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

List:       kde-commits
Subject:    KDE_3_3_BRANCH: kdepim/kmail
From:       Till Adam <adam () kde ! org>
Date:       2004-10-03 20:23:46
Message-ID: 20041003202346.727A799BC () office ! kde ! org
[Download RAW message or body]

CVS commit by tilladam: 

Backport of:

CVS commit by tilladam: 

When making a connection to an imap server fails, set an error condition
and clear it after a timeout, so all waiting folders are stopped, and a 
new mailcheck can try again.

This is based on a patch by Waldo with most bits moved to online imap only
since they don't make sense for dimap and some debug changes of very little
consequence. Thanks, dude.


  M +5 -1      imapaccountbase.cpp   1.101.2.1
  M +1 -0      imapaccountbase.h   1.55.2.1
  M +17 -0     kmacctimap.cpp   1.185.2.1
  M +8 -0      kmacctimap.h   1.91.2.1


--- kdepim/kmail/imapaccountbase.cpp  #1.101:1.101.2.1
@@ -94,4 +94,5 @@ namespace KMail {
       mACLSupport( true ),
       mSlaveConnected( false ),
+      mSlaveConnectionError( false ),
       mListDirProgressItem( 0 )
   {
@@ -482,7 +483,10 @@ namespace KMail {
       if ( mAskAgain )
         makeConnection();
-      else
+      else {
+        if ( !mSlaveConnected )
+          mSlaveConnectionError = true;
         emit connectionResult( errorCode, errorMsg );
   }
+  }
 
   //-----------------------------------------------------------------------------

--- kdepim/kmail/imapaccountbase.h  #1.55:1.55.2.1
@@ -367,4 +367,5 @@ namespace KMail {
     bool mACLSupport : 1;
     bool mSlaveConnected : 1;
+    bool mSlaveConnectionError : 1;
 
         // folders that should be checked for new mails

--- kdepim/kmail/kmacctimap.cpp  #1.185:1.185.2.1
@@ -55,4 +55,5 @@ KMAcctImap::KMAcctImap(KMAcctMgr* aOwner
   connect(kmkernel->imapFolderMgr(), SIGNAL(changed()),
       this, SLOT(slotUpdateFolderList()));
+  connect(&mErrorTimer, SIGNAL(timeout()), SLOT(slotResetConnectionError()));
 }
 
@@ -415,3 +416,19 @@ FolderStorage* const KMAcctImap::rootFol
 }
 
+ImapAccountBase::ConnectionState KMAcctImap::makeConnection() 
+{
+    if ( mSlaveConnectionError )
+    {
+       mErrorTimer.start(100, true); // Clear error flag
+       return Error;
+    }
+    return ImapAccountBase::makeConnection();
+}
+
+void KMAcctImap::slotResetConnectionError()
+{
+  mSlaveConnectionError = false;
+  kdDebug(5006) << k_funcinfo << endl;
+}
+
 #include "kmacctimap.moc"

--- kdepim/kmail/kmacctimap.h  #1.91:1.91.2.1
@@ -55,4 +55,5 @@ public:
   virtual QString type(void) const;
   virtual void processNewMail(bool);
+  ConnectionState makeConnection();
 
   /**
@@ -125,5 +126,12 @@ protected slots:
   void slotMailCheckCanceled();
 
+  /**
+   * called to reset the connection error status
+   */
+  void slotResetConnectionError();
+
 private:
+  /** used to reset connection errors */
+  QTimer mErrorTimer;
   int mCountRemainChecks;
 };


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

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