[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: [Bug 68661] kmail deletes the whole directory if it is existent.
From: Till Adam <adam () kde ! org>
Date: 2003-11-29 17:43:59
[Download RAW message or body]
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=68661
adam@kde.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From adam@kde.org 2003-11-29 18:43 -------
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;
}
_______________________________________________
KMail Developers mailing list
kmail@kde.org
https://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