forked from yshui/klipper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
94 lines (75 loc) · 3.27 KB
/
main.cpp
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
82
83
84
85
86
87
88
89
90
91
92
93
94
/* This file is part of the KDE project
Copyright (C) Andrew Stanley-Jones <[email protected]>
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <KLocalizedString>
#include <KAboutData>
#include <KConfigDialogManager>
#include <KDBusService>
#include <QApplication>
#include <QCommandLineParser>
#include <QSessionManager>
#include "tray.h"
#include "klipper.h"
extern "C" int Q_DECL_EXPORT kdemain(int argc, char *argv[])
{
KLocalizedString::setApplicationDomain("klipper");
QApplication app(argc, argv);
KAboutData aboutData(QStringLiteral("klipper"),
i18n("Klipper"),
QStringLiteral(KLIPPER_VERSION_STRING),
i18n("KDE cut & paste history utility"),
KAboutLicense::GPL,
i18n("(c) 1998, Andrew Stanley-Jones\n"
"1998-2002, Carsten Pfeiffer\n"
"2001, Patrick Dubroy"));
aboutData.addAuthor(i18n("Carsten Pfeiffer"),
i18n("Author"),
aboutData.addAuthor(i18n("Andrew Stanley-Jones"),
i18n( "Original Author" ),
aboutData.addAuthor(i18n("Patrick Dubroy"),
i18n("Contributor"),
aboutData.addAuthor(i18n("Luboš Luňák"),
i18n("Bugfixes and optimizations"),
aboutData.addAuthor(i18n("Esben Mose Hansen"),
i18n("Previous Maintainer"),
aboutData.addAuthor(i18n("Martin Gräßlin"),
i18n("Maintainer"),
KAboutData::setApplicationData(aboutData);
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
app.setQuitOnLastWindowClosed( false );
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
KDBusService service(KDBusService::Unique);
// make KConfigDialog "know" when our actions page is changed
KConfigDialogManager::changedMap()->insert("ActionsTreeWidget", SIGNAL(changed()));
KlipperTray klipper;
return app.exec();
}