File indexing completed on 2024-03-24 04:59:54
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include <QApplication> 0008 #include <QCommandLineParser> 0009 #include <QStandardPaths> 0010 #include <QStyle> 0011 0012 #include "kdeconnect-version.h" 0013 #include <KAboutData> 0014 #include <KCMultiDialog> 0015 #include <KDBusService> 0016 #include <KLocalizedString> 0017 #include <KWindowSystem> 0018 0019 int main(int argc, char **argv) 0020 { 0021 QIcon::setFallbackThemeName(QStringLiteral("breeze")); 0022 QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); 0023 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 0024 0025 QApplication app(argc, argv); 0026 app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect"))); 0027 KAboutData about(QStringLiteral("kdeconnect-settings"), 0028 i18n("KDE Connect Settings"), 0029 QStringLiteral(KDECONNECT_VERSION_STRING), 0030 i18n("KDE Connect Settings"), 0031 KAboutLicense::GPL, 0032 i18n("(C) 2018-2020 Nicolas Fella")); 0033 KAboutData::setApplicationData(about); 0034 0035 QCommandLineParser parser; 0036 parser.addOption(QCommandLineOption(QStringLiteral("args"), i18n("Arguments for the config module"), QStringLiteral("args"))); 0037 0038 about.setupCommandLine(&parser); 0039 parser.process(app); 0040 about.processCommandLine(&parser); 0041 0042 KDBusService dbusService(KDBusService::Unique); 0043 0044 KCMultiDialog *dialog = new KCMultiDialog; 0045 dialog->addModule(KPluginMetaData(QStringLiteral("plasma/kcms/systemsettings_qwidgets/kcm_kdeconnect")), {parser.value(QStringLiteral("args"))}); 0046 0047 dialog->setAttribute(Qt::WA_DeleteOnClose); 0048 dialog->show(); 0049 0050 QObject::connect(&dbusService, &KDBusService::activateRequested, dialog, [dialog](const QStringList &args, const QString & /*workingDir*/) { 0051 KWindowSystem::updateStartupId(dialog->windowHandle()); 0052 KWindowSystem::activateWindow(dialog->windowHandle()); 0053 0054 QCommandLineParser parser; 0055 parser.addOption(QCommandLineOption(QStringLiteral("args"), i18n("Arguments for the config module"), QStringLiteral("args"))); 0056 parser.parse(args); 0057 0058 dialog->clear(); 0059 dialog->addModule(KPluginMetaData(QStringLiteral("plasma/kcms/systemsettings_qwidgets/kcm_kdeconnect")), {parser.value(QStringLiteral("args"))}); 0060 }); 0061 0062 app.setQuitOnLastWindowClosed(true); 0063 0064 return app.exec(); 0065 }