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 09:48:48 +0200 |
commit | 28ccd3d7f23f330e40c3f5a4768e8955aada4635 (patch) | |
tree | a793c1957f2d120f8efc847f687ff7ca8b560bc5 /kcontrol/screensaver/scrnsave.cpp | |
parent | 515465039af34e4bf87a3d4ae4585e9b37315310 (diff) | |
download | tdebase-28ccd3d7f23f330e40c3f5a4768e8955aada4635.tar.gz tdebase-28ccd3d7f23f330e40c3f5a4768e8955aada4635.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>
(cherry picked from commit 58d7c360547e57857982fafd72b8a2086906c7d7)
Diffstat (limited to 'kcontrol/screensaver/scrnsave.cpp')
-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; } } |