summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kxsconfig/kxsconfig.cpp
diff options
context:
space:
mode:
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();