More dimap error handling, this time for failed "creating folder on server".

Multiple mistakes made this not handled (and the user couldn't sync anymore afterwards).

svn path=/trunk/kdepim/; revision=305504
wilder-work
David Faure 22 years ago
parent e9d9c101ec
commit be9568d7a9
  1. 21
      cachedimapjob.cpp
  2. 1
      kmacctcachedimap.cpp
  3. 9
      kmfoldercachedimap.cpp

@ -429,22 +429,22 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job )
return;
}
if ( job->error() &&
!static_cast<KMFolderCachedImap*>((*it).parent->storage())->silentUpload() ) {
QStringList errors = job->detailedErrorStrings();
QString myError = "<qt><p><b>" + i18n("Error while uploading folder")
// make copy of setting, to reset it before potentially destroying 'it'
bool silentUpload = static_cast<KMFolderCachedImap*>((*it).parent->storage())->silentUpload();
static_cast<KMFolderCachedImap*>((*it).parent->storage())->setSilentUpload( false );
if ( job->error() && !silentUpload ) {
QString myError = "<p><b>" + i18n("Error while uploading folder")
+ "</b></p><p>" + i18n("Could not make the folder %1 on the server.").arg((*it).items[0])
+ "</p><p>" + i18n("This could be because you do not have permission to do this, or because the folder is already present on the server; the error message from the server communication is here:") + "</p>";
KMessageBox::error( 0, myError + errors[1] + '\n' + errors[2],
errors[0] );
mAccount->handleJobError( job->error(), job->errorText(), job, myError );
}
static_cast<KMFolderCachedImap*>((*it).parent->storage())->setSilentUpload( false );
mAccount->removeJob( it );
if( job->error() ) {
delete this;
return;
}
mAccount->removeJob( it );
}
if (mFolderList.isEmpty()) {
@ -458,7 +458,10 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job )
KURL url = mAccount->getUrl();
url.setPath(mFolder->imapPath() + folder->name());
ImapAccountBase::jobData jd( url.url(), folder->folder() );
// Associate the jobData with the parent folder, not with the child
// This is necessary in case of an error while creating the subfolder,
// so that folderComplete is called on the parent (and the sync resetted).
ImapAccountBase::jobData jd( url.url(), mFolder->folder() );
KIO::SimpleJob *simpleJob = KIO::mkdir(url);
KIO::Scheduler::assignJobToSlave(mAccount->slave(), simpleJob);
mAccount->insertJob(simpleJob, jd);

@ -277,6 +277,7 @@ void KMAcctCachedImap::slotAbortRequested()
//-----------------------------------------------------------------------------
void KMAcctCachedImap::killAllJobs( bool disconnectSlave )
{
//kdDebug(5006) << "killAllJobs: disconnectSlave=" << disconnectSlave << " " << mapJobData.count() << " jobs in map." << endl;
QMap<KIO::Job*, jobData>::Iterator it = mapJobData.begin();
for (it = mapJobData.begin(); it != mapJobData.end(); ++it)
if ((*it).parent)

@ -1010,7 +1010,8 @@ void KMFolderCachedImap::listMessages() {
return;
}
if( mAccount->makeConnection() != ImapAccountBase::Connected ) {
if( !mAccount->slave() ) { // sync aborted
resetSyncState();
emit listMessagesComplete();
emit folderComplete( this, false );
return;
@ -1132,8 +1133,7 @@ void KMFolderCachedImap::getMessagesResult( KIO::Job * job, bool lastSet )
}
if( job->error() ) {
mAccount->slotSlaveError( mAccount->slave(), job->error(),
job->errorText() );
mAccount->handleJobError( job->error(), job->errorText(), job, i18n( "Error while retrieving messages on the server: " ) + '\n' );
mContentState = imapNoInformation;
emit folderComplete(this, FALSE);
} else {
@ -1172,7 +1172,8 @@ void KMFolderCachedImap::setAccount(KMAcctCachedImap *aAccount)
bool KMFolderCachedImap::listDirectory(bool secondStep)
{
mSubfolderState = imapInProgress;
if( mAccount->makeConnection() != ImapAccountBase::Connected ) {
if( !mAccount->slave() ) { // sync aborted
resetSyncState();
emit folderComplete( this, false );
return false;
}

Loading…
Cancel
Save