-rw-r--r-- | microkde/kurl.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/microkde/kurl.cpp b/microkde/kurl.cpp index 2574e25..122ad71 100644 --- a/microkde/kurl.cpp +++ b/microkde/kurl.cpp @@ -35,5 +35,5 @@ #include <unistd.h> #endif -#include <qurl.h> +#include <q3url.h> #include <qdir.h> #include <qstringlist.h> @@ -42,4 +42,6 @@ #include <qmap.h> #include <qtextcodec.h> +//Added by qt3to4: +#include <Q3CString> static const QString fileProt = "file"; @@ -58,5 +60,5 @@ static QString encode( const QString& segment, bool encode_slash, int encoding_h encode_string = "<>#@\"&%?={}|^~[]\'`\\:+"; - QCString local; + Q3CString local; if (encoding_hint==0) local = segment.local8Bit(); @@ -101,5 +103,5 @@ static QString encode( const QString& segment, bool encode_slash, int encoding_h } else - new_segment[ new_length++ ] = local[i]; + new_segment[ new_length++ ] = character; } @@ -206,5 +208,5 @@ static void decode( const QString& segment, QString &decoded, QString &encoded, textCodec = QTextCodec::codecForLocale(); - QCString csegment = textCodec->fromUnicode(segment); + Q3CString csegment = textCodec->fromUnicode(segment); // Check if everything went ok if (textCodec->toUnicode(csegment) != segment) @@ -279,5 +281,5 @@ static void decode( const QString& segment, QString &decoded, QString &encoded, decoded = textCodec->toUnicode( array, new_length ); array.resetRawData(new_segment, new_length); - QCString validate = textCodec->fromUnicode(decoded); + Q3CString validate = textCodec->fromUnicode(decoded); if (strcmp(validate.data(), new_segment) != 0) @@ -420,5 +422,5 @@ KURL::KURL( const char * url, int encoding_hint ) } -KURL::KURL( const QCString& url, int encoding_hint ) +KURL::KURL( const Q3CString& url, int encoding_hint ) { reset(); @@ -461,5 +463,5 @@ QDataStream & operator>> (QDataStream & s, KURL & a) #ifndef QT_NO_NETWORKPROTOCOL -KURL::KURL( const QUrl &u ) +KURL::KURL( const Q3Url &u ) { *this = u; @@ -590,5 +592,5 @@ void KURL::parse( const QString& _url, int encoding_hint ) if ( x == '/' ) goto Node9; - if ( !isalpha( (int)x ) ) + if ( !x.isLetter() ) goto NodeErr; @@ -596,5 +598,5 @@ void KURL::parse( const QString& _url, int encoding_hint ) // '.' is not currently accepted, because current KURL may be confused. // Proceed with :// :/ or : - while( pos < len && (isalpha((int)buf[pos]) || isdigit((int)buf[pos]) || + while( pos < len && ( buf[pos].isLetter() || buf[pos].isDigit() || buf[pos] == '+' || buf[pos] == '-')) pos++; @@ -770,9 +772,9 @@ void KURL::parse( const QString& _url, int encoding_hint ) goto NodeErr; start = pos; - if ( !isdigit( buf[pos++] ) ) + if ( !buf[pos++].isDigit() ) goto NodeErr; // Node 8b: Accept any amount of digits - while( pos < len && isdigit( buf[pos] ) ) pos++; + while( pos < len && buf[pos].isDigit() ) pos++; port = QString( buf + start, pos - start ); m_iPort = port.toUShort(); @@ -849,5 +851,5 @@ KURL& KURL::operator=( const char * _url ) #ifndef QT_NO_NETWORKPROTOCOL -KURL& KURL::operator=( const QUrl & u ) +KURL& KURL::operator=( const Q3Url & u ) { m_strProtocol = u.protocol(); @@ -1375,5 +1377,5 @@ KURL KURL::join( const KURL::List & lst ) if (it != first) { - if (!u.m_strRef_encoded) u.m_strRef_encoded = tmp.url(); + if (u.m_strRef_encoded.isEmpty()) u.m_strRef_encoded = tmp.url(); else u.m_strRef_encoded += "#" + tmp.url(); // Support more than one suburl thingy } @@ -1419,5 +1421,5 @@ QString KURL::fileName( bool _strip_trailing_slash ) const int i = m_strPath_encoded.findRev( '/', len - 1 ); QString fileName_encoded = m_strPath_encoded.mid(i+1); - n += fileName_encoded.contains("%2f", false); + n += fileName_encoded.count("%2f", Qt::CaseInsensitive); } int i = len; |