From 0752c9362e34bf2f5b4b7aae0daa39a555cc9ff4 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Sat, 29 Nov 2003 17:54:14 +0000 Subject: [PATCH] Don't allow creation of a new maildir folder if there is already a folder with the same name in ~/Mail which has a cur, tmp or new subfolder. This was requested by Ingo. svn path=/trunk/kdepim/; revision=270288 --- kmfoldermaildir.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kmfoldermaildir.cpp b/kmfoldermaildir.cpp index f7273c766..2fe592ef9 100644 --- a/kmfoldermaildir.cpp +++ b/kmfoldermaildir.cpp @@ -134,7 +134,16 @@ int KMFolderMaildir::create(bool imap) assert(!name().isEmpty()); assert(mOpenCount == 0); - + + // Make sure that neither a new, cur or tmp subfolder exists already. + QFileInfo dirinfo; + dirinfo.setFile(location() + "/new"); + if (dirinfo.exists()) return 1; + dirinfo.setFile(location() + "/cur"); + if (dirinfo.exists()) return 1; + dirinfo.setFile(location() + "/tmp"); + if (dirinfo.exists()) return 1; + // create the maildir directory structure if (::mkdir(QFile::encodeName(location()), S_IRWXU) > 0) {