diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp index 7ff163821..088165b01 100644 --- a/interfaces/notificationsmodel.cpp +++ b/interfaces/notificationsmodel.cpp @@ -159,13 +159,13 @@ QVariant NotificationsModel::data(const QModelIndex& index, int role) const case IconModelRole: return KIcon("device-notifier").pixmap(32, 32); case IdModelRole: - return QString(notification->internalId()); + return notification->internalId(); case NameModelRole: - return QString(notification->ticker()); + return notification->ticker(); case ContentModelRole: return QString(); //To implement in the Android side case AppNameModelRole: - return QString(notification->appName()); + return notification->appName(); case DbusInterfaceRole: return qVariantFromValue(notification); case DismissableModelRole: diff --git a/plasmoid/declarativeplugin/CMakeLists.txt b/plasmoid/declarativeplugin/CMakeLists.txt index 4b8579259..b483e790b 100644 --- a/plasmoid/declarativeplugin/CMakeLists.txt +++ b/plasmoid/declarativeplugin/CMakeLists.txt @@ -6,6 +6,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} set(kdeconnectdeclarativeplugin_SRC kdeconnectdeclarativeplugin.cpp responsewaiter.cpp + processrunner.cpp ) set(kdeconnectdeclarativeplugin_MOC diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp index 9ea7f16f7..5b9716f09 100644 --- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp +++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp @@ -28,6 +28,7 @@ #include "objectfactory.h" #include "responsewaiter.h" +#include "processrunner.h" #include "interfaces/devicesmodel.h" #include "interfaces/notificationsmodel.h" @@ -59,6 +60,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri) qmlRegisterType("org.kde.kdeconnect", 1, 0, "DevicesModel"); qmlRegisterType("org.kde.kdeconnect", 1, 0, "NotificationsModel"); qmlRegisterType("org.kde.kdeconnect", 1, 0, "DBusAsyncResponse"); + qmlRegisterType(uri, 1, 0, "ProcessRunner"); } void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri) diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.h b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.h index 8c9ecd288..85d0cf04f 100644 --- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.h +++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.h @@ -18,8 +18,8 @@ * along with this program. If not, see . */ -#ifndef ANALITZADECLARATIVEPLUGIN_H -#define ANALITZADECLARATIVEPLUGIN_H +#ifndef KDECONNECTDECLARATIVEPLUGIN_H +#define KDECONNECTDECLARATIVEPLUGIN_H #include @@ -33,8 +33,4 @@ class KdeConnectDeclarativePlugin : public QQmlExtensionPlugin virtual void initializeEngine(QQmlEngine *engine, const char *uri); }; - - - - -#endif // ANALITZADECLARATIVEPLUGIN_H +#endif // KDECONNECTDECLARATIVEPLUGIN_H diff --git a/plasmoid/declarativeplugin/processrunner.cpp b/plasmoid/declarativeplugin/processrunner.cpp new file mode 100644 index 000000000..aa57aaf95 --- /dev/null +++ b/plasmoid/declarativeplugin/processrunner.cpp @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2013 by Eike Hein * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * + ***************************************************************************/ + +#include "processrunner.h" + +#include + +ProcessRunner::ProcessRunner(QObject *parent) : QObject(parent) +{ +} + +ProcessRunner::~ProcessRunner() +{ +} + +void ProcessRunner::runKdeconnectKCM() +{ + QProcess::startDetached("kcmshell5", QStringList() << "kcm_kdeconnect"); +} diff --git a/plasmoid/declarativeplugin/processrunner.h b/plasmoid/declarativeplugin/processrunner.h new file mode 100644 index 000000000..20e86e69b --- /dev/null +++ b/plasmoid/declarativeplugin/processrunner.h @@ -0,0 +1,36 @@ +/*************************************************************************** + * Copyright (C) 2013 by Eike Hein * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * + ***************************************************************************/ + +#ifndef PROCESSRUNNER_H +#define PROCESSRUNNER_H + +#include + +class ProcessRunner : public QObject +{ + Q_OBJECT + +public: + ProcessRunner(QObject *parent = 0); + ~ProcessRunner(); + + Q_INVOKABLE void runKdeconnectKCM(); +}; + +#endif diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 28b584943..71e66b1d5 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -21,6 +21,7 @@ import QtQuick 2.1 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 +import org.kde.kdeconnect 1.0 Item { @@ -35,4 +36,17 @@ Item Plasmoid.fullRepresentation: FullRepresentation {} Plasmoid.preferredRepresentation: isConstrained() ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation + + ProcessRunner { + id: processRunner + } + + function action_launchkcm() { + processRunner.runKdeconnectKCM(); + } + + Component.onCompleted: { + plasmoid.removeAction("configure"); + plasmoid.setAction("launchkcm", i18n("KDE Connect Settings..."), "configure"); + } } diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index ba579259b..5d32f7cee 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -85,7 +85,6 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np) } addNotification(noti); - } } @@ -106,7 +105,6 @@ void NotificationsDbusInterface::addNotification(Notification* noti) QDBusConnection::sessionBus().registerObject(mDevice->dbusPath()+"/notifications/"+publicId, noti, QDBusConnection::ExportScriptableContents); Q_EMIT notificationPosted(publicId); - } void NotificationsDbusInterface::removeNotification(const QString& internalId)