summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kxsconfig/kxsconfig.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-03-29 02:53:16 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-03-29 02:53:16 +0200
commitb0eb71dedfc68ca5ce981b2853af9a64b2c2e67f (patch)
tree8734f4b2c86a22c8aa0945816102969dda4ce01f /tdescreensaver/kxsconfig/kxsconfig.cpp
parente5903f8f6e3d5cec0934a62040fe5a95179e2bb0 (diff)
downloadtdeartwork-b0eb71dedfc68ca5ce981b2853af9a64b2c2e67f.tar.gz
tdeartwork-b0eb71dedfc68ca5ce981b2853af9a64b2c2e67f.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 #19. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdescreensaver/kxsconfig/kxsconfig.cpp')
-rw-r--r--tdescreensaver/kxsconfig/kxsconfig.cpp42
1 files changed, 33 insertions, 9 deletions
diff --git a/tdescreensaver/kxsconfig/kxsconfig.cpp b/tdescreensaver/kxsconfig/kxsconfig.cpp
index 28e9d112..f91b0321 100644
--- a/tdescreensaver/kxsconfig/kxsconfig.cpp
+++ b/tdescreensaver/kxsconfig/kxsconfig.cpp
@@ -101,11 +101,21 @@ bool KXSConfigDialog::create()
TDEConfig config(mConfigFile);
TQString xmlFile = "/doesntexist";
-#ifdef XSCREENSAVER_CONFIG_DIR
- xmlFile = XSCREENSAVER_CONFIG_DIR;
+ xmlFile += "/" + mExeName + ".xml";
+#ifdef XSCREENSAVER_CONFIG_DIRS
+ TQFileInfo checkXml;
+ TQStringList saverConfigPaths = TQStringList::split(':', XSCREENSAVER_CONFIG_DIRS);
+ for (TQStringList::ConstIterator it = saverConfigPaths.begin(); it != saverConfigPaths.end(); ++it)
+ {
+ checkXml.setFile((*it) + "/" + mExeName + ".xml");
+ if (checkXml.exists())
+ {
+ xmlFile = checkXml.absFilePath();
+ break;
+ }
+ }
#endif
- xmlFile += "/" + mExeName + ".xml";
if ( TQFile::exists( xmlFile ) ) {
// We can use the xscreensaver xml config files.
KXSXml xmlParser(controlLayout);
@@ -227,15 +237,29 @@ void KXSConfigDialog::slotPreviewExited(TDEProcess *)
TQString word;
saver = saver.stripWhiteSpace();
while ( !saver[i].isSpace() ) word += saver[i++];
+
+ // find the xscreensaver executable
//work around a KStandarDirs::findExe() "feature" where it looks in $TDEDIR/bin first no matter what and sometimes finds the wrong executable
- TQFileInfo checkExe;
- TQString saverdir = TQString("%1/%2").arg(XSCREENSAVER_HACKS_DIR).arg(word);
TQString path;
- checkExe.setFile(saverdir);
- if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile())
+ TQFileInfo checkExe;
+ TQStringList saverPaths = TQStringList::split(':', XSCREENSAVER_HACKS_DIRS);
+ for (TQStringList::ConstIterator it = saverPaths.begin(); it != saverPaths.end(); ++it)
+ {
+ checkExe.setFile((*it) + "/" + word);
+ if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile())
+ {
+ path = checkExe.absFilePath();
+ break;
+ }
+ }
+
+ if (path.isEmpty())
{
- path = saverdir;
+ // Executable not present in XScreenSaver directory!
+ // Try standard paths
+ path = TDEStandardDirs::findExe(word);
}
+
if (!path.isEmpty()) {
(*mPreviewProc) << path;
@@ -260,7 +284,7 @@ void KXSConfigDialog::slotPreviewExited(TDEProcess *)
}
} else {
// stops us from spawning the hack really fast, but still not the best
- TQString path = TDEStandardDirs::findExe(mFilename, XSCREENSAVER_HACKS_DIR);
+ TQString path = TDEStandardDirs::findExe(mFilename, XSCREENSAVER_HACKS_DIRS);
if ( TQFile::exists(path) ) {
mKilled = true;
slotChanged();