From dd02604334a5180b9619d7cf425de43dff7488a2 Mon Sep 17 00:00:00 2001 From: chani Date: Tue, 30 Sep 2008 08:15:28 +0000 Subject: [PATCH] rename some dbus functions and clear up a bit of my own confusion about the locking logic git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase@866154 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- workspace/krunner/lock/lockprocess.cc | 20 +++++++++++--------- workspace/krunner/lock/lockprocess.h | 13 +++++-------- .../shells/screensaver/containment/desktop.cpp | 5 +++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/workspace/krunner/lock/lockprocess.cc b/workspace/krunner/lock/lockprocess.cc index 397585a9d8..9565e20505 100644 --- a/workspace/krunner/lock/lockprocess.cc +++ b/workspace/krunner/lock/lockprocess.cc @@ -1020,8 +1020,6 @@ void LockProcess::deactivatePlasma() mPlasmaDBus->call(QDBus::NoBlock, "deactivate"); } if (!mLocked && mLockGrace >=0) { - //I can't remember why we do nothing on mLockGrace=0 - //wouldn't we want to lock immediately? FIXME QTimer::singleShot(mLockGrace, this, SLOT(startLock())); } } @@ -1040,8 +1038,7 @@ void LockProcess::unSuppressUnlock() mSuppressUnlock.stop(); } -//TODO can we rename this to tryQuit() or attemptExit() or something? -void LockProcess::unlock() +void LockProcess::quit() { mSuppressUnlock.stop(); if (!mLocked || checkPass()) { @@ -1049,11 +1046,6 @@ void LockProcess::unlock() } } -void LockProcess::endFreeUnlock() -{ - startLock(); //TODO rename or delete this func -} - void LockProcess::suspend() { if( !mSuspended && mHackProc.state() == QProcess::Running ) @@ -1130,6 +1122,15 @@ bool LockProcess::checkPass(const QString &reason) //so that the user doesn't have to type their password twice mLocked = false; KDisplayManager().setLock(false); + //FIXME while suppressUnlock *should* always be running, if it isn't + //(say if someone's doing things they shouldn't with dbus) then it won't get started by this + //which means that a successful unlock will never re-lock + //in fact, the next bit of activity would lead to the screensaver quitting. + //possible solutions: + //-treat this function like activity: quit if already unlocked, ensure suppress is started + //if we're locked and the dialog's rejected + //-return true if already unlocked, without doing anything, same as above if locked + //-let it quit, and tell people not to do such silly things :P return true; } return false; @@ -1256,6 +1257,7 @@ bool LockProcess::x11Event(XEvent *event) case KeyPress: case MotionNotify: if (mBusy || !mDialogs.isEmpty()) + //FIXME shouldn't we be resetting some timers? break; mBusy = true; //something happened. do we quit, ask for a password or forward it to plasma? diff --git a/workspace/krunner/lock/lockprocess.h b/workspace/krunner/lock/lockprocess.h index 75843b7645..fd29b6572b 100644 --- a/workspace/krunner/lock/lockprocess.h +++ b/workspace/krunner/lock/lockprocess.h @@ -82,20 +82,18 @@ public Q_SLOTS: * bring up the password dialog with @param reason displayed instead of the usual "this session * is locked" message. * @return true if the password was entered correctly - * if this returns true, there is a grace period where the screensaver can be freely unlocked - * with the unlock method without re-entering the password. + * if this returns true, it will also unlock the screensaver without quitting. + * it will re-lock after the lock timeout in the settings */ Q_SCRIPTABLE bool checkPass(const QString &reason); /** * this will unlock and quit the screensaver, asking for a password first if necessary */ - Q_SCRIPTABLE void unlock(); + Q_SCRIPTABLE void quit(); /** - * immediately end the "free unlock" grace period; if the screen is locked, it will now require - * a password to unlock. - * this has no effect if the screen wasn't locked in the first place. + * immediately lock the screen; it will now require a password to unlock. */ - Q_SCRIPTABLE void endFreeUnlock(); + Q_SCRIPTABLE bool startLock(); protected: virtual bool x11Event(XEvent *); @@ -105,7 +103,6 @@ protected: private Q_SLOTS: void hackExited(); void signalPipeSignal(); - bool startLock(); void suspend(); void checkDPMSActive(); void slotDeadTimePassed(); diff --git a/workspace/plasma/shells/screensaver/containment/desktop.cpp b/workspace/plasma/shells/screensaver/containment/desktop.cpp index 6f2efd103b..a541699fdf 100644 --- a/workspace/plasma/shells/screensaver/containment/desktop.cpp +++ b/workspace/plasma/shells/screensaver/containment/desktop.cpp @@ -177,7 +177,8 @@ void SaverDesktop::toggleLock() "local.LockProcess", QDBusConnection::sessionBus(), this); //FIXME local?? if (corona()->immutability() == Mutable) { corona()->setImmutability(UserImmutable); - lockprocess.call(QDBus::NoBlock, "endFreeUnlock"); + lockprocess.call(QDBus::NoBlock, "startLock"); + kDebug() << "blaaaaaaaaaaaaaaaaa!!!!"; emit locked(); } else if (corona()->immutability() == UserImmutable) { QList args; @@ -209,7 +210,7 @@ void SaverDesktop::unlockDesktop() { QDBusInterface lockprocess("org.kde.krunner_lock", "/LockProcess", "local.LockProcess", QDBusConnection::sessionBus(), this); //FIXME local?? - lockprocess.call(QDBus::NoBlock, "unlock"); + lockprocess.call(QDBus::NoBlock, "quit"); } void SaverDesktop::createConfigurationInterface(KConfigDialog *parent) -- 2.11.4.GIT