fix the Configure action
display the kdeconnect kcm
This commit is contained in:
parent
e3237881aa
commit
994057af0e
8 changed files with 94 additions and 12 deletions
|
@ -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<QObject*>(notification);
|
||||
case DismissableModelRole:
|
||||
|
|
|
@ -6,6 +6,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
|
|||
set(kdeconnectdeclarativeplugin_SRC
|
||||
kdeconnectdeclarativeplugin.cpp
|
||||
responsewaiter.cpp
|
||||
processrunner.cpp
|
||||
)
|
||||
|
||||
set(kdeconnectdeclarativeplugin_MOC
|
||||
|
|
|
@ -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<DevicesModel>("org.kde.kdeconnect", 1, 0, "DevicesModel");
|
||||
qmlRegisterType<NotificationsModel>("org.kde.kdeconnect", 1, 0, "NotificationsModel");
|
||||
qmlRegisterType<DBusAsyncResponse>("org.kde.kdeconnect", 1, 0, "DBusAsyncResponse");
|
||||
qmlRegisterType<ProcessRunner>(uri, 1, 0, "ProcessRunner");
|
||||
}
|
||||
|
||||
void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri)
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ANALITZADECLARATIVEPLUGIN_H
|
||||
#define ANALITZADECLARATIVEPLUGIN_H
|
||||
#ifndef KDECONNECTDECLARATIVEPLUGIN_H
|
||||
#define KDECONNECTDECLARATIVEPLUGIN_H
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
|
@ -33,8 +33,4 @@ class KdeConnectDeclarativePlugin : public QQmlExtensionPlugin
|
|||
virtual void initializeEngine(QQmlEngine *engine, const char *uri);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // ANALITZADECLARATIVEPLUGIN_H
|
||||
#endif // KDECONNECTDECLARATIVEPLUGIN_H
|
||||
|
|
35
plasmoid/declarativeplugin/processrunner.cpp
Normal file
35
plasmoid/declarativeplugin/processrunner.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Eike Hein <hein@kde.org> *
|
||||
* *
|
||||
* 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 <QProcess>
|
||||
|
||||
ProcessRunner::ProcessRunner(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ProcessRunner::~ProcessRunner()
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessRunner::runKdeconnectKCM()
|
||||
{
|
||||
QProcess::startDetached("kcmshell5", QStringList() << "kcm_kdeconnect");
|
||||
}
|
36
plasmoid/declarativeplugin/processrunner.h
Normal file
36
plasmoid/declarativeplugin/processrunner.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Eike Hein <hein@kde.org> *
|
||||
* *
|
||||
* 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 <QObject>
|
||||
|
||||
class ProcessRunner : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProcessRunner(QObject *parent = 0);
|
||||
~ProcessRunner();
|
||||
|
||||
Q_INVOKABLE void runKdeconnectKCM();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue