[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:31 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=d592819
The following commit has been merged in the master branch:
commit d5928197b2d86272dfc228a03df7c38d21501324
Author: Aleix Pol <aleixpol at kde.org>
Date: Tue Apr 1 03:12:31 2014 +0200
CLI application to interact with kdeconnect kded module
Lists devices and makes it possible to share a url or a file with any
device.
REVIEW: 113343
---
CMakeLists.txt | 1 +
cli/CMakeLists.txt | 7 +++++
cli/kdeconnect-cli.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b823023..dd7c82d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,5 +18,6 @@ add_subdirectory(kcm)
add_subdirectory(kio)
add_subdirectory(plasmoid)
add_subdirectory(icon)
+add_subdirectory(cli)
add_subdirectory(tests)
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
new file mode 100644
index 0000000..6bc525e
--- /dev/null
+++ b/cli/CMakeLists.txt
@@ -0,0 +1,7 @@
+include_directories(${CMAKE_SOURCE_DIR})
+
+add_executable(kdeconnect-cli kdeconnect-cli.cpp)
+
+target_link_libraries(kdeconnect-cli kdeconnect ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBS})
+
+install(TARGETS kdeconnect-cli ${INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
new file mode 100644
index 0000000..1e87937
--- /dev/null
+++ b/cli/kdeconnect-cli.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2013 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
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <KApplication>
+#include <KUrl>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <libkdeconnect/devicesmodel.h>
+#include <iostream>
+
+int main(int argc, char** argv)
+{
+ KAboutData about("kctool", 0, ki18n(("kctool")), "1.0", ki18n("KDE Connect CLI tool"),
+ KAboutData::License_GPL, ki18n("(C) 2013 Aleix Pol Gonzalez"));
+ 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"));
+ options.add("device <dev>", ki18n("Device ID"));
+ KCmdLineArgs::addCmdLineOptions( options );
+ KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+ KApplication app;
+ if(args->isSet("l")) {
+ DevicesModel devices;
+ devices.setDisplayFilter(DevicesModel::StatusUnknown);
+ for(int i=0, rows=devices.rowCount(); i<rows; ++i) {
+ QModelIndex idx = devices.index(i);
+ std::cout << "- " << idx.data(Qt::DisplayRole).toString().toStdString()
+ << ": " << idx.data(DevicesModel::IdModelRole).toString().toStdString() << std::endl;
+ }
+ std::cout << devices.rowCount() << " devices found" << std::endl;
+ } else {
+ QString device;
+ if(!args->isSet("device")) {
+ KCmdLineArgs::usageError(i18n("No device specified"));
+ }
+ device = args->getOption("device");
+ QUrl url;
+ if(args->isSet("share")) {
+ url = args->makeURL(args->getOption("share").toLatin1());
+ }
+ args->clear();
+
+ 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("Nothing to be done with the device"));
+ }
+ QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
+
+ return app.exec();
+}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list