Version: 1.5 (using KDE 3.1.0) Installed from: SuSE Compiler: gcc version 3.2 OS: Linux (i686) release 2.4.19-4GB Great Work! KMail just deleted a whole folder named "Old" which was on the hard in the Mail-directory when I created one with the same name and deleted it afterwards. This shouldn't have happened... kmail should only delete files and directorys created by kmail. not files that have been created by myself with the bash. thanks... because of this i just lost 40MB of emails that I needed. Benedikt
KMail must delete the maildir directory only if it doesn't contain non-KMail files.
Subject: kdepim/kmail CVS commit by tilladam: When the user deletes a maildir folder first delete the new, cur and tmp subdirs, then check if the dir itself is empty and only then delete the folder directory itself. This prevents data loss if the user has non-kmail data stored in a folder in ~/Mail and then creates a maildir folder of the same name and later deletes it. CCMAIL: 68661-done@bugs.kde.org M +16 -3 kmfoldermaildir.cpp 1.72 --- kdepim/kmail/kmfoldermaildir.cpp #1.71:1.72 @@ -887,7 +887,20 @@ bool KMFolderMaildir::removeFile(const Q int KMFolderMaildir::removeContents() { - if (KIO::NetAccess::del(KURL::fromPathOrURL(location()), 0)) - return 0; + if (!KIO::NetAccess::del(KURL::fromPathOrURL(location()+ "/new/"), 0)) + return 1; + if (!KIO::NetAccess::del(KURL::fromPathOrURL(location()+ "/cur/"), 0)) return 1; + if (!KIO::NetAccess::del(KURL::fromPathOrURL(location()+ "/tmp/"), 0)) + return 1; + + /* The subdirs are removed now. Check if there is anything else in the dir + * and only if not delete the dir itself. The user could have data stored + * that would otherwise be deleted. */ + QDir *dir = new QDir(location()); + if ( dir->count() == 2 ) { // only . and .. + if (!KIO::NetAccess::del(KURL::fromPathOrURL(location()), 0)) + return 1; + } + return 0; }