From c54c4e700377b9853371c0c3809885d9b0830877 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 4 Sep 2015 01:34:34 -0500 Subject: Fix the most egregious style guide violations in the kdesktoplock plugin sources No functional changes were made to the source --- kdesktop/lock/infodlg.cc | 86 +-- kdesktop/lock/infodlg.h | 52 +- kdesktop/lock/lockdlg.cc | 1344 ++++++++++++++++++++++---------------------- kdesktop/lock/lockdlg.h | 127 ++--- kdesktop/lock/querydlg.cc | 136 ++--- kdesktop/lock/querydlg.h | 58 +- kdesktop/lock/sakdlg.cc | 100 ++-- kdesktop/lock/sakdlg.h | 56 +- kdesktop/lock/securedlg.cc | 216 +++---- kdesktop/lock/securedlg.h | 64 +-- 10 files changed, 1134 insertions(+), 1105 deletions(-) diff --git a/kdesktop/lock/infodlg.cc b/kdesktop/lock/infodlg.cc index d248d7bd0..3efaf060d 100644 --- a/kdesktop/lock/infodlg.cc +++ b/kdesktop/lock/infodlg.cc @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson #include @@ -62,86 +62,88 @@ extern bool trinity_desktop_lock_use_system_modal_dialogs; // Simple dialog for displaying an unlock status or recurring error message // InfoDlg::InfoDlg(LockProcess *parent) - : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), - mUnlockingFailed(false) + : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), + mUnlockingFailed(false) { - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - setCaption(i18n("Information")); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Information")); - frame = new TQFrame( this ); - if (trinity_desktop_lock_use_system_modal_dialogs) - frame->setFrameStyle( TQFrame::NoFrame ); - else - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); - frame->setLineWidth( 2 ); + frame = new TQFrame( this ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + frame->setFrameStyle( TQFrame::NoFrame ); + } + else { + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + } + frame->setLineWidth( 2 ); - mpixLabel = new TQLabel( frame, "pixlabel" ); - mpixLabel->setPixmap(DesktopIcon("unlock")); + mpixLabel = new TQLabel( frame, "pixlabel" ); + mpixLabel->setPixmap(DesktopIcon("unlock")); - KUser user; + KUser user; - mStatusLabel = new TQLabel( " ", frame ); - mStatusLabel->setAlignment( TQLabel::AlignCenter ); + mStatusLabel = new TQLabel( " ", frame ); + mStatusLabel->setAlignment( TQLabel::AlignCenter ); - TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); - unlockDialogLayout->addWidget( frame ); + TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); + unlockDialogLayout->addWidget( frame ); - TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layStatus->addWidget( mStatusLabel ); + TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + 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 = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); + frameLayout->addLayout( layStatus, 1, 1 ); - installEventFilter(this); - setFixedSize( sizeHint() ); -} + installEventFilter(this); + setFixedSize( sizeHint() ); + } InfoDlg::~InfoDlg() { - hide(); + hide(); } void InfoDlg::updateLabel(TQString &txt) { - mStatusLabel->setPaletteForegroundColor(Qt::black); - mStatusLabel->setText("" + txt + ""); + mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setText("" + txt + ""); } void InfoDlg::setUnlockIcon() { - mpixLabel->setPixmap(DesktopIcon("unlock")); + mpixLabel->setPixmap(DesktopIcon("unlock")); } void InfoDlg::setKDEIcon() { - mpixLabel->setPixmap(DesktopIcon("about_kde")); + mpixLabel->setPixmap(DesktopIcon("about_kde")); } void InfoDlg::setInfoIcon() { - mpixLabel->setPixmap(DesktopIcon("messagebox_info")); + mpixLabel->setPixmap(DesktopIcon("messagebox_info")); } void InfoDlg::setWarningIcon() { - mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); + mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); } void InfoDlg::setErrorIcon() { - mpixLabel->setPixmap(DesktopIcon("messagebox_critical")); + mpixLabel->setPixmap(DesktopIcon("messagebox_critical")); } void InfoDlg::show() { - TQDialog::show(); - TQApplication::flushX(); + TQDialog::show(); + TQApplication::flushX(); } #include "infodlg.moc" diff --git a/kdesktop/lock/infodlg.h b/kdesktop/lock/infodlg.h index bb974282f..3daf4d2ce 100644 --- a/kdesktop/lock/infodlg.h +++ b/kdesktop/lock/infodlg.h @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson // #ifndef __INFODLG_H__ @@ -26,30 +26,30 @@ class TQListView; // class InfoDlg : public TQDialog { - Q_OBJECT - -public: - InfoDlg(LockProcess *parent); - ~InfoDlg(); - virtual void show(); - - void updateLabel( TQString &txt ); - void setUnlockIcon(); - void setKDEIcon(); - void setInfoIcon(); - void setWarningIcon(); - void setErrorIcon(); - -private: - TQFrame *frame; - TQGridLayout *frameLayout; - TQLabel *mStatusLabel; - TQLabel *mpixLabel; - int mCapsLocked; - bool mUnlockingFailed; - TQStringList layoutsList; - TQStringList::iterator currLayout; - int sPid, sFd; + Q_OBJECT + + public: + InfoDlg(LockProcess *parent); + ~InfoDlg(); + virtual void show(); + + void updateLabel( TQString &txt ); + void setUnlockIcon(); + void setKDEIcon(); + void setInfoIcon(); + void setWarningIcon(); + void setErrorIcon(); + + private: + TQFrame *frame; + TQGridLayout *frameLayout; + TQLabel *mStatusLabel; + TQLabel *mpixLabel; + int mCapsLocked; + bool mUnlockingFailed; + TQStringList layoutsList; + TQStringList::iterator currLayout; + int sPid, sFd; }; #endif diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 763d7bf95..e75ac2b18 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -1,10 +1,11 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // // Copyright (c) 1999 Martin R. Jones // Copyright (c) 2003 Chris Howells // Copyright (c) 2003 Oswald Buddenhagen +// Copyright (c) 2010 - 2015 Timothy Pearson #include @@ -75,12 +76,12 @@ int dialogHideTimeout = 10*1000; // Simple dialog for entering a password. // PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) - : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), - mPlugin( plugin ), - mCapsLocked(-1), - mUnlockingFailed(false) + : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), + mPlugin( plugin ), + mCapsLocked(-1), + mUnlockingFailed(false) { - init(plugin); + init(plugin); } // @@ -88,239 +89,242 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) // This version includes support for displaying the date and time the lock process was started // PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime) - : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), - mPlugin( plugin ), - mCapsLocked(-1), - mUnlockingFailed(false) + : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), + mPlugin( plugin ), + mCapsLocked(-1), + mUnlockingFailed(false) { - m_lockStartDT = lockStartDateTime; - init(plugin); + m_lockStartDT = lockStartDateTime; + init(plugin); } void PasswordDlg::init(GreeterPluginHandle *plugin) { - dialogHideTimeout = trinity_desktop_lock_delay_screensaver_start?KDesktopSettings::timeout()*1000:10*1000; - - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - setCaption(i18n("Desktop Session Locked")); - - frame = new TQFrame( this ); - if (trinity_desktop_lock_use_system_modal_dialogs) - frame->setFrameStyle( TQFrame::NoFrame ); - else - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); - frame->setLineWidth( 2 ); - - TQLabel *pixLabel = NULL; - if (!trinity_desktop_lock_use_system_modal_dialogs) { - pixLabel = new TQLabel( frame, "pixlabel" ); - pixLabel->setPixmap(DesktopIcon("system-lock-screen")); - } - - KUser user; - 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 ); - } - - TQLabel *lockDTLabel = NULL; - if ((trinity_desktop_lock_use_system_modal_dialogs) && (!m_lockStartDT.isNull())) { - lockDTLabel = new TQLabel(i18n("This session has been locked since %1").arg(m_lockStartDT.toString()), frame); - } - - mStatusLabel = new TQLabel( " ", frame ); - mStatusLabel->setAlignment( TQLabel::AlignCenter ); - - mLayoutButton = new TQPushButton( frame ); - mLayoutButton->setFlat( true ); - - KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); - - mNewSessButton = new KPushButton( KGuiItem(i18n("Sw&itch User..."), "fork"), frame ); - ok = new KPushButton( i18n("Unl&ock"), frame ); - 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 ); - - TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layStatus->addWidget( mStatusLabel ); - layStatus->addWidget( mLayoutButton ); - - TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layButtons->addWidget( mNewSessButton ); - layButtons->addStretch(); - layButtons->addWidget(ok); - if (show_cancel_button) - layButtons->addWidget(cancel); - - if (trinity_desktop_lock_use_system_modal_dialogs) { - KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); - - if (!m_lockStartDT.isNull()) { - 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->addWidget( lockDTLabel, 2, 1 ); - frameLayout->addItem( greet->getLayoutItem(), 3, 1 ); - frameLayout->addLayout( layStatus, 4, 1 ); - frameLayout->addMultiCellWidget( sep, 5, 5, 0, 1 ); - frameLayout->addMultiCellLayout( layButtons, 6, 6, 0, 1 ); - } - else { - 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 ); - } - - 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 (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())); - - if (!DM().isSwitchable() || !kapp->authorize("switch_user")) - mNewSessButton->hide(); - - installEventFilter(this); - setFixedSize( sizeHint() ); - - mFailedTimerId = 0; - mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); - connect(tqApp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) ); - - greet->start(); - - DCOPRef kxkb("kxkb", "kxkb"); - if( !kxkb.isNull() ) { - DCOPReply reply = kxkb.call("getLayoutsList"); - if (reply.isValid()) { - layoutsList = reply; - } - reply = kxkb.call("getCurrentLayout"); - TQString currentLayout; - if (reply.isValid()) { - reply.get(currentLayout); - } - if( !currentLayout.isEmpty() && layoutsList.count() > 1 ) { - currLayout = layoutsList.find(currentLayout); - if (currLayout == layoutsList.end()) - setLayoutText("err"); - else - setLayoutText(*currLayout); - } else - mLayoutButton->hide(); - } else { - mLayoutButton->hide(); // no kxkb running - } - capsLocked(); + dialogHideTimeout = trinity_desktop_lock_delay_screensaver_start?KDesktopSettings::timeout()*1000:10*1000; + + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Desktop Session Locked")); + + frame = new TQFrame( this ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + frame->setFrameStyle( TQFrame::NoFrame ); + } + else { + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + } + frame->setLineWidth( 2 ); + + TQLabel *pixLabel = NULL; + if (!trinity_desktop_lock_use_system_modal_dialogs) { + pixLabel = new TQLabel( frame, "pixlabel" ); + pixLabel->setPixmap(DesktopIcon("system-lock-screen")); + } + + KUser user; + 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 ); + } + + TQLabel *lockDTLabel = NULL; + if ((trinity_desktop_lock_use_system_modal_dialogs) && (!m_lockStartDT.isNull())) { + lockDTLabel = new TQLabel(i18n("This session has been locked since %1").arg(m_lockStartDT.toString()), frame); + } + + mStatusLabel = new TQLabel( " ", frame ); + mStatusLabel->setAlignment( TQLabel::AlignCenter ); + + mLayoutButton = new TQPushButton( frame ); + mLayoutButton->setFlat( true ); + + KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); + + mNewSessButton = new KPushButton( KGuiItem(i18n("Sw&itch User..."), "fork"), frame ); + ok = new KPushButton( i18n("Unl&ock"), frame ); + 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 ); + + TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + layStatus->addWidget( mStatusLabel ); + layStatus->addWidget( mLayoutButton ); + + TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + layButtons->addWidget( mNewSessButton ); + layButtons->addStretch(); + layButtons->addWidget(ok); + if (show_cancel_button) { + layButtons->addWidget(cancel); + } + + if (trinity_desktop_lock_use_system_modal_dialogs) { + KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); + + if (!m_lockStartDT.isNull()) { + 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->addWidget( lockDTLabel, 2, 1 ); + frameLayout->addItem( greet->getLayoutItem(), 3, 1 ); + frameLayout->addLayout( layStatus, 4, 1 ); + frameLayout->addMultiCellWidget( sep, 5, 5, 0, 1 ); + frameLayout->addMultiCellLayout( layButtons, 6, 6, 0, 1 ); + } + else { + 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 ); + } + + 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 (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())); + + if (!DM().isSwitchable() || !kapp->authorize("switch_user")) { + mNewSessButton->hide(); + } + + installEventFilter(this); + setFixedSize( sizeHint() ); + + mFailedTimerId = 0; + mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); + connect(tqApp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) ); + + greet->start(); + + DCOPRef kxkb("kxkb", "kxkb"); + if( !kxkb.isNull() ) { + DCOPReply reply = kxkb.call("getLayoutsList"); + if (reply.isValid()) { + layoutsList = reply; + } + reply = kxkb.call("getCurrentLayout"); + TQString currentLayout; + if (reply.isValid()) { + reply.get(currentLayout); + } + if( !currentLayout.isEmpty() && layoutsList.count() > 1 ) { + currLayout = layoutsList.find(currentLayout); + if (currLayout == layoutsList.end()) + setLayoutText("err"); + else + setLayoutText(*currLayout); + } + else { + mLayoutButton->hide(); + } + } + else { + mLayoutButton->hide(); // no kxkb running + } + capsLocked(); } PasswordDlg::~PasswordDlg() { - hide(); - frameLayout->removeItem( greet->getLayoutItem() ); - delete greet; + hide(); + frameLayout->removeItem( greet->getLayoutItem() ); + delete greet; } void PasswordDlg::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(); - } + 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() { + if( ++currLayout == layoutsList.end() ) { + currLayout = layoutsList.begin(); + } - if( ++currLayout == layoutsList.end() ) - currLayout = layoutsList.begin(); - - DCOPRef kxkb("kxkb", "kxkb"); - setLayoutText( kxkb.call("setLayout", *currLayout) ? *currLayout : "err" ); + DCOPRef kxkb("kxkb", "kxkb"); + setLayoutText( kxkb.call("setLayout", *currLayout) ? *currLayout : "err" ); } void PasswordDlg::setLayoutText( const TQString &txt ) { - mLayoutButton->setText( txt ); - TQSize sz = mLayoutButton->fontMetrics().size( 0, txt ); - int mrg = mLayoutButton->style().pixelMetric( TQStyle::PM_ButtonMargin ) * 2; - mLayoutButton->setFixedSize( sz.width() + mrg, sz.height() + mrg ); + mLayoutButton->setText( txt ); + TQSize sz = mLayoutButton->fontMetrics().size( 0, txt ); + int mrg = mLayoutButton->style().pixelMetric( TQStyle::PM_ButtonMargin ) * 2; + mLayoutButton->setFixedSize( sz.width() + mrg, sz.height() + mrg ); } void PasswordDlg::updateLabel() { - if (mUnlockingFailed) - { - mStatusLabel->setPaletteForegroundColor(Qt::black); - mStatusLabel->setText(i18n("Unlocking failed")); -// mStatusLabel->show(); - } - else - if (mCapsLocked) - { - mStatusLabel->setPaletteForegroundColor(Qt::red); - mStatusLabel->setText(i18n("Warning: Caps Lock on")); -// mStatusLabel->show(); - } - else - { - mStatusLabel->setText(" "); -// mStatusLabel->hide(); - } + if (mUnlockingFailed) { + mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setText(i18n("Unlocking failed")); +// mStatusLabel->show(); + } + else if (mCapsLocked) { + mStatusLabel->setPaletteForegroundColor(Qt::red); + mStatusLabel->setText(i18n("Warning: Caps Lock on")); +// mStatusLabel->show(); + } + else { + mStatusLabel->setText(" "); +// mStatusLabel->hide(); + } } //--------------------------------------------------------------------------- @@ -329,240 +333,251 @@ void PasswordDlg::updateLabel() // void PasswordDlg::timerEvent(TQTimerEvent *ev) { - if (ev->timerId() == mTimeoutTimerId) - { - 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 if (ev->timerId() == mFailedTimerId) - { - killTimer(mFailedTimerId); - mFailedTimerId = 0; - // Show the normal password prompt. - mUnlockingFailed = false; - updateLabel(); - ok->setEnabled(true); - if (cancel) cancel->setEnabled(true); - mNewSessButton->setEnabled( true ); - greet->revive(); - greet->start(); - } + if (ev->timerId() == mTimeoutTimerId) { + 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 if (ev->timerId() == mFailedTimerId) { + killTimer(mFailedTimerId); + mFailedTimerId = 0; + // Show the normal password prompt. + mUnlockingFailed = false; + updateLabel(); + ok->setEnabled(true); + if (cancel) { + cancel->setEnabled(true); + } + mNewSessButton->setEnabled( true ); + greet->revive(); + greet->start(); + } } bool PasswordDlg::eventFilter(TQObject *, TQEvent *ev) { - if (ev->type() == TQEvent::KeyPress || ev->type() == TQEvent::KeyRelease) - capsLocked(); - return false; + if (ev->type() == TQEvent::KeyPress || ev->type() == TQEvent::KeyRelease) { + capsLocked(); + } + return false; } void PasswordDlg::slotActivity() { - if (mTimeoutTimerId) { - killTimer(mTimeoutTimerId); - mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); - } + if (mTimeoutTimerId) { + killTimer(mTimeoutTimerId); + mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); + } } ////// kckeckpass interface code int PasswordDlg::Reader (void *buf, int count) { - int ret, rlen; - - for (rlen = 0; rlen < count; ) { - dord: - ret = ::read (sFd, (void *)((char *)buf + rlen), count - rlen); - if (ret < 0) { - if (errno == EINTR) - goto dord; - if (errno == EAGAIN) - break; - return -1; - } - if (!ret) - break; - rlen += ret; - } - return rlen; + int ret, rlen; + + for (rlen = 0; rlen < count; ) { +dord: + ret = ::read (sFd, (void *)((char *)buf + rlen), count - rlen); + if (ret < 0) { + if (errno == EINTR) { + goto dord; + } + if (errno == EAGAIN) { + break; + } + return -1; + } + if (!ret) { + break; + } + rlen += ret; + } + return rlen; } bool PasswordDlg::GRead (void *buf, int count) { - return Reader (buf, count) == count; + return Reader (buf, count) == count; } bool PasswordDlg::GWrite (const void *buf, int count) { - return ::write (sFd, buf, count) == count; + return ::write (sFd, buf, count) == count; } bool PasswordDlg::GSendInt (int val) { - return GWrite (&val, sizeof(val)); + return GWrite (&val, sizeof(val)); } bool PasswordDlg::GSendStr (const char *buf) { - int len = buf ? ::strlen (buf) + 1 : 0; - return GWrite (&len, sizeof(len)) && GWrite (buf, len); + int len = buf ? ::strlen (buf) + 1 : 0; + return GWrite (&len, sizeof(len)) && GWrite (buf, len); } bool PasswordDlg::GSendArr (int len, const char *buf) { - return GWrite (&len, sizeof(len)) && GWrite (buf, len); + return GWrite (&len, sizeof(len)) && GWrite (buf, len); } bool PasswordDlg::GRecvInt (int *val) { - return GRead (val, sizeof(*val)); + return GRead (val, sizeof(*val)); } bool PasswordDlg::GRecvArr (char **ret) { - int len; - char *buf; + int len; + char *buf; - if (!GRecvInt(&len)) - return false; - if (!len) { - *ret = 0; - return true; - } - if (!(buf = (char *)::malloc (len))) - return false; - *ret = buf; - return GRead (buf, len); + if (!GRecvInt(&len)) { + return false; + } + if (!len) { + *ret = 0; + return true; + } + if (!(buf = (char *)::malloc (len))) { + return false; + } + *ret = buf; + return GRead (buf, len); } void PasswordDlg::reapVerify() { - ::close( sFd ); - int status; - pid_t retpid = ::waitpid( sPid, &status, 0 ); - if (retpid < 0) { - // FIXME - // ERROR - } - else { - if (WIFEXITED(status)) { - switch (WEXITSTATUS(status)) { - case AuthOk: - greet->succeeded(); - accept(); - return; - case AuthBad: - greet->failed(); - mUnlockingFailed = true; - updateLabel(); - mFailedTimerId = startTimer(1500); - ok->setEnabled(false); - if (cancel) cancel->setEnabled(false); - mNewSessButton->setEnabled( false ); - return; - case AuthAbort: - return; - } - } - else if (WIFSIGNALED(status)) { - // FIXME - // ERROR - } - } - cantCheck(); + ::close( sFd ); + int status; + pid_t retpid = ::waitpid( sPid, &status, 0 ); + if (retpid < 0) { + // FIXME + // ERROR + } + else { + if (WIFEXITED(status)) { + switch (WEXITSTATUS(status)) { + case AuthOk: + greet->succeeded(); + accept(); + return; + case AuthBad: + greet->failed(); + mUnlockingFailed = true; + updateLabel(); + mFailedTimerId = startTimer(1500); + ok->setEnabled(false); + if (cancel) { + cancel->setEnabled(false); + } + mNewSessButton->setEnabled( false ); + return; + case AuthAbort: + return; + } + } + else if (WIFSIGNALED(status)) { + // FIXME + // ERROR + } + } + cantCheck(); } void PasswordDlg::handleVerify() { - int ret; - char *arr; - - while (GRecvInt( &ret )) { - switch (ret) { - case ConvGetBinary: - if (!GRecvArr( &arr )) - break; - greet->binaryPrompt( arr, false ); - if (arr) - ::free( arr ); - return; - case ConvGetNormal: - if (!GRecvArr( &arr )) - break; - greet->textPrompt( arr, true, false ); - if (arr) - ::free( arr ); - return; - case ConvGetHidden: - if (!GRecvArr( &arr )) - break; - greet->textPrompt( arr, false, false ); - if (arr) - ::free( arr ); - return; - case ConvPutInfo: - if (!GRecvArr( &arr )) - break; - if (!greet->textMessage( arr, false )) - static_cast< LockProcess* >(parent())->msgBox( TQMessageBox::Information, TQString::fromLocal8Bit( arr ) ); - ::free( arr ); - continue; - case ConvPutError: - if (!GRecvArr( &arr )) - break; - if (!greet->textMessage( arr, true )) - static_cast< LockProcess* >(parent())->msgBox( TQMessageBox::Warning, TQString::fromLocal8Bit( arr ) ); - ::free( arr ); - continue; - } - break; - } - reapVerify(); + int ret; + char *arr; + + while (GRecvInt( &ret )) { + switch (ret) { + case ConvGetBinary: + if (!GRecvArr( &arr )) + break; + greet->binaryPrompt( arr, false ); + if (arr) + ::free( arr ); + return; + case ConvGetNormal: + if (!GRecvArr( &arr )) + break; + greet->textPrompt( arr, true, false ); + if (arr) + ::free( arr ); + return; + case ConvGetHidden: + if (!GRecvArr( &arr )) + break; + greet->textPrompt( arr, false, false ); + if (arr) + ::free( arr ); + return; + case ConvPutInfo: + if (!GRecvArr( &arr )) + break; + if (!greet->textMessage( arr, false )) + static_cast< LockProcess* >(parent())->msgBox( TQMessageBox::Information, TQString::fromLocal8Bit( arr ) ); + ::free( arr ); + continue; + case ConvPutError: + if (!GRecvArr( &arr )) + break; + if (!greet->textMessage( arr, true )) + static_cast< LockProcess* >(parent())->msgBox( TQMessageBox::Warning, TQString::fromLocal8Bit( arr ) ); + ::free( arr ); + continue; + } + break; + } + reapVerify(); } ////// greeter plugin callbacks void PasswordDlg::gplugReturnText( const char *text, int tag ) { - GSendStr( text ); - if (text) - GSendInt( tag ); - handleVerify(); + GSendStr( text ); + if (text) { + GSendInt( tag ); + } + handleVerify(); } void PasswordDlg::gplugReturnBinary( const char *data ) { - if (data) { - unsigned const char *up = (unsigned const char *)data; - int len = up[3] | (up[2] << 8) | (up[1] << 16) | (up[0] << 24); - if (!len) - GSendArr( 4, data ); - else - GSendArr( len, data ); - } else - GSendArr( 0, 0 ); - handleVerify(); + if (data) { + unsigned const char *up = (unsigned const char *)data; + int len = up[3] | (up[2] << 8) | (up[1] << 16) | (up[0] << 24); + if (!len) { + GSendArr( 4, data ); + } + else { + GSendArr( len, data ); + } + } + else { + GSendArr( 0, 0 ); + } + handleVerify(); } void PasswordDlg::gplugSetUser( const TQString & ) { - // ignore ... + // ignore ... } void PasswordDlg::cantCheck() { - greet->failed(); - static_cast< LockProcess* >(parent())->msgBox( TQMessageBox::Critical, - i18n("Cannot unlock the session because the authentication system failed to work;\n" - "you must kill kdesktop_lock (pid %1) manually.").arg(getpid()) ); - greet->revive(); + greet->failed(); + static_cast< LockProcess* >(parent())->msgBox( TQMessageBox::Critical, + i18n("Cannot unlock the session because the authentication system failed to work;\n" + "you must kill kdesktop_lock (pid %1) manually.").arg(getpid()) ); + greet->revive(); } //--------------------------------------------------------------------------- @@ -571,330 +586,333 @@ void PasswordDlg::cantCheck() // void PasswordDlg::gplugStart() { - int sfd[2]; - char fdbuf[16]; - - if (::socketpair(AF_LOCAL, SOCK_STREAM, 0, sfd)) { - cantCheck(); - return; - } - if ((sPid = ::fork()) < 0) { - ::close(sfd[0]); - ::close(sfd[1]); - cantCheck(); - return; - } - if (!sPid) { - ::close(sfd[0]); - sprintf(fdbuf, "%d", sfd[1]); - execlp("kcheckpass", "kcheckpass", + int sfd[2]; + char fdbuf[16]; + + if (::socketpair(AF_LOCAL, SOCK_STREAM, 0, sfd)) { + cantCheck(); + return; + } + if ((sPid = ::fork()) < 0) { + ::close(sfd[0]); + ::close(sfd[1]); + cantCheck(); + return; + } + if (!sPid) { + ::close(sfd[0]); + sprintf(fdbuf, "%d", sfd[1]); + execlp("kcheckpass", "kcheckpass", #ifdef HAVE_PAM - "-c", TDESCREENSAVER_PAM_SERVICE, + "-c", TDESCREENSAVER_PAM_SERVICE, #endif - "-m", mPlugin->info->method, - "-S", fdbuf, - (char *)0); - exit(20); - } - ::close(sfd[1]); - sFd = sfd[0]; - handleVerify(); + "-m", mPlugin->info->method, + "-S", fdbuf, + (char *)0); + exit(20); + } + ::close(sfd[1]); + sFd = sfd[0]; + handleVerify(); } void PasswordDlg::gplugActivity() { - slotActivity(); + slotActivity(); } void PasswordDlg::gplugMsgBox( TQMessageBox::Icon type, const TQString &text ) { - TQDialog dialog( this, 0, true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), dialog.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - dialog.setCaption(i18n("Authentication Subsystem Notice")); - TQFrame *winFrame = new TQFrame( &dialog ); - if (trinity_desktop_lock_use_system_modal_dialogs) - winFrame->setFrameStyle( TQFrame::NoFrame ); - else - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); - winFrame->setLineWidth( 2 ); - TQVBoxLayout *vbox = new TQVBoxLayout( &dialog ); - vbox->addWidget( winFrame ); - - TQLabel *label1 = new TQLabel( winFrame ); - label1->setPixmap( TQMessageBox::standardIcon( type ) ); - TQLabel *label2 = new TQLabel( text, winFrame ); - KPushButton *button = new KPushButton( KStdGuiItem::ok(), winFrame ); - button->setDefault( true ); - button->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ) ); - connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( accept() ) ); - - TQGridLayout *grid = new TQGridLayout( winFrame, 2, 2, 10 ); - grid->addWidget( label1, 0, 0, Qt::AlignCenter ); - grid->addWidget( label2, 0, 1, Qt::AlignCenter ); - grid->addMultiCellWidget( button, 1,1, 0,1, Qt::AlignCenter ); - - static_cast< LockProcess* >(parent())->execDialog( &dialog ); + TQDialog dialog( this, 0, true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), dialog.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + dialog.setCaption(i18n("Authentication Subsystem Notice")); + TQFrame *winFrame = new TQFrame( &dialog ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + winFrame->setFrameStyle( TQFrame::NoFrame ); + } + else { + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + } + winFrame->setLineWidth( 2 ); + TQVBoxLayout *vbox = new TQVBoxLayout( &dialog ); + vbox->addWidget( winFrame ); + + TQLabel *label1 = new TQLabel( winFrame ); + label1->setPixmap( TQMessageBox::standardIcon( type ) ); + TQLabel *label2 = new TQLabel( text, winFrame ); + KPushButton *button = new KPushButton( KStdGuiItem::ok(), winFrame ); + button->setDefault( true ); + button->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ) ); + connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( accept() ) ); + + TQGridLayout *grid = new TQGridLayout( winFrame, 2, 2, 10 ); + grid->addWidget( label1, 0, 0, Qt::AlignCenter ); + grid->addWidget( label2, 0, 1, Qt::AlignCenter ); + grid->addMultiCellWidget( button, 1,1, 0,1, Qt::AlignCenter ); + + static_cast< LockProcess* >(parent())->execDialog( &dialog ); } void PasswordDlg::slotOK() { - greet->next(); + greet->next(); } void PasswordDlg::show() { - TQDialog::show(); - TQApplication::flushX(); - setFixedSize( sizeHint() ); + TQDialog::show(); + TQApplication::flushX(); + setFixedSize( sizeHint() ); } void PasswordDlg::slotStartNewSession() { - if (!KMessageBox::shouldBeShownContinue( ":confirmNewSession" )) { - DM().startReserve(); - return; - } - - killTimer(mTimeoutTimerId); - mTimeoutTimerId = 0; - - TQDialog *dialog = new TQDialog( this, "warnbox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))); - - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), dialog->winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - dialog->setCaption(i18n("New Session")); - - TQFrame *winFrame = new TQFrame( dialog ); - if (trinity_desktop_lock_use_system_modal_dialogs) - winFrame->setFrameStyle( TQFrame::NoFrame ); - else - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); - winFrame->setLineWidth( 2 ); - TQVBoxLayout *vbox = new TQVBoxLayout( dialog ); - vbox->addWidget( winFrame ); - - TQLabel *label1 = new TQLabel( winFrame ); - label1->setPixmap( TQMessageBox::standardIcon( TQMessageBox::Warning ) ); - TQString qt_text = - i18n("You have chosen to open another desktop session " - "instead of resuming the current one.
" - "The current session will be hidden " - "and a new login screen will be displayed.
" - "An F-key is assigned to each session; " - "F%1 is usually assigned to the first session, " - "F%2 to the second session and so on. " - "You can switch between sessions by pressing " - "Ctrl, Alt and the appropriate F-key at the same time. " - "Additionally, the TDE Panel and Desktop menus have " - "actions for switching between sessions.") - .arg(7).arg(8); - TQLabel *label2 = new TQLabel( qt_text, winFrame ); - KPushButton *okbutton = new KPushButton( KGuiItem(i18n("&Start New Session"), "fork"), winFrame ); - okbutton->setDefault( true ); - connect( okbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( accept() ) ); - KPushButton *cbutton = new KPushButton( KStdGuiItem::cancel(), winFrame ); - connect( cbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( reject() ) ); - - TQBoxLayout *mbox = new TQVBoxLayout( winFrame, KDialog::marginHint(), KDialog::spacingHint() ); - - TQGridLayout *grid = new TQGridLayout( mbox, 2, 2, 2 * KDialog::spacingHint() ); - grid->setMargin( KDialog::marginHint() ); - grid->addWidget( label1, 0, 0, Qt::AlignCenter ); - grid->addWidget( label2, 0, 1, Qt::AlignCenter ); - TQCheckBox *cb = new TQCheckBox( i18n("&Do not ask again"), winFrame ); - grid->addMultiCellWidget( cb, 1,1, 0,1 ); - - TQBoxLayout *hbox = new TQHBoxLayout( mbox, KDialog::spacingHint() ); - hbox->addStretch( 1 ); - hbox->addWidget( okbutton ); - hbox->addStretch( 1 ); - hbox->addWidget( cbutton ); - hbox->addStretch( 1 ); - - // stolen from kmessagebox - int pref_width = 0; - int pref_height = 0; - // Calculate a proper size for the text. - { - TQSimpleRichText rt(qt_text, dialog->font()); - TQRect rect = TDEGlobalSettings::desktopGeometry(dialog); - - pref_width = rect.width() / 3; - rt.setWidth(pref_width); - int used_width = rt.widthUsed(); - pref_height = rt.height(); - if (used_width <= pref_width) - { - while(true) - { - int new_width = (used_width * 9) / 10; - rt.setWidth(new_width); - int new_height = rt.height(); - if (new_height > pref_height) - break; - used_width = rt.widthUsed(); - if (used_width > new_width) - break; - } - pref_width = used_width; - } - else - { - if (used_width > (pref_width *2)) - pref_width = pref_width *2; - else - pref_width = used_width; - } - } - label2->setFixedSize(TQSize(pref_width+10, pref_height)); - - int ret = static_cast< LockProcess* >( parent())->execDialog( dialog ); - - delete dialog; - - if (ret == TQDialog::Accepted) { - if (cb->isChecked()) - KMessageBox::saveDontShowAgainContinue( ":confirmNewSession" ); - DM().startReserve(); - } - - mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); + if (!KMessageBox::shouldBeShownContinue( ":confirmNewSession" )) { + DM().startReserve(); + return; + } + + killTimer(mTimeoutTimerId); + mTimeoutTimerId = 0; + + TQDialog *dialog = new TQDialog( this, "warnbox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))); + + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), dialog->winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + dialog->setCaption(i18n("New Session")); + + TQFrame *winFrame = new TQFrame( dialog ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + winFrame->setFrameStyle( TQFrame::NoFrame ); + } + else { + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + } + winFrame->setLineWidth( 2 ); + TQVBoxLayout *vbox = new TQVBoxLayout( dialog ); + vbox->addWidget( winFrame ); + + TQLabel *label1 = new TQLabel( winFrame ); + label1->setPixmap( TQMessageBox::standardIcon( TQMessageBox::Warning ) ); + TQString qt_text = i18n("You have chosen to open another desktop session " + "instead of resuming the current one.
" + "The current session will be hidden " + "and a new login screen will be displayed.
" + "An F-key is assigned to each session; " + "F%1 is usually assigned to the first session, " + "F%2 to the second session and so on. " + "You can switch between sessions by pressing " + "Ctrl, Alt and the appropriate F-key at the same time. " + "Additionally, the TDE Panel and Desktop menus have " + "actions for switching between sessions.") + .arg(7).arg(8); + TQLabel *label2 = new TQLabel( qt_text, winFrame ); + KPushButton *okbutton = new KPushButton( KGuiItem(i18n("&Start New Session"), "fork"), winFrame ); + okbutton->setDefault( true ); + connect( okbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( accept() ) ); + KPushButton *cbutton = new KPushButton( KStdGuiItem::cancel(), winFrame ); + connect( cbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( reject() ) ); + + TQBoxLayout *mbox = new TQVBoxLayout( winFrame, KDialog::marginHint(), KDialog::spacingHint() ); + + TQGridLayout *grid = new TQGridLayout( mbox, 2, 2, 2 * KDialog::spacingHint() ); + grid->setMargin( KDialog::marginHint() ); + grid->addWidget( label1, 0, 0, Qt::AlignCenter ); + grid->addWidget( label2, 0, 1, Qt::AlignCenter ); + TQCheckBox *cb = new TQCheckBox( i18n("&Do not ask again"), winFrame ); + grid->addMultiCellWidget( cb, 1,1, 0,1 ); + + TQBoxLayout *hbox = new TQHBoxLayout( mbox, KDialog::spacingHint() ); + hbox->addStretch( 1 ); + hbox->addWidget( okbutton ); + hbox->addStretch( 1 ); + hbox->addWidget( cbutton ); + hbox->addStretch( 1 ); + + // stolen from kmessagebox + int pref_width = 0; + int pref_height = 0; + // Calculate a proper size for the text. + { + TQSimpleRichText rt(qt_text, dialog->font()); + TQRect rect = TDEGlobalSettings::desktopGeometry(dialog); + + pref_width = rect.width() / 3; + rt.setWidth(pref_width); + int used_width = rt.widthUsed(); + pref_height = rt.height(); + if (used_width <= pref_width) { + while(true) { + int new_width = (used_width * 9) / 10; + rt.setWidth(new_width); + int new_height = rt.height(); + if (new_height > pref_height) { + break; + } + used_width = rt.widthUsed(); + if (used_width > new_width) { + break; + } + } + pref_width = used_width; + } + else { + if (used_width > (pref_width *2)) + pref_width = pref_width *2; + else + pref_width = used_width; + } + } + label2->setFixedSize(TQSize(pref_width+10, pref_height)); + + int ret = static_cast< LockProcess* >( parent())->execDialog( dialog ); + + delete dialog; + + if (ret == TQDialog::Accepted) { + if (cb->isChecked()) { + KMessageBox::saveDontShowAgainContinue( ":confirmNewSession" ); + } + DM().startReserve(); + } + + mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); } class LockListViewItem : public TQListViewItem { -public: - LockListViewItem( TQListView *parent, - const TQString &sess, const TQString &loc, int _vt ) - : TQListViewItem( parent ) - , vt( _vt ) - { - setText( 0, sess ); - setText( 1, loc ); - } - - int vt; + public: + LockListViewItem( TQListView *parent, const TQString &sess, const TQString &loc, int _vt ) : TQListViewItem( parent ) + , vt( _vt ) + { + setText( 0, sess ); + setText( 1, loc ); + } + + int vt; }; void PasswordDlg::slotSwitchUser() { - int p = 0; - DM dm; - - TQDialog dialog( this, "sessbox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); - - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), dialog.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - dialog.setCaption(i18n("Switch User")); - - TQFrame *winFrame = new TQFrame( &dialog ); - if (trinity_desktop_lock_use_system_modal_dialogs) - winFrame->setFrameStyle( TQFrame::NoFrame ); - else - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); - winFrame->setLineWidth( 2 ); - TQBoxLayout *vbox = new TQVBoxLayout( &dialog ); - vbox->addWidget( winFrame ); - - TQBoxLayout *hbox = new TQHBoxLayout( winFrame, KDialog::marginHint(), KDialog::spacingHint() ); - - TQBoxLayout *vbox1 = new TQVBoxLayout( hbox, KDialog::spacingHint() ); - TQBoxLayout *vbox2 = new TQVBoxLayout( hbox, KDialog::spacingHint() ); - - KPushButton *btn; - - SessList sess; - if (dm.localSessions( sess )) { - - lv = new TQListView( winFrame ); - connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT(slotSessionActivated()) ); - connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), &dialog, TQT_SLOT(accept()) ); - lv->setAllColumnsShowFocus( true ); - lv->addColumn( i18n("Session") ); - lv->addColumn( i18n("Location") ); - lv->setColumnWidthMode( 0, TQListView::Maximum ); - lv->setColumnWidthMode( 1, TQListView::Maximum ); - TQListViewItem *itm = 0; - TQString user, loc; - int ns = 0; - for (SessList::ConstIterator it = sess.begin(); it != sess.end(); ++it) { - DM::sess2Str2( *it, user, loc ); - itm = new LockListViewItem( lv, user, loc, (*it).vt ); - if (!(*it).vt) - itm->setEnabled( false ); - if ((*it).self) { - lv->setCurrentItem( itm ); - itm->setSelected( true ); - } - ns++; - } - int fw = lv->frameWidth() * 2; - TQSize hds( lv->header()->sizeHint() ); - lv->setMinimumWidth( fw + hds.width() + - (ns > 10 ? style().pixelMetric(TQStyle::PM_ScrollBarExtent) : 0 ) ); - lv->setFixedHeight( fw + hds.height() + - itm->height() * (ns < 6 ? 6 : ns > 10 ? 10 : ns) ); - lv->header()->adjustHeaderSize(); - vbox1->addWidget( lv ); - - btn = new KPushButton( KGuiItem(i18n("session", "&Activate"), "fork"), winFrame ); - connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotSessionActivated()) ); - connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) ); - vbox2->addWidget( btn ); - vbox2->addStretch( 2 ); - } - - if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0) - { - btn = new KPushButton( KGuiItem(i18n("Start &New Session"), "fork"), winFrame ); - connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotStartNewSession()) ); - connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) ); - if (!p) - btn->setEnabled( false ); - vbox2->addWidget( btn ); - vbox2->addStretch( 1 ); - } - - btn = new KPushButton( KStdGuiItem::cancel(), winFrame ); - connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(reject()) ); - vbox2->addWidget( btn ); - - dialog.setFixedSize( dialog.sizeHint() ); - - int ret = static_cast< LockProcess* >(parent())->execDialog( &dialog ); - if (ret != TQDialog::Rejected) { - TQDialog::reject(); - } + int p = 0; + DM dm; + + TQDialog dialog( this, "sessbox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); + + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), dialog.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + dialog.setCaption(i18n("Switch User")); + + TQFrame *winFrame = new TQFrame( &dialog ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + winFrame->setFrameStyle( TQFrame::NoFrame ); + } + else { + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + } + winFrame->setLineWidth( 2 ); + TQBoxLayout *vbox = new TQVBoxLayout( &dialog ); + vbox->addWidget( winFrame ); + + TQBoxLayout *hbox = new TQHBoxLayout( winFrame, KDialog::marginHint(), KDialog::spacingHint() ); + + TQBoxLayout *vbox1 = new TQVBoxLayout( hbox, KDialog::spacingHint() ); + TQBoxLayout *vbox2 = new TQVBoxLayout( hbox, KDialog::spacingHint() ); + + KPushButton *btn; + + SessList sess; + if (dm.localSessions( sess )) { + lv = new TQListView( winFrame ); + connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT(slotSessionActivated()) ); + connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), &dialog, TQT_SLOT(accept()) ); + lv->setAllColumnsShowFocus( true ); + lv->addColumn( i18n("Session") ); + lv->addColumn( i18n("Location") ); + lv->setColumnWidthMode( 0, TQListView::Maximum ); + lv->setColumnWidthMode( 1, TQListView::Maximum ); + TQListViewItem *itm = 0; + TQString user, loc; + int ns = 0; + for (SessList::ConstIterator it = sess.begin(); it != sess.end(); ++it) { + DM::sess2Str2( *it, user, loc ); + itm = new LockListViewItem( lv, user, loc, (*it).vt ); + if (!(*it).vt) { + itm->setEnabled( false ); + } + if ((*it).self) { + lv->setCurrentItem( itm ); + itm->setSelected( true ); + } + ns++; + } + int fw = lv->frameWidth() * 2; + TQSize hds( lv->header()->sizeHint() ); + lv->setMinimumWidth( fw + hds.width() + + (ns > 10 ? style().pixelMetric(TQStyle::PM_ScrollBarExtent) : 0 ) ); + lv->setFixedHeight( fw + hds.height() + + itm->height() * (ns < 6 ? 6 : ns > 10 ? 10 : ns) ); + lv->header()->adjustHeaderSize(); + vbox1->addWidget( lv ); + + btn = new KPushButton( KGuiItem(i18n("session", "&Activate"), "fork"), winFrame ); + connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotSessionActivated()) ); + connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) ); + vbox2->addWidget( btn ); + vbox2->addStretch( 2 ); + } + + if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0) { + btn = new KPushButton( KGuiItem(i18n("Start &New Session"), "fork"), winFrame ); + connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotStartNewSession()) ); + connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) ); + if (!p) + btn->setEnabled( false ); + vbox2->addWidget( btn ); + vbox2->addStretch( 1 ); + } + + btn = new KPushButton( KStdGuiItem::cancel(), winFrame ); + connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(reject()) ); + vbox2->addWidget( btn ); + + dialog.setFixedSize( dialog.sizeHint() ); + + int ret = static_cast< LockProcess* >(parent())->execDialog( &dialog ); + if (ret != TQDialog::Rejected) { + TQDialog::reject(); + } } void PasswordDlg::slotSessionActivated() { - LockListViewItem *itm = (LockListViewItem *)lv->currentItem(); - if (itm && itm->vt > 0) - DM().switchVT( itm->vt ); + LockListViewItem *itm = (LockListViewItem *)lv->currentItem(); + if (itm && itm->vt > 0) { + DM().switchVT( itm->vt ); + } } void PasswordDlg::capsLocked() { - unsigned int lmask; - Window dummy1, dummy2; - int dummy3, dummy4, dummy5, dummy6; - XQueryPointer(tqt_xdisplay(), DefaultRootWindow( tqt_xdisplay() ), &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, &dummy6, &lmask); - mCapsLocked = lmask & LockMask; - updateLabel(); + unsigned int lmask; + Window dummy1, dummy2; + int dummy3, dummy4, dummy5, dummy6; + XQueryPointer(tqt_xdisplay(), DefaultRootWindow( tqt_xdisplay() ), &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, &dummy6, &lmask); + mCapsLocked = lmask & LockMask; + updateLabel(); } #include "lockdlg.moc" diff --git a/kdesktop/lock/lockdlg.h b/kdesktop/lock/lockdlg.h index 2ede5a4fa..eea0931ab 100644 --- a/kdesktop/lock/lockdlg.h +++ b/kdesktop/lock/lockdlg.h @@ -1,9 +1,10 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // // Copyright (c) 1999 Martin R. Jones // Copyright (c) 2003 Oswald Buddenhagen +// Copyright (c) 2010 - 2015 Timothy Pearson // #ifndef __LOCKDLG_H__ @@ -32,69 +33,69 @@ class TQListView; // class PasswordDlg : public TQDialog, public KGreeterPluginHandler { - Q_OBJECT + Q_OBJECT -public: - PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin); - PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime); - ~PasswordDlg(); - void init(GreeterPluginHandle *plugin); - virtual void show(); - - // from KGreetPluginHandler - virtual void gplugReturnText( const char *text, int tag ); - virtual void gplugReturnBinary( const char *data ); - virtual void gplugSetUser( const TQString & ); - virtual void gplugStart(); - virtual void gplugActivity(); - virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text ); - -protected: - virtual void timerEvent(TQTimerEvent *); - virtual bool eventFilter(TQObject *, TQEvent *); - -private slots: - void slotSwitchUser(); - void slotSessionActivated(); - void slotStartNewSession(); - void slotOK(); - void layoutClicked(); - void slotActivity(); - -protected slots: - virtual void reject(); - -private: - void setLayoutText( const TQString &txt ); - void capsLocked(); - void updateLabel(); - int Reader (void *buf, int count); - bool GRead (void *buf, int count); - bool GWrite (const void *buf, int count); - bool GSendInt (int val); - bool GSendStr (const char *buf); - bool GSendArr (int len, const char *buf); - bool GRecvInt (int *val); - bool GRecvArr (char **buf); - void handleVerify(); - void reapVerify(); - void cantCheck(); - GreeterPluginHandle *mPlugin; - KGreeterPlugin *greet; - TQFrame *frame; - TQGridLayout *frameLayout; - TQLabel *mStatusLabel; - KPushButton *mNewSessButton, *ok, *cancel; - TQPushButton *mLayoutButton; - int mFailedTimerId; - int mTimeoutTimerId; - int mCapsLocked; - bool mUnlockingFailed; - TQStringList layoutsList; - TQStringList::iterator currLayout; - int sPid, sFd; - TQListView *lv; - TQDateTime m_lockStartDT; + public: + PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin); + PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime); + ~PasswordDlg(); + void init(GreeterPluginHandle *plugin); + virtual void show(); + + // from KGreetPluginHandler + virtual void gplugReturnText( const char *text, int tag ); + virtual void gplugReturnBinary( const char *data ); + virtual void gplugSetUser( const TQString & ); + virtual void gplugStart(); + virtual void gplugActivity(); + virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text ); + + protected: + virtual void timerEvent(TQTimerEvent *); + virtual bool eventFilter(TQObject *, TQEvent *); + + private slots: + void slotSwitchUser(); + void slotSessionActivated(); + void slotStartNewSession(); + void slotOK(); + void layoutClicked(); + void slotActivity(); + + protected slots: + virtual void reject(); + + private: + void setLayoutText( const TQString &txt ); + void capsLocked(); + void updateLabel(); + int Reader (void *buf, int count); + bool GRead (void *buf, int count); + bool GWrite (const void *buf, int count); + bool GSendInt (int val); + bool GSendStr (const char *buf); + bool GSendArr (int len, const char *buf); + bool GRecvInt (int *val); + bool GRecvArr (char **buf); + void handleVerify(); + void reapVerify(); + void cantCheck(); + GreeterPluginHandle *mPlugin; + KGreeterPlugin *greet; + TQFrame *frame; + TQGridLayout *frameLayout; + TQLabel *mStatusLabel; + KPushButton *mNewSessButton, *ok, *cancel; + TQPushButton *mLayoutButton; + int mFailedTimerId; + int mTimeoutTimerId; + int mCapsLocked; + bool mUnlockingFailed; + TQStringList layoutsList; + TQStringList::iterator currLayout; + int sPid, sFd; + TQListView *lv; + TQDateTime m_lockStartDT; }; #endif diff --git a/kdesktop/lock/querydlg.cc b/kdesktop/lock/querydlg.cc index 7618a5062..004bbc458 100644 --- a/kdesktop/lock/querydlg.cc +++ b/kdesktop/lock/querydlg.cc @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson #include @@ -62,100 +62,102 @@ extern bool trinity_desktop_lock_use_system_modal_dialogs; // Simple dialog for displaying a password/PIN entry dialog // QueryDlg::QueryDlg(LockProcess *parent) - : TQDialog(parent, "query dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), - mUnlockingFailed(false) + : TQDialog(parent, "query dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), + mUnlockingFailed(false) { - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - setCaption(i18n("Information Needed")); - - frame = new TQFrame( this ); - if (trinity_desktop_lock_use_system_modal_dialogs) - frame->setFrameStyle( TQFrame::NoFrame ); - else - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); - frame->setLineWidth( 2 ); - - mpixLabel = new TQLabel( frame, "pixlabel" ); - mpixLabel->setPixmap(DesktopIcon("unlock")); - - KUser user; - - mStatusLabel = new TQLabel( " ", frame ); - //mStatusLabel->setAlignment( TQLabel::AlignCenter ); - mStatusLabel->setAlignment( TQLabel::AlignLeft ); - - KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); - - ok = new KPushButton( i18n("Unl&ock"), frame ); - - TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); - unlockDialogLayout->addWidget( frame ); - - TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layStatus->addWidget( mStatusLabel ); - - TQHBoxLayout *layPin = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - pin_box = new KPasswordEdit( this, "pin_box" ); - layPin->addWidget( pin_box ); - pin_box->setFocus(); - - TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layButtons->addStretch(); - layButtons->addWidget( ok ); - - frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); - frameLayout->addLayout( layStatus, 0, 1 ); - frameLayout->addLayout( layPin, 2, 1 ); - frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 ); - frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); - - connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); - - installEventFilter(this); - setFixedSize( sizeHint() ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Information Needed")); + + frame = new TQFrame( this ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + frame->setFrameStyle( TQFrame::NoFrame ); + } + else { + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + } + frame->setLineWidth( 2 ); + + mpixLabel = new TQLabel( frame, "pixlabel" ); + mpixLabel->setPixmap(DesktopIcon("unlock")); + + KUser user; + + mStatusLabel = new TQLabel( " ", frame ); + //mStatusLabel->setAlignment( TQLabel::AlignCenter ); + mStatusLabel->setAlignment( TQLabel::AlignLeft ); + + KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); + + ok = new KPushButton( i18n("Unl&ock"), frame ); + + TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); + unlockDialogLayout->addWidget( frame ); + + TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + layStatus->addWidget( mStatusLabel ); + + TQHBoxLayout *layPin = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + pin_box = new KPasswordEdit( this, "pin_box" ); + layPin->addWidget( pin_box ); + pin_box->setFocus(); + + TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + layButtons->addStretch(); + layButtons->addWidget( ok ); + + frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); + frameLayout->addLayout( layStatus, 0, 1 ); + frameLayout->addLayout( layPin, 2, 1 ); + frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 ); + frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); + + connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); + + installEventFilter(this); + setFixedSize( sizeHint() ); } QueryDlg::~QueryDlg() { - hide(); + hide(); } void QueryDlg::slotOK() { - close(); + close(); } const char * QueryDlg::getEntry() { - return pin_box->password(); + return pin_box->password(); } void QueryDlg::updateLabel(TQString &txt) { - mStatusLabel->setPaletteForegroundColor(Qt::black); - mStatusLabel->setText("" + txt + ""); + mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setText("" + txt + ""); } void QueryDlg::setUnlockIcon() { - mpixLabel->setPixmap(DesktopIcon("unlock")); + mpixLabel->setPixmap(DesktopIcon("unlock")); } void QueryDlg::setWarningIcon() { - mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); + mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); } void QueryDlg::show() { - TQDialog::show(); - TQApplication::flushX(); + TQDialog::show(); + TQApplication::flushX(); } #include "querydlg.moc" diff --git a/kdesktop/lock/querydlg.h b/kdesktop/lock/querydlg.h index 0da557caf..71f73f9ab 100644 --- a/kdesktop/lock/querydlg.h +++ b/kdesktop/lock/querydlg.h @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson // #ifndef __QUERYDLG_H__ @@ -28,33 +28,33 @@ class TQListView; // class QueryDlg : public TQDialog { - Q_OBJECT - -public: - QueryDlg(LockProcess *parent); - ~QueryDlg(); - virtual void show(); - - void updateLabel( TQString &txt ); - void setUnlockIcon(); - void setWarningIcon(); - const char * getEntry(); - -private slots: - void slotOK(); - -private: - TQFrame *frame; - TQGridLayout *frameLayout; - TQLabel *mStatusLabel; - TQLabel *mpixLabel; - int mCapsLocked; - bool mUnlockingFailed; - TQStringList layoutsList; - TQStringList::iterator currLayout; - int sPid, sFd; - KPushButton *ok; - KPasswordEdit *pin_box; + Q_OBJECT + + public: + QueryDlg(LockProcess *parent); + ~QueryDlg(); + virtual void show(); + + void updateLabel( TQString &txt ); + void setUnlockIcon(); + void setWarningIcon(); + const char * getEntry(); + + private slots: + void slotOK(); + + private: + TQFrame *frame; + TQGridLayout *frameLayout; + TQLabel *mStatusLabel; + TQLabel *mpixLabel; + int mCapsLocked; + bool mUnlockingFailed; + TQStringList layoutsList; + TQStringList::iterator currLayout; + int sPid, sFd; + KPushButton *ok; + KPasswordEdit *pin_box; }; #endif diff --git a/kdesktop/lock/sakdlg.cc b/kdesktop/lock/sakdlg.cc index 1bb8305ef..1ae946b6a 100644 --- a/kdesktop/lock/sakdlg.cc +++ b/kdesktop/lock/sakdlg.cc @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010-2011 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson #include @@ -64,71 +64,75 @@ extern bool trinity_desktop_lock_use_sak; // Simple dialog for displaying an unlock status or recurring error message // SAKDlg::SAKDlg(LockProcess *parent) - : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), - mUnlockingFailed(false) + : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), + mUnlockingFailed(false) { - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - setCaption(i18n("Desktop Session Locked")); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Desktop Session Locked")); - frame = new TQFrame( this ); - if (trinity_desktop_lock_use_system_modal_dialogs) - frame->setFrameStyle( TQFrame::NoFrame ); - else - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); - frame->setLineWidth( 2 ); + frame = new TQFrame( this ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + frame->setFrameStyle( TQFrame::NoFrame ); + } + else { + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + } + frame->setLineWidth( 2 ); - KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); + KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); - KUser user; + KUser user; - mStatusLabel = new TQLabel( " ", frame ); - mStatusLabel->setAlignment( TQLabel::AlignVCenter ); + mStatusLabel = new TQLabel( " ", frame ); + mStatusLabel->setAlignment( TQLabel::AlignVCenter ); - TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); - unlockDialogLayout->addWidget( frame ); + TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); + unlockDialogLayout->addWidget( frame ); - TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layStatus->addWidget( mStatusLabel ); + TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + layStatus->addWidget( mStatusLabel ); - frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft ); - frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter); + frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft ); + frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter); - 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.")); + 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); - setFixedSize( sizeHint() ); + installEventFilter(this); + setFixedSize( sizeHint() ); - mSAKProcess = new TDEProcess; - *mSAKProcess << "tdmtsak"; - connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited())); - mSAKProcess->start(); + mSAKProcess = new TDEProcess; + *mSAKProcess << "tdmtsak"; + connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited())); + mSAKProcess->start(); } void SAKDlg::slotSAKProcessExited() { - int retcode = mSAKProcess->exitStatus(); - if (retcode != 0) trinity_desktop_lock_use_sak = false; - hide(); + int retcode = mSAKProcess->exitStatus(); + if (retcode != 0) { + trinity_desktop_lock_use_sak = false; + } + hide(); } SAKDlg::~SAKDlg() { - if ((mSAKProcess) && (mSAKProcess->isRunning())) { - mSAKProcess->kill(SIGTERM); - delete mSAKProcess; - } - hide(); + if ((mSAKProcess) && (mSAKProcess->isRunning())) { + mSAKProcess->kill(SIGTERM); + delete mSAKProcess; + } + hide(); } void SAKDlg::closeDialogForced() { - TQDialog::reject(); + TQDialog::reject(); } void SAKDlg::reject() @@ -138,14 +142,14 @@ void SAKDlg::reject() void SAKDlg::updateLabel(TQString &txt) { - mStatusLabel->setPaletteForegroundColor(Qt::black); - mStatusLabel->setText("" + txt + ""); + mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setText("" + txt + ""); } void SAKDlg::show() { - TQDialog::show(); - TQApplication::flushX(); + TQDialog::show(); + TQApplication::flushX(); } #include "sakdlg.moc" diff --git a/kdesktop/lock/sakdlg.h b/kdesktop/lock/sakdlg.h index 5810b8771..faded4b6e 100644 --- a/kdesktop/lock/sakdlg.h +++ b/kdesktop/lock/sakdlg.h @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson // #ifndef __SAKDLG_H__ @@ -26,32 +26,32 @@ class TQListView; // class SAKDlg : public TQDialog { - Q_OBJECT - -public: - SAKDlg(LockProcess *parent); - ~SAKDlg(); - virtual void show(); - - void updateLabel( TQString &txt ); - void closeDialogForced(); - -private slots: - void slotSAKProcessExited(); - -protected slots: - virtual void reject(); - -private: - TQFrame *frame; - TQGridLayout *frameLayout; - TQLabel *mStatusLabel; - int mCapsLocked; - bool mUnlockingFailed; - TQStringList layoutsList; - TQStringList::iterator currLayout; - int sPid, sFd; - TDEProcess* mSAKProcess; + Q_OBJECT + + public: + SAKDlg(LockProcess *parent); + ~SAKDlg(); + virtual void show(); + + void updateLabel( TQString &txt ); + void closeDialogForced(); + + private slots: + void slotSAKProcessExited(); + + protected slots: + virtual void reject(); + + private: + TQFrame *frame; + TQGridLayout *frameLayout; + TQLabel *mStatusLabel; + int mCapsLocked; + bool mUnlockingFailed; + TQStringList layoutsList; + TQStringList::iterator currLayout; + int sPid, sFd; + TDEProcess* mSAKProcess; }; #endif diff --git a/kdesktop/lock/securedlg.cc b/kdesktop/lock/securedlg.cc index b38378f2e..fca79a707 100644 --- a/kdesktop/lock/securedlg.cc +++ b/kdesktop/lock/securedlg.cc @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010-2011 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson #include @@ -64,152 +64,154 @@ extern bool trinity_desktop_lock_use_sak; // Simple dialog for displaying an unlock status or recurring error message // SecureDlg::SecureDlg(LockProcess *parent) - : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), - mUnlockingFailed(false), retInt(NULL) + : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), + mUnlockingFailed(false), retInt(NULL) { - if (trinity_desktop_lock_use_system_modal_dialogs) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - } - setCaption(i18n("Secure Desktop Area")); - - frame = new TQFrame( this ); - if (trinity_desktop_lock_use_system_modal_dialogs) - frame->setFrameStyle( TQFrame::NoFrame ); - else - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); - frame->setLineWidth( 2 ); - - KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); - - KUser user; - - mLogonStatus = new TQLabel( frame ); - TQString userString = user.fullName(); - if (userString == "") { - userString = user.loginName(); - } - if (userString != "") { - mLogonStatus->setText(i18n("'%1' is currently logged on").arg( user.fullName() )); - } - else { - mLogonStatus->setText(i18n("You are currently logged on")); // We should never get here, and this message is somewhat obtuse, but it is better than displaying two qotation marks with no text between them... - } - - KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); - - mLockButton = new TQPushButton( frame ); - mLockButton->setText(i18n("Lock Session")); - - mTaskButton = new TQPushButton( frame ); - mTaskButton->setText(i18n("Task Manager")); - - mShutdownButton = new TQPushButton( frame ); - mShutdownButton->setText(i18n("Logoff Menu")); - - mCancelButton = new TQPushButton( frame ); - mCancelButton->setText(i18n("Cancel")); - - mSwitchButton = new TQPushButton( frame ); - mSwitchButton->setText(i18n("Switch User")); - mSwitchButton->setEnabled(false); // FIXME - - TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); - unlockDialogLayout->addWidget( frame ); - - TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); - layStatus->addWidget( mLogonStatus ); - - TQGridLayout *layPBGrid = new TQGridLayout( 0, 0, KDialog::spacingHint()); - layPBGrid->addWidget( mLockButton, 0, 0 ); - layPBGrid->addWidget( mTaskButton, 0, 1 ); - layPBGrid->addWidget( mShutdownButton, 0, 2 ); - layPBGrid->addWidget( mCancelButton, 0, 3 ); - layPBGrid->addWidget( mSwitchButton, 1, 0 ); - - frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft ); - frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter); - frameLayout->addMultiCellWidget( sep, 2, 2, 0, 1 ); - frameLayout->addMultiCellLayout( layPBGrid, 3, 3, 0, 1, AlignLeft | AlignVCenter); - - connect(mCancelButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnCancel())); - connect(mLockButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnLock())); - connect(mTaskButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnTask())); - connect(mShutdownButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnShutdown())); - connect(mSwitchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnSwitchUser())); - - TQSize dlgSz = sizeHint(); - int btnSize = dlgSz.width(); - btnSize = btnSize / 4; - btnSize = btnSize - (KDialog::spacingHint() / 2); - mLockButton->setFixedWidth(btnSize); - mTaskButton->setFixedWidth(btnSize); - mCancelButton->setFixedWidth(btnSize); - mShutdownButton->setFixedWidth(btnSize); - mSwitchButton->setFixedWidth(btnSize); - - installEventFilter(this); - setFixedSize( sizeHint() ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Secure Desktop Area")); + + frame = new TQFrame( this ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + frame->setFrameStyle( TQFrame::NoFrame ); + } + else { + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + } + frame->setLineWidth( 2 ); + + KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); + + KUser user; + + mLogonStatus = new TQLabel( frame ); + TQString userString = user.fullName(); + if (userString == "") { + userString = user.loginName(); + } + if (userString != "") { + mLogonStatus->setText(i18n("'%1' is currently logged on").arg( user.fullName() )); + } + else { + mLogonStatus->setText(i18n("You are currently logged on")); // We should never get here, and this message is somewhat obtuse, but it is better than displaying two qotation marks with no text between them... + } + + KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); + + mLockButton = new TQPushButton( frame ); + mLockButton->setText(i18n("Lock Session")); + + mTaskButton = new TQPushButton( frame ); + mTaskButton->setText(i18n("Task Manager")); + + mShutdownButton = new TQPushButton( frame ); + mShutdownButton->setText(i18n("Logoff Menu")); + + mCancelButton = new TQPushButton( frame ); + mCancelButton->setText(i18n("Cancel")); + + mSwitchButton = new TQPushButton( frame ); + mSwitchButton->setText(i18n("Switch User")); + mSwitchButton->setEnabled(false); // FIXME + + TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); + unlockDialogLayout->addWidget( frame ); + + TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); + layStatus->addWidget( mLogonStatus ); + + TQGridLayout *layPBGrid = new TQGridLayout( 0, 0, KDialog::spacingHint()); + layPBGrid->addWidget( mLockButton, 0, 0 ); + layPBGrid->addWidget( mTaskButton, 0, 1 ); + layPBGrid->addWidget( mShutdownButton, 0, 2 ); + layPBGrid->addWidget( mCancelButton, 0, 3 ); + layPBGrid->addWidget( mSwitchButton, 1, 0 ); + + frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft ); + frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter); + frameLayout->addMultiCellWidget( sep, 2, 2, 0, 1 ); + frameLayout->addMultiCellLayout( layPBGrid, 3, 3, 0, 1, AlignLeft | AlignVCenter); + + connect(mCancelButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnCancel())); + connect(mLockButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnLock())); + connect(mTaskButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnTask())); + connect(mShutdownButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnShutdown())); + connect(mSwitchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnSwitchUser())); + + TQSize dlgSz = sizeHint(); + int btnSize = dlgSz.width(); + btnSize = btnSize / 4; + btnSize = btnSize - (KDialog::spacingHint() / 2); + mLockButton->setFixedWidth(btnSize); + mTaskButton->setFixedWidth(btnSize); + mCancelButton->setFixedWidth(btnSize); + mShutdownButton->setFixedWidth(btnSize); + mSwitchButton->setFixedWidth(btnSize); + + installEventFilter(this); + setFixedSize( sizeHint() ); } SecureDlg::~SecureDlg() { - hide(); + hide(); } void SecureDlg::slotBtnCancel() { - if (retInt) *retInt = 0; - hide(); + if (retInt) *retInt = 0; + hide(); } void SecureDlg::slotBtnLock() { - if (retInt) *retInt = 1; - hide(); + if (retInt) *retInt = 1; + hide(); } void SecureDlg::slotBtnTask() { - if (retInt) *retInt = 2; - hide(); + if (retInt) *retInt = 2; + hide(); } void SecureDlg::slotBtnShutdown() { - if (retInt) *retInt = 3; - hide(); + if (retInt) *retInt = 3; + hide(); } void SecureDlg::slotBtnSwitchUser() { - if (retInt) *retInt = 4; - hide(); + if (retInt) *retInt = 4; + hide(); } void SecureDlg::setRetInt(int *i) { - retInt = i; + retInt = i; } void SecureDlg::closeDialogForced() { - if (retInt) *retInt = 0; - TQDialog::reject(); + if (retInt) *retInt = 0; + TQDialog::reject(); } void SecureDlg::reject() { - closeDialogForced(); + closeDialogForced(); } void SecureDlg::show() { - TQDialog::show(); - TQApplication::flushX(); + TQDialog::show(); + TQApplication::flushX(); } #include "securedlg.moc" diff --git a/kdesktop/lock/securedlg.h b/kdesktop/lock/securedlg.h index d616bf2e7..9ad0ac1da 100644 --- a/kdesktop/lock/securedlg.h +++ b/kdesktop/lock/securedlg.h @@ -1,8 +1,8 @@ //=========================================================================== // -// This file is part of the KDE project +// This file is part of the TDE project // -// Copyright (c) 2010 Timothy Pearson +// Copyright (c) 2010 - 2015 Timothy Pearson // #ifndef __SECUREDLG_H__ @@ -27,41 +27,41 @@ class TQListView; // class SecureDlg : public TQDialog { - Q_OBJECT + Q_OBJECT -public: - SecureDlg(LockProcess *parent); - ~SecureDlg(); - virtual void show(); + public: + SecureDlg(LockProcess *parent); + ~SecureDlg(); + virtual void show(); - void closeDialogForced(); - void setRetInt(int *); + void closeDialogForced(); + void setRetInt(int *); -private slots: - void slotBtnCancel(); - void slotBtnLock(); - void slotBtnTask(); - void slotBtnShutdown(); - void slotBtnSwitchUser(); + private slots: + void slotBtnCancel(); + void slotBtnLock(); + void slotBtnTask(); + void slotBtnShutdown(); + void slotBtnSwitchUser(); -protected slots: - virtual void reject(); + protected slots: + virtual void reject(); -private: - TQFrame *frame; - TQGridLayout *frameLayout; - TQLabel *mLogonStatus; - TQButton *mCancelButton; - TQButton *mLockButton; - TQButton *mTaskButton; - TQButton *mShutdownButton; - TQButton *mSwitchButton; - int mCapsLocked; - bool mUnlockingFailed; - TQStringList layoutsList; - TQStringList::iterator currLayout; - int sPid, sFd; - int* retInt; + private: + TQFrame *frame; + TQGridLayout *frameLayout; + TQLabel *mLogonStatus; + TQButton *mCancelButton; + TQButton *mLockButton; + TQButton *mTaskButton; + TQButton *mShutdownButton; + TQButton *mSwitchButton; + int mCapsLocked; + bool mUnlockingFailed; + TQStringList layoutsList; + TQStringList::iterator currLayout; + int sPid, sFd; + int* retInt; }; #endif -- cgit v1.2.3