2023-03-30 02:40:47 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
#include <QCommandLineParser>
|
2023-03-30 05:43:44 +00:00
|
|
|
#include <QCoreApplication>
|
2023-03-30 02:40:47 +00:00
|
|
|
#include <QIcon>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
|
#include <QQmlContext>
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
|
|
#include <KAboutData>
|
|
|
|
|
#include <KLocalizedString>
|
|
|
|
|
|
|
|
|
|
#include "settings.h"
|
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
QCommandLineParser *createParser()
|
|
|
|
|
{
|
|
|
|
|
QCommandLineParser *parser = new QCommandLineParser;
|
2023-03-30 05:43:44 +00:00
|
|
|
parser->addOption(QCommandLineOption(QStringLiteral("apply-settings"), "Applies the correct system settings for the current environment."));
|
2023-03-30 02:40:47 +00:00
|
|
|
parser->addVersionOption();
|
|
|
|
|
parser->addHelpOption();
|
|
|
|
|
return parser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2023-03-30 05:43:44 +00:00
|
|
|
QCoreApplication app(argc, argv);
|
2023-03-30 02:40:47 +00:00
|
|
|
|
|
|
|
|
// parse command
|
|
|
|
|
QScopedPointer<QCommandLineParser> parser{createParser()};
|
|
|
|
|
parser->process(app);
|
|
|
|
|
|
|
|
|
|
// start wizard
|
|
|
|
|
KLocalizedString::setApplicationDomain("plasma-mobile-envmanager");
|
|
|
|
|
QCoreApplication::setApplicationName(QStringLiteral("plasma-mobile-envmanager"));
|
|
|
|
|
QCoreApplication::setApplicationVersion(QStringLiteral(PLASMA_MOBILE_VERSION_STRING));
|
|
|
|
|
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
|
|
|
|
|
|
|
|
|
|
// apply configuration
|
|
|
|
|
if (parser->isSet(QStringLiteral("apply-settings"))) {
|
2024-01-17 00:02:51 +00:00
|
|
|
Settings::self().applyConfiguration();
|
2023-03-30 02:40:47 +00:00
|
|
|
} else {
|
|
|
|
|
parser->showHelp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|