File: shelldbusobject.cpp

package info (click to toggle)
plasma-mobile 6.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,412 kB
  • sloc: xml: 38,474; cpp: 18,529; javascript: 139; sh: 82; makefile: 5
file content (157 lines) | stat: -rw-r--r-- 3,716 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "shelldbusobject.h"
#include "mobileadaptor.h"

#include <QDBusConnection>

ShellDBusObject::ShellDBusObject(QObject *parent)
    : QObject{parent}
    , m_startupFeedbackModel{new StartupFeedbackModel{this}}
{
}

void ShellDBusObject::registerObject()
{
    if (!m_initialized) {
        new PlasmashellAdaptor{this};
        QDBusConnection::sessionBus().registerObject(QStringLiteral("/Mobile"), this);
        m_initialized = true;
    }
}

StartupFeedbackModel *ShellDBusObject::startupFeedbackModel()
{
    return m_startupFeedbackModel;
}

bool ShellDBusObject::doNotDisturb()
{
    return m_doNotDisturb;
}

void ShellDBusObject::setDoNotDisturb(bool value)
{
    if (value != m_doNotDisturb) {
        m_doNotDisturb = value;
        Q_EMIT doNotDisturbChanged();
    }
}

QString ShellDBusObject::panelState()
{
    return m_panelState;
}

void ShellDBusObject::setPanelState(QString state)
{
    if (state != m_panelState) {
        m_panelState = state;
        Q_EMIT panelStateChanged();
    }
}


bool ShellDBusObject::isActionDrawerOpen()
{
    return m_isActionDrawerOpen;
}

void ShellDBusObject::setIsActionDrawerOpen(bool value)
{
    if (value != m_isActionDrawerOpen) {
        m_isActionDrawerOpen = value;
        Q_EMIT isActionDrawerOpenChanged();
    }
}

bool ShellDBusObject::isVolumeOSDOpen()
{
    return m_isVolumeOSDOpen;
}

void ShellDBusObject::setIsVolumeOSDOpen(bool value)
{
    if (value != m_isVolumeOSDOpen) {
        m_isVolumeOSDOpen = value;
        Q_EMIT isVolumeOSDOpenChanged();
    }
}

bool ShellDBusObject::isNotificationPopupDrawerOpen()
{
    return m_isNotificationPopupDrawerOpen;
}

void ShellDBusObject::setIsNotificationPopupDrawerOpen(bool value)
{
    if (value != m_isNotificationPopupDrawerOpen) {
        m_isNotificationPopupDrawerOpen = value;
        Q_EMIT isNotificationPopupDrawerOpenChanged();
    }
}

bool ShellDBusObject::isTaskSwitcherVisible()
{
    return m_isTaskSwitcherVisible;
}

void ShellDBusObject::setIsTaskSwitcherVisible(bool value)
{
    if (value != m_isTaskSwitcherVisible) {
        m_isTaskSwitcherVisible = value;
        Q_EMIT isTaskSwitcherVisibleChanged();
    }
}

void ShellDBusObject::openActionDrawer()
{
    Q_EMIT openActionDrawerRequested();
}

void ShellDBusObject::closeActionDrawer()
{
    Q_EMIT closeActionDrawerRequested();
}

void ShellDBusObject::openAppLaunchAnimationWithPosition(int screen,
                                                         QString splashIcon,
                                                         QString title,
                                                         QString storageId,
                                                         qreal x,
                                                         qreal y,
                                                         qreal sourceIconSize)
{
    if (!m_startupFeedbackModel) {
        return;
    }

    StartupFeedback *feedback = new StartupFeedback{m_startupFeedbackModel, splashIcon, title, storageId, x, y, sourceIconSize, screen};
    m_startupFeedbackModel->addApp(feedback);
}

void ShellDBusObject::triggerAppLaunchMaximizePanelAnimation(int screen, QString color)
{
    Q_EMIT appLaunchMaximizePanelAnimationTriggered(screen, color);
}

void ShellDBusObject::openHomeScreen()
{
    Q_EMIT openHomeScreenRequested();
}

void ShellDBusObject::resetHomeScreenPosition()
{
    Q_EMIT resetHomeScreenPositionRequested();
}

void ShellDBusObject::showVolumeOSD()
{
    Q_EMIT showVolumeOSDRequested();
}

void ShellDBusObject::openLockScreenKeypad()
{
    Q_EMIT openLockScreenKeypadRequested();
}