From 560e8638e8ddc06a92f207fb21d5e8741ec608b7 Mon Sep 17 00:00:00 2001 From: Erik Duisters Date: Tue, 6 Nov 2018 14:19:44 +0100 Subject: [PATCH] A QApplication object needs to be instantiated for kio-kdeconnect to work on KDE Neon Summary: kio-kdeconnect fails to start on KDE Neon because it does not instantiate a QApplication object BUG: 400178 Test Plan: Install on a KDE Neon 5.14 system or VM Pair an android phone Browse the phone's filesystem using dolphin Reviewers: #kde_connect, #frameworks, albertvaka Reviewed By: #kde_connect, albertvaka Subscribers: sredman, apol, jriddell, nicolasfella, albertvaka, kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D16692 --- kio/CMakeLists.txt | 5 +++-- kio/kdeconnect.json | 26 ++++++++++++++++++++++++++ kio/kdeconnect.protocol | 16 ---------------- kio/kiokdeconnect.cpp | 12 ++++++++++++ 4 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 kio/kdeconnect.json delete mode 100644 kio/kdeconnect.protocol diff --git a/kio/CMakeLists.txt b/kio/CMakeLists.txt index 024140262..b381eaec1 100644 --- a/kio/CMakeLists.txt +++ b/kio/CMakeLists.txt @@ -17,5 +17,6 @@ target_link_libraries(kio_kdeconnect ) ########### install files ############### -install(TARGETS kio_kdeconnect DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES kdeconnect.protocol DESTINATION ${SERVICES_INSTALL_DIR}) +set_target_properties(kio_kdeconnect PROPERTIES OUTPUT_NAME "kdeconnect") +set_target_properties(kio_kdeconnect PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/kio") +install(TARGETS kio_kdeconnect DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio) diff --git a/kio/kdeconnect.json b/kio/kdeconnect.json new file mode 100644 index 000000000..d37269e03 --- /dev/null +++ b/kio/kdeconnect.json @@ -0,0 +1,26 @@ +{ + "KDE-KIO-Protocols": { + "kdeconnect": { + "Class": ":internet", + "Icon": "kdeconnect", + "copyFromFile": false, + "copyToFile": false, + "deleting": false, + "exec": "kdeconnect", + "input": "none", + "listing": [ + "Name", + "Type", + "Access", + "" + ], + "makedir": false, + "maxInstances": 2, + "moving": false, + "output": "filesystem", + "protocol": "kdeconnect", + "reading": true, + "writing": false + } + } +} diff --git a/kio/kdeconnect.protocol b/kio/kdeconnect.protocol deleted file mode 100644 index 73708447e..000000000 --- a/kio/kdeconnect.protocol +++ /dev/null @@ -1,16 +0,0 @@ -[Protocol] -exec=kio_kdeconnect -protocol=kdeconnect -input=none -output=filesystem -copyToFile=false -copyFromFile=false -listing=Name,Type,Access -reading=true -writing=false -makedir=false -deleting=false -moving=false -Icon=kdeconnect -maxInstances=2 - diff --git a/kio/kiokdeconnect.cpp b/kio/kiokdeconnect.cpp index e0d7973de..0bf62a845 100644 --- a/kio/kiokdeconnect.cpp +++ b/kio/kiokdeconnect.cpp @@ -27,11 +27,21 @@ #include #include +#include Q_LOGGING_CATEGORY(KDECONNECT_KIO, "kdeconnect.kio") +class KIOPluginForMetaData : public QObject +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.kde.kio.slave.kdeconnect" FILE "kdeconnect.json") +}; + extern "C" int Q_DECL_EXPORT kdemain(int argc, char** argv) { + QCoreApplication app(argc, argv); + app.setApplicationName(QStringLiteral("kio_kdeconnect")); + if (argc != 4) { fprintf(stderr, "Usage: kio_kdeconnect protocol pool app\n"); exit(-1); @@ -232,3 +242,5 @@ void KioKdeconnect::setHost(const QString& hostName, quint16 port, const QString } +//needed for JSON file embedding +#include "kiokdeconnect.moc"