diff options
Diffstat (limited to 'kdesktop/lock')
-rw-r--r-- | kdesktop/lock/CMakeLists.txt | 8 | ||||
-rw-r--r-- | kdesktop/lock/Makefile.am | 2 | ||||
-rw-r--r-- | kdesktop/lock/autologout.cpp (renamed from kdesktop/lock/autologout.cc) | 6 | ||||
-rw-r--r-- | kdesktop/lock/autologout.h | 2 | ||||
-rw-r--r-- | kdesktop/lock/infodlg.cpp (renamed from kdesktop/lock/infodlg.cc) | 6 | ||||
-rw-r--r-- | kdesktop/lock/infodlg.h | 2 | ||||
-rw-r--r-- | kdesktop/lock/lockdlg.cpp (renamed from kdesktop/lock/lockdlg.cc) | 95 | ||||
-rw-r--r-- | kdesktop/lock/lockdlg.h | 2 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cpp (renamed from kdesktop/lock/lockprocess.cc) | 337 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 20 | ||||
-rw-r--r-- | kdesktop/lock/main.cpp (renamed from kdesktop/lock/main.cc) | 136 | ||||
-rw-r--r-- | kdesktop/lock/main.h | 4 | ||||
-rw-r--r-- | kdesktop/lock/querydlg.cpp (renamed from kdesktop/lock/querydlg.cc) | 8 | ||||
-rw-r--r-- | kdesktop/lock/querydlg.h | 2 | ||||
-rw-r--r-- | kdesktop/lock/sakdlg.cpp (renamed from kdesktop/lock/sakdlg.cc) | 6 | ||||
-rw-r--r-- | kdesktop/lock/sakdlg.h | 2 | ||||
-rw-r--r-- | kdesktop/lock/securedlg.cpp (renamed from kdesktop/lock/securedlg.cc) | 12 | ||||
-rw-r--r-- | kdesktop/lock/securedlg.h | 2 |
18 files changed, 347 insertions, 305 deletions
diff --git a/kdesktop/lock/CMakeLists.txt b/kdesktop/lock/CMakeLists.txt index 05e14e938..abeebb3d2 100644 --- a/kdesktop/lock/CMakeLists.txt +++ b/kdesktop/lock/CMakeLists.txt @@ -34,14 +34,14 @@ link_directories( set( target kdesktop_lock ) set( ${target}_SRCS - lockprocess.cc lockdlg.cc infodlg.cc querydlg.cc sakdlg.cc - securedlg.cc autologout.cc main.cc + lockprocess.cpp lockdlg.cpp infodlg.cpp querydlg.cpp sakdlg.cpp + securedlg.cpp autologout.cpp main.cpp ) tde_add_executable( ${target} AUTOMOC SOURCES ${${target}_SRCS} - LINK kdesktopsettings-static dmctl-static tdeio-shared Xext - pthread ${GL_LIBRARIES} ${LIBTDELDAP_LIBRARIES} + LINK kdesktopsettings-static dmctl-static tdeio-shared Xext ${TDEHW_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${GL_LIBRARIES} "${LINKER_IMMEDIATE_BINDING_FLAGS}" DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kdesktop/lock/Makefile.am b/kdesktop/lock/Makefile.am index c686e3ea9..4c2fb22a8 100644 --- a/kdesktop/lock/Makefile.am +++ b/kdesktop/lock/Makefile.am @@ -8,7 +8,7 @@ kdesktop_lock_LDADD = ../libkdesktopsettings.la ../../tdmlib/libdmctl.la $(LI bin_PROGRAMS = kdesktop_lock -kdesktop_lock_SOURCES = lockprocess.cc lockdlg.cc infodlg.cc querydlg.cc autologout.cc main.cc +kdesktop_lock_SOURCES = lockprocess.cpp lockdlg.cpp infodlg.cpp querydlg.cpp autologout.cpp main.cpp noinst_HEADERS = lockprocess.h lockdlg.h infodlg.h querydlg.h autologout.h main.h diff --git a/kdesktop/lock/autologout.cc b/kdesktop/lock/autologout.cpp index 6e05c439d..ee1d8e1db 100644 --- a/kdesktop/lock/autologout.cc +++ b/kdesktop/lock/autologout.cpp @@ -67,7 +67,7 @@ AutoLogout::AutoLogout(LockProcess *parent) : TQDialog(parent, "password dialog" unlockDialogLayout->addWidget( frame ); frameLayout = new TQGridLayout(frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint()); - frameLayout->addMultiCellWidget(pixLabel, 0, 2, 0, 0, Qt::AlignCenter | Qt::AlignTop); + frameLayout->addMultiCellWidget(pixLabel, 0, 2, 0, 0, TQt::AlignCenter | TQt::AlignTop); frameLayout->addWidget(greetLabel, 0, 1); frameLayout->addWidget(mStatusLabel, 1, 1); frameLayout->addWidget(infoLabel, 2, 1); @@ -83,7 +83,7 @@ AutoLogout::AutoLogout(LockProcess *parent) : TQDialog(parent, "password dialog" mCountdownTimerId = startTimer(1000/25); - connect(tqApp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity())); + connect(tqApp, TQ_SIGNAL(activity()), TQ_SLOT(slotActivity())); setFixedSize( sizeHint() ); } @@ -119,7 +119,7 @@ void AutoLogout::slotActivity() void AutoLogout::logout() { - TQT_TQOBJECT(this)->killTimers(); + this->killTimers(); DCOPRef("ksmserver","ksmserver").send("logout", 0, 0, 0); } diff --git a/kdesktop/lock/autologout.h b/kdesktop/lock/autologout.h index 89cbb880e..834f4fd0e 100644 --- a/kdesktop/lock/autologout.h +++ b/kdesktop/lock/autologout.h @@ -22,7 +22,7 @@ class TQProgressBar; class AutoLogout : public TQDialog { - Q_OBJECT + TQ_OBJECT public: AutoLogout(LockProcess *parent); diff --git a/kdesktop/lock/infodlg.cc b/kdesktop/lock/infodlg.cpp index 3efaf060d..a37c92b8e 100644 --- a/kdesktop/lock/infodlg.cc +++ b/kdesktop/lock/infodlg.cpp @@ -14,7 +14,7 @@ #include <tdelocale.h> #include <kpushbutton.h> #include <kseparator.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeglobalsettings.h> #include <tdeconfig.h> #include <kiconloader.h> @@ -97,7 +97,7 @@ InfoDlg::InfoDlg(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->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, TQt::AlignTop ); frameLayout->addLayout( layStatus, 1, 1 ); installEventFilter(this); @@ -111,7 +111,7 @@ InfoDlg::~InfoDlg() void InfoDlg::updateLabel(TQString &txt) { - mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setPaletteForegroundColor(TQt::black); mStatusLabel->setText("<b>" + txt + "</b>"); } diff --git a/kdesktop/lock/infodlg.h b/kdesktop/lock/infodlg.h index 3daf4d2ce..ec5569748 100644 --- a/kdesktop/lock/infodlg.h +++ b/kdesktop/lock/infodlg.h @@ -26,7 +26,7 @@ class TQListView; // class InfoDlg : public TQDialog { - Q_OBJECT + TQ_OBJECT public: InfoDlg(LockProcess *parent); diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cpp index d4b456a9e..c5d3d1aea 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cpp @@ -20,7 +20,8 @@ #include <tdelocale.h> #include <kpushbutton.h> #include <kseparator.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> +#include <tdesimpleconfig.h> #include <tdeglobalsettings.h> #include <tdeconfig.h> #include <kiconloader.h> @@ -43,7 +44,10 @@ #include <tqlistview.h> #include <tqheader.h> #include <tqcheckbox.h> +#ifdef WITH_TDEHWLIB #include <tqfile.h> +#include <tdecryptographiccarddevice.h> +#endif #include <ctype.h> #include <unistd.h> @@ -58,9 +62,6 @@ #include <X11/Xatom.h> #include <fixx11h.h> -#ifdef HAVE_KRB5 -#include <libtdeldap.h> -#endif #ifndef AF_LOCAL # define AF_LOCAL AF_UNIX @@ -101,6 +102,7 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDat mPlugin( plugin ), mCapsLocked(-1), mUnlockingFailed(false), + validUserCardInserted(false), showInfoMessages(true), mCardLoginInProgress(false) { @@ -198,7 +200,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) if (!m_lockStartDT.isNull()) { frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop ); + frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, TQt::AlignTop ); frameLayout->addWidget( greetLabel, 1, 1 ); frameLayout->addWidget( lockDTLabel, 2, 1 ); frameLayout->addItem( greet->getLayoutItem(), 3, 1 ); @@ -208,7 +210,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) } else { frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop ); + frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, TQt::AlignTop ); frameLayout->addWidget( greetLabel, 1, 1 ); frameLayout->addItem( greet->getLayoutItem(), 2, 1 ); frameLayout->addLayout( layStatus, 3, 1 ); @@ -218,7 +220,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) } else { frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( pixLabel, 0, 2, 0, 0, Qt::AlignTop ); + frameLayout->addMultiCellWidget( pixLabel, 0, 2, 0, 0, TQt::AlignTop ); frameLayout->addWidget( greetLabel, 0, 1 ); frameLayout->addItem( greet->getLayoutItem(), 1, 1 ); frameLayout->addLayout( layStatus, 2, 1 ); @@ -235,14 +237,14 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) } setTabOrder( mNewSessButton, mLayoutButton ); - connect(mLayoutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(layoutClicked())); + connect(mLayoutButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(layoutClicked())); if (show_cancel_button) { - connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + connect(cancel, TQ_SIGNAL(clicked()), TQ_SLOT(reject())); } - connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); - connect(mNewSessButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotSwitchUser())); + connect(ok, TQ_SIGNAL(clicked()), TQ_SLOT(slotOK())); + connect(mNewSessButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotSwitchUser())); - if (!DM().isSwitchable() || !kapp->authorize("switch_user")) { + if (!DM().isSwitchable() || !tdeApp->authorize("switch_user")) { mNewSessButton->hide(); } @@ -251,7 +253,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) mFailedTimerId = 0; mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT); - connect(tqApp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) ); + connect(tqApp, TQ_SIGNAL(activity()), TQ_SLOT(slotActivity()) ); greet->setInfoMessageDisplay(showInfoMessages); greet->start(); @@ -327,12 +329,12 @@ void PasswordDlg::setLayoutText( const TQString &txt ) void PasswordDlg::updateLabel() { if (mUnlockingFailed) { - mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setPaletteForegroundColor(TQt::black); mStatusLabel->setText(i18n("<b>Unlocking failed</b>")); // mStatusLabel->show(); } else if (mCapsLocked) { - mStatusLabel->setPaletteForegroundColor(Qt::red); + mStatusLabel->setPaletteForegroundColor(TQt::red); mStatusLabel->setText(i18n("<b>Warning: Caps Lock on</b>")); // mStatusLabel->show(); } @@ -479,6 +481,7 @@ void PasswordDlg::reapVerify() switch (WEXITSTATUS(status)) { case AuthOk: { +#ifdef WITH_TDEHWLIB KUser userinfo; TQString fileName = userinfo.homeDir() + "/.tde_card_login_state"; TQFile flagFile(fileName); @@ -493,6 +496,7 @@ void PasswordDlg::reapVerify() // Card was not used to log in flagFile.remove(); } +#endif // Signal success greet->succeeded(); @@ -555,6 +559,7 @@ void PasswordDlg::handleVerify() setFixedSize( sizeHint().width(), sizeHint().height() + 1 ); setFixedSize( sizeHint() ); +#ifdef WITH_TDEHWLIB // Check if cryptographic card login is being used if (mCardLoginInProgress) { // Attempt authentication if configured @@ -563,11 +568,12 @@ void PasswordDlg::handleVerify() TQString autoPIN = cdevice->autoPIN(); if (autoPIN != TQString::null) { greet->setPassword(autoPIN); - TQTimer::singleShot(0, this, SLOT(slotOK())); + TQTimer::singleShot(0, this, TQ_SLOT(slotOK())); } } mCardLoginInProgress = false; } +#endif } else { greet->textPrompt( arr, false, false ); @@ -706,12 +712,12 @@ void PasswordDlg::gplugMsgBox( TQMessageBox::Icon type, const TQString &text ) 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() ) ); + connect( button, TQ_SIGNAL( clicked() ), TQ_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 ); + grid->addWidget( label1, 0, 0, TQt::AlignCenter ); + grid->addWidget( label2, 0, 1, TQt::AlignCenter ); + grid->addMultiCellWidget( button, 1,1, 0,1, TQt::AlignCenter ); static_cast< LockProcess* >(parent())->execDialog( &dialog ); } @@ -777,16 +783,16 @@ void PasswordDlg::slotStartNewSession() 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() ) ); + connect( okbutton, TQ_SIGNAL( clicked() ), dialog, TQ_SLOT( accept() ) ); KPushButton *cbutton = new KPushButton( KStdGuiItem::cancel(), winFrame ); - connect( cbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( reject() ) ); + connect( cbutton, TQ_SIGNAL( clicked() ), dialog, TQ_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 ); + grid->addWidget( label1, 0, 0, TQt::AlignCenter ); + grid->addWidget( label2, 0, 1, TQt::AlignCenter ); TQCheckBox *cb = new TQCheckBox( i18n("&Do not ask again"), winFrame ); grid->addMultiCellWidget( cb, 1,1, 0,1 ); @@ -895,8 +901,8 @@ void PasswordDlg::slotSwitchUser() 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()) ); + connect( lv, TQ_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), TQ_SLOT(slotSessionActivated()) ); + connect( lv, TQ_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), &dialog, TQ_SLOT(accept()) ); lv->setAllColumnsShowFocus( true ); lv->addColumn( i18n("Session") ); lv->addColumn( i18n("Location") ); @@ -927,16 +933,16 @@ void PasswordDlg::slotSwitchUser() 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()) ); + connect( btn, TQ_SIGNAL(clicked()), TQ_SLOT(slotSessionActivated()) ); + connect( btn, TQ_SIGNAL(clicked()), &dialog, TQ_SLOT(accept()) ); vbox2->addWidget( btn ); vbox2->addStretch( 2 ); } - if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0) { + if (tdeApp->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()) ); + connect( btn, TQ_SIGNAL(clicked()), TQ_SLOT(slotStartNewSession()) ); + connect( btn, TQ_SIGNAL(clicked()), &dialog, TQ_SLOT(accept()) ); if (!p) btn->setEnabled( false ); vbox2->addWidget( btn ); @@ -944,7 +950,7 @@ void PasswordDlg::slotSwitchUser() } btn = new KPushButton( KStdGuiItem::cancel(), winFrame ); - connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(reject()) ); + connect( btn, TQ_SIGNAL(clicked()), &dialog, TQ_SLOT(reject()) ); vbox2->addWidget( btn ); dialog.setFixedSize( dialog.sizeHint() ); @@ -974,16 +980,22 @@ void PasswordDlg::capsLocked() } void PasswordDlg::attemptCardLogin() { -#ifdef HAVE_KRB5 - // Make sure card logins are enabled before attempting one - if (!LDAPManager::pkcsLoginEnabled()) { - return; - } -#else +#ifdef WITH_TDEHWLIB +#ifndef HAVE_KRB5 // Don't enable card-based logins if Kerberos integration was disabled return; #endif + // Make sure card logins are enabled before attempting one + TDESimpleConfig *systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" )); + systemconfig->setGroup(NULL); + bool enabled = systemconfig->readBoolEntry("EnablePKCS11Login", false); + delete systemconfig; + if (!enabled) + { + return; + } + if (mCardLoginInProgress) { return; } @@ -1003,10 +1015,12 @@ void PasswordDlg::attemptCardLogin() { // Bypass initial password prompt greet->start(); greet->setPassword(""); - TQTimer::singleShot(0, this, SLOT(slotOK())); + TQTimer::singleShot(0, this, TQ_SLOT(slotOK())); +#endif } void PasswordDlg::resetCardLogin() { +#ifdef WITH_TDEHWLIB validUserCardInserted = false; greet->abort(); greet->clear(); @@ -1019,9 +1033,10 @@ void PasswordDlg::resetCardLogin() { setFixedSize(sizeHint()); // Restore information message display settings - greet->setInfoMessageDisplay(showInfoMessages); + greet->setInfoMessageDisplay(showInfoMessages); mCardLoginInProgress = false; +#endif } #include "lockdlg.moc" diff --git a/kdesktop/lock/lockdlg.h b/kdesktop/lock/lockdlg.h index 571d825fa..3f8500a42 100644 --- a/kdesktop/lock/lockdlg.h +++ b/kdesktop/lock/lockdlg.h @@ -33,7 +33,7 @@ class TQListView; // class PasswordDlg : public TQDialog, public KGreeterPluginHandler { - Q_OBJECT + TQ_OBJECT public: PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin); diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cpp index fdde3fc9e..2ad89f5ab 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cpp @@ -17,6 +17,14 @@ //some image will be corrupted). #include <config.h> +#include <tdeglobal.h> + +#ifdef WITH_TDEHWLIB +#include <ksslcertificate.h> +#include <kuser.h> +#include <tdehardwaredevices.h> +#include <tdecryptographiccarddevice.h> +#endif #include "lockprocess.h" #include "lockdlg.h" @@ -30,11 +38,10 @@ #include <dmctl.h> #include <dcopref.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeapplication.h> #include <kservicegroup.h> #include <kdebug.h> -#include <kuser.h> #include <tdemessagebox.h> #include <tdeglobalsettings.h> #include <tdelocale.h> @@ -78,7 +85,7 @@ #include <sys/types.h> #include <fcntl.h> -#include <kcrash.h> +#include <tdecrash.h> #include <pthread.h> @@ -144,14 +151,6 @@ Atom kde_wm_system_modal_notification = 0; Atom kde_wm_transparent_to_desktop = 0; Atom kde_wm_transparent_to_black = 0; -static void segv_handler(int) -{ - kdError(KDESKTOP_DEBUG_ID) << "A fatal exception was encountered." - << " Trapping and ignoring it so as not to compromise desktop security..." - << kdBacktrace() << endl; - sleep(1); -} - extern Atom tqt_wm_state; extern bool trinity_desktop_lock_use_system_modal_dialogs; extern bool trinity_desktop_lock_delay_screensaver_start; @@ -159,24 +158,32 @@ extern bool trinity_desktop_lock_use_sak; extern bool trinity_desktop_lock_hide_active_windows; extern bool trinity_desktop_lock_hide_cancel_button; extern bool trinity_desktop_lock_forced; - -extern LockProcess* trinity_desktop_lock_process; +extern bool trinity_desktop_lock_failed_grab; extern bool argb_visual; extern pid_t kdesktop_pid; extern TQXLibWindowList trinity_desktop_lock_hidden_window_list; -bool trinity_desktop_lock_autohide_lockdlg = TRUE; +bool trinity_desktop_lock_autohide_lockdlg = true; + +static void segv_handler(int) +{ + kdError(KDESKTOP_DEBUG_ID) << "A fatal exception was encountered." + << " Trapping and ignoring it so as not to compromise desktop security..." + << kdBacktrace() << endl; + + sleep(1); +} #define ENABLE_CONTINUOUS_LOCKDLG_DISPLAY \ -if (!mForceContinualLockDisplayTimer->isActive()) mForceContinualLockDisplayTimer->start(100, FALSE); \ -trinity_desktop_lock_autohide_lockdlg = FALSE; \ +if (!mForceContinualLockDisplayTimer->isActive()) mForceContinualLockDisplayTimer->start(100, false); \ +trinity_desktop_lock_autohide_lockdlg = false; \ mHackDelayStartupTimer->stop(); #define DISABLE_CONTINUOUS_LOCKDLG_DISPLAY \ mForceContinualLockDisplayTimer->stop(); \ -trinity_desktop_lock_autohide_lockdlg = TRUE; \ +trinity_desktop_lock_autohide_lockdlg = true; \ mHackDelayStartupTimer->stop(); //=========================================================================== @@ -227,7 +234,9 @@ LockProcess::LockProcess() m_notifyReadyRequested(false), m_loginCardDevice(NULL), m_maskWidget(NULL), - m_saverRootWindow(0) + m_saverRootWindow(0), + mControlPipeHandler(nullptr), + mControlPipeHandlerThread(nullptr) { #ifdef KEEP_MOUSE_UNGRABBED setNFlags(WX11DisableMove|WX11DisableClose|WX11DisableShade|WX11DisableMinimize|WX11DisableMaximize); @@ -240,7 +249,7 @@ LockProcess::LockProcess() kde_wm_transparent_to_desktop = XInternAtom(tqt_xdisplay(), "_TDE_TRANSPARENT_TO_DESKTOP", False); kde_wm_transparent_to_black = XInternAtom(tqt_xdisplay(), "_TDE_TRANSPARENT_TO_BLACK", False); - kapp->installX11EventFilter(this); + tdeApp->installX11EventFilter(this); mForceContinualLockDisplayTimer = new TQTimer( this ); mHackDelayStartupTimer = new TQTimer( this ); @@ -249,7 +258,7 @@ LockProcess::LockProcess() if (!argb_visual) { // Try to get the root pixmap if (!m_rootPixmap) m_rootPixmap = new KRootPixmap(this); - connect(m_rootPixmap, TQT_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQT_SLOT(slotPaintBackground(const TQPixmap &))); + connect(m_rootPixmap, TQ_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQ_SLOT(slotPaintBackground(const TQPixmap &))); m_rootPixmap->setCustomPainting(true); m_rootPixmap->start(); } @@ -291,18 +300,20 @@ LockProcess::LockProcess() } } +#ifdef WITH_TDEHWLIB // Initialize SmartCard readers TDEGenericDevice *hwdevice; TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); TDEGenericHardwareList cardReaderList = hwdevices->listByDeviceClass(TDEGenericDeviceType::CryptographicCard); for (hwdevice = cardReaderList.first(); hwdevice; hwdevice = cardReaderList.next()) { TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice); - // connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); - connect(cdevice, TQT_SIGNAL(certificateListAvailable(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardInserted(TDECryptographicCardDevice*))); - connect(cdevice, TQT_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); + // connect(cdevice, TQ_SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(certificateListAvailable(TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardInserted(TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); // cdevice->enablePINEntryCallbacks(true); } +#endif #ifdef KEEP_MOUSE_UNGRABBED setEnabled(false); @@ -322,8 +333,6 @@ LockProcess::~LockProcess() mControlPipeHandler->terminateThread(); mControlPipeHandlerThread->wait(); delete mControlPipeHandler; -// delete mControlPipeHandlerThread; - if (resizeTimer != NULL) { resizeTimer->stop(); delete resizeTimer; @@ -379,12 +388,12 @@ void LockProcess::init(bool child, bool useBlankOnly) generateBackingImages(); // Connect all signals - connect( mForceContinualLockDisplayTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(displayLockDialogIfNeeded()) ); - connect( mHackDelayStartupTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(closeDialogAndStartHack()) ); - connect( mEnsureVRootWindowSecurityTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(repaintRootWindowIfNeeded()) ); - connect(tqApp, TQT_SIGNAL(mouseInteraction(XEvent *)), TQT_SLOT(slotMouseActivity(XEvent *))); - connect(&mHackProc, TQT_SIGNAL(processExited(TDEProcess *)), TQT_SLOT(hackExited(TDEProcess *))); - connect(&mSuspendTimer, TQT_SIGNAL(timeout()), TQT_SLOT(suspend())); + connect( mForceContinualLockDisplayTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(displayLockDialogIfNeeded()) ); + connect( mHackDelayStartupTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(closeDialogAndStartHack()) ); + connect( mEnsureVRootWindowSecurityTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(repaintRootWindowIfNeeded()) ); + connect(tqApp, TQ_SIGNAL(mouseInteraction(XEvent *)), TQ_SLOT(slotMouseActivity(XEvent *))); + connect(&mHackProc, TQ_SIGNAL(processExited(TDEProcess *)), TQ_SLOT(hackExited(TDEProcess *))); + connect(&mSuspendTimer, TQ_SIGNAL(timeout()), TQ_SLOT(suspend())); #ifdef HAVE_DPMS //if the user decided that the screensaver should run independent from @@ -394,7 +403,7 @@ void LockProcess::init(bool child, bool useBlankOnly) CARD16 state; if (DPMSInfo(tqt_xdisplay(), &state, &on)) { if (on) { - connect(&mCheckDPMS, TQT_SIGNAL(timeout()), TQT_SLOT(checkDPMSActive())); + connect(&mCheckDPMS, TQ_SIGNAL(timeout()), TQ_SLOT(checkDPMSActive())); // we can save CPU if we stop it as quickly as possible // but we waste CPU if we check too often -> so take 10s mCheckDPMS.start(10000); @@ -403,9 +412,7 @@ void LockProcess::init(bool child, bool useBlankOnly) } #endif -#if (TQT_VERSION-0 >= 0x030200) // XRANDR support - connect( kapp->desktop(), TQT_SIGNAL( resized( int )), TQT_SLOT( desktopResized())); -#endif + connect( tdeApp->desktop(), TQ_SIGNAL( resized( int )), TQ_SLOT( desktopResized())); if (!trinity_desktop_lock_use_system_modal_dialogs) { setWFlags((WFlags)WX11BypassWM); @@ -426,21 +433,25 @@ void LockProcess::init(bool child, bool useBlankOnly) mControlPipeHandler = new ControlPipeHandlerObject(); mControlPipeHandler->mParent = this; mControlPipeHandler->moveToThread(mControlPipeHandlerThread); - TQObject::connect(mControlPipeHandler, SIGNAL(processCommand(TQString)), this, SLOT(processInputPipeCommand(TQString))); - TQTimer::singleShot(0, mControlPipeHandler, SLOT(run())); + TQObject::connect(mControlPipeHandler, TQ_SIGNAL(processCommand(TQString)), this, TQ_SLOT(processInputPipeCommand(TQString))); + TQTimer::singleShot(0, mControlPipeHandler, TQ_SLOT(run())); mControlPipeHandlerThread->start(); + // If the lock process terminates before 'mControlPipeHandler::run()' has been called, the + // 'mControlPipeHandlerThread' thread would not terminate and the lock process would have a + // dirty exit, potentially leaving 'kdesktop' in a dirty state that prevents the lock from + // working correctly till 'kdesktop' is killed and restarted. By forcing a call to 'processEvents()' + // we make sure to handle pending timer events and execute the required call + tdeApp->processEvents(); } static int signal_pipe[2]; static void sigterm_handler(int) { - if ((!trinity_desktop_lock_process) || (!trinity_desktop_lock_process->inSecureDialog())) { - // Exit uncleanly - char tmp = 'U'; - if (::write( signal_pipe[1], &tmp, 1) == -1) { - // Error handler to shut up gcc warnings - } + // Exit uncleanly + char tmp = 'U'; + if (::write( signal_pipe[1], &tmp, 1) == -1) { + // Error handler to shut up gcc warnings } } @@ -454,7 +465,7 @@ static void sighup_handler(int) bool LockProcess::closeCurrentWindow() { - mClosingWindows = TRUE; + mClosingWindows = true; if (currentDialog != NULL) { mForceReject = true; if (dynamic_cast<SAKDlg*>(currentDialog)) { @@ -469,12 +480,12 @@ bool LockProcess::closeCurrentWindow() } if( mDialogs.isEmpty() ) { - mClosingWindows = FALSE; + mClosingWindows = false; mForceReject = false; return false; } else { - mClosingWindows = TRUE; + mClosingWindows = true; return true; } } @@ -524,8 +535,8 @@ void LockProcess::setupSignals() if (pipe(signal_pipe) == -1) { // Error handler to shut up gcc warnings } - TQSocketNotifier* notif = new TQSocketNotifier(signal_pipe[0], TQSocketNotifier::Read, TQT_TQOBJECT(this) ); - connect( notif, TQT_SIGNAL(activated(int)), TQT_SLOT(signalPipeSignal())); + TQSocketNotifier* notif = new TQSocketNotifier(signal_pipe[0], TQSocketNotifier::Read, this ); + connect( notif, TQ_SIGNAL(activated(int)), TQ_SLOT(signalPipeSignal())); } @@ -543,9 +554,11 @@ void LockProcess::signalPipeSignal() startLock(); } else if( tmp == 'U' ) { - // Exit uncleanly - quitSaver(); - exit(1); + if (!inSecureDialog()) { + // Exit uncleanly + quitSaver(); + exit(1); + } } } @@ -557,7 +570,7 @@ bool LockProcess::lock() m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("...")); m_startupStatusDialog->show(); m_startupStatusDialog->setActiveWindow(); - tqApp->processEvents(); + tdeApp->processEvents(); #endif if (startSaver(true)) { @@ -568,7 +581,7 @@ bool LockProcess::lock() // selecting "lock screen", that looks really untidy. mBusy = true; if (startLock()) { - TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed())); + TQTimer::singleShot(1000, this, TQ_SLOT(slotDeadTimePassed())); return true; } stopSaver(); @@ -589,7 +602,7 @@ bool LockProcess::defaultSave() mOverrideHackStartupEnabled = true; if (startSaver()) { if (mLockGrace >= 0) { - TQTimer::singleShot(mLockGrace, this, TQT_SLOT(startLock())); + TQTimer::singleShot(mLockGrace, this, TQ_SLOT(startLock())); } return true; } @@ -609,18 +622,18 @@ void LockProcess::quitSaver() { DISABLE_CONTINUOUS_LOCKDLG_DISPLAY if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(quitSaver()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(quitSaver()) ); return; } stopSaver(); - kapp->quit(); + tdeApp->quit(); } //--------------------------------------------------------------------------- void LockProcess::startSecureDialog() { if ((backingPixmap.isNull()) && (mBackingStartupDelayTimer < 100)) { - TQTimer::singleShot(10, this, TQT_SLOT(startSecureDialog())); + TQTimer::singleShot(10, this, TQ_SLOT(startSecureDialog())); mBackingStartupDelayTimer++; return; } @@ -641,7 +654,7 @@ void LockProcess::startSecureDialog() mInSecureDialog = false; if (ret == 0) { mClosingWindows = 1; - kapp->quit(); + tdeApp->quit(); } if (ret == 1) { // In case of a forced lock we don't react to events during @@ -652,18 +665,18 @@ void LockProcess::startSecureDialog() mBusy = true; trinity_desktop_lock_forced = true; // Make sure the cursor is not showing busy status - setCursor( tqarrowCursor ); + setCursor( TQt::arrowCursor ); if (startLock()) { if (trinity_desktop_lock_delay_screensaver_start) { mBusy = false; } else { - TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed())); + TQTimer::singleShot(1000, this, TQ_SLOT(slotDeadTimePassed())); } if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { if (mHackStartupEnabled == true) { @@ -672,7 +685,7 @@ void LockProcess::startSecureDialog() else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { startHack(); @@ -690,18 +703,18 @@ void LockProcess::startSecureDialog() if (system("ksysguard &") == -1) { // Error handler to shut up gcc warnings } - kapp->quit(); + tdeApp->quit(); } if (ret == 3) { mClosingWindows = 1; DCOPRef("ksmserver","ksmserver").send("logout", (int)TDEApplication::ShutdownConfirmYes, (int)TDEApplication::ShutdownTypeNone, (int)TDEApplication::ShutdownModeInteractive); - kapp->quit(); + tdeApp->quit(); } // FIXME // Handle remaining case (switch user) if (forcecontdisp) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } stopSaver(); } @@ -713,13 +726,13 @@ bool LockProcess::runSecureDialog() m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("...")); m_startupStatusDialog->show(); m_startupStatusDialog->setActiveWindow(); - tqApp->processEvents(); + tdeApp->processEvents(); #endif mInSecureDialog = true; if (startSaver()) { mBackingStartupDelayTimer = 0; - TQTimer::singleShot(0, this, TQT_SLOT(startSecureDialog())); + TQTimer::singleShot(0, this, TQ_SLOT(startSecureDialog())); return true; } else { @@ -789,9 +802,9 @@ void LockProcess::readSaver() if (!mSaver.isEmpty()) { TQString file = locate("scrsav", mSaver); - bool opengl = kapp->authorize("opengl_screensavers"); - bool manipulatescreen = kapp->authorize("manipulatescreen_screensavers"); - KDesktopFile config(file, true); + bool opengl = tdeApp->authorize("opengl_screensavers"); + bool manipulatescreen = tdeApp->authorize("manipulatescreen_screensavers"); + TDEDesktopFile config(file, true); if (config.readEntry("X-TDE-Type").utf8() != 0) { TQString saverType = config.readEntry("X-TDE-Type").utf8(); TQStringList saverTypes = TQStringList::split(";", saverType); @@ -1031,7 +1044,7 @@ void LockProcess::desktopResized() } else { mEnsureScreenHiddenTimer = new TQTimer( this ); - connect( mEnsureScreenHiddenTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotForcePaintBackground()) ); + connect( mEnsureScreenHiddenTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotForcePaintBackground()) ); } mEnsureScreenHiddenTimer->start(DESKTOP_WALLPAPER_OBTAIN_TIMEOUT_MS, true); } @@ -1054,9 +1067,9 @@ void LockProcess::desktopResized() // being displayed, so we finish the hack restarting/display prettying operations in a separate timed slot if (resizeTimer == NULL) { resizeTimer = new TQTimer( this ); - connect( resizeTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(doDesktopResizeFinish()) ); + connect( resizeTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(doDesktopResizeFinish()) ); } - resizeTimer->start( 100, TRUE ); // 100 millisecond single shot timer; should allow display switching operations to finish before hack is started + resizeTimer->start( 100, true ); // 100 millisecond single shot timer; should allow display switching operations to finish before hack is started } void LockProcess::doDesktopResizeFinish() @@ -1066,7 +1079,7 @@ void LockProcess::doDesktopResizeFinish() } mDialogControlLock = true; if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(doDesktopResizeFinish()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(doDesktopResizeFinish()) ); mDialogControlLock = false; return; } @@ -1075,7 +1088,7 @@ void LockProcess::doDesktopResizeFinish() // Restart the hack as the window size is now different if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { if (mHackStartupEnabled == true) { @@ -1084,7 +1097,7 @@ void LockProcess::doDesktopResizeFinish() else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { startHack(); @@ -1234,10 +1247,10 @@ bool LockProcess::grabMouse() { HANDLE cursorHandle; if (mHackActive) { - cursorHandle = TQCursor(tqblankCursor).handle(); + cursorHandle = TQCursor(TQt::blankCursor).handle(); } else { - cursorHandle = TQCursor(tqbusyCursor).handle(); + cursorHandle = TQCursor(TQt::busyCursor).handle(); } int rv = XGrabPointer( tqt_xdisplay(), TQApplication::desktop()->winId(), True, GRABEVENTS, GrabModeAsync, GrabModeAsync, None, @@ -1334,6 +1347,7 @@ bool LockProcess::startSaver(bool notify_ready) if (!child_saver && !grabInput()) { kdWarning(KDESKTOP_DEBUG_ID) << "LockProcess::startSaver() grabInput() failed!!!!" << endl; + trinity_desktop_lock_failed_grab = true; return false; } mBusy = false; @@ -1344,8 +1358,8 @@ bool LockProcess::startSaver(bool notify_ready) saveVRoot(); if (mParent) { - TQSocketNotifier *notifier = new TQSocketNotifier(mParent, TQSocketNotifier::Read, TQT_TQOBJECT(this), "notifier"); - connect(notifier, TQT_SIGNAL( activated (int)), TQT_SLOT( quitSaver())); + TQSocketNotifier *notifier = new TQSocketNotifier(mParent, TQSocketNotifier::Read, this, "notifier"); + connect(notifier, TQ_SIGNAL( activated (int)), TQ_SLOT( quitSaver())); } createSaverWindow(); move(0, 0); @@ -1361,7 +1375,8 @@ bool LockProcess::startSaver(bool notify_ready) slotPaintBackground(rootWinSnapShot); } - if (((!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) && (!mInSecureDialog)) && (mHackStartupEnabled || mOverrideHackStartupEnabled)) { + if (!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) && !mInSecureDialog && + (mHackStartupEnabled || mOverrideHackStartupEnabled)) { if (argb_visual) { setTransparentBackgroundARGB(); } @@ -1388,10 +1403,10 @@ bool LockProcess::startSaver(bool notify_ready) } } - if (mInSecureDialog == FALSE) { + if (!mInSecureDialog) { if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { if (mHackStartupEnabled || mOverrideHackStartupEnabled) { @@ -1401,7 +1416,7 @@ bool LockProcess::startSaver(bool notify_ready) else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { startHack(); @@ -1520,7 +1535,7 @@ void LockProcess::closeDialogAndStartHack() // Make sure saver will attempt to start again after DPMS wakeup // This is related to Bug 1475 ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); // Should not start saver here, because the DPMS check method below would turn it right back off! // This is related to Bug 1475 return; @@ -1533,7 +1548,7 @@ void LockProcess::closeDialogAndStartHack() DISABLE_CONTINUOUS_LOCKDLG_DISPLAY mSuspended = true; if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(closeDialogAndStartHack()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(closeDialogAndStartHack()) ); } else { resume(true); @@ -1568,10 +1583,10 @@ void LockProcess::repaintRootWindowIfNeeded() bool LockProcess::startHack() { - mHackActive = TRUE; + mHackActive = true; if ((mEnsureVRootWindowSecurityTimer) && (!mEnsureVRootWindowSecurityTimer->isActive())) { - mEnsureVRootWindowSecurityTimer->start(250, FALSE); + mEnsureVRootWindowSecurityTimer->start(250, false); } if (currentDialog || (!mDialogs.isEmpty())) { @@ -1593,8 +1608,8 @@ bool LockProcess::startHack() return false; } - setCursor( tqblankCursor ); - XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqblankCursor).handle(), CurrentTime); + setCursor( TQt::blankCursor ); + XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(TQt::blankCursor).handle(), CurrentTime); if (mSaverExec.isEmpty()) { return false; @@ -1650,7 +1665,7 @@ bool LockProcess::startHack() mSuspended = false; } - XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqblankCursor).handle(), CurrentTime); + XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(TQt::blankCursor).handle(), CurrentTime); if (mHackProc.start() == true) { #ifdef HAVE_SETPRIORITY setpriority(PRIO_PROCESS, mHackProc.pid(), mPriority); @@ -1660,7 +1675,7 @@ bool LockProcess::startHack() if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) { // Close any active dialogs if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(closeCurrentWindow()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(closeCurrentWindow()) ); } } if (m_startupStatusDialog) { m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog=NULL; } @@ -1700,7 +1715,7 @@ bool LockProcess::startHack() } if (trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } saverReadyIfNeeded(); } @@ -1724,9 +1739,9 @@ void LockProcess::stopHack() mHackProc.kill(SIGKILL); } } - setCursor( tqarrowCursor ); + setCursor( TQt::arrowCursor ); - mHackActive = FALSE; + mHackActive = false; } //--------------------------------------------------------------------------- @@ -1735,7 +1750,7 @@ void LockProcess::hackExited(TDEProcess *) { // Hack exited while we're supposed to be saving the screen. // Make sure the saver window is black. - mHackActive = FALSE; + mHackActive = false; usleep(100); TQApplication::syncX(); if (!trinity_desktop_lock_use_system_modal_dialogs) { @@ -1770,7 +1785,7 @@ void LockProcess::hackExited(TDEProcess *) if (!mSuspended) { if (trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } } saverReadyIfNeeded(); @@ -1782,19 +1797,17 @@ void LockProcess::displayLockDialogIfNeeded() m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog = NULL; } - if (!mInSecureDialog) { - if (trinity_desktop_lock_use_system_modal_dialogs) { - if (!mBusy) { - mBusy = true; - if (mLocked) { - if (checkPass()) { - mClosingWindows = true; - stopSaver(); - kapp->quit(); - } + if (!mInSecureDialog && trinity_desktop_lock_use_system_modal_dialogs) { + if (!mBusy) { + mBusy = true; + if (mLocked) { + if (checkPass()) { + mClosingWindows = true; + stopSaver(); + tdeApp->quit(); } - mBusy = false; } + mBusy = false; } } } @@ -1807,7 +1820,7 @@ void LockProcess::suspend() stopHack(); ENABLE_CONTINUOUS_LOCKDLG_DISPLAY if (mHackStartupEnabled) { - mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } } else { @@ -1825,7 +1838,7 @@ void LockProcess::suspend() } hackstat[8191] = 0; hackStatus = hackstat; - hackStatus = hackStatus.remove(TQRegExp("(*) ", TRUE, TRUE)); + hackStatus = hackStatus.remove(TQRegExp("(*) ", true, true)); TQStringList hackStatusList = TQStringList::split(" ", hackStatus); hackStatus = (*(hackStatusList.at(1))); } @@ -1980,7 +1993,7 @@ int LockProcess::execDialog( TQDialog *dlg ) if (mDialogs.isEmpty()) { suspend(); - XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqarrowCursor).handle(), CurrentTime); + XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(TQt::arrowCursor).handle(), CurrentTime); } mDialogs.prepend( dlg ); fakeFocusIn( dlg->winId()); @@ -2007,20 +2020,20 @@ int LockProcess::execDialog( TQDialog *dlg ) if( mDialogs.isEmpty() ) { HANDLE cursorHandle; if (mHackActive) { - cursorHandle = TQCursor(tqblankCursor).handle(); + cursorHandle = TQCursor(TQt::blankCursor).handle(); } else { - cursorHandle = TQCursor(tqbusyCursor).handle(); + cursorHandle = TQCursor(TQt::busyCursor).handle(); } XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, cursorHandle, CurrentTime); if (trinity_desktop_lock_use_system_modal_dialogs) { // Slight delay before screensaver resume to allow the dialog window to fully disappear if (hackResumeTimer == NULL) { hackResumeTimer = new TQTimer( this ); - connect( hackResumeTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(resumeUnforced()) ); + connect( hackResumeTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(resumeUnforced()) ); } if (mResizingDesktopLock == false) { - hackResumeTimer->start( 10, TRUE ); + hackResumeTimer->start( 10, true ); } } else { @@ -2037,7 +2050,7 @@ int LockProcess::execDialog( TQDialog *dlg ) void LockProcess::slotForcePaintBackground() { TQPixmap blankPixmap(mRootWidth, mRootHeight); - blankPixmap.fill(Qt::black); + blankPixmap.fill(TQt::black); slotPaintBackground(blankPixmap); printf("[WARNING] Unable to obtain desktop wallpaper in a timely manner. High system load or possibly a TDE bug!\n"); fflush(stdout); } @@ -2056,7 +2069,7 @@ void LockProcess::slotPaintBackground(const TQPixmap &rpm) } else { mEnsureScreenHiddenTimer = new TQTimer( this ); - connect( mEnsureScreenHiddenTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotForcePaintBackground()) ); + connect( mEnsureScreenHiddenTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotForcePaintBackground()) ); } // Only remove the mask widget once the resize is 100% complete! @@ -2118,7 +2131,7 @@ void LockProcess::doFunctionKeyBroadcast() { // This does NOT work with the SAK or system modal dialogs! if ((!trinity_desktop_lock_use_system_modal_dialogs) && (!trinity_desktop_lock_use_sak)) { mBusy=true; - TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed())); + TQTimer::singleShot(1000, this, TQ_SLOT(slotDeadTimePassed())); if (mkeyCode == XKeysymToKeycode(tqt_xdisplay(), XF86XK_Display)) { while (mDialogControlLock == true) { usleep(100000); @@ -2158,7 +2171,7 @@ bool LockProcess::x11Event(XEvent *event) (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioRaiseVolume)) || \ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioLowerVolume))) { mkeyCode = event->xkey.keycode; - TQTimer::singleShot( 100, this, TQT_SLOT(doFunctionKeyBroadcast()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(doFunctionKeyBroadcast()) ); return true; } // ACPI power keys @@ -2167,7 +2180,7 @@ bool LockProcess::x11Event(XEvent *event) (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Suspend)) || \ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Hibernate))) { mkeyCode = event->xkey.keycode; - TQTimer::singleShot( 100, this, TQT_SLOT(doFunctionKeyBroadcast()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(doFunctionKeyBroadcast()) ); return true; } } @@ -2183,7 +2196,7 @@ bool LockProcess::x11Event(XEvent *event) // fall through case KeyPress: if ((mHackDelayStartupTimer) && (mHackDelayStartupTimer->isActive())) { - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } if (mBusy || !mDialogs.isEmpty()) { break; @@ -2193,12 +2206,12 @@ bool LockProcess::x11Event(XEvent *event) if (mLocked) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY if (mHackStartupEnabled) { - mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } } - if ((!mLocked) && (!mInSecureDialog)) { + if (!mLocked && !mInSecureDialog) { stopSaver(); - kapp->quit(); + tdeApp->quit(); } if (mAutoLogout) { // we need to restart the auto logout countdown @@ -2210,7 +2223,7 @@ bool LockProcess::x11Event(XEvent *event) if (!mLocked || checkPass()) { mClosingWindows = true; stopSaver(); - kapp->quit(); + tdeApp->quit(); } else if (mAutoLogout) { // we need to restart the auto logout countdown @@ -2242,7 +2255,7 @@ bool LockProcess::x11Event(XEvent *event) else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { resume( false ); @@ -2299,7 +2312,7 @@ bool LockProcess::x11Event(XEvent *event) && event->xkey.window != mDialogs.first()->winId()) { XEvent ev2 = *event; ev2.xkey.window = ev2.xkey.subwindow = mDialogs.first()->winId(); - tqApp->x11ProcessEvent( &ev2 ); + tdeApp->x11ProcessEvent( &ev2 ); return true; } @@ -2433,14 +2446,14 @@ void LockProcess::msgBox( TQMessageBox::Icon type, const TQString &txt ) KPushButton *button = new KPushButton( KStdGuiItem::ok(), winFrame ); button->setDefault( true ); button->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ) ); - connect( button, TQT_SIGNAL( clicked() ), &box, TQT_SLOT( accept() ) ); + connect( button, TQ_SIGNAL( clicked() ), &box, TQ_SLOT( accept() ) ); TQVBoxLayout *vbox = new TQVBoxLayout( &box ); vbox->addWidget( winFrame ); 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 ); + grid->addWidget( label1, 0, 0, TQt::AlignCenter ); + grid->addWidget( label2, 0, 1, TQt::AlignCenter ); + grid->addMultiCellWidget( button, 1,1, 0,1, TQt::AlignCenter ); execDialog( &box ); } @@ -2449,19 +2462,13 @@ static int run_vkbd = -1; void LockProcess::showVkbd() { if( run_vkbd == - 1 ) { -#ifdef WITH_HAL - int status = system( "hal-find-by-property --key system.formfactor.subtype --string tabletpc" ); -// status = 0; // enable for testing - run_vkbd = ( WIFEXITED( status ) && WEXITSTATUS( status ) == 0 && !TDEStandardDirs::findExe( "xvkbd" ).isEmpty()) ? 1 : 0; -#else // WITH_HAL run_vkbd = (!TDEStandardDirs::findExe( "xvkbd" ).isEmpty()); -#endif // WITH_HAL } if( run_vkbd ) { mVkbdWindows.clear(); mVkbdLastEventWindow = None; mKWinModule = new KWinModule( NULL, KWinModule::INFO_WINDOWS ); - connect( mKWinModule, TQT_SIGNAL( windowAdded( WId )), TQT_SLOT( windowAdded( WId ))); + connect( mKWinModule, TQ_SIGNAL( windowAdded( WId )), TQ_SLOT( windowAdded( WId ))); mVkbdProcess = new TDEProcess; *mVkbdProcess << "xvkbd" << "-compact" << "-geometry" << "-0-0" << "-xdm"; mVkbdProcess->start(); @@ -2567,7 +2574,7 @@ bool LockProcess::forwardVkbdEvent( XEvent* event ) } // vkbd windows are kept topmost, so just find the first one in the position for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin(); it != mVkbdWindows.end(); ++it ) { - if( TQT_TQRECT_OBJECT((*it).rect).contains( pos )) { + if( (*it).rect.contains( pos )) { // Find the subwindow where the event should actually go. // Not exactly cheap in the number of X roundtrips but oh well. Window window = (*it).id; @@ -2675,7 +2682,7 @@ void LockProcess::slotMouseActivity(XEvent *event) } // Clicked inside dialog; set focus - if (inFrame == TRUE) { + if (inFrame) { WId window = mDialogs.first()->winId(); XSetInputFocus(tqt_xdisplay(), window, RevertToParent, CurrentTime); fakeFocusIn(window); @@ -2685,20 +2692,20 @@ void LockProcess::slotMouseActivity(XEvent *event) } // Clicked inside window handle (or border); drag window - if ((inFrame == TRUE) && (inDialog == FALSE)) { + if (inFrame && !inDialog) { TQPoint oldPoint = mDialogs.first()->pos(); m_mouseDown = 1; m_dialogPrevX = oldPoint.x(); m_dialogPrevY = oldPoint.y(); m_mousePrevX = be->x_root; m_mousePrevY = be->y_root; - XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqsizeAllCursor).handle(), CurrentTime); + XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(TQt::sizeAllCursor).handle(), CurrentTime); } } // Drag the window... if (event->type == MotionNotify) { - if (m_mouseDown == TRUE) { + if (m_mouseDown) { int deltaX = me->x_root - m_mousePrevX; int deltaY = me->y_root - m_mousePrevY; m_dialogPrevX = m_dialogPrevX + deltaX; @@ -2712,7 +2719,7 @@ void LockProcess::slotMouseActivity(XEvent *event) if (event->type == ButtonRelease) { m_mouseDown = 0; - XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqarrowCursor).handle(), CurrentTime); + XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(TQt::arrowCursor).handle(), CurrentTime); } } @@ -2823,6 +2830,7 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) { } void LockProcess::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { +#ifdef WITH_TDEHWLIB TQString login_name = TQString::null; X509CertificatePtrList certList = cdevice->cardX509Certificates(); if (certList.count() > 0) { @@ -2845,31 +2853,36 @@ void LockProcess::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) m_loginCardDevice = cdevice; if (dynamic_cast<SAKDlg*>(currentDialog)) { dynamic_cast<SAKDlg*>(currentDialog)->closeDialogForced(); - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardLogin())); } else if (dynamic_cast<SecureDlg*>(currentDialog)) { dynamic_cast<SecureDlg*>(currentDialog)->closeDialogForced(); - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardLogin())); } else if (dynamic_cast<PasswordDlg*>(currentDialog)) { signalPassDlgToAttemptCardLogin(); } } } +#endif } void LockProcess::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { +#ifdef WITH_TDEHWLIB PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); if (passDlg) { passDlg->resetCardLogin(); } else { m_loginCardDevice = NULL; - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardAbort())); } +#endif } -void LockProcess::signalPassDlgToAttemptCardLogin() { +void LockProcess::signalPassDlgToAttemptCardLogin() +{ +#ifdef WITH_TDEHWLIB PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); if (passDlg && m_loginCardDevice) { passDlg->attemptCardLogin(); @@ -2877,12 +2890,15 @@ void LockProcess::signalPassDlgToAttemptCardLogin() { else { if (currentDialog && m_loginCardDevice) { // Try again later - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardLogin())); } } +#endif } -void LockProcess::signalPassDlgToAttemptCardAbort() { +void LockProcess::signalPassDlgToAttemptCardAbort() +{ +#ifdef WITH_TDEHWLIB PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); if (passDlg) { passDlg->resetCardLogin(); @@ -2890,12 +2906,15 @@ void LockProcess::signalPassDlgToAttemptCardAbort() { else { if (currentDialog) { // Try again later - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardAbort())); } } +#endif } -void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) { +void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) +{ +#ifdef WITH_TDEHWLIB TQCString password; TQString pin_entry; @@ -2911,10 +2930,16 @@ void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographi else { cdevice->setProvidedPin(TQString::null); } +#endif } -TDECryptographicCardDevice* LockProcess::cryptographicCardDevice() { +TDECryptographicCardDevice* LockProcess::cryptographicCardDevice() +{ +#ifdef WITH_TDEHWLIB return m_loginCardDevice; +#else + return NULL; +#endif } void LockProcess::fullyOnline() { @@ -2942,7 +2967,7 @@ void LockProcess::saverReady() { // Control pipe handler // ControlPipeHandlerObject::ControlPipeHandlerObject() : TQObject() { - mParent = NULL; + mParent = nullptr; mRunning = false; mTerminate = false; mThreadID = 0L; @@ -2966,7 +2991,7 @@ void ControlPipeHandlerObject::run(void) { int display_number = atoi(TQString(XDisplayString(tqt_xdisplay())).replace(":","").ascii()); if (display_number < 0) { - printf("[kdesktop_lock] Warning: unable to create control socket. Interactive logon modules may not function properly.\n"); + printf("[kdesktop_lock] Warning: unable to create control socket. Interactive logon modules may not function properly.\n"); mRunning = false; TQApplication::eventLoop()->exit(-1); return; @@ -2997,7 +3022,7 @@ void ControlPipeHandlerObject::run(void) { } if (!mParent->mPipeOpen) { - printf("[kdesktop_lock] Warning: unable to create control socket '%s'. Interactive logon modules may not function properly.\n", fifo_file); + printf("[kdesktop_lock] Warning: unable to create control socket '%s'. Interactive logon modules may not function properly.\n", fifo_file); mRunning = false; TQApplication::eventLoop()->exit(-1); return; diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index 4dc2d8bab..1afc9bb46 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -10,14 +10,8 @@ #ifndef __LOCKENG_H__ #define __LOCKENG_H__ -#include <ksslcertificate.h> - -#include <tdehardwaredevices.h> -#include <tdecryptographiccarddevice.h> - #include <kgreeterplugin.h> - -#include <kprocess.h> +#include <tdeprocess.h> #include <kpixmap.h> #include <krootpixmap.h> @@ -35,6 +29,11 @@ class KLibrary; class KWinModule; class KSMModalDialog; class LockProcess; +#ifdef WITH_TDEHWLIB +class TDECryptographicCardDevice; +#else +#define TDECryptographicCardDevice void +#endif struct GreeterPluginHandle { KLibrary *library; @@ -53,7 +52,7 @@ typedef TQValueList<Window> TQXLibWindowList; // class ControlPipeHandlerObject : public TQObject { - Q_OBJECT + TQ_OBJECT public: ControlPipeHandlerObject(); @@ -82,7 +81,7 @@ class ControlPipeHandlerObject : public TQObject // class LockProcess : public TQWidget { - Q_OBJECT + TQ_OBJECT public: LockProcess(); @@ -107,9 +106,6 @@ class LockProcess : public TQWidget TDECryptographicCardDevice* cryptographicCardDevice(); - signals: - void terminateHelperThread(); - public slots: void quitSaver(); void preparePopup(); diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cpp index f1407070c..9f707c35d 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cpp @@ -33,14 +33,14 @@ #include <kdebug.h> #include <tdeglobalsettings.h> #include <dcopref.h> -#include <ksimpleconfig.h> -#include <kstandarddirs.h> +#include <tdesimpleconfig.h> +#include <tdestandarddirs.h> #include <tdmtsak.h> #include <stdlib.h> -#if defined(Q_WS_X11) && defined(HAVE_XRENDER) && TQT_VERSION >= 0x030300 +#if defined(TQ_WS_X11) && defined(HAVE_XRENDER) && TQT_VERSION >= 0x030300 #define COMPOSITE #endif @@ -58,49 +58,49 @@ TQXLibWindowList trinity_desktop_lock_hidden_window_list; // [FIXME] Add GUI configuration checkboxes for these three settings (see kdesktoprc [ScreenSaver] UseUnmanagedLockWindows, DelaySaverStart, and UseTDESAK) -bool trinity_desktop_lock_use_system_modal_dialogs = FALSE; -bool trinity_desktop_lock_delay_screensaver_start = FALSE; -bool trinity_desktop_lock_use_sak = FALSE; -bool trinity_desktop_lock_hide_active_windows = FALSE; -bool trinity_desktop_lock_hide_cancel_button = FALSE; -bool trinity_desktop_lock_forced = FALSE; - -LockProcess* trinity_desktop_lock_process = NULL; +bool trinity_desktop_lock_use_system_modal_dialogs = false; +bool trinity_desktop_lock_delay_screensaver_start = false; +bool trinity_desktop_lock_use_sak = false; +bool trinity_desktop_lock_hide_active_windows = false; +bool trinity_desktop_lock_hide_cancel_button = false; +bool trinity_desktop_lock_forced = false; +// This is a temporary variable used till a fix for the grab issue is prepared +bool trinity_desktop_lock_failed_grab = false; bool signalled_forcelock; bool signalled_dontlock; bool signalled_securedialog; bool signalled_blank; bool signalled_run; -bool in_internal_mode = FALSE; +bool in_internal_mode = false; -bool argb_visual = FALSE; +bool argb_visual = false; pid_t kdesktop_pid = -1; -bool trinity_desktop_lock_settings_initialized = FALSE; +bool trinity_desktop_lock_settings_initialized = false; static void sigusr1_handler(int) { - signalled_forcelock = TRUE; + signalled_forcelock = true; } static void sigusr2_handler(int) { - signalled_dontlock = TRUE; + signalled_dontlock = true; } -static void sigusr3_handler(int) +static void sigwinch_handler(int) { - signalled_securedialog = TRUE; + signalled_securedialog = true; } -static void sigusr4_handler(int) +static void sigttin_handler(int) { - signalled_blank = TRUE; + signalled_blank = true; } -static void sigusr5_handler(int) +static void sigttou_handler(int) { - signalled_run = TRUE; + signalled_run = true; } static int trapXErrors(Display *, XErrorEvent *) @@ -236,9 +236,9 @@ int main( int argc, char **argv ) XSetErrorHandler(trapXErrors); - MyApp* app = NULL; + MyApp *app = nullptr; - while (1 == 1) { + while (true) { sigset_t new_mask; sigset_t orig_mask; @@ -246,11 +246,11 @@ int main( int argc, char **argv ) sigfillset(&new_mask); sigprocmask(SIG_BLOCK, &new_mask, NULL); - signalled_forcelock = FALSE; - signalled_dontlock = FALSE; - signalled_securedialog = FALSE; - signalled_blank = FALSE; - signalled_run = FALSE; + signalled_forcelock = false; + signalled_dontlock = false; + signalled_securedialog = false; + signalled_blank = false; + signalled_run = false; int kdesktop_screen_number = 0; int starting_screen = 0; @@ -261,7 +261,7 @@ int main( int argc, char **argv ) if (TDEGlobalSettings::isMultiHead()) { Display *dpy = XOpenDisplay(NULL); - if (! dpy) { + if (!dpy) { fprintf(stderr, "%s: FATAL ERROR: couldn't open display '%s'\n", argv[0], XDisplayName(NULL)); @@ -303,14 +303,11 @@ int main( int argc, char **argv ) } } - env.sprintf("DISPLAY=%s.%d", display_name.data(), - kdesktop_screen_number); + env.sprintf("DISPLAY=%s.%d", display_name.data(), kdesktop_screen_number); kdDebug() << "env " << env << endl; if (putenv(strdup(env.data()))) { - fprintf(stderr, - "%s: WARNING: unable to set DISPLAY environment variable\n", - argv[0]); + fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]); perror("putenv()"); } } @@ -374,17 +371,17 @@ int main( int argc, char **argv ) TDEGlobal::locale()->insertCatalogue("libdmctl"); struct stat st; - KSimpleConfig* tdmconfig; + TDESimpleConfig* tdmconfig; if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) { - tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); + tdmconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); } else { - tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); + tdmconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); } tdmconfig->setGroup("X-:*-Greeter"); // Create new LockProcess, which also spawns threads inheriting the blocked signal mask - trinity_desktop_lock_process = new LockProcess; + LockProcess lock_process; // Unblock reception of all signals in this thread sigprocmask(SIG_UNBLOCK, &new_mask, NULL); @@ -396,7 +393,7 @@ int main( int argc, char **argv ) kdesktop_pid = atoi(args->getOption( "internal" )); struct sigaction act; - in_internal_mode = TRUE; + in_internal_mode = true; // handle SIGUSR1 act.sa_handler= sigusr1_handler; @@ -410,20 +407,20 @@ int main( int argc, char **argv ) sigaddset(&(act.sa_mask), SIGUSR2); act.sa_flags = 0; sigaction(SIGUSR2, &act, 0L); - // handle SIGWINCH (an ersatz SIGUSR3) - act.sa_handler= sigusr3_handler; + // handle SIGWINCH (as custom user signal rather than its inherent meaning) + act.sa_handler= sigwinch_handler; sigemptyset(&(act.sa_mask)); sigaddset(&(act.sa_mask), SIGWINCH); act.sa_flags = 0; sigaction(SIGWINCH, &act, 0L); - // handle SIGTTIN (an ersatz SIGUSR4) - act.sa_handler= sigusr4_handler; + // handle SIGTTIN (as custom user signal rather than its inherent meaning) + act.sa_handler= sigttin_handler; sigemptyset(&(act.sa_mask)); sigaddset(&(act.sa_mask), SIGTTIN); act.sa_flags = 0; sigaction(SIGTTIN, &act, 0L); - // handle SIGTTOU (an ersatz SIGUSR5) - act.sa_handler= sigusr5_handler; + // handle SIGTTOU (as custom user signal rather than its inherent meaning) + act.sa_handler= sigttou_handler; sigemptyset(&(act.sa_mask)); sigaddset(&(act.sa_mask), SIGTTOU); act.sa_flags = 0; @@ -437,7 +434,7 @@ int main( int argc, char **argv ) sigaddset(&new_mask,SIGTTIN); sigaddset(&new_mask,SIGTTOU); - while (signalled_run == FALSE) { + while (!signalled_run) { // let kdesktop know the saver process is ready if (kill(kdesktop_pid, SIGTTIN) < 0) { // The controlling kdesktop process probably died. Commit suicide... @@ -454,7 +451,7 @@ int main( int argc, char **argv ) // wait for SIGUSR1, SIGUSR2, SIGWINCH, SIGTTIN, or SIGTTOU sigprocmask(SIG_BLOCK, &new_mask, &orig_mask); - if (signalled_run != TRUE) { + if (!signalled_run) { sigsuspend(&orig_mask); } sigprocmask(SIG_UNBLOCK, &new_mask, NULL); @@ -494,42 +491,54 @@ int main( int argc, char **argv ) delete tdmconfig; - if (args->isSet( "forcelock" ) || (signalled_forcelock == TRUE)) { - trinity_desktop_lock_forced = TRUE; + if (args->isSet( "forcelock" ) || signalled_forcelock) { + trinity_desktop_lock_forced = true; } - trinity_desktop_lock_process->init(child, (args->isSet( "blank" ) || (signalled_blank == TRUE))); + lock_process.init(child, (args->isSet( "blank" ) || signalled_blank)); if (!child) { - trinity_desktop_lock_process->setChildren(child_sockets); + lock_process.setChildren(child_sockets); } else { - trinity_desktop_lock_process->setParent(parent_connection); + lock_process.setParent(parent_connection); } + trinity_desktop_lock_failed_grab = false; bool rt; - if( (((!child) && (args->isSet( "forcelock" ))) || (signalled_forcelock == TRUE))) { - rt = trinity_desktop_lock_process->lock(); + if( (!child && args->isSet( "forcelock" )) || signalled_forcelock) { + rt = lock_process.lock(); } - else if( child || (args->isSet( "dontlock" ) || (signalled_dontlock == TRUE))) { - rt = trinity_desktop_lock_process->dontLock(); + else if( child || (args->isSet( "dontlock" ) || signalled_dontlock)) { + rt = lock_process.dontLock(); } - else if( child || (args->isSet( "securedialog" ) || (signalled_securedialog == TRUE))) { + else if( child || (args->isSet( "securedialog" ) || signalled_securedialog)) { int retcode = tde_sak_verify_calling_process(); if (retcode == 0) { - rt = trinity_desktop_lock_process->runSecureDialog(); + rt = lock_process.runSecureDialog(); } else { return 1; } } else { - rt = trinity_desktop_lock_process->defaultSave(); + rt = lock_process.defaultSave(); } + + // Make sure to handle all pending responses from the X server. + // If we don't do this, in case of failed activation of the saver/lock screen, + // we will end up in a dirty state and the screen lock will no longer hide the windows + // on the screen due to 'm_rootPixmap' failing to load the background image. + // This is caused by a 'XConvertSelection' request in 'TDESharedPixmap::loadFromShared' + // not being handled and causing the corresponding property to become unusuable in X for + // subsequent lock requests. + XSync(tqt_xdisplay(), False); + app->processEvents(); + if (!rt) { - return 0; + return (trinity_desktop_lock_failed_grab ? 0 : 12); } - if (in_internal_mode == FALSE) { + if (!in_internal_mode) { trinity_desktop_lock_hidden_window_list.clear(); int ret = app->exec(); restore_hidden_override_redirect_windows(); @@ -548,9 +557,6 @@ int main( int argc, char **argv ) return 12; } - delete trinity_desktop_lock_process; - trinity_desktop_lock_process = NULL; - // FIXME // We should not have to return (restart) at all, // but it seems that some X11 connections are left active, diff --git a/kdesktop/lock/main.h b/kdesktop/lock/main.h index fd19c6183..162542555 100644 --- a/kdesktop/lock/main.h +++ b/kdesktop/lock/main.h @@ -25,10 +25,10 @@ #include <time.h> class MyApp : public TDEApplication { - Q_OBJECT + TQ_OBJECT public: MyApp() : TDEApplication(), lastTick( 0 ) {} - MyApp(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0, bool allowStyles=true) : TDEApplication(display, visual, colormap, allowStyles), lastTick( 0 ) {} + MyApp(Display *display, TQt::HANDLE visual = 0, TQt::HANDLE colormap = 0, bool allowStyles=true) : TDEApplication(display, visual, colormap, allowStyles), lastTick( 0 ) {} protected: bool x11EventFilter( XEvent * ); diff --git a/kdesktop/lock/querydlg.cc b/kdesktop/lock/querydlg.cpp index 1fc5d260c..5b1fea0f3 100644 --- a/kdesktop/lock/querydlg.cc +++ b/kdesktop/lock/querydlg.cpp @@ -14,7 +14,7 @@ #include <tdelocale.h> #include <kpushbutton.h> #include <kseparator.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeglobalsettings.h> #include <tdeconfig.h> #include <kiconloader.h> @@ -111,13 +111,13 @@ QueryDlg::QueryDlg(LockProcess *parent) layButtons->addWidget( ok ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); - frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); + frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, TQt::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())); + connect(ok, TQ_SIGNAL(clicked()), TQ_SLOT(slotOK())); installEventFilter(this); setFixedSize( sizeHint() ); @@ -140,7 +140,7 @@ TQString QueryDlg::getEntry() void QueryDlg::updateLabel(TQString &txt) { - mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setPaletteForegroundColor(TQt::black); mStatusLabel->setText("<b>" + txt + "</b>"); } diff --git a/kdesktop/lock/querydlg.h b/kdesktop/lock/querydlg.h index d5c4f7f33..0b3e55aa8 100644 --- a/kdesktop/lock/querydlg.h +++ b/kdesktop/lock/querydlg.h @@ -28,7 +28,7 @@ class TQListView; // class QueryDlg : public TQDialog { - Q_OBJECT + TQ_OBJECT public: QueryDlg(LockProcess *parent); diff --git a/kdesktop/lock/sakdlg.cc b/kdesktop/lock/sakdlg.cpp index 803c77919..5b23a9c5a 100644 --- a/kdesktop/lock/sakdlg.cc +++ b/kdesktop/lock/sakdlg.cpp @@ -14,7 +14,7 @@ #include <tdelocale.h> #include <kpushbutton.h> #include <kseparator.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeglobalsettings.h> #include <tdeconfig.h> #include <kiconloader.h> @@ -108,7 +108,7 @@ SAKDlg::SAKDlg(LockProcess *parent) mSAKProcess = new TDEProcess; *mSAKProcess << "tdmtsak"; - connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited())); + connect(mSAKProcess, TQ_SIGNAL(processExited(TDEProcess*)), this, TQ_SLOT(slotSAKProcessExited())); mSAKProcess->start(); } @@ -142,7 +142,7 @@ void SAKDlg::reject() void SAKDlg::updateLabel(TQString &txt) { - mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setPaletteForegroundColor(TQt::black); mStatusLabel->setText("<b>" + txt + "</b>"); } diff --git a/kdesktop/lock/sakdlg.h b/kdesktop/lock/sakdlg.h index faded4b6e..12d80b8cb 100644 --- a/kdesktop/lock/sakdlg.h +++ b/kdesktop/lock/sakdlg.h @@ -26,7 +26,7 @@ class TQListView; // class SAKDlg : public TQDialog { - Q_OBJECT + TQ_OBJECT public: SAKDlg(LockProcess *parent); diff --git a/kdesktop/lock/securedlg.cc b/kdesktop/lock/securedlg.cpp index fca79a707..ba2b08af0 100644 --- a/kdesktop/lock/securedlg.cc +++ b/kdesktop/lock/securedlg.cpp @@ -14,7 +14,7 @@ #include <tdelocale.h> #include <kpushbutton.h> #include <kseparator.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeglobalsettings.h> #include <tdeconfig.h> #include <kiconloader.h> @@ -137,11 +137,11 @@ SecureDlg::SecureDlg(LockProcess *parent) 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())); + connect(mCancelButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotBtnCancel())); + connect(mLockButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotBtnLock())); + connect(mTaskButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotBtnTask())); + connect(mShutdownButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotBtnShutdown())); + connect(mSwitchButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotBtnSwitchUser())); TQSize dlgSz = sizeHint(); int btnSize = dlgSz.width(); diff --git a/kdesktop/lock/securedlg.h b/kdesktop/lock/securedlg.h index 9ad0ac1da..c6c9fa7fe 100644 --- a/kdesktop/lock/securedlg.h +++ b/kdesktop/lock/securedlg.h @@ -27,7 +27,7 @@ class TQListView; // class SecureDlg : public TQDialog { - Q_OBJECT + TQ_OBJECT public: SecureDlg(LockProcess *parent); |