[SCM] kdeconnect packaging branch, master, updated. upstream/1.0.1-206-gf661872
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 18:27:01 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=d9e7f30
The following commit has been merged in the master branch:
commit d9e7f308c21fc78fb3f75270e7c67e9a1e4a3536
Author: Aleix Pol <aleixpol at kde.org>
Date: Sun Aug 21 19:38:15 2016 +0200
Show the announcedName in the qml app
Makes it possible to display it and modify it
Introduces a DBusProperty component that can be used if we don't want
to go through the QtDBus property generation hell.
---
app/qml/main.qml | 18 +++++++++
core/daemon.cpp | 1 +
core/daemon.h | 1 +
plasmoid/declarativeplugin/CMakeLists.txt | 2 +-
.../kdeconnectdeclarativeplugin.cpp | 5 +++
.../qml/{PluginChecker.qml => DBusProperty.qml} | 47 +++++++++++++++-------
plasmoid/declarativeplugin/qmldir | 1 +
7 files changed, 60 insertions(+), 15 deletions(-)
diff --git a/app/qml/main.qml b/app/qml/main.qml
index 0e58b30..46541cd 100644
--- a/app/qml/main.qml
+++ b/app/qml/main.qml
@@ -50,6 +50,24 @@ Kirigami.ApplicationWindow
titleIcon: "kdeconnect"
// bannerImageSource: "/home/apol/devel/kde5/share/wallpapers/Next/contents/images/1024x768.png"
+ topContent: [
+ TextField {
+ Layout.fillWidth: true
+
+ DBusProperty {
+ id: announcedNameProperty
+ object: DaemonDbusInterface
+ read: "announcedName"
+ defaultValue: ""
+ }
+
+ text: announcedNameProperty.value
+ onAccepted: {
+ DaemonDbusInterface.setAnnouncedName(text)
+ text = Qt.binding(function() {return announcedNameProperty.value})
+ }
+ }
+ ]
property var objects: [findDevicesAction]
Instantiator {
model: DevicesSortProxyModel {
diff --git a/core/daemon.cpp b/core/daemon.cpp
index 129a535..b8323e6 100644
--- a/core/daemon.cpp
+++ b/core/daemon.cpp
@@ -214,6 +214,7 @@ void Daemon::setAnnouncedName(const QString &name)
qCDebug(KDECONNECT_CORE()) << "Announcing name";
KdeConnectConfig::instance()->setName(name);
forceOnNetworkChange();
+ Q_EMIT announcedNameChanged(name);
}
QString Daemon::announcedName()
diff --git a/core/daemon.h b/core/daemon.h
index 8b3fab0..dde33d3 100644
--- a/core/daemon.h
+++ b/core/daemon.h
@@ -73,6 +73,7 @@ Q_SIGNALS:
Q_SCRIPTABLE void deviceAdded(const QString& id);
Q_SCRIPTABLE void deviceRemoved(const QString& id); //Note that paired devices will never be removed
Q_SCRIPTABLE void deviceVisibilityChanged(const QString& id, bool isVisible);
+ Q_SCRIPTABLE void announcedNameChanged(const QString &announcedName);
private Q_SLOTS:
void onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* dl);
diff --git a/plasmoid/declarativeplugin/CMakeLists.txt b/plasmoid/declarativeplugin/CMakeLists.txt
index ec86925..b32738a 100644
--- a/plasmoid/declarativeplugin/CMakeLists.txt
+++ b/plasmoid/declarativeplugin/CMakeLists.txt
@@ -21,4 +21,4 @@ target_link_libraries(kdeconnectdeclarativeplugin
kdeconnectinterfaces
)
install(TARGETS kdeconnectdeclarativeplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kdeconnect)
-install(FILES qmldir qml/PluginChecker.qml DESTINATION ${QML_INSTALL_DIR}/org/kde/kdeconnect)
+install(FILES qmldir qml/PluginChecker.qml qml/DBusProperty.qml DESTINATION ${QML_INSTALL_DIR}/org/kde/kdeconnect)
diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
index aec6be4..1a1a4a3 100644
--- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
+++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
@@ -86,6 +86,11 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
qmlRegisterUncreatableType<FindMyPhoneDeviceDbusInterface>(uri, 1, 0, "FindMyPhoneDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
+ qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface",
+ [](QQmlEngine*, QJSEngine*) -> QObject* {
+ return new DaemonDbusInterface;
+ }
+ );
}
void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri)
diff --git a/plasmoid/declarativeplugin/qml/PluginChecker.qml b/plasmoid/declarativeplugin/qml/DBusProperty.qml
similarity index 51%
copy from plasmoid/declarativeplugin/qml/PluginChecker.qml
copy to plasmoid/declarativeplugin/qml/DBusProperty.qml
index dfd1114..30527de 100644
--- a/plasmoid/declarativeplugin/qml/PluginChecker.qml
+++ b/plasmoid/declarativeplugin/qml/DBusProperty.qml
@@ -1,6 +1,5 @@
/**
- * Copyright 2014 Samoilenko Yuri <kinnalru at gmail.com>
- * Copyright 2016 David Kahles <david.kahles96 at gmail.com>
+ * Copyright 2016 Aleix Pol Gonzalez <aleixpol at 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
@@ -23,28 +22,48 @@ import QtQml 2.2
import org.kde.kdeconnect 1.0
QtObject {
+ id: prop
+ property QtObject object: null
+ property string read
+ property string change: read+"Changed"
- id: root
+ Component.onCompleted: get();
- property alias device: conn.target
- property string pluginName: ""
- property bool available: false
+ onChangeChanged: {
+ if (object) {
+ var theSignal = object[change];
+ if (theSignal) {
+ theSignal.connect(valueReceived);
+ } else {
+ console.warn("couldn't find signal", change, "for", object)
+ }
+ }
+ }
- readonly property Connections connection: Connections {
- id: conn
- onPluginsChanged: pluginsChanged()
+ function valueReceived(val) {
+ if (!val) {
+ get();
+ } else {
+ _value = val;
+ }
}
- Component.onCompleted: pluginsChanged()
+ property var defaultValue
+ property var _value: defaultValue
+ readonly property var value: _value
readonly property var v: DBusAsyncResponse {
id: response
autoDelete: false
- onSuccess: { root.available = result; }
- onError: { root.available = false }
+ onSuccess: {
+ prop._value = result;
+ }
+ onError: {
+ console.warn("failed call", object, read, write, change)
+ }
}
- function pluginsChanged() {
- response.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName))
+ function get() {
+ response.setPendingCall(object[read]());
}
}
diff --git a/plasmoid/declarativeplugin/qmldir b/plasmoid/declarativeplugin/qmldir
index 638deac..80d0bc1 100644
--- a/plasmoid/declarativeplugin/qmldir
+++ b/plasmoid/declarativeplugin/qmldir
@@ -2,3 +2,4 @@ module org.kde.kdeconnect
plugin kdeconnectdeclarativeplugin
PluginChecker 1.0 PluginChecker.qml
+DBusProperty 1.0 DBusProperty.qml
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list