summaryrefslogtreecommitdiffstats
path: root/kdecore/kurl.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-13 08:32:36 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-13 08:32:36 +0000
commitf7e71d47719ab6094cf4a9fafffa5ea351973522 (patch)
tree30834aa632d442019e14f88685001d94657d060b /kdecore/kurl.cpp
parentb31cfd9a1ee986fe2ae9a693f3afd7f171dd897c (diff)
downloadtdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.tar.gz
tdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.zip
Initial conversion for TQt for Qt4 3.4.0 TP2
This will also compile with TQt for Qt3, and should not cause any problems with dependent modules such as kdebase. If it does then it needs to be fixed! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1214149 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/kurl.cpp')
-rw-r--r--kdecore/kurl.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/kdecore/kurl.cpp b/kdecore/kurl.cpp
index cb396c3a5..047f18dee 100644
--- a/kdecore/kurl.cpp
+++ b/kdecore/kurl.cpp
@@ -87,7 +87,7 @@ static TQString encode( const TQString& segment, int encoding_offset, int encodi
return segment.isNull() ? TQString::null : TQString(""); // differentiate null and empty
// a worst case approximation
- TQChar *new_segment = new QChar[ old_length * 3 + 1 ];
+ TQChar *new_segment = new TQChar[ old_length * 3 + 1 ];
int new_length = 0;
for ( int i = 0; i < old_length; i++ )
@@ -167,19 +167,19 @@ static TQString lazy_encode( const TQString& segment, bool encodeAt=true )
return TQString::null;
// a worst case approximation
- TQChar *new_segment = new QChar[ old_length * 3 + 1 ];
+ TQChar *new_segment = new TQChar[ old_length * 3 + 1 ];
int new_length = 0;
for ( int i = 0; i < old_length; i++ )
{
- unsigned int character = segment[i].unicode(); // Don't use latin1()
+ unsigned int character = segment[i].tqunicode(); // Don't use latin1()
// It returns 0 for non-latin1 values
// Small set of really ambiguous chars
if ((character < 32) || // Low ASCII
((character == '%') && // The escape character itself
(i+2 < old_length) && // But only if part of a valid escape sequence!
- (hex2int(segment[i+1].unicode())!= -1) &&
- (hex2int(segment[i+2].unicode())!= -1)) ||
+ (hex2int(segment[i+1].tqunicode())!= -1) &&
+ (hex2int(segment[i+2].tqunicode())!= -1)) ||
(character == '?') || // Start of query delimiter
((character == '@') && encodeAt) || // Username delimiter
(character == '#') || // Start of reference delimiter
@@ -235,7 +235,7 @@ static void decode( const TQString& segment, TQString &decoded, TQString &encode
// make a copy of the old one
char *new_segment = new char[ old_length + 1 ];
- TQChar *new_usegment = new QChar[ old_length * 3 + 1 ];
+ TQChar *new_usegment = new TQChar[ old_length * 3 + 1 ];
int i = 0;
while( i < old_length )
@@ -291,12 +291,12 @@ static void decode( const TQString& segment, TQString &decoded, TQString &encode
{
decoded = textCodec->toUnicode( new_segment );
if ( isRawURI ) {
- int length = qstrlen( new_segment );
+ int length = tqstrlen( new_segment );
while ( length < new_length ) {
decoded += TQChar::null;
length += 1;
decoded += textCodec->toUnicode( new_segment + length );
- length += qstrlen( new_segment + length );
+ length += tqstrlen( new_segment + length );
}
}
@@ -338,7 +338,7 @@ static TQString cleanpath(const TQString &_path, bool cleanDirSeparator, bool de
#else
TQString encodedDot("%2e");
#endif
- if (path.find(encodedDot, 0, false) != -1)
+ if (path.tqfind(encodedDot, 0, false) != -1)
{
#ifndef KDE_QT_ONLY
static const TQString &encodedDOT = KGlobal::staticQString("%2E"); // Uppercase!
@@ -365,7 +365,7 @@ static TQString cleanpath(const TQString &_path, bool cleanDirSeparator, bool de
cdUp = 0;
pos = orig_pos = len;
- while ( pos && (pos = path.findRev('/',--pos)) != -1 )
+ while ( pos && (pos = path.tqfindRev('/',--pos)) != -1 )
{
len = orig_pos - pos - 1;
if ( len == 2 && path[pos+1] == '.' && path[pos+2] == '.' )
@@ -404,7 +404,7 @@ bool KURL::isRelativeURL(const TQString &_url)
{
int len = _url.length();
if (!len) return true; // Very short relative URL.
- const TQChar *str = _url.unicode();
+ const TQChar *str = _url.tqunicode();
// Absolute URL must start with alpha-character
if (!isalpha(str[0].latin1()))
@@ -471,13 +471,13 @@ KURL::KURL( const TQString &url, int encoding_hint )
KURL::KURL( const char * url, int encoding_hint )
{
reset();
- parse( TQString::fromLatin1(url), encoding_hint );
+ parse( TQString::tqfromLatin1(url), encoding_hint );
}
KURL::KURL( const TQCString& url, int encoding_hint )
{
reset();
- parse( TQString::fromLatin1(url), encoding_hint );
+ parse( TQString::tqfromLatin1(url), encoding_hint );
}
KURL::KURL( const KURL& _u )
@@ -493,13 +493,13 @@ TQDataStream & operator<< (TQDataStream & s, const KURL & a)
s << a.m_strProtocol << a.m_strUser << a.m_strPass << a.m_strHost
<< a.m_strPath << a.m_strPath_encoded << QueryForWire << a.m_strRef_encoded
- << Q_INT8(a.m_bIsMalformed ? 1 : 0) << a.m_iPort;
+ << TQ_INT8(a.m_bIsMalformed ? 1 : 0) << a.m_iPort;
return s;
}
TQDataStream & operator>> (TQDataStream & s, KURL & a)
{
- Q_INT8 malf;
+ TQ_INT8 malf;
TQString QueryFromWire;
s >> a.m_strProtocol >> a.m_strUser >> a.m_strPass >> a.m_strHost
>> a.m_strPath >> a.m_strPath_encoded >> QueryFromWire >> a.m_strRef_encoded
@@ -542,11 +542,11 @@ KURL::KURL( const KURL& _u, const TQString& _rel_url, int encoding_hint )
TQString rUrl = _rel_url;
int len = _u.m_strProtocol.length();
if ( !_u.m_strHost.isEmpty() && !rUrl.isEmpty() &&
- rUrl.find( _u.m_strProtocol, 0, false ) == 0 &&
+ rUrl.tqfind( _u.m_strProtocol, 0, false ) == 0 &&
rUrl[len] == ':' && (rUrl[len+1] != '/' ||
(rUrl[len+1] == '/' && rUrl[len+2] != '/')) )
{
- rUrl.remove( 0, rUrl.find( ':' ) + 1 );
+ rUrl.remove( 0, rUrl.tqfind( ':' ) + 1 );
}
if ( rUrl.isEmpty() )
@@ -579,13 +579,13 @@ KURL::KURL( const KURL& _u, const TQString& _rel_url, int encoding_hint )
}
else if ( rUrl[0] != '?' )
{
- int pos = m_strPath.findRev( '/' );
+ int pos = m_strPath.tqfindRev( '/' );
if (pos >= 0)
m_strPath.truncate(pos);
m_strPath += '/';
if (!m_strPath_encoded.isEmpty())
{
- pos = m_strPath_encoded.findRev( '/' );
+ pos = m_strPath_encoded.tqfindRev( '/' );
if (pos >= 0)
m_strPath_encoded.truncate(pos);
m_strPath_encoded += '/';
@@ -643,7 +643,7 @@ void KURL::parse( const TQString& _url, int encoding_hint )
return;
}
- const TQChar* buf = _url.unicode();
+ const TQChar* buf = _url.tqunicode();
const TQChar* orig = buf;
uint len = _url.length();
uint pos = 0;
@@ -707,7 +707,7 @@ NodeErr:
void KURL::parseRawURI( const TQString& _url, int encoding_hint )
{
uint len = _url.length();
- const TQChar* buf = _url.unicode();
+ const TQChar* buf = _url.tqunicode();
uint pos = 0;
@@ -748,9 +748,9 @@ void KURL::parseMailto( const TQString& _url, int encoding_hint )
#ifndef KDE_QT_ONLY
TQString host = KIDNA::toUnicode( mailre.cap( 2 ) );
if (host.isEmpty())
- host = mailre.cap( 2 ).lower();
+ host = TQString(mailre.cap( 2 )).lower();
#else
- TQString host = mailre.cap( 2 ).lower();
+ TQString host = TQString(mailre.cap( 2 )).lower();
#endif
m_strPath = mailre.cap( 1 ) + host;
}
@@ -762,7 +762,7 @@ void KURL::parseURL( const TQString& _url, int encoding_hint )
bool badHostName = false;
int start = 0;
uint len = _url.length();
- const TQChar* buf = _url.unicode();
+ const TQChar* buf = _url.tqunicode();
TQChar delim;
TQString tmp;
@@ -1040,7 +1040,7 @@ KURL& KURL::operator=( const TQString& _url )
KURL& KURL::operator=( const char * _url )
{
reset();
- parse( TQString::fromLatin1(_url) );
+ parse( TQString::tqfromLatin1(_url) );
return *this;
}
@@ -1231,7 +1231,7 @@ void KURL::setFileName( const TQString& _txt )
path = "/";
else
{
- int lastSlash = path.findRev( '/' );
+ int lastSlash = path.tqfindRev( '/' );
if ( lastSlash == -1)
{
// The first character is not a '/' ???
@@ -1347,7 +1347,7 @@ void KURL::setEncodedPath( const TQString& _txt, int encoding_hint )
void KURL::setEncodedPathAndQuery( const TQString& _txt, int encoding_hint )
{
- int pos = _txt.find( '?' );
+ int pos = _txt.tqfind( '?' );
if ( pos == -1 )
{
setEncodedPath(_txt, encoding_hint);
@@ -1490,7 +1490,7 @@ TQString KURL::url( int _trailing, int encoding_hint ) const
}
if ( m_iUriMode == URL )
{
- bool IPv6 = (m_strHost.find(':') != -1);
+ bool IPv6 = (m_strHost.tqfind(':') != -1);
if (IPv6)
u += '[' + m_strHost + ']';
else
@@ -1546,7 +1546,7 @@ TQString KURL::prettyURL( int _trailing ) const
}
if ( m_iUriMode == URL )
{
- bool IPv6 = (m_strHost.find(':') != -1);
+ bool IPv6 = (m_strHost.tqfind(':') != -1);
if (IPv6)
{
u += '[' + m_strHost + ']';
@@ -1704,13 +1704,13 @@ TQString KURL::fileName( bool _strip_trailing_slash ) const
// This is hairy, we need the last unencoded slash.
// Count in the encoded string how many encoded slashes follow the last
// unencoded one.
- int i = m_strPath_encoded.findRev( (QChar)'/', len - 1 );
+ int i = m_strPath_encoded.tqfindRev( (QChar)'/', len - 1 );
TQString fileName_encoded = m_strPath_encoded.mid(i+1);
- n += fileName_encoded.contains("%2f", false);
+ n += fileName_encoded.tqcontains("%2f", false);
}
int i = len;
do {
- i = path.findRev( (QChar)'/', i - 1 );
+ i = path.tqfindRev( (QChar)'/', i - 1 );
}
while (--n && (i > 0));
@@ -1773,7 +1773,7 @@ TQString KURL::directory( bool _strip_trailing_slash_from_result,
if ( result.isEmpty() || result == "/" )
return result;
- int i = result.findRev( "/" );
+ int i = result.tqfindRev( "/" );
// If ( i == -1 ) => the first character is not a '/'
// So it's some URL like file:blah.tgz, with no path
if ( i == -1 )
@@ -2143,14 +2143,14 @@ TQMap< TQString, TQString > KURL::queryItems( int options, int encoding_hint ) c
TQMap< TQString, TQString > result;
TQStringList items = TQStringList::split( '&', m_strQuery_encoded );
for ( TQStringList::const_iterator it = items.begin() ; it != items.end() ; ++it ) {
- int equal_pos = (*it).find( '=' );
+ int equal_pos = (*it).tqfind( '=' );
if ( equal_pos > 0 ) { // = is not the first char...
TQString name = (*it).left( equal_pos );
if ( options & CaseInsensitiveKeys )
name = name.lower();
TQString value = (*it).mid( equal_pos + 1 );
if ( value.isEmpty() )
- result.insert( name, TQString::fromLatin1("") );
+ result.insert( name, TQString::tqfromLatin1("") );
else {
// ### why is decoding name not necessary?
value.replace( '+', ' ' ); // + in queries means space
@@ -2191,7 +2191,7 @@ TQString KURL::queryItem( const TQString& _item, int encoding_hint ) const
return decode_string( str, encoding_hint );
}
else // empty value
- return TQString::fromLatin1("");
+ return TQString::tqfromLatin1("");
}
}