File indexing completed on 2024-05-12 05:36:09
0001 // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #include "shelldbusobject.h" 0005 #include "mobileadaptor.h" 0006 0007 #include <QDBusConnection> 0008 0009 ShellDBusObject::ShellDBusObject(QObject *parent) 0010 : QObject{parent} 0011 { 0012 } 0013 0014 void ShellDBusObject::registerObject() 0015 { 0016 if (!m_initialized) { 0017 new PlasmashellAdaptor{this}; 0018 QDBusConnection::sessionBus().registerObject(QStringLiteral("/Mobile"), this); 0019 m_initialized = true; 0020 } 0021 } 0022 0023 bool ShellDBusObject::doNotDisturb() 0024 { 0025 return m_doNotDisturb; 0026 } 0027 0028 void ShellDBusObject::setDoNotDisturb(bool value) 0029 { 0030 if (value != m_doNotDisturb) { 0031 m_doNotDisturb = value; 0032 Q_EMIT doNotDisturbChanged(); 0033 } 0034 } 0035 0036 bool ShellDBusObject::isActionDrawerOpen() 0037 { 0038 return m_isActionDrawerOpen; 0039 } 0040 0041 void ShellDBusObject::setIsActionDrawerOpen(bool value) 0042 { 0043 if (value != m_isActionDrawerOpen) { 0044 m_isActionDrawerOpen = value; 0045 Q_EMIT isActionDrawerOpenChanged(); 0046 } 0047 } 0048 0049 bool ShellDBusObject::isTaskSwitcherVisible() 0050 { 0051 return m_isTaskSwitcherVisible; 0052 } 0053 0054 void ShellDBusObject::setIsTaskSwitcherVisible(bool value) 0055 { 0056 if (value != m_isTaskSwitcherVisible) { 0057 m_isTaskSwitcherVisible = value; 0058 Q_EMIT isTaskSwitcherVisibleChanged(); 0059 } 0060 } 0061 0062 void ShellDBusObject::openActionDrawer() 0063 { 0064 Q_EMIT openActionDrawerRequested(); 0065 } 0066 0067 void ShellDBusObject::closeActionDrawer() 0068 { 0069 Q_EMIT closeActionDrawerRequested(); 0070 } 0071 0072 void ShellDBusObject::openAppLaunchAnimation(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize) 0073 { 0074 Q_EMIT openAppLaunchAnimationRequested(splashIcon, title, x, y, sourceIconSize); 0075 } 0076 0077 void ShellDBusObject::closeAppLaunchAnimation() 0078 { 0079 Q_EMIT closeAppLaunchAnimationRequested(); 0080 } 0081 0082 void ShellDBusObject::openHomeScreen() 0083 { 0084 Q_EMIT openHomeScreenRequested(); 0085 } 0086 0087 void ShellDBusObject::resetHomeScreenPosition() 0088 { 0089 Q_EMIT resetHomeScreenPositionRequested(); 0090 } 0091 0092 void ShellDBusObject::showVolumeOSD() 0093 { 0094 Q_EMIT showVolumeOSDRequested(); 0095 }