Git commit df77c3127b9aa22c5cf547403ea6af173eb4f9d2 by Martin Gräßlin. Committed on 09/10/2011 at 19:27. Pushed by graesslin into branch 'farhad_hf/lockscreen'. Revert changes to old screen locker The new screen locker does not share any UI code with the existing unlock dialog, so we no longer need the adjustments. This reverts the following commits for the lock directory: cd4d9bd3954a01ac83b5e4ba54818d20705c9d05 5fbe6d0c9f7fc6f0bb01d1f887ca2ca5c40bd062 b4a8c1fc8a51df5994b6a2319a4197b640e2f62c M +45 -70 kwin/screenlocker/lock/lockdlg.cc M +3 -35 kwin/screenlocker/lock/lockdlg.h M +1 -1 kwin/screenlocker/lock/lockprocess.cc M +1 -2 kwin/screenlocker/lock/lockprocess.h http://commits.kde.org/kde-workspace/df77c312... diff --git a/kwin/screenlocker/lock/lockdlg.cc b/kwin/screenlocker/lock/lockdlg.cc index 678f5ae..14a9b34 100644 --- a/kwin/screenlocker/lock/lockdlg.cc +++ b/kwin/screenlocker/lock/lockdlg.cc @@ -77,44 +77,18 @@ #define PASSDLG_HIDE_TIMEOUT 10000-// GreeterWidget -GreeterWidget::GreeterWidget(QWidget *parent, Qt::WindowFlags f) -: QWidget(parent, f) -{ -} - -GreeterWidget::~GreeterWidget() -{ -} - //=========================================================================== // // Simple dialog for entering a password. // -PasswordDlg::PasswordDlg(GreeterWidget *parent, GreeterPluginHandle *plugin, const QString &text) - : KDialog(parent, Qt::X11BypassWindowManagerHint) -{ - UnlockWidget *widget = new UnlockWidget(this, parent, plugin, text); - setMainWidget(widget); - connect(widget, SIGNAL(done(int)), SLOT(done(int))); - connect(widget, SIGNAL(reject()), SLOT(reject())); - connect(widget, SIGNAL(accept()), SLOT(accept())); - setButtons(KDialog::None); -} - -PasswordDlg::~PasswordDlg() -{ -} - -UnlockWidget::UnlockWidget(QWidget *parent, GreeterWidget *greeterWidget, GreeterPluginHandle *plugin, const QString &text) - : QFrame(parent), +PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, const QString &text) + : KDialog(parent, Qt::X11BypassWindowManagerHint), mPlugin( plugin ), mCapsLocked(-1), mUnlockingFailed(false), - sNot(0), - mGreeterWidget(greeterWidget) + sNot(0) { - QWidget* w = this; + QWidget* w = mainWidget(); QLabel *pixLabel = new QLabel( w ); pixLabel->setPixmap(DesktopIcon(QLatin1String( "system-lock-screen" ))); @@ -178,7 +152,8 @@ UnlockWidget::UnlockWidget(QWidget *parent, GreeterWidget *greeterWidget, Greete frameLayout->addWidget( sep, 3, 0, 1, 2 ); frameLayout->addLayout( layButtons, 4, 0, 1, 2 );- connect(cancel, SIGNAL(clicked()), SIGNAL(reject())); + setButtons(None); + connect(cancel, SIGNAL(clicked()), SLOT(reject())); connect(ok, SIGNAL(clicked()), SLOT(slotOK())); connect(mNewSessButton, SIGNAL(clicked()), SLOT(slotSwitchUser()));@@ -196,13 +171,13 @@ UnlockWidget::UnlockWidget(QWidget *parent, GreeterWidget *greeterWidget, Greete capsLocked(); }-UnlockWidget::~UnlockWidget() +PasswordDlg::~PasswordDlg() { hide(); delete greet; }-void UnlockWidget::updateLabel() +void PasswordDlg::updateLabel() { if (mUnlockingFailed) { @@ -229,11 +204,11 @@ void UnlockWidget::updateLabel() // // Handle timer events. // -void UnlockWidget::timerEvent(QTimerEvent *ev) +void PasswordDlg::timerEvent(QTimerEvent *ev) { if (ev->timerId() == mTimeoutTimerId) { - emit done(TIMEOUT_CODE); + done(TIMEOUT_CODE); } else if (ev->timerId() == mFailedTimerId) { @@ -250,14 +225,14 @@ void UnlockWidget::timerEvent(QTimerEvent *ev) } }-bool UnlockWidget::eventFilter(QObject *, QEvent *ev) +bool PasswordDlg::eventFilter(QObject *, QEvent *ev) { if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::KeyRelease) capsLocked(); return false; }-void UnlockWidget::slotActivity() +void PasswordDlg::slotActivity() { if (mTimeoutTimerId) { killTimer(mTimeoutTimerId); @@ -267,7 +242,7 @@ void UnlockWidget::slotActivity() ////// kckeckpass interface code-int UnlockWidget::Reader (void *buf, int count) +int PasswordDlg::Reader (void *buf, int count) { int ret, rlen;@@ -288,38 +263,38 @@ int UnlockWidget::Reader (void *buf, int count) return rlen; }-bool UnlockWidget::GRead (void *buf, int count) +bool PasswordDlg::GRead (void *buf, int count) { return Reader (buf, count) == count; }-bool UnlockWidget::GWrite (const void *buf, int count) +bool PasswordDlg::GWrite (const void *buf, int count) { return ::write (sFd, buf, count) == count; }-bool UnlockWidget::GSendInt (int val) +bool PasswordDlg::GSendInt (int val) { return GWrite (&val, sizeof(val)); }-bool UnlockWidget::GSendStr (const char *buf) +bool PasswordDlg::GSendStr (const char *buf) { int len = buf ? ::strlen (buf) + 1 : 0; return GWrite (&len, sizeof(len)) && GWrite (buf, len); }-bool UnlockWidget::GSendArr (int len, const char *buf) +bool PasswordDlg::GSendArr (int len, const char *buf) { return GWrite (&len, sizeof(len)) && GWrite (buf, len); }-bool UnlockWidget::GRecvInt (int *val) +bool PasswordDlg::GRecvInt (int *val) { return GRead (val, sizeof(*val)); }-bool UnlockWidget::GRecvArr (char **ret) +bool PasswordDlg::GRecvArr (char **ret) { int len; char *buf; @@ -342,7 +317,7 @@ bool UnlockWidget::GRecvArr (char **ret) } }-void UnlockWidget::reapVerify() +void PasswordDlg::reapVerify() { sNot->setEnabled( false ); sNot->deleteLater(); @@ -358,7 +333,7 @@ void UnlockWidget::reapVerify() switch (WEXITSTATUS(status)) { case AuthOk: greet->succeeded(); - emit accept(); + accept(); return; case AuthBad: greet->failed(); @@ -376,7 +351,7 @@ void UnlockWidget::reapVerify() cantCheck(); }-void UnlockWidget::handleVerify() +void PasswordDlg::handleVerify() { int ret; char *arr; @@ -408,14 +383,14 @@ void UnlockWidget::handleVerify() if (!GRecvArr( &arr )) break; if (!greet->textMessage( arr, false )) - mGreeterWidget->msgBox( this, QMessageBox::Information, QString::fromLocal8Bit( arr ) ); + static_cast< LockProcess* >(parent())->msgBox( this, QMessageBox::Information, QString::fromLocal8Bit( arr ) ); ::free( arr ); return; case ConvPutError: if (!GRecvArr( &arr )) break; if (!greet->textMessage( arr, true )) - mGreeterWidget->msgBox( this, QMessageBox::Warning, QString::fromLocal8Bit( arr ) ); + static_cast< LockProcess* >(parent())->msgBox( this, QMessageBox::Warning, QString::fromLocal8Bit( arr ) ); ::free( arr ); return; } @@ -425,14 +400,14 @@ void UnlockWidget::handleVerify() ////// greeter plugin callbacks-void UnlockWidget::gplugReturnText( const char *text, int tag ) +void PasswordDlg::gplugReturnText( const char *text, int tag ) { GSendStr( text ); if (text) GSendInt( tag ); }-void UnlockWidget::gplugReturnBinary( const char *data ) +void PasswordDlg::gplugReturnBinary( const char *data ) { if (data) { unsigned const char *up = (unsigned const char *)data; @@ -445,15 +420,15 @@ void UnlockWidget::gplugReturnBinary( const char *data ) GSendArr( 0, 0 ); }-void UnlockWidget::gplugSetUser( const QString & ) +void PasswordDlg::gplugSetUser( const QString & ) { // ignore ... }-void UnlockWidget::cantCheck() +void PasswordDlg::cantCheck() { greet->failed(); - mGreeterWidget->msgBox( this, QMessageBox::Critical, + static_cast< LockProcess* >(parent())->msgBox( this, QMessageBox::Critical, i18n("Cannot unlock the session because the authentication system failed to work;\n" "you must kill kscreenlocker (pid %1) manually.", getpid()) ); greet->revive(); @@ -463,7 +438,7 @@ void UnlockWidget::cantCheck() // // Starts the kcheckpass process to check the user's password. // -void UnlockWidget::gplugStart() +void PasswordDlg::gplugStart() { int sfd[2]; char fdbuf[16]; @@ -496,40 +471,40 @@ void UnlockWidget::gplugStart() connect(sNot, SIGNAL(activated(int)), SLOT(handleVerify())); }-void UnlockWidget::gplugChanged() +void PasswordDlg::gplugChanged() { }-void UnlockWidget::gplugActivity() +void PasswordDlg::gplugActivity() { slotActivity(); }-void UnlockWidget::gplugMsgBox( QMessageBox::Icon type, const QString &text ) +void PasswordDlg::gplugMsgBox( QMessageBox::Icon type, const QString &text ) { - mGreeterWidget->msgBox( this, type, text ); + static_cast< LockProcess* >(parent())->msgBox( this, type, text ); }-bool UnlockWidget::gplugHasNode( const QString & ) +bool PasswordDlg::gplugHasNode( const QString & ) { return false; }-void UnlockWidget::slotOK() +void PasswordDlg::slotOK() { greet->next(); } -void UnlockWidget::setVisible( bool visible ) +void PasswordDlg::setVisible( bool visible ) { - QFrame::setVisible( visible ); + QDialog::setVisible( visible ); if ( visible ) QApplication::flush(); }-void UnlockWidget::slotStartNewSession() +void PasswordDlg::slotStartNewSession() { if (!KMessageBox::shouldBeShownContinue( QLatin1String( ":confirmNewSession" ) )) { KDisplayManager().startReserve(); @@ -566,7 +541,7 @@ void UnlockWidget::slotStartNewSession() i18n("&Do not ask again"), &dontAskAgain, KMessageBox::NoExec );- int ret = mGreeterWidget->execDialog( dialog ); + int ret = static_cast< LockProcess* >( parent())->execDialog( dialog ); delete dialog;@@ -593,7 +568,7 @@ public: int vt; };-void UnlockWidget::slotSwitchUser() +void PasswordDlg::slotSwitchUser() { int p = 0; KDisplayManager dm; @@ -669,17 +644,17 @@ void UnlockWidget::slotSwitchUser() connect( btn, SIGNAL(clicked()), &dialog, SLOT(reject()) ); vbox2->addWidget( btn );- mGreeterWidget->execDialog( &dialog ); + static_cast< LockProcess* >(parent())->execDialog( &dialog ); }-void UnlockWidget::slotSessionActivated() +void PasswordDlg::slotSessionActivated() { LockListViewItem *itm = (LockListViewItem *)lv->currentItem(); if (itm && itm->vt > 0) KDisplayManager().switchVT( itm->vt ); }-void UnlockWidget::capsLocked() +void PasswordDlg::capsLocked() { unsigned int lmask; Window dummy1, dummy2; diff --git a/kwin/screenlocker/lock/lockdlg.h b/kwin/screenlocker/lock/lockdlg.h index e5823e6..f25e55f 100644 --- a/kwin/screenlocker/lock/lockdlg.h +++ b/kwin/screenlocker/lock/lockdlg.h @@ -27,45 +27,19 @@ class QLabel; class KPushButton; class QSocketNotifier; class QTreeWidget; -class UnlockWidget; - -/** - * @short Interface of the Widget where the Dialog is embedded into. - * @author Martin Gräßlin - **/ -class GreeterWidget : public QWidget -{ - Q_OBJECT -public: - GreeterWidget(QWidget *parent = 0, Qt::WindowFlags f = 0); - virtual ~GreeterWidget(); - virtual void msgBox(QWidget *parent, QMessageBox::Icon type, const QString &txt) = 0; - virtual int execDialog(QDialog *dlg) = 0; -}; - -class PasswordDlg : public KDialog -{ - Q_OBJECT -public: - PasswordDlg(GreeterWidget* parent, GreeterPluginHandle* plugin, const QString& text = QString()); - ~PasswordDlg(); - -private: - UnlockWidget *m_unlock; -}; //=========================================================================== // // Simple dialog for entering a password. // It does not handle password validation. // -class UnlockWidget : public QFrame, public KGreeterPluginHandler +class PasswordDlg : public KDialog, public KGreeterPluginHandler { Q_OBJECT public: - UnlockWidget(QWidget* parent, GreeterWidget* greeterWidget, GreeterPluginHandle* plugin, const QString& text = QString()); - ~UnlockWidget(); + PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, const QString &text = QString()); + ~PasswordDlg(); virtual void setVisible(bool visible); // from KGreetPluginHandler @@ -82,11 +56,6 @@ protected: virtual void timerEvent(QTimerEvent *); virtual bool eventFilter(QObject *, QEvent *);-Q_SIGNALS: - void reject(); - void done(int); - void accept(); - private Q_SLOTS: void slotSwitchUser(); void slotSessionActivated(); @@ -121,7 +90,6 @@ private: int sPid, sFd; QSocketNotifier *sNot; QTreeWidget *lv; - GreeterWidget *mGreeterWidget; }; #endif diff --git a/kwin/screenlocker/lock/lockprocess.cc b/kwin/screenlocker/lock/lockprocess.cc index 3df5890..b10f1a6 100644 --- a/kwin/screenlocker/lock/lockprocess.cc +++ b/kwin/screenlocker/lock/lockprocess.cc @@ -136,7 +136,7 @@ static QLatin1String s_overlayServiceName("org.kde.plasma-overlay"); // starting screensaver hacks, and password entry.f // LockProcess::LockProcess(bool child, bool useBlankOnly) - : GreeterWidget(0L, Qt::X11BypassWindowManagerHint), + : QWidget(0L, Qt::X11BypassWindowManagerHint), mInitialLock(false), mLocked(false), mBusy(false), diff --git a/kwin/screenlocker/lock/lockprocess.h b/kwin/screenlocker/lock/lockprocess.h index 2cb4222..8b6d9a8 100644 --- a/kwin/screenlocker/lock/lockprocess.h +++ b/kwin/screenlocker/lock/lockprocess.h @@ -24,7 +24,6 @@ #include <fixx11h.h> #include "plasmaapp_interface.h" -#include "lockdlg.h" class KLibrary;@@ -45,7 +44,7 @@ class QDBusServiceWatcher; // starting screensaver hacks, and password entry. // class LockProcess - : public GreeterWidget + : public QWidget { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.screenlocker.LockProcess")