File indexing completed on 2024-06-16 05:08:35
0001 /* 0002 SPDX-FileCopyrightText: 2016 Aditya Mehra <aix.m@outlook.com> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #include "biglauncher_dbus.h" 0007 #include "configuration.h" 0008 #include <QByteArray> 0009 #include <QList> 0010 #include <QMap> 0011 #include <QMetaObject> 0012 #include <QString> 0013 #include <QVariant> 0014 0015 /* 0016 * Implementation of adaptor class BigLauncherDbusAdapterInterface 0017 */ 0018 0019 BigLauncherDbusAdapterInterface::BigLauncherDbusAdapterInterface(QObject *parent) 0020 : QDBusAbstractAdaptor(parent) 0021 { 0022 // constructor 0023 QDBusConnection dbus = QDBusConnection::sessionBus(); 0024 dbus.registerObject("/BigLauncher", this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportNonScriptableSlots); 0025 dbus.registerService("org.kde.biglauncher"); 0026 setAutoRelaySignals(true); 0027 } 0028 0029 BigLauncherDbusAdapterInterface::~BigLauncherDbusAdapterInterface() 0030 { 0031 // destructor 0032 } 0033 0034 void BigLauncherDbusAdapterInterface::useColoredTiles(const bool &coloredTiles) 0035 { 0036 Q_EMIT useColoredTilesChanged(coloredTiles); 0037 } 0038 0039 void BigLauncherDbusAdapterInterface::useExpandableTiles(const bool &expandableTiles) 0040 { 0041 Q_EMIT useExpandableTilesChanged(expandableTiles); 0042 } 0043 0044 void BigLauncherDbusAdapterInterface::enableMycroftIntegration(const bool &mycroftIntegration) 0045 { 0046 Configuration::self().setMycroftEnabled(mycroftIntegration); 0047 Q_EMIT enableMycroftIntegrationChanged(mycroftIntegration); 0048 } 0049 0050 void BigLauncherDbusAdapterInterface::enablePmInhibition(const bool &pmInhibition) 0051 { 0052 Configuration::self().setPmInhibitionEnabled(pmInhibition); 0053 Q_EMIT enablePmInhibitionChanged(pmInhibition); 0054 } 0055 0056 bool BigLauncherDbusAdapterInterface::coloredTilesActive() 0057 { 0058 if(m_useColoredTiles) { 0059 return 1; 0060 } else { 0061 return 0; 0062 } 0063 } 0064 0065 bool BigLauncherDbusAdapterInterface::expandableTilesActive() 0066 { 0067 if(m_useExpandableTiles) { 0068 return 1; 0069 } else { 0070 return 0; 0071 } 0072 } 0073 0074 bool BigLauncherDbusAdapterInterface::mycroftIntegrationActive() 0075 { 0076 return Configuration::self().mycroftEnabled(); 0077 } 0078 0079 bool BigLauncherDbusAdapterInterface::pmInhibitionActive() 0080 { 0081 return Configuration::self().pmInhibitionEnabled(); 0082 } 0083 0084 void BigLauncherDbusAdapterInterface::setColoredTilesActive(const bool &coloredTilesActive) 0085 { 0086 m_useColoredTiles = coloredTilesActive; 0087 } 0088 0089 void BigLauncherDbusAdapterInterface::setExpandableTilesActive(const bool &expandableTilesActive) 0090 { 0091 m_useExpandableTiles = expandableTilesActive; 0092 } 0093 0094 Q_INVOKABLE QString BigLauncherDbusAdapterInterface::getMethod(const QString &method) 0095 { 0096 QString str = method; 0097 return str; 0098 }