diff options
Diffstat (limited to 'kmail/vacation.cpp')
-rw-r--r-- | kmail/vacation.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kmail/vacation.cpp b/kmail/vacation.cpp index af0c5e16b..d0cdedf85 100644 --- a/kmail/vacation.cpp +++ b/kmail/vacation.cpp @@ -43,7 +43,7 @@ using KMime::Types::AddrSpecList; #include <kmessagebox.h> #include <kdebug.h> -#include <qdatetime.h> +#include <tqdatetime.h> #include <cassert> #include <vector> @@ -86,24 +86,24 @@ namespace KSieveExt { #undef FOREACH #endif #define FOREACH for ( std::vector<KSieve::ScriptBuilder*>::const_iterator it = mBuilders.begin(), end = mBuilders.end() ; it != end ; ++it ) (*it)-> - void commandStart( const QString & identifier ) { FOREACH commandStart( identifier ); } + void commandStart( const TQString & identifier ) { FOREACH commandStart( identifier ); } void commandEnd() { FOREACH commandEnd(); } - void testStart( const QString & identifier ) { FOREACH testStart( identifier ); } + void testStart( const TQString & identifier ) { FOREACH testStart( identifier ); } void testEnd() { FOREACH testEnd(); } void testListStart() { FOREACH testListStart(); } void testListEnd() { FOREACH testListEnd(); } void blockStart() { FOREACH blockStart(); } void blockEnd() { FOREACH blockEnd(); } - void hashComment( const QString & comment ) { FOREACH hashComment( comment ); } - void bracketComment( const QString & comment ) { FOREACH bracketComment( comment ); } + void hashComment( const TQString & comment ) { FOREACH hashComment( comment ); } + void bracketComment( const TQString & comment ) { FOREACH bracketComment( comment ); } void lineFeed() { FOREACH lineFeed(); } void error( const KSieve::Error & e ) { FOREACH error( e ); } void finished() { FOREACH finished(); } - void taggedArgument( const QString & tag ) { FOREACH taggedArgument( tag ); } - void stringArgument( const QString & string, bool multiline, const QString & fixme ) { FOREACH stringArgument( string, multiline, fixme ); } + void taggedArgument( const TQString & tag ) { FOREACH taggedArgument( tag ); } + void stringArgument( const TQString & string, bool multiline, const TQString & fixme ) { FOREACH stringArgument( string, multiline, fixme ); } void numberArgument( unsigned long number, char quantifier ) { FOREACH numberArgument( number, quantifier ); } void stringListArgumentStart() { FOREACH stringListArgumentStart(); } - void stringListEntry( const QString & string, bool multiline, const QString & fixme) { FOREACH stringListEntry( string, multiline, fixme ); } + void stringListEntry( const TQString & string, bool multiline, const TQString & fixme) { FOREACH stringListEntry( string, multiline, fixme ); } void stringListArgumentEnd() { FOREACH stringListArgumentEnd(); } #undef FOREACH }; @@ -144,7 +144,7 @@ namespace { }; const std::vector<StateNode> mNodes; - std::map<QString,QString> mResults; + std::map<TQString,TQString> mResults; std::set<unsigned int> mRecursionGuard; unsigned int mState; int mNestingDepth; @@ -153,14 +153,14 @@ namespace { GenericInformationExtractor( const std::vector<StateNode> & nodes ) : KSieve::ScriptBuilder(), mNodes( nodes ), mState( 0 ), mNestingDepth( 0 ) {} - const std::map<QString,QString> & results() const { return mResults; } + const std::map<TQString,TQString> & results() const { return mResults; } private: - void process( BuilderMethod method, const QString & string=QString::null ) { + void process( BuilderMethod method, const TQString & string=TQString::null ) { doProcess( method, string ); mRecursionGuard.clear(); } - void doProcess( BuilderMethod method, const QString & string ) { + void doProcess( BuilderMethod method, const TQString & string ) { mRecursionGuard.insert( mState ); bool found = true; const StateNode & expected = mNodes[mState]; @@ -169,7 +169,7 @@ namespace { if ( expected.method != Any && method != expected.method ) found = false; if ( const char * str = expected.string ) - if ( string.lower() != QString::fromUtf8( str ).lower() ) + if ( string.lower() != TQString::fromUtf8( str ).lower() ) found = false; kdDebug(5006) << ( found ? "found: " : "not found: " ) << mState << " -> " @@ -183,16 +183,16 @@ namespace { doProcess( method, string ); } } - void commandStart( const QString & identifier ) { kdDebug(5006) << k_funcinfo << endl; process( CommandStart, identifier ); } + void commandStart( const TQString & identifier ) { kdDebug(5006) << k_funcinfo << endl; process( CommandStart, identifier ); } void commandEnd() { kdDebug(5006) << k_funcinfo << endl; process( CommandEnd ); } - void testStart( const QString & identifier ) { kdDebug(5006) << k_funcinfo << endl; process( TestStart, identifier ); } + void testStart( const TQString & identifier ) { kdDebug(5006) << k_funcinfo << endl; process( TestStart, identifier ); } void testEnd() { kdDebug(5006) << k_funcinfo << endl; process( TestEnd ); } void testListStart() { kdDebug(5006) << k_funcinfo << endl; process( TestListStart ); } void testListEnd() { kdDebug(5006) << k_funcinfo << endl; process( TestListEnd ); } void blockStart() { kdDebug(5006) << k_funcinfo << endl; process( BlockStart ); ++mNestingDepth; } void blockEnd() { kdDebug(5006) << k_funcinfo << endl; --mNestingDepth; process( BlockEnd ); } - void hashComment( const QString & ) { kdDebug(5006) << k_funcinfo << endl; } - void bracketComment( const QString & ) { kdDebug(5006) << k_funcinfo << endl; } + void hashComment( const TQString & ) { kdDebug(5006) << k_funcinfo << endl; } + void bracketComment( const TQString & ) { kdDebug(5006) << k_funcinfo << endl; } void lineFeed() { kdDebug(5006) << k_funcinfo << endl; } void error( const KSieve::Error & ) { kdDebug(5006) << k_funcinfo << endl; @@ -200,11 +200,11 @@ namespace { } void finished() { kdDebug(5006) << k_funcinfo << endl; } - void taggedArgument( const QString & tag ) { kdDebug(5006) << k_funcinfo << endl; process( TaggedArgument, tag ); } - void stringArgument( const QString & string, bool, const QString & ) { kdDebug(5006) << k_funcinfo << endl; process( StringArgument, string ); } - void numberArgument( unsigned long number, char ) { kdDebug(5006) << k_funcinfo << endl; process( NumberArgument, QString::number( number ) ); } + void taggedArgument( const TQString & tag ) { kdDebug(5006) << k_funcinfo << endl; process( TaggedArgument, tag ); } + void stringArgument( const TQString & string, bool, const TQString & ) { kdDebug(5006) << k_funcinfo << endl; process( StringArgument, string ); } + void numberArgument( unsigned long number, char ) { kdDebug(5006) << k_funcinfo << endl; process( NumberArgument, TQString::number( number ) ); } void stringListArgumentStart() { kdDebug(5006) << k_funcinfo << endl; process( StringListArgumentStart ); } - void stringListEntry( const QString & string, bool, const QString & ) { kdDebug(5006) << k_funcinfo << endl; process( StringListEntry, string ); } + void stringListEntry( const TQString & string, bool, const TQString & ) { kdDebug(5006) << k_funcinfo << endl; process( StringListEntry, string ); } void stringListArgumentEnd() { kdDebug(5006) << k_funcinfo << endl; process( StringListArgumentEnd ); } }; @@ -306,9 +306,9 @@ namespace { } - QString domainName() /*not const, since map::op[] isn't const*/ { + TQString domainName() /*not const, since map::op[] isn't const*/ { return mResults.count( "stop" ) && mResults.count( "from" ) - ? mResults["domainName"] : QString::null ; + ? mResults["domainName"] : TQString::null ; } }; @@ -330,11 +330,11 @@ namespace { virtual ~VacationDataExtractor() {} int notificationInterval() const { return mNotificationInterval; } - const QString & messageText() const { return mMessageText; } - const QStringList & aliases() const { return mAliases; } + const TQString & messageText() const { return mMessageText; } + const TQStringList & aliases() const { return mAliases; } private: - void commandStart( const QString & identifier ) { + void commandStart( const TQString & identifier ) { kdDebug( 5006 ) << "VacationDataExtractor::commandStart( \"" << identifier << "\" )" << endl; if ( identifier != "vacation" ) return; @@ -347,14 +347,14 @@ namespace { mContext = None; } - void testStart( const QString & ) {} + void testStart( const TQString & ) {} void testEnd() {} void testListStart() {} void testListEnd() {} void blockStart() {} void blockEnd() {} - void hashComment( const QString & ) {} - void bracketComment( const QString & ) {} + void hashComment( const TQString & ) {} + void bracketComment( const TQString & ) {} void lineFeed() {} void error( const KSieve::Error & e ) { kdDebug( 5006 ) << "VacationDataExtractor::error() ### " @@ -363,7 +363,7 @@ namespace { } void finished() {} - void taggedArgument( const QString & tag ) { + void taggedArgument( const TQString & tag ) { kdDebug( 5006 ) << "VacationDataExtractor::taggedArgument( \"" << tag << "\" )" << endl; if ( mContext != VacationCommand ) return; @@ -373,7 +373,7 @@ namespace { mContext = Addresses; } - void stringArgument( const QString & string, bool, const QString & ) { + void stringArgument( const TQString & string, bool, const TQString & ) { kdDebug( 5006 ) << "VacationDataExtractor::stringArgument( \"" << string << "\" )" << endl; if ( mContext == Addresses ) { mAliases.push_back( string ); @@ -396,7 +396,7 @@ namespace { } void stringListArgumentStart() {} - void stringListEntry( const QString & string, bool, const QString & ) { + void stringListEntry( const TQString & string, bool, const TQString & ) { kdDebug( 5006 ) << "VacationDataExtractor::stringListEntry( \"" << string << "\" )" << endl; if ( mContext != Addresses ) return; @@ -412,15 +412,15 @@ namespace { private: Context mContext; int mNotificationInterval; - QString mMessageText; - QStringList mAliases; + TQString mMessageText; + TQStringList mAliases; void reset() { kdDebug(5006) << "VacationDataExtractor::reset()" << endl; mContext = None; mNotificationInterval = 0; mAliases.clear(); - mMessageText = QString::null; + mMessageText = TQString::null; } }; @@ -428,16 +428,16 @@ namespace { namespace KMail { - Vacation::Vacation( QObject * parent, bool checkOnly, const char * name ) - : QObject( parent, name ), mSieveJob( 0 ), mDialog( 0 ), mWasActive( false ), mCheckOnly( checkOnly ) + Vacation::Vacation( TQObject * parent, bool checkOnly, const char * name ) + : TQObject( parent, name ), mSieveJob( 0 ), mDialog( 0 ), mWasActive( false ), mCheckOnly( checkOnly ) { mUrl = findURL(); kdDebug(5006) << "Vacation: found url \"" << mUrl.prettyURL() << "\"" << endl; if ( mUrl.isEmpty() ) // nothing to do... return; mSieveJob = SieveJob::get( mUrl, !checkOnly ); - connect( mSieveJob, SIGNAL(gotScript(KMail::SieveJob*,bool,const QString&,bool)), - SLOT(slotGetResult(KMail::SieveJob*,bool,const QString&,bool)) ); + connect( mSieveJob, TQT_SIGNAL(gotScript(KMail::SieveJob*,bool,const TQString&,bool)), + TQT_SLOT(slotGetResult(KMail::SieveJob*,bool,const TQString&,bool)) ); } Vacation::~Vacation() { @@ -446,44 +446,44 @@ namespace KMail { kdDebug(5006) << "~Vacation()" << endl; } - static inline QString dotstuff( QString s ) { + static inline TQString dotstuff( TQString s ) { if ( s.startsWith( "." ) ) return '.' + s.replace( "\n.", "\n.." ); else return s.replace( "\n.", "\n.." ); } - QString Vacation::composeScript( const QString & messageText, + TQString Vacation::composeScript( const TQString & messageText, int notificationInterval, const AddrSpecList & addrSpecs, - bool sendForSpam, const QString & domain ) + bool sendForSpam, const TQString & domain ) { - QString addressesArgument; - QStringList aliases; + TQString addressesArgument; + TQStringList aliases; if ( !addrSpecs.empty() ) { addressesArgument += ":addresses [ "; - QStringList sl; + TQStringList sl; for ( AddrSpecList::const_iterator it = addrSpecs.begin() ; it != addrSpecs.end() ; ++it ) { sl.push_back( '"' + (*it).asString().replace( '\\', "\\\\" ).replace( '"', "\\\"" ) + '"' ); aliases.push_back( (*it).asString() ); } addressesArgument += sl.join( ", " ) + " ] "; } - QString script = QString::fromLatin1("require \"vacation\";\n\n" ); + TQString script = TQString::fromLatin1("require \"vacation\";\n\n" ); if ( !sendForSpam ) - script += QString::fromLatin1( "if header :contains \"X-Spam-Flag\" \"YES\"" + script += TQString::fromLatin1( "if header :contains \"X-Spam-Flag\" \"YES\"" " { keep; stop; }\n" ); // FIXME? if ( !domain.isEmpty() ) // FIXME - script += QString::fromLatin1( "if not address :domain :contains \"from\" \"%1\" { keep; stop; }\n" ).arg( domain ); + script += TQString::fromLatin1( "if not address :domain :contains \"from\" \"%1\" { keep; stop; }\n" ).arg( domain ); script += "vacation "; script += addressesArgument; if ( notificationInterval > 0 ) - script += QString::fromLatin1(":days %1 ").arg( notificationInterval ); - script += QString::fromLatin1("text:\n"); + script += TQString::fromLatin1(":days %1 ").arg( notificationInterval ); + script += TQString::fromLatin1("text:\n"); script += dotstuff( messageText.isEmpty() ? defaultMessageText() : messageText ); - script += QString::fromLatin1( "\n.\n;\n" ); + script += TQString::fromLatin1( "\n.\n;\n" ); return script; } @@ -522,9 +522,9 @@ namespace KMail { return KURL(); } - bool Vacation::parseScript( const QString & script, QString & messageText, - int & notificationInterval, QStringList & aliases, - bool & sendForSpam, QString & domainName ) { + bool Vacation::parseScript( const TQString & script, TQString & messageText, + int & notificationInterval, TQStringList & aliases, + bool & sendForSpam, TQString & domainName ) { if ( script.stripWhiteSpace().isEmpty() ) { messageText = defaultMessageText(); notificationInterval = defaultNotificationInterval(); @@ -537,7 +537,7 @@ namespace KMail { // The stripWhiteSpace() call below prevents parsing errors. The // slave somehow omits the last \n, which results in a lone \r at // the end, leading to a parse error. - const QCString scriptUTF8 = script.stripWhiteSpace().utf8(); + const TQCString scriptUTF8 = script.stripWhiteSpace().utf8(); kdDebug(5006) << "scriptUtf8 = \"" + scriptUTF8 + "\"" << endl; KSieve::Parser parser( scriptUTF8.begin(), scriptUTF8.begin() + scriptUTF8.length() ); @@ -558,7 +558,7 @@ namespace KMail { return true; } - QString Vacation::defaultMessageText() { + TQString Vacation::defaultMessageText() { return i18n("I am out of office till %1.\n" "\n" "In urgent cases, please contact Mrs. <vacation replacement>\n" @@ -569,15 +569,15 @@ namespace KMail { "\n" "Yours sincerely,\n" "-- <enter your name and email address here>\n") - .arg( KGlobal::locale()->formatDate( QDate::currentDate().addDays( 1 ) ) ); + .arg( KGlobal::locale()->formatDate( TQDate::currentDate().addDays( 1 ) ) ); } int Vacation::defaultNotificationInterval() { return 7; // days } - QStringList Vacation::defaultMailAliases() { - QStringList sl; + TQStringList Vacation::defaultMailAliases() { + TQStringList sl; for ( KPIM::IdentityManager::ConstIterator it = kmkernel->identityManager()->begin() ; it != kmkernel->identityManager()->end() ; ++it ) if ( !(*it).emailAddr().isEmpty() ) @@ -589,12 +589,12 @@ namespace KMail { return GlobalSettings::outOfOfficeReactToSpam(); } - QString Vacation::defaultDomainName() { + TQString Vacation::defaultDomainName() { return GlobalSettings::outOfOfficeDomain(); } void Vacation::slotGetResult( SieveJob * job, bool success, - const QString & script, bool active ) { + const TQString & script, bool active ) { kdDebug(5006) << "Vacation::slotGetResult( ??, " << success << ", ?, " << active << " )" << endl << "script:" << endl @@ -615,11 +615,11 @@ namespace KMail { if ( !mDialog && !mCheckOnly ) mDialog = new VacationDialog( i18n("Configure \"Out of Office\" Replies"), 0, 0, false ); - QString messageText = defaultMessageText(); + TQString messageText = defaultMessageText(); int notificationInterval = defaultNotificationInterval(); - QStringList aliases = defaultMailAliases(); + TQStringList aliases = defaultMailAliases(); bool sendForSpam = defaultSendForSpam(); - QString domainName = defaultDomainName(); + TQString domainName = defaultDomainName(); if ( !success ) active = false; // default to inactive if ( !mCheckOnly && ( !success || !parseScript( script, messageText, notificationInterval, aliases, sendForSpam, domainName ) ) ) @@ -639,9 +639,9 @@ namespace KMail { mDialog->setDomainName( domainName ); mDialog->enableDomainAndSendForSpam( !GlobalSettings::allowOutOfOfficeUploadButNoSettings() ); - connect( mDialog, SIGNAL(okClicked()), SLOT(slotDialogOk()) ); - connect( mDialog, SIGNAL(cancelClicked()), SLOT(slotDialogCancel()) ); - connect( mDialog, SIGNAL(defaultClicked()), SLOT(slotDialogDefaults()) ); + connect( mDialog, TQT_SIGNAL(okClicked()), TQT_SLOT(slotDialogOk()) ); + connect( mDialog, TQT_SIGNAL(cancelClicked()), TQT_SLOT(slotDialogCancel()) ); + connect( mDialog, TQT_SIGNAL(defaultClicked()), TQT_SLOT(slotDialogDefaults()) ); mDialog->show(); } @@ -671,7 +671,7 @@ namespace KMail { void Vacation::slotDialogOk() { kdDebug(5006) << "Vacation::slotDialogOk()" << endl; // compose a new script: - const QString script = composeScript( mDialog->messageText(), + const TQString script = composeScript( mDialog->messageText(), mDialog->notificationInterval(), mDialog->mailAliases(), mDialog->sendForSpam(), @@ -683,10 +683,10 @@ namespace KMail { // and commit the dialog's settings to the server: mSieveJob = SieveJob::put( mUrl, script, active, mWasActive ); - connect( mSieveJob, SIGNAL(gotScript(KMail::SieveJob*,bool,const QString&,bool)), + connect( mSieveJob, TQT_SIGNAL(gotScript(KMail::SieveJob*,bool,const TQString&,bool)), active - ? SLOT(slotPutActiveResult(KMail::SieveJob*,bool)) - : SLOT(slotPutInactiveResult(KMail::SieveJob*,bool)) ); + ? TQT_SLOT(slotPutActiveResult(KMail::SieveJob*,bool)) + : TQT_SLOT(slotPutInactiveResult(KMail::SieveJob*,bool)) ); // destroy the dialog: mDialog->delayedDestruct(); |