From a6fbc0f1e09859de2a8414b00c8b39082b0f974e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 1 May 2014 13:15:49 +0900 Subject: Commits ccb5fca, 59ef38d, 710fc43 re-pushed to local branch for further development. This relates to bug 1584. --- kdesktop/kdesktop.kcfg | 31 ++++-------------------- kdesktop/lock/lockdlg.cc | 56 +++++++++++++++++++++++++++++++------------- kdesktop/lock/lockprocess.cc | 1 + kdesktop/lock/main.cc | 3 ++- 4 files changed, 48 insertions(+), 43 deletions(-) (limited to 'kdesktop') 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 @@ false - - 5000 - - false - - 600 - - 19 - - - - false When enabled this restores the old style unmanaged window behavior of desktop locking. - - true When enabled the date and time when the desktop was locked is displayed as an additional intrusion detection measure. - - true When disabled the screensaver starts immediately when locking the desktop. - - true When enabled all active windows are hidden from the screensaver, showing only the desktop background as a result. - - + + + false + + Hide Cancel button from the "Desktop Session Locked" dialog. true 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. - - - - - - diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 163a03e43..847e018d1 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,13 +150,17 @@ 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 ); - TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); unlockDialogLayout->addWidget( frame ); @@ -166,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 ); @@ -203,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())); @@ -257,9 +271,12 @@ 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 || trinity_desktop_lock_autohide_lockdlg || + trinity_desktop_lock_use_sak) + { + TQDialog::reject(); + } +} void PasswordDlg::layoutClicked() { @@ -310,11 +327,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) @@ -325,7 +345,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(); @@ -440,7 +464,7 @@ void PasswordDlg::reapVerify() updateLabel(); mFailedTimerId = startTimer(1500); ok->setEnabled(false); - cancel->setEnabled(false); + //cancel->setEnabled(false); mNewSessButton->setEnabled( false ); return; case AuthAbort: 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; -- cgit v1.2.1 From 868c510ed63f27464d74b0c5e8f71f765c02f563 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 2 May 2014 11:53:32 +0900 Subject: "Hide Cancel button" functionality in kdesktop_lock is now fully working also on SAK available and enabled systems. This (finally!) fully solves bug 1584. --- kdesktop/lock/lockdlg.cc | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'kdesktop') diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 847e018d1..bfa727678 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -152,11 +152,13 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) ok = new KPushButton( i18n("Unl&ock"), frame ); ok->setDefault(true); - if (!trinity_desktop_lock_hide_cancel_button) - { + bool show_cancel_button = !trinity_desktop_lock_hide_cancel_button || + trinity_desktop_lock_use_sak || + !trinity_desktop_lock_use_system_modal_dialogs; + if (show_cancel_button) cancel = new KPushButton( KStdGuiItem::cancel(), frame ); - // if (!trinity_desktop_lock_autohide_lockdlg && !trinity_desktop_lock_use_sak) cancel->setEnabled(false); - } + else + cancel = NULL; greet = plugin->info->create( this, 0, this, mLayoutButton, TQString::null, KGreeterPlugin::Authenticate, KGreeterPlugin::ExUnlock ); @@ -172,10 +174,8 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) layButtons->addWidget( mNewSessButton ); layButtons->addStretch(); layButtons->addWidget(ok); - if (!trinity_desktop_lock_hide_cancel_button) - { + if (show_cancel_button) layButtons->addWidget(cancel); - } if (trinity_desktop_lock_use_system_modal_dialogs) { KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); @@ -210,15 +210,19 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); } - setTabOrder( ok, cancel ); - if (!trinity_desktop_lock_hide_cancel_button) + if (show_cancel_button) { + setTabOrder( ok, cancel ); setTabOrder( cancel, mNewSessButton ); } + else + { + setTabOrder( ok, mNewSessButton ); + } setTabOrder( mNewSessButton, mLayoutButton ); connect(mLayoutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(layoutClicked())); - if (!trinity_desktop_lock_hide_cancel_button) + if (show_cancel_button) { connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); } @@ -271,8 +275,8 @@ PasswordDlg::~PasswordDlg() void PasswordDlg::reject() { - if (!trinity_desktop_lock_hide_cancel_button || trinity_desktop_lock_autohide_lockdlg || - trinity_desktop_lock_use_sak) + if (!trinity_desktop_lock_hide_cancel_button || trinity_desktop_lock_use_sak || + !trinity_desktop_lock_use_system_modal_dialogs || trinity_desktop_lock_autohide_lockdlg) { TQDialog::reject(); } @@ -345,11 +349,6 @@ void PasswordDlg::timerEvent(TQTimerEvent *ev) mUnlockingFailed = false; updateLabel(); ok->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(); @@ -464,7 +463,6 @@ void PasswordDlg::reapVerify() updateLabel(); mFailedTimerId = startTimer(1500); ok->setEnabled(false); - //cancel->setEnabled(false); mNewSessButton->setEnabled( false ); return; case AuthAbort: -- cgit v1.2.1