Wait for a connection.

svn path=/trunk/kdepim/; revision=319188
wilder-work
Carsten Burghardt 22 years ago
parent d77025146a
commit a068eb9658
  1. 2
      kmfolderimap.cpp
  2. 23
      listjob.cpp
  3. 5
      listjob.h

@ -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 )

@ -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 );

@ -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

Loading…
Cancel
Save