Some IMAP folder renaming fixes:

- the mbox is now correctly moved
- the settings stay
- unsubscribe the old one
- subscribe the new one

svn path=/trunk/kdepim/; revision=335692
wilder-work
Carsten Burghardt 22 years ago
parent 5db3504923
commit ad115e2b7f
  1. 5
      folderstorage.cpp
  2. 8
      kmfolderimap.cpp
  3. 3
      kmfolderimap.h

@ -581,6 +581,7 @@ int FolderStorage::rename(const QString& newName, KMFolderDir *newParent)
oldSubDirLoc = folder()->subdirLocation();
if (kmkernel->msgDict())
oldIdsLoc = kmkernel->msgDict()->getFolderIdsLocation( folder() );
QString oldConfigString = "Folder-" + folder()->idString();
close(TRUE);
@ -647,6 +648,10 @@ int FolderStorage::rename(const QString& newName, KMFolderDir *newParent)
open();
mOpenCount = openCount;
}
writeConfig();
// delete the old entry as we get two entries with the same ID otherwise
KMKernel::config()->deleteGroup( oldConfigString );
emit nameChanged();
return rc;

@ -302,13 +302,19 @@ void KMFolderImap::slotRenameResult( KIO::Job *job )
if ( it == mAccount->jobsEnd() ) return;
KIO::SimpleJob* sj = static_cast<KIO::SimpleJob*>(job);
if ( job->error() ) {
// rollback
setImapPath( sj->url().path() );
mAccount->handleJobError( job, i18n("Error while renaming a folder.") );
return;
}
// unsubscribe old (we don't want ghosts)
mAccount->changeSubscription( false, sj->url().path() );
// subscribe new
mAccount->changeSubscription( true, imapPath() );
// ATTENTION port me to maildir
KMFolderMbox::rename( (*it).path );
kmkernel->folderMgr()->contentsChanged();
mAccount->removeJob(it);
kmkernel->folderMgr()->contentsChanged();
}
//-----------------------------------------------------------------------------

@ -228,7 +228,8 @@ public:
/**
* Return the filename of the folder (reimplemented from KFolder)
*/
virtual QString fileName() const { return encodeFileName(name()); }
virtual QString fileName() const {
return encodeFileName( KMFolderMbox::fileName() ); }
/**
* Insert a new entry into the uid <=> sernum cache

Loading…
Cancel
Save