From 9ef1d1c901d5b65aa5734b376cd55abd09f609f0 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Mon, 6 Aug 2007 14:13:59 +0000 Subject: [PATCH] Forwardport SVN commit 696993 by vkrause: Prevent re-creation of a previously deleted DIMAP folder without a prior sync, this could create inconsistencies. Fixes Kolab issue 1846. svn path=/trunk/KDE/kdepim/; revision=696999 --- kmfoldermgr.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/kmfoldermgr.cpp b/kmfoldermgr.cpp index a4553ffad..56bc1a972 100644 --- a/kmfoldermgr.cpp +++ b/kmfoldermgr.cpp @@ -23,6 +23,9 @@ #include "kmfiltermgr.h" #include "kmfoldermgr.h" #include "folderstorage.h" +#include "kmfolder.h" +#include "kmfoldercachedimap.h" +#include "kmacctcachedimap.h" #include "renamejob.h" #include "copyfolderjob.h" @@ -178,6 +181,27 @@ KMFolder* KMFolderMgr::createFolder(const QString& fName, bool sysFldr, if (!aFolderDir) fldDir = &mDir; + + // check if this is a dimap folder and the folder we want to create has been deleted + // since the last sync + if ( fldDir->owner() && fldDir->owner()->folderType() == KMFolderTypeCachedImap ) { + KMFolderCachedImap *storage = static_cast( fldDir->owner()->storage() ); + KMAcctCachedImap *account = storage->account(); + // guess imap path + QString imapPath = storage->imapPath(); + if ( !imapPath.endsWith( "/" ) ) + imapPath += "/"; + imapPath += fName; + if ( account->isDeletedFolder( imapPath ) || account->isDeletedFolder( imapPath + "/" ) + || account->isPreviouslyDeletedFolder( imapPath ) + || account->isPreviouslyDeletedFolder( imapPath + "/" ) ) { + KMessageBox::error( 0, i18n("A folder with the same name has been deleted since the last mail check." + "You need to check mails first before creating another folder with the same name."), + i18n("Could Not Create Folder") ); + return 0; + } + } + fld = fldDir->createFolder(fName, sysFldr, aFolderType); if (fld) { if ( fld->id() == 0 )