diff options
Diffstat (limited to 'kmail/imapaccountbase.cpp')
-rw-r--r-- | kmail/imapaccountbase.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/kmail/imapaccountbase.cpp b/kmail/imapaccountbase.cpp index 6380251e4..e97a260ed 100644 --- a/kmail/imapaccountbase.cpp +++ b/kmail/imapaccountbase.cpp @@ -55,16 +55,16 @@ using KPIM::ProgressManager; #include <kconfig.h> #include <klocale.h> #include <kmessagebox.h> -using KIO::MetaData; +using TDEIO::MetaData; #include <kio/passdlg.h> -using KIO::PasswordDialog; +using TDEIO::PasswordDialog; #include <kio/scheduler.h> #include <kio/slave.h> #include <mimelib/bodypart.h> #include <mimelib/body.h> #include <mimelib/headers.h> #include <mimelib/message.h> -//using KIO::Scheduler; // use FQN below +//using TDEIO::Scheduler; // use FQN below #include <tqregexp.h> #include <tqstylesheet.h> @@ -105,10 +105,10 @@ namespace KMail { { mPort = imapDefaultPort; mBodyPartList.setAutoDelete(true); - KIO::Scheduler::connect(TQT_SIGNAL(slaveError(KIO::Slave *, int, const TQString &)), - this, TQT_SLOT(slotSchedulerSlaveError(KIO::Slave *, int, const TQString &))); - KIO::Scheduler::connect(TQT_SIGNAL(slaveConnected(KIO::Slave *)), - this, TQT_SLOT(slotSchedulerSlaveConnected(KIO::Slave *))); + TDEIO::Scheduler::connect(TQT_SIGNAL(slaveError(TDEIO::Slave *, int, const TQString &)), + this, TQT_SLOT(slotSchedulerSlaveError(TDEIO::Slave *, int, const TQString &))); + TDEIO::Scheduler::connect(TQT_SIGNAL(slaveConnected(TDEIO::Slave *)), + this, TQT_SLOT(slotSchedulerSlaveConnected(TDEIO::Slave *))); connect(&mNoopTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotNoopTimeout())); connect(&mIdleTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotIdleTimeout())); } @@ -189,7 +189,7 @@ namespace KMail { // // - void ImapAccountBase::readConfig( /*const*/ KConfig/*Base*/ & config ) { + void ImapAccountBase::readConfig( /*const*/ TDEConfig/*Base*/ & config ) { NetworkAccount::readConfig( config ); setAutoExpunge( config.readBoolEntry( "auto-expunge", false ) ); @@ -229,7 +229,7 @@ namespace KMail { localBlacklistFromStringList( config.readListEntry( "locallyUnsubscribedFolders" ) ); } - void ImapAccountBase::writeConfig( KConfig/*Base*/ & config ) /*const*/ { + void ImapAccountBase::writeConfig( TDEConfig/*Base*/ & config ) /*const*/ { NetworkAccount::writeConfig( config ); config.writeEntry( "auto-expunge", autoExpunge() ); @@ -288,7 +288,7 @@ namespace KMail { // "keep password" checkbox. Then, we set [Passwords]Keep to // storePasswd(), so that the checkbox in the dialog will be // init'ed correctly: - KConfigGroup passwords( TDEGlobal::config(), "Passwords" ); + TDEConfigGroup passwords( TDEGlobal::config(), "Passwords" ); passwords.writeEntry( "Keep", storePasswd() ); TQString msg = i18n("You need to supply a username and a password to " "access this mailbox."); @@ -301,7 +301,7 @@ namespace KMail { if (ret != TQDialog::Accepted ) { mPasswordDialogIsActive = false; mAskAgain = false; - emit connectionResult( KIO::ERR_USER_CANCELED, TQString() ); + emit connectionResult( TDEIO::ERR_USER_CANCELED, TQString() ); return Error; } mPasswordDialogIsActive = false; @@ -315,7 +315,7 @@ namespace KMail { if ( mSlave && !mSlaveConnected ) return Connecting; mSlaveConnected = false; - mSlave = KIO::Scheduler::getConnectedSlave( getUrl(), slaveConfig() ); + mSlave = TDEIO::Scheduler::getConnectedSlave( getUrl(), slaveConfig() ); if ( !mSlave ) { KMessageBox::error(0, i18n("Could not start process for %1.") .arg( getUrl().protocol() ) ); @@ -329,7 +329,7 @@ namespace KMail { return Connecting; } - bool ImapAccountBase::handleJobError( KIO::Job *job, const TQString& context, bool abortSync ) + bool ImapAccountBase::handleJobError( TDEIO::Job *job, const TQString& context, bool abortSync ) { JobIterator it = findJob( job ); if ( it != jobsEnd() && (*it).progressItem ) @@ -376,8 +376,8 @@ namespace KMail { // create the KIO-job if ( makeConnection() != Connected ) return;// ## doesn't handle Connecting - KIO::SimpleJob *job = KIO::special(url, packedArgs, false); - KIO::Scheduler::assignJobToSlave(mSlave, job); + TDEIO::SimpleJob *job = TDEIO::special(url, packedArgs, false); + TDEIO::Scheduler::assignJobToSlave(mSlave, job); jobData jd( url.url(), NULL ); // a bit of a hack to save one slot if (subscribe) jd.onlySubscribed = true; @@ -385,18 +385,18 @@ namespace KMail { jd.quiet = quiet; insertJob(job, jd); - connect(job, TQT_SIGNAL(result(KIO::Job *)), - TQT_SLOT(slotSubscriptionResult(KIO::Job *))); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), + TQT_SLOT(slotSubscriptionResult(TDEIO::Job *))); } //----------------------------------------------------------------------------- - void ImapAccountBase::slotSubscriptionResult( KIO::Job * job ) + void ImapAccountBase::slotSubscriptionResult( TDEIO::Job * job ) { // result of a subscription-job JobIterator it = findJob( job ); if ( it == jobsEnd() ) return; bool onlySubscribed = (*it).onlySubscribed; - TQString path = static_cast<KIO::SimpleJob*>(job)->url().path(); + TQString path = static_cast<TDEIO::SimpleJob*>(job)->url().path(); if (job->error()) { if ( !(*it).quiet ) @@ -437,11 +437,11 @@ namespace KMail { jd.cancellable = true; insertJob(job, jd); - connect(job, TQT_SIGNAL(result(KIO::Job *)), - TQT_SLOT(slotGetUserRightsResult(KIO::Job *))); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), + TQT_SLOT(slotGetUserRightsResult(TDEIO::Job *))); } - void ImapAccountBase::slotGetUserRightsResult( KIO::Job* _job ) + void ImapAccountBase::slotGetUserRightsResult( TDEIO::Job* _job ) { ACLJobs::GetUserRightsJob* job = static_cast<ACLJobs::GetUserRightsJob *>( _job ); JobIterator it = findJob( job ); @@ -449,7 +449,7 @@ namespace KMail { KMFolder* folder = (*it).parent; if ( job->error() ) { - if ( job->error() == KIO::ERR_UNSUPPORTED_ACTION ) // that's when the imap server doesn't support ACLs + if ( job->error() == TDEIO::ERR_UNSUPPORTED_ACTION ) // that's when the imap server doesn't support ACLs mACLSupport = false; else kdWarning(5006) << "slotGetUserRightsResult: " << job->errorString() << endl; @@ -481,11 +481,11 @@ namespace KMail { jd.cancellable = true; insertJob(job, jd); - connect(job, TQT_SIGNAL(result(KIO::Job *)), - TQT_SLOT(slotGetACLResult(KIO::Job *))); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), + TQT_SLOT(slotGetACLResult(TDEIO::Job *))); } - void ImapAccountBase::slotGetACLResult( KIO::Job* _job ) + void ImapAccountBase::slotGetACLResult( TDEIO::Job* _job ) { ACLJobs::GetACLJob* job = static_cast<ACLJobs::GetACLJob *>( _job ); JobIterator it = findJob( job ); @@ -509,16 +509,16 @@ namespace KMail { jd.cancellable = true; insertJob(job, jd); - connect(job, TQT_SIGNAL(result(KIO::Job *)), - TQT_SLOT(slotGetStorageQuotaInfoResult(KIO::Job *))); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), + TQT_SLOT(slotGetStorageQuotaInfoResult(TDEIO::Job *))); } - void ImapAccountBase::slotGetStorageQuotaInfoResult( KIO::Job* _job ) + void ImapAccountBase::slotGetStorageQuotaInfoResult( TDEIO::Job* _job ) { QuotaJobs::GetStorageQuotaJob* job = static_cast<QuotaJobs::GetStorageQuotaJob *>( _job ); JobIterator it = findJob( job ); if ( it == jobsEnd() ) return; - if ( job->error() && job->error() == KIO::ERR_UNSUPPORTED_ACTION ) + if ( job->error() && job->error() == TDEIO::ERR_UNSUPPORTED_ACTION ) setHasNoQuotaSupport(); KMFolder* folder = (*it).parent; // can be 0 @@ -534,10 +534,10 @@ namespace KMail { stream << ( int ) 'N'; - KIO::SimpleJob *job = KIO::special( getUrl(), packedArgs, false ); - KIO::Scheduler::assignJobToSlave(mSlave, job); - connect( job, TQT_SIGNAL(result( KIO::Job * ) ), - this, TQT_SLOT( slotSimpleResult( KIO::Job * ) ) ); + TDEIO::SimpleJob *job = TDEIO::special( getUrl(), packedArgs, false ); + TDEIO::Scheduler::assignJobToSlave(mSlave, job); + connect( job, TQT_SIGNAL(result( TDEIO::Job * ) ), + this, TQT_SLOT( slotSimpleResult( TDEIO::Job * ) ) ); } else { /* Stop the timer, we have disconnected. We have to make sure it is started again when a new slave appears. */ @@ -548,7 +548,7 @@ namespace KMail { void ImapAccountBase::slotIdleTimeout() { if ( mSlave ) { - KIO::Scheduler::disconnectSlave(mSlave); + TDEIO::Scheduler::disconnectSlave(mSlave); mSlave = 0; mSlaveConnected = false; /* As for the noop timer, we need to make sure this one is started @@ -566,7 +566,7 @@ namespace KMail { //----------------------------------------------------------------------------- - void ImapAccountBase::slotSchedulerSlaveError(KIO::Slave *aSlave, int errorCode, + void ImapAccountBase::slotSchedulerSlaveError(TDEIO::Slave *aSlave, int errorCode, const TQString &errorMsg) { if (aSlave != mSlave) return; @@ -580,7 +580,7 @@ namespace KMail { resetConnectionList( this ); if ( mSlave ) { - KIO::Scheduler::disconnectSlave( slave() ); + TDEIO::Scheduler::disconnectSlave( slave() ); mSlave = 0; } } @@ -588,7 +588,7 @@ namespace KMail { } //----------------------------------------------------------------------------- - void ImapAccountBase::slotSchedulerSlaveConnected(KIO::Slave *aSlave) + void ImapAccountBase::slotSchedulerSlaveConnected(TDEIO::Slave *aSlave) { if (aSlave != mSlave) return; mSlaveConnected = true; @@ -605,14 +605,14 @@ namespace KMail { TQByteArray packedArgs; TQDataStream stream( packedArgs, IO_WriteOnly); stream << (int) 'c'; - KIO::SimpleJob *job = KIO::special( getUrl(), packedArgs, false ); - KIO::Scheduler::assignJobToSlave( mSlave, job ); - connect( job, TQT_SIGNAL(infoMessage(KIO::Job*, const TQString&)), - TQT_SLOT(slotCapabilitiesResult(KIO::Job*, const TQString&)) ); + TDEIO::SimpleJob *job = TDEIO::special( getUrl(), packedArgs, false ); + TDEIO::Scheduler::assignJobToSlave( mSlave, job ); + connect( job, TQT_SIGNAL(infoMessage(TDEIO::Job*, const TQString&)), + TQT_SLOT(slotCapabilitiesResult(TDEIO::Job*, const TQString&)) ); } //----------------------------------------------------------------------------- - void ImapAccountBase::slotCapabilitiesResult( KIO::Job*, const TQString& result ) + void ImapAccountBase::slotCapabilitiesResult( TDEIO::Job*, const TQString& result ) { mCapabilities = TQStringList::split(' ', result.lower() ); kdDebug(5006) << "capabilities:" << mCapabilities << endl; @@ -649,15 +649,15 @@ namespace KMail { TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ), this, TQT_SLOT( slotAbortRequested( KPIM::ProgressItem* ) ) ); - KIO::SimpleJob *job = KIO::special( getUrl(), packedArgs, false ); - KIO::Scheduler::assignJobToSlave( mSlave, job ); + TDEIO::SimpleJob *job = TDEIO::special( getUrl(), packedArgs, false ); + TDEIO::Scheduler::assignJobToSlave( mSlave, job ); insertJob( job, jd ); - connect( job, TQT_SIGNAL( infoMessage(KIO::Job*, const TQString&) ), - TQT_SLOT( slotNamespaceResult(KIO::Job*, const TQString&) ) ); + connect( job, TQT_SIGNAL( infoMessage(TDEIO::Job*, const TQString&) ), + TQT_SLOT( slotNamespaceResult(TDEIO::Job*, const TQString&) ) ); } //----------------------------------------------------------------------------- - void ImapAccountBase::slotNamespaceResult( KIO::Job* job, const TQString& str ) + void ImapAccountBase::slotNamespaceResult( TDEIO::Job* job, const TQString& str ) { JobIterator it = findJob( job ); if ( it == jobsEnd() ) return; @@ -847,7 +847,7 @@ namespace KMail { } //----------------------------------------------------------------------------- - void ImapAccountBase::slotSimpleResult(KIO::Job * job) + void ImapAccountBase::slotSimpleResult(TDEIO::Job * job) { JobIterator it = findJob( job ); bool quiet = false; @@ -860,20 +860,20 @@ namespace KMail { if (!quiet) handleJobError(job, TQString() ); else { - if ( job->error() == KIO::ERR_CONNECTION_BROKEN && slave() ) { + if ( job->error() == TDEIO::ERR_CONNECTION_BROKEN && slave() ) { // make sure ERR_CONNECTION_BROKEN is properly handled and the slave // disconnected even when quiet() - KIO::Scheduler::disconnectSlave( slave() ); + TDEIO::Scheduler::disconnectSlave( slave() ); mSlave = 0; } - if (job->error() == KIO::ERR_SLAVE_DIED) + if (job->error() == TDEIO::ERR_SLAVE_DIED) slaveDied(); } } } //----------------------------------------------------------------------------- - bool ImapAccountBase::handlePutError( KIO::Job* job, jobData& jd, KMFolder* folder ) + bool ImapAccountBase::handlePutError( TDEIO::Job* job, jobData& jd, KMFolder* folder ) { Q_ASSERT( !jd.msgList.isEmpty() ); KMMessage* msg = jd.msgList.first(); @@ -891,7 +891,7 @@ namespace KMail { return handleJobError( job, myError ); } - TQString ImapAccountBase::prettifyQuotaError( const TQString& _error, KIO::Job * job ) + TQString ImapAccountBase::prettifyQuotaError( const TQString& _error, TDEIO::Job * job ) { TQString error = _error; if ( error.find( "quota", 0, false ) == -1 ) return error; @@ -917,27 +917,27 @@ namespace KMail { } //----------------------------------------------------------------------------- - bool ImapAccountBase::handleError( int errorCode, const TQString &errorMsg, KIO::Job* job, const TQString& context, bool abortSync ) + bool ImapAccountBase::handleError( int errorCode, const TQString &errorMsg, TDEIO::Job* job, const TQString& context, bool abortSync ) { // Copy job's data before a possible killAllJobs TQStringList errors; - if ( job && job->error() != KIO::ERR_SLAVE_DEFINED /*workaround for tdelibs-3.2*/) + if ( job && job->error() != TDEIO::ERR_SLAVE_DEFINED /*workaround for tdelibs-3.2*/) errors = job->detailedErrorStrings(); bool jobsKilled = true; switch( errorCode ) { - case KIO::ERR_SLAVE_DIED: slaveDied(); killAllJobs( true ); break; - case KIO::ERR_COULD_NOT_AUTHENTICATE: // bad password + case TDEIO::ERR_SLAVE_DIED: slaveDied(); killAllJobs( true ); break; + case TDEIO::ERR_COULD_NOT_AUTHENTICATE: // bad password mAskAgain = true; // fallthrough intended - case KIO::ERR_CONNECTION_BROKEN: - case KIO::ERR_COULD_NOT_CONNECT: - case KIO::ERR_SERVER_TIMEOUT: + case TDEIO::ERR_CONNECTION_BROKEN: + case TDEIO::ERR_COULD_NOT_CONNECT: + case TDEIO::ERR_SERVER_TIMEOUT: // These mean that we'll have to reconnect on the next attempt, so disconnect and set mSlave to 0. killAllJobs( true ); break; - case KIO::ERR_COULD_NOT_LOGIN: - case KIO::ERR_USER_CANCELED: + case TDEIO::ERR_COULD_NOT_LOGIN: + case TDEIO::ERR_USER_CANCELED: killAllJobs( false ); break; default: @@ -949,21 +949,21 @@ namespace KMail { } // check if we still display an error - if ( !mErrorDialogIsActive && errorCode != KIO::ERR_USER_CANCELED ) { + if ( !mErrorDialogIsActive && errorCode != TDEIO::ERR_USER_CANCELED ) { mErrorDialogIsActive = true; - TQString msg = context + '\n' + prettifyQuotaError( KIO::buildErrorString( errorCode, errorMsg ), job ); + TQString msg = context + '\n' + prettifyQuotaError( TDEIO::buildErrorString( errorCode, errorMsg ), job ); TQString caption = i18n("Error"); - if ( jobsKilled || errorCode == KIO::ERR_COULD_NOT_LOGIN ) { - if ( errorCode == KIO::ERR_SERVER_TIMEOUT || errorCode == KIO::ERR_CONNECTION_BROKEN ) { + if ( jobsKilled || errorCode == TDEIO::ERR_COULD_NOT_LOGIN ) { + if ( errorCode == TDEIO::ERR_SERVER_TIMEOUT || errorCode == TDEIO::ERR_CONNECTION_BROKEN ) { msg = i18n("The connection to the server %1 was unexpectedly closed or timed out. It will be re-established automatically if possible."). arg( name() ); KMessageBox::information( TQT_TQWIDGET(kapp->activeWindow()), msg, caption, "kmailConnectionBrokenErrorDialog" ); // Show it in the status bar, in case the user has ticked "don't show again" - if ( errorCode == KIO::ERR_CONNECTION_BROKEN ) + if ( errorCode == TDEIO::ERR_CONNECTION_BROKEN ) KPIM::BroadcastStatus::instance()->setStatusMsg( i18n( "The connection to account %1 was broken." ).arg( name() ) ); - else if ( errorCode == KIO::ERR_SERVER_TIMEOUT ) + else if ( errorCode == TDEIO::ERR_SERVER_TIMEOUT ) KPIM::BroadcastStatus::instance()->setStatusMsg( i18n( "The connection to account %1 timed out." ).arg( name() ) ); } else { @@ -997,12 +997,12 @@ namespace KMail { //----------------------------------------------------------------------------- void ImapAccountBase::cancelMailCheck() { - TQMap<KIO::Job*, jobData>::Iterator it = mapJobData.begin(); + TQMap<TDEIO::Job*, jobData>::Iterator it = mapJobData.begin(); while ( it != mapJobData.end() ) { kdDebug(5006) << "cancelMailCheck: job is cancellable: " << (*it).cancellable << endl; if ( (*it).cancellable ) { it.key()->kill(); - TQMap<KIO::Job*, jobData>::Iterator rmit = it; + TQMap<TDEIO::Job*, jobData>::Iterator rmit = it; ++it; mapJobData.remove( rmit ); // We killed a job -> this kills the slave @@ -1209,13 +1209,13 @@ namespace KMail { if ( makeConnection() != Connected ) return; // can't happen with dimap - KIO::SimpleJob *job = KIO::special(url, packedArgs, false); - KIO::Scheduler::assignJobToSlave(slave(), job); + TDEIO::SimpleJob *job = TDEIO::special(url, packedArgs, false); + TDEIO::Scheduler::assignJobToSlave(slave(), job); ImapAccountBase::jobData jd( url.url(), folder ); jd.path = path; insertJob(job, jd); - connect(job, TQT_SIGNAL(result(KIO::Job *)), - TQT_SLOT(slotSetStatusResult(KIO::Job *))); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), + TQT_SLOT(slotSetStatusResult(TDEIO::Job *))); } void ImapAccountBase::setImapSeenStatus(KMFolder * folder, const TQString & path, bool seen) @@ -1231,24 +1231,24 @@ namespace KMail { if ( makeConnection() != Connected ) return; // can't happen with dimap - KIO::SimpleJob *job = KIO::special(url, packedArgs, false); - KIO::Scheduler::assignJobToSlave(slave(), job); + TDEIO::SimpleJob *job = TDEIO::special(url, packedArgs, false); + TDEIO::Scheduler::assignJobToSlave(slave(), job); ImapAccountBase::jobData jd( url.url(), folder ); jd.path = path; insertJob(job, jd); - connect(job, TQT_SIGNAL(result(KIO::Job *)), - TQT_SLOT(slotSetStatusResult(KIO::Job *))); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), + TQT_SLOT(slotSetStatusResult(TDEIO::Job *))); } //----------------------------------------------------------------------------- - void ImapAccountBase::slotSetStatusResult(KIO::Job * job) + void ImapAccountBase::slotSetStatusResult(TDEIO::Job * job) { ImapAccountBase::JobIterator it = findJob(job); if ( it == jobsEnd() ) return; int errorCode = job->error(); KMFolder * const parent = (*it).parent; const TQString path = (*it).path; - if (errorCode && errorCode != KIO::ERR_CANNOT_OPEN_FOR_WRITING) + if (errorCode && errorCode != TDEIO::ERR_CANNOT_OPEN_FOR_WRITING) { bool cont = handleJobError( job, i18n( "Error while uploading status of messages to server: " ) + '\n' ); emit imapStatusChanged( parent, path, cont ); @@ -1282,7 +1282,7 @@ namespace KMail { } //----------------------------------------------------------------------------- - void KMail::ImapAccountBase::removeJob( KIO::Job* job ) + void KMail::ImapAccountBase::removeJob( TDEIO::Job* job ) { mapJobData.remove( job ); } |