diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kmail/cachedimapjob.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/cachedimapjob.cpp')
-rw-r--r-- | kmail/cachedimapjob.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/kmail/cachedimapjob.cpp b/kmail/cachedimapjob.cpp index 8c6339612..3b8ff4115 100644 --- a/kmail/cachedimapjob.cpp +++ b/kmail/cachedimapjob.cpp @@ -57,35 +57,35 @@ namespace KMail { // Get messages -CachedImapJob::CachedImapJob( const QValueList<MsgForDownload>& msgs, +CachedImapJob::CachedImapJob( const TQValueList<MsgForDownload>& msgs, JobType type, KMFolderCachedImap* folder ) : FolderJob( type ), mFolder( folder ), mMsgsForDownload( msgs ), mTotalBytes(0), mMsg(0), mParentFolder( 0 ) { - QValueList<MsgForDownload>::ConstIterator it = msgs.begin(); + TQValueList<MsgForDownload>::ConstIterator it = msgs.begin(); for ( ; it != msgs.end() ; ++it ) mTotalBytes += (*it).size; } // Put messages -CachedImapJob::CachedImapJob( const QPtrList<KMMessage>& msgs, JobType type, +CachedImapJob::CachedImapJob( const TQPtrList<KMMessage>& msgs, JobType type, KMFolderCachedImap* folder ) - : FolderJob( msgs, QString::null, type, folder?folder->folder():0 ), mFolder( folder ), + : FolderJob( msgs, TQString::null, type, folder?folder->folder():0 ), mFolder( folder ), mTotalBytes( msgs.count() ), // we abuse it as "total number of messages" mMsg( 0 ), mParentFolder( 0 ) { } -CachedImapJob::CachedImapJob( const QValueList<unsigned long>& msgs, +CachedImapJob::CachedImapJob( const TQValueList<unsigned long>& msgs, JobType type, KMFolderCachedImap* folder ) - : FolderJob( QPtrList<KMMessage>(), QString::null, type, folder?folder->folder():0 ), + : FolderJob( TQPtrList<KMMessage>(), TQString::null, type, folder?folder->folder():0 ), mFolder( folder ), mSerNumMsgList( msgs ), mTotalBytes( msgs.count() ), mMsg( 0 ), mParentFolder ( 0 ) { } // Add sub folders -CachedImapJob::CachedImapJob( const QValueList<KMFolderCachedImap*>& fList, +CachedImapJob::CachedImapJob( const TQValueList<KMFolderCachedImap*>& fList, JobType type, KMFolderCachedImap* folder ) : FolderJob( type ), mFolder( folder ), mFolderList( fList ), mMsg( 0 ), mParentFolder ( 0 ) @@ -93,7 +93,7 @@ CachedImapJob::CachedImapJob( const QValueList<KMFolderCachedImap*>& fList, } // Rename folder -CachedImapJob::CachedImapJob( const QString& string1, JobType type, +CachedImapJob::CachedImapJob( const TQString& string1, JobType type, KMFolderCachedImap* folder ) : FolderJob( type ), mFolder(folder), mMsg( 0 ), mString( string1 ), mParentFolder ( 0 ) @@ -103,7 +103,7 @@ CachedImapJob::CachedImapJob( const QString& string1, JobType type, } // Delete folders or messages -CachedImapJob::CachedImapJob( const QStringList& foldersOrMsgs, JobType type, +CachedImapJob::CachedImapJob( const TQStringList& foldersOrMsgs, JobType type, KMFolderCachedImap* folder ) : FolderJob( type ), mFolder( folder ), mFoldersOrMessages( foldersOrMsgs ), mMsg( 0 ), mParentFolder( 0 ) @@ -155,11 +155,11 @@ void CachedImapJob::execute() */ if ( mAccount->groupwareType() == KMAcctCachedImap::GroupwareScalix ) { if ( !mAccount->sentCustomLoginCommand() ) { - QByteArray packedArgs; - QDataStream stream( packedArgs, IO_WriteOnly ); + TQByteArray packedArgs; + TQDataStream stream( packedArgs, IO_WriteOnly ); - const QString command = QString( "X-SCALIX-ID " ); - const QString argument = QString( "(\"name\" \"Evolution\" \"version\" \"2.10.0\")" ); + const TQString command = TQString( "X-SCALIX-ID " ); + const TQString argument = TQString( "(\"name\" \"Evolution\" \"version\" \"2.10.0\")" ); stream << (int) 'X' << 'N' << command << argument; @@ -200,11 +200,11 @@ void CachedImapJob::listMessages() ImapAccountBase::jobData jd( url.url(), mFolder->folder() ); jd.cancellable = true; mAccount->insertJob( job, jd ); - connect( job, SIGNAL( result(KIO::Job *) ), - this, SLOT( slotListMessagesResult( KIO::Job* ) ) ); + connect( job, TQT_SIGNAL( result(KIO::Job *) ), + this, TQT_SLOT( slotListMessagesResult( KIO::Job* ) ) ); // send the data directly for KMFolderCachedImap - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - mFolder, SLOT( slotGetMessagesData( KIO::Job* , const QByteArray& ) ) ); + connect( job, TQT_SIGNAL( data( KIO::Job*, const TQByteArray& ) ), + mFolder, TQT_SLOT( slotGetMessagesData( KIO::Job* , const TQByteArray& ) ) ); } void CachedImapJob::slotDeleteNextMessages( KIO::Job* job ) @@ -230,32 +230,32 @@ void CachedImapJob::slotDeleteNextMessages( KIO::Job* job ) return; } - QString uids = mFoldersOrMessages.front(); mFoldersOrMessages.pop_front(); + TQString uids = mFoldersOrMessages.front(); mFoldersOrMessages.pop_front(); KURL url = mAccount->getUrl(); url.setPath( mFolder->imapPath() + - QString::fromLatin1(";UID=%1").arg(uids) ); + TQString::fromLatin1(";UID=%1").arg(uids) ); KIO::SimpleJob *simpleJob = KIO::file_delete( url, false ); KIO::Scheduler::assignJobToSlave( mAccount->slave(), simpleJob ); ImapAccountBase::jobData jd( url.url(), mFolder->folder() ); mAccount->insertJob( simpleJob, jd ); - connect( simpleJob, SIGNAL( result(KIO::Job *) ), - this, SLOT( slotDeleteNextMessages(KIO::Job *) ) ); + connect( simpleJob, TQT_SIGNAL( result(KIO::Job *) ), + this, TQT_SLOT( slotDeleteNextMessages(KIO::Job *) ) ); } void CachedImapJob::expungeFolder() { KURL url = mAccount->getUrl(); // Special URL that means EXPUNGE - url.setPath( mFolder->imapPath() + QString::fromLatin1(";UID=*") ); + url.setPath( mFolder->imapPath() + TQString::fromLatin1(";UID=*") ); KIO::SimpleJob *job = KIO::file_delete( url, false ); KIO::Scheduler::assignJobToSlave( mAccount->slave(), job ); ImapAccountBase::jobData jd( url.url(), mFolder->folder() ); mAccount->insertJob( job, jd ); - connect( job, SIGNAL( result(KIO::Job *) ), - this, SLOT( slotExpungeResult(KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result(KIO::Job *) ), + this, TQT_SLOT( slotExpungeResult(KIO::Job *) ) ); } void CachedImapJob::slotExpungeResult( KIO::Job * job ) @@ -341,7 +341,7 @@ void CachedImapJob::slotGetNextMessage(KIO::Job * job) if( mfd.flags > 0 ) KMFolderImap::flagsToStatus(mMsg, mfd.flags, true, GlobalSettings::allowLocalFlags() ? mFolder->permanentFlags() : INT_MAX); KURL url = mAccount->getUrl(); - url.setPath(mFolder->imapPath() + QString(";UID=%1;SECTION=BODY.PEEK[]").arg(mfd.uid)); + url.setPath(mFolder->imapPath() + TQString(";UID=%1;SECTION=BODY.PEEK[]").arg(mfd.uid)); ImapAccountBase::jobData jd( url.url(), mFolder->folder() ); jd.cancellable = true; @@ -349,12 +349,12 @@ void CachedImapJob::slotGetNextMessage(KIO::Job * job) KIO::SimpleJob *simpleJob = KIO::get(url, false, false); KIO::Scheduler::assignJobToSlave(mAccount->slave(), simpleJob); mAccount->insertJob(simpleJob, jd); - connect(simpleJob, SIGNAL(processedSize(KIO::Job *, KIO::filesize_t)), - this, SLOT(slotProcessedSize(KIO::Job *, KIO::filesize_t))); - connect(simpleJob, SIGNAL(result(KIO::Job *)), - this, SLOT(slotGetNextMessage(KIO::Job *))); - connect(simpleJob, SIGNAL(data(KIO::Job *, const QByteArray &)), - mFolder, SLOT(slotSimpleData(KIO::Job *, const QByteArray &))); + connect(simpleJob, TQT_SIGNAL(processedSize(KIO::Job *, KIO::filesize_t)), + this, TQT_SLOT(slotProcessedSize(KIO::Job *, KIO::filesize_t))); + connect(simpleJob, TQT_SIGNAL(result(KIO::Job *)), + this, TQT_SLOT(slotGetNextMessage(KIO::Job *))); + connect(simpleJob, TQT_SIGNAL(data(KIO::Job *, const TQByteArray &)), + mFolder, TQT_SLOT(slotSimpleData(KIO::Job *, const TQByteArray &))); } void CachedImapJob::slotProcessedSize(KIO::Job *, KIO::filesize_t processed) @@ -394,17 +394,17 @@ void CachedImapJob::slotPutNextMessage() } KURL url = mAccount->getUrl(); - QString flags = KMFolderImap::statusToFlags( mMsg->status(), mFolder->permanentFlags() ); + TQString flags = KMFolderImap::statusToFlags( mMsg->status(), mFolder->permanentFlags() ); url.setPath( mFolder->imapPath() + ";SECTION=" + flags ); ImapAccountBase::jobData jd( url.url(), mFolder->folder() ); mMsg->setUID( 0 ); // for the index - QCString cstr(mMsg->asString()); + TQCString cstr(mMsg->asString()); int a = cstr.find("\nX-UID: "); int b = cstr.find('\n', a); if (a != -1 && b != -1 && cstr.find("\n\n") > a) cstr.remove(a, b-a); - QCString mData(cstr.length() + cstr.contains('\n')); + TQCString mData(cstr.length() + cstr.contains('\n')); unsigned int i = 0; for( char *ch = cstr.data(); *ch; ch++ ) { if ( *ch == '\n' ) { @@ -420,20 +420,20 @@ void CachedImapJob::slotPutNextMessage() KIO::SimpleJob *simpleJob = KIO::put(url, 0, false, false, false); KIO::Scheduler::assignJobToSlave(mAccount->slave(), simpleJob); mAccount->insertJob(simpleJob, jd); - connect( simpleJob, SIGNAL( result(KIO::Job *) ), - SLOT( slotPutMessageResult(KIO::Job *) ) ); - connect( simpleJob, SIGNAL( dataReq(KIO::Job *, QByteArray &) ), - SLOT( slotPutMessageDataReq(KIO::Job *, QByteArray &) ) ); - connect( simpleJob, SIGNAL( data(KIO::Job *, const QByteArray &) ), - mFolder, SLOT( slotSimpleData(KIO::Job *, const QByteArray &) ) ); - connect( simpleJob, SIGNAL(infoMessage(KIO::Job *, const QString &)), - SLOT(slotPutMessageInfoData(KIO::Job *, const QString &)) ); + connect( simpleJob, TQT_SIGNAL( result(KIO::Job *) ), + TQT_SLOT( slotPutMessageResult(KIO::Job *) ) ); + connect( simpleJob, TQT_SIGNAL( dataReq(KIO::Job *, TQByteArray &) ), + TQT_SLOT( slotPutMessageDataReq(KIO::Job *, TQByteArray &) ) ); + connect( simpleJob, TQT_SIGNAL( data(KIO::Job *, const TQByteArray &) ), + mFolder, TQT_SLOT( slotSimpleData(KIO::Job *, const TQByteArray &) ) ); + connect( simpleJob, TQT_SIGNAL(infoMessage(KIO::Job *, const TQString &)), + TQT_SLOT(slotPutMessageInfoData(KIO::Job *, const TQString &)) ); } //----------------------------------------------------------------------------- // TODO: port to KIO::StoredTransferJob once it's ok to require kdelibs-3.3 -void CachedImapJob::slotPutMessageDataReq(KIO::Job *job, QByteArray &data) +void CachedImapJob::slotPutMessageDataReq(KIO::Job *job, TQByteArray &data) { KMAcctCachedImap::JobIterator it = mAccount->findJob(job); if ( it == mAccount->jobsEnd() ) { // Shouldn't happen @@ -452,7 +452,7 @@ void CachedImapJob::slotPutMessageDataReq(KIO::Job *job, QByteArray &data) } //---------------------------------------------------------------------------- -void CachedImapJob::slotPutMessageInfoData(KIO::Job *job, const QString &data) +void CachedImapJob::slotPutMessageInfoData(KIO::Job *job, const TQString &data) { KMFolderCachedImap * imapFolder = static_cast<KMFolderCachedImap*>(mDestFolder->storage()); KMAcctCachedImap *account = imapFolder->account(); @@ -535,7 +535,7 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job ) static_cast<KMFolderCachedImap*>((*it).parent->storage())->setSilentUpload( false ); if ( job->error() && !silentUpload ) { - QString myError = "<p><b>" + i18n("Error while uploading folder") + TQString myError = "<p><b>" + i18n("Error while uploading folder") + "</b></p><p>" + i18n("Could not make the folder <b>%1</b> on the server.").arg((*it).items[0]) + "</p><p>" + i18n("This could be because you do not have permission to do this, or because the folder is already present on the server; the error message from the server communication is here:") + "</p>"; mAccount->handleJobError( job, myError ); @@ -550,7 +550,7 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job ) Q_ASSERT( storage ); Q_ASSERT( parentStorage ); if ( storage->imapPath().isEmpty() ) { - QString path = mAccount->createImapPath( parentStorage->imapPath(), storage->folder()->name() ); + TQString path = mAccount->createImapPath( parentStorage->imapPath(), storage->folder()->name() ); if ( !storage->imapPathForCreation().isEmpty() ) path = storage->imapPathForCreation(); storage->setImapPath( path ); @@ -569,7 +569,7 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job ) KMFolderCachedImap *folder = mFolderList.front(); mFolderList.pop_front(); KURL url = mAccount->getUrl(); - QString path = mAccount->createImapPath( mFolder->imapPath(), + TQString path = mAccount->createImapPath( mFolder->imapPath(), folder->folder()->name() ); if ( !folder->imapPathForCreation().isEmpty() ) { // the folder knows it's namespace @@ -587,14 +587,14 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job ) KIO::SimpleJob *simpleJob = KIO::mkdir(url); KIO::Scheduler::assignJobToSlave(mAccount->slave(), simpleJob); mAccount->insertJob(simpleJob, jd); - connect( simpleJob, SIGNAL(result(KIO::Job *)), - this, SLOT(slotAddNextSubfolder(KIO::Job *)) ); + connect( simpleJob, TQT_SIGNAL(result(KIO::Job *)), + this, TQT_SLOT(slotAddNextSubfolder(KIO::Job *)) ); } else { - QByteArray packedArgs; - QDataStream stream( packedArgs, IO_WriteOnly ); + TQByteArray packedArgs; + TQDataStream stream( packedArgs, IO_WriteOnly ); - const QString command = QString( "X-CREATE-SPECIAL" ); - const QString argument = QString( "%1 %2" ).arg( Scalix::Utils::contentsTypeToScalixId( folder->contentsType() ) ) + const TQString command = TQString( "X-CREATE-SPECIAL" ); + const TQString argument = TQString( "%1 %2" ).arg( Scalix::Utils::contentsTypeToScalixId( folder->contentsType() ) ) .arg( path ); stream << (int) 'X' << 'N' << command << argument; @@ -605,8 +605,8 @@ void CachedImapJob::slotAddNextSubfolder( KIO::Job * job ) KIO::SimpleJob *simpleJob = KIO::special( url.url(), packedArgs, false ); KIO::Scheduler::assignJobToSlave(mAccount->slave(), simpleJob); mAccount->insertJob(simpleJob, jd); - connect( simpleJob, SIGNAL(result(KIO::Job *)), - this, SLOT(slotAddNextSubfolder(KIO::Job *)) ); + connect( simpleJob, TQT_SIGNAL(result(KIO::Job *)), + this, TQT_SLOT(slotAddNextSubfolder(KIO::Job *)) ); } } @@ -636,7 +636,7 @@ void CachedImapJob::slotDeleteNextFolder( KIO::Job *job ) return; } - QString folderPath = mFoldersOrMessages.front(); + TQString folderPath = mFoldersOrMessages.front(); mFoldersOrMessages.pop_front(); KURL url = mAccount->getUrl(); url.setPath(folderPath); @@ -645,8 +645,8 @@ void CachedImapJob::slotDeleteNextFolder( KIO::Job *job ) KIO::SimpleJob *simpleJob = KIO::file_delete(url, false); KIO::Scheduler::assignJobToSlave(mAccount->slave(), simpleJob); mAccount->insertJob(simpleJob, jd); - connect( simpleJob, SIGNAL( result(KIO::Job *) ), - SLOT( slotDeleteNextFolder(KIO::Job *) ) ); + connect( simpleJob, TQT_SIGNAL( result(KIO::Job *) ), + TQT_SLOT( slotDeleteNextFolder(KIO::Job *) ) ); } void CachedImapJob::checkUidValidity() @@ -660,10 +660,10 @@ void CachedImapJob::checkUidValidity() KIO::SimpleJob *job = KIO::get( url, false, false ); KIO::Scheduler::assignJobToSlave( mAccount->slave(), job ); mAccount->insertJob( job, jd ); - connect( job, SIGNAL(result(KIO::Job *)), - SLOT(slotCheckUidValidityResult(KIO::Job *)) ); - connect( job, SIGNAL(data(KIO::Job *, const QByteArray &)), - mFolder, SLOT(slotSimpleData(KIO::Job *, const QByteArray &))); + connect( job, TQT_SIGNAL(result(KIO::Job *)), + TQT_SLOT(slotCheckUidValidityResult(KIO::Job *)) ); + connect( job, TQT_SIGNAL(data(KIO::Job *, const TQByteArray &)), + mFolder, TQT_SLOT(slotSimpleData(KIO::Job *, const TQByteArray &))); } void CachedImapJob::slotCheckUidValidityResult(KIO::Job * job) @@ -682,7 +682,7 @@ void CachedImapJob::slotCheckUidValidityResult(KIO::Job * job) } // Check the uidValidity - QCString cstr((*it).data.data(), (*it).data.size() + 1); + TQCString cstr((*it).data.data(), (*it).data.size() + 1); int a = cstr.find("X-uidValidity: "); if (a < 0) { // Something is seriously rotten here! @@ -693,7 +693,7 @@ void CachedImapJob::slotCheckUidValidityResult(KIO::Job * job) else { int b = cstr.find("\r\n", a); if ( (b - a - 15) >= 0 ) { - QString uidv = cstr.mid(a + 15, b - a - 15); + TQString uidv = cstr.mid(a + 15, b - a - 15); // kdDebug(5006) << "New uidv = " << uidv << ", old uidv = " // << mFolder->uidValidity() << endl; if( !mFolder->uidValidity().isEmpty() && mFolder->uidValidity() != uidv ) { @@ -726,7 +726,7 @@ void CachedImapJob::slotCheckUidValidityResult(KIO::Job * job) } -void CachedImapJob::renameFolder( const QString &newName ) +void CachedImapJob::renameFolder( const TQString &newName ) { // Set the source URL KURL urlSrc = mAccount->getUrl(); @@ -734,7 +734,7 @@ void CachedImapJob::renameFolder( const QString &newName ) // Set the destination URL - this is a bit trickier KURL urlDst = mAccount->getUrl(); - QString imapPath( mFolder->imapPath() ); + TQString imapPath( mFolder->imapPath() ); // Destination url = old imappath - oldname + new name imapPath.truncate( imapPath.length() - mFolder->folder()->name().length() - 1); imapPath += newName + '/'; @@ -746,12 +746,12 @@ void CachedImapJob::renameFolder( const QString &newName ) KIO::SimpleJob *simpleJob = KIO::rename( urlSrc, urlDst, false ); KIO::Scheduler::assignJobToSlave( mAccount->slave(), simpleJob ); mAccount->insertJob( simpleJob, jd ); - connect( simpleJob, SIGNAL(result(KIO::Job *)), - SLOT(slotRenameFolderResult(KIO::Job *)) ); + connect( simpleJob, TQT_SIGNAL(result(KIO::Job *)), + TQT_SLOT(slotRenameFolderResult(KIO::Job *)) ); } -static void renameChildFolders( KMFolderDir* dir, const QString& oldPath, - const QString& newPath ) +static void renameChildFolders( KMFolderDir* dir, const TQString& oldPath, + const TQString& newPath ) { if( dir ) { KMFolderNode *node = dir->first(); @@ -762,7 +762,7 @@ static void renameChildFolders( KMFolderDir* dir, const QString& oldPath, if ( !imapFolder->imapPath().isEmpty() ) // Only rename folders that have been accepted by the server if( imapFolder->imapPath().find( oldPath ) == 0 ) { - QString p = imapFolder->imapPath(); + TQString p = imapFolder->imapPath(); p = p.mid( oldPath.length() ); p.prepend( newPath ); imapFolder->setImapPath( p ); @@ -785,7 +785,7 @@ void CachedImapJob::slotRenameFolderResult( KIO::Job *job ) if( job->error() ) { // Error, revert label change - QMap<QString, KMAcctCachedImap::RenamedFolder>::ConstIterator renit = mAccount->renamedFolders().find( mFolder->imapPath() ); + TQMap<TQString, KMAcctCachedImap::RenamedFolder>::ConstIterator renit = mAccount->renamedFolders().find( mFolder->imapPath() ); Q_ASSERT( renit != mAccount->renamedFolders().end() ); if ( renit != mAccount->renamedFolders().end() ) { mFolder->folder()->setLabel( (*renit).mOldLabel ); @@ -795,14 +795,14 @@ void CachedImapJob::slotRenameFolderResult( KIO::Job *job ) } else { // Okay, the folder seems to be renamed on the server, // now rename it on disk - QString oldName = mFolder->name(); - QString oldPath = mFolder->imapPath(); + TQString oldName = mFolder->name(); + TQString oldPath = mFolder->imapPath(); mAccount->removeRenamedFolder( oldPath ); mFolder->setImapPath( (*it).path ); mFolder->FolderStorage::rename( (*it).url ); if( oldPath.endsWith( "/" ) ) oldPath.truncate( oldPath.length() -1 ); - QString newPath = mFolder->imapPath(); + TQString newPath = mFolder->imapPath(); if( newPath.endsWith( "/" ) ) newPath.truncate( newPath.length() -1 ); renameChildFolders( mFolder->folder()->child(), oldPath, newPath ); kmkernel->dimapFolderMgr()->contentsChanged(); |