diff options
Diffstat (limited to 'kioslave/http/kcookiejar')
-rw-r--r-- | kioslave/http/kcookiejar/kcookiejar.cpp | 254 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/kcookiejar.h | 100 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/kcookieserver.cpp | 138 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/kcookieserver.h | 42 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/kcookiewin.cpp | 124 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/kcookiewin.h | 10 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/main.cpp | 32 | ||||
-rw-r--r-- | kioslave/http/kcookiejar/tests/kcookiejartest.cpp | 88 |
8 files changed, 394 insertions, 394 deletions
diff --git a/kioslave/http/kcookiejar/kcookiejar.cpp b/kioslave/http/kcookiejar/kcookiejar.cpp index 5b5f78f6b..909f92dcb 100644 --- a/kioslave/http/kcookiejar/kcookiejar.cpp +++ b/kioslave/http/kcookiejar/kcookiejar.cpp @@ -55,13 +55,13 @@ //#include <netinet/in.h> //#include <arpa/inet.h> -#include <qstring.h> -#include <qstrlist.h> -#include <qptrlist.h> -#include <qptrdict.h> -#include <qfile.h> -#include <qdir.h> -#include <qregexp.h> +#include <tqstring.h> +#include <tqstrlist.h> +#include <tqptrlist.h> +#include <tqptrdict.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqregexp.h> #include <kurl.h> #include <krfcdate.h> @@ -84,17 +84,17 @@ #define READ_BUFFER_SIZE 8192 #define IP_ADDRESS_EXPRESSION "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" -// Note with respect to QString::fromLatin1( ) +// Note with respect to TQString::fromLatin1( ) // Cookies are stored as 8 bit data and passed to kio_http as // latin1 regardless of their actual encoding. // L1 is used to indicate latin1 constants -#define L1(x) QString::fromLatin1(x) +#define L1(x) TQString::fromLatin1(x) -template class QPtrList<KHttpCookie>; -template class QPtrDict<KHttpCookieList>; +template class TQPtrList<KHttpCookie>; +template class TQPtrDict<KHttpCookieList>; -QString KCookieJar::adviceToStr(KCookieAdvice _advice) +TQString KCookieJar::adviceToStr(KCookieAdvice _advice) { switch( _advice ) { @@ -105,12 +105,12 @@ QString KCookieJar::adviceToStr(KCookieAdvice _advice) } } -KCookieAdvice KCookieJar::strToAdvice(const QString &_str) +KCookieAdvice KCookieJar::strToAdvice(const TQString &_str) { if (_str.isEmpty()) return KCookieDunno; - QCString advice = _str.lower().latin1(); + TQCString advice = _str.lower().latin1(); if (advice == "accept") return KCookieAccept; @@ -128,11 +128,11 @@ KCookieAdvice KCookieJar::strToAdvice(const QString &_str) // // Cookie constructor // -KHttpCookie::KHttpCookie(const QString &_host, - const QString &_domain, - const QString &_path, - const QString &_name, - const QString &_value, +KHttpCookie::KHttpCookie(const TQString &_host, + const TQString &_domain, + const TQString &_path, + const TQString &_name, + const TQString &_value, time_t _expireDate, int _protocolVersion, bool _secure, @@ -140,7 +140,7 @@ KHttpCookie::KHttpCookie(const QString &_host, bool _explicitPath) : mHost(_host), mDomain(_domain), - mPath(_path.isEmpty() ? QString::null : _path), + mPath(_path.isEmpty() ? TQString::null : _path), mName(_name), mValue(_value), mExpireDate(_expireDate), @@ -162,9 +162,9 @@ bool KHttpCookie::isExpired(time_t currentDate) // // Returns a string for a HTTP-header // -QString KHttpCookie::cookieStr(bool useDOMFormat) +TQString KHttpCookie::cookieStr(bool useDOMFormat) { - QString result; + TQString result; if (useDOMFormat || (mProtocolVersion == 0)) { @@ -185,8 +185,8 @@ QString KHttpCookie::cookieStr(bool useDOMFormat) // // Returns whether this cookie should be send to this location. -bool KHttpCookie::match(const QString &fqdn, const QStringList &domains, - const QString &path) +bool KHttpCookie::match(const TQString &fqdn, const TQStringList &domains, + const TQString &path) { // Cookie domain match check if (mDomain.isEmpty()) @@ -200,7 +200,7 @@ bool KHttpCookie::match(const QString &fqdn, const QStringList &domains, return false; // Maybe the domain needs an extra dot. - QString domain = '.' + mDomain; + TQString domain = '.' + mDomain; if ( !domains.contains( domain ) ) if ( fqdn != mDomain ) return false; @@ -257,8 +257,8 @@ KCookieJar::KCookieJar() m_cookiesChanged = false; KConfig cfg("khtml/domain_info", true, false, "data"); - QStringList countries = cfg.readListEntry("twoLevelTLD"); - for(QStringList::ConstIterator it = countries.begin(); + TQStringList countries = cfg.readListEntry("twoLevelTLD"); + for(TQStringList::ConstIterator it = countries.begin(); it != countries.end(); ++it) { m_twoLevelTLD.replace(*it, (int *) 1); @@ -277,13 +277,13 @@ KCookieJar::~KCookieJar() static void removeDuplicateFromList(KHttpCookieList *list, KHttpCookie *cookiePtr, bool nameMatchOnly=false, bool updateWindowId=false) { - QString domain1 = cookiePtr->domain(); + TQString domain1 = cookiePtr->domain(); if (domain1.isEmpty()) domain1 = cookiePtr->host(); for ( KHttpCookiePtr cookie=list->first(); cookie != 0; ) { - QString domain2 = cookie->domain(); + TQString domain2 = cookie->domain(); if (domain2.isEmpty()) domain2 = cookie->host(); @@ -297,7 +297,7 @@ static void removeDuplicateFromList(KHttpCookieList *list, KHttpCookie *cookiePt { if (updateWindowId) { - for(QValueList<long>::ConstIterator it = cookie->windowIds().begin(); + for(TQValueList<long>::ConstIterator it = cookie->windowIds().begin(); it != cookie->windowIds().end(); ++it) { long windowId = *it; @@ -325,12 +325,12 @@ static void removeDuplicateFromList(KHttpCookieList *list, KHttpCookie *cookiePt // Returned is a string containing all appropriate cookies in a format // which can be added to a HTTP-header without any additional processing. // -QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, long windowId, KHttpCookieList *pendingCookies) +TQString KCookieJar::findCookies(const TQString &_url, bool useDOMFormat, long windowId, KHttpCookieList *pendingCookies) { - QString cookieStr; - QStringList domains; - QString fqdn; - QString path; + TQString cookieStr; + TQStringList domains; + TQString fqdn; + TQString path; KHttpCookiePtr cookie; KCookieAdvice advice = m_globalAdvice; @@ -346,7 +346,7 @@ QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, long win KHttpCookieList allCookies; - for(QStringList::ConstIterator it = domains.begin(); + for(TQStringList::ConstIterator it = domains.begin(); true; ++it) { @@ -360,7 +360,7 @@ QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, long win } else { - QString key = (*it).isNull() ? L1("") : (*it); + TQString key = (*it).isNull() ? L1("") : (*it); cookieList = m_cookieDomains[key]; if (!cookieList) continue; // No cookies for this domain @@ -437,7 +437,7 @@ QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, long win cookieStr += L1("Cookie: "); if (protVersion > 0) { - QString version; + TQString version; version.sprintf("$Version=%d; ", protVersion); // Without quotes cookieStr += version; } @@ -465,8 +465,8 @@ QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, long win // ',' - Another cookie follows // '\n' - Another header follows static const char * parseNameValue(const char *header, - QString &Name, - QString &Value, + TQString &Name, + TQString &Value, bool keepQuotes=false, bool rfcQuotes=false) { @@ -479,7 +479,7 @@ static const char * parseNameValue(const char *header, // No '=' sign -> use string as the value, name is empty // (behavior found in Mozilla and IE) Name = ""; - Value = QString::fromLatin1(header); + Value = TQString::fromLatin1(header); Value.truncate( s - header ); Value = Value.stripWhiteSpace(); return (s); @@ -516,12 +516,12 @@ static const char * parseNameValue(const char *header, if ((*s=='\0') || (*s=='\n')) { // End of Name - Value = QString::fromLatin1(header); + Value = TQString::fromLatin1(header); Value.truncate(s - header); return (s); } } - Value = QString::fromLatin1(header); + Value = TQString::fromLatin1(header); // *s == '\"'; if (keepQuotes) Value.truncate( ++s - header ); @@ -542,7 +542,7 @@ static const char * parseNameValue(const char *header, while ((*s != '\0') && (*s != ';') && (*s != '\n')) s++; // End of Name - Value = QString::fromLatin1(header); + Value = TQString::fromLatin1(header); Value.truncate( s - header ); Value = Value.stripWhiteSpace(); } @@ -550,9 +550,9 @@ static const char * parseNameValue(const char *header, } -void KCookieJar::stripDomain(const QString &_fqdn, QString &_domain) +void KCookieJar::stripDomain(const TQString &_fqdn, TQString &_domain) { - QStringList domains; + TQStringList domains; extractDomains(_fqdn, domains); if (domains.count() > 3) _domain = domains[3]; @@ -560,9 +560,9 @@ void KCookieJar::stripDomain(const QString &_fqdn, QString &_domain) _domain = domains[0]; } -QString KCookieJar::stripDomain( KHttpCookiePtr cookiePtr) +TQString KCookieJar::stripDomain( KHttpCookiePtr cookiePtr) { - QString domain; // We file the cookie under this domain. + TQString domain; // We file the cookie under this domain. if (cookiePtr->domain().isEmpty()) stripDomain( cookiePtr->host(), domain); else @@ -570,9 +570,9 @@ QString KCookieJar::stripDomain( KHttpCookiePtr cookiePtr) return domain; } -bool KCookieJar::parseURL(const QString &_url, - QString &_fqdn, - QString &_path) +bool KCookieJar::parseURL(const TQString &_url, + TQString &_fqdn, + TQString &_path) { KURL kurl(_url); if (!kurl.isValid()) @@ -600,7 +600,7 @@ bool KCookieJar::parseURL(const QString &_url, if (_path.isEmpty()) _path = L1("/"); - QRegExp exp(L1("[\\\\/]\\.\\.[\\\\/]")); + TQRegExp exp(L1("[\\\\/]\\.\\.[\\\\/]")); // Weird path, cookie stealing attempt? if (exp.search(_path) != -1) return false; // Deny everything!! @@ -608,8 +608,8 @@ bool KCookieJar::parseURL(const QString &_url, return true; } -void KCookieJar::extractDomains(const QString &_fqdn, - QStringList &_domains) +void KCookieJar::extractDomains(const TQString &_fqdn, + TQStringList &_domains) { // Return numeric IPv6 addresses as is... if (_fqdn[0] == '[') @@ -620,14 +620,14 @@ void KCookieJar::extractDomains(const QString &_fqdn, // Return numeric IPv4 addresses as is... if ((_fqdn[0] >= '0') && (_fqdn[0] <= '9')) { - if (_fqdn.find(QRegExp(IP_ADDRESS_EXPRESSION)) > -1) + if (_fqdn.find(TQRegExp(IP_ADDRESS_EXPRESSION)) > -1) { _domains.append( _fqdn ); return; } } - QStringList partList = QStringList::split('.', _fqdn, false); + TQStringList partList = TQStringList::split('.', _fqdn, false); if (partList.count()) partList.remove(partList.begin()); // Remove hostname @@ -653,12 +653,12 @@ void KCookieJar::extractDomains(const QString &_fqdn, // Catch some TLDs that we miss with the previous check // e.g. com.au, org.uk, mil.co - QCString t = partList[0].lower().utf8(); + TQCString t = partList[0].lower().utf8(); if ((t == "com") || (t == "net") || (t == "org") || (t == "gov") || (t == "edu") || (t == "mil") || (t == "int")) break; } - QString domain = partList.join(L1(".")); + TQString domain = partList.join(L1(".")); _domains.append(domain); _domains.append('.' + domain); partList.remove(partList.begin()); // Remove part @@ -681,16 +681,16 @@ void KCookieJar::extractDomains(const QString &_fqdn, to allow KRFCDate::parseDate to properly parse expiration date formats used in cookies by some servers such as amazon.com. See BR# 145244. */ -static QString fixupDateTime(const QString& dt) +static TQString fixupDateTime(const TQString& dt) { - const int index = dt.find(QRegExp("[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}")); + const int index = dt.find(TQRegExp("[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}")); if (index > -1) { - QStringList dateStrList = QStringList::split(' ', dt.mid(index)); + TQStringList dateStrList = TQStringList::split(' ', dt.mid(index)); if (dateStrList.count() > 1) { - QString date = dateStrList[0]; + TQString date = dateStrList[0]; dateStrList[0] = dateStrList[1]; dateStrList[1] = date; date = dt; @@ -709,18 +709,18 @@ static QString fixupDateTime(const QString& dt) // cookie_headers should be a concatenation of all lines of a HTTP-header // which start with "Set-Cookie". The lines should be separated by '\n's. // -KHttpCookieList KCookieJar::makeCookies(const QString &_url, - const QCString &cookie_headers, +KHttpCookieList KCookieJar::makeCookies(const TQString &_url, + const TQCString &cookie_headers, long windowId) { KHttpCookieList cookieList; KHttpCookieList cookieList2; KHttpCookiePtr lastCookie = 0; const char *cookieStr = cookie_headers.data(); - QString Name; - QString Value; - QString fqdn; - QString path; + TQString Name; + TQString Value; + TQString fqdn; + TQString path; bool crossDomain = false; if (!parseURL(_url, fqdn, path)) @@ -728,7 +728,7 @@ KHttpCookieList KCookieJar::makeCookies(const QString &_url, // Error parsing _url return KHttpCookieList(); } - QString defaultPath; + TQString defaultPath; int i = path.findRev('/'); if (i > 0) defaultPath = path.left(i); @@ -799,10 +799,10 @@ KHttpCookieList KCookieJar::makeCookies(const QString &_url, // Name-Value pair follows cookieStr = parseNameValue(cookieStr, Name, Value); - QCString cName = Name.lower().latin1(); + TQCString cName = Name.lower().latin1(); if (cName == "domain") { - QString dom = Value.lower(); + TQString dom = Value.lower(); // RFC2965 3.2.2: If an explicitly specified value does not // start with a dot, the user agent supplies a leading dot if(dom.length() && dom[0] != '.') @@ -835,7 +835,7 @@ KHttpCookieList KCookieJar::makeCookies(const QString &_url, else if (cName == "path") { if (Value.isEmpty()) - lastCookie->mPath = QString::null; // Catch "" <> QString::null + lastCookie->mPath = TQString::null; // Catch "" <> TQString::null else lastCookie->mPath = KURL::decode_string(Value); lastCookie->mExplicitPath = true; @@ -879,8 +879,8 @@ KHttpCookieList KCookieJar::makeCookies(const QString &_url, * pairs. Any whitespace before "name" or around '=' is discarded. * If no cookies are found, 0 is returned. */ -KHttpCookieList KCookieJar::makeDOMCookies(const QString &_url, - const QCString &cookie_domstring, +KHttpCookieList KCookieJar::makeDOMCookies(const TQString &_url, + const TQCString &cookie_domstring, long windowId) { // A lot copied from above @@ -888,10 +888,10 @@ KHttpCookieList KCookieJar::makeDOMCookies(const QString &_url, KHttpCookiePtr lastCookie = 0; const char *cookieStr = cookie_domstring.data(); - QString Name; - QString Value; - QString fqdn; - QString path; + TQString Name; + TQString Value; + TQString fqdn; + TQString path; if (!parseURL(_url, fqdn, path)) { @@ -907,7 +907,7 @@ KHttpCookieList KCookieJar::makeDOMCookies(const QString &_url, // Host = FQDN // Default domain = "" // Default path = "" - KHttpCookie *cookie = new KHttpCookie(fqdn, QString::null, QString::null, + KHttpCookie *cookie = new KHttpCookie(fqdn, TQString::null, TQString::null, Name, Value ); if (windowId) cookie->mWindowIds.append(windowId); @@ -946,26 +946,26 @@ static void makeRoom(KHttpCookieList *cookieList, KHttpCookiePtr &cookiePtr) // void KCookieJar::addCookie(KHttpCookiePtr &cookiePtr) { - QStringList domains; + TQStringList domains; KHttpCookieList *cookieList = 0L; // We always need to do this to make sure that the // that cookies of type hostname == cookie-domainname // are properly removed and/or updated as necessary! extractDomains( cookiePtr->host(), domains ); - for ( QStringList::ConstIterator it = domains.begin(); + for ( TQStringList::ConstIterator it = domains.begin(); (it != domains.end() && !cookieList); ++it ) { - QString key = (*it).isNull() ? L1("") : (*it); + TQString key = (*it).isNull() ? L1("") : (*it); KHttpCookieList *list= m_cookieDomains[key]; if ( !list ) continue; removeDuplicateFromList(list, cookiePtr, false, true); } - QString domain = stripDomain( cookiePtr ); - QString key = domain.isNull() ? L1("") : domain; + TQString domain = stripDomain( cookiePtr ); + TQString key = domain.isNull() ? L1("") : domain; cookieList = m_cookieDomains[ key ]; if (!cookieList) { @@ -1011,7 +1011,7 @@ KCookieAdvice KCookieJar::cookieAdvice(KHttpCookiePtr cookiePtr) if (m_rejectCrossDomainCookies && cookiePtr->isCrossDomain()) return KCookieReject; - QStringList domains; + TQStringList domains; extractDomains(cookiePtr->host(), domains); @@ -1022,7 +1022,7 @@ KCookieAdvice KCookieJar::cookieAdvice(KHttpCookiePtr cookiePtr) { if (!domains.contains(cookiePtr->domain()) && !cookiePtr->domain().endsWith("."+cookiePtr->host())) - cookiePtr->fixDomain(QString::null); + cookiePtr->fixDomain(TQString::null); } if (m_autoAcceptSessionCookies && (cookiePtr->expireDate() == 0 || @@ -1031,10 +1031,10 @@ KCookieAdvice KCookieJar::cookieAdvice(KHttpCookiePtr cookiePtr) KCookieAdvice advice = KCookieDunno; bool isFQDN = true; // First is FQDN - QStringList::Iterator it = domains.begin(); // Start with FQDN which first in the list. + TQStringList::Iterator it = domains.begin(); // Start with FQDN which first in the list. while( (advice == KCookieDunno) && (it != domains.end())) { - QString domain = *it; + TQString domain = *it; // Check if a policy for the FQDN/domain is set. if ( domain[0] == '.' || isFQDN ) { @@ -1057,7 +1057,7 @@ KCookieAdvice KCookieJar::cookieAdvice(KHttpCookiePtr cookiePtr) // This function gets the advice for all cookies originating from // _domain. // -KCookieAdvice KCookieJar::getDomainAdvice(const QString &_domain) +KCookieAdvice KCookieJar::getDomainAdvice(const TQString &_domain) { KHttpCookieList *cookieList = m_cookieDomains[_domain]; KCookieAdvice advice; @@ -1078,9 +1078,9 @@ KCookieAdvice KCookieJar::getDomainAdvice(const QString &_domain) // This function sets the advice for all cookies originating from // _domain. // -void KCookieJar::setDomainAdvice(const QString &_domain, KCookieAdvice _advice) +void KCookieJar::setDomainAdvice(const TQString &_domain, KCookieAdvice _advice) { - QString domain(_domain); + TQString domain(_domain); KHttpCookieList *cookieList = m_cookieDomains[domain]; if (cookieList) @@ -1124,7 +1124,7 @@ void KCookieJar::setDomainAdvice(const QString &_domain, KCookieAdvice _advice) // void KCookieJar::setDomainAdvice(KHttpCookiePtr cookiePtr, KCookieAdvice _advice) { - QString domain; + TQString domain; stripDomain(cookiePtr->host(), domain); // We file the cookie under this domain. setDomainAdvice(domain, _advice); @@ -1143,7 +1143,7 @@ void KCookieJar::setGlobalAdvice(KCookieAdvice _advice) // // Get a list of all domains known to the cookie jar. // -const QStringList& KCookieJar::getDomainList() +const TQStringList& KCookieJar::getDomainList() { return m_domainList; } @@ -1151,10 +1151,10 @@ const QStringList& KCookieJar::getDomainList() // // Get a list of all cookies in the cookie jar originating from _domain. // -const KHttpCookieList *KCookieJar::getCookieList(const QString & _domain, - const QString & _fqdn ) +const KHttpCookieList *KCookieJar::getCookieList(const TQString & _domain, + const TQString & _fqdn ) { - QString domain; + TQString domain; if (_domain.isEmpty()) stripDomain( _fqdn, domain ); @@ -1170,7 +1170,7 @@ const KHttpCookieList *KCookieJar::getCookieList(const QString & _domain, // void KCookieJar::eatCookie(KHttpCookiePtr cookiePtr) { - QString domain = stripDomain(cookiePtr); // We file the cookie under this domain. + TQString domain = stripDomain(cookiePtr); // We file the cookie under this domain. KHttpCookieList *cookieList = m_cookieDomains[domain]; if (cookieList) @@ -1190,7 +1190,7 @@ void KCookieJar::eatCookie(KHttpCookiePtr cookiePtr) } } -void KCookieJar::eatCookiesForDomain(const QString &domain) +void KCookieJar::eatCookiesForDomain(const TQString &domain) { KHttpCookieList *cookieList = m_cookieDomains[domain]; if (!cookieList || cookieList->isEmpty()) return; @@ -1210,23 +1210,23 @@ void KCookieJar::eatSessionCookies( long windowId ) if (!windowId) return; - QStringList::Iterator it=m_domainList.begin(); + TQStringList::Iterator it=m_domainList.begin(); for ( ; it != m_domainList.end(); ++it ) eatSessionCookies( *it, windowId, false ); } void KCookieJar::eatAllCookies() { - for ( QStringList::Iterator it=m_domainList.begin(); + for ( TQStringList::Iterator it=m_domainList.begin(); it != m_domainList.end();) { - QString domain = *it++; + TQString domain = *it++; // This might remove domain from domainList! eatCookiesForDomain(domain); } } -void KCookieJar::eatSessionCookies( const QString& fqdn, long windowId, +void KCookieJar::eatSessionCookies( const TQString& fqdn, long windowId, bool isFQDN ) { KHttpCookieList* cookieList; @@ -1234,7 +1234,7 @@ void KCookieJar::eatSessionCookies( const QString& fqdn, long windowId, cookieList = m_cookieDomains[fqdn]; else { - QString domain; + TQString domain; stripDomain( fqdn, domain ); cookieList = m_cookieDomains[domain]; } @@ -1250,7 +1250,7 @@ void KCookieJar::eatSessionCookies( const QString& fqdn, long windowId, continue; } - QValueList<long> &ids = cookie->windowIds(); + TQValueList<long> &ids = cookie->windowIds(); if (!ids.remove(windowId) || !ids.isEmpty()) { cookie = cookieList->next(); @@ -1267,7 +1267,7 @@ void KCookieJar::eatSessionCookies( const QString& fqdn, long windowId, // Saves all cookies to the file '_filename'. // On succes 'true' is returned. // On failure 'false' is returned. -bool KCookieJar::saveCookies(const QString &_filename) +bool KCookieJar::saveCookies(const TQString &_filename) { KSaveFile saveFile(_filename, 0600); @@ -1284,10 +1284,10 @@ bool KCookieJar::saveCookies(const QString &_filename) "# Host", "Domain", "Path", "Exp.date", "Prot", "Name", "Sec", "Value"); - for ( QStringList::Iterator it=m_domainList.begin(); it != m_domainList.end(); + for ( TQStringList::Iterator it=m_domainList.begin(); it != m_domainList.end(); it++ ) { - const QString &domain = *it; + const TQString &domain = *it; bool domainPrinted = false; KHttpCookieList *cookieList = m_cookieDomains[domain]; @@ -1310,10 +1310,10 @@ bool KCookieJar::saveCookies(const QString &_filename) fprintf(fStream, "[%s]\n", domain.local8Bit().data()); } // Store persistent cookies - QString path = L1("\""); + TQString path = L1("\""); path += cookie->path(); path += '"'; - QString domain = L1("\""); + TQString domain = L1("\""); domain += cookie->domain(); domain += '"'; fprintf(fStream, "%-20s %-20s %-12s %10lu %3d %-20s %-4i %s\n", @@ -1374,9 +1374,9 @@ static const char *parseField(charPtr &buffer, bool keepQuotes=false) // Reloads all cookies from the file '_filename'. // On succes 'true' is returned. // On failure 'false' is returned. -bool KCookieJar::loadCookies(const QString &_filename) +bool KCookieJar::loadCookies(const TQString &_filename) { - FILE *fStream = fopen( QFile::encodeName(_filename), "r"); + FILE *fStream = fopen( TQFile::encodeName(_filename), "r"); if (fStream == 0) { return false; @@ -1457,11 +1457,11 @@ bool KCookieJar::loadCookies(const QString &_filename) if ((expDate == 0) || (expDate < curTime)) continue; - KHttpCookie *cookie = new KHttpCookie(QString::fromLatin1(host), - QString::fromLatin1(domain), - QString::fromLatin1(path), - QString::fromLatin1(name), - QString::fromLatin1(value), + KHttpCookie *cookie = new KHttpCookie(TQString::fromLatin1(host), + TQString::fromLatin1(domain), + TQString::fromLatin1(path), + TQString::fromLatin1(name), + TQString::fromLatin1(value), expDate, protVer, secure, httpOnly, explicitPath); addCookie(cookie); @@ -1489,16 +1489,16 @@ void KCookieJar::saveConfig(KConfig *_config) _config->setGroup("Cookie Policy"); _config->writeEntry("CookieGlobalAdvice", adviceToStr( m_globalAdvice)); - QStringList domainSettings; - for ( QStringList::Iterator it=m_domainList.begin(); + TQStringList domainSettings; + for ( TQStringList::Iterator it=m_domainList.begin(); it != m_domainList.end(); it++ ) { - const QString &domain = *it; + const TQString &domain = *it; KCookieAdvice advice = getDomainAdvice( domain); if (advice != KCookieDunno) { - QString value(domain); + TQString value(domain); value += ':'; value += adviceToStr(advice); domainSettings.append(value); @@ -1524,34 +1524,34 @@ void KCookieJar::loadConfig(KConfig *_config, bool reparse ) m_preferredPolicy = _config->readNumEntry( "PreferredPolicy", 0 ); _config->setGroup("Cookie Policy"); - QStringList domainSettings = _config->readListEntry("CookieDomainAdvice"); + TQStringList domainSettings = _config->readListEntry("CookieDomainAdvice"); m_rejectCrossDomainCookies = _config->readBoolEntry( "RejectCrossDomainCookies", true ); m_autoAcceptSessionCookies = _config->readBoolEntry( "AcceptSessionCookies", true ); m_ignoreCookieExpirationDate = _config->readBoolEntry( "IgnoreExpirationDate", false ); - QString value = _config->readEntry("CookieGlobalAdvice", L1("Ask")); + TQString value = _config->readEntry("CookieGlobalAdvice", L1("Ask")); m_globalAdvice = strToAdvice(value); // Reset current domain settings first. - for ( QStringList::Iterator it=m_domainList.begin(); it != m_domainList.end(); ) + for ( TQStringList::Iterator it=m_domainList.begin(); it != m_domainList.end(); ) { // Make sure to update iterator before calling setDomainAdvice() // setDomainAdvice() might delete the domain from domainList. - QString domain = *it++; + TQString domain = *it++; setDomainAdvice(domain, KCookieDunno); } // Now apply the domain settings read from config file... - for ( QStringList::Iterator it=domainSettings.begin(); + for ( TQStringList::Iterator it=domainSettings.begin(); it != domainSettings.end(); ) { - const QString &value = *it++; + const TQString &value = *it++; int sepPos = value.findRev(':'); if (sepPos <= 0) continue; - QString domain(value.left(sepPos)); + TQString domain(value.left(sepPos)); KCookieAdvice advice = strToAdvice( value.mid(sepPos + 1) ); setDomainAdvice(domain, advice); } diff --git a/kioslave/http/kcookiejar/kcookiejar.h b/kioslave/http/kcookiejar/kcookiejar.h index c73708bea..eb64485ea 100644 --- a/kioslave/http/kcookiejar/kcookiejar.h +++ b/kioslave/http/kcookiejar/kcookiejar.h @@ -25,10 +25,10 @@ #ifndef KCOOKIEJAR_H #define KCOOKIEJAR_H -#include <qstring.h> -#include <qstringlist.h> -#include <qdict.h> -#include <qptrlist.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqdict.h> +#include <tqptrlist.h> #include <time.h> class KConfig; @@ -52,40 +52,40 @@ class KHttpCookie friend class KHttpCookieList; protected: - QString mHost; - QString mDomain; - QString mPath; - QString mName; - QString mValue; + TQString mHost; + TQString mDomain; + TQString mPath; + TQString mName; + TQString mValue; time_t mExpireDate; int mProtocolVersion; bool mSecure; bool mCrossDomain; bool mHttpOnly; bool mExplicitPath; - QValueList<long> mWindowIds; + TQValueList<long> mWindowIds; - QString cookieStr(bool useDOMFormat); + TQString cookieStr(bool useDOMFormat); public: - KHttpCookie(const QString &_host=QString::null, - const QString &_domain=QString::null, - const QString &_path=QString::null, - const QString &_name=QString::null, - const QString &_value=QString::null, + KHttpCookie(const TQString &_host=TQString::null, + const TQString &_domain=TQString::null, + const TQString &_path=TQString::null, + const TQString &_name=TQString::null, + const TQString &_value=TQString::null, time_t _expireDate=0, int _protocolVersion=0, bool _secure = false, bool _httpOnly = false, bool _explicitPath = false); - QString domain(void) { return mDomain; } - QString host(void) { return mHost; } - QString path(void) { return mPath; } - QString name(void) { return mName; } - QString value(void) { return mValue; } - QValueList<long> &windowIds(void) { return mWindowIds; } - void fixDomain(const QString &domain) { mDomain = domain; } + TQString domain(void) { return mDomain; } + TQString host(void) { return mHost; } + TQString path(void) { return mPath; } + TQString name(void) { return mName; } + TQString value(void) { return mValue; } + TQValueList<long> &windowIds(void) { return mWindowIds; } + void fixDomain(const TQString &domain) { mDomain = domain; } time_t expireDate(void) { return mExpireDate; } int protocolVersion(void) { return mProtocolVersion; } bool isSecure(void) { return mSecure; } @@ -93,13 +93,13 @@ public: bool isCrossDomain(void) { return mCrossDomain; } bool isHttpOnly(void) { return mHttpOnly; } bool hasExplicitPath(void) { return mExplicitPath; } - bool match(const QString &fqdn, const QStringList &domainList, const QString &path); + bool match(const TQString &fqdn, const TQStringList &domainList, const TQString &path); }; -class KHttpCookieList : public QPtrList<KHttpCookie> +class KHttpCookieList : public TQPtrList<KHttpCookie> { public: - KHttpCookieList() : QPtrList<KHttpCookie>(), advice( KCookieDunno ) + KHttpCookieList() : TQPtrList<KHttpCookie>(), advice( KCookieDunno ) { } virtual ~KHttpCookieList() { } @@ -136,12 +136,12 @@ public: /** * Store all the cookies in a safe(?) place */ - bool saveCookies(const QString &_filename); + bool saveCookies(const TQString &_filename); /** * Load all the cookies from file and add them to the cookie jar. */ - bool loadCookies(const QString &_filename); + bool loadCookies(const TQString &_filename); /** * Save the cookie configuration @@ -164,7 +164,7 @@ public: * approved yet by the user but that will be included in the result * none the less. */ - QString findCookies(const QString &_url, bool useDOMFormat, long windowId, KHttpCookieList *pendingCookies=0); + TQString findCookies(const TQString &_url, bool useDOMFormat, long windowId, KHttpCookieList *pendingCookies=0); /** * This function parses cookie_headers and returns a linked list of @@ -174,7 +174,7 @@ public: * cookie_headers should be a concatenation of all lines of a HTTP-header * which start with "Set-Cookie". The lines should be separated by '\n's. */ - KHttpCookieList makeCookies(const QString &_url, const QCString &cookie_headers, long windowId); + KHttpCookieList makeCookies(const TQString &_url, const TQCString &cookie_headers, long windowId); /** * This function parses cookie_headers and returns a linked list of @@ -184,7 +184,7 @@ public: * cookie_domstr should be a concatenation of "name=value" pairs, separated * by a semicolon ';'. */ - KHttpCookieList makeDOMCookies(const QString &_url, const QCString &cookie_domstr, long windowId); + KHttpCookieList makeDOMCookies(const TQString &_url, const TQCString &cookie_domstr, long windowId); /** * This function hands a KHttpCookie object over to the cookie jar. @@ -213,7 +213,7 @@ public: * - KCookieReject, reject all cookies for _domain * - KCookieAsk, the user decides what to do with cookies for _domain */ - KCookieAdvice getDomainAdvice(const QString &_domain); + KCookieAdvice getDomainAdvice(const TQString &_domain); /** * This function sets the advice for all cookies originating from @@ -225,7 +225,7 @@ public: * - KCookieReject, reject all cookies for _domain * - KCookieAsk, the user decides what to do with cookies for _domain */ - void setDomainAdvice(const QString &_domain, KCookieAdvice _advice); + void setDomainAdvice(const TQString &_domain, KCookieAdvice _advice); /** * This function sets the advice for all cookies originating from @@ -269,13 +269,13 @@ public: * - It has a cookie originating from the domain * - It has a specific advice set for the domain */ - const QStringList& getDomainList(); + const TQStringList& getDomainList(); /** * Get a list of all cookies in the cookie jar originating from _domain. */ - const KHttpCookieList *getCookieList(const QString & _domain, - const QString& _fqdn ); + const KHttpCookieList *getCookieList(const TQString & _domain, + const TQString& _fqdn ); /** * Remove & delete a cookie from the jar. @@ -289,7 +289,7 @@ public: /** * Remove & delete all cookies for @p domain. */ - void eatCookiesForDomain(const QString &domain); + void eatCookiesForDomain(const TQString &domain); /** * Remove & delete all cookies @@ -306,25 +306,25 @@ public: * Removes all end of session cookies set by the * session @p windId. */ - void eatSessionCookies( const QString& fqdn, long windowId, bool isFQDN = true ); + void eatSessionCookies( const TQString& fqdn, long windowId, bool isFQDN = true ); /** * Parses _url and returns the FQDN (_fqdn) and path (_path). */ - static bool parseURL(const QString &_url, - QString &_fqdn, - QString &_path); + static bool parseURL(const TQString &_url, + TQString &_fqdn, + TQString &_path); /** * Returns a list of domains in @p _domainList relevant for this host. * The list is sorted with the FQDN listed first and the top-most * domain listed last */ - void extractDomains(const QString &_fqdn, - QStringList &_domainList); + void extractDomains(const TQString &_fqdn, + TQStringList &_domainList); - static QString adviceToStr(KCookieAdvice _advice); - static KCookieAdvice strToAdvice(const QString &_str); + static TQString adviceToStr(KCookieAdvice _advice); + static KCookieAdvice strToAdvice(const TQString &_str); /** Returns the */ int preferredDefaultPolicy() const { return m_preferredPolicy; } @@ -344,14 +344,14 @@ public: void setShowCookieDetails (bool value) { m_showCookieDetails = value; } protected: - void stripDomain(const QString &_fqdn, QString &_domain); - QString stripDomain( KHttpCookiePtr cookiePtr); + void stripDomain(const TQString &_fqdn, TQString &_domain); + TQString stripDomain( KHttpCookiePtr cookiePtr); protected: - QStringList m_domainList; + TQStringList m_domainList; KCookieAdvice m_globalAdvice; - QDict<KHttpCookieList> m_cookieDomains; - QDict<int> m_twoLevelTLD; + TQDict<KHttpCookieList> m_cookieDomains; + TQDict<int> m_twoLevelTLD; bool m_configChanged; bool m_cookiesChanged; diff --git a/kioslave/http/kcookiejar/kcookieserver.cpp b/kioslave/http/kcookiejar/kcookieserver.cpp index 365f15e79..e6469f127 100644 --- a/kioslave/http/kcookiejar/kcookieserver.cpp +++ b/kioslave/http/kcookiejar/kcookieserver.cpp @@ -29,9 +29,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <unistd.h> -#include <qtimer.h> -#include <qptrlist.h> -#include <qfile.h> +#include <tqtimer.h> +#include <tqptrlist.h> +#include <tqfile.h> #include <dcopclient.h> @@ -46,7 +46,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kcookieserver.h" extern "C" { - KDE_EXPORT KDEDModule *create_kcookiejar(const QCString &name) + KDE_EXPORT KDEDModule *create_kcookiejar(const TQCString &name) { return new KCookieServer(name); } @@ -62,20 +62,20 @@ class CookieRequest { public: DCOPClient *client; DCOPClientTransaction *transaction; - QString url; + TQString url; bool DOM; long windowId; }; -template class QPtrList<CookieRequest>; +template class TQPtrList<CookieRequest>; -class RequestList : public QPtrList<CookieRequest> +class RequestList : public TQPtrList<CookieRequest> { public: - RequestList() : QPtrList<CookieRequest>() { } + RequestList() : TQPtrList<CookieRequest>() { } }; -KCookieServer::KCookieServer(const QCString &name) +KCookieServer::KCookieServer(const TQCString &name) :KDEDModule(name) { mOldCookieServer = new DCOPClient(); // backwards compatibility. @@ -86,29 +86,29 @@ KCookieServer::KCookieServer(const QCString &name) mPendingCookies->setAutoDelete(true); mRequestList = new RequestList; mAdvicePending = false; - mTimer = new QTimer(); - connect( mTimer, SIGNAL( timeout()), SLOT( slotSave())); + mTimer = new TQTimer(); + connect( mTimer, TQT_SIGNAL( timeout()), TQT_SLOT( slotSave())); mConfig = new KConfig("kcookiejarrc"); mCookieJar->loadConfig( mConfig ); - QString filename = locateLocal("data", "kcookiejar/cookies"); + TQString filename = locateLocal("data", "kcookiejar/cookies"); // Stay backwards compatible! - QString filenameOld = locate("data", "kfm/cookies"); + TQString filenameOld = locate("data", "kfm/cookies"); if (!filenameOld.isEmpty()) { mCookieJar->loadCookies( filenameOld ); if (mCookieJar->saveCookies( filename)) { - unlink(QFile::encodeName(filenameOld)); // Remove old kfm cookie file + unlink(TQFile::encodeName(filenameOld)); // Remove old kfm cookie file } } else { mCookieJar->loadCookies( filename); } - connect(this, SIGNAL(windowUnregistered(long)), - this, SLOT(slotDeleteSessionCookies(long))); + connect(this, TQT_SIGNAL(windowUnregistered(long)), + this, TQT_SLOT(slotDeleteSessionCookies(long))); } KCookieServer::~KCookieServer() @@ -122,11 +122,11 @@ KCookieServer::~KCookieServer() delete mConfig; } -bool KCookieServer::cookiesPending( const QString &url, KHttpCookieList *cookieList ) +bool KCookieServer::cookiesPending( const TQString &url, KHttpCookieList *cookieList ) { - QString fqdn; - QStringList domains; - QString path; + TQString fqdn; + TQStringList domains; + TQString path; // Check whether 'url' has cookies on the pending list if (mPendingCookies->isEmpty()) return false; @@ -150,7 +150,7 @@ bool KCookieServer::cookiesPending( const QString &url, KHttpCookieList *cookieL return cookieList->isEmpty(); } -void KCookieServer::addCookies( const QString &url, const QCString &cookieHeader, +void KCookieServer::addCookies( const TQString &url, const TQCString &cookieHeader, long windowId, bool useDOMFormat ) { KHttpCookieList cookieList; @@ -216,7 +216,7 @@ void KCookieServer::checkCookies( KHttpCookieList *cookieList) KHttpCookieList currentList; currentList.append(currentCookie); - QString currentHost = currentCookie->host(); + TQString currentHost = currentCookie->host(); cookie = mPendingCookies->next(); while (cookie) @@ -275,13 +275,13 @@ void KCookieServer::checkCookies( KHttpCookieList *cookieList) { if (!cookiesPending( request->url )) { - QCString replyType; - QByteArray replyData; - QString res = mCookieJar->findCookies( request->url, request->DOM, request->windowId ); + TQCString replyType; + TQByteArray replyData; + TQString res = mCookieJar->findCookies( request->url, request->DOM, request->windowId ); - QDataStream stream2(replyData, IO_WriteOnly); + TQDataStream stream2(replyData, IO_WriteOnly); stream2 << res; - replyType = "QString"; + replyType = "TQString"; request->client->endTransaction( request->transaction, replyType, replyData); CookieRequest *tmp = request; @@ -300,7 +300,7 @@ void KCookieServer::checkCookies( KHttpCookieList *cookieList) void KCookieServer::slotSave() { - QString filename = locateLocal("data", "kcookiejar/cookies"); + TQString filename = locateLocal("data", "kcookiejar/cookies"); mCookieJar->saveCookies(filename); } @@ -312,10 +312,10 @@ void KCookieServer::saveCookieJar() mTimer->start( 1000*60*SAVE_DELAY, true ); } -void KCookieServer::putCookie( QStringList& out, KHttpCookie *cookie, - const QValueList<int>& fields ) +void KCookieServer::putCookie( TQStringList& out, KHttpCookie *cookie, + const TQValueList<int>& fields ) { - QValueList<int>::ConstIterator i = fields.begin(); + TQValueList<int>::ConstIterator i = fields.begin(); for ( ; i != fields.end(); ++i ) { switch(*i) @@ -336,23 +336,23 @@ void KCookieServer::putCookie( QStringList& out, KHttpCookie *cookie, out << cookie->value(); break; case CF_EXPIRE : - out << QString::number(cookie->expireDate()); + out << TQString::number(cookie->expireDate()); break; case CF_PROVER : - out << QString::number(cookie->protocolVersion()); + out << TQString::number(cookie->protocolVersion()); break; case CF_SECURE : - out << QString::number( cookie->isSecure() ? 1 : 0 ); + out << TQString::number( cookie->isSecure() ? 1 : 0 ); break; default : - out << QString::null; + out << TQString::null; } } } bool KCookieServer::cookieMatches( KHttpCookiePtr c, - QString domain, QString fqdn, - QString path, QString name ) + TQString domain, TQString fqdn, + TQString path, TQString name ) { if( c ) { @@ -369,14 +369,14 @@ bool KCookieServer::cookieMatches( KHttpCookiePtr c, // DCOP function QString -KCookieServer::findCookies(QString url) +KCookieServer::findCookies(TQString url) { return findCookies(url, 0); } // DCOP function QString -KCookieServer::findCookies(QString url, long windowId) +KCookieServer::findCookies(TQString url, long windowId) { if (cookiesPending(url)) { @@ -387,10 +387,10 @@ KCookieServer::findCookies(QString url, long windowId) request->DOM = false; request->windowId = windowId; mRequestList->append( request ); - return QString::null; // Talk to you later :-) + return TQString::null; // Talk to you later :-) } - QString cookies = mCookieJar->findCookies(url, false, windowId); + TQString cookies = mCookieJar->findCookies(url, false, windowId); if (mCookieJar->changed()) saveCookieJar(); @@ -402,9 +402,9 @@ KCookieServer::findCookies(QString url, long windowId) QStringList KCookieServer::findDomains() { - QStringList result; - const QStringList domains = mCookieJar->getDomainList(); - for ( QStringList::ConstIterator domIt = domains.begin(); + TQStringList result; + const TQStringList domains = mCookieJar->getDomainList(); + for ( TQStringList::ConstIterator domIt = domains.begin(); domIt != domains.end(); ++domIt ) { // Ignore domains that have policy set for but contain @@ -418,19 +418,19 @@ KCookieServer::findDomains() // DCOP function QStringList -KCookieServer::findCookies(QValueList<int> fields, - QString domain, - QString fqdn, - QString path, - QString name) +KCookieServer::findCookies(TQValueList<int> fields, + TQString domain, + TQString fqdn, + TQString path, + TQString name) { - QStringList result; + TQStringList result; bool allDomCookies = name.isEmpty(); const KHttpCookieList* list = mCookieJar->getCookieList(domain, fqdn); if ( list && !list->isEmpty() ) { - QPtrListIterator<KHttpCookie>it( *list ); + TQPtrListIterator<KHttpCookie>it( *list ); for ( ; it.current(); ++it ) { if ( !allDomCookies ) @@ -450,14 +450,14 @@ KCookieServer::findCookies(QValueList<int> fields, // DCOP function QString -KCookieServer::findDOMCookies(QString url) +KCookieServer::findDOMCookies(TQString url) { return findDOMCookies(url, 0); } // DCOP function QString -KCookieServer::findDOMCookies(QString url, long windowId) +KCookieServer::findDOMCookies(TQString url, long windowId) { // We don't wait for pending cookies because it locks up konqueror // which can cause a deadlock if it happens to have a popup-menu up. @@ -470,20 +470,20 @@ KCookieServer::findDOMCookies(QString url, long windowId) // DCOP function void -KCookieServer::addCookies(QString arg1, QCString arg2, long arg3) +KCookieServer::addCookies(TQString arg1, TQCString arg2, long arg3) { addCookies(arg1, arg2, arg3, false); } // DCOP function void -KCookieServer::deleteCookie(QString domain, QString fqdn, - QString path, QString name) +KCookieServer::deleteCookie(TQString domain, TQString fqdn, + TQString path, TQString name) { const KHttpCookieList* list = mCookieJar->getCookieList( domain, fqdn ); if ( list && !list->isEmpty() ) { - QPtrListIterator<KHttpCookie>it (*list); + TQPtrListIterator<KHttpCookie>it (*list); for ( ; it.current(); ++it ) { if( cookieMatches(it.current(), domain, fqdn, path, name) ) @@ -498,7 +498,7 @@ KCookieServer::deleteCookie(QString domain, QString fqdn, // DCOP function void -KCookieServer::deleteCookiesFromDomain(QString domain) +KCookieServer::deleteCookiesFromDomain(TQString domain) { mCookieJar->eatCookiesForDomain(domain); saveCookieJar(); @@ -521,7 +521,7 @@ KCookieServer::deleteSessionCookies( long windowId ) } void -KCookieServer::deleteSessionCookiesFor(QString fqdn, long windowId) +KCookieServer::deleteSessionCookiesFor(TQString fqdn, long windowId) { mCookieJar->eatSessionCookies( fqdn, windowId ); saveCookieJar(); @@ -537,20 +537,20 @@ KCookieServer::deleteAllCookies() // DCOP function void -KCookieServer::addDOMCookies(QString arg1, QCString arg2, long arg3) +KCookieServer::addDOMCookies(TQString arg1, TQCString arg2, long arg3) { addCookies(arg1, arg2, arg3, true); } // DCOP function void -KCookieServer::setDomainAdvice(QString url, QString advice) +KCookieServer::setDomainAdvice(TQString url, TQString advice) { - QString fqdn; - QString dummy; + TQString fqdn; + TQString dummy; if (KCookieJar::parseURL(url, fqdn, dummy)) { - QStringList domains; + TQStringList domains; mCookieJar->extractDomains(fqdn, domains); mCookieJar->setDomainAdvice(domains[domains.count() > 3 ? 3 : 0], @@ -562,17 +562,17 @@ KCookieServer::setDomainAdvice(QString url, QString advice) // DCOP function QString -KCookieServer::getDomainAdvice(QString url) +KCookieServer::getDomainAdvice(TQString url) { KCookieAdvice advice = KCookieDunno; - QString fqdn; - QString dummy; + TQString fqdn; + TQString dummy; if (KCookieJar::parseURL(url, fqdn, dummy)) { - QStringList domains; + TQStringList domains; mCookieJar->extractDomains(fqdn, domains); - QStringList::ConstIterator it = domains.begin(); + TQStringList::ConstIterator it = domains.begin(); while ( (advice == KCookieDunno) && (it != domains.end()) ) { // Always check advice in both ".domain" and "domain". Note diff --git a/kioslave/http/kcookiejar/kcookieserver.h b/kioslave/http/kcookiejar/kcookieserver.h index bcd7fa530..ac185c38d 100644 --- a/kioslave/http/kcookiejar/kcookieserver.h +++ b/kioslave/http/kcookiejar/kcookieserver.h @@ -25,7 +25,7 @@ #ifndef KCOOKIESERVER_H #define KCOOKIESERVER_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kded/kdedmodule.h> class KHttpCookieList; @@ -41,37 +41,37 @@ class KCookieServer : public KDEDModule Q_OBJECT K_DCOP public: - KCookieServer(const QCString &); + KCookieServer(const TQCString &); ~KCookieServer(); k_dcop: - QString findCookies(QString); - QString findCookies(QString, long); - QStringList findDomains(); - QStringList findCookies(QValueList<int>,QString,QString,QString,QString); - QString findDOMCookies(QString); - QString findDOMCookies(QString, long); - void addCookies(QString, QCString, long); - void deleteCookie(QString, QString, QString, QString); - void deleteCookiesFromDomain(QString); + TQString findCookies(TQString); + TQString findCookies(TQString, long); + TQStringList findDomains(); + TQStringList findCookies(TQValueList<int>,TQString,TQString,TQString,TQString); + TQString findDOMCookies(TQString); + TQString findDOMCookies(TQString, long); + void addCookies(TQString, TQCString, long); + void deleteCookie(TQString, TQString, TQString, TQString); + void deleteCookiesFromDomain(TQString); void deleteSessionCookies(long); - void deleteSessionCookiesFor(QString, long); + void deleteSessionCookiesFor(TQString, long); void deleteAllCookies(); - void addDOMCookies(QString, QCString, long); + void addDOMCookies(TQString, TQCString, long); /** * Sets the cookie policy for the domain associated with the specified URL. */ - void setDomainAdvice(QString url, QString advice); + void setDomainAdvice(TQString url, TQString advice); /** * Returns the cookie policy in effect for the specified URL. */ - QString getDomainAdvice(QString url); + TQString getDomainAdvice(TQString url); void reloadPolicy(); void shutdown(); public: - bool cookiesPending(const QString &url, KHttpCookieList *cookieList=0); - void addCookies(const QString &url, const QCString &cookieHeader, + bool cookiesPending(const TQString &url, KHttpCookieList *cookieList=0); + void addCookies(const TQString &url, const TQCString &cookieHeader, long windowId, bool useDOMFormat); void checkCookies(KHttpCookieList *cookieList); @@ -83,15 +83,15 @@ protected: KCookieJar *mCookieJar; KHttpCookieList *mPendingCookies; RequestList *mRequestList; - QTimer *mTimer; + TQTimer *mTimer; bool mAdvicePending; DCOPClient *mOldCookieServer; KConfig *mConfig; private: - virtual int newInstance(QValueList<QCString>) { return 0; } - bool cookieMatches(KHttpCookie*, QString, QString, QString, QString); - void putCookie(QStringList&, KHttpCookie*, const QValueList<int>&); + virtual int newInstance(TQValueList<TQCString>) { return 0; } + bool cookieMatches(KHttpCookie*, TQString, TQString, TQString, TQString); + void putCookie(TQStringList&, KHttpCookie*, const TQValueList<int>&); void saveCookieJar(); }; diff --git a/kioslave/http/kcookiejar/kcookiewin.cpp b/kioslave/http/kcookiejar/kcookiewin.cpp index 5c68f8c1e..2c11c33cb 100644 --- a/kioslave/http/kcookiejar/kcookiewin.cpp +++ b/kioslave/http/kcookiejar/kcookiewin.cpp @@ -30,30 +30,30 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // this file is also used in Konqueror/Embedded. One of the aims of // Konqueror/Embedded is to be a small as possible to fit on embedded // devices. For this it's also useful to strip out unneeded features of -// Qt, like for example QToolTip or QWhatsThis. The availability (or the +// Qt, like for example TQToolTip or TQWhatsThis. The availability (or the // lack thereof) can be determined using these preprocessor defines. // The same applies to the QT_NO_ACCEL ifdef below. I hope it doesn't make // too much trouble... (Simon) -#include <qhbox.h> -#include <qvbox.h> -#include <qaccel.h> -#include <qlabel.h> -#include <qwidget.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qdatetime.h> -#include <qmessagebox.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qvbuttongroup.h> +#include <tqhbox.h> +#include <tqvbox.h> +#include <tqaccel.h> +#include <tqlabel.h> +#include <tqwidget.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqdatetime.h> +#include <tqmessagebox.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> +#include <tqvbuttongroup.h> #ifndef QT_NO_TOOLTIP -#include <qtooltip.h> +#include <tqtooltip.h> #endif #ifndef QT_NO_WHATSTHIS -#include <qwhatsthis.h> +#include <tqwhatsthis.h> #endif #include <kidna.h> @@ -72,7 +72,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kcookiejar.h" #include "kcookiewin.h" -KCookieWin::KCookieWin( QWidget *parent, KHttpCookieList cookieList, +KCookieWin::KCookieWin( TQWidget *parent, KHttpCookieList cookieList, int defaultButton, bool showDetails ) :KDialog( parent, "cookiealert", true ) { @@ -94,42 +94,42 @@ KCookieWin::KCookieWin( QWidget *parent, KHttpCookieList cookieList, # endif #endif // Main widget's layout manager... - QVBoxLayout* vlayout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); - vlayout->setResizeMode( QLayout::Fixed ); + TQVBoxLayout* vlayout = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + vlayout->setResizeMode( TQLayout::Fixed ); // Cookie image and message to user - QHBox* hBox = new QHBox( this ); + TQHBox* hBox = new TQHBox( this ); hBox->setSpacing( KDialog::spacingHint() ); - QLabel* icon = new QLabel( hBox ); - icon->setPixmap( QMessageBox::standardIcon(QMessageBox::Warning) ); + TQLabel* icon = new TQLabel( hBox ); + icon->setPixmap( TQMessageBox::standardIcon(TQMessageBox::Warning) ); icon->setAlignment( Qt::AlignCenter ); icon->setFixedSize( 2*icon->sizeHint() ); int count = cookieList.count(); - QVBox* vBox = new QVBox( hBox ); - QString txt = i18n("You received a cookie from", + TQVBox* vBox = new TQVBox( hBox ); + TQString txt = i18n("You received a cookie from", "You received %n cookies from", count); - QLabel* lbl = new QLabel( txt, vBox ); + TQLabel* lbl = new TQLabel( txt, vBox ); lbl->setAlignment( Qt::AlignCenter ); KHttpCookiePtr cookie = cookieList.first(); - QString host (cookie->host()); + TQString host (cookie->host()); int pos = host.find(':'); if ( pos > 0 ) { - QString portNum = host.left(pos); + TQString portNum = host.left(pos); host.remove(0, pos+1); host += ':'; host += portNum; } - txt = QString("<b>%1</b>").arg( KIDNA::toUnicode(host) ); + txt = TQString("<b>%1</b>").arg( KIDNA::toUnicode(host) ); if (cookie->isCrossDomain()) txt += i18n(" <b>[Cross Domain!]</b>"); - lbl = new QLabel( txt, vBox ); + lbl = new TQLabel( txt, vBox ); lbl->setAlignment( Qt::AlignCenter ); - lbl = new QLabel( i18n("Do you want to accept or reject?"), vBox ); + lbl = new TQLabel( i18n("Do you want to accept or reject?"), vBox ); lbl->setAlignment( Qt::AlignCenter ); vlayout->addWidget( hBox, 0, Qt::AlignLeft ); @@ -140,29 +140,29 @@ KCookieWin::KCookieWin( QWidget *parent, KHttpCookieList cookieList, m_showDetails ? m_detailView->show():m_detailView->hide(); // Cookie policy choice... - m_btnGrp = new QVButtonGroup( i18n("Apply Choice To"), this ); + m_btnGrp = new TQVButtonGroup( i18n("Apply Choice To"), this ); m_btnGrp->setRadioButtonExclusive( true ); txt = (count == 1)? i18n("&Only this cookie") : i18n("&Only these cookies"); - QRadioButton* rb = new QRadioButton( txt, m_btnGrp ); + TQRadioButton* rb = new TQRadioButton( txt, m_btnGrp ); #ifndef QT_NO_WHATSTHIS - QWhatsThis::add( rb, i18n("Select this option to accept/reject only this cookie. " + TQWhatsThis::add( rb, i18n("Select this option to accept/reject only this cookie. " "You will be prompted if another cookie is received. " "<em>(see WebBrowsing/Cookies in the Control Center)</em>." ) ); #endif m_btnGrp->insert( rb ); - rb = new QRadioButton( i18n("All cookies from this do&main"), m_btnGrp ); + rb = new TQRadioButton( i18n("All cookies from this do&main"), m_btnGrp ); #ifndef QT_NO_WHATSTHIS - QWhatsThis::add( rb, i18n("Select this option to accept/reject all cookies from " + TQWhatsThis::add( rb, i18n("Select this option to accept/reject all cookies from " "this site. Choosing this option will add a new policy for " "the site this cookie originated from. This policy will be " "permanent until you manually change it from the Control Center " "<em>(see WebBrowsing/Cookies in the Control Center)</em>.") ); #endif m_btnGrp->insert( rb ); - rb = new QRadioButton( i18n("All &cookies"), m_btnGrp ); + rb = new TQRadioButton( i18n("All &cookies"), m_btnGrp ); #ifndef QT_NO_WHATSTHIS - QWhatsThis::add( rb, i18n("Select this option to accept/reject all cookies from " + TQWhatsThis::add( rb, i18n("Select this option to accept/reject all cookies from " "anywhere. Choosing this option will change the global " "cookie policy set in the Control Center for all cookies " "<em>(see WebBrowsing/Cookies in the Control Center)</em>.") ); @@ -176,29 +176,29 @@ KCookieWin::KCookieWin( QWidget *parent, KHttpCookieList cookieList, m_btnGrp->setButton( 1 ); // Accept/Reject buttons - QWidget* bbox = new QWidget( this ); - QBoxLayout* bbLay = new QHBoxLayout( bbox ); + TQWidget* bbox = new TQWidget( this ); + TQBoxLayout* bbLay = new TQHBoxLayout( bbox ); bbLay->setSpacing( KDialog::spacingHint() ); - QPushButton* btn = new QPushButton( i18n("&Accept"), bbox ); + TQPushButton* btn = new TQPushButton( i18n("&Accept"), bbox ); btn->setDefault( true ); btn->setFocus(); - connect( btn, SIGNAL(clicked()), SLOT(accept()) ); + connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(accept()) ); bbLay->addWidget( btn ); - btn = new QPushButton( i18n("&Reject"), bbox ); - connect( btn, SIGNAL(clicked()), SLOT(reject()) ); + btn = new TQPushButton( i18n("&Reject"), bbox ); + connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(reject()) ); bbLay->addWidget( btn ); bbLay->addStretch( 1 ); #ifndef QT_NO_ACCEL - QAccel* a = new QAccel( this ); - a->connectItem( a->insertItem(Qt::Key_Escape), btn, SLOT(animateClick()) ); + TQAccel* a = new TQAccel( this ); + a->connectItem( a->insertItem(Qt::Key_Escape), btn, TQT_SLOT(animateClick()) ); #endif - m_button = new QPushButton( bbox ); + m_button = new TQPushButton( bbox ); m_button->setText( m_showDetails ? i18n("&Details <<"):i18n("&Details >>") ); - connect( m_button, SIGNAL(clicked()), SLOT(slotCookieDetails()) ); + connect( m_button, TQT_SIGNAL(clicked()), TQT_SLOT(slotCookieDetails()) ); bbLay->addWidget( m_button ); #ifndef QT_NO_WHATSTHIS - QWhatsThis::add( m_button, i18n("See or modify the cookie information") ); + TQWhatsThis::add( m_button, i18n("See or modify the cookie information") ); #endif @@ -236,7 +236,7 @@ KCookieAdvice KCookieWin::advice( KCookieJar *cookiejar, KHttpCookie* cookie ) cookiejar->setShowCookieDetails ( m_showDetails ); - KCookieAdvice advice = (result==QDialog::Accepted) ? KCookieAccept:KCookieReject; + KCookieAdvice advice = (result==TQDialog::Accepted) ? KCookieAccept:KCookieReject; int preferredPolicy = m_btnGrp->id( m_btnGrp->selected() ); cookiejar->setPreferredDefaultPolicy( preferredPolicy ); @@ -257,17 +257,17 @@ KCookieAdvice KCookieWin::advice( KCookieJar *cookiejar, KHttpCookie* cookie ) } KCookieDetail::KCookieDetail( KHttpCookieList cookieList, int cookieCount, - QWidget* parent, const char* name ) - :QGroupBox( parent, name ) + TQWidget* parent, const char* name ) + :TQGroupBox( parent, name ) { setTitle( i18n("Cookie Details") ); - QGridLayout* grid = new QGridLayout( this, 9, 2, + TQGridLayout* grid = new TQGridLayout( this, 9, 2, KDialog::spacingHint(), KDialog::marginHint() ); grid->addRowSpacing( 0, fontMetrics().lineSpacing() ); grid->setColStretch( 1, 3 ); - QLabel* label = new QLabel( i18n("Name:"), this ); + TQLabel* label = new TQLabel( i18n("Name:"), this ); grid->addWidget( label, 1, 0 ); m_name = new KLineEdit( this ); m_name->setReadOnly( true ); @@ -275,35 +275,35 @@ KCookieDetail::KCookieDetail( KHttpCookieList cookieList, int cookieCount, grid->addWidget( m_name, 1 ,1 ); //Add the value - label = new QLabel( i18n("Value:"), this ); + label = new TQLabel( i18n("Value:"), this ); grid->addWidget( label, 2, 0 ); m_value = new KLineEdit( this ); m_value->setReadOnly( true ); m_value->setMaximumWidth( fontMetrics().maxWidth() * 25 ); grid->addWidget( m_value, 2, 1); - label = new QLabel( i18n("Expires:"), this ); + label = new TQLabel( i18n("Expires:"), this ); grid->addWidget( label, 3, 0 ); m_expires = new KLineEdit( this ); m_expires->setReadOnly( true ); m_expires->setMaximumWidth(fontMetrics().maxWidth() * 25 ); grid->addWidget( m_expires, 3, 1); - label = new QLabel( i18n("Path:"), this ); + label = new TQLabel( i18n("Path:"), this ); grid->addWidget( label, 4, 0 ); m_path = new KLineEdit( this ); m_path->setReadOnly( true ); m_path->setMaximumWidth( fontMetrics().maxWidth() * 25 ); grid->addWidget( m_path, 4, 1); - label = new QLabel( i18n("Domain:"), this ); + label = new TQLabel( i18n("Domain:"), this ); grid->addWidget( label, 5, 0 ); m_domain = new KLineEdit( this ); m_domain->setReadOnly( true ); m_domain->setMaximumWidth( fontMetrics().maxWidth() * 25 ); grid->addWidget( m_domain, 5, 1); - label = new QLabel( i18n("Exposure:"), this ); + label = new TQLabel( i18n("Exposure:"), this ); grid->addWidget( label, 6, 0 ); m_secure = new KLineEdit( this ); m_secure->setReadOnly( true ); @@ -312,12 +312,12 @@ KCookieDetail::KCookieDetail( KHttpCookieList cookieList, int cookieCount, if ( cookieCount > 1 ) { - QPushButton* btnNext = new QPushButton( i18n("Next cookie","&Next >>"), this ); + TQPushButton* btnNext = new TQPushButton( i18n("Next cookie","&Next >>"), this ); btnNext->setFixedSize( btnNext->sizeHint() ); grid->addMultiCellWidget( btnNext, 8, 8, 0, 1 ); - connect( btnNext, SIGNAL(clicked()), SLOT(slotNextCookie()) ); + connect( btnNext, TQT_SIGNAL(clicked()), TQT_SLOT(slotNextCookie()) ); #ifndef QT_NO_TOOLTIP - QToolTip::add( btnNext, i18n("Show details of the next cookie") ); + TQToolTip::add( btnNext, i18n("Show details of the next cookie") ); #endif } m_cookieList = cookieList; @@ -354,13 +354,13 @@ void KCookieDetail::slotNextCookie() else m_domain->setText( m_cookie->domain() ); m_path->setText( m_cookie->path() ); - QDateTime cookiedate; + TQDateTime cookiedate; cookiedate.setTime_t( m_cookie->expireDate() ); if ( m_cookie->expireDate() ) m_expires->setText( KGlobal::locale()->formatDateTime(cookiedate) ); else m_expires->setText( i18n("End of Session") ); - QString sec; + TQString sec; if (m_cookie->isSecure()) { if (m_cookie->isHttpOnly()) diff --git a/kioslave/http/kcookiejar/kcookiewin.h b/kioslave/http/kcookiejar/kcookiewin.h index 30e92e7e0..926964dec 100644 --- a/kioslave/http/kcookiejar/kcookiewin.h +++ b/kioslave/http/kcookiejar/kcookiewin.h @@ -27,7 +27,7 @@ #ifndef _KCOOKIEWIN_H_ #define _KCOOKIEWIN_H_ -#include <qgroupbox.h> +#include <tqgroupbox.h> #include <kdialog.h> #include "kcookiejar.h" @@ -42,7 +42,7 @@ class KCookieDetail : public QGroupBox Q_OBJECT public : - KCookieDetail( KHttpCookieList cookieList, int cookieCount, QWidget *parent=0, + KCookieDetail( KHttpCookieList cookieList, int cookieCount, TQWidget *parent=0, const char *name=0 ); ~KCookieDetail(); @@ -66,15 +66,15 @@ class KCookieWin : public KDialog Q_OBJECT public : - KCookieWin( QWidget *parent, KHttpCookieList cookieList, int defaultButton=0, + KCookieWin( TQWidget *parent, KHttpCookieList cookieList, int defaultButton=0, bool showDetails=false ); ~KCookieWin(); KCookieAdvice advice( KCookieJar *cookiejar, KHttpCookie* cookie ); private : - QPushButton* m_button; - QVButtonGroup* m_btnGrp; + TQPushButton* m_button; + TQVButtonGroup* m_btnGrp; KCookieDetail* m_detailView; bool m_showDetails; diff --git a/kioslave/http/kcookiejar/main.cpp b/kioslave/http/kcookiejar/main.cpp index 1e943b939..1a47b398e 100644 --- a/kioslave/http/kcookiejar/main.cpp +++ b/kioslave/http/kcookiejar/main.cpp @@ -53,39 +53,39 @@ extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) kapp->dcopClient()->attach(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - QCString replyType; - QByteArray replyData; + TQCString replyType; + TQByteArray replyData; if (args->isSet("remove-all")) { - kapp->dcopClient()->call( "kded", "kcookiejar", "deleteAllCookies()", QByteArray(), replyType, replyData); + kapp->dcopClient()->call( "kded", "kcookiejar", "deleteAllCookies()", TQByteArray(), replyType, replyData); } if (args->isSet("remove")) { - QString domain = args->getOption("remove"); - QByteArray params; - QDataStream stream(params, IO_WriteOnly); + TQString domain = args->getOption("remove"); + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); stream << domain; - kapp->dcopClient()->call( "kded", "kcookiejar", "deleteCookiesFromDomain(QString)", params, replyType, replyData); + kapp->dcopClient()->call( "kded", "kcookiejar", "deleteCookiesFromDomain(TQString)", params, replyType, replyData); } if (args->isSet("shutdown")) { - QCString module = "kcookiejar"; - QByteArray params; - QDataStream stream(params, IO_WriteOnly); + TQCString module = "kcookiejar"; + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); stream << module; - kapp->dcopClient()->call( "kded", "kded", "unloadModule(QCString)", params, replyType, replyData); + kapp->dcopClient()->call( "kded", "kded", "unloadModule(TQCString)", params, replyType, replyData); } else if(args->isSet("reload-config")) { - kapp->dcopClient()->call( "kded", "kcookiejar", "reloadPolicy()", QByteArray(), replyType, replyData); + kapp->dcopClient()->call( "kded", "kcookiejar", "reloadPolicy()", TQByteArray(), replyType, replyData); } else { - QCString module = "kcookiejar"; - QByteArray params; - QDataStream stream(params, IO_WriteOnly); + TQCString module = "kcookiejar"; + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); stream << module; - kapp->dcopClient()->call( "kded", "kded", "loadModule(QCString)", params, replyType, replyData); + kapp->dcopClient()->call( "kded", "kded", "loadModule(TQCString)", params, replyType, replyData); } return 0; diff --git a/kioslave/http/kcookiejar/tests/kcookiejartest.cpp b/kioslave/http/kcookiejar/tests/kcookiejartest.cpp index f196f1820..0ad238ab7 100644 --- a/kioslave/http/kcookiejar/tests/kcookiejartest.cpp +++ b/kioslave/http/kcookiejar/tests/kcookiejartest.cpp @@ -21,8 +21,8 @@ #include <stdio.h> #include <stdlib.h> -#include <qdatetime.h> -#include <qstring.h> +#include <tqdatetime.h> +#include <tqstring.h> #include <kapplication.h> #include <kaboutdata.h> @@ -34,8 +34,8 @@ static const char *description = "KCookiejar regression test"; static KCookieJar *jar; -static QCString *lastYear; -static QCString *nextYear; +static TQCString *lastYear; +static TQCString *nextYear; static KConfig *config = 0; @@ -45,13 +45,13 @@ static KCmdLineOptions options[] = KCmdLineLastOption }; -static void FAIL(const QString &msg) +static void FAIL(const TQString &msg) { qWarning("%s", msg.local8Bit().data()); exit(1); } -static void popArg(QCString &command, QCString & line) +static void popArg(TQCString &command, TQCString & line) { int i = line.find(' '); if (i != -1) @@ -67,17 +67,17 @@ static void popArg(QCString &command, QCString & line) } -static void popArg(QString &command, QCString & line) +static void popArg(TQString &command, TQCString & line) { int i = line.find(' '); if (i != -1) { - command = QString::fromLatin1(line.left(i)); + command = TQString::fromLatin1(line.left(i)); line = line.mid(i+1); } else { - command = QString::fromLatin1(line); + command = TQString::fromLatin1(line); line = 0; } } @@ -85,8 +85,8 @@ static void popArg(QString &command, QCString & line) static void clearConfig() { delete config; - QString file = locateLocal("config", "kcookiejar-testconfig"); - QFile::remove(file); + TQString file = locateLocal("config", "kcookiejar-testconfig"); + TQFile::remove(file); config = new KConfig(file); config->setGroup("Cookie Policy"); config->writeEntry("RejectCrossDomainCookies", false); @@ -103,8 +103,8 @@ static void clearCookies() static void saveCookies() { - QString file = locateLocal("config", "kcookiejar-testcookies"); - QFile::remove(file); + TQString file = locateLocal("config", "kcookiejar-testcookies"); + TQFile::remove(file); jar->saveCookies(file); delete jar; jar = new KCookieJar(); @@ -112,21 +112,21 @@ static void saveCookies() jar->loadCookies(file); } -static void processCookie(QCString &line) +static void processCookie(TQCString &line) { - QString policy; + TQString policy; popArg(policy, line); KCookieAdvice expectedAdvice = KCookieJar::strToAdvice(policy); if (expectedAdvice == KCookieDunno) - FAIL(QString("Unknown accept policy '%1'").arg(policy)); + FAIL(TQString("Unknown accept policy '%1'").arg(policy)); - QString urlStr; + TQString urlStr; popArg(urlStr, line); KURL url(urlStr); if (!url.isValid()) - FAIL(QString("Invalid URL '%1'").arg(urlStr)); + FAIL(TQString("Invalid URL '%1'").arg(urlStr)); if (url.isEmpty()) - FAIL(QString("Missing URL")); + FAIL(TQString("Missing URL")); line.replace("%LASTYEAR%", *lastYear); line.replace("%NEXTYEAR%", *nextYear); @@ -134,62 +134,62 @@ static void processCookie(QCString &line) KHttpCookieList list = jar->makeCookies(urlStr, line, 0); if (list.isEmpty()) - FAIL(QString("Failed to make cookies from: '%1'").arg(line)); + FAIL(TQString("Failed to make cookies from: '%1'").arg(line)); for(KHttpCookie *cookie = list.first(); cookie; cookie = list.next()) { KCookieAdvice cookieAdvice = jar->cookieAdvice(cookie); if (cookieAdvice != expectedAdvice) - FAIL(urlStr+QString("\n'%2'\nGot advice '%3' expected '%4'").arg(line) + FAIL(urlStr+TQString("\n'%2'\nGot advice '%3' expected '%4'").arg(line) .arg(KCookieJar::adviceToStr(cookieAdvice)) .arg(KCookieJar::adviceToStr(expectedAdvice))); jar->addCookie(cookie); } } -static void processCheck(QCString &line) +static void processCheck(TQCString &line) { - QString urlStr; + TQString urlStr; popArg(urlStr, line); KURL url(urlStr); if (!url.isValid()) - FAIL(QString("Invalid URL '%1'").arg(urlStr)); + FAIL(TQString("Invalid URL '%1'").arg(urlStr)); if (url.isEmpty()) - FAIL(QString("Missing URL")); + FAIL(TQString("Missing URL")); - QString expectedCookies = QString::fromLatin1(line); + TQString expectedCookies = TQString::fromLatin1(line); - QString cookies = jar->findCookies(urlStr, false, 0, 0).stripWhiteSpace(); + TQString cookies = jar->findCookies(urlStr, false, 0, 0).stripWhiteSpace(); if (cookies != expectedCookies) - FAIL(urlStr+QString("\nGot '%1' expected '%2'") + FAIL(urlStr+TQString("\nGot '%1' expected '%2'") .arg(cookies, expectedCookies)); } -static void processClear(QCString &line) +static void processClear(TQCString &line) { if (line == "CONFIG") clearConfig(); else if (line == "COOKIES") clearCookies(); else - FAIL(QString("Unknown command 'CLEAR %1'").arg(line)); + FAIL(TQString("Unknown command 'CLEAR %1'").arg(line)); } -static void processConfig(QCString &line) +static void processConfig(TQCString &line) { - QCString key; + TQCString key; popArg(key, line); if (key.isEmpty()) - FAIL(QString("Missing Key")); + FAIL(TQString("Missing Key")); config->setGroup("Cookie Policy"); config->writeEntry(key.data(), line.data()); jar->loadConfig(config, false); } -static void processLine(QCString line) +static void processLine(TQCString line) { if (line.isEmpty()) return; @@ -201,7 +201,7 @@ static void processLine(QCString line) return; } - QCString command; + TQCString command; popArg(command, line); if (command.isEmpty()) return; @@ -217,14 +217,14 @@ static void processLine(QCString line) else if (command == "SAVE") saveCookies(); else - FAIL(QString("Unknown command '%1'").arg(command)); + FAIL(TQString("Unknown command '%1'").arg(command)); } -static void runRegression(const QString &filename) +static void runRegression(const TQString &filename) { FILE *file = fopen(filename.local8Bit(), "r"); if (!file) - FAIL(QString("Can't open '%1'").arg(filename)); + FAIL(TQString("Can't open '%1'").arg(filename)); char buf[4096]; while (fgets(buf, sizeof(buf), file)) @@ -242,12 +242,12 @@ static void runRegression(const QString &filename) int main(int argc, char *argv[]) { - QString arg1; - QCString arg2; - QString result; + TQString arg1; + TQCString arg2; + TQString result; - lastYear = new QCString(QString("Fri, 04-May-%1 01:00:00 GMT").arg(QDate::currentDate().year()-1).utf8()); - nextYear = new QCString(QString(" expires=Fri, 04-May-%1 01:00:00 GMT").arg(QDate::currentDate().year()+1).utf8()); + lastYear = new TQCString(TQString("Fri, 04-May-%1 01:00:00 GMT").arg(TQDate::currentDate().year()-1).utf8()); + nextYear = new TQCString(TQString(" expires=Fri, 04-May-%1 01:00:00 GMT").arg(TQDate::currentDate().year()+1).utf8()); KAboutData about("kcookietest", "kcookietest", "1.0", description, KAboutData::License_GPL, "(C) 2004 Waldo Bastian"); KCmdLineArgs::init( argc, argv, &about); @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) clearConfig(); - QString file = args->url(0).path(); + TQString file = args->url(0).path(); runRegression(file); return 0; } |