Commit 67129532 authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

kdeconnect-app: add CLI option to allow starting handler via app

this feature is important to enable sendTo-menu-like integration in the Microsoft Store build
parent cec5d808
Pipeline #70418 passed with stage
in 4 minutes and 23 seconds
......@@ -11,6 +11,7 @@
#include <QQmlContext>
#include <QQuickStyle>
#include <QStandardPaths>
#include <QProcess>
#include <KAboutData>
#include <KLocalizedString>
......@@ -35,11 +36,21 @@ int main(int argc, char* argv[])
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
}
QString urlToShare;
{
QCommandLineParser parser;
parser.addPositionalArgument(QStringLiteral("url"), i18n("URL to share"));
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
if (parser.positionalArguments().count() == 1) {
urlToShare = parser.positionalArguments().constFirst();
const QString kdeconnectHandlerExecutable = QStandardPaths::findExecutable(QStringLiteral("kdeconnect-handler"), { QCoreApplication::applicationDirPath() });
if (!kdeconnectHandlerExecutable.isEmpty()) {
QProcess::startDetached(kdeconnectHandlerExecutable, { urlToShare });
return 0; // exit the app once kdeconnect-handler is started
}
}
}
QQmlApplicationEngine engine;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment