2018-12-06 15:06:06 +00:00
|
|
|
/*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
2018-12-06 15:06:06 +00:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2018-12-06 15:06:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QApplication>
|
2020-03-21 20:26:42 +00:00
|
|
|
#include <QCommandLineParser>
|
2020-11-11 11:58:37 +00:00
|
|
|
#include <QStandardPaths>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QStyle>
|
2018-12-06 15:06:06 +00:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
#include "kdeconnect-version.h"
|
2018-12-06 15:06:06 +00:00
|
|
|
#include <KAboutData>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KCMultiDialog>
|
2020-01-17 00:31:53 +00:00
|
|
|
#include <KDBusService>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KLocalizedString>
|
2022-05-12 02:59:56 +01:00
|
|
|
#include <KWindowSystem>
|
2018-12-06 15:06:06 +00:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
int main(int argc, char **argv)
|
2018-12-06 15:06:06 +00:00
|
|
|
{
|
2021-07-27 22:03:51 +01:00
|
|
|
QIcon::setFallbackThemeName(QStringLiteral("breeze"));
|
2022-04-02 13:32:54 +01:00
|
|
|
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2021-07-27 22:03:51 +01:00
|
|
|
|
2018-12-06 15:06:06 +00:00
|
|
|
QApplication app(argc, argv);
|
2021-05-23 06:12:29 +01:00
|
|
|
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect")));
|
2019-06-10 15:40:28 +01:00
|
|
|
KAboutData about(QStringLiteral("kdeconnect-settings"),
|
2018-12-06 15:06:06 +00:00
|
|
|
i18n("KDE Connect Settings"),
|
|
|
|
QStringLiteral(KDECONNECT_VERSION_STRING),
|
|
|
|
i18n("KDE Connect Settings"),
|
|
|
|
KAboutLicense::GPL,
|
2020-01-17 00:31:53 +00:00
|
|
|
i18n("(C) 2018-2020 Nicolas Fella"));
|
2018-12-06 15:06:06 +00:00
|
|
|
KAboutData::setApplicationData(about);
|
|
|
|
|
2020-03-21 20:26:42 +00:00
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.addOption(QCommandLineOption(QStringLiteral("args"), i18n("Arguments for the config module"), QStringLiteral("args")));
|
|
|
|
|
|
|
|
about.setupCommandLine(&parser);
|
|
|
|
parser.process(app);
|
|
|
|
about.processCommandLine(&parser);
|
|
|
|
|
2020-01-17 00:31:53 +00:00
|
|
|
KDBusService dbusService(KDBusService::Unique);
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
KCMultiDialog *dialog = new KCMultiDialog;
|
2021-11-18 09:53:44 +00:00
|
|
|
dialog->addModule(KPluginMetaData(QStringLiteral("kcm_kdeconnect")), {parser.value(QStringLiteral("args"))});
|
2020-08-17 19:06:36 +01:00
|
|
|
|
2018-12-06 15:06:06 +00:00
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
dialog->show();
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
QObject::connect(&dbusService, &KDBusService::activateRequested, dialog, [dialog](const QStringList &args, const QString & /*workingDir*/) {
|
2022-05-12 02:59:56 +01:00
|
|
|
KWindowSystem::updateStartupId(dialog->windowHandle());
|
|
|
|
KWindowSystem::activateWindow(dialog->windowHandle());
|
2022-05-12 02:41:05 +01:00
|
|
|
|
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.addOption(QCommandLineOption(QStringLiteral("args"), i18n("Arguments for the config module"), QStringLiteral("args")));
|
|
|
|
parser.parse(args);
|
|
|
|
|
|
|
|
dialog->clear();
|
|
|
|
dialog->addModule(KPluginMetaData(QStringLiteral("kcm_kdeconnect")), {parser.value(QStringLiteral("args"))});
|
|
|
|
});
|
|
|
|
|
2018-12-06 15:06:06 +00:00
|
|
|
app.setQuitOnLastWindowClosed(true);
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|