[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:27:59 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=1abf068

The following commit has been merged in the master branch:
commit 1abf0686f5e10e9c09dbcc53f2625974d88818f2
Author: Aleix Pol <aleixpol at kde.org>
Date:   Mon Sep 22 02:26:06 2014 +0200

    Port kdeconnect-cli away from kdelibs4supposrt
---
 cli/CMakeLists.txt     |  2 +-
 cli/kdeconnect-cli.cpp | 67 ++++++++++++++++++++++++++------------------------
 2 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
index 3297abe..026b80d 100644
--- a/cli/CMakeLists.txt
+++ b/cli/CMakeLists.txt
@@ -2,6 +2,6 @@ include_directories(${CMAKE_SOURCE_DIR})
 
 add_executable(kdeconnect-cli kdeconnect-cli.cpp)
 
-target_link_libraries(kdeconnect-cli kdeconnectinterfaces Qt5::Gui KF5::KDELibs4Support)
+target_link_libraries(kdeconnect-cli kdeconnectinterfaces Qt5::Gui KF5::CoreAddons KF5::I18n)
 
 install(TARGETS kdeconnect-cli ${INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
index 21d7eab..d899968 100644
--- a/cli/kdeconnect-cli.cpp
+++ b/cli/kdeconnect-cli.cpp
@@ -18,36 +18,39 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <KApplication>
-#include <kcmdlineargs.h>
-#include <k4aboutdata.h>
 #include <interfaces/devicesmodel.h>
 #include <interfaces/notificationsmodel.h>
 #include <interfaces/dbusinterfaces.h>
 #include <iostream>
 #include <QDBusMessage>
 #include <QDBusConnection>
+#include <QGuiApplication>
+#include <KAboutData>
+#include <KLocalizedString>
 
 int main(int argc, char** argv)
 {
-    K4AboutData about("kdeconnect-cli", "kdeconnect-cli", ki18n(("kdeconnect-cli")), "1.0", ki18n("KDE Connect CLI tool"),
-                     K4AboutData::License_GPL, ki18n("(C) 2013 Aleix Pol Gonzalez"));
+    QGuiApplication app(argc, argv);
+    KAboutData about("kdeconnect-cli", i18n("kdeconnect-cli"), "1.0", i18n("KDE Connect CLI tool"),
+                     KAboutLicense::GPL, i18n("(C) 2013 Aleix Pol Gonzalez"));
+    KAboutData::setApplicationData(about);
 
-    about.addAuthor( ki18n("Aleix Pol Gonzalez"), KLocalizedString(), "aleixpol at kde.org" );
-    KCmdLineArgs::init(argc, argv, &about);
-    KCmdLineOptions options;
-    options.add("l")
-           .add("list-devices", ki18n("List all devices"));
-    options.add("share <path>", ki18n("Share a file to a said device"));
-    options.add("pair", ki18n("Request pairing to a said device"));
-    options.add("unpair", ki18n("Stop pairing to a said device"));
-    options.add("ping", ki18n("Sends a ping to said device"));
-    options.add("list-notifications", ki18n("Display the notifications on a said device"));
-    options.add("device <dev>", ki18n("Device ID"));
-    KCmdLineArgs::addCmdLineOptions( options );
-    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
-    KApplication app;
-    if(args->isSet("l")) {
+    about.addAuthor( i18n("Aleix Pol Gonzalez"), QString(), "aleixpol at kde.org" );
+    QCommandLineParser parser;
+    parser.addOption(QCommandLineOption(QStringList("l") << "list-devices", i18n("List all devices")));
+    parser.addOption(QCommandLineOption("share", i18n("Share a file to a said device"), "path"));
+    parser.addOption(QCommandLineOption("pair", i18n("Request pairing to a said device")));
+    parser.addOption(QCommandLineOption("unpair", i18n("Stop pairing to a said device")));
+    parser.addOption(QCommandLineOption("ping", i18n("Sends a ping to said device")));
+    parser.addOption(QCommandLineOption("list-notifications", i18n("Display the notifications on a said device")));
+    parser.addOption(QCommandLineOption("device", i18n("Device ID"), "dev"));
+    about.setupCommandLine(&parser);
+
+    parser.addHelpOption();
+    parser.process(app);
+    about.processCommandLine(&parser);
+
+    if(parser.isSet("l")) {
         DevicesModel devices;
         for(int i=0, rows=devices.rowCount(); i<rows; ++i) {
             QModelIndex idx = devices.index(i);
@@ -69,21 +72,21 @@ int main(int argc, char** argv)
         std::cout << devices.rowCount() << " devices found" << std::endl;
     } else {
         QString device;
-        if(!args->isSet("device")) {
-            KCmdLineArgs::usageError(i18n("No device specified"));
+        if(!parser.isSet("device")) {
+            qCritical() << (i18n("No device specified"));
         }
-        device = args->getOption("device");
+        device = parser.value("device");
         QUrl url;
-        if(args->isSet("share")) {
-            url = args->makeURL(args->getOption("share").toLatin1());
-            args->clear();
+        if(parser.isSet("share")) {
+            url = QUrl::fromUserInput(parser.value("share"));
+            parser.clearPositionalArguments();
             if(!url.isEmpty() && !device.isEmpty()) {
                 QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/share", "org.kde.kdeconnect.device.share", "shareUrl");
                 msg.setArguments(QVariantList() << url.toString());
                 QDBusConnection::sessionBus().call(msg);
             } else
-                KCmdLineArgs::usageError(i18n("Couldn't share %1", url.toString()));
-        } else if(args->isSet("pair")) {
+                qCritical() << (i18n("Couldn't share %1", url.toString()));
+        } else if(parser.isSet("pair")) {
             DeviceDbusInterface dev(device);
             if(dev.isPaired())
                 std::cout << "Already paired" << std::endl;
@@ -91,7 +94,7 @@ int main(int argc, char** argv)
                 QDBusPendingReply<void> req = dev.requestPair();
                 req.waitForFinished();
             }
-        } else if(args->isSet("unpair")) {
+        } else if(parser.isSet("unpair")) {
             DeviceDbusInterface dev(device);
             if(!dev.isPaired())
                 std::cout << "Already not paired" << std::endl;
@@ -99,10 +102,10 @@ int main(int argc, char** argv)
                 QDBusPendingReply<void> req = dev.unpair();
                 req.waitForFinished();
             }
-        } else if(args->isSet("ping")) {
+        } else if(parser.isSet("ping")) {
             QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/ping", "org.kde.kdeconnect.device.ping", "sendPing");
             QDBusConnection::sessionBus().call(msg);
-        } else if(args->isSet("list-notifications")) {
+        } else if(parser.isSet("list-notifications")) {
             NotificationsModel notifications;
             notifications.setDeviceId(device);
             for(int i=0, rows=notifications.rowCount(); i<rows; ++i) {
@@ -111,7 +114,7 @@ int main(int argc, char** argv)
                 << ": " << idx.data(NotificationsModel::NameModelRole).toString().toStdString() << std::endl;
             }
         } else {
-            KCmdLineArgs::usageError(i18n("Nothing to be done with the device"));
+            qCritical() << i18n("Nothing to be done with the device");
         }
     }
     QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list