diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-04-29 16:46:10 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-04-29 16:46:10 +0900 |
commit | 59ef38d29164cfb93c8137c6245d402182aa9157 (patch) | |
tree | 05960f07d71c05e60ed28ee06ba16a553f402553 | |
parent | db8c0a13638bfe74653f47b9d4465a8648596d0a (diff) | |
download | tdebase-59ef38d29164cfb93c8137c6245d402182aa9157.tar.gz tdebase-59ef38d29164cfb93c8137c6245d402182aa9157.zip |
Added possibility to hide the Cancel button from the Desktop Session Locked dialog.
This relates to bug 1584.
-rw-r--r-- | kcontrol/screensaver/scrnsave.cpp | 23 | ||||
-rw-r--r-- | kcontrol/screensaver/scrnsave.h | 3 | ||||
-rw-r--r-- | kdesktop/kdesktop.kcfg | 31 | ||||
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 52 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 1 | ||||
-rw-r--r-- | kdesktop/lock/main.cc | 3 |
6 files changed, 70 insertions, 43 deletions
diff --git a/kcontrol/screensaver/scrnsave.cpp b/kcontrol/screensaver/scrnsave.cpp index 33df74f27..18925e889 100644 --- a/kcontrol/screensaver/scrnsave.cpp +++ b/kcontrol/screensaver/scrnsave.cpp @@ -177,7 +177,7 @@ KScreenSaver::KScreenSaver(TQWidget *parent, const char *name, const TQStringLis mSettingsGroup = new TQGroupBox( i18n("Settings"), this ); mSettingsGroup->setColumnLayout( 0, Qt::Vertical ); leftColumnLayout->addWidget( mSettingsGroup ); - TQGridLayout *settingsGroupLayout = new TQGridLayout( mSettingsGroup->layout(), 4, 2, KDialog::spacingHint() ); + TQGridLayout *settingsGroupLayout = new TQGridLayout( mSettingsGroup->layout(), 5, 2, KDialog::spacingHint() ); mEnabledCheckBox = new TQCheckBox(i18n("Start a&utomatically"), mSettingsGroup); mEnabledCheckBox->setChecked(mEnabled); @@ -264,13 +264,20 @@ KScreenSaver::KScreenSaver(TQWidget *parent, const char *name, const TQStringLis settingsGroupLayout->addWidget(mUseUnmanagedLockWindowsCheckBox, 2, 1); TQWhatsThis::add( mUseUnmanagedLockWindowsCheckBox, i18n("Use old-style unmanaged X11 lock windows.") ); - mHideActiveWindowsFromSaverCheckBox = new TQCheckBox( i18n("&Hide active windows from saver"), mSettingsGroup ); + mHideActiveWindowsFromSaverCheckBox = new TQCheckBox( i18n("Hide active &windows from saver"), mSettingsGroup ); mHideActiveWindowsFromSaverCheckBox->setEnabled( true ); mHideActiveWindowsFromSaverCheckBox->setChecked( mHideActiveWindowsFromSaver ); connect( mHideActiveWindowsFromSaverCheckBox, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotHideActiveWindowsFromSaver( bool ) ) ); settingsGroupLayout->addWidget(mHideActiveWindowsFromSaverCheckBox, 3, 1); TQWhatsThis::add( mHideActiveWindowsFromSaverCheckBox, i18n("Hide all active windows from the screen saver and use the desktop background as the screen saver input.") ); + mHideCancelButtonCheckBox = new TQCheckBox( i18n("&Hide Cancel &button"), mSettingsGroup ); + mHideCancelButtonCheckBox->setEnabled( true ); + mHideCancelButtonCheckBox->setChecked( mHideCancelButton ); + connect( mHideCancelButtonCheckBox, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotHideCancelButton(bool)) ); + settingsGroupLayout->addWidget(mHideCancelButtonCheckBox, 4, 1); + TQWhatsThis::add(mHideCancelButtonCheckBox, i18n("Hide Cancel button from the \"Desktop Session Locked\" dialog.")); + // right column TQBoxLayout* rightColumnLayout = new TQVBoxLayout(topLayout, KDialog::spacingHint()); @@ -432,6 +439,7 @@ void KScreenSaver::readSettings( bool useDefaults ) mUseTSAK = config->readBoolEntry("UseTDESAK", true); mUseUnmanagedLockWindows = config->readBoolEntry("UseUnmanagedLockWindows", false); mHideActiveWindowsFromSaver = config->readBoolEntry("HideActiveWindowsFromSaver", true); + mHideCancelButton = config->readBoolEntry("HideCancelButton", false); mSaver = config->readEntry("Saver"); if (mTimeout < 60) mTimeout = 60; @@ -484,6 +492,7 @@ void KScreenSaver::save() config->writeEntry("UseTDESAK", mUseTSAK); config->writeEntry("UseUnmanagedLockWindows", mUseUnmanagedLockWindows); config->writeEntry("HideActiveWindowsFromSaver", mHideActiveWindowsFromSaver); + config->writeEntry("HideCancelButton", mHideCancelButton); if ( !mSaver.isEmpty() ) config->writeEntry("Saver", mSaver); @@ -980,6 +989,16 @@ void KScreenSaver::slotHideActiveWindowsFromSaver( bool h ) //--------------------------------------------------------------------------- // +void KScreenSaver::slotHideCancelButton( bool h ) +{ + if (mHideCancelButtonCheckBox->isEnabled()) mHideCancelButton = h; + processLockouts(); + mChanged = true; + emit changed(true); +} + +//--------------------------------------------------------------------------- +// void KScreenSaver::slotSetupDone(TDEProcess *) { mPrevSelected = -1; // see ugly hack in slotPreviewExited() diff --git a/kcontrol/screensaver/scrnsave.h b/kcontrol/screensaver/scrnsave.h index a8f6e53b0..d52c81227 100644 --- a/kcontrol/screensaver/scrnsave.h +++ b/kcontrol/screensaver/scrnsave.h @@ -60,6 +60,7 @@ protected slots: void slotUseTSAK( bool ); void slotUseUnmanagedLockWindows( bool ); void slotHideActiveWindowsFromSaver( bool ); + void slotHideCancelButton( bool ); void processLockouts(); void slotSetupDone(TDEProcess*); // when selecting a new screensaver, the old preview will @@ -103,6 +104,7 @@ protected: TQCheckBox *mUseTSAKCheckBox; TQCheckBox *mUseUnmanagedLockWindowsCheckBox; TQCheckBox *mHideActiveWindowsFromSaverCheckBox; + TQCheckBox *mHideCancelButtonCheckBox; int mSelected; int mPrevSelected; @@ -121,6 +123,7 @@ protected: bool mUseTSAK; bool mUseUnmanagedLockWindows; bool mHideActiveWindowsFromSaver; + bool mHideCancelButton; KSimpleConfig* mTDMConfig; }; diff --git a/kdesktop/kdesktop.kcfg b/kdesktop/kdesktop.kcfg index 2298e16c5..f2226f79d 100644 --- a/kdesktop/kdesktop.kcfg +++ b/kdesktop/kdesktop.kcfg @@ -271,92 +271,71 @@ <default>false</default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:308 --> - <!-- if(config.readBoolEntry("Lock", false)) --> </entry> <entry key="LockGrace" type="Int"> <default>5000</default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:310 --> - <!-- mLockGrace = config.readNumEntry("LockGrace", LOCK_GRACE_DEFAULT); --> </entry> <entry key="AutoLogout" type="Bool"> <default>false</default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:319 --> - <!-- if (config.readBoolEntry("AutoLogout", false)) --> </entry> <entry key="AutoLogoutTimeout" type="Int"> <default>600</default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:322 --> - <!-- mAutoLogoutTimeout = config.readNumEntry("AutoLogoutTimeout", AUTOLOGOUT_DEFAULT); --> </entry> <entry key="Priority" type="Int"> <default>19</default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:332 --> - <!-- mPriority = config.readNumEntry("Priority", 19); --> </entry> <entry key="Saver" type="String"> <default></default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:336 --> - <!-- mSaver = config.readEntry("Saver"); --> </entry> <entry key="UseUnmanagedLockWindows" type="Bool"> <default>false</default> <label></label> <whatsthis>When enabled this restores the old style unmanaged window behavior of desktop locking.</whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:336 --> - <!-- mSaver = config.readEntry("UseUnmanagedLockWindows"); --> </entry> <entry key="ShowLockDateTime" type="Bool"> <default>true</default> <label></label> <whatsthis>When enabled the date and time when the desktop was locked is displayed as an additional intrusion detection measure.</whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:336 --> - <!-- mSaver = config.readEntry("ShowLockDateTime"); --> </entry> <entry key="DelaySaverStart" type="Bool"> <default>true</default> <label></label> <whatsthis>When disabled the screensaver starts immediately when locking the desktop.</whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:336 --> - <!-- mSaver = config.readEntry("DelaySaverStart"); --> </entry> <entry key="HideActiveWindowsFromSaver" type="Bool"> <default>true</default> <label></label> <whatsthis>When enabled all active windows are hidden from the screensaver, showing only the desktop background as a result.</whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:336 --> - <!-- mSaver = config.readEntry("HideActiveWindowsFromSaver"); --> + </entry> + <entry key="HideCancelButton" type="Bool"> + <default>false</default> + <label></label> + <whatsthis>Hide Cancel button from the "Desktop Session Locked" dialog.</whatsthis> </entry> <entry key="UseTDESAK" type="Bool"> <default>true</default> <label></label> <whatsthis>When enabled, the Trinity Secure Attention Key (TSAK) system will be used to secure the screen locker. This requires system wide TSAK support to be enabled prior to use.</whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:336 --> - <!-- mSaver = config.readEntry("UseTDESAK"); --> </entry> <entry key="PluginsUnlock" type="StringList"> <default></default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:342 --> - <!-- mPlugins = config.readListEntry("PluginsUnlock"); --> </entry> <entry key="PluginOptions" type="StringList"> <default></default> <label></label> <whatsthis></whatsthis> - <!-- /home/paco/cvsroot/tdebase/kdesktop/lock/lockprocess.cc:345 --> - <!-- mPluginOptions = config.readListEntry("PluginOptions"); --> </entry> </group> <group name="MiniCli"> diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 30a892ca1..c3779581f 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -66,6 +66,7 @@ extern bool trinity_desktop_lock_autohide_lockdlg; extern bool trinity_desktop_lock_delay_screensaver_start; extern bool trinity_desktop_lock_use_system_modal_dialogs; extern bool trinity_desktop_lock_use_sak; +extern bool trinity_desktop_lock_hide_cancel_button; int dialogHideTimeout = 10*1000; @@ -149,8 +150,13 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) mNewSessButton = new KPushButton( KGuiItem(i18n("Sw&itch User..."), "fork"), frame ); ok = new KPushButton( i18n("Unl&ock"), frame ); - cancel = new KPushButton( KStdGuiItem::cancel(), frame ); - //if (!trinity_desktop_lock_autohide_lockdlg && !trinity_desktop_lock_use_sak) cancel->setEnabled(false); + ok->setDefault(true); + + if (!trinity_desktop_lock_hide_cancel_button) + { + cancel = new KPushButton( KStdGuiItem::cancel(), frame ); + // if (!trinity_desktop_lock_autohide_lockdlg && !trinity_desktop_lock_use_sak) cancel->setEnabled(false); + } greet = plugin->info->create( this, 0, this, mLayoutButton, TQString::null, KGreeterPlugin::Authenticate, KGreeterPlugin::ExUnlock ); @@ -165,8 +171,11 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); layButtons->addWidget( mNewSessButton ); layButtons->addStretch(); - layButtons->addWidget( ok ); - layButtons->addWidget( cancel ); + layButtons->addWidget(ok); + if (!trinity_desktop_lock_hide_cancel_button) + { + layButtons->addWidget(cancel); + } if (trinity_desktop_lock_use_system_modal_dialogs) { KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); @@ -202,11 +211,17 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) } setTabOrder( ok, cancel ); - setTabOrder( cancel, mNewSessButton ); + if (!trinity_desktop_lock_hide_cancel_button) + { + setTabOrder( cancel, mNewSessButton ); + } setTabOrder( mNewSessButton, mLayoutButton ); connect(mLayoutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(layoutClicked())); - connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + if (!trinity_desktop_lock_hide_cancel_button) + { + connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + } connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); connect(mNewSessButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotSwitchUser())); @@ -256,9 +271,11 @@ PasswordDlg::~PasswordDlg() void PasswordDlg::reject() { - // if (trinity_desktop_lock_autohide_lockdlg || trinity_desktop_lock_use_sak) - TQDialog::reject(); -} + if (!trinity_desktop_lock_hide_cancel_button) + { + TQDialog::reject(); + } +} void PasswordDlg::layoutClicked() { @@ -309,11 +326,14 @@ void PasswordDlg::timerEvent(TQTimerEvent *ev) { if (ev->timerId() == mTimeoutTimerId) { - if (trinity_desktop_lock_autohide_lockdlg) { - reject(); + if (trinity_desktop_lock_autohide_lockdlg) + { + // Force dialog rejection regardless of the value of trinity_desktop_lock_hide_cancel_button + TQDialog::reject(); } - else { - slotActivity(); + else + { + slotActivity(); } } else if (ev->timerId() == mFailedTimerId) @@ -324,7 +344,11 @@ void PasswordDlg::timerEvent(TQTimerEvent *ev) mUnlockingFailed = false; updateLabel(); ok->setEnabled(true); - if (trinity_desktop_lock_autohide_lockdlg || trinity_desktop_lock_use_sak) cancel->setEnabled(true); + if (!trinity_desktop_lock_hide_cancel_button) + // if (trinity_desktop_lock_autohide_lockdlg || trinity_desktop_lock_use_sak) + { + cancel->setEnabled(true); + } mNewSessButton->setEnabled( true ); greet->revive(); greet->start(); diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index f7dc1c25a..773a0710a 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -154,6 +154,7 @@ extern bool trinity_desktop_lock_use_system_modal_dialogs; extern bool trinity_desktop_lock_delay_screensaver_start; extern bool trinity_desktop_lock_use_sak; extern bool trinity_desktop_lock_hide_active_windows; +extern bool trinity_desktop_lock_hide_cancel_button; extern bool trinity_desktop_lock_forced; extern bool argb_visual; diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index c90c2ef6b..2a8a6657d 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cc @@ -70,7 +70,7 @@ bool trinity_desktop_lock_use_system_modal_dialogs = FALSE; bool trinity_desktop_lock_delay_screensaver_start = FALSE; bool trinity_desktop_lock_use_sak = FALSE; bool trinity_desktop_lock_hide_active_windows = FALSE; - +bool trinity_desktop_lock_hide_cancel_button = FALSE; bool trinity_desktop_lock_forced = FALSE; bool signalled_forcelock; @@ -445,6 +445,7 @@ int main( int argc, char **argv ) trinity_desktop_lock_delay_screensaver_start = false; // If trinity_desktop_lock_delay_screensaver_start is true with unmanaged windows, the lock dialog may never appear } trinity_desktop_lock_hide_active_windows = KDesktopSettings::hideActiveWindowsFromSaver(); + trinity_desktop_lock_hide_cancel_button = KDesktopSettings::hideCancelButton(); delete tdmconfig; |