diff --git a/dcop/client/dcop.cpp b/dcop/client/dcop.cpp index a78c8e016..1d167ce70 100644 --- a/dcop/client/dcop.cpp +++ b/dcop/client/dcop.cpp @@ -410,11 +410,11 @@ TQStringList dcopSessionList( const TQString &user, const TQString &home ) d.setFilter( TQDir::Files | TQDir::Hidden | TQDir::NoSymLinks ); d.setNameFilter( ".DCOPserver*" ); - const QFileInfoList *list = d.entryInfoList(); + const TQFileInfoList *list = d.entryInfoList(); if( !list ) return result; - QFileInfoListIterator it( *list ); + TQFileInfoListIterator it( *list ); TQFileInfo *fi; while ( ( fi = it.current() ) != 0 ) diff --git a/dcop/kdatastream.h b/dcop/kdatastream.h index f8502aaab..de85ebb47 100644 --- a/dcop/kdatastream.h +++ b/dcop/kdatastream.h @@ -3,6 +3,7 @@ #include +#ifdef USE_QT3 inline TQDataStream & operator << (TQDataStream & str, bool b) { str << Q_INT8(b); @@ -16,6 +17,7 @@ inline TQDataStream & operator >> (TQDataStream & str, bool & b) b = bool(l); return str; } +#endif // USE_QT3 #if QT_VERSION < 0x030200 && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) inline TQDataStream & operator << (TQDataStream & str, long long int ll) diff --git a/kdecore/kdebug.h b/kdecore/kdebug.h index 884545257..7d9dd5957 100644 --- a/kdecore/kdebug.h +++ b/kdecore/kdebug.h @@ -216,7 +216,7 @@ class KDECORE_EXPORT kdbgstream { kdbgstream &operator<<(const TQString& string) { if (!print) return *this; output += string; - if (output.at(output.length() -1 ) == '\n') + if (output.at(output.length() -1 ) == (QChar)'\n') flush(); return *this; } @@ -228,7 +228,7 @@ class KDECORE_EXPORT kdbgstream { kdbgstream &operator<<(const char *string) { if (!print) return *this; output += TQString::fromUtf8(string); - if (output.at(output.length() - 1) == '\n') + if (output.at(output.length() - 1) == (QChar)'\n') flush(); return *this; } diff --git a/kdecore/kurl.cpp b/kdecore/kurl.cpp index 2d2082e7f..cb396c3a5 100644 --- a/kdecore/kurl.cpp +++ b/kdecore/kurl.cpp @@ -112,7 +112,7 @@ static TQString encode( const TQString& segment, int encoding_offset, int encodi } else - new_segment[ new_length++ ] = local[i]; + new_segment[ new_length++ ] = (QChar)local[i]; } TQString result = TQString(new_segment, new_length); @@ -183,7 +183,7 @@ static TQString lazy_encode( const TQString& segment, bool encodeAt=true ) (character == '?') || // Start of query delimiter ((character == '@') && encodeAt) || // Username delimiter (character == '#') || // Start of reference delimiter - ((character == 32) && (i+1 == old_length || segment[i+1] == ' '))) // A trailing space + ((character == 32) && (i+1 == old_length || segment[i+1] == (QChar)' '))) // A trailing space { new_segment[ new_length++ ] = '%'; @@ -657,7 +657,7 @@ void KURL::parse( const TQString& _url, int encoding_hint ) goto NodeErr; if (alpha && buf[pos]==':' && (len==2 || (len>2 && (buf[pos+1]=='/' || buf[pos+1]=='\\')))) #else - if ( x == '/' ) + if ( x == (QChar)'/' ) #endif { // A slash means we immediately proceed to parse it as a file URL. @@ -673,9 +673,9 @@ void KURL::parse( const TQString& _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]) || - buf[pos] == '+' || buf[pos] == '-')) pos++; + buf[pos] == (QChar)'+' || buf[pos] == (QChar)'-')) pos++; - if (pos < len && buf[pos] == ':' ) + if (pos < len && buf[pos] == (QChar)':' ) { m_strProtocol = TQString( orig, pos ).lower(); if ( m_iUriMode == Auto ) @@ -715,10 +715,10 @@ void KURL::parseRawURI( const TQString& _url, int encoding_hint ) // '.' is not currently accepted, because current KURL may be confused. // Proceed with : while( pos < len && (isalpha((int)buf[pos]) || isdigit((int)buf[pos]) || - buf[pos] == '+' || buf[pos] == '-')) pos++; + buf[pos] == (QChar)'+' || buf[pos] == (QChar)'-')) pos++; // Note that m_strProtocol is already set here, so we just skip over the protocol. - if (pos < len && buf[pos] == ':' ) + if (pos < len && buf[pos] == (QChar)':' ) pos++; else { // can't happen, the caller checked all this already reset(); @@ -776,9 +776,9 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) const bool alpha = isalpha((int)x); if (alpha && len<2) goto NodeErr; - if (alpha && buf[pos]==':' && (len==2 || (len>2 && (buf[pos+1]=='/' || buf[pos+1]=='\\')))) + if (alpha && buf[pos]==(QChar)':' && (len==2 || (len>2 && (buf[pos+1]==(QChar)'/' || buf[pos+1]==(QChar)'\\')))) #else - if ( x == '/' ) + if ( x == (QChar)'/' ) #endif goto Node9; if ( !isalpha( (int)x ) ) @@ -788,14 +788,14 @@ void KURL::parseURL( const TQString& _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]) || - buf[pos] == '+' || buf[pos] == '-')) pos++; + buf[pos] == (QChar)'+' || buf[pos] == (QChar)'-')) pos++; // Note that m_strProtocol is already set here, so we just skip over the protocol. - if ( pos+2 < len && buf[pos] == ':' && buf[pos+1] == '/' && buf[pos+2] == '/' ) + if ( pos+2 < len && buf[pos] == (QChar)':' && buf[pos+1] == (QChar)'/' && buf[pos+2] == (QChar)'/' ) { pos += 3; } - else if (pos+1 < len && buf[pos] == ':' ) // Need to always compare length()-1 otherwise KURL passes "http:" as legal!! + else if (pos+1 < len && buf[pos] == (QChar)':' ) // Need to always compare length()-1 otherwise KURL passes "http:" as legal!! { pos++; start = pos; @@ -810,13 +810,13 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) start = pos; // Node 4: Accept any amount of characters. - if (buf[pos] == '[') // An IPv6 host follows. + if (buf[pos] == (QChar)'[') // An IPv6 host follows. goto Node8; // Terminate on / or @ or ? or # or " or ; or < x = buf[pos]; - while( (x != ':') && (x != '@') && (x != '/') && (x != '?') && (x != '#') ) + while( (x != (QChar)':') && (x != (QChar)'@') && (x != (QChar)'/') && (x != (QChar)'?') && (x != (QChar)'#') ) { - if ((x == '\"') || (x == ';') || (x == '<')) + if ((x == (QChar)'\"') || (x == (QChar)';') || (x == (QChar)'<')) badHostName = true; if (++pos == len) break; @@ -830,13 +830,13 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) setHost(decode(TQString( buf + start, pos - start ), encoding_hint)); goto NodeOk; } - if ( x == '@' ) + if ( x == (QChar)'@' ) { m_strUser = decode(TQString( buf + start, pos - start ), encoding_hint); pos++; goto Node7; } - else if ( (x == '/') || (x == '?') || (x == '#')) + else if ( (x == (QChar)'/') || (x == (QChar)'?') || (x == (QChar)'#')) { if (badHostName) goto NodeErr; @@ -845,7 +845,7 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) start = pos; goto Node9; } - else if ( x != ':' ) + else if ( x != (QChar)':' ) goto NodeErr; m_strUser = decode(TQString( buf + start, pos - start ), encoding_hint); pos++; @@ -857,13 +857,13 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) // Node 6: Read everything until @, /, ? or # while( (pos < len) && - (buf[pos] != '@') && - (buf[pos] != '/') && - (buf[pos] != '?') && - (buf[pos] != '#')) pos++; + (buf[pos] != (QChar)'@') && + (buf[pos] != (QChar)'/') && + (buf[pos] != (QChar)'?') && + (buf[pos] != (QChar)'#')) pos++; // If we now have a '@' the ':' seperates user and password. // Otherwise it seperates host and port. - if ( (pos == len) || (buf[pos] != '@') ) + if ( (pos == len) || (buf[pos] != (QChar)'@') ) { // Ok the : was used to separate host and port if (badHostName) @@ -877,10 +877,10 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) goto NodeOk; // there is more after the digits pos -= strlen(endptr); - if ((buf[pos] != '@') && - (buf[pos] != '/') && - (buf[pos] != '?') && - (buf[pos] != '#')) + if ((buf[pos] != (QChar)'@') && + (buf[pos] != (QChar)'/') && + (buf[pos] != (QChar)'?') && + (buf[pos] != (QChar)'#')) goto NodeErr; start = pos; @@ -895,7 +895,7 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) goto NodeErr; Node8: - if (buf[pos] == '[') + if (buf[pos] == (QChar)'[') { // IPv6 address start = ++pos; // Skip '[' @@ -908,9 +908,9 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) // Node 8a: Read everything until ] or terminate badHostName = false; x = buf[pos]; - while( (x != ']') ) + while( (x != (QChar)']') ) { - if ((x == '\"') || (x == ';') || (x == '<')) + if ((x == (QChar)'\"') || (x == (QChar)';') || (x == (QChar)'<')) badHostName = true; if (++pos == len) { @@ -934,9 +934,9 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) // Node 8b: Read everything until / : or terminate badHostName = false; x = buf[pos]; - while( (x != ':') && (x != '@') && (x != '/') && (x != '?') && (x != '#') ) + while( (x != (QChar)':') && (x != (QChar)'@') && (x != (QChar)'/') && (x != (QChar)'?') && (x != (QChar)'#') ) { - if ((x == '\"') || (x == ';') || (x == '<')) + if ((x == (QChar)'\"') || (x == (QChar)';') || (x == (QChar)'<')) badHostName = true; if (++pos == len) break; @@ -952,12 +952,12 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) setHost(decode(TQString( buf + start, pos - start ), encoding_hint)); } x = buf[pos]; - if ( x == '/' || x == '#' || x == '?' ) + if ( x == (QChar)'/' || x == (QChar)'#' || x == (QChar)'?' ) { start = pos; goto Node9; } - else if ( x != ':' ) + else if ( x != (QChar)':' ) goto NodeErr; pos++; @@ -978,7 +978,7 @@ void KURL::parseURL( const TQString& _url, int encoding_hint ) Node9: // parse path until query or reference reached - while( pos < len && buf[pos] != '#' && buf[pos]!='?' ) pos++; + while( pos < len && buf[pos] != (QChar)'#' && buf[pos]!=(QChar)'?' ) pos++; tmp = TQString( buf + start, pos - start ); //kdDebug(126)<<" setting encoded path to:"< 1 && result[ len - 1 ] == '/') + while (len > 1 && result[ len - 1 ] == (QChar)'/') { len--; } @@ -1687,14 +1687,14 @@ TQString KURL::fileName( bool _strip_trailing_slash ) const if ( _strip_trailing_slash ) { - while ( len >= 1 && path[ len - 1 ] == '/' ) + while ( len >= 1 && path[ len - 1 ] == (QChar)'/' ) len--; } - else if ( path[ len - 1 ] == '/' ) + else if ( path[ len - 1 ] == (QChar)'/' ) return fname; // Does the path only consist of '/' characters ? - if ( len == 1 && path[ 0 ] == '/' ) + if ( len == 1 && path[ 0 ] == (QChar)'/' ) return fname; // Skip last n slashes @@ -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( '/', len - 1 ); + int i = m_strPath_encoded.findRev( (QChar)'/', len - 1 ); TQString fileName_encoded = m_strPath_encoded.mid(i+1); n += fileName_encoded.contains("%2f", false); } int i = len; do { - i = path.findRev( '/', i - 1 ); + i = path.findRev( (QChar)'/', i - 1 ); } while (--n && (i > 0)); @@ -1749,14 +1749,14 @@ void KURL::addPath( const TQString& _txt ) int i = 0; int len = m_strPath.length(); // Add the trailing '/' if it is missing - if ( _txt[0] != '/' && ( len == 0 || m_strPath[ len - 1 ] != '/' ) ) + if ( _txt[0] != (QChar)'/' && ( len == 0 || m_strPath[ len - 1 ] != (QChar)'/' ) ) m_strPath += "/"; // No double '/' characters i = 0; - if ( len != 0 && m_strPath[ len - 1 ] == '/' ) + if ( len != 0 && m_strPath[ len - 1 ] == (QChar)'/' ) { - while( _txt[i] == '/' ) + while( _txt[i] == (QChar)'/' ) ++i; } @@ -1812,7 +1812,7 @@ bool KURL::cd( const TQString& _dir ) } // absolute path ? - if ( _dir[0] == '/' ) + if ( _dir[0] == (QChar)'/' ) { m_strPath_encoded = TQString::null; m_strPath = _dir; @@ -1822,7 +1822,7 @@ bool KURL::cd( const TQString& _dir ) } // Users home directory on the local disk ? - if ( ( _dir[0] == '~' ) && ( m_strProtocol == fileProt )) + if ( ( _dir[0] == (QChar)'~' ) && ( m_strProtocol == fileProt )) { m_strPath_encoded = TQString::null; m_strPath = TQDir::homeDirPath(); @@ -2011,7 +2011,7 @@ void KURL::setDirectory( const TQString &dir) void KURL::setQuery( const TQString &_txt, int encoding_hint) { - if (_txt[0] == '?') + if (_txt[0] == (QChar)'?') _setQuery( _txt.length() > 1 ? _txt.mid(1) : "" /*empty, not null*/, encoding_hint ); else _setQuery( _txt, encoding_hint ); @@ -2249,7 +2249,7 @@ KURL KURL::fromPathOrURL( const TQString& text ) static TQString _relativePath(const TQString &base_dir, const TQString &path, bool &isParent) { TQString _base_dir(TQDir::cleanDirPath(base_dir)); - TQString _path(TQDir::cleanDirPath(path.isEmpty() || (path[0] != '/') ? _base_dir+"/"+path : path)); + TQString _path(TQDir::cleanDirPath(path.isEmpty() || (path[0] != (QChar)'/') ? _base_dir+"/"+path : path)); if (_base_dir.isEmpty()) return _path; @@ -2274,7 +2274,7 @@ static TQString _relativePath(const TQString &base_dir, const TQString &path, bo for(uint i = level; i < list2.count(); i++) result.append(list2[i]).append("/"); - if ((level < list2.count()) && (path[path.length()-1] != '/')) + if ((level < list2.count()) && (path[path.length()-1] != (QChar)'/')) result.truncate(result.length()-1); isParent = (level == list1.count()); diff --git a/kdecore/network/kbufferedsocket.cpp b/kdecore/network/kbufferedsocket.cpp index 52d826c88..04115c051 100644 --- a/kdecore/network/kbufferedsocket.cpp +++ b/kdecore/network/kbufferedsocket.cpp @@ -93,7 +93,12 @@ void KBufferedSocket::close() } } +#ifdef USE_QT3 Q_LONG KBufferedSocket::bytesAvailable() const +#endif +#ifdef USE_QT4 +qint64 KBufferedSocket::bytesAvailable() const +#endif { if (!d->input) return KStreamSocket::bytesAvailable(); @@ -279,7 +284,12 @@ KIOBufferBase* KBufferedSocket::outputBuffer() return d->output; } +#ifdef USE_QT3 Q_ULONG KBufferedSocket::bytesToWrite() const +#endif +#ifdef USE_QT4 +qint64 KBufferedSocket::bytesToWrite() const +#endif { if (!d->output) return 0; diff --git a/kdecore/network/kbufferedsocket.h b/kdecore/network/kbufferedsocket.h index d99862781..bca034002 100644 --- a/kdecore/network/kbufferedsocket.h +++ b/kdecore/network/kbufferedsocket.h @@ -98,7 +98,12 @@ public: /** * Make use of the buffers. */ +#ifdef USE_QT3 virtual Q_LONG bytesAvailable() const; +#endif +#ifdef USE_QT4 + virtual qint64 bytesAvailable() const; +#endif /** * Make use of buffers. @@ -177,7 +182,12 @@ public: /** * Returns the length of the output buffer. */ +#ifdef USE_QT3 virtual Q_ULONG bytesToWrite() const; +#endif +#ifdef USE_QT4 + virtual qint64 bytesToWrite() const; +#endif /** * Closes the socket and discards any output data that had been buffered @@ -244,7 +254,12 @@ public: * which required a call to reset() in order to be able to connect again * using the same device. This is not necessary in KBufferedSocket any more. */ +#ifdef USE_QT3 inline void reset() +#endif +#ifdef USE_QT4 + inline bool reset() +#endif { closeNow(); } }; diff --git a/kdecore/network/kclientsocketbase.cpp b/kdecore/network/kclientsocketbase.cpp index 2da802d56..7ac3ca3b1 100644 --- a/kdecore/network/kclientsocketbase.cpp +++ b/kdecore/network/kclientsocketbase.cpp @@ -278,7 +278,12 @@ void KClientSocketBase::close() } // This function is unlike all the others because it is const +#ifdef USE_QT3 Q_LONG KClientSocketBase::bytesAvailable() const +#endif +#ifdef USE_QT4 +qint64 KClientSocketBase::bytesAvailable() const +#endif { return socketDevice()->bytesAvailable(); } diff --git a/kdecore/network/kclientsocketbase.h b/kdecore/network/kclientsocketbase.h index 1a6d3b8b1..d4e31b6b3 100644 --- a/kdecore/network/kclientsocketbase.h +++ b/kdecore/network/kclientsocketbase.h @@ -292,7 +292,12 @@ public: * Returns the number of bytes available on this socket. * Reimplemented from KSocketBase. */ +#ifdef USE_QT3 virtual Q_LONG bytesAvailable() const; +#endif +#ifdef USE_QT4 + virtual qint64 bytesAvailable() const; +#endif /** * Waits for more data. Reimplemented from KSocketBase. diff --git a/kdecore/network/kresolver.cpp b/kdecore/network/kresolver.cpp index 598b6de55..cfb87e3ef 100644 --- a/kdecore/network/kresolver.cpp +++ b/kdecore/network/kresolver.cpp @@ -72,7 +72,7 @@ using namespace KNetwork::Internal; ///////////////////////////////////////////// // class KResolverEntry -class KNetwork::KResolverEntryPrivate: public QShared +class KNetwork::KResolverEntryPrivate: public TQShared { public: KSocketAddress addr; diff --git a/kdecore/network/ksocketbase.h b/kdecore/network/ksocketbase.h index 5ef298847..133086114 100644 --- a/kdecore/network/ksocketbase.h +++ b/kdecore/network/ksocketbase.h @@ -532,7 +532,12 @@ public: * Returns the number of bytes available for reading without * blocking. */ +#ifdef USE_QT3 virtual Q_LONG bytesAvailable() const = 0; +#endif +#ifdef USE_QT4 + virtual qint64 bytesAvailable() const = 0; +#endif /** * Waits up to @p msecs for more data to be available on this socket. diff --git a/kdecore/network/ksocketdevice.cpp b/kdecore/network/ksocketdevice.cpp index 2885efdb3..53a16ca0a 100644 --- a/kdecore/network/ksocketdevice.cpp +++ b/kdecore/network/ksocketdevice.cpp @@ -364,7 +364,12 @@ bool KSocketDevice::disconnect() return true; // all is well } +#ifdef USE_QT3 Q_LONG KSocketDevice::bytesAvailable() const +#endif +#ifdef USE_QT4 +qint64 KSocketDevice::bytesAvailable() const +#endif { if (m_sockfd == -1) return -1; // there's nothing to read in a closed socket diff --git a/kdecore/network/ksocketdevice.h b/kdecore/network/ksocketdevice.h index 1bf4771c2..5f86687b2 100644 --- a/kdecore/network/ksocketdevice.h +++ b/kdecore/network/ksocketdevice.h @@ -198,7 +198,12 @@ public: /** * Returns the number of bytes available for reading without blocking. */ +#ifdef USE_QT3 virtual Q_LONG bytesAvailable() const; +#endif +#ifdef USE_QT4 + virtual qint64 bytesAvailable() const; +#endif /** * Waits up to @p msecs for more data to be available on this socket. diff --git a/kdecore/svgicons/ksvgiconengine.cpp b/kdecore/svgicons/ksvgiconengine.cpp index 18d52bee7..dd54e99be 100644 --- a/kdecore/svgicons/ksvgiconengine.cpp +++ b/kdecore/svgicons/ksvgiconengine.cpp @@ -441,7 +441,7 @@ public: { // Scale, if needed if(image.width() != (int) w || image.height() != (int) h) - image = image.smoothScale((int) w, (int) h, TQImage::ScaleFree); + image = image.smoothScale((int) w, (int) h, TQImage_ScaleFree); m_engine->painter()->drawImage(x, y, image); } diff --git a/kdefx/kstyle.cpp b/kdefx/kstyle.cpp index d22a6d795..a533e2803 100644 --- a/kdefx/kstyle.cpp +++ b/kdefx/kstyle.cpp @@ -516,6 +516,25 @@ int KStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) c return value; } +// ----------------------------------------------------------------------------- + +#ifdef USE_QT4 + +void KStyle::drawPrimitive( ControlElement pe, + TQPainter* p, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + // FIXME: + // What should "widget" be in actuality? How should I get it? From where? + // Almost certainly it should not be null! + TQWidget *widget = 0; + drawControl(pe, p, widget, r, cg, flags, opt); +} + +#endif // USE_QT4 // ----------------------------------------------------------------------------- @@ -999,7 +1018,7 @@ int KStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const case PM_SliderControlThickness: { const TQSlider* slider = (const TQSlider*)widget; TQSlider::TickSetting ts = slider->tickmarks(); - int thickness = (slider->orientation() == Horizontal) ? + int thickness = (slider->orientation() == TQ_Horizontal) ? slider->height() : slider->width(); switch (ts) { case TQSlider::NoMarks: // Use total area. diff --git a/kdefx/kstyle.h b/kdefx/kstyle.h index 87b5d299e..f9a47ec45 100644 --- a/kdefx/kstyle.h +++ b/kdefx/kstyle.h @@ -281,6 +281,17 @@ class KDEFX_EXPORT KStyle: public QCommonStyle SFlags flags = Style_Default, const TQStyleOption& = TQStyleOption::TQSO_Default ) const; +#ifdef USE_QT4 + + void drawPrimitive( ControlElement pe, + TQPainter* p, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::TQSO_Default ) const; + +#endif // USE_QT4 + void drawControl( ControlElement element, TQPainter* p, const TQWidget* widget,