Changeset View
Changeset View
Standalone View
Standalone View
src/main.cpp
Show All 32 Lines | |||||
33 | #include <KAboutData> | 33 | #include <KAboutData> | ||
34 | #include <KLocalizedString> | 34 | #include <KLocalizedString> | ||
35 | #include <QCommandLineParser> | 35 | #include <QCommandLineParser> | ||
36 | 36 | | |||
37 | #include <config-X11.h> | 37 | #include <config-X11.h> | ||
38 | #if HAVE_X11 | 38 | #if HAVE_X11 | ||
39 | #include <QX11Info> | 39 | #include <QX11Info> | ||
40 | #endif | 40 | #endif | ||
41 | #ifdef Q_OS_MACOS | ||||
42 | #include <KWindowSystem> | ||||
43 | #endif | ||||
41 | 44 | | |||
42 | #include "drkonqi.h" | 45 | #include "drkonqi.h" | ||
43 | #include "drkonqidialog.h" | 46 | #include "drkonqidialog.h" | ||
44 | #include "statusnotifier.h" | 47 | #include "statusnotifier.h" | ||
45 | 48 | | |||
46 | static const char version[] = PROJECT_VERSION; | 49 | static const char version[] = PROJECT_VERSION; | ||
47 | static const char description[] = I18N_NOOP("The KDE Crash Handler gives the user feedback " | 50 | static const char description[] = I18N_NOOP("The KDE Crash Handler gives the user feedback " | ||
48 | "if a program has crashed."); | 51 | "if a program has crashed."); | ||
Show All 27 Lines | 61 | #endif | |||
76 | aboutData.addAuthor(i18nc("@info:credit","Hans Petter Bieker"), QString(), | 79 | aboutData.addAuthor(i18nc("@info:credit","Hans Petter Bieker"), QString(), | ||
77 | QStringLiteral("bieker@kde.org")); | 80 | QStringLiteral("bieker@kde.org")); | ||
78 | aboutData.addAuthor(i18nc("@info:credit","Dario Andres Rodriguez"), QString(), | 81 | aboutData.addAuthor(i18nc("@info:credit","Dario Andres Rodriguez"), QString(), | ||
79 | QStringLiteral("andresbajotierra@gmail.com")); | 82 | QStringLiteral("andresbajotierra@gmail.com")); | ||
80 | aboutData.addAuthor(i18nc("@info:credit","George Kiagiadakis"), QString(), | 83 | aboutData.addAuthor(i18nc("@info:credit","George Kiagiadakis"), QString(), | ||
81 | QStringLiteral("gkiagia@users.sourceforge.net")); | 84 | QStringLiteral("gkiagia@users.sourceforge.net")); | ||
82 | aboutData.addAuthor(i18nc("@info:credit","A. L. Spehr"), QString(), | 85 | aboutData.addAuthor(i18nc("@info:credit","A. L. Spehr"), QString(), | ||
83 | QStringLiteral("spehr@kde.org")); | 86 | QStringLiteral("spehr@kde.org")); | ||
84 | qa.setWindowIcon(QIcon::fromTheme(QStringLiteral("tools-report-bug"))); | 87 | qa.setWindowIcon(QIcon::fromTheme(QStringLiteral("tools-report-bug"), qa.windowIcon())); | ||
85 | qa.setDesktopFileName(QStringLiteral("org.kde.drkonqi")); | 88 | qa.setDesktopFileName(QStringLiteral("org.kde.drkonqi")); | ||
86 | 89 | | |||
87 | QCommandLineParser parser; | 90 | QCommandLineParser parser; | ||
88 | aboutData.setupCommandLine(&parser); | 91 | aboutData.setupCommandLine(&parser); | ||
89 | 92 | | |||
90 | QCommandLineOption signalOption(QStringLiteral("signal"), i18nc("@info:shell","The signal <number> that was caught"), QStringLiteral("number")); | 93 | QCommandLineOption signalOption(QStringLiteral("signal"), i18nc("@info:shell","The signal <number> that was caught"), QStringLiteral("number")); | ||
91 | QCommandLineOption appNameOption(QStringLiteral("appname"), i18nc("@info:shell","<Name> of the program"), QStringLiteral("name")); | 94 | QCommandLineOption appNameOption(QStringLiteral("appname"), i18nc("@info:shell","<Name> of the program"), QStringLiteral("name")); | ||
92 | QCommandLineOption appPathOption(QStringLiteral("apppath"), i18nc("@info:shell","<Path> to the executable"), QStringLiteral("path")); | 95 | QCommandLineOption appPathOption(QStringLiteral("apppath"), i18nc("@info:shell","<Path> to the executable"), QStringLiteral("path")); | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 146 | #endif | |||
147 | } | 150 | } | ||
148 | 151 | | |||
149 | qa.setQuitOnLastWindowClosed(false); | 152 | qa.setQuitOnLastWindowClosed(false); | ||
150 | 153 | | |||
151 | auto openDrKonqiDialog = [&qa]{ | 154 | auto openDrKonqiDialog = [&qa]{ | ||
152 | DrKonqiDialog *w = new DrKonqiDialog(); | 155 | DrKonqiDialog *w = new DrKonqiDialog(); | ||
153 | QObject::connect(w, &DrKonqiDialog::rejected, &qa, &QApplication::quit); | 156 | QObject::connect(w, &DrKonqiDialog::rejected, &qa, &QApplication::quit); | ||
154 | w->show(); | 157 | w->show(); | ||
158 | #ifdef Q_OS_MACOS | ||||
159 | KWindowSystem::forceActiveWindow(w->winId()); | ||||
160 | #endif | ||||
155 | }; | 161 | }; | ||
156 | 162 | | |||
157 | bool restarted = parser.isSet(restartedOption); | 163 | bool restarted = parser.isSet(restartedOption); | ||
158 | 164 | | |||
159 | // if no notification service is running (eg. shell crashed, or other desktop environment) | 165 | // if no notification service is running (eg. shell crashed, or other desktop environment) | ||
160 | // and we didn't auto-restart the app, open DrKonqi dialog instead of showing an SNI | 166 | // and we didn't auto-restart the app, open DrKonqi dialog instead of showing an SNI | ||
161 | // and emitting a desktop notification | 167 | // and emitting a desktop notification | ||
162 | if (forceDialog || (!restarted && !StatusNotifier::notificationServiceRegistered())) { | 168 | if (forceDialog || (!restarted && !StatusNotifier::notificationServiceRegistered())) { | ||
Show All 15 Lines |