[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:29:09 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=7f794c0
The following commit has been merged in the master branch:
commit 7f794c093a35ec98a5e6c857abf6f44d2a7fb049
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Sat Sep 12 22:07:05 2015 +0200
Fixed the CLI
Enter discoverability mode if pairing with an unpaired device.
Use the correct isPaired. This exists as a method and a property,
callign the method returns QDbusPendingReply which shouldn't be checked
immediately
---
cli/kdeconnect-cli.cpp | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
index e869ff4..0a12b6a 100644
--- a/cli/kdeconnect-cli.cpp
+++ b/cli/kdeconnect-cli.cpp
@@ -65,9 +65,10 @@ int main(int argc, char** argv)
parser.process(app);
about.processCommandLine(&parser);
+ const QString id = "kdeconnect-cli-"+QString::number(QCoreApplication::applicationPid());
+ DaemonDbusInterface iface;
+
if(parser.isSet("l") || parser.isSet("a")) {
- const QString id = "kdeconnect-cli-"+QString::number(QCoreApplication::applicationPid());
- DaemonDbusInterface iface;
bool paired = true, reachable = false;
if (parser.isSet("a")) {
reachable = true;
@@ -85,7 +86,7 @@ int main(int argc, char** argv)
} else {
DeviceDbusInterface deviceIface(id);
QString statusInfo;
- const bool isReachable = deviceIface.isReachable(), isPaired = deviceIface.isPaired();
+ const bool isReachable = deviceIface.isReachable(), isPaired = deviceIface.property("isPaired").toBool();
if (isReachable && isPaired) {
statusInfo = i18n("(paired and reachable)");
} else if (isReachable) {
@@ -124,17 +125,40 @@ int main(int argc, char** argv)
}
} else if(parser.isSet("pair")) {
DeviceDbusInterface dev(device);
- if(dev.isPaired())
+ if (!dev.isReachable()) {
+ //Device doesn't exist, go into discovery mode and wait up to 30 seconds for the device to appear
+ QEventLoop wait;
+ QTextStream(stderr) << i18n("waiting for device...") << endl;
+ iface.acquireDiscoveryMode(id);
+
+ QObject::connect(&iface, &DaemonDbusInterface::deviceAdded, [&](const QString &deviceAddedId) {
+ if (device == deviceAddedId) {
+ wait.quit();
+ }
+ });
+ QTimer::singleShot(30 * 1000, &wait, &QEventLoop::quit);
+
+ wait.exec();
+ }
+
+ if (!dev.isReachable()) {
+ QTextStream(stderr) << i18n("Device not found") << endl;
+ } else if(dev.property("isPaired").toBool()) {
QTextStream(stderr) << i18n("Already paired") << endl;
- else {
+ } else {
+ QTextStream(stderr) << i18n("Pair requested") << endl;
QDBusPendingReply<void> req = dev.requestPair();
req.waitForFinished();
}
+ iface.releaseDiscoveryMode(id);
} else if(parser.isSet("unpair")) {
DeviceDbusInterface dev(device);
- if(!dev.isPaired())
+ if (!dev.isReachable()) {
+ QTextStream(stderr) << i18n("Device does not exist") << endl;
+ } else if(!dev.property("isPaired").toBool()) {
QTextStream(stderr) << i18n("Already not paired") << endl;
- else {
+ } else {
+ QTextStream(stderr) << i18n("Unpaired") << endl;
QDBusPendingReply<void> req = dev.unpair();
req.waitForFinished();
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list