File: main.cpp

package info (click to toggle)
kgpg 4:18.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,168 kB
  • sloc: cpp: 18,911; xml: 159; makefile: 8; sh: 4
file content (81 lines) | stat: -rw-r--r-- 3,131 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Copyright (C) 2002 Jean-Baptiste Mardelle <bj@altern.org>
 * Copyright (C) 2007,2008,2009,2010,2011,2012,2013,2014,2015,2016
 *               Rolf Eike Beer <kde@opensource.sf-tec.de>
 * Copyright (C) 2016 Andrius Štikonas <andrius@stikonas.eu>
 */

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kgpg.h"

#include <QCommandLineParser>
#include <QDir>

#include <KAboutData>
#include <KCrash>
#include <KDBusService>
#include <Kdelibs4ConfigMigrator>
#include <KLocalizedString>

int main(int argc, char *argv[])
{
    KGpgApp app(argc, argv);

    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    KCrash::initialize();

    Kdelibs4ConfigMigrator migrate(QLatin1Literal("kgpg"));
    migrate.setConfigFiles({ QLatin1Literal("kgpgrc") });
    migrate.setUiFiles({ QStringLiteral("keysmanager.rc"), QStringLiteral("kgpgeditor.rc") });
    migrate.migrate();

    KLocalizedString::setApplicationDomain("kgpg");

    KAboutData about (
        QLatin1String("kgpg"),
        xi18nc("@title", "<application>KGpg</application>"),
        QLatin1String(KGPG_VERSION),
        xi18nc("@title", "KGpg - simple gui for GnuPG"),
        KAboutLicense::GPL,
        xi18nc("@info:credit", "&copy; 2003-2016, The KGpg Developers"));

    about.addAuthor(xi18nc("@info:credit", "Rolf Eike Beer"), i18nc("@info:credit", "Maintainer"), QStringLiteral("kde@opensource.sf-tec.de"));
    about.addAuthor(xi18nc("@info:credit", "Jean-Baptiste Mardelle"), i18nc("@info:credit", "Author and former maintainer"), QStringLiteral("bj@altern.org"));
    about.addAuthor(xi18nc("@info:credit", "Jimmy Gilles"), QString(), QStringLiteral("jimmygilles@gmail.com"));
    about.addAuthor(xi18nc("@info:credit", "Andrius Štikonas"), i18nc("@info:credit", "KF5 port"), QStringLiteral("andrius@stikonas.eu"));

    about.setHomepage(QLatin1String("http://utils.kde.org/projects/kgpg"));

    about.setOrganizationDomain(QByteArray("kde.org"));
    about.setProductName(QByteArray("kgpg"));

    KAboutData::setApplicationData(about);

    QCommandLineParser parser;
    parser.setApplicationDescription(about.shortDescription());
    about.setupCommandLine(&parser);
    app.setupCmdlineParser(parser);

    parser.process(app);
    about.processCommandLine(&parser);

    app.setQuitOnLastWindowClosed(false);
    KDBusService service(KDBusService::Unique);

	service.connect(&service, &KDBusService::activateRequested, &app, &KGpgApp::slotDBusActivation);

	if(!app.newInstance())
		return 1;
	app.handleArguments(parser, QDir::current());

    return app.exec();
}