summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-04-08 17:10:12 (GMT)
committerAlbert Astals Cid <aacid@kde.org>2017-04-10 08:57:38 (GMT)
commit19a6bb179d5fd5056f34568651bab34e9db390f7 (patch)
tree9598a70fae266ff01616484159df9507a18217aa
parent33b284e286aec41f3801f98e3e01976b23bef5b9 (diff)
Fix query for available modules
Summary: The old query was bad because two reasons: * it didn't use the same query systemsettings uses * it didn't use exist so if the first property did not exist the second one was not evaluated since the parser bailed out Test Plan: Ran kcmshell5 --list, it's better now Subscribers: plasma-devel Tags: #plasma BUGS: 378548 Differential Revision: https://phabricator.kde.org/D5355
-rw-r--r--kcmshell/main.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/kcmshell/main.cpp b/kcmshell/main.cpp
index 27b60af..c49373a 100644
--- a/kcmshell/main.cpp
+++ b/kcmshell/main.cpp
@@ -57,7 +57,9 @@ static bool caseInsensitiveLessThan(const KService::Ptr s1, const KService::Ptr
static void listModules()
{
- const KService::List services = KServiceTypeTrader::self()->query( "KCModule", "[X-KDE-ParentApp] == 'kcontrol' or [X-KDE-ParentApp] == 'kinfocenter'" );
+ // First condition is what systemsettings does, second what kinfocenter does, make sure this is kept in sync
+ // We need the exist calls because otherwise the trader language aborts if the property doesn't exist and the second part of the or is not evaluated
+ const KService::List services = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), QStringLiteral("(exist [X-KDE-System-Settings-Parent-Category] and [X-KDE-System-Settings-Parent-Category] != '') or (exist [X-KDE-ParentApp] and [X-KDE-ParentApp] == 'kinfocenter')") );
for( KService::List::const_iterator it = services.constBegin(); it != services.constEnd(); ++it) {
const KService::Ptr s = (*it);
if (!KAuthorized::authorizeControlModule(s->menuId()))