summaryrefslogtreecommitdiffstats
path: root/kcontrol/screensaver/scrnsave.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-07-24 14:04:34 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-07-24 14:04:34 -0500
commit0d3ebd90203be2314e9c9fece66216f36dab3abe (patch)
tree4291bbfa32286d328059df54f4e3cc5b8cea98d0 /kcontrol/screensaver/scrnsave.cpp
parent763b290f0123855a1d9e8fde0583297e0ce5941b (diff)
downloadtdebase-0d3ebd90203be2314e9c9fece66216f36dab3abe.tar.gz
tdebase-0d3ebd90203be2314e9c9fece66216f36dab3abe.zip
Do not display screensavers in the configuration dialog that are not installed on the system
Diffstat (limited to 'kcontrol/screensaver/scrnsave.cpp')
-rw-r--r--kcontrol/screensaver/scrnsave.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/kcontrol/screensaver/scrnsave.cpp b/kcontrol/screensaver/scrnsave.cpp
index 776c8e43a..8980c8e3c 100644
--- a/kcontrol/screensaver/scrnsave.cpp
+++ b/kcontrol/screensaver/scrnsave.cpp
@@ -27,6 +27,7 @@
#include <tqpushbutton.h>
#include <tqslider.h>
#include <tqtimer.h>
+#include <tqfileinfo.h>
#include <tqwhatsthis.h>
#include <dcopclient.h>
@@ -519,9 +520,28 @@ void KScreenSaver::findSavers()
TQString file = mSaverFileList[mNumLoaded];
SaverConfig *saver = new SaverConfig;
if (saver->read(file)) {
- mSaverList.append(saver);
- } else
+ TQString saverexec = TQString("%1/%2").arg(XSCREENSAVER_HACKS_DIR).arg(saver->exec());
+ // 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);
+ }
+ else {
+ // Executable not present in XScreenSaver directory!
+ // Try standard paths
+ if (TDEStandardDirs::findExe(saver->exec()) != TQString::null) {
+ mSaverList.append(saver);
+ }
+ else {
+ delete saver;
+ }
+ }
+ }
+ else {
delete saver;
+ }
}
if ( (unsigned)mNumLoaded == mSaverFileList.count() ) {