File indexing completed on 2024-10-06 13:17:41
0001 /* 0002 * Copyright (C) 2016 by Aditya Mehra <aix.m@outlook.com> * 0003 * This program is free software; you can redistribute it and/or modify 0004 * it under the terms of the GNU Library General Public License as 0005 * published by the Free Software Foundation; either version 2, or 0006 * (at your option) any later version. 0007 * 0008 * This program is distributed in the hope that it will be useful, 0009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0011 * GNU General Public License for more details 0012 * 0013 * You should have received a copy of the GNU Library General Public 0014 * License along with this program; if not, write to the 0015 * Free Software Foundation, Inc., 0016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #include "mycroftplasmoid_dbus.h" 0020 #include "mycroftplasmoidmobileplugin.h" 0021 #include <QMetaObject> 0022 #include <QByteArray> 0023 #include <QList> 0024 #include <QMap> 0025 #include <QString> 0026 #include <QStringList> 0027 #include <QVariant> 0028 #include <QtDBus> 0029 0030 /* 0031 * Implementation of adaptor class MycroftDbusAdapterInterface 0032 */ 0033 0034 MycroftDbusAdapterInterface::MycroftDbusAdapterInterface(QObject *parent) 0035 : QDBusAbstractAdaptor(parent) 0036 { 0037 // constructor 0038 QDBusConnection dbus = QDBusConnection::sessionBus(); 0039 dbus.registerObject("/mycroftapplet", this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportNonScriptableSlots); 0040 dbus.registerService("org.kde.mycroftapplet"); 0041 setAutoRelaySignals(true); 0042 } 0043 0044 MycroftDbusAdapterInterface::~MycroftDbusAdapterInterface() 0045 { 0046 // destructor 0047 } 0048 0049 void MycroftDbusAdapterInterface::showMycroft() 0050 { 0051 // handle method call org.kde.mycroft.showMycroft 0052 emit sendShowMycroft("Show"); 0053 QMetaObject::invokeMethod(this, "getMethod", Qt::DirectConnection, Q_ARG(QString, "Show")); 0054 } 0055 0056 void MycroftDbusAdapterInterface::showSkills() 0057 { 0058 // handle method call org.kde.mycroft.showSkills 0059 emit sendShowSkills("ShowSkills"); 0060 //QMetaObject::invokeMethod(this, "showSkills"); 0061 } 0062 0063 void MycroftDbusAdapterInterface::showSkillsInstaller() 0064 { 0065 // handle method call org.kde.mycroft.showSkillsInstaller 0066 emit sendShowInstallSkills("ShowInstallSkills"); 0067 //QMetaObject::invokeMethod(this, "showSkillsInstaller"); 0068 } 0069 0070 Q_INVOKABLE QString MycroftDbusAdapterInterface::getMethod(const QString &method) 0071 { 0072 QString str = method; 0073 return str; 0074 } 0075