summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <[email protected]>2016-10-26 07:44:57 +0200
committerMartin Gräßlin <[email protected]>2016-10-26 07:50:54 +0200
commit214981eada3f5229db503314c70f2a69e0a8284e (patch)
tree727132857fdd1b01d4c69c68f550defc71df07e3
parentbf7df62ad0024f4dfb5a6b8b091e1b5ac3404b30 (diff)
[kcmshell] Use desktop file name of module as app's desktop file
Summary: By default kcmshell5 registers as org.kde.kcmshell5, but such a desktop file does not exist. Which means that on Wayland neither window manager nor task manager is able to provide a useful window icon for configuration window. This change tries to locate the desktop file of the module passed to kcmshell5. If it is found it is set as the application's desktop file name. Thus the compositor and task manager actually know the desktop file which was used to start the kcmshell5 instance. This is only done if kcmshell5 is invoked for only one module. In case of multiple modules the application invoking kcmshell5 should pass a proper desktop file name through the command line argument. And if the desktopfile got specified already it is not updated from the module. Test Plan: KWin Effects KCM shows proper icon on Wayland Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D3161
-rw-r--r--kcmshell/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/kcmshell/main.cpp b/kcmshell/main.cpp
index 7a75b27..b77c94c 100644
--- a/kcmshell/main.cpp
+++ b/kcmshell/main.cpp
@@ -292,6 +292,16 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
dlg->setWindowIcon( QIcon::fromTheme(iconName) );
}
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
+ if (modules.count() == 1 && app.desktopFileName() == QLatin1String("org.kde.kcmshell5")) {
+ const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
+ QStringLiteral("kservices5/%1.desktop").arg(modules.first()->desktopEntryName()));
+ if (!path.isEmpty()) {
+ app.setDesktopFileName(path);
+ }
+ }
+#endif
+
dlg->show();
app.exec();