diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2022-03-28 23:34:29 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2022-03-29 00:15:35 +0200 |
commit | 58d7c360547e57857982fafd72b8a2086906c7d7 (patch) | |
tree | 47e7ff801b96321881836e881274138cf6242ffc /kcontrol | |
parent | 4974727d50923a4393e5f0daddf4694c6e082a84 (diff) | |
download | tdebase-58d7c360547e57857982fafd72b8a2086906c7d7.tar.gz tdebase-58d7c360547e57857982fafd72b8a2086906c7d7.zip |
Modify screen savers detection that the XSCREENSAVER_DIRS
and XSCREENSAVER_CONFIG_DIRS variables allow multiple paths.
Likewise, the XSCREENSAVER HACKS DIRS variable used to search
for an screen saver executable can contain multiple paths.
This relates to TDE/tdeartwork#19.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kcontrol')
-rw-r--r-- | kcontrol/screensaver/scrnsave.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/kcontrol/screensaver/scrnsave.cpp b/kcontrol/screensaver/scrnsave.cpp index b66f7bbd6..cd30fa1a1 100644 --- a/kcontrol/screensaver/scrnsave.cpp +++ b/kcontrol/screensaver/scrnsave.cpp @@ -523,28 +523,39 @@ void KScreenSaver::findSavers() i++, mNumLoaded++ ) { TQString file = mSaverFileList[mNumLoaded]; SaverConfig *saver = new SaverConfig; - if (saver->read(file)) { - TQString saverexec = TQString("%1/%2").arg(XSCREENSAVER_HACKS_DIR).arg(saver->exec()); + bool saverFound = false; + if (saver->read(file)) + { // find the xscreensaver executable //work around a TDEStandardDirs::findExe() "feature" where it looks in $TDEDIR/bin first no matter what and sometimes finds the wrong executable TQFileInfo checkExe; - checkExe.setFile(saverexec); - if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile()) { - mSaverList.append(saver); + TQStringList saverPaths = TQStringList::split(':', XSCREENSAVER_HACKS_DIRS); + for (TQStringList::ConstIterator it = saverPaths.begin(); it != saverPaths.end(); ++it) + { + checkExe.setFile((*it) + "/" + saver->exec()); + if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile()) + { + mSaverList.append(saver); + saverFound = true; + break; + } } - else { + + if (!saverFound) + { // Executable not present in XScreenSaver directory! // Try standard paths - if (TDEStandardDirs::findExe(saver->exec()) != TQString::null) { + if (TDEStandardDirs::findExe(saver->exec()) != TQString::null) + { mSaverList.append(saver); - } - else { - delete saver; + saverFound = true; } } } - else { - delete saver; + + if (!saverFound) + { + delete saver; } } |