diff options
Diffstat (limited to 'kdesktop/lock/lockdlg.cc')
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 163a03e43..bfa727678 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,19 @@ 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); + + 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 ); + else + cancel = NULL; greet = plugin->info->create( this, 0, this, mLayoutButton, TQString::null, KGreeterPlugin::Authenticate, KGreeterPlugin::ExUnlock ); - TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); unlockDialogLayout->addWidget( frame ); @@ -166,8 +173,9 @@ 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 (show_cancel_button) + layButtons->addWidget(cancel); if (trinity_desktop_lock_use_system_modal_dialogs) { KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); @@ -202,12 +210,22 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); } - setTabOrder( ok, cancel ); - setTabOrder( cancel, mNewSessButton ); + 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())); - connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + if (show_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 +275,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_use_sak || + !trinity_desktop_lock_use_system_modal_dialogs || trinity_desktop_lock_autohide_lockdlg) + { + TQDialog::reject(); + } +} void PasswordDlg::layoutClicked() { @@ -310,11 +331,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 +349,6 @@ 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); mNewSessButton->setEnabled( true ); greet->revive(); greet->start(); @@ -440,7 +463,6 @@ void PasswordDlg::reapVerify() updateLabel(); mFailedTimerId = startTimer(1500); ok->setEnabled(false); - cancel->setEnabled(false); mNewSessButton->setEnabled( false ); return; case AuthAbort: |