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

List:       kde-commits
Subject:    kdenonbeta/kopete/plugins/autoaway
From:       Andy Goossens <andygoossens () pandora ! be>
Date:       2003-01-04 15:34:25
[Download RAW message or body]

CVS commit by goossens: 

fixing AutoAway
don't rely on the old and strange Away behaviour that we had before
but let AutoAway remember it's own status and compare it to the Global Away status


  M +16 -3     autoawayplugin.cpp   1.14
  M +1 -0      autoawayplugin.h   1.7


--- kdenonbeta/kopete/plugins/autoaway/autoawayplugin.cpp  #1.13:1.14
@@ -34,4 +34,7 @@ AutoAwayPlugin::AutoAwayPlugin( QObject 
         mPrefs = new AutoAwayPreferences ( "date", this );
         mWatcher = new XAutoLock();
+
+        mActive = false;
+
         connect( mWatcher, SIGNAL(timeout()), this, SLOT(slotTimeout()) );
         connect( mWatcher, SIGNAL(activity()), this, SLOT(slotActivity()) );
@@ -60,7 +64,15 @@ bool AutoAwayPlugin::unload()
 void AutoAwayPlugin::slotTimeout()
 {
-        if ( !KopeteAway::globalAway() )
+        if ( mActive && !KopeteAway::globalAway() )
+        {
+                // user is available and we didn't noticed it
+                // change our status to not active
+                mActive = false;
+        }
+
+        if ( !mActive && !KopeteAway::globalAway() )
         {
                 kdDebug() << "[AutoAway Plugin] : Timeout and no user activity, going away" << endl;
+                mActive = true;
                 KopeteIdentityManager::manager()->setAwayAll();
         }
@@ -69,7 +81,8 @@ void AutoAwayPlugin::slotTimeout()
 void AutoAwayPlugin::slotActivity()
 {
-        if ( mPrefs->goAvailable() && !KopeteAway::globalAway() )
+        if ( mPrefs->goAvailable() && mActive )
         {
                 kdDebug() << "[AutoAway Plugin] : User activity!, going available" << endl;
+                mActive = false;
                 KopeteIdentityManager::manager()->setAvailableAll();
         }
@@ -78,5 +91,5 @@ void AutoAwayPlugin::slotActivity()
 void AutoAwayPlugin::slotSettingsChanged()
 {
-        mWatcher->setTimeout( mPrefs->awayTimeout() * 60);
+        mWatcher->setTimeout( mPrefs->awayTimeout() * 60 );
 }
 

--- kdenonbeta/kopete/plugins/autoaway/autoawayplugin.h  #1.6:1.7
@@ -44,4 +44,5 @@ private:
         XAutoLock *mWatcher;
         AutoAwayPreferences *mPrefs;
+        bool mActive;
 };
 


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

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