File indexing completed on 2022-07-03 17:05:59

0001 /*
0002     SPDX-FileCopyrightText: 2002 Jean-Baptiste Mardelle <bj@altern.org>
0003     SPDX-FileCopyrightText: 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Rolf Eike Beer <kde@opensource.sf-tec.de>
0004     SPDX-FileCopyrightText: 2016 Andrius Štikonas <andrius@stikonas.eu>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "kgpg.h"
0009 
0010 #include <QCommandLineParser>
0011 #include <QDir>
0012 
0013 #include <KAboutData>
0014 #include <KCrash>
0015 #include <KDBusService>
0016 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0017 #include <Kdelibs4ConfigMigrator>
0018 #endif
0019 #include <KLocalizedString>
0020 
0021 int main(int argc, char *argv[])
0022 {
0023     KGpgApp app(argc, argv);
0024 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0025     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0026 #endif
0027     KCrash::initialize();
0028 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0029     Kdelibs4ConfigMigrator migrate(QLatin1String("kgpg"));
0030     migrate.setConfigFiles({ QLatin1String("kgpgrc") });
0031     migrate.setUiFiles({ QStringLiteral("keysmanager.rc"), QStringLiteral("kgpgeditor.rc") });
0032     migrate.migrate();
0033 #endif
0034 
0035     KLocalizedString::setApplicationDomain("kgpg");
0036 
0037     KAboutData about (
0038         QLatin1String("kgpg"),
0039         xi18nc("@title", "<application>KGpg</application>"),
0040         QLatin1String(KGPG_VERSION),
0041         xi18nc("@title", "KGpg - simple gui for GnuPG"),
0042         KAboutLicense::GPL,
0043         xi18nc("@info:credit", "&copy; 2003-2016, The KGpg Developers"));
0044 
0045     about.addAuthor(xi18nc("@info:credit", "Rolf Eike Beer"), i18nc("@info:credit", "Maintainer"), QStringLiteral("kde@opensource.sf-tec.de"));
0046     about.addAuthor(xi18nc("@info:credit", "Jean-Baptiste Mardelle"), i18nc("@info:credit", "Author and former maintainer"), QStringLiteral("bj@altern.org"));
0047     about.addAuthor(xi18nc("@info:credit", "Jimmy Gilles"), QString(), QStringLiteral("jimmygilles@gmail.com"));
0048     about.addAuthor(xi18nc("@info:credit", "Andrius Štikonas"), i18nc("@info:credit", "KF5 port"), QStringLiteral("andrius@stikonas.eu"));
0049 
0050     about.setHomepage(QLatin1String("https://utils.kde.org/projects/kgpg"));
0051 
0052     about.setOrganizationDomain(QByteArray("kde.org"));
0053     about.setProductName(QByteArray("kgpg"));
0054 
0055     KAboutData::setApplicationData(about);
0056 
0057     QCommandLineParser parser;
0058     parser.setApplicationDescription(about.shortDescription());
0059     about.setupCommandLine(&parser);
0060     app.setupCmdlineParser(parser);
0061 
0062     parser.process(app);
0063     about.processCommandLine(&parser);
0064 
0065     app.setQuitOnLastWindowClosed(false);
0066     KDBusService service(KDBusService::Unique);
0067 
0068     service.connect(&service, &KDBusService::activateRequested, &app, &KGpgApp::slotDBusActivation);
0069 
0070     if(!app.newInstance())
0071         return 1;
0072     app.handleArguments(parser, QDir::current());
0073 
0074     return app.exec();
0075 }