diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-06 15:10:56 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-04-07 02:20:11 +0200 |
commit | eb1b42efffa3e6a0ab960be407f57e8d58638de9 (patch) | |
tree | b9a0533aa0e0cb4f25df1bd63e1edd6c4b2c2ad4 /kcontrol | |
parent | 06f7b3b478e67358c1fcf5f2ae86b9dea83b480a (diff) | |
download | tdebase-eb1b42efffa3e6a0ab960be407f57e8d58638de9.tar.gz tdebase-eb1b42efffa3e6a0ab960be407f57e8d58638de9.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
(cherry picked from commit 091b1eface0a6172927a481c8d7e4030f3d2d0b9)
Diffstat (limited to 'kcontrol')
-rw-r--r-- | kcontrol/screensaver/scrnsave.cpp | 51 | ||||
-rw-r--r-- | kcontrol/screensaver/scrnsave.h | 2 |
2 files changed, 46 insertions, 7 deletions
diff --git a/kcontrol/screensaver/scrnsave.cpp b/kcontrol/screensaver/scrnsave.cpp index 9f16d2aae..284649619 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 "/kdm/kdmdistrc" , &st ) == 0) { \ + mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/kdm/kdmdistrc" )); \ +} \ +else { \ + mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/kdm/kdmrc" )); \ +} \ +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-KDE path KGlobal::dirs()->addResourceType("scrsav", KGlobal::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); diff --git a/kcontrol/screensaver/scrnsave.h b/kcontrol/screensaver/scrnsave.h index 1f7875f5f..64d9527ff 100644 --- a/kcontrol/screensaver/scrnsave.h +++ b/kcontrol/screensaver/scrnsave.h @@ -121,6 +121,8 @@ protected: bool mUseTSAK; bool mUseUnmanagedLockWindows; bool mHideActiveWindowsFromSaver; + + KSimpleConfig* mTDMConfig; }; #endif |