diff --git a/initialstart/main.cpp b/initialstart/main.cpp index 72e74c93..b12885ec 100644 --- a/initialstart/main.cpp +++ b/initialstart/main.cpp @@ -15,12 +15,10 @@ #include "version.h" #include "wizard.h" -QCommandLineParser *createParser() +std::unique_ptr createParser() { - QCommandLineParser *parser = new QCommandLineParser; + auto parser = std::make_unique(); parser->addOption(QCommandLineOption(QStringLiteral("test-wizard"), i18n("Opens the initial start wizard without modifying configuration"))); - parser->addVersionOption(); - parser->addHelpOption(); return parser; } @@ -28,20 +26,6 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - // parse command - QScopedPointer parser{createParser()}; - parser->process(app); - - bool testWizard = parser->isSet(QStringLiteral("test-wizard")); - - if (!testWizard) { - // if the wizard has already been run, or we aren't in plasma mobile - if (!Settings::self()->shouldStartWizard()) { - qDebug() << "Wizard will not be started since either it has already been run, or the current session is not Plasma Mobile."; - return 0; - } - } - // start wizard KLocalizedString::setApplicationDomain("plasma_org.kde.plasma.mobileinitialstart"); KAboutData aboutData(QStringLiteral("plasma-mobile-initial-start"), @@ -53,6 +37,21 @@ int main(int argc, char *argv[]) aboutData.addAuthor(i18n("Devin Lin"), QString(), QStringLiteral("devin@kde.org")); KAboutData::setApplicationData(aboutData); + // parse command + auto parser = createParser(); + aboutData.setupCommandLine(parser.get()); + parser->process(app); + aboutData.processCommandLine(parser.get()); + + const bool testWizard = parser->isSet(QStringLiteral("test-wizard")); + if (!testWizard) { + // if the wizard has already been run, or we aren't in plasma mobile + if (!Settings::self()->shouldStartWizard()) { + qDebug() << "Wizard will not be started since either it has already been run, or the current session is not Plasma Mobile."; + return 0; + } + } + QQmlApplicationEngine engine; engine.rootContext()->setContextObject(new KLocalizedContext{&engine});