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
This commit is contained in:
Erik Duisters 2018-11-06 14:19:44 +01:00 committed by Albert Vaca
parent 43e6fed43d
commit 8388ed0603
4 changed files with 41 additions and 18 deletions

View file

@ -17,5 +17,6 @@ target_link_libraries(kio_kdeconnect
) )
########### install files ############### ########### install files ###############
install(TARGETS kio_kdeconnect DESTINATION ${PLUGIN_INSTALL_DIR}) set_target_properties(kio_kdeconnect PROPERTIES OUTPUT_NAME "kdeconnect")
install(FILES kdeconnect.protocol DESTINATION ${SERVICES_INSTALL_DIR}) 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)

26
kio/kdeconnect.json Normal file
View file

@ -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
}
}
}

View file

@ -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

View file

@ -27,11 +27,21 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <QDebug> #include <QDebug>
#include <QtPlugin>
Q_LOGGING_CATEGORY(KDECONNECT_KIO, "kdeconnect.kio") 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) extern "C" int Q_DECL_EXPORT kdemain(int argc, char** argv)
{ {
QCoreApplication app(argc, argv);
app.setApplicationName(QStringLiteral("kio_kdeconnect"));
if (argc != 4) { if (argc != 4) {
fprintf(stderr, "Usage: kio_kdeconnect protocol pool app\n"); fprintf(stderr, "Usage: kio_kdeconnect protocol pool app\n");
exit(-1); exit(-1);
@ -232,3 +242,5 @@ void KioKdeconnect::setHost(const QString& hostName, quint16 port, const QString
} }
//needed for JSON file embedding
#include "kiokdeconnect.moc"