Changeset View
Changeset View
Standalone View
Standalone View
kaccess/main.cpp
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #include "kaccess.h" | 22 | #include "kaccess.h" | ||
23 | #include <QDebug> | 23 | #include <QDebug> | ||
24 | #include <QApplication> | 24 | #include <QApplication> | ||
25 | #include <QSessionManager> | 25 | #include <QSessionManager> | ||
26 | #include <QX11Info> | 26 | #include <QX11Info> | ||
27 | #include <KAboutData> | 27 | #include <KAboutData> | ||
28 | #include <KLocalizedString> | 28 | #include <KLocalizedString> | ||
29 | #include <KDBusService> | | |||
30 | #include <Kdelibs4ConfigMigrator> | 29 | #include <Kdelibs4ConfigMigrator> | ||
31 | 30 | | |||
32 | extern "C" Q_DECL_EXPORT int kdemain(int argc, char * argv[]) | 31 | extern "C" Q_DECL_EXPORT int kdemain(int argc, char * argv[]) | ||
33 | { | 32 | { | ||
34 | // we need an application object for QX11Info | | |||
35 | QApplication app(argc, argv); | | |||
36 | KAccessApp acc; | | |||
37 | | ||||
38 | Kdelibs4ConfigMigrator migrate(QStringLiteral("kaccess")); | 33 | Kdelibs4ConfigMigrator migrate(QStringLiteral("kaccess")); | ||
39 | migrate.setConfigFiles(QStringList() << QStringLiteral("kaccessrc")); | 34 | migrate.setConfigFiles(QStringList() << QStringLiteral("kaccessrc")); | ||
40 | migrate.migrate(); | 35 | migrate.migrate(); | ||
41 | 36 | | |||
42 | QGuiApplication::setFallbackSessionManagementEnabled(false); | 37 | QGuiApplication::setFallbackSessionManagementEnabled(false); | ||
43 | 38 | | |||
44 | KAboutData about("kaccess", QString(), i18n("KDE Accessibility Tool"), | | |||
45 | {}, KAboutLicense::GPL_V2, | | |||
46 | i18n("(c) 2000, Matthias Hoelzer-Kluepfel")); | | |||
47 | | ||||
48 | about.addAuthor(i18n("Matthias Hoelzer-Kluepfel"), i18n("Author") , QStringLiteral("hoelzer@kde.org")); | | |||
49 | | ||||
50 | //this application is currently only relevant on X, force to run under X | 39 | //this application is currently only relevant on X, force to run under X | ||
51 | //note if someone does port this we still need to run kaccess under X for xwayland apps | 40 | //note if someone does port this we still need to run kaccess under X for xwayland apps | ||
52 | qputenv("QT_QPA_PLATFORM", "xcb"); | 41 | qputenv("QT_QPA_PLATFORM", "xcb"); | ||
53 | 42 | | |||
54 | // verify the Xlib has matching XKB extension | 43 | // verify the Xlib has matching XKB extension | ||
55 | int major = XkbMajorVersion; | 44 | int major = XkbMajorVersion; | ||
56 | int minor = XkbMinorVersion; | 45 | int minor = XkbMinorVersion; | ||
57 | if (!XkbLibraryVersion(&major, &minor)) { | 46 | if (!XkbLibraryVersion(&major, &minor)) { | ||
58 | qWarning() << "Xlib XKB extension does not match"; | 47 | qWarning() << "Xlib XKB extension does not match"; | ||
59 | return 1; | 48 | return 1; | ||
60 | } | 49 | } | ||
61 | qDebug() << "Xlib XKB extension major=" << major << " minor=" << minor; | 50 | qDebug() << "Xlib XKB extension major=" << major << " minor=" << minor; | ||
62 | 51 | | |||
52 | // we need an application object for QX11Info | ||||
53 | QApplication app(argc, argv); | ||||
54 | | ||||
55 | KAboutData about("kaccess", QString(), i18n("KDE Accessibility Tool"), | ||||
56 | {}, KAboutLicense::GPL_V2, | ||||
57 | i18n("(c) 2000, Matthias Hoelzer-Kluepfel")); | ||||
58 | | ||||
59 | about.addAuthor(i18n("Matthias Hoelzer-Kluepfel"), i18n("Author") , QStringLiteral("hoelzer@kde.org")); | ||||
60 | // set data as used for D-Bus by KAccessApp | ||||
61 | KAboutData::setApplicationData(about); | ||||
62 | | ||||
63 | KAccessApp acc; | ||||
63 | if (acc.isFailed()) { | 64 | if (acc.isFailed()) { | ||
64 | return 1; | 65 | return 1; | ||
65 | } | 66 | } | ||
66 | 67 | | |||
67 | auto disableSessionManagement = [](QSessionManager &sm) { | 68 | auto disableSessionManagement = [](QSessionManager &sm) { | ||
68 | sm.setRestartHint(QSessionManager::RestartNever); | 69 | sm.setRestartHint(QSessionManager::RestartNever); | ||
69 | }; | 70 | }; | ||
70 | 71 | | |||
Show All 23 Lines |