[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace
From:       Chani Armitage <chanika () gmail ! com>
Date:       2008-09-30 8:15:28
Message-ID: 1222762528.601580.11899.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 866154 by chani:

rename some dbus functions and clear up a bit of my own confusion about the locking logic


 M  +11 -9     krunner/lock/lockprocess.cc  
 M  +5 -8      krunner/lock/lockprocess.h  
 M  +3 -2      plasma/shells/screensaver/containment/desktop.cpp  


--- trunk/KDE/kdebase/workspace/krunner/lock/lockprocess.cc #866153:866154
@@ -1020,8 +1020,6 @@
         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 @@
     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::endFreeUnlock()
-{
-    startLock(); //TODO rename or delete this func
-}
-
 void LockProcess::suspend()
 {
     if( !mSuspended && mHackProc.state() == QProcess::Running )
@@ -1130,6 +1122,15 @@
         //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 @@
         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?
--- trunk/KDE/kdebase/workspace/krunner/lock/lockprocess.h #866153:866154
@@ -82,20 +82,18 @@
      * 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 @@
 private Q_SLOTS:
     void hackExited();
     void signalPipeSignal();
-    bool startLock();
     void suspend();
     void checkDPMSActive();
     void slotDeadTimePassed();
--- trunk/KDE/kdebase/workspace/plasma/shells/screensaver/containment/desktop.cpp #866153:866154
@@ -177,7 +177,8 @@
             "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<QVariant> args;
@@ -209,7 +210,7 @@
 {
     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)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic