From 1039f2df32eb011fd4013167ac20ecdc607e1c7b Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 15 Sep 2011 07:33:07 +0000 Subject: Enhance SAK appearance git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1253791 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesktop/lock/lockdlg.cc | 48 +++++++++++++++++++++++++++++++++----------- kdesktop/lock/lockprocess.cc | 14 ++++++++++++- kdesktop/lock/sakdlg.cc | 43 ++++++++++----------------------------- kdesktop/lock/sakdlg.h | 7 +------ 4 files changed, 61 insertions(+), 51 deletions(-) (limited to 'kdesktop') diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 8059a28c7..fee47dfdb 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -96,13 +96,24 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); frame->setLineWidth( 2 ); - TQLabel *pixLabel = new TQLabel( frame, "pixlabel" ); - pixLabel->setPixmap(DesktopIcon("lock")); + TQLabel *pixLabel; + if (!trinity_desktop_lock_use_system_modal_dialogs) { + pixLabel = new TQLabel( frame, "pixlabel" ); + pixLabel->setPixmap(DesktopIcon("lock")); + } KUser user; - TQLabel *greetLabel = new TQLabel( user.fullName().isEmpty() ? - i18n("The session is locked
") : - i18n("
The session was locked by %1
").arg( user.fullName() ), frame ); + TQLabel *greetLabel; + if (trinity_desktop_lock_use_system_modal_dialogs) { + greetLabel = new TQLabel( user.fullName().isEmpty() ? + "" + i18n("This computer is in use and has been locked.") + "" : + "" + i18n("This computer is in use and has been locked.") + "
" + i18n("Only '%1' may unlock this session.").arg( user.fullName() ), frame ); + } + else { + greetLabel = new TQLabel( user.fullName().isEmpty() ? + i18n("The session is locked
") : + i18n("
The session was locked by %1
").arg( user.fullName() ), frame ); + } mStatusLabel = new TQLabel( " ", frame ); mStatusLabel->tqsetAlignment( TQLabel::AlignCenter ); @@ -134,13 +145,26 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) layButtons->addWidget( ok ); layButtons->addWidget( cancel ); - frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( pixLabel, 0, 2, 0, 0, Qt::AlignTop ); - frameLayout->addWidget( greetLabel, 0, 1 ); - frameLayout->addItem( greet->getLayoutItem(), 1, 1 ); - frameLayout->addLayout( layStatus, 2, 1 ); - frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 ); - frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); + + frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop ); + frameLayout->addWidget( greetLabel, 1, 1 ); + frameLayout->addItem( greet->getLayoutItem(), 2, 1 ); + frameLayout->addLayout( layStatus, 3, 1 ); + frameLayout->addMultiCellWidget( sep, 4, 4, 0, 1 ); + frameLayout->addMultiCellLayout( layButtons, 5, 5, 0, 1 ); + } + else { + frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( pixLabel, 0, 2, 0, 0, Qt::AlignTop ); + frameLayout->addWidget( greetLabel, 0, 1 ); + frameLayout->addItem( greet->getLayoutItem(), 1, 1 ); + frameLayout->addLayout( layStatus, 2, 1 ); + frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 ); + frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); + } setTabOrder( ok, cancel ); setTabOrder( cancel, mNewSessButton ); diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index 206dc9718..17de269bf 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -134,6 +134,7 @@ extern bool trinity_desktop_lock_use_sak; extern bool trinity_desktop_lock_forced; bool trinity_desktop_lock_autohide_lockdlg = TRUE; +bool trinity_desktop_lock_closing_windows = FALSE; #define ENABLE_CONTINUOUS_LOCKDLG_DISPLAY \ if (!mForceContinualLockDisplayTimer->isActive()) mForceContinualLockDisplayTimer->start(100, FALSE); \ @@ -316,15 +317,24 @@ static void sighup_handler(int) bool LockProcess::closeCurrentWindow() { + trinity_desktop_lock_closing_windows = TRUE; if (currentDialog != NULL) { mForceReject = true; - currentDialog->close(); + if (dynamic_cast(currentDialog)) { + dynamic_cast(currentDialog)->closeDialogForced(); + } + else { + currentDialog->close(); + } } if( mDialogs.isEmpty() ) { + trinity_desktop_lock_closing_windows = FALSE; + mForceReject = false; return false; } else { + trinity_desktop_lock_closing_windows = TRUE; return true; } } @@ -1402,6 +1412,8 @@ bool LockProcess::checkPass() // Wait for SAK press before continuing... SAKDlg inDlg( this ); int ret = execDialog( &inDlg ); + if (trinity_desktop_lock_closing_windows) + return 0; } showVkbd(); diff --git a/kdesktop/lock/sakdlg.cc b/kdesktop/lock/sakdlg.cc index 719f2122f..1647fb527 100644 --- a/kdesktop/lock/sakdlg.cc +++ b/kdesktop/lock/sakdlg.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -81,13 +82,12 @@ SAKDlg::SAKDlg(LockProcess *parent) frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); frame->setLineWidth( 2 ); - mpixLabel = new TQLabel( frame, "pixlabel" ); - mpixLabel->setPixmap(DesktopIcon("unlock")); + KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); KUser user; mStatusLabel = new TQLabel( " ", frame ); - mStatusLabel->tqsetAlignment( TQLabel::AlignCenter ); + mStatusLabel->tqsetAlignment( TQLabel::AlignVCenter ); TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); unlockDialogLayout->addWidget( frame ); @@ -96,11 +96,10 @@ SAKDlg::SAKDlg(LockProcess *parent) layStatus->addWidget( mStatusLabel ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); - frameLayout->addLayout( layStatus, 1, 1 ); + frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, Qt::AlignTop | AlignHCenter ); + frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignHCenter | AlignVCenter); - setKDEIcon(); - mStatusLabel->setText("" + i18n("Press Ctrl+Alt+Del to begin.") + ""); + mStatusLabel->setText("" + i18n("Press Ctrl+Alt+Del to begin.") + "

" + i18n("This process helps keep your password secure.") + "
" + i18n("It prevents unauthorized users from emulating the login screen.")); installEventFilter(this); @@ -126,6 +125,11 @@ SAKDlg::~SAKDlg() hide(); } +void SAKDlg::closeDialogForced() +{ + TQDialog::reject(); +} + void SAKDlg::reject() { @@ -137,31 +141,6 @@ void SAKDlg::updateLabel(TQString &txt) mStatusLabel->setText("" + txt + ""); } -void SAKDlg::setUnlockIcon() -{ - mpixLabel->setPixmap(DesktopIcon("unlock")); -} - -void SAKDlg::setKDEIcon() -{ - mpixLabel->setPixmap(DesktopIcon("about_kde")); -} - -void SAKDlg::setInfoIcon() -{ - mpixLabel->setPixmap(DesktopIcon("messagebox_info")); -} - -void SAKDlg::setWarningIcon() -{ - mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); -} - -void SAKDlg::setErrorIcon() -{ - mpixLabel->setPixmap(DesktopIcon("messagebox_critical")); -} - void SAKDlg::show() { TQDialog::show(); diff --git a/kdesktop/lock/sakdlg.h b/kdesktop/lock/sakdlg.h index a9a3c31a0..d72f8d46e 100644 --- a/kdesktop/lock/sakdlg.h +++ b/kdesktop/lock/sakdlg.h @@ -34,11 +34,7 @@ public: virtual void show(); void updateLabel( TQString &txt ); - void setUnlockIcon(); - void setKDEIcon(); - void setInfoIcon(); - void setWarningIcon(); - void setErrorIcon(); + void closeDialogForced(); private slots: void slotSAKProcessExited(); @@ -50,7 +46,6 @@ private: TQFrame *frame; TQGridLayout *frameLayout; TQLabel *mStatusLabel; - TQLabel *mpixLabel; int mCapsLocked; bool mUnlockingFailed; TQStringList layoutsList; -- cgit v1.2.1