diff options
Diffstat (limited to 'kmail/actionscheduler.cpp')
-rw-r--r-- | kmail/actionscheduler.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/kmail/actionscheduler.cpp b/kmail/actionscheduler.cpp index 3d92cd7a1..0af6cdd4f 100644 --- a/kmail/actionscheduler.cpp +++ b/kmail/actionscheduler.cpp @@ -46,23 +46,23 @@ #include "accountmanager.h" using KMail::AccountManager; -#include <qtimer.h> +#include <tqtimer.h> #include <kconfig.h> #include <kstandarddirs.h> using namespace KMail; -typedef QPtrList<KMMsgBase> KMMessageList; +typedef TQPtrList<KMMsgBase> KMMessageList; KMFolderMgr* ActionScheduler::tempFolderMgr = 0; int ActionScheduler::refCount = 0; int ActionScheduler::count = 0; -QValueList<ActionScheduler*> *ActionScheduler::schedulerList = 0; +TQValueList<ActionScheduler*> *ActionScheduler::schedulerList = 0; bool ActionScheduler::sEnabled = false; bool ActionScheduler::sEnabledChecked = false; ActionScheduler::ActionScheduler(KMFilterMgr::FilterSet set, - QValueList<KMFilter*> filters, + TQValueList<KMFilter*> filters, KMHeaders *headers, KMFolder *srcFolder) :mSet( set ), mHeaders( headers ) @@ -81,22 +81,22 @@ ActionScheduler::ActionScheduler(KMFilterMgr::FilterSet set, mAccount = false; lastCommand = 0; lastJob = 0; - finishTimer = new QTimer( this, "finishTimer" ); - connect( finishTimer, SIGNAL(timeout()), this, SLOT(finish())); - fetchMessageTimer = new QTimer( this, "fetchMessageTimer" ); - connect( fetchMessageTimer, SIGNAL(timeout()), this, SLOT(fetchMessage())); - tempCloseFoldersTimer = new QTimer( this, "tempCloseFoldersTimer" ); - connect( tempCloseFoldersTimer, SIGNAL(timeout()), this, SLOT(tempCloseFolders())); - processMessageTimer = new QTimer( this, "processMessageTimer" ); - connect( processMessageTimer, SIGNAL(timeout()), this, SLOT(processMessage())); - filterMessageTimer = new QTimer( this, "filterMessageTimer" ); - connect( filterMessageTimer, SIGNAL(timeout()), this, SLOT(filterMessage())); - timeOutTimer = new QTimer( this, "timeOutTimer" ); - connect( timeOutTimer, SIGNAL(timeout()), this, SLOT(timeOut())); - fetchTimeOutTimer = new QTimer( this, "fetchTimeOutTimer" ); - connect( fetchTimeOutTimer, SIGNAL(timeout()), this, SLOT(fetchTimeOut())); - - QValueList<KMFilter*>::Iterator it = filters.begin(); + finishTimer = new TQTimer( this, "finishTimer" ); + connect( finishTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(finish())); + fetchMessageTimer = new TQTimer( this, "fetchMessageTimer" ); + connect( fetchMessageTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(fetchMessage())); + tempCloseFoldersTimer = new TQTimer( this, "tempCloseFoldersTimer" ); + connect( tempCloseFoldersTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(tempCloseFolders())); + processMessageTimer = new TQTimer( this, "processMessageTimer" ); + connect( processMessageTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(processMessage())); + filterMessageTimer = new TQTimer( this, "filterMessageTimer" ); + connect( filterMessageTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(filterMessage())); + timeOutTimer = new TQTimer( this, "timeOutTimer" ); + connect( timeOutTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeOut())); + fetchTimeOutTimer = new TQTimer( this, "fetchTimeOutTimer" ); + connect( fetchTimeOutTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(fetchTimeOut())); + + TQValueList<KMFilter*>::Iterator it = filters.begin(); for (; it != filters.end(); ++it) mFilters.append( **it ); mDestFolder = 0; @@ -104,7 +104,7 @@ ActionScheduler::ActionScheduler(KMFilterMgr::FilterSet set, mDeleteSrcFolder = false; setSourceFolder( srcFolder ); } else { - QString tmpName; + TQString tmpName; tmpName.setNum( count ); if (!tempFolderMgr) tempFolderMgr = new KMFolderMgr(locateLocal("data","kmail/filter")); @@ -114,7 +114,7 @@ ActionScheduler::ActionScheduler(KMFilterMgr::FilterSet set, setSourceFolder( tempFolder ); } if (!schedulerList) - schedulerList = new QValueList<ActionScheduler*>; + schedulerList = new TQValueList<ActionScheduler*>; schedulerList->append( this ); } @@ -122,10 +122,10 @@ ActionScheduler::~ActionScheduler() { schedulerList->remove( this ); tempCloseFolders(); - disconnect( mSrcFolder, SIGNAL(closed()), - this, SLOT(folderClosedOrExpunged()) ); - disconnect( mSrcFolder, SIGNAL(expunged(KMFolder*)), - this, SLOT(folderClosedOrExpunged()) ); + disconnect( mSrcFolder, TQT_SIGNAL(closed()), + this, TQT_SLOT(folderClosedOrExpunged()) ); + disconnect( mSrcFolder, TQT_SIGNAL(expunged(KMFolder*)), + this, TQT_SLOT(folderClosedOrExpunged()) ); mSrcFolder->close("actionschedsrc"); if (mDeleteSrcFolder) @@ -157,12 +157,12 @@ void ActionScheduler::setSourceFolder( KMFolder *srcFolder ) { srcFolder->open("actionschedsrc"); if (mSrcFolder) { - disconnect( mSrcFolder, SIGNAL(msgAdded(KMFolder*, Q_UINT32)), - this, SLOT(msgAdded(KMFolder*, Q_UINT32)) ); - disconnect( mSrcFolder, SIGNAL(closed()), - this, SLOT(folderClosedOrExpunged()) ); - disconnect( mSrcFolder, SIGNAL(expunged(KMFolder*)), - this, SLOT(folderClosedOrExpunged()) ); + disconnect( mSrcFolder, TQT_SIGNAL(msgAdded(KMFolder*, Q_UINT32)), + this, TQT_SLOT(msgAdded(KMFolder*, Q_UINT32)) ); + disconnect( mSrcFolder, TQT_SIGNAL(closed()), + this, TQT_SLOT(folderClosedOrExpunged()) ); + disconnect( mSrcFolder, TQT_SIGNAL(expunged(KMFolder*)), + this, TQT_SLOT(folderClosedOrExpunged()) ); mSrcFolder->close("actionschedsrc"); } mSrcFolder = srcFolder; @@ -170,21 +170,21 @@ void ActionScheduler::setSourceFolder( KMFolder *srcFolder ) for (i = 0; i < mSrcFolder->count(); ++i) enqueue( mSrcFolder->getMsgBase( i )->getMsgSerNum() ); if (mSrcFolder) { - connect( mSrcFolder, SIGNAL(msgAdded(KMFolder*, Q_UINT32)), - this, SLOT(msgAdded(KMFolder*, Q_UINT32)) ); - connect( mSrcFolder, SIGNAL(closed()), - this, SLOT(folderClosedOrExpunged()) ); - connect( mSrcFolder, SIGNAL(expunged(KMFolder*)), - this, SLOT(folderClosedOrExpunged()) ); + connect( mSrcFolder, TQT_SIGNAL(msgAdded(KMFolder*, Q_UINT32)), + this, TQT_SLOT(msgAdded(KMFolder*, Q_UINT32)) ); + connect( mSrcFolder, TQT_SIGNAL(closed()), + this, TQT_SLOT(folderClosedOrExpunged()) ); + connect( mSrcFolder, TQT_SIGNAL(expunged(KMFolder*)), + this, TQT_SLOT(folderClosedOrExpunged()) ); } } -void ActionScheduler::setFilterList( QValueList<KMFilter*> filters ) +void ActionScheduler::setFilterList( TQValueList<KMFilter*> filters ) { mFiltersAreQueued = true; mQueuedFilters.clear(); - QValueList<KMFilter*>::Iterator it = filters.begin(); + TQValueList<KMFilter*>::Iterator it = filters.begin(); for (; it != filters.end(); ++it) mQueuedFilters.append( **it ); if (!mExecuting) { @@ -221,7 +221,7 @@ int ActionScheduler::tempOpenFolder( KMFolder* aFolder ) void ActionScheduler::tempCloseFolders() { // close temp opened folders - QValueListConstIterator<QGuardedPtr<KMFolder> > it; + TQValueListConstIterator<TQGuardedPtr<KMFolder> > it; for (it = mOpenFolders.begin(); it != mOpenFolders.end(); ++it) { KMFolder *folder = *it; if (folder) @@ -230,17 +230,17 @@ void ActionScheduler::tempCloseFolders() mOpenFolders.clear(); } -void ActionScheduler::execFilters(const QValueList<Q_UINT32> serNums) +void ActionScheduler::execFilters(const TQValueList<Q_UINT32> serNums) { - QValueListConstIterator<Q_UINT32> it; + TQValueListConstIterator<Q_UINT32> it; for (it = serNums.begin(); it != serNums.end(); ++it) execFilters( *it ); } -void ActionScheduler::execFilters(const QPtrList<KMMsgBase> msgList) +void ActionScheduler::execFilters(const TQPtrList<KMMsgBase> msgList) { KMMsgBase *msgBase; - QPtrList<KMMsgBase> list = msgList; + TQPtrList<KMMsgBase> list = msgList; for (msgBase = list.first(); msgBase; msgBase = list.next()) execFilters( msgBase->getMsgSerNum() ); } @@ -380,7 +380,7 @@ void ActionScheduler::finish() void ActionScheduler::fetchMessage() { - QValueListIterator<Q_UINT32> mFetchMessageIt = mFetchSerNums.begin(); + TQValueListIterator<Q_UINT32> mFetchMessageIt = mFetchSerNums.begin(); while (mFetchMessageIt != mFetchSerNums.end()) { if (!MessageProperty::transferInProgress(*mFetchMessageIt)) break; @@ -419,11 +419,11 @@ void ActionScheduler::fetchMessage() if (msg && msg->isComplete()) { messageFetched( msg ); } else if (msg) { - fetchTimeOutTime = QTime::currentTime(); + fetchTimeOutTime = TQTime::currentTime(); fetchTimeOutTimer->start( 60 * 1000, true ); FolderJob *job = msg->parent()->createJob( msg ); - connect( job, SIGNAL(messageRetrieved( KMMessage* )), - SLOT(messageFetched( KMMessage* )) ); + connect( job, TQT_SIGNAL(messageRetrieved( KMMessage* )), + TQT_SLOT(messageFetched( KMMessage* )) ); lastJob = job; job->start(); } else { @@ -450,7 +450,7 @@ void ActionScheduler::messageFetched( KMMessage *msg ) // Is the new serial number being set correctly then? if ((mSet & KMFilterMgr::Explicit) || (msg->headerField( "X-KMail-Filtered" ).isEmpty())) { - QString serNumS; + TQString serNumS; serNumS.setNum( msg->getMsgSerNum() ); KMMessage *newMsg = new KMMessage; newMsg->fromString(msg->asString()); @@ -563,8 +563,8 @@ void ActionScheduler::processMessage() } if (msg) { FolderJob *job = msg->parent()->createJob( msg ); - connect( job, SIGNAL(messageRetrieved( KMMessage* )), - SLOT(messageRetrieved( KMMessage* )) ); + connect( job, TQT_SIGNAL(messageRetrieved( KMMessage* )), + TQT_SLOT(messageRetrieved( KMMessage* )) ); job->start(); } else { mExecuting = false; @@ -595,7 +595,7 @@ void ActionScheduler::filterMessage() // filter is applicable if ( FilterLog::instance()->isLogging() ) { - QString logText( i18n( "<b>Evaluating filter rules:</b> " ) ); + TQString logText( i18n( "<b>Evaluating filter rules:</b> " ) ); logText.append( (*mFilterIt).pattern()->asString() ); FilterLog::instance()->add( logText, FilterLog::patternDesc ); } @@ -624,7 +624,7 @@ void ActionScheduler::actionMessage(KMFilterAction::ReturnCode res) KMMessage *msg = message( *mMessageIt ); if (msg) { if ( FilterLog::instance()->isLogging() ) { - QString logText( i18n( "<b>Applying filter action:</b> %1" ) + TQString logText( i18n( "<b>Applying filter action:</b> %1" ) .arg( mFilterAction->displayString() ) ); FilterLog::instance()->add( logText, FilterLog::appliedAction ); } @@ -651,7 +651,7 @@ void ActionScheduler::moveMessage() MessageProperty::setTransferInProgress( *mMessageIt, false, true ); KMMessage *msg = message( *mMessageIt ); KMFolder *folder = MessageProperty::filterFolder( *mMessageIt ); - QString serNumS = msg->headerField( "X-KMail-Filtered" ); + TQString serNumS = msg->headerField( "X-KMail-Filtered" ); if (!serNumS.isEmpty()) mOriginalSerNum = serNumS.toUInt(); else @@ -687,10 +687,10 @@ void ActionScheduler::moveMessage() if (msg && folder && kmkernel->folderIsTrash( folder )) KMFilterAction::sendMDN( msg, KMime::MDN::Deleted ); - timeOutTime = QTime::currentTime(); + timeOutTime = TQTime::currentTime(); KMCommand *cmd = new KMMoveCommand( folder, msg ); - connect( cmd, SIGNAL( completed( KMCommand * ) ), - this, SLOT( moveMessageFinished( KMCommand * ) ) ); + connect( cmd, TQT_SIGNAL( completed( KMCommand * ) ), + this, TQT_SLOT( moveMessageFinished( KMCommand * ) ) ); cmd->start(); // sometimes the move command doesn't complete so time out after a minute // and move onto the next message @@ -727,16 +727,16 @@ void ActionScheduler::moveMessageFinished( KMCommand *command ) if (mResult == ResultOk) { mExecutingLock = false; if (cmd) - connect( cmd, SIGNAL( completed( KMCommand * ) ), - this, SLOT( processMessage() ) ); + connect( cmd, TQT_SIGNAL( completed( KMCommand * ) ), + this, TQT_SLOT( processMessage() ) ); else processMessageTimer->start( 0, true ); } else { // Note: An alternative to consider is just calling // finishTimer->start and returning if (cmd) - connect( cmd, SIGNAL( completed( KMCommand * ) ), - this, SLOT( finish() ) ); + connect( cmd, TQT_SIGNAL( completed( KMCommand * ) ), + this, TQT_SLOT( finish() ) ); else finishTimer->start( 0, true ); } @@ -758,8 +758,8 @@ void ActionScheduler::timeOut() // Note: This is a good place for a debug statement assert( lastCommand ); // sometimes imap jobs seem to just stall so give up and move on - disconnect( lastCommand, SIGNAL( completed( KMCommand * ) ), - this, SLOT( moveMessageFinished( KMCommand * ) ) ); + disconnect( lastCommand, TQT_SIGNAL( completed( KMCommand * ) ), + this, TQT_SLOT( moveMessageFinished( KMCommand * ) ) ); lastCommand = 0; mExecutingLock = false; mExecuting = false; @@ -773,41 +773,41 @@ void ActionScheduler::fetchTimeOut() // Note: This is a good place for a debug statement assert( lastJob ); // sometimes imap jobs seem to just stall so give up and move on - disconnect( lastJob, SIGNAL(messageRetrieved( KMMessage* )), - this, SLOT(messageFetched( KMMessage* )) ); + disconnect( lastJob, TQT_SIGNAL(messageRetrieved( KMMessage* )), + this, TQT_SLOT(messageFetched( KMMessage* )) ); lastJob->kill(); lastJob = 0; fetchMessageTimer->start( 0, true ); } -QString ActionScheduler::debug() +TQString ActionScheduler::debug() { - QString res; - QValueList<ActionScheduler*>::iterator it; + TQString res; + TQValueList<ActionScheduler*>::iterator it; int i = 1; for ( it = schedulerList->begin(); it != schedulerList->end(); ++it ) { - res.append( QString( "ActionScheduler #%1.\n" ).arg( i ) ); + res.append( TQString( "ActionScheduler #%1.\n" ).arg( i ) ); if ((*it)->mAccount && kmkernel->find( (*it)->mAccountId )) { - res.append( QString( "Account %1, Name %2.\n" ) + res.append( TQString( "Account %1, Name %2.\n" ) .arg( (*it)->mAccountId ) .arg( kmkernel->acctMgr()->find( (*it)->mAccountId )->name() ) ); } - res.append( QString( "mExecuting %1, " ).arg( (*it)->mExecuting ? "true" : "false" ) ); - res.append( QString( "mExecutingLock %1, " ).arg( (*it)->mExecutingLock ? "true" : "false" ) ); - res.append( QString( "mFetchExecuting %1.\n" ).arg( (*it)->mFetchExecuting ? "true" : "false" ) ); - res.append( QString( "mOriginalSerNum %1.\n" ).arg( (*it)->mOriginalSerNum ) ); - res.append( QString( "mMessageIt %1.\n" ).arg( ((*it)->mMessageIt != 0) ? *(*it)->mMessageIt : 0 ) ); - res.append( QString( "mSerNums count %1, " ).arg( (*it)->mSerNums.count() ) ); - res.append( QString( "mFetchSerNums count %1.\n" ).arg( (*it)->mFetchSerNums.count() ) ); - res.append( QString( "mResult " ) ); + res.append( TQString( "mExecuting %1, " ).arg( (*it)->mExecuting ? "true" : "false" ) ); + res.append( TQString( "mExecutingLock %1, " ).arg( (*it)->mExecutingLock ? "true" : "false" ) ); + res.append( TQString( "mFetchExecuting %1.\n" ).arg( (*it)->mFetchExecuting ? "true" : "false" ) ); + res.append( TQString( "mOriginalSerNum %1.\n" ).arg( (*it)->mOriginalSerNum ) ); + res.append( TQString( "mMessageIt %1.\n" ).arg( ((*it)->mMessageIt != 0) ? *(*it)->mMessageIt : 0 ) ); + res.append( TQString( "mSerNums count %1, " ).arg( (*it)->mSerNums.count() ) ); + res.append( TQString( "mFetchSerNums count %1.\n" ).arg( (*it)->mFetchSerNums.count() ) ); + res.append( TQString( "mResult " ) ); if ((*it)->mResult == ResultOk) - res.append( QString( "ResultOk.\n" ) ); + res.append( TQString( "ResultOk.\n" ) ); else if ((*it)->mResult == ResultError) - res.append( QString( "ResultError.\n" ) ); + res.append( TQString( "ResultError.\n" ) ); else if ((*it)->mResult == ResultCriticalError) - res.append( QString( "ResultCriticalError.\n" ) ); + res.append( TQString( "ResultCriticalError.\n" ) ); else - res.append( QString( "Unknown.\n" ) ); + res.append( TQString( "Unknown.\n" ) ); ++i; } |