diff options
authorMartin Gräßlin <[email protected]>2016-10-26 07:28:41 +0200
committerMartin Gräßlin <[email protected]>2016-10-26 07:35:10 +0200
commitbf7df62ad0024f4dfb5a6b8b091e1b5ac3404b30 (patch)
parent2f54dc981fe29a1dde0fa648e8d44efc4201082f (diff)
[kcmshell] set application data only after parsing command line
Summary: KAboutData provides some information needed for the output of the command line options like version. Thus it needs to be called before processing the QCommandLineParser. But if done before any command line arguments are processed the switch like --desktopfile does not work. This change reorders the calls so that the command line is first parsed, then the options of the KAboutData are processed. After that the about data is set on the application and the command line parser is processed. With this change both the version option and the desktopfile option is working. It's important for kcmshell to have the desktopfile option working so that applications using kcmshell5 as a helper to show configuration can pass their own app id to kcmshell5, so that it e.g. registers to a Wayland compositor as instead of org.kde.kcmshell5. Test Plan: Run kcmshell5 --version, --help, --list and --desktopfile and compared to variant before Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision:
1 files changed, 4 insertions, 2 deletions
diff --git a/kcmshell/main.cpp b/kcmshell/main.cpp
index 27b60af..7a75b27 100644
--- a/kcmshell/main.cpp
+++ b/kcmshell/main.cpp
@@ -177,7 +177,6 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
aboutData.addAuthor(i18n("Matthias Elter"),QString(), "[email protected]");
aboutData.addAuthor(i18n("Matthias Ettrich"),QString(), "[email protected]");
aboutData.addAuthor(i18n("Waldo Bastian"),QString(), "[email protected]");
- KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
@@ -192,8 +191,11 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
parser.addOption(QCommandLineOption(QStringLiteral("icon"), i18n("Use a specific icon for the window"), QLatin1String("icon")));
parser.addOption(QCommandLineOption(QStringLiteral("caption"), i18n("Use a specific caption for the window"), QLatin1String("caption")));
- parser.process(app);
+ parser.parse(app.arguments());
+ KAboutData::setApplicationData(aboutData);
+ parser.process(app);
const QString lang = parser.value("lang");
if (!lang.isEmpty()) {