diff options
author | Timothy Pearson <[email protected]> | 2013-04-06 15:10:56 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-04-06 15:10:56 -0500 |
commit | 091b1eface0a6172927a481c8d7e4030f3d2d0b9 (patch) | |
tree | 96e1d92104f359027f1546049e9098e90755a270 /kcontrol/screensaver/scrnsave.cpp | |
parent | 67fdaf7041a47e442bc96b21a108931745180d71 (diff) | |
download | tdebase-091b1eface0a6172927a481c8d7e4030f3d2d0b9.tar.gz tdebase-091b1eface0a6172927a481c8d7e4030f3d2d0b9.zip |
Honor per-user lock screen SAK setting
This resolves Bug 811
Clean up screen saver settings display to more accurately reflect the current configuration
Diffstat (limited to 'kcontrol/screensaver/scrnsave.cpp')
-rw-r--r-- | kcontrol/screensaver/scrnsave.cpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/kcontrol/screensaver/scrnsave.cpp b/kcontrol/screensaver/scrnsave.cpp index f58dd3815..776c8e43a 100644 --- a/kcontrol/screensaver/scrnsave.cpp +++ b/kcontrol/screensaver/scrnsave.cpp @@ -16,6 +16,7 @@ #include <sys/types.h> #include <sys/wait.h> +#include <sys/stat.h> #include <tqbuttongroup.h> #include <tqcheckbox.h> @@ -41,6 +42,7 @@ #include <kprocess.h> #include <kservicegroup.h> #include <kstandarddirs.h> +#include <ksimpleconfig.h> #include <X11/Xlib.h> @@ -48,6 +50,15 @@ #include <fixx11h.h> +#define OPEN_TDMCONFIG_AND_SET_GROUP \ +if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) { \ + mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); \ +} \ +else { \ + mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); \ +} \ +mTDMConfig->setGroup("X-*-Greeter"); + template class TQPtrList<SaverConfig>; const uint widgetEventMask = // X event mask @@ -81,6 +92,9 @@ KScreenSaver::KScreenSaver(TQWidget *parent, const char *name, const TQStringLis mMonitor = 0; mTesting = false; + struct stat st; + OPEN_TDMCONFIG_AND_SET_GROUP + // Add non-TDE path TDEGlobal::dirs()->addResourceType("scrsav", TDEGlobal::dirs()->kde_default("apps") + @@ -354,6 +368,8 @@ KScreenSaver::~KScreenSaver() delete mTestProc; delete mSetupProc; delete mTestWin; + + delete mTDMConfig; } //--------------------------------------------------------------------------- @@ -655,9 +671,30 @@ void KScreenSaver::processLockouts() mActivateLbl->setEnabled( mEnabled ); mWaitEdit->setEnabled( mEnabled ); mLockCheckBox->setEnabled( mEnabled ); - mDelaySaverStartCheckBox->setEnabled( mEnabled && !mUseUnmanagedLockWindows ); - mUseTSAKCheckBox->setEnabled( !mUseUnmanagedLockWindows ); - mHideActiveWindowsFromSaverCheckBox->setEnabled( !mUseUnmanagedLockWindows ); + if (mEnabled && !mUseUnmanagedLockWindows) { + mDelaySaverStartCheckBox->setEnabled( true ); + mDelaySaverStartCheckBox->setChecked( mDelaySaverStart ); + } + else { + mDelaySaverStartCheckBox->setEnabled( false ); + mDelaySaverStartCheckBox->setChecked( false ); + } + if (!mUseUnmanagedLockWindows && mTDMConfig->readBoolEntry("UseSAK", true)) { + mUseTSAKCheckBox->setEnabled( true ); + mUseTSAKCheckBox->setChecked( mUseTSAK ); + } + else { + mUseTSAKCheckBox->setEnabled( false ); + mUseTSAKCheckBox->setChecked( false ); + } + if (!mUseUnmanagedLockWindows) { + mHideActiveWindowsFromSaverCheckBox->setEnabled( true ); + mHideActiveWindowsFromSaverCheckBox->setChecked( mHideActiveWindowsFromSaver ); + } + else { + mHideActiveWindowsFromSaverCheckBox->setEnabled( false ); + mHideActiveWindowsFromSaverCheckBox->setChecked( false ); + } mLockLbl->setEnabled( mEnabled && mLock ); mWaitLockEdit->setEnabled( mEnabled && mLock ); } @@ -885,7 +922,7 @@ void KScreenSaver::slotLock( bool l ) // void KScreenSaver::slotDelaySaverStart( bool d ) { - mDelaySaverStart = d; + if (mDelaySaverStartCheckBox->isEnabled()) mDelaySaverStart = d; processLockouts(); mChanged = true; emit changed(true); @@ -895,7 +932,7 @@ void KScreenSaver::slotDelaySaverStart( bool d ) // void KScreenSaver::slotUseTSAK( bool u ) { - mUseTSAK = u; + if (mUseTSAKCheckBox->isEnabled()) mUseTSAK = u; processLockouts(); mChanged = true; emit changed(true); @@ -905,7 +942,7 @@ void KScreenSaver::slotUseTSAK( bool u ) // void KScreenSaver::slotUseUnmanagedLockWindows( bool u ) { - mUseUnmanagedLockWindows = u; + if (mUseUnmanagedLockWindowsCheckBox->isEnabled()) mUseUnmanagedLockWindows = u; processLockouts(); mChanged = true; emit changed(true); @@ -915,7 +952,7 @@ void KScreenSaver::slotUseUnmanagedLockWindows( bool u ) // void KScreenSaver::slotHideActiveWindowsFromSaver( bool h ) { - mHideActiveWindowsFromSaver = h; + if (mHideActiveWindowsFromSaverCheckBox->isEnabled()) mHideActiveWindowsFromSaver = h; processLockouts(); mChanged = true; emit changed(true); |