summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/lockdlg.cc
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2014-04-29 16:46:10 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2014-04-29 16:46:10 +0900
commit59ef38d29164cfb93c8137c6245d402182aa9157 (patch)
tree05960f07d71c05e60ed28ee06ba16a553f402553 /kdesktop/lock/lockdlg.cc
parentdb8c0a13638bfe74653f47b9d4465a8648596d0a (diff)
downloadtdebase-59ef38d29164cfb93c8137c6245d402182aa9157.tar.gz
tdebase-59ef38d29164cfb93c8137c6245d402182aa9157.zip
Added possibility to hide the Cancel button from the Desktop Session Locked dialog.
This relates to bug 1584.
Diffstat (limited to 'kdesktop/lock/lockdlg.cc')
-rw-r--r--kdesktop/lock/lockdlg.cc52
1 files changed, 38 insertions, 14 deletions
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();