diff --git a/kmfolderimap.cpp b/kmfolderimap.cpp index 140a65e22..5ca3974e2 100644 --- a/kmfolderimap.cpp +++ b/kmfolderimap.cpp @@ -545,6 +545,7 @@ bool KMFolderImap::listDirectory(bool secondStep) if ( this == mAccount->rootFolder() ) { mAccount->setHasInbox( false ); + // recursive setSubfolderState( imapNoInformation ); } mSubfolderState = imapInProgress; @@ -1525,6 +1526,7 @@ void KMFolderImap::expungeFolder(KMFolderImap * aFolder, bool quiet) //----------------------------------------------------------------------------- void KMFolderImap::slotProcessNewMail( int errorCode, const QString &errorMsg ) { + Q_UNUSED( errorMsg ); disconnect( mAccount, SIGNAL( connectionResult(int, const QString&) ), this, SLOT( slotProcessNewMail(int, const QString&) ) ); if ( !errorCode ) diff --git a/listjob.cpp b/listjob.cpp index bcd23587b..e4f256ea9 100644 --- a/listjob.cpp +++ b/listjob.cpp @@ -60,8 +60,16 @@ void ListJob::execute() { if ( mAccount->makeConnection() == ImapAccountBase::Error ) { + kdWarning(5006) << "ListJob - got no connection" << endl; delete this; return; + } else if ( mAccount->makeConnection() == ImapAccountBase::Connecting ) + { + // We'll wait for the connectionResult signal from the account. + kdDebug(5006) << "ListJob - waiting for connection" << endl; + connect( mAccount, SIGNAL( connectionResult(int, const QString&) ), + this, SLOT( slotConnectionResult(int, const QString&) ) ); + return; } // this is needed until we have a common base class for d(imap) if ( mPath.isEmpty() ) @@ -98,12 +106,6 @@ void ListJob::execute() url.setPath( ( jd.inboxOnly ? QString("/") : mPath ) + ";TYPE=" + ltype + ( mComplete ? ";SECTION=COMPLETE" : QString::null) ); - // at least here we have to be connected - if ( mAccount->makeConnection() != ImapAccountBase::Connected ) - { - delete this; - return; - } // go KIO::SimpleJob *job = KIO::listDir( url, false ); KIO::Scheduler::assignJobToSlave( mAccount->slave(), job ); @@ -114,6 +116,15 @@ void ListJob::execute() this, SLOT(slotListEntries(KIO::Job *, const KIO::UDSEntryList &)) ); } +void ListJob::slotConnectionResult( int errorCode, const QString& errorMsg ) +{ + Q_UNUSED( errorMsg ); + if ( !errorCode ) + execute(); + else + delete this; +} + void ListJob::slotListResult( KIO::Job* job ) { ImapAccountBase::JobIterator it = mAccount->findJob( job ); diff --git a/listjob.h b/listjob.h index 6ee6fb0d2..6db55a811 100644 --- a/listjob.h +++ b/listjob.h @@ -88,6 +88,11 @@ protected slots: */ void slotListEntries( KIO::Job* job, const KIO::UDSEntryList& uds ); + /** + * Called from the account when a connection was established + */ + void slotConnectionResult( int errorCode, const QString& errorMsg ); + signals: /** * Emitted when new folders have been received