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
wilder-work
Volker Krause 19 years ago
parent 8c37f8e109
commit 9ef1d1c901
  1. 24
      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<KMFolderCachedImap*>( 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 )

Loading…
Cancel
Save