Make sure that folders which are to be created on the server during startup

while there is no connected slave yet are stored in a list and created
once the slave signals that it is connected. Fixes creation of missing
imap resource folders with online imap.

svn path=/trunk/kdepim/; revision=330332
wilder-work
Till Adam 22 years ago
parent bd2bfe6e2c
commit 068dd703de
  1. 26
      kmfolderimap.cpp
  2. 8
      kmfolderimap.h

@ -1317,10 +1317,24 @@ void KMFolderImap::slotGetMessagesResult(KIO::Job * job)
//-----------------------------------------------------------------------------
void KMFolderImap::createFolder(const QString &name)
{
if ( mAccount->makeConnection() == ImapAccountBase::Error ) {
kdWarning(5006) << "KMFolderImap::createFolder - got no connection" << endl;
return;
} else if ( mAccount->makeConnection() == ImapAccountBase::Connecting ) {
// We'll wait for the connectionResult signal from the account.
kdDebug(5006) << "KMFolderImap::createFolder - waiting for connection" << endl;
if ( mFoldersPendingCreation.isEmpty() ) {
// first folder, connect
connect( mAccount, SIGNAL( connectionResult(int, const QString&) ),
this, SLOT( slotCreatePendingFolders() ) );
}
mFoldersPendingCreation << name;
return;
}
KURL url = mAccount->getUrl();
url.setPath(imapPath() + name);
if ( mAccount->makeConnection() != ImapAccountBase::Connected )
return;
KIO::SimpleJob *job = KIO::mkdir(url);
KIO::Scheduler::assignJobToSlave(mAccount->slave(), job);
ImapAccountBase::jobData jd( url.url(), folder() );
@ -1829,4 +1843,12 @@ void KMFolderImap::setAlreadyRemoved( bool removed )
}
}
void KMFolderImap::slotCreatePendingFolders()
{
QStringList::Iterator it = mFoldersPendingCreation.begin();
for ( ; it != mFoldersPendingCreation.end(); ++it ) {
createFolder( *it );
}
}
#include "kmfolderimap.moc"

@ -409,6 +409,13 @@ protected slots:
*/
void slotProcessNewMail( int errorCode, const QString& errorMsg );
/**
* Is connected when there are folders to be created on startup and the
* account is still connecting. Once the account emits the connected
* signal this slot is called and the folders created.
*/
void slotCreatePendingFolders();
protected:
QString mImapPath;
ulong mLastUid;
@ -428,6 +435,7 @@ private:
bool mAlreadyRemoved;
ProgressItem *mMailCheckProgressItem;
ProgressItem *mListDirProgressItem;
QStringList mFoldersPendingCreation;
};
#endif // kmfolderimap_h

Loading…
Cancel
Save