summaryrefslogtreecommitdiffstats
path: root/kmail/kmsearchpattern.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmail/kmsearchpattern.cpp')
-rw-r--r--kmail/kmsearchpattern.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/kmail/kmsearchpattern.cpp b/kmail/kmsearchpattern.cpp
index 1b9e36530..bec476ef6 100644
--- a/kmail/kmsearchpattern.cpp
+++ b/kmail/kmsearchpattern.cpp
@@ -23,7 +23,7 @@ using KMail::FilterLog;
#include <kabc/stdaddressbook.h>
-#include <qregexp.h>
+#include <tqregexp.h>
#include <mimelib/string.h>
#include <mimelib/boyermor.h>
@@ -70,7 +70,7 @@ static const int numStatusNames = sizeof statusNames / sizeof ( struct _statusNa
//
//==================================================
-KMSearchRule::KMSearchRule( const QCString & field, Function func, const QString & contents )
+KMSearchRule::KMSearchRule( const TQCString & field, Function func, const TQString & contents )
: mField( field ),
mFunction( func ),
mContents( contents )
@@ -95,9 +95,9 @@ const KMSearchRule & KMSearchRule::operator=( const KMSearchRule & other ) {
return *this;
}
-KMSearchRule * KMSearchRule::createInstance( const QCString & field,
+KMSearchRule * KMSearchRule::createInstance( const TQCString & field,
Function func,
- const QString & contents )
+ const TQString & contents )
{
KMSearchRule *ret = 0;
if (field == "<status>")
@@ -110,9 +110,9 @@ KMSearchRule * KMSearchRule::createInstance( const QCString & field,
return ret;
}
-KMSearchRule * KMSearchRule::createInstance( const QCString & field,
+KMSearchRule * KMSearchRule::createInstance( const TQCString & field,
const char *func,
- const QString & contents )
+ const TQString & contents )
{
return ( createInstance( field, configValueToFunc( func ), contents ) );
}
@@ -126,13 +126,13 @@ KMSearchRule * KMSearchRule::createInstanceFromConfig( const KConfig * config, i
{
const char cIdx = char( int('A') + aIdx );
- static const QString & field = KGlobal::staticQString( "field" );
- static const QString & func = KGlobal::staticQString( "func" );
- static const QString & contents = KGlobal::staticQString( "contents" );
+ static const TQString & field = KGlobal::staticQString( "field" );
+ static const TQString & func = KGlobal::staticQString( "func" );
+ static const TQString & contents = KGlobal::staticQString( "contents" );
- const QCString &field2 = config->readEntry( field + cIdx ).latin1();
+ const TQCString &field2 = config->readEntry( field + cIdx ).latin1();
Function func2 = configValueToFunc( config->readEntry( func + cIdx ).latin1() );
- const QString & contents2 = config->readEntry( contents + cIdx );
+ const TQString & contents2 = config->readEntry( contents + cIdx );
if ( field2 == "<To or Cc>" ) // backwards compat
return KMSearchRule::createInstance( "<recipients>", func2, contents2 );
@@ -150,7 +150,7 @@ KMSearchRule::Function KMSearchRule::configValueToFunc( const char * str ) {
return FuncNone;
}
-QString KMSearchRule::functionToString( Function function )
+TQString KMSearchRule::functionToString( Function function )
{
if ( function != FuncNone )
return funcConfigNames[int( function )];
@@ -160,11 +160,11 @@ QString KMSearchRule::functionToString( Function function )
void KMSearchRule::writeConfig( KConfig * config, int aIdx ) const {
const char cIdx = char('A' + aIdx);
- static const QString & field = KGlobal::staticQString( "field" );
- static const QString & func = KGlobal::staticQString( "func" );
- static const QString & contents = KGlobal::staticQString( "contents" );
+ static const TQString & field = KGlobal::staticQString( "field" );
+ static const TQString & func = KGlobal::staticQString( "func" );
+ static const TQString & contents = KGlobal::staticQString( "contents" );
- config->writeEntry( field + cIdx, QString(mField) );
+ config->writeEntry( field + cIdx, TQString(mField) );
config->writeEntry( func + cIdx, functionToString( mFunction ) );
config->writeEntry( contents + cIdx, mContents );
}
@@ -179,9 +179,9 @@ bool KMSearchRule::matches( const DwString & aStr, KMMessage & msg,
return matches( &msg );
}
-const QString KMSearchRule::asString() const
+const TQString KMSearchRule::asString() const
{
- QString result = "\"" + mField + "\" <";
+ TQString result = "\"" + mField + "\" <";
result += functionToString( mFunction );
result += "> \"" + mContents + "\"";
@@ -194,8 +194,8 @@ const QString KMSearchRule::asString() const
//
//==================================================
-KMSearchRuleString::KMSearchRuleString( const QCString & field,
- Function func, const QString & contents )
+KMSearchRuleString::KMSearchRuleString( const TQCString & field,
+ Function func, const TQString & contents )
: KMSearchRule(field, func, contents)
{
if ( field.isEmpty() || field[0] == '<' )
@@ -283,8 +283,8 @@ bool KMSearchRuleString::matches( const DwString & aStr, KMMessage & msg,
while ( stop != DwString::npos && ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' )
stop = aStr.find( '\n', stop + 1 );
const int len = stop == DwString::npos ? aStr.length() - start : stop - start ;
- const QCString codedValue( aStr.data() + start, len + 1 );
- const QString msgContents = KMMsgBase::decodeRFC2047String( codedValue ).stripWhiteSpace(); // FIXME: This needs to be changed for IDN support.
+ const TQCString codedValue( aStr.data() + start, len + 1 );
+ const TQString msgContents = KMMsgBase::decodeRFC2047String( codedValue ).stripWhiteSpace(); // FIXME: This needs to be changed for IDN support.
rc = matchesInternal( msgContents );
}
} else if ( field() == "<recipients>" ) {
@@ -308,7 +308,7 @@ bool KMSearchRuleString::matches( const DwString & aStr, KMMessage & msg,
}
}
if ( FilterLog::instance()->isLogging() ) {
- QString msg = ( rc ? "<font color=#00FF00>1 = </font>"
+ TQString msg = ( rc ? "<font color=#00FF00>1 = </font>"
: "<font color=#FF0000>0 = </font>" );
msg += FilterLog::recode( asString() );
// only log headers bcause messages and bodies can be pretty large
@@ -327,7 +327,7 @@ bool KMSearchRuleString::matches( const KMMessage * msg ) const
if ( isEmpty() )
return false;
- QString msgContents;
+ TQString msgContents;
// Show the value used to compare the rules against in the log.
// Overwrite the value for complete messages and all headers!
bool logContents = true;
@@ -382,7 +382,7 @@ bool KMSearchRuleString::matches( const KMMessage * msg ) const
bool rc = matchesInternal( msgContents );
if ( FilterLog::instance()->isLogging() ) {
- QString msg = ( rc ? "<font color=#00FF00>1 = </font>"
+ TQString msg = ( rc ? "<font color=#00FF00>1 = </font>"
: "<font color=#FF0000>0 = </font>" );
msg += FilterLog::recode( asString() );
// only log headers bcause messages and bodies can be pretty large
@@ -394,14 +394,14 @@ bool KMSearchRuleString::matches( const KMMessage * msg ) const
}
// helper, does the actual comparing
-bool KMSearchRuleString::matchesInternal( const QString & msgContents ) const
+bool KMSearchRuleString::matchesInternal( const TQString & msgContents ) const
{
switch ( function() ) {
case KMSearchRule::FuncEquals:
- return ( QString::compare( msgContents.lower(), contents().lower() ) == 0 );
+ return ( TQString::compare( msgContents.lower(), contents().lower() ) == 0 );
case KMSearchRule::FuncNotEqual:
- return ( QString::compare( msgContents.lower(), contents().lower() ) != 0 );
+ return ( TQString::compare( msgContents.lower(), contents().lower() ) != 0 );
case KMSearchRule::FuncContains:
return ( msgContents.find( contents(), 0, false ) >= 0 );
@@ -411,33 +411,33 @@ bool KMSearchRuleString::matchesInternal( const QString & msgContents ) const
case KMSearchRule::FuncRegExp:
{
- QRegExp regexp( contents(), false );
+ TQRegExp regexp( contents(), false );
return ( regexp.search( msgContents ) >= 0 );
}
case KMSearchRule::FuncNotRegExp:
{
- QRegExp regexp( contents(), false );
+ TQRegExp regexp( contents(), false );
return ( regexp.search( msgContents ) < 0 );
}
case FuncIsGreater:
- return ( QString::compare( msgContents.lower(), contents().lower() ) > 0 );
+ return ( TQString::compare( msgContents.lower(), contents().lower() ) > 0 );
case FuncIsLessOrEqual:
- return ( QString::compare( msgContents.lower(), contents().lower() ) <= 0 );
+ return ( TQString::compare( msgContents.lower(), contents().lower() ) <= 0 );
case FuncIsLess:
- return ( QString::compare( msgContents.lower(), contents().lower() ) < 0 );
+ return ( TQString::compare( msgContents.lower(), contents().lower() ) < 0 );
case FuncIsGreaterOrEqual:
- return ( QString::compare( msgContents.lower(), contents().lower() ) >= 0 );
+ return ( TQString::compare( msgContents.lower(), contents().lower() ) >= 0 );
case FuncIsInAddressbook: {
KABC::AddressBook *stdAb = KABC::StdAddressBook::self( true );
- QStringList addressList =
+ TQStringList addressList =
KPIM::splitEmailAddrList( msgContents.lower() );
- for( QStringList::ConstIterator it = addressList.begin();
+ for( TQStringList::ConstIterator it = addressList.begin();
( it != addressList.end() );
++it ) {
if ( !stdAb->findByEmail( KPIM::getEmailAddress( *it ) ).isEmpty() )
@@ -448,9 +448,9 @@ bool KMSearchRuleString::matchesInternal( const QString & msgContents ) const
case FuncIsNotInAddressbook: {
KABC::AddressBook *stdAb = KABC::StdAddressBook::self( true );
- QStringList addressList =
+ TQStringList addressList =
KPIM::splitEmailAddrList( msgContents.lower() );
- for( QStringList::ConstIterator it = addressList.begin();
+ for( TQStringList::ConstIterator it = addressList.begin();
( it != addressList.end() );
++it ) {
if ( stdAb->findByEmail( KPIM::getEmailAddress( *it ) ).isEmpty() )
@@ -460,11 +460,11 @@ bool KMSearchRuleString::matchesInternal( const QString & msgContents ) const
}
case FuncIsInCategory: {
- QString category = contents();
- QStringList addressList = KPIM::splitEmailAddrList( msgContents.lower() );
+ TQString category = contents();
+ TQStringList addressList = KPIM::splitEmailAddrList( msgContents.lower() );
KABC::AddressBook *stdAb = KABC::StdAddressBook::self( true );
- for( QStringList::ConstIterator it = addressList.begin();
+ for( TQStringList::ConstIterator it = addressList.begin();
it != addressList.end(); ++it ) {
KABC::Addressee::List addresses = stdAb->findByEmail( KPIM::getEmailAddress( *it ) );
@@ -477,11 +477,11 @@ bool KMSearchRuleString::matchesInternal( const QString & msgContents ) const
}
case FuncIsNotInCategory: {
- QString category = contents();
- QStringList addressList = KPIM::splitEmailAddrList( msgContents.lower() );
+ TQString category = contents();
+ TQStringList addressList = KPIM::splitEmailAddrList( msgContents.lower() );
KABC::AddressBook *stdAb = KABC::StdAddressBook::self( true );
- for( QStringList::ConstIterator it = addressList.begin();
+ for( TQStringList::ConstIterator it = addressList.begin();
it != addressList.end(); ++it ) {
KABC::Addressee::List addresses = stdAb->findByEmail( KPIM::getEmailAddress( *it ) );
@@ -506,8 +506,8 @@ bool KMSearchRuleString::matchesInternal( const QString & msgContents ) const
//
//==================================================
-KMSearchRuleNumerical::KMSearchRuleNumerical( const QCString & field,
- Function func, const QString & contents )
+KMSearchRuleNumerical::KMSearchRuleNumerical( const TQCString & field,
+ Function func, const TQString & contents )
: KMSearchRule(field, func, contents)
{
}
@@ -524,7 +524,7 @@ bool KMSearchRuleNumerical::isEmpty() const
bool KMSearchRuleNumerical::matches( const KMMessage * msg ) const
{
- QString msgContents;
+ TQString msgContents;
int numericalMsgContents = 0;
int numericalValue = 0;
@@ -533,25 +533,25 @@ bool KMSearchRuleNumerical::matches( const KMMessage * msg ) const
numericalValue = contents().toInt();
msgContents.setNum( numericalMsgContents );
} else if ( field() == "<age in days>" ) {
- QDateTime msgDateTime;
+ TQDateTime msgDateTime;
msgDateTime.setTime_t( msg->date() );
- numericalMsgContents = msgDateTime.daysTo( QDateTime::currentDateTime() );
+ numericalMsgContents = msgDateTime.daysTo( TQDateTime::currentDateTime() );
numericalValue = contents().toInt();
msgContents.setNum( numericalMsgContents );
}
bool rc = matchesInternal( numericalValue, numericalMsgContents, msgContents );
if ( FilterLog::instance()->isLogging() ) {
- QString msg = ( rc ? "<font color=#00FF00>1 = </font>"
+ TQString msg = ( rc ? "<font color=#00FF00>1 = </font>"
: "<font color=#FF0000>0 = </font>" );
msg += FilterLog::recode( asString() );
- msg += " ( <i>" + QString::number( numericalMsgContents ) + "</i> )";
+ msg += " ( <i>" + TQString::number( numericalMsgContents ) + "</i> )";
FilterLog::instance()->add( msg, FilterLog::ruleResult );
}
return rc;
}
bool KMSearchRuleNumerical::matchesInternal( long numericalValue,
- long numericalMsgContents, const QString & msgContents ) const
+ long numericalMsgContents, const TQString & msgContents ) const
{
switch ( function() ) {
case KMSearchRule::FuncEquals:
@@ -568,13 +568,13 @@ bool KMSearchRuleNumerical::matchesInternal( long numericalValue,
case KMSearchRule::FuncRegExp:
{
- QRegExp regexp( contents(), false );
+ TQRegExp regexp( contents(), false );
return ( regexp.search( msgContents ) >= 0 );
}
case KMSearchRule::FuncNotRegExp:
{
- QRegExp regexp( contents(), false );
+ TQRegExp regexp( contents(), false );
return ( regexp.search( msgContents ) < 0 );
}
@@ -610,18 +610,18 @@ bool KMSearchRuleNumerical::matchesInternal( long numericalValue,
// class KMSearchRuleStatus
//
//==================================================
-QString englishNameForStatus( const KMMsgStatus& status )
+TQString englishNameForStatus( const KMMsgStatus& status )
{
for ( int i=0; i< numStatusNames; i++ ) {
if ( statusNames[i].status == status ) {
return statusNames[i].name;
}
}
- return QString::null;
+ return TQString::null;
}
-KMSearchRuleStatus::KMSearchRuleStatus( const QCString & field,
- Function func, const QString & aContents )
+KMSearchRuleStatus::KMSearchRuleStatus( const TQCString & field,
+ Function func, const TQString & aContents )
: KMSearchRule(field, func, aContents)
{
// the values are always in english, both from the conf file as well as
@@ -635,7 +635,7 @@ KMSearchRuleStatus::KMSearchRuleStatus( int status, Function func )
mStatus = status;
}
-KMMsgStatus KMSearchRuleStatus::statusFromEnglishName( const QString & aStatusString )
+KMMsgStatus KMSearchRuleStatus::statusFromEnglishName( const TQString & aStatusString )
{
for ( int i=0; i< numStatusNames; i++ ) {
if ( !aStatusString.compare( statusNames[i].name ) ) {
@@ -681,7 +681,7 @@ bool KMSearchRuleStatus::matches( const KMMessage * msg ) const
}
if ( FilterLog::instance()->isLogging() ) {
- QString msg = ( rc ? "<font color=#00FF00>1 = </font>"
+ TQString msg = ( rc ? "<font color=#00FF00>1 = </font>"
: "<font color=#FF0000>0 = </font>" );
msg += FilterLog::recode( asString() );
FilterLog::instance()->add( msg, FilterLog::ruleResult );
@@ -698,7 +698,7 @@ bool KMSearchRuleStatus::matches( const KMMessage * msg ) const
//==================================================
KMSearchPattern::KMSearchPattern( const KConfig * config )
- : QPtrList<KMSearchRule>()
+ : TQPtrList<KMSearchRule>()
{
setAutoDelete( true );
if ( config )
@@ -716,7 +716,7 @@ bool KMSearchPattern::matches( const KMMessage * msg, bool ignoreBody ) const
if ( isEmpty() )
return true;
- QPtrListIterator<KMSearchRule> it( *this );
+ TQPtrListIterator<KMSearchRule> it( *this );
switch ( mOperator ) {
case OpAnd: // all rules must match
for ( it.toFirst() ; it.current() ; ++it )
@@ -741,7 +741,7 @@ bool KMSearchPattern::matches( const DwString & aStr, bool ignoreBody ) const
return true;
KMMessage msg;
- QPtrListIterator<KMSearchRule> it( *this );
+ TQPtrListIterator<KMSearchRule> it( *this );
switch ( mOperator ) {
case OpAnd: // all rules must match
for ( it.toFirst() ; it.current() ; ++it )
@@ -791,7 +791,7 @@ bool KMSearchPattern::matches( Q_UINT32 serNum, bool ignoreBody ) const
}
bool KMSearchPattern::requiresBody() const {
- QPtrListIterator<KMSearchRule> it( *this );
+ TQPtrListIterator<KMSearchRule> it( *this );
for ( it.toFirst() ; it.current() ; ++it )
if ( (*it)->requiresBody() )
return true;
@@ -799,7 +799,7 @@ bool KMSearchPattern::requiresBody() const {
}
void KMSearchPattern::purify() {
- QPtrListIterator<KMSearchRule> it( *this );
+ TQPtrListIterator<KMSearchRule> it( *this );
it.toLast();
while ( it.current() )
if ( (*it)->isEmpty() ) {
@@ -847,7 +847,7 @@ void KMSearchPattern::importLegacyConfig( const KConfig * config ) {
}
append( rule );
- const QString sOperator = config->readEntry("operator");
+ const TQString sOperator = config->readEntry("operator");
if ( sOperator == "ignore" ) return;
rule = KMSearchRule::createInstance( config->readEntry("fieldB").latin1(),
@@ -883,7 +883,7 @@ void KMSearchPattern::writeConfig( KConfig * config ) const {
config->writeEntry("operator", (mOperator == KMSearchPattern::OpOr) ? "or" : "and" );
int i = 0;
- for ( QPtrListIterator<KMSearchRule> it( *this ) ; it.current() && i < FILTER_MAX_RULES ; ++i , ++it )
+ for ( TQPtrListIterator<KMSearchRule> it( *this ) ; it.current() && i < FILTER_MAX_RULES ; ++i , ++it )
// we could do this ourselves, but we want the rules to be extensible,
// so we give the rule it's number and let it do the rest.
(*it)->writeConfig( config, i );
@@ -898,14 +898,14 @@ void KMSearchPattern::init() {
mName = '<' + i18n("name used for a virgin filter","unknown") + '>';
}
-QString KMSearchPattern::asString() const {
- QString result;
+TQString KMSearchPattern::asString() const {
+ TQString result;
if ( mOperator == OpOr )
result = i18n("(match any of the following)");
else
result = i18n("(match all of the following)");
- for ( QPtrListIterator<KMSearchRule> it( *this ) ; it.current() ; ++it )
+ for ( TQPtrListIterator<KMSearchRule> it( *this ) ; it.current() ; ++it )
result += "\n\t" + FilterLog::recode( (*it)->asString() );
return result;
@@ -920,7 +920,7 @@ const KMSearchPattern & KMSearchPattern::operator=( const KMSearchPattern & othe
clear(); // ###
- for ( QPtrListIterator<KMSearchRule> it( other ) ; it.current() ; ++it ) {
+ for ( TQPtrListIterator<KMSearchRule> it( other ) ; it.current() ; ++it ) {
KMSearchRule * rule = KMSearchRule::createInstance( **it ); // deep copy
append( rule );
}