Changeset View
Changeset View
Standalone View
Standalone View
src/main.cpp
Show All 27 Lines | |||||
28 | #include <cstdlib> | 28 | #include <cstdlib> | ||
29 | #include <unistd.h> | 29 | #include <unistd.h> | ||
30 | 30 | | |||
31 | #include <QIcon> | 31 | #include <QIcon> | ||
32 | 32 | | |||
33 | #include <KAboutData> | 33 | #include <KAboutData> | ||
34 | #include <KLocalizedString> | 34 | #include <KLocalizedString> | ||
35 | #include <QCommandLineParser> | 35 | #include <QCommandLineParser> | ||
36 | #include <QDebug> | ||||
36 | 37 | | |||
37 | #include <config-drkonqi.h> | 38 | #include <config-drkonqi.h> | ||
38 | #if HAVE_X11 | 39 | #if HAVE_X11 | ||
39 | #include <QX11Info> | 40 | #include <QX11Info> | ||
40 | #endif | 41 | #endif | ||
41 | #ifdef Q_OS_MACOS | 42 | #ifdef Q_OS_MACOS | ||
42 | #include <KWindowSystem> | 43 | #include <KWindowSystem> | ||
43 | #endif | 44 | #endif | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 63 | #endif | |||
117 | parser.addOption(startupIdOption); | 118 | parser.addOption(startupIdOption); | ||
118 | parser.addOption(kdeinitOption); | 119 | parser.addOption(kdeinitOption); | ||
119 | parser.addOption(saferOption); | 120 | parser.addOption(saferOption); | ||
120 | parser.addOption(restartedOption); | 121 | parser.addOption(restartedOption); | ||
121 | parser.addOption(keepRunningOption); | 122 | parser.addOption(keepRunningOption); | ||
122 | parser.addOption(threadOption); | 123 | parser.addOption(threadOption); | ||
123 | parser.addOption(dialogOption); | 124 | parser.addOption(dialogOption); | ||
124 | 125 | | |||
126 | // Add all unknown options but make sure to print a warning. | ||||
127 | // This enables older DrKonqi's to run by newer KCrash instances with | ||||
128 | // possibly different/new options. | ||||
129 | // KCrash can always send all options it knows to send and be sure that | ||||
130 | // DrKonqi will not explode on them. If an option is not known here it's | ||||
131 | // either too old or too new. | ||||
132 | // | ||||
133 | // To implement this smartly we'll ::parse all arguments, and then ::process | ||||
134 | // them again once we have injected no-op options for all unknown ones. | ||||
135 | // This allows ::process to still do common argument handling for --version | ||||
136 | // as well as standard error handling. | ||||
137 | if (!parser.parse(qa.arguments())) { | ||||
138 | for (const QString &option : parser.unknownOptionNames()) { | ||||
139 | qWarning() << "Unknown option" << option << " - ignoring it."; | ||||
140 | parser.addOption(QCommandLineOption(option)); | ||||
141 | } | ||||
142 | } | ||||
143 | | ||||
125 | parser.process(qa); | 144 | parser.process(qa); | ||
126 | aboutData.processCommandLine(&parser); | 145 | aboutData.processCommandLine(&parser); | ||
127 | 146 | | |||
128 | DrKonqi::setSignal(parser.value(signalOption).toInt()); | 147 | DrKonqi::setSignal(parser.value(signalOption).toInt()); | ||
129 | DrKonqi::setAppName(parser.value(appNameOption)); | 148 | DrKonqi::setAppName(parser.value(appNameOption)); | ||
130 | DrKonqi::setAppPath(parser.value(appPathOption)); | 149 | DrKonqi::setAppPath(parser.value(appPathOption)); | ||
131 | DrKonqi::setAppVersion(parser.value(appVersionOption)); | 150 | DrKonqi::setAppVersion(parser.value(appVersionOption)); | ||
132 | DrKonqi::setBugAddress(parser.value(bugAddressOption)); | 151 | DrKonqi::setBugAddress(parser.value(bugAddressOption)); | ||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |