summaryrefslogtreecommitdiffabout
path: root/microkde/kurl.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kurl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kurl.cpp30
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
@@ -33,15 +33,17 @@
#else
#include <unistd.h>
#endif
-#include <qurl.h>
+#include <q3url.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qregexp.h>
//US#include <qstylesheet.h>
#include <qmap.h>
#include <qtextcodec.h>
+//Added by qt3to4:
+#include <Q3CString>
static const QString fileProt = "file";
static QTextCodec * codecForHint( int encoding_hint /* not 0 ! */ )
@@ -56,9 +58,9 @@ static QString encode( const QString& segment, bool encode_slash, int encoding_h
encode_string = "<>#@\"&%?={}|^~[]\'`\\:+/";
else
encode_string = "<>#@\"&%?={}|^~[]\'`\\:+";
- QCString local;
+ Q3CString local;
if (encoding_hint==0)
local = segment.local8Bit();
else
{
@@ -99,9 +101,9 @@ static QString encode( const QString& segment, bool encode_slash, int encoding_h
new_segment[ new_length++ ] = c;
}
else
- new_segment[ new_length++ ] = local[i];
+ new_segment[ new_length++ ] = character;
}
QString result = QString(new_segment, new_length);
delete [] new_segment;
@@ -204,9 +206,9 @@ static void decode( const QString& segment, QString &decoded, QString &encoded,
if (!textCodec)
textCodec = QTextCodec::codecForLocale();
- QCString csegment = textCodec->fromUnicode(segment);
+ Q3CString csegment = textCodec->fromUnicode(segment);
// Check if everything went ok
if (textCodec->toUnicode(csegment) != segment)
{
// Uh oh
@@ -277,9 +279,9 @@ static void decode( const QString& segment, QString &decoded, QString &encoded,
QByteArray array;
array.setRawData(new_segment, new_length);
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)
{
decoded = QString::fromLocal8Bit(new_segment, new_length);
@@ -418,9 +420,9 @@ KURL::KURL( const char * url, int encoding_hint )
reset();
parse( QString::fromLatin1(url), encoding_hint );
}
-KURL::KURL( const QCString& url, int encoding_hint )
+KURL::KURL( const Q3CString& url, int encoding_hint )
{
reset();
parse( QString::fromLatin1(url), encoding_hint );
}
@@ -459,9 +461,9 @@ QDataStream & operator>> (QDataStream & s, KURL & a)
return s;
}
#ifndef QT_NO_NETWORKPROTOCOL
-KURL::KURL( const QUrl &u )
+KURL::KURL( const Q3Url &u )
{
*this = u;
}
#endif
@@ -588,15 +590,15 @@ void KURL::parse( const QString& _url, int encoding_hint )
// Node 1: Accept alpha or slash
QChar x = buf[pos++];
if ( x == '/' )
goto Node9;
- if ( !isalpha( (int)x ) )
+ if ( !x.isLetter() )
goto NodeErr;
// Node 2: Accept any amount of (alpha|digit|'+'|'-')
// '.' 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++;
if ( pos+2 < len && buf[pos] == ':' && buf[pos+1] == '/' && buf[pos+2] == '/' )
{
@@ -768,13 +770,13 @@ void KURL::parse( const QString& _url, int encoding_hint )
// Node 8a: Accept at least one digit
if ( pos == len )
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();
if ( pos == len )
goto NodeOk;
@@ -847,9 +849,9 @@ KURL& KURL::operator=( const char * _url )
return *this;
}
#ifndef QT_NO_NETWORKPROTOCOL
-KURL& KURL::operator=( const QUrl & u )
+KURL& KURL::operator=( const Q3Url & u )
{
m_strProtocol = u.protocol();
m_strUser = u.user();
m_strPass = u.password();
@@ -1373,9 +1375,9 @@ KURL KURL::join( const KURL::List & lst )
{
KURL u(*it);
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
}
tmp = u;
}
@@ -1417,9 +1419,9 @@ QString KURL::fileName( bool _strip_trailing_slash ) const
// Count in the encoded string how many encoded slashes follow the last
// unencoded one.
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;
do {
i = path.findRev( '/', i - 1 );