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

List:       kmail-devel
Subject:    [PATCH] fix bug 43417
From:       Carsten Burghardt <burghardt () kde ! org>
Date:       2002-08-26 20:37:16
[Download RAW message or body]

Hi,

this patch reloads the folderlisting when kmail gets an error that the folder 
doesn't exist anymore.

Ciao,

Carsten

["deletefolder.diff" (text/x-diff)]

Index: kmacctimap.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmacctimap.cpp,v
retrieving revision 1.102
diff -u -3 -p -r1.102 kmacctimap.cpp
--- kmacctimap.cpp	2002/08/20 10:42:06	1.102
+++ kmacctimap.cpp	2002/08/26 20:28:11
@@ -366,6 +366,31 @@ void KMAcctImap::slotSlaveError(KIO::Sla
   if (aSlave != mSlave) return;
   if (errorCode == KIO::ERR_SLAVE_DIED) slaveDied();
   if (errorCode == KIO::ERR_COULD_NOT_LOGIN && !mStorePasswd) mAskAgain = TRUE;
+  if (errorCode == KIO::ERR_DOES_NOT_EXIST ||
+      errorCode == KIO::ERR_COULD_NOT_READ)
+  {
+    // a folder is gone
+    // get the folderpath from the message
+    KURL url(errorMsg);
+    QString folderpath = url.path();
+    int uid = folderpath.findRev(";");
+    if (uid != -1)
+      folderpath.truncate(uid);
+    errorDialogIsActive = true;
+    if ( KMessageBox::questionYesNo(0,
+          i18n("The folder %1 was obviously deleted on the server, do you want to remove it?")
+          .arg(folderpath),
+          i18n("Error")) == KMessageBox::Yes )
+    {
+      errorDialogIsActive = false;
+      // reload folders
+      if (mFolder) mFolder->listDirectory();
+    } else {
+      errorDialogIsActive = false;
+    }
+    return;
+  }
+  killAllJobs();
   // check if we still display an error
   if ( !errorDialogIsActive )
   {
@@ -378,7 +403,6 @@ void KMAcctImap::slotSlaveError(KIO::Sla
     }
   } else
     kdDebug() << "suppressing error:" << errorMsg << endl;
-  killAllJobs();
 }
 
 
@@ -504,7 +528,7 @@ void KMAcctImap::slotSimpleResult(KIO::J
   if (job->error())
   {
     if (!quiet) slotSlaveError(mSlave, job->error(),
-        job->errorString() );
+        job->errorText() );
     if (job->error() == KIO::ERR_SLAVE_DIED) slaveDied();
   }
   displayProgress();

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

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

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