summaryrefslogtreecommitdiffstats
path: root/kmail/searchjob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmail/searchjob.cpp')
-rw-r--r--kmail/searchjob.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/kmail/searchjob.cpp b/kmail/searchjob.cpp
index dde86495f..89dde8214 100644
--- a/kmail/searchjob.cpp
+++ b/kmail/searchjob.cpp
@@ -46,7 +46,7 @@ using KPIM::ProgressManager;
#include <klocale.h>
#include <kmessagebox.h>
-#include <qstylesheet.h>
+#include <tqstylesheet.h>
namespace KMail {
@@ -77,47 +77,47 @@ void SearchJob::execute()
void SearchJob::searchCompleteFolder()
{
// generate imap search command and save local search patterns
- QString searchString = searchStringFromPattern( mSearchPattern );
+ TQString searchString = searchStringFromPattern( mSearchPattern );
if ( searchString.isEmpty() ) // skip imap search and download the messages
- return slotSearchData( 0, QString::null );
+ return slotSearchData( 0, TQString::null );
// do the IMAP search
KURL url = mAccount->getUrl();
url.setPath( mFolder->imapPath() + ";SECTION=" + searchString );
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int) 'E' << url;
KIO::SimpleJob *job = KIO::special( url, packedArgs, false );
- if ( mFolder->imapPath() != QString( "/" ) )
+ if ( mFolder->imapPath() != TQString( "/" ) )
{
KIO::Scheduler::assignJobToSlave( mAccount->slave(), job );
- connect( job, SIGNAL( infoMessage( KIO::Job*, const QString& ) ),
- SLOT( slotSearchData( KIO::Job*, const QString& ) ) );
- connect( job, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotSearchResult( KIO::Job * ) ) );
+ connect( job, TQT_SIGNAL( infoMessage( KIO::Job*, const TQString& ) ),
+ TQT_SLOT( slotSearchData( KIO::Job*, const TQString& ) ) );
+ connect( job, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotSearchResult( KIO::Job * ) ) );
}
else
{ // for the "/ folder" of an imap account, searching blocks the kioslave
- slotSearchData( job, QString() );
+ slotSearchData( job, TQString() );
slotSearchResult( job );
}
}
//-----------------------------------------------------------------------------
-QString SearchJob::searchStringFromPattern( const KMSearchPattern* pattern )
+TQString SearchJob::searchStringFromPattern( const KMSearchPattern* pattern )
{
- QStringList parts;
+ TQStringList parts;
// this is for the search pattern that can only be done local
mLocalSearchPattern = new KMSearchPattern();
mLocalSearchPattern->setOp( pattern->op() );
- for ( QPtrListIterator<KMSearchRule> it( *pattern ) ; it.current() ; ++it )
+ for ( TQPtrListIterator<KMSearchRule> it( *pattern ) ; it.current() ; ++it )
{
// construct an imap search command
bool accept = true;
- QString result;
- QString field = (*it)->field();
+ TQString result;
+ TQString field = (*it)->field();
// check if the operation is supported
if ( (*it)->function() == KMSearchRule::FuncContainsNot ) {
result = "NOT ";
@@ -161,7 +161,7 @@ QString SearchJob::searchStringFromPattern( const KMSearchPattern* pattern )
}
}
- QString search;
+ TQString search;
if ( !parts.isEmpty() ) {
if ( pattern->op() == KMSearchPattern::OpOr && parts.size() > 1 ) {
search = "(OR " + parts.join(" ") + ")";
@@ -176,7 +176,7 @@ QString SearchJob::searchStringFromPattern( const KMSearchPattern* pattern )
}
//-----------------------------------------------------------------------------
-void SearchJob::slotSearchData( KIO::Job* job, const QString& data )
+void SearchJob::slotSearchData( KIO::Job* job, const TQString& data )
{
if ( job && job->error() ) {
// error is handled in slotSearchResult
@@ -186,12 +186,12 @@ void SearchJob::slotSearchData( KIO::Job* job, const QString& data )
if ( mLocalSearchPattern->isEmpty() && data.isEmpty() )
{
// no local search and the server found nothing
- QValueList<Q_UINT32> serNums;
+ TQValueList<Q_UINT32> serNums;
emit searchDone( serNums, mSearchPattern, true );
} else
{
// remember the uids the server found
- mImapSearchHits = QStringList::split( " ", data );
+ mImapSearchHits = TQStringList::split( " ", data );
if ( canMapAllUIDs() )
{
@@ -199,8 +199,8 @@ void SearchJob::slotSearchData( KIO::Job* job, const QString& data )
} else
{
// get the folder to make sure we have all messages
- connect ( mFolder, SIGNAL( folderComplete( KMFolderImap*, bool ) ),
- this, SLOT( slotSearchFolder()) );
+ connect ( mFolder, TQT_SIGNAL( folderComplete( KMFolderImap*, bool ) ),
+ this, TQT_SLOT( slotSearchFolder()) );
mFolder->getFolder();
}
}
@@ -209,7 +209,7 @@ void SearchJob::slotSearchData( KIO::Job* job, const QString& data )
//-----------------------------------------------------------------------------
bool SearchJob::canMapAllUIDs()
{
- for ( QStringList::Iterator it = mImapSearchHits.begin();
+ for ( TQStringList::Iterator it = mImapSearchHits.begin();
it != mImapSearchHits.end(); ++it )
{
if ( mFolder->serNumForUID( (*it).toULong() ) == 0 )
@@ -221,13 +221,13 @@ bool SearchJob::canMapAllUIDs()
//-----------------------------------------------------------------------------
void SearchJob::slotSearchFolder()
{
- disconnect ( mFolder, SIGNAL( folderComplete( KMFolderImap*, bool ) ),
- this, SLOT( slotSearchFolder()) );
+ disconnect ( mFolder, TQT_SIGNAL( folderComplete( KMFolderImap*, bool ) ),
+ this, TQT_SLOT( slotSearchFolder()) );
if ( mLocalSearchPattern->isEmpty() ) {
// pure imap search - now get the serial number for the UIDs
- QValueList<Q_UINT32> serNums;
- for ( QStringList::Iterator it = mImapSearchHits.begin();
+ TQValueList<Q_UINT32> serNums;
+ for ( TQStringList::Iterator it = mImapSearchHits.begin();
it != mImapSearchHits.end(); ++it )
{
ulong serNum = mFolder->serNumForUID( (*it).toULong() );
@@ -250,14 +250,14 @@ void SearchJob::slotSearchFolder()
bool needToDownload = needsDownload();
if ( needToDownload ) {
// so we need to download all messages and check
- QString question = i18n("To execute your search all messages of the folder %1 "
+ TQString question = i18n("To execute your search all messages of the folder %1 "
"have to be downloaded from the server. This may take some time. "
"Do you want to continue your search?").arg( mFolder->label() );
if ( KMessageBox::warningContinueCancel( 0, question,
i18n("Continue Search"), i18n("&Search"),
"continuedownloadingforsearch" ) != KMessageBox::Continue )
{
- QValueList<Q_UINT32> serNums;
+ TQValueList<Q_UINT32> serNums;
emit searchDone( serNums, mSearchPattern, true );
return;
}
@@ -267,12 +267,12 @@ void SearchJob::slotSearchFolder()
mProgress = ProgressManager::createProgressItem(
"ImapSearchDownload" + ProgressManager::getUniqueID(),
i18n("Downloading emails from IMAP server"),
- i18n( "URL: %1" ).arg( QStyleSheet::escape( mFolder->folder()->prettyURL() ) ),
+ i18n( "URL: %1" ).arg( TQStyleSheet::escape( mFolder->folder()->prettyURL() ) ),
true,
mAccount->useSSL() || mAccount->useTLS() );
mProgress->setTotalItems( numMsgs );
- connect ( mProgress, SIGNAL( progressItemCanceled( KPIM::ProgressItem*)),
- this, SLOT( slotAbortSearch( KPIM::ProgressItem* ) ) );
+ connect ( mProgress, TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem*)),
+ this, TQT_SLOT( slotAbortSearch( KPIM::ProgressItem* ) ) );
for ( unsigned int i = 0; i < numMsgs ; ++i ) {
KMMessage * msg = mFolder->getMsg( i );
@@ -280,8 +280,8 @@ void SearchJob::slotSearchFolder()
ImapJob *job = new ImapJob( msg );
job->setParentFolder( mFolder );
job->setParentProgressItem( mProgress );
- connect( job, SIGNAL(messageRetrieved(KMMessage*)),
- this, SLOT(slotSearchMessageArrived(KMMessage*)) );
+ connect( job, TQT_SIGNAL(messageRetrieved(KMMessage*)),
+ this, TQT_SLOT(slotSearchMessageArrived(KMMessage*)) );
job->start();
} else {
slotSearchMessageArrived( msg );
@@ -305,7 +305,7 @@ void SearchJob::slotSearchMessageArrived( KMMessage* msg )
// imap and local search have to match
if ( mLocalSearchPattern->matches( msg ) &&
( mImapSearchHits.isEmpty() ||
- mImapSearchHits.find( QString::number(msg->UID() ) ) != mImapSearchHits.end() ) ) {
+ mImapSearchHits.find( TQString::number(msg->UID() ) ) != mImapSearchHits.end() ) ) {
Q_UINT32 serNum = msg->getMsgSerNum();
mSearchSerNums.append( serNum );
matches = true;
@@ -313,7 +313,7 @@ void SearchJob::slotSearchMessageArrived( KMMessage* msg )
} else if ( mLocalSearchPattern->op() == KMSearchPattern::OpOr ) {
// imap or local search have to match
if ( mLocalSearchPattern->matches( msg ) ||
- mImapSearchHits.find( QString::number(msg->UID()) ) != mImapSearchHits.end() ) {
+ mImapSearchHits.find( TQString::number(msg->UID()) ) != mImapSearchHits.end() ) {
Q_UINT32 serNum = msg->getMsgSerNum();
mSearchSerNums.append( serNum );
matches = true;
@@ -352,7 +352,7 @@ void SearchJob::slotSearchResult( KIO::Job *job )
if ( mSerNum == 0 )
{
// folder
- QValueList<Q_UINT32> serNums;
+ TQValueList<Q_UINT32> serNums;
emit searchDone( serNums, mSearchPattern, true );
} else {
// message
@@ -364,11 +364,11 @@ void SearchJob::slotSearchResult( KIO::Job *job )
//-----------------------------------------------------------------------------
void SearchJob::searchSingleMessage()
{
- QString searchString = searchStringFromPattern( mSearchPattern );
+ TQString searchString = searchStringFromPattern( mSearchPattern );
if ( searchString.isEmpty() )
{
// no imap search
- slotSearchDataSingleMessage( 0, QString::null );
+ slotSearchDataSingleMessage( 0, TQString::null );
} else
{
// imap search
@@ -379,23 +379,23 @@ void SearchJob::searchSingleMessage()
KMMsgBase *mb = mFolder->getMsgBase( idx );
// only search for that UID
- searchString += " UID " + QString::number( mb->UID() );
+ searchString += " UID " + TQString::number( mb->UID() );
KURL url = mAccount->getUrl();
url.setPath( mFolder->imapPath() + ";SECTION=" + searchString );
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int) 'E' << url;
KIO::SimpleJob *job = KIO::special( url, packedArgs, false );
KIO::Scheduler::assignJobToSlave(mAccount->slave(), job);
- connect( job, SIGNAL(infoMessage(KIO::Job*,const QString&)),
- SLOT(slotSearchDataSingleMessage(KIO::Job*,const QString&)) );
- connect( job, SIGNAL(result(KIO::Job *)),
- SLOT(slotSearchResult(KIO::Job *)) );
+ connect( job, TQT_SIGNAL(infoMessage(KIO::Job*,const TQString&)),
+ TQT_SLOT(slotSearchDataSingleMessage(KIO::Job*,const TQString&)) );
+ connect( job, TQT_SIGNAL(result(KIO::Job *)),
+ TQT_SLOT(slotSearchResult(KIO::Job *)) );
}
}
//-----------------------------------------------------------------------------
-void SearchJob::slotSearchDataSingleMessage( KIO::Job* job, const QString& data )
+void SearchJob::slotSearchDataSingleMessage( KIO::Job* job, const TQString& data )
{
if ( job && job->error() ) {
// error is handled in slotSearchResult
@@ -408,7 +408,7 @@ void SearchJob::slotSearchDataSingleMessage( KIO::Job* job, const QString& data
return;
}
// remember what the server found
- mImapSearchHits = QStringList::split( " ", data );
+ mImapSearchHits = TQStringList::split( " ", data );
// add the local search
int idx = -1;
@@ -420,8 +420,8 @@ void SearchJob::slotSearchDataSingleMessage( KIO::Job* job, const QString& data
if ( needsDownload() ) {
ImapJob *job = new ImapJob( msg );
job->setParentFolder( mFolder );
- connect( job, SIGNAL(messageRetrieved(KMMessage*)),
- this, SLOT(slotSearchMessageArrived(KMMessage*)) );
+ connect( job, TQT_SIGNAL(messageRetrieved(KMMessage*)),
+ this, TQT_SLOT(slotSearchMessageArrived(KMMessage*)) );
job->start();
} else {
slotSearchMessageArrived( msg );
@@ -434,14 +434,14 @@ void SearchJob::slotAbortSearch( KPIM::ProgressItem* item )
if ( item )
item->setComplete();
mAccount->killAllJobs();
- QValueList<Q_UINT32> serNums;
+ TQValueList<Q_UINT32> serNums;
emit searchDone( serNums, mSearchPattern, true );
}
//-----------------------------------------------------------------------------
bool SearchJob::needsDownload()
{
- for ( QPtrListIterator<KMSearchRule> it( *mLocalSearchPattern ) ; it.current() ; ++it ) {
+ for ( TQPtrListIterator<KMSearchRule> it( *mLocalSearchPattern ) ; it.current() ; ++it ) {
if ( (*it)->field() != "<status>" ) {
return true;
}