File indexing completed on 2024-04-28 05:26:47

0001 /*
0002  *   SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpolkde.org>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #include "../DiscoverVersion.h"
0008 #include "DiscoverUpdate.h"
0009 #include <DiscoverBackendsFactory.h>
0010 #include <KAboutData>
0011 #include <KDBusService>
0012 #include <KLocalizedString>
0013 #include <QCommandLineParser>
0014 #include <QGuiApplication>
0015 
0016 int main(int argc, char **argv)
0017 {
0018     QGuiApplication app(argc, argv);
0019     app.setQuitOnLastWindowClosed(false);
0020     KLocalizedString::setApplicationDomain("plasma-discover-update");
0021     KAboutData about(QStringLiteral("discoverupdate"), i18n("Discover Update"), version, {}, KAboutLicense::GPL, i18n("© 2020 Aleix Pol Gonzalez"), {});
0022     about.addAuthor(QStringLiteral("Aleix Pol i Gonzàlez"), {}, QStringLiteral("aleixpolkde.org"));
0023     about.setProductName("discover/update");
0024     KAboutData::setApplicationData(about);
0025 
0026     KDBusService service(KDBusService::Unique);
0027 
0028     DiscoverUpdate exp;
0029     {
0030         QCommandLineParser parser;
0031         QCommandLineOption offlineUpdate(QStringLiteral("offline"), i18n("Prefer updates that will only apply upon reboot"));
0032         parser.addOption(offlineUpdate);
0033         DiscoverBackendsFactory::setupCommandLine(&parser);
0034         about.setupCommandLine(&parser);
0035         parser.process(app);
0036         about.processCommandLine(&parser);
0037         DiscoverBackendsFactory::processCommandLine(&parser, false);
0038 
0039         exp.setOfflineUpdates(parser.isSet(offlineUpdate));
0040     }
0041 
0042     return app.exec();
0043 }