summaryrefslogtreecommitdiffstats
path: root/kcontrol
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-09-04 23:28:04 +0300
committerMavridis Philippe <mavridisf@gmail.com>2024-09-08 01:31:30 +0300
commit63178a8866996791c95b349988a064c26a826025 (patch)
tree6e904b1efe4bee3864f395de9e75ab569df1970f /kcontrol
parent0046b760c3a6426720ff6010ac108ecbd49dfa61 (diff)
downloadtdebase-63178a8866996791c95b349988a064c26a826025.tar.gz
tdebase-63178a8866996791c95b349988a064c26a826025.zip
KControl: implement dynamic module tests
Since KDE 3.4 there is underlying support for dynamically determining whether a module should be loaded or not, depending on an exported test function which would return a boolean value depending on the success of one or more tests (e.g. for presence of specific hardware). This approach is documented but has so far not been implemented by the TDE Control Centre. This commit adds a check to the TCC which performs the test function if needed (that is, if the X-TDE-Test-Module property is true) and, if it returns false, prevents showing the module in the tree list, which is the intended behaviour of the test function feature. For more information see: https://wiki.trinitydesktop.org/index.php?title=TDEConfig_Module_HOWTO&oldid=1893#Making_a_KCModule_dynamically_available Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit e91257a7c75a50b69bde8189f336acc89fa4fec0)
Diffstat (limited to 'kcontrol')
-rw-r--r--kcontrol/kcontrol/modules.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/kcontrol/kcontrol/modules.cpp b/kcontrol/kcontrol/modules.cpp
index c419e0d4e..0d6c9f7fc 100644
--- a/kcontrol/kcontrol/modules.cpp
+++ b/kcontrol/kcontrol/modules.cpp
@@ -284,9 +284,9 @@ bool ConfigModuleList::readDesktopEntriesRecursive(const TQString &path)
KService *s = static_cast<KService*>(p);
if (!kapp->authorizeControlModule(s->menuId()))
continue;
-
+
ConfigModule *module = new ConfigModule(s);
- if (module->library().isEmpty())
+ if (module->library().isEmpty() || (module->needsTest() && !TDECModuleLoader::testModule(*module)))
{
delete module;
continue;