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

List:       kde-commits
Subject:    [kdepim-runtime] resources/imap: Better error handling when a not-existing folder is requested to be
From:       Andras Mantia <amantia () kde ! org>
Date:       2012-02-29 21:58:29
Message-ID: 20120229215829.7F2CEA60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 4f88eb47c9772b5621eb22df13cc657b22e59bce by Andras Mantia.
Committed on 29/02/2012 at 22:58.
Pushed by amantia into branch 'master'.

Better error handling when a not-existing folder is requested to be deleted.
This fix avoids the resource being stuck in change processing if the above =
conditions
is hit.

REVIEW: 104117

M  +9    -0    resources/imap/removecollectionrecursivetask.cpp
M  +12   -1    resources/imap/tests/testremovecollectiontask.cpp

http://commits.kde.org/kdepim-runtime/4f88eb47c9772b5621eb22df13cc657b22e59=
bce

diff --git a/resources/imap/removecollectionrecursivetask.cpp b/resources/i=
map/removecollectionrecursivetask.cpp
index 9e78cff..d51eace 100644
--- a/resources/imap/removecollectionrecursivetask.cpp
+++ b/resources/imap/removecollectionrecursivetask.cpp
@@ -69,6 +69,15 @@ void RemoveCollectionRecursiveTask::onMailBoxesReceived(=
 const QList< KIMAP::Mai
     }
   }
 =

+  if  ( foldersToDelete.isEmpty() ) {
+      changeProcessed();
+
+      kDebug(5327) << "Failed to find the folder to be deleted, resync the=
 folder tree";
+      emitWarning( i18n( "Failed to find the folder to be deleted, restori=
ng folder list." ) );
+      synchronizeCollectionTree();
+      return;
+  }
+
   // Now start the actual deletion work
   QMapIterator<int, QList<KIMAP::MailBoxDescriptor> > it( foldersToDelete =
);
   it.toBack(); // we start with largest nesting value first
diff --git a/resources/imap/tests/testremovecollectiontask.cpp b/resources/=
imap/tests/testremovecollectiontask.cpp
index d4c6765..9a3152a 100644
--- a/resources/imap/tests/testremovecollectiontask.cpp
+++ b/resources/imap/tests/testremovecollectiontask.cpp
@@ -170,11 +170,22 @@ private slots:
              << "S: * 0 EXISTS"
              << "S: * 0 RECENT"
              << "S: A000011 OK Completed";
-
     callNames.clear();
     callNames << "changeProcessed";
 =

     QTest::newRow( "normal case" ) << collection << scenario << callNames;
+
+    scenario.clear();
+    scenario << defaultPoolConnectionScenario()
+              << "C: A000003 LSUB \"\" *"
+             << "S: * LSUB ( \\HasChildren ) / INBOX"
+             << "S: * LSUB ( \\HasChildren ) / INBOX/test1"
+             << "S: * LSUB ( ) / INBOX/test1/test2"
+             << "S: A000003 OK Completed ( 0.000 secs 26 calls )";
+    collection.setRemoteId( "test1" );
+    callNames.clear();
+    callNames << "changeProcessed" << "emitWarning" << "synchronizeCollect=
ionTree";
+    QTest::newRow( "invalid collection" ) << collection << scenario << cal=
lNames;
   }
 =

   void shouldDeleteMailBoxRecursive()
[prev in list] [next in list] [prev in thread] [next in thread] 

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