From f7e71d47719ab6094cf4a9fafffa5ea351973522 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 13 Jan 2011 08:32:36 +0000 Subject: 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 --- kdecore/network/kbufferedsocket.cpp | 24 ++++---- kdecore/network/kbufferedsocket.h | 19 +++--- kdecore/network/kclientsocketbase.cpp | 44 ++++++++------ kdecore/network/kclientsocketbase.h | 30 ++++++---- kdecore/network/kdatagramsocket.cpp | 6 +- kdecore/network/kdatagramsocket.h | 7 ++- kdecore/network/khttpproxysocketdevice.cpp | 14 ++--- kdecore/network/kiobuffer.h | 10 ++-- kdecore/network/kresolver.cpp | 54 ++++++++--------- kdecore/network/kresolver.h | 11 ++-- kdecore/network/kresolver_p.h | 2 +- kdecore/network/kresolverstandardworkers.cpp | 30 +++++----- kdecore/network/kresolverstandardworkers_p.h | 2 +- kdecore/network/kreverseresolver.cpp | 8 +-- kdecore/network/kreverseresolver.h | 5 +- kdecore/network/kserversocket.cpp | 2 +- kdecore/network/kserversocket.h | 1 + kdecore/network/ksocketaddress.cpp | 86 ++++++++++++++-------------- kdecore/network/ksocketaddress.h | 58 +++++++++---------- kdecore/network/ksocketbase.cpp | 2 +- kdecore/network/ksocketbase.h | 20 ++++--- kdecore/network/ksocketbuffer.cpp | 32 +++++------ kdecore/network/ksocketbuffer_p.h | 20 +++---- kdecore/network/ksocketdevice.cpp | 20 +++---- kdecore/network/ksocketdevice.h | 16 +++--- kdecore/network/ksockssocketdevice.cpp | 14 ++--- kdecore/network/ksockssocketdevice.h | 12 ++-- kdecore/network/ksrvresolverworker.cpp | 12 ++-- kdecore/network/ksrvresolverworker_p.h | 9 +-- kdecore/network/kstreamsocket.cpp | 4 +- kdecore/network/kstreamsocket.h | 1 + 31 files changed, 302 insertions(+), 273 deletions(-) (limited to 'kdecore/network') diff --git a/kdecore/network/kbufferedsocket.cpp b/kdecore/network/kbufferedsocket.cpp index 04115c051..85b433193 100644 --- a/kdecore/network/kbufferedsocket.cpp +++ b/kdecore/network/kbufferedsocket.cpp @@ -94,7 +94,7 @@ void KBufferedSocket::close() } #ifdef USE_QT3 -Q_LONG KBufferedSocket::bytesAvailable() const +TQ_LONG KBufferedSocket::bytesAvailable() const #endif #ifdef USE_QT4 qint64 KBufferedSocket::bytesAvailable() const @@ -106,9 +106,9 @@ qint64 KBufferedSocket::bytesAvailable() const return d->input->length(); } -Q_LONG KBufferedSocket::waitForMore(int msecs, bool *timeout) +TQ_LONG KBufferedSocket::waitForMore(int msecs, bool *timeout) { - Q_LONG retval = KStreamSocket::waitForMore(msecs, timeout); + TQ_LONG retval = KStreamSocket::waitForMore(msecs, timeout); if (d->input) { resetError(); @@ -118,7 +118,7 @@ Q_LONG KBufferedSocket::waitForMore(int msecs, bool *timeout) return retval; } -Q_LONG KBufferedSocket::readBlock(char *data, Q_ULONG maxlen) +TQ_LONG KBufferedSocket::readBlock(char *data, TQ_ULONG maxlen) { if (d->input) { @@ -134,13 +134,13 @@ Q_LONG KBufferedSocket::readBlock(char *data, Q_ULONG maxlen) return KStreamSocket::readBlock(data, maxlen); } -Q_LONG KBufferedSocket::readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) +TQ_LONG KBufferedSocket::readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) { from = peerAddress(); return readBlock(data, maxlen); } -Q_LONG KBufferedSocket::peekBlock(char *data, Q_ULONG maxlen) +TQ_LONG KBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen) { if (d->input) { @@ -156,13 +156,13 @@ Q_LONG KBufferedSocket::peekBlock(char *data, Q_ULONG maxlen) return KStreamSocket::peekBlock(data, maxlen); } -Q_LONG KBufferedSocket::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) +TQ_LONG KBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) { from = peerAddress(); return peekBlock(data, maxlen); } -Q_LONG KBufferedSocket::writeBlock(const char *data, Q_ULONG len) +TQ_LONG KBufferedSocket::writeBlock(const char *data, TQ_ULONG len) { if (state() != Connected) { @@ -192,7 +192,7 @@ Q_LONG KBufferedSocket::writeBlock(const char *data, Q_ULONG len) return KStreamSocket::writeBlock(data, len); } -Q_LONG KBufferedSocket::writeBlock(const char *data, Q_ULONG maxlen, +TQ_LONG KBufferedSocket::writeBlock(const char *data, TQ_ULONG maxlen, const KSocketAddress&) { // ignore the third parameter @@ -285,7 +285,7 @@ KIOBufferBase* KBufferedSocket::outputBuffer() } #ifdef USE_QT3 -Q_ULONG KBufferedSocket::bytesToWrite() const +TQ_ULONG KBufferedSocket::bytesToWrite() const #endif #ifdef USE_QT4 qint64 KBufferedSocket::bytesToWrite() const @@ -332,7 +332,7 @@ void KBufferedSocket::slotReadActivity() if (d->input && state() == Connected) { mutex()->lock(); - Q_LONG len = d->input->receiveFrom(socketDevice()); + TQ_LONG len = d->input->receiveFrom(socketDevice()); if (len == -1) { @@ -380,7 +380,7 @@ void KBufferedSocket::slotWriteActivity() (state() == Connected || state() == Closing)) { mutex()->lock(); - Q_LONG len = d->output->sendTo(socketDevice()); + TQ_LONG len = d->output->sendTo(socketDevice()); if (len == -1) { diff --git a/kdecore/network/kbufferedsocket.h b/kdecore/network/kbufferedsocket.h index bca034002..0982a88d3 100644 --- a/kdecore/network/kbufferedsocket.h +++ b/kdecore/network/kbufferedsocket.h @@ -58,6 +58,7 @@ class KBufferedSocketPrivate; class KDECORE_EXPORT KBufferedSocket: public KStreamSocket { Q_OBJECT + TQ_OBJECT public: /** * Default constructor. @@ -99,7 +100,7 @@ public: * Make use of the buffers. */ #ifdef USE_QT3 - virtual Q_LONG bytesAvailable() const; + virtual TQ_LONG bytesAvailable() const; #endif #ifdef USE_QT4 virtual qint64 bytesAvailable() const; @@ -108,12 +109,12 @@ public: /** * Make use of buffers. */ - virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L); + virtual TQ_LONG waitForMore(int msecs, bool *timeout = 0L); /** * Reads data from the socket. Make use of buffers. */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); /** * @overload @@ -121,12 +122,12 @@ public: * * The @p from parameter is always set to @ref peerAddress() */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); /** * Peeks data from the socket. */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen); /** * @overload @@ -134,12 +135,12 @@ public: * * The @p from parameter is always set to @ref peerAddress() */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress &from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from); /** * Writes data to the socket. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); /** * @overload @@ -147,7 +148,7 @@ public: * * The @p to parameter is discarded. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); /** * Catch changes. @@ -183,7 +184,7 @@ public: * Returns the length of the output buffer. */ #ifdef USE_QT3 - virtual Q_ULONG bytesToWrite() const; + virtual TQ_ULONG bytesToWrite() const; #endif #ifdef USE_QT4 virtual qint64 bytesToWrite() const; diff --git a/kdecore/network/kclientsocketbase.cpp b/kdecore/network/kclientsocketbase.cpp index 7ac3ca3b1..46f7a1942 100644 --- a/kdecore/network/kclientsocketbase.cpp +++ b/kdecore/network/kclientsocketbase.cpp @@ -47,9 +47,17 @@ public: bool enableRead : 1, enableWrite : 1; }; -KClientSocketBase::KClientSocketBase(TQObject *parent, const char *name) - : TQObject(parent, name), d(new KClientSocketBasePrivate) +KClientSocketBase::KClientSocketBase(TQObject *parent, const char *name) : +#ifdef USE_QT4 +#else // USE_QT4 + TQObject(parent, name), +#endif // USE_QT4 + d(new KClientSocketBasePrivate) { +#ifdef USE_QT4 + setParent(parent); + setObjectName(name); +#endif // USE_QT4 d->state = Idle; d->enableRead = true; d->enableWrite = false; @@ -140,7 +148,7 @@ bool KClientSocketBase::lookup() { if (d->localResolver.serviceName().isNull() && !d->localResolver.nodeName().isNull()) - d->localResolver.setServiceName(TQString::fromLatin1("")); + d->localResolver.setServiceName(TQString::tqfromLatin1("")); // don't restart the lookups if they had succeeded and // the input values weren't changed @@ -279,7 +287,7 @@ void KClientSocketBase::close() // This function is unlike all the others because it is const #ifdef USE_QT3 -Q_LONG KClientSocketBase::bytesAvailable() const +TQ_LONG KClientSocketBase::bytesAvailable() const #endif #ifdef USE_QT4 qint64 KClientSocketBase::bytesAvailable() const @@ -291,10 +299,10 @@ qint64 KClientSocketBase::bytesAvailable() const // All the functions below look really alike // Should I use a macro to define them? -Q_LONG KClientSocketBase::waitForMore(int msecs, bool *timeout) +TQ_LONG KClientSocketBase::waitForMore(int msecs, bool *timeout) { resetError(); - Q_LONG retval = socketDevice()->waitForMore(msecs, timeout); + TQ_LONG retval = socketDevice()->waitForMore(msecs, timeout); if (retval == -1) { copyError(); @@ -303,10 +311,10 @@ Q_LONG KClientSocketBase::waitForMore(int msecs, bool *timeout) return retval; } -Q_LONG KClientSocketBase::readBlock(char *data, Q_ULONG maxlen) +TQ_LONG KClientSocketBase::readBlock(char *data, TQ_ULONG maxlen) { resetError(); - Q_LONG retval = socketDevice()->readBlock(data, maxlen); + TQ_LONG retval = socketDevice()->readBlock(data, maxlen); if (retval == -1) { copyError(); @@ -315,10 +323,10 @@ Q_LONG KClientSocketBase::readBlock(char *data, Q_ULONG maxlen) return retval; } -Q_LONG KClientSocketBase::readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) +TQ_LONG KClientSocketBase::readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) { resetError(); - Q_LONG retval = socketDevice()->readBlock(data, maxlen, from); + TQ_LONG retval = socketDevice()->readBlock(data, maxlen, from); if (retval == -1) { copyError(); @@ -327,10 +335,10 @@ Q_LONG KClientSocketBase::readBlock(char *data, Q_ULONG maxlen, KSocketAddress& return retval; } -Q_LONG KClientSocketBase::peekBlock(char *data, Q_ULONG maxlen) +TQ_LONG KClientSocketBase::peekBlock(char *data, TQ_ULONG maxlen) { resetError(); - Q_LONG retval = socketDevice()->peekBlock(data, maxlen); + TQ_LONG retval = socketDevice()->peekBlock(data, maxlen); if (retval == -1) { copyError(); @@ -339,10 +347,10 @@ Q_LONG KClientSocketBase::peekBlock(char *data, Q_ULONG maxlen) return retval; } -Q_LONG KClientSocketBase::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) +TQ_LONG KClientSocketBase::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) { resetError(); - Q_LONG retval = socketDevice()->peekBlock(data, maxlen, from); + TQ_LONG retval = socketDevice()->peekBlock(data, maxlen, from); if (retval == -1) { copyError(); @@ -351,10 +359,10 @@ Q_LONG KClientSocketBase::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& return retval; } -Q_LONG KClientSocketBase::writeBlock(const char *data, Q_ULONG len) +TQ_LONG KClientSocketBase::writeBlock(const char *data, TQ_ULONG len) { resetError(); - Q_LONG retval = socketDevice()->writeBlock(data, len); + TQ_LONG retval = socketDevice()->writeBlock(data, len); if (retval == -1) { copyError(); @@ -363,10 +371,10 @@ Q_LONG KClientSocketBase::writeBlock(const char *data, Q_ULONG len) return retval; } -Q_LONG KClientSocketBase::writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to) +TQ_LONG KClientSocketBase::writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) { resetError(); - Q_LONG retval = socketDevice()->writeBlock(data, len, to); + TQ_LONG retval = socketDevice()->writeBlock(data, len, to); if (retval == -1) { copyError(); diff --git a/kdecore/network/kclientsocketbase.h b/kdecore/network/kclientsocketbase.h index d4e31b6b3..63ddc3aa3 100644 --- a/kdecore/network/kclientsocketbase.h +++ b/kdecore/network/kclientsocketbase.h @@ -32,6 +32,10 @@ #include "kresolver.h" #include +#ifdef Q_MOC_RUN +#define USE_QT4 +#endif // Q_MOC_RUN + namespace KNetwork { class KClientSocketBasePrivate; @@ -46,9 +50,15 @@ class KClientSocketBasePrivate; * * @author Thiago Macieira */ -class KDECORE_EXPORT KClientSocketBase : public TQObject, public KActiveSocketBase +class KDECORE_EXPORT KClientSocketBase : +#ifdef USE_QT4 +#else // USE_QT4 +public TQObject, +#endif // USE_QT4 +public KActiveSocketBase { Q_OBJECT + TQ_OBJECT public: /** @@ -257,7 +267,7 @@ public: * This is a convenience function provided to ease migrating from * Qt 3.x's TQSocket class. */ - inline void connectToHost(const TQString& host, Q_UINT16 port) + inline void connectToHost(const TQString& host, TQ_UINT16 port) { connect(host, TQString::number(port)); } /** @@ -293,7 +303,7 @@ public: * Reimplemented from KSocketBase. */ #ifdef USE_QT3 - virtual Q_LONG bytesAvailable() const; + virtual TQ_LONG bytesAvailable() const; #endif #ifdef USE_QT4 virtual qint64 bytesAvailable() const; @@ -302,40 +312,40 @@ public: /** * Waits for more data. Reimplemented from KSocketBase. */ - virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L); + virtual TQ_LONG waitForMore(int msecs, bool *timeout = 0L); /** * Reads data from a socket. Reimplemented from KSocketBase. */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); /** * @overload * Reads data from a socket. Reimplemented from KSocketBase. */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); /** * Peeks data from the socket. Reimplemented from KSocketBase. */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen); /** * @overload * Peeks data from the socket. Reimplemented from KSocketBase. */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress &from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from); /** * Writes data to the socket. Reimplemented from KSocketBase. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); /** * @overload * Writes data to the socket. Reimplemented from KSocketBase. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); /** * Returns the local socket address. Reimplemented from KSocketBase. diff --git a/kdecore/network/kdatagramsocket.cpp b/kdecore/network/kdatagramsocket.cpp index d598d2d14..ff6ea04b3 100644 --- a/kdecore/network/kdatagramsocket.cpp +++ b/kdecore/network/kdatagramsocket.cpp @@ -133,7 +133,7 @@ bool KDatagramSocket::connect(const TQString& node, const TQString& service) KDatagramPacket KDatagramSocket::receive() { - Q_LONG size = bytesAvailable(); + TQ_LONG size = bytesAvailable(); if (size == 0) { // nothing available yet to read @@ -165,12 +165,12 @@ KDatagramPacket KDatagramSocket::receive() return KDatagramPacket(data, address); } -Q_LONG KDatagramSocket::send(const KDatagramPacket& packet) +TQ_LONG KDatagramSocket::send(const KDatagramPacket& packet) { return writeBlock(packet.data(), packet.size(), packet.address()); } -Q_LONG KDatagramSocket::writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to) +TQ_LONG KDatagramSocket::writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) { if (to.family() != AF_UNSPEC) { diff --git a/kdecore/network/kdatagramsocket.h b/kdecore/network/kdatagramsocket.h index 6b94c1d42..7ecbada09 100644 --- a/kdecore/network/kdatagramsocket.h +++ b/kdecore/network/kdatagramsocket.h @@ -180,6 +180,7 @@ class KDatagramSocketPrivate; class KDECORE_EXPORT KDatagramSocket: public KClientSocketBase { Q_OBJECT + TQ_OBJECT public: /** @@ -222,7 +223,7 @@ public: * * Connecting means only to designate the given address as the default * destination address for datagrams sent without destination addresses - * ( writeBlock(const char *, Q_ULONG) ). + * ( writeBlock(const char *, TQ_ULONG) ). * * @note Calling connect will not cause the socket to be bound. You have * to call @ref bind explicitly. @@ -240,7 +241,7 @@ public: /** * Writes data to the socket. Reimplemented from KClientSocketBase. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); /** * Receives one datagram from the stream. The reading process is guaranteed @@ -260,7 +261,7 @@ public: * * @returns the number of bytes written or -1 in case of error. */ - virtual Q_LONG send(const KDatagramPacket& packet); + virtual TQ_LONG send(const KDatagramPacket& packet); private slots: void lookupFinishedLocal(); diff --git a/kdecore/network/khttpproxysocketdevice.cpp b/kdecore/network/khttpproxysocketdevice.cpp index 09d8dd7a5..f4ef01564 100644 --- a/kdecore/network/khttpproxysocketdevice.cpp +++ b/kdecore/network/khttpproxysocketdevice.cpp @@ -153,7 +153,7 @@ bool KHttpProxySocketDevice::connect(const TQString& node, const TQString& servi setState(0); // unset open flag // prepare the request - TQString request = TQString::fromLatin1("CONNECT %1:%2 HTTP/1.1\r\n" + TQString request = TQString::tqfromLatin1("CONNECT %1:%2 HTTP/1.1\r\n" "Cache-Control: no-cache\r\n" "Host: \r\n" "\r\n"); @@ -161,7 +161,7 @@ bool KHttpProxySocketDevice::connect(const TQString& node, const TQString& servi if (node.contains(':')) node2 = '[' + node + ']'; - d->request = request.arg(node2).arg(service).latin1(); + d->request = TQString(request.arg(node2).arg(service)).latin1(); } return parseServerReply(); @@ -179,7 +179,7 @@ bool KHttpProxySocketDevice::parseServerReply() if (!d->request.isEmpty()) { // send request - Q_LONG written = writeBlock(d->request, d->request.length()); + TQ_LONG written = writeBlock(d->request, d->request.length()); if (written < 0) { qDebug("KHttpProxySocketDevice: would block writing request!"); @@ -205,7 +205,7 @@ bool KHttpProxySocketDevice::parseServerReply() int index; if (!blocking()) { - Q_LONG avail = bytesAvailable(); + TQ_LONG avail = bytesAvailable(); qDebug("KHttpProxySocketDevice: %ld bytes available", avail); setState(0); if (avail == 0) @@ -222,7 +222,7 @@ bool KHttpProxySocketDevice::parseServerReply() TQCString fullHeaders = d->reply + buf.data(); // search for the end of the headers - index = fullHeaders.find("\r\n\r\n"); + index = fullHeaders.tqfind("\r\n\r\n"); if (index == -1) { // no, headers not yet finished... @@ -265,9 +265,9 @@ bool KHttpProxySocketDevice::parseServerReply() // now really parse the reply qDebug("KHttpProxySocketDevice: get reply: %s\n", - d->reply.left(d->reply.find('\r')).data()); + d->reply.left(d->reply.tqfind('\r')).data()); if (d->reply.left(7) != "HTTP/1." || - (index = d->reply.find(' ')) == -1 || + (index = d->reply.tqfind(' ')) == -1 || d->reply[index + 1] != '2') { setError(IO_ConnectError, NetFailure); diff --git a/kdecore/network/kiobuffer.h b/kdecore/network/kiobuffer.h index 839899b18..02f75a420 100644 --- a/kdecore/network/kiobuffer.h +++ b/kdecore/network/kiobuffer.h @@ -85,7 +85,7 @@ public: * * @sa size */ - virtual Q_LONG length() const = 0; + virtual TQ_LONG length() const = 0; /** * Returns true if the buffer is empty of data. @@ -99,7 +99,7 @@ public: * * @sa length for the length of the data stored */ - virtual Q_LONG size() const = 0; + virtual TQ_LONG size() const = 0; /** * Returns true if the buffer is full (i.e., cannot receive more data) @@ -114,7 +114,7 @@ public: * @returns true on success, false if an error occurred. * @note if the new size is less than length(), the buffer will be truncated */ - virtual bool setSize(Q_LONG size) = 0; + virtual bool setSize(TQ_LONG size) = 0; /** * Adds data to the end of the buffer. @@ -123,7 +123,7 @@ public: * @param len the data length, in bytes * @returns the number of bytes added to the end of the buffer. */ - virtual Q_LONG feedBuffer(const char *data, Q_LONG len) = 0; + virtual TQ_LONG feedBuffer(const char *data, TQ_LONG len) = 0; /** * Consumes data from the beginning of the buffer. @@ -133,7 +133,7 @@ public: * @param discard if true, the bytes copied will be discarded * @returns the number of bytes copied from the buffer */ - virtual Q_LONG consumeBuffer(char *data, Q_LONG maxlen, bool discard = true) = 0; + virtual TQ_LONG consumeBuffer(char *data, TQ_LONG maxlen, bool discard = true) = 0; /** * Clears the buffer. diff --git a/kdecore/network/kresolver.cpp b/kdecore/network/kresolver.cpp index cfb87e3ef..d58d02cb0 100644 --- a/kdecore/network/kresolver.cpp +++ b/kdecore/network/kresolver.cpp @@ -105,7 +105,7 @@ KResolverEntry::KResolverEntry(const KSocketAddress& addr, int socktype, int pro } // constructor with even more stuff -KResolverEntry::KResolverEntry(const struct sockaddr* sa, Q_UINT16 salen, int socktype, +KResolverEntry::KResolverEntry(const struct sockaddr* sa, TQ_UINT16 salen, int socktype, int protocol, const TQString& canonName, const TQCString& encodedName) : d(new KResolverEntryPrivate) @@ -141,7 +141,7 @@ KSocketAddress KResolverEntry::address() const } // returns the length -Q_UINT16 KResolverEntry::length() const +TQ_UINT16 KResolverEntry::length() const { return d ? d->addr.length() : 0; } @@ -587,7 +587,7 @@ KResolverResults KResolver::resolve(const TQString& host, const TQString& service, int flags, int families) { - KResolver qres(host, service, qApp, "synchronous KResolver"); + KResolver qres(host, service, TQT_TQOBJECT(tqApp), "synchronous KResolver"); qres.setFlags(flags); qres.setFamily(families); qres.start(); @@ -599,7 +599,7 @@ bool KResolver::resolveAsync(TQObject* userObj, const char *userSlot, const TQString& host, const TQString& service, int flags, int families) { - KResolver* qres = new KResolver(host, service, qApp, "asynchronous KResolver"); + KResolver* qres = new KResolver(host, service, TQT_TQOBJECT(tqApp), "asynchronous KResolver"); TQObject::connect(qres, TQT_SIGNAL(finished(KResolverResults)), userObj, userSlot); qres->setFlags(flags); qres->setFamily(families); @@ -915,16 +915,16 @@ TQString KResolver::localHostName() } if (name.isEmpty()) - return TQString::fromLatin1("localhost"); + return TQString::tqfromLatin1("localhost"); - if (name.find('.') == -1) + if (name.tqfind('.') == -1) { // not fully qualified // must resolve KResolverResults results = resolve(name, "0", CanonName); if (results.isEmpty()) // cannot find a valid hostname! - return TQString::fromLatin1("localhost"); + return TQString::tqfromLatin1("localhost"); else return results.first().canonicalName(); } @@ -934,7 +934,7 @@ TQString KResolver::localHostName() // forward declaration -static TQStringList splitLabels(const TQString& unicodeDomain); +static TQStringList splitLabels(const TQString& tqunicodeDomain); static TQCString ToASCII(const TQString& label); static TQString ToUnicode(const TQString& label); @@ -943,11 +943,11 @@ static TQStringList *KResolver_initIdnDomains() const char *kde_use_idn = getenv("KDE_USE_IDN"); if (!kde_use_idn) kde_use_idn = "ac:at:br:cat:ch:cl:cn:de:dk:fi:gr:hu:info:io:is:jp:kr:li:lt:museum:org:no:se:sh:th:tm:tw:vn"; - return new TQStringList(TQStringList::split(':', TQString::fromLatin1(kde_use_idn).lower())); + return new TQStringList(TQStringList::split(':', TQString::tqfromLatin1(kde_use_idn).lower())); } // implement the ToAscii function, as described by IDN documents -TQCString KResolver::domainToAscii(const TQString& unicodeDomain) +TQCString KResolver::domainToAscii(const TQString& tqunicodeDomain) { if (!idnDomains) idnDomains = KResolver_initIdnDomains(); @@ -958,10 +958,10 @@ TQCString KResolver::domainToAscii(const TQString& unicodeDomain) // 2) split the domain into individual labels, without // separators. - TQStringList input = splitLabels(unicodeDomain); + TQStringList input = splitLabels(tqunicodeDomain); // Do we allow IDN names for this TLD? - if (input.count() && !idnDomains->contains(input[input.count()-1].lower())) + if (input.count() && !idnDomains->tqcontains(input[input.count()-1].lower())) return input.join(".").lower().latin1(); // No IDN allowed for this TLD // 3) decide whether to enforce the STD3 rules for chars < 0x7F @@ -987,7 +987,7 @@ TQCString KResolver::domainToAscii(const TQString& unicodeDomain) TQString KResolver::domainToUnicode(const TQCString& asciiDomain) { - return domainToUnicode(TQString::fromLatin1(asciiDomain)); + return domainToUnicode(TQString::tqfromLatin1(asciiDomain)); } // implement the ToUnicode function, as described by IDN documents @@ -1009,7 +1009,7 @@ TQString KResolver::domainToUnicode(const TQString& asciiDomain) TQStringList input = splitLabels(asciiDomain); // Do we allow IDN names for this TLD? - if (input.count() && !idnDomains->contains(input[input.count()-1].lower())) + if (input.count() && !idnDomains->tqcontains(input[input.count()-1].lower())) return asciiDomain.lower(); // No TLDs allowed // 3) decide whether to enforce the STD3 rules for chars < 0x7F @@ -1048,7 +1048,7 @@ void KResolver::virtual_hook( int, void* ) // RFC 3492 - Punycode: A Bootstring encoding of Unicode // for Internationalized Domain Names in Applications (IDNA) -static TQStringList splitLabels(const TQString& unicodeDomain) +static TQStringList splitLabels(const TQString& tqunicodeDomain) { // From RFC 3490 section 3.1: // "Whenever dots are used as label separators, the following characters @@ -1060,9 +1060,9 @@ static TQStringList splitLabels(const TQString& unicodeDomain) TQStringList lst; int start = 0; uint i; - for (i = 0; i < unicodeDomain.length(); i++) + for (i = 0; i < tqunicodeDomain.length(); i++) { - unsigned int c = unicodeDomain[i].unicode(); + unsigned int c = tqunicodeDomain[i].tqunicode(); if (c == separators[0] || c == separators[1] || @@ -1070,13 +1070,13 @@ static TQStringList splitLabels(const TQString& unicodeDomain) c == separators[3]) { // found a separator! - lst << unicodeDomain.mid(start, i - start); + lst << tqunicodeDomain.mid(start, i - start); start = i + 1; } } if ((long)i >= start) // there is still one left - lst << unicodeDomain.mid(start, i - start); + lst << tqunicodeDomain.mid(start, i - start); return lst; } @@ -1097,11 +1097,11 @@ static TQCString ToASCII(const TQString& label) TQCString retval; char buf[65]; - Q_UINT32* ucs4 = new Q_UINT32[label.length() + 1]; + TQ_UINT32* ucs4 = new TQ_UINT32[label.length() + 1]; uint i; for (i = 0; i < label.length(); i++) - ucs4[i] = (unsigned long)label[i].unicode(); + ucs4[i] = (unsigned long)label[i].tqunicode(); ucs4[i] = 0; // terminate with NUL, just to be on the safe side if (idna_to_ascii_4i(ucs4, label.length(), buf, 0) == IDNA_SUCCESS) @@ -1118,18 +1118,18 @@ static TQCString ToASCII(const TQString& label) static TQString ToUnicode(const TQString& label) { #ifdef HAVE_IDNA_H - // We have idna.h, so we can use the idna_to_unicode + // We have idna.h, so we can use the idna_to_tqunicode // function :) - Q_UINT32 *ucs4_input, *ucs4_output; + TQ_UINT32 *ucs4_input, *ucs4_output; size_t outlen; - ucs4_input = new Q_UINT32[label.length() + 1]; + ucs4_input = new TQ_UINT32[label.length() + 1]; for (uint i = 0; i < label.length(); i++) - ucs4_input[i] = (unsigned long)label[i].unicode(); + ucs4_input[i] = (unsigned long)label[i].tqunicode(); // try the same length for output - ucs4_output = new Q_UINT32[outlen = label.length()]; + ucs4_output = new TQ_UINT32[outlen = label.length()]; idna_to_unicode_44i(ucs4_input, label.length(), ucs4_output, &outlen, @@ -1139,7 +1139,7 @@ static TQString ToUnicode(const TQString& label) { // it must have failed delete [] ucs4_output; - ucs4_output = new Q_UINT32[outlen]; + ucs4_output = new TQ_UINT32[outlen]; idna_to_unicode_44i(ucs4_input, label.length(), ucs4_output, &outlen, diff --git a/kdecore/network/kresolver.h b/kdecore/network/kresolver.h index 5b66f362c..069428904 100644 --- a/kdecore/network/kresolver.h +++ b/kdecore/network/kresolver.h @@ -101,7 +101,7 @@ public: * @param canonName the canonical name of the resolved hostname * @param encodedName the ASCII-compatible encoding of the hostname */ - KResolverEntry(const struct sockaddr *sa, Q_UINT16 salen, int socktype, + KResolverEntry(const struct sockaddr *sa, TQ_UINT16 salen, int socktype, int protocol, const TQString& canonName = TQString::null, const TQCString& encodedName = TQCString()); @@ -128,7 +128,7 @@ public: /** * Retrieves the length of the socket address structure. */ - Q_UINT16 length() const; + TQ_UINT16 length() const; /** * Retrieves the family associated with this socket address. @@ -292,9 +292,10 @@ class KResolverPrivate; * * @author Thiago Macieira */ -class KDECORE_EXPORT KResolver: public QObject +class KDECORE_EXPORT KResolver: public TQObject { Q_OBJECT + TQ_OBJECT public: @@ -795,11 +796,11 @@ public: * Note that the encoding is illegible and, thus, should not be presented * to the user, except if requested. * - * @param unicodeDomain the domain name to be encoded + * @param tqunicodeDomain the domain name to be encoded * @return the ACE-encoded suitable for DNS queries if successful, a null * TQCString if failure. */ - static TQCString domainToAscii(const TQString& unicodeDomain); + static TQCString domainToAscii(const TQString& tqunicodeDomain); /** * Does the inverse of @ref domainToAscii and return an Unicode domain diff --git a/kdecore/network/kresolver_p.h b/kdecore/network/kresolver_p.h index e29304383..7f74c6fe6 100644 --- a/kdecore/network/kresolver_p.h +++ b/kdecore/network/kresolver_p.h @@ -326,7 +326,7 @@ namespace KNetwork * This class is a worker thread in the resolver system. * This class must be thread-safe. */ - class KResolverThread: public QThread + class KResolverThread: public TQThread { private: // private constructor. Only the manager can create worker threads diff --git a/kdecore/network/kresolverstandardworkers.cpp b/kdecore/network/kresolverstandardworkers.cpp index f64803ced..08bd57121 100644 --- a/kdecore/network/kresolverstandardworkers.cpp +++ b/kdecore/network/kresolverstandardworkers.cpp @@ -140,7 +140,7 @@ bool KBlacklistWorker::isBlacklisted(const TQString& host) return false; // KDE4: QLatin1String - TQString ascii = TQString::fromLatin1(KResolver::domainToAscii(host)); + TQString ascii = TQString::tqfromLatin1(KResolver::domainToAscii(host)); TQMutexLocker locker(&blacklistMutex); @@ -208,12 +208,12 @@ namespace { public: TQCString m_hostname; // might be different! - Q_UINT16 m_port; + TQ_UINT16 m_port; int m_scopeid; int m_af; KResolverResults& results; - GetHostByNameThread(const char * hostname, Q_UINT16 port, + GetHostByNameThread(const char * hostname, TQ_UINT16 port, int scopeid, int af, KResolverResults* res) : m_hostname(hostname), m_port(port), m_scopeid(scopeid), m_af(af), results(*res) @@ -251,7 +251,7 @@ namespace // check blacklist if (m_af != AF_INET && - KBlacklistWorker::isBlacklisted(TQString::fromLatin1(m_hostname))) + KBlacklistWorker::isBlacklisted(TQString::tqfromLatin1(m_hostname))) break; # ifdef USE_GETHOSTBYNAME2_R @@ -358,7 +358,7 @@ namespace if (socktype == 0) socktype = SOCK_STREAM; // default - TQString canon = KResolver::domainToUnicode(TQString::fromLatin1(he->h_name)); + TQString canon = KResolver::domainToUnicode(TQString::tqfromLatin1(he->h_name)); KInetSocketAddress sa; sa.setPort(m_port); if (he->h_addrtype != AF_INET) @@ -404,7 +404,7 @@ namespace { // check blacklist if ((m_af != AF_INET && m_af != AF_UNSPEC) && - KBlacklistWorker::isBlacklisted(TQString::fromLatin1(m_node))) + KBlacklistWorker::isBlacklisted(TQString::tqfromLatin1(m_node))) { results.setError(KResolver::NoName); finished(); @@ -547,11 +547,11 @@ bool KStandardWorker::sanityCheck() if (!nodeName().isEmpty()) { TQString node = nodeName(); - if (node.find('%') != -1) - node.truncate(node.find('%')); + if (node.tqfind('%') != -1) + node.truncate(node.tqfind('%')); - if (node.isEmpty() || node == TQString::fromLatin1("*") || - node == TQString::fromLatin1("localhost")) + if (node.isEmpty() || node == TQString::tqfromLatin1("*") || + node == TQString::tqfromLatin1("localhost")) m_encodedName.truncate(0); else { @@ -584,7 +584,7 @@ bool KStandardWorker::resolveScopeId() { // we must test the original name, not the encoded one scopeid = 0; - int pos = nodeName().findRev('%'); + int pos = nodeName().tqfindRev('%'); if (pos == -1) return true; @@ -616,7 +616,7 @@ bool KStandardWorker::resolveService() // service name does not contain a port number // must be a name - if (serviceName().isEmpty() || serviceName().compare(TQString::fromLatin1("*")) == 0) + if (serviceName().isEmpty() || serviceName().compare(TQString::tqfromLatin1("*")) == 0) port = 0; else { @@ -648,7 +648,7 @@ bool KStandardWorker::resolveService() } // it worked, we have a port number - port = (Q_UINT16)result; + port = (TQ_UINT16)result; } } @@ -667,7 +667,7 @@ KResolver::ErrorCodes KStandardWorker::addUnix() if (!m_encodedName.isEmpty()) return KResolver::AddrFamily; // non local hostname - if (protocol() || protocolName()) + if (protocol() || static_cast(protocolName())) return KResolver::BadFlags; // cannot have Unix sockets with protocols TQString pathname = serviceName(); @@ -712,7 +712,7 @@ bool KStandardWorker::resolveNumerically() // now try to resolve the hostname numerically KInetSocketAddress sa; setError(KResolver::NoError); - sa.setHost(KIpAddress(TQString::fromLatin1(m_encodedName))); + sa.setHost(KIpAddress(TQString::tqfromLatin1(m_encodedName))); // if it failed, the length was reset to 0 bool ok = sa.length() != 0; diff --git a/kdecore/network/kresolverstandardworkers_p.h b/kdecore/network/kresolverstandardworkers_p.h index 310849bf3..2db460bef 100644 --- a/kdecore/network/kresolverstandardworkers_p.h +++ b/kdecore/network/kresolverstandardworkers_p.h @@ -66,7 +66,7 @@ namespace KNetwork { namespace Internal { protected: mutable TQCString m_encodedName; - Q_UINT16 port; + TQ_UINT16 port; int scopeid; TQPtrList resultList; diff --git a/kdecore/network/kreverseresolver.cpp b/kdecore/network/kreverseresolver.cpp index 639f6dbe4..00ef7f81d 100644 --- a/kdecore/network/kreverseresolver.cpp +++ b/kdecore/network/kreverseresolver.cpp @@ -78,7 +78,7 @@ namespace bool success; }; - class KReverseResolverEvent: public QEvent + class KReverseResolverEvent: public TQEvent { public: static const int myType = TQEvent::User + 63; // arbitrary value @@ -203,7 +203,7 @@ bool KReverseResolver::resolve(const KSocketAddress& addr, TQString& node, return false; } -bool KReverseResolver::resolve(const struct sockaddr* sa, Q_UINT16 salen, +bool KReverseResolver::resolve(const struct sockaddr* sa, TQ_UINT16 salen, TQString& node, TQString& serv, int flags) { return resolve(KSocketAddress(sa, salen), node, serv, flags); @@ -238,8 +238,8 @@ bool ReverseThread::run() if (err == 0) { - node = KResolver::domainToUnicode(TQString::fromLatin1(h)); - service = TQString::fromLatin1(s); + node = KResolver::domainToUnicode(TQString::tqfromLatin1(h)); + service = TQString::tqfromLatin1(s); success = true; } else diff --git a/kdecore/network/kreverseresolver.h b/kdecore/network/kreverseresolver.h index 26274e586..1f26f4a2a 100644 --- a/kdecore/network/kreverseresolver.h +++ b/kdecore/network/kreverseresolver.h @@ -47,9 +47,10 @@ class KReverseResolverPrivate; * * @author Thiago Macieira */ -class KDECORE_EXPORT KReverseResolver: public QObject +class KDECORE_EXPORT KReverseResolver: public TQObject { Q_OBJECT + TQ_OBJECT public: /** @@ -183,7 +184,7 @@ public: * @return true if the resolution succeeded, false if not * @see ReverseFlags for the possible values for @p flags */ - static bool resolve(const struct sockaddr* sa, Q_UINT16 salen, + static bool resolve(const struct sockaddr* sa, TQ_UINT16 salen, TQString& node, TQString& serv, int flags = 0); private: diff --git a/kdecore/network/kserversocket.cpp b/kdecore/network/kserversocket.cpp index 49facb12c..bd63d6306 100644 --- a/kdecore/network/kserversocket.cpp +++ b/kdecore/network/kserversocket.cpp @@ -155,7 +155,7 @@ bool KServerSocket::lookup() // make sure we have at least one parameter for lookup if (d->resolver.serviceName().isNull() && !d->resolver.nodeName().isNull()) - d->resolver.setServiceName(TQString::fromLatin1("")); + d->resolver.setServiceName(TQString::tqfromLatin1("")); // don't restart the lookups if they had succeeded and // the input values weren't changed diff --git a/kdecore/network/kserversocket.h b/kdecore/network/kserversocket.h index 30d8b40b0..a07ed54a1 100644 --- a/kdecore/network/kserversocket.h +++ b/kdecore/network/kserversocket.h @@ -107,6 +107,7 @@ class KServerSocketPrivate; class KDECORE_EXPORT KServerSocket: public TQObject, public KPassiveSocketBase { Q_OBJECT + TQ_OBJECT public: /** * Default constructor. diff --git a/kdecore/network/ksocketaddress.cpp b/kdecore/network/ksocketaddress.cpp index adfc76b06..a6fd14cf5 100644 --- a/kdecore/network/ksocketaddress.cpp +++ b/kdecore/network/ksocketaddress.cpp @@ -74,7 +74,7 @@ const KIpAddress KIpAddress::anyhostV4(0L, 4); const KIpAddress KIpAddress::anyhostV6(0L, 6); // helper function to test if an IPv6 v4-mapped address is equal to its IPv4 counterpart -static bool check_v4mapped(const Q_UINT32* v6addr, Q_UINT32 v4addr) +static bool check_v4mapped(const TQ_UINT32* v6addr, TQ_UINT32 v4addr) { // check that the v6 is a v4-mapped address if (!(v6addr[0] == 0 && v6addr[1] == 0 && v6addr[2] == htonl(0x0000ffff))) @@ -131,12 +131,12 @@ bool KIpAddress::setAddress(const TQString& address) m_version = 0; // try to guess the address version - if (address.find(':') != -1) + if (address.tqfind(':') != -1) { #ifdef AF_INET6 // guessing IPv6 - Q_UINT32 buf[4]; + TQ_UINT32 buf[4]; if (inet_pton(AF_INET6, address.latin1(), buf)) { memcpy(m_data, buf, sizeof(m_data)); @@ -149,7 +149,7 @@ bool KIpAddress::setAddress(const TQString& address) } else { - Q_UINT32 buf; + TQ_UINT32 buf; if (inet_pton(AF_INET, address.latin1(), &buf)) { *m_data = buf; @@ -165,7 +165,7 @@ bool KIpAddress::setAddress(const TQString& address) bool KIpAddress::setAddress(const char* address) { - return setAddress(TQString::fromLatin1(address)); + return setAddress(TQString::tqfromLatin1(address)); } // set from binary data @@ -194,21 +194,21 @@ TQString KIpAddress::toString() const { case 4: inet_ntop(AF_INET, m_data, buf, sizeof(buf) - 1); - return TQString::fromLatin1(buf); + return TQString::tqfromLatin1(buf); case 6: #ifdef AF_INET6 inet_ntop(AF_INET6, m_data, buf, sizeof(buf) - 1); #endif - return TQString::fromLatin1(buf); + return TQString::tqfromLatin1(buf); } return TQString::null; } -Q_UINT32 KIpAddress::hostIPv4Addr(bool convertMapped) const +TQ_UINT32 KIpAddress::hostIPv4Addr(bool convertMapped) const { - Q_UINT32 addr = IPv4Addr(convertMapped); + TQ_UINT32 addr = IPv4Addr(convertMapped); return ntohl(addr); } @@ -219,23 +219,23 @@ Q_UINT32 KIpAddress::hostIPv4Addr(bool convertMapped) const struct our_sockaddr_in6 { # ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - Q_UINT8 sin6_len; - Q_UINT8 sin6_family; + TQ_UINT8 sin6_len; + TQ_UINT8 sin6_family; # else //!HAVE_STRUCT_SOCKADDR_SA_LEN - Q_UINT16 sin6_family; + TQ_UINT16 sin6_family; # endif - Q_UINT16 sin6_port; /* RFC says in_port_t */ - Q_UINT32 sin6_flowinfo; - Q_UINT8 sin6_addr[16]; // 24 bytes up to here - Q_UINT32 sin6_scope_id; // 28 bytes total + TQ_UINT16 sin6_port; /* RFC says in_port_t */ + TQ_UINT32 sin6_flowinfo; + TQ_UINT8 sin6_addr[16]; // 24 bytes up to here + TQ_UINT32 sin6_scope_id; // 28 bytes total }; // useful definitions -#define MIN_SOCKADDR_LEN sizeof(Q_UINT16) +#define MIN_SOCKADDR_LEN sizeof(TQ_UINT16) #define SOCKADDR_IN_LEN sizeof(sockaddr_in) #define MIN_SOCKADDR_IN6_LEN ((unsigned long) &(((our_sockaddr_in6*)0)->sin6_scope_id)) #define SOCKADDR_IN6_LEN sizeof(our_sockaddr_in6) -#define MIN_SOCKADDR_UN_LEN (sizeof(Q_UINT16) + sizeof(char)) +#define MIN_SOCKADDR_UN_LEN (sizeof(TQ_UINT16) + sizeof(char)) class KNetwork::KSocketAddressData @@ -263,14 +263,14 @@ public: struct our_sockaddr_in6 *in6; struct sockaddr_un *un; } addr; - Q_UINT16 curlen, reallen; + TQ_UINT16 curlen, reallen; KSocketAddressData() : ref(this) { addr.generic = 0L; curlen = 0; - invalidate(); + tqinvalidate(); } ~KSocketAddressData() @@ -282,10 +282,10 @@ public: inline bool invalid() const { return reallen == 0; } - inline void invalidate() + inline void tqinvalidate() { reallen = 0; } - void dup(const sockaddr* sa, Q_UINT16 len, bool clear = true); + void dup(const sockaddr* sa, TQ_UINT16 len, bool clear = true); void makeipv4() { @@ -343,12 +343,12 @@ public: }; // create duplicates of -void KSocketAddressData::dup(const sockaddr* sa, Q_UINT16 len, bool clear) +void KSocketAddressData::dup(const sockaddr* sa, TQ_UINT16 len, bool clear) { if (len < MIN_SOCKADDR_LEN) { // certainly invalid - invalidate(); + tqinvalidate(); return; } @@ -359,7 +359,7 @@ void KSocketAddressData::dup(const sockaddr* sa, Q_UINT16 len, bool clear) (sa->sa_family == AF_UNIX && len < MIN_SOCKADDR_UN_LEN))) { // also invalid - invalidate(); + tqinvalidate(); return; } @@ -411,7 +411,7 @@ KSocketAddress::KSocketAddress() } // constructor from binary data -KSocketAddress::KSocketAddress(const sockaddr *sa, Q_UINT16 len) +KSocketAddress::KSocketAddress(const sockaddr *sa, TQ_UINT16 len) : d(new KSocketAddressData) { setAddress(sa, len); @@ -444,7 +444,7 @@ KSocketAddress& KSocketAddress::operator =(const KSocketAddress& other) if (other.d && !other.d->invalid()) d->dup(other.d->addr.generic, other.d->reallen); else - d->invalidate(); + d->tqinvalidate(); return *this; } @@ -462,24 +462,24 @@ sockaddr* KSocketAddress::address() return d->addr.generic; } -KSocketAddress& KSocketAddress::setAddress(const sockaddr* sa, Q_UINT16 len) +KSocketAddress& KSocketAddress::setAddress(const sockaddr* sa, TQ_UINT16 len) { if (sa != 0L && len >= MIN_SOCKADDR_LEN) d->dup(sa, len); else - d->invalidate(); + d->tqinvalidate(); return *this; } -Q_UINT16 KSocketAddress::length() const +TQ_UINT16 KSocketAddress::length() const { if (d->invalid()) return 0; return d->reallen; } -KSocketAddress& KSocketAddress::setLength(Q_UINT16 len) +KSocketAddress& KSocketAddress::setLength(TQ_UINT16 len) { d->dup((sockaddr*)0L, len, false); @@ -619,7 +619,7 @@ TQString KSocketAddress::toString() const fmt = "[%1]:%2"; #endif else if (d->addr.generic->sa_family == AF_UNIX) - return TQString::fromLatin1("unix:%1").arg(serviceName()); + return TQString::tqfromLatin1("unix:%1").arg(serviceName()); else return i18n("1: the unknown socket address family number", "Unknown family %1").arg(d->addr.generic->sa_family); @@ -687,7 +687,7 @@ KInetSocketAddress::KInetSocketAddress() } // binary data constructor -KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, Q_UINT16 len) +KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, TQ_UINT16 len) : KSocketAddress(sa, len) { if (!d->invalid()) @@ -695,7 +695,7 @@ KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, Q_UINT16 len) } // create from IP and port -KInetSocketAddress::KInetSocketAddress(const KIpAddress& host, Q_UINT16 port) +KInetSocketAddress::KInetSocketAddress(const KIpAddress& host, TQ_UINT16 port) { setHost(host); setPort(port); @@ -788,14 +788,14 @@ KInetSocketAddress& KInetSocketAddress::setHost(const KIpAddress& ip) default: // empty - d->invalidate(); + d->tqinvalidate(); } return *this; } // returns the port -Q_UINT16 KInetSocketAddress::port() const +TQ_UINT16 KInetSocketAddress::port() const { if (d->invalid()) return 0; @@ -814,7 +814,7 @@ Q_UINT16 KInetSocketAddress::port() const return 0; } -KInetSocketAddress& KInetSocketAddress::setPort(Q_UINT16 port) +KInetSocketAddress& KInetSocketAddress::setPort(TQ_UINT16 port) { if (d->invalid()) makeIPv4(); @@ -832,7 +832,7 @@ KInetSocketAddress& KInetSocketAddress::setPort(Q_UINT16 port) #endif default: - d->invalidate(); // setting the port on something else + d->tqinvalidate(); // setting the port on something else } return *this; @@ -850,7 +850,7 @@ KInetSocketAddress& KInetSocketAddress::makeIPv6() return *this; } -Q_UINT32 KInetSocketAddress::flowinfo() const +TQ_UINT32 KInetSocketAddress::flowinfo() const { #ifndef AF_INET6 return 0; @@ -862,7 +862,7 @@ Q_UINT32 KInetSocketAddress::flowinfo() const #endif } -KInetSocketAddress& KInetSocketAddress::setFlowinfo(Q_UINT32 flowinfo) +KInetSocketAddress& KInetSocketAddress::setFlowinfo(TQ_UINT32 flowinfo) { makeIPv6(); // must set here d->addr.in6->sin6_flowinfo = flowinfo; @@ -897,18 +897,18 @@ void KInetSocketAddress::update() return; #endif else - d->invalidate(); + d->tqinvalidate(); } KUnixSocketAddress::KUnixSocketAddress() { } -KUnixSocketAddress::KUnixSocketAddress(const sockaddr* sa, Q_UINT16 len) +KUnixSocketAddress::KUnixSocketAddress(const sockaddr* sa, TQ_UINT16 len) : KSocketAddress(sa, len) { if (!d->invalid() && d->addr.un->sun_family != AF_UNIX) - d->invalidate(); + d->tqinvalidate(); } KUnixSocketAddress::KUnixSocketAddress(const KUnixSocketAddress& other) diff --git a/kdecore/network/ksocketaddress.h b/kdecore/network/ksocketaddress.h index 6889527e3..75deb60ae 100644 --- a/kdecore/network/ksocketaddress.h +++ b/kdecore/network/ksocketaddress.h @@ -119,7 +119,7 @@ public: * * @param ip4addr the IPv4 address */ - inline KIpAddress(Q_UINT32 ip4addr) + inline KIpAddress(TQ_UINT32 ip4addr) { setAddress(&ip4addr, 4); } /** @@ -232,7 +232,7 @@ public: * system's in_addr type. * */ - inline Q_UINT32 IPv4Addr(bool convertMapped = true) const + inline TQ_UINT32 IPv4Addr(bool convertMapped = true) const { return (convertMapped && isV4Mapped()) ? m_data[3] : m_data[0]; } @@ -245,7 +245,7 @@ public: * valid. The address returned is in host byte order. * */ - Q_UINT32 hostIPv4Addr(bool convertMapped = true) const; + TQ_UINT32 hostIPv4Addr(bool convertMapped = true) const; public: /*-- tests --*/ @@ -310,7 +310,7 @@ public: inline bool isMulticast() const { if (version() == 4) return isClassD(); - if (version() == 6) return ((Q_UINT8*)addr())[0] == 0xff; + if (version() == 6) return ((TQ_UINT8*)addr())[0] == 0xff; return false; } @@ -320,7 +320,7 @@ public: inline bool isLinkLocal() const { if (version() != 6) return false; - Q_UINT8* addr = (Q_UINT8*)this->addr(); + TQ_UINT8* addr = (TQ_UINT8*)this->addr(); return (addr[0] & 0xff) == 0xfe && (addr[1] & 0xc0) == 0x80; } @@ -331,7 +331,7 @@ public: inline bool isSiteLocal() const { if (version() != 6) return false; - Q_UINT8* addr = (Q_UINT8*)this->addr(); + TQ_UINT8* addr = (TQ_UINT8*)this->addr(); return (addr[0] & 0xff) == 0xfe && (addr[1] & 0xc0) == 0xc0; } @@ -348,10 +348,10 @@ public: inline bool isV4Mapped() const { if (version() != 6) return false; - Q_UINT32* addr = (Q_UINT32*)this->addr(); + TQ_UINT32* addr = (TQ_UINT32*)this->addr(); return addr[0] == 0 && addr[1] == 0 && - ((Q_UINT16*)&addr[2])[0] == 0 && - ((Q_UINT16*)&addr[2])[1] == 0xffff; + ((TQ_UINT16*)&addr[2])[0] == 0 && + ((TQ_UINT16*)&addr[2])[1] == 0xffff; } /** @@ -360,7 +360,7 @@ public: inline bool isV4Compat() const { if (version() != 6 || isLocalhost()) return false; - Q_UINT32* addr = (Q_UINT32*)this->addr(); + TQ_UINT32* addr = (TQ_UINT32*)this->addr(); return addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] != 0; } @@ -368,34 +368,34 @@ public: * Returns true if this is an IPv6 node-local multicast address. */ inline bool isMulticastNodeLocal() const - { return version() == 6 && isMulticast() && (((Q_UINT32*)addr())[0] & 0xf) == 0x1; } + { return version() == 6 && isMulticast() && (((TQ_UINT32*)addr())[0] & 0xf) == 0x1; } /** * Returns true if this is an IPv6 link-local multicast address. */ inline bool isMulticastLinkLocal() const - { return version() == 6 && isMulticast() && (((Q_UINT32*)addr())[0] & 0xf) == 0x2; } + { return version() == 6 && isMulticast() && (((TQ_UINT32*)addr())[0] & 0xf) == 0x2; } /** * Returns true if this is an IPv6 site-local multicast address. */ inline bool isMulticastSiteLocal() const - { return version() == 6 && isMulticast() && (((Q_UINT32*)addr())[0] & 0xf) == 0x5; } + { return version() == 6 && isMulticast() && (((TQ_UINT32*)addr())[0] & 0xf) == 0x5; } /** * Returns true if this is an IPv6 organisational-local multicast address. */ inline bool isMulticastOrgLocal() const - { return version() == 6 && isMulticast() && (((Q_UINT32*)addr())[0] & 0xf) == 0x8; } + { return version() == 6 && isMulticast() && (((TQ_UINT32*)addr())[0] & 0xf) == 0x8; } /** * Returns true if this is an IPv6 global multicast address. */ inline bool isMulticastGlobal() const - { return version() == 6 && isMulticast() && (((Q_UINT32*)addr())[0] & 0xf) == 0xe; } + { return version() == 6 && isMulticast() && (((TQ_UINT32*)addr())[0] & 0xf) == 0xe; } protected: - Q_UINT32 m_data[4]; // 16 bytes, needed for an IPv6 address + TQ_UINT32 m_data[4]; // 16 bytes, needed for an IPv6 address char m_version; @@ -437,7 +437,7 @@ public: * @param sa the socket address structure * @param len the socket address length */ - KSocketAddress(const sockaddr* sa, Q_UINT16 len); + KSocketAddress(const sockaddr* sa, TQ_UINT16 len); /** * Copy constructor. This creates a copy of the other @@ -490,7 +490,7 @@ public: * @param sa the socket address structure * @param len the socket address length */ - KSocketAddress& setAddress(const sockaddr *sa, Q_UINT16 len); + KSocketAddress& setAddress(const sockaddr *sa, TQ_UINT16 len); /** * Returns the socket address structure, to be passed down to @@ -502,7 +502,7 @@ public: /** * Returns the length of this socket address structure. */ - Q_UINT16 length() const; + TQ_UINT16 length() const; /** * Sets the length of this socket structure. @@ -511,7 +511,7 @@ public: * buffer to fit needs. This function should not be used except for handling * unknown socket address structures. * - * Also note that this function may invalidate the socket if a known + * Also note that this function may tqinvalidate the socket if a known * family is set (Internet or Unix socket) and the new length would be * too small to hold the system's sockaddr_* structure. If unsure, reset * the family: @@ -524,7 +524,7 @@ public: * * @param len the new length */ - KSocketAddress& setLength(Q_UINT16 len); + KSocketAddress& setLength(TQ_UINT16 len); /** * Returns the family of this address. @@ -535,7 +535,7 @@ public: /** * Sets the family of this object. * - * Note: setting the family will probably invalidate any address data + * Note: setting the family will probably tqinvalidate any address data * contained in this object. Use this function with care. * * @param family the new family to set @@ -666,7 +666,7 @@ public: * @param sa the sockaddr structure * @param len the structure's length */ - KInetSocketAddress(const sockaddr* sa, Q_UINT16 len); + KInetSocketAddress(const sockaddr* sa, TQ_UINT16 len); /** * Creates an object from an IP address and port. @@ -674,7 +674,7 @@ public: * @param host the IP address * @param port the port number */ - KInetSocketAddress(const KIpAddress& host, Q_UINT16 port); + KInetSocketAddress(const KIpAddress& host, TQ_UINT16 port); /** * Copy constructor. @@ -750,7 +750,7 @@ public: * @return a port number in the range 0 to 65535, inclusive. An empty or * invalid object will have a port number of 0. */ - Q_UINT16 port() const; + TQ_UINT16 port() const; /** * Sets the port number. If this object is empty, this function will default to @@ -759,7 +759,7 @@ public: * @param port the port number to set * @return a reference to itself */ - KInetSocketAddress& setPort(Q_UINT16 port); + KInetSocketAddress& setPort(TQ_UINT16 port); /** * Converts this object to an IPv4 socket address. It has no effect if the object @@ -787,7 +787,7 @@ public: * * @return the flowinfo information or 0 if this object is empty or IPv4 */ - Q_UINT32 flowinfo() const; + TQ_UINT32 flowinfo() const; /** * Sets the flowinfo information for an IPv6 socket address. If this is not @@ -796,7 +796,7 @@ public: * @param flowinfo the flowinfo to set * @return a reference to itself */ - KInetSocketAddress& setFlowinfo(Q_UINT32 flowinfo); + KInetSocketAddress& setFlowinfo(TQ_UINT32 flowinfo); /** * Returns the scope id this IPv6 socket is bound to. @@ -854,7 +854,7 @@ public: * @param sa the socket address structure * @param len the structure's length */ - KUnixSocketAddress(const sockaddr* sa, Q_UINT16 len); + KUnixSocketAddress(const sockaddr* sa, TQ_UINT16 len); /** * Copy constructor. Creates a copy of the other object, diff --git a/kdecore/network/ksocketbase.cpp b/kdecore/network/ksocketbase.cpp index 9071eea0e..1a486ee16 100644 --- a/kdecore/network/ksocketbase.cpp +++ b/kdecore/network/ksocketbase.cpp @@ -309,7 +309,7 @@ int KActiveSocketBase::putch(int ch) void KActiveSocketBase::setError(int status, SocketError error) { KSocketBase::setError(error); - setStatus(status); + setqStatus(status); } void KActiveSocketBase::resetError() diff --git a/kdecore/network/ksocketbase.h b/kdecore/network/ksocketbase.h index 133086114..b7df0c35f 100644 --- a/kdecore/network/ksocketbase.h +++ b/kdecore/network/ksocketbase.h @@ -504,7 +504,11 @@ public: * This call is not supported on sockets. Reimplemented from TQIODevice. * This will always return 0. */ +#ifdef USE_QT4 + virtual qint64 size() const +#else // USE_QT4 virtual Offset size() const +#endif // USE_QT4 { return 0; } /** @@ -533,7 +537,7 @@ public: * blocking. */ #ifdef USE_QT3 - virtual Q_LONG bytesAvailable() const = 0; + virtual TQ_LONG bytesAvailable() const = 0; #endif #ifdef USE_QT4 virtual qint64 bytesAvailable() const = 0; @@ -550,7 +554,7 @@ public: * * @returns the number of bytes available */ - virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L) = 0; + virtual TQ_LONG waitForMore(int msecs, bool *timeout = 0L) = 0; /** * Reads data from the socket. @@ -558,7 +562,7 @@ public: * Reimplemented from TQIODevice. See TQIODevice::readBlock for * more information. */ - virtual Q_LONG readBlock(char *data, Q_ULONG len) = 0; + virtual TQ_LONG readBlock(char *data, TQ_ULONG len) = 0; /** @overload * Receives data and the source address. @@ -571,7 +575,7 @@ public: * @param from the address of the sender will be stored here * @returns the actual number of bytes read */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) = 0; + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) = 0; /** * Peeks the data in the socket. @@ -584,7 +588,7 @@ public: * @param maxlen the maximum number of bytes to peek * @returns the actual number of bytes copied into @p data */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen) = 0; + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen) = 0; /** @overload * Peeks the data in the socket and the source address. @@ -598,7 +602,7 @@ public: * @param from the address of the sender will be stored here * @returns the actual number of bytes copied into @p data */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) = 0; + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) = 0; /** * Writes the given data to the socket. @@ -606,7 +610,7 @@ public: * Reimplemented from TQIODevice. See TQIODevice::writeBlock for * more information. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len) = 0; + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len) = 0; /** @overload * Writes the given data to the destination address. @@ -619,7 +623,7 @@ public: * @param to the address to send to * @returns the number of bytes actually sent */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to) = 0; + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) = 0; /** * Reads one character from the socket. diff --git a/kdecore/network/ksocketbuffer.cpp b/kdecore/network/ksocketbuffer.cpp index 18c926c83..4ea12ed14 100644 --- a/kdecore/network/ksocketbuffer.cpp +++ b/kdecore/network/ksocketbuffer.cpp @@ -33,7 +33,7 @@ using namespace KNetwork; using namespace KNetwork::Internal; -KSocketBuffer::KSocketBuffer(Q_LONG size) +KSocketBuffer::KSocketBuffer(TQ_LONG size) : m_mutex(true), m_offset(0), m_size(size), m_length(0) { } @@ -75,9 +75,9 @@ bool KSocketBuffer::canReadLine() const // walk the buffer for ( ; it != end; ++it) { - if ((*it).find('\n', offset) != -1) + if ((*it).tqfind('\n', offset) != -1) return true; - if ((*it).find('\r', offset) != -1) + if ((*it).tqfind('\r', offset) != -1) return true; offset = 0; } @@ -101,7 +101,7 @@ TQCString KSocketBuffer::readLine() // walk the buffer for ( ; it != end; ++it) { - int posnl = (*it).find('\n', offset); + int posnl = (*it).tqfind('\n', offset); if (posnl == -1) { // not found in this one @@ -120,17 +120,17 @@ TQCString KSocketBuffer::readLine() return result; } -Q_LONG KSocketBuffer::length() const +TQ_LONG KSocketBuffer::length() const { return m_length; } -Q_LONG KSocketBuffer::size() const +TQ_LONG KSocketBuffer::size() const { return m_size; } -bool KSocketBuffer::setSize(Q_LONG size) +bool KSocketBuffer::setSize(TQ_LONG size) { m_size = size; if (size == -1 || m_length < m_size) @@ -147,7 +147,7 @@ bool KSocketBuffer::setSize(Q_LONG size) return (m_length - m_size) == consumeBuffer(0L, m_length - m_size, true); } -Q_LONG KSocketBuffer::feedBuffer(const char *data, Q_LONG len) +TQ_LONG KSocketBuffer::feedBuffer(const char *data, TQ_LONG len) { if (data == 0L || len == 0) return 0; // nothing to write @@ -168,7 +168,7 @@ Q_LONG KSocketBuffer::feedBuffer(const char *data, Q_LONG len) return len; } -Q_LONG KSocketBuffer::consumeBuffer(char *destbuffer, Q_LONG maxlen, bool discard) +TQ_LONG KSocketBuffer::consumeBuffer(char *destbuffer, TQ_LONG maxlen, bool discard) { if (maxlen == 0 || isEmpty()) return 0; @@ -176,7 +176,7 @@ Q_LONG KSocketBuffer::consumeBuffer(char *destbuffer, Q_LONG maxlen, bool discar TQValueListIterator it = m_list.begin(), end = m_list.end(); TQIODevice::Offset offset = m_offset; - Q_LONG copied = 0; + TQ_LONG copied = 0; // walk the buffer while (it != end && maxlen) @@ -228,7 +228,7 @@ void KSocketBuffer::clear() m_length = 0; } -Q_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, Q_LONG len) +TQ_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, TQ_LONG len) { if (len == 0 || isEmpty()) return 0; @@ -238,7 +238,7 @@ Q_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, Q_LONG len) TQValueListIterator it = m_list.begin(), end = m_list.end(); TQIODevice::Offset offset = m_offset; - Q_LONG written = 0; + TQ_LONG written = 0; // walk the buffer while (it != end && (len || len == -1)) @@ -248,11 +248,11 @@ Q_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, Q_LONG len) // better by concatenating a few of them into a big buffer // question is: how big should that buffer be? 2 kB should be enough - Q_ULONG bufsize = 1460; + TQ_ULONG bufsize = 1460; if (len != -1 && len < bufsize) bufsize = len; TQByteArray buf(bufsize); - Q_LONG count = 0; + TQ_LONG count = 0; while (it != end && count + ((*it).size() - offset) <= bufsize) { @@ -273,7 +273,7 @@ Q_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, Q_LONG len) } // now try to write those bytes - Q_LONG wrote = dev->writeBlock(buf, count); + TQ_LONG wrote = dev->writeBlock(buf, count); if (wrote == -1) // error? @@ -293,7 +293,7 @@ Q_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, Q_LONG len) return written; } -Q_LONG KSocketBuffer::receiveFrom(KActiveSocketBase* dev, Q_LONG len) +TQ_LONG KSocketBuffer::receiveFrom(KActiveSocketBase* dev, TQ_LONG len) { if (len == 0 || isFull()) return 0; diff --git a/kdecore/network/ksocketbuffer_p.h b/kdecore/network/ksocketbuffer_p.h index a4a0d6a9e..0b8e96205 100644 --- a/kdecore/network/ksocketbuffer_p.h +++ b/kdecore/network/ksocketbuffer_p.h @@ -53,7 +53,7 @@ public: * * @param size the maximum size of the buffer */ - KSocketBuffer(Q_LONG size = -1); + KSocketBuffer(TQ_LONG size = -1); /** * Copy constructor. @@ -86,7 +86,7 @@ public: * * @sa size */ - virtual Q_LONG length() const; + virtual TQ_LONG length() const; /** * Retrieves the buffer size. The value of -1 indicates that @@ -94,7 +94,7 @@ public: * * @sa length for the length of the data stored */ - virtual Q_LONG size() const; + virtual TQ_LONG size() const; /** * Sets the size of the buffer, if allowed. @@ -103,7 +103,7 @@ public: * @returns true on success, false if an error occurred. * @note if the new size is less than length(), the buffer will be truncated */ - virtual bool setSize(Q_LONG size); + virtual bool setSize(TQ_LONG size); /** * Adds data to the end of the buffer. @@ -112,7 +112,7 @@ public: * @param len the data length, in bytes * @returns the number of bytes added to the end of the buffer. */ - virtual Q_LONG feedBuffer(const char *data, Q_LONG len); + virtual TQ_LONG feedBuffer(const char *data, TQ_LONG len); /** * Clears the buffer. @@ -127,7 +127,7 @@ public: * @param discard if true, the bytes copied will be discarded * @returns the number of bytes copied from the buffer */ - virtual Q_LONG consumeBuffer(char *data, Q_LONG maxlen, bool discard = true); + virtual TQ_LONG consumeBuffer(char *data, TQ_LONG maxlen, bool discard = true); /** * Sends at most @p len bytes of data to the I/O Device. @@ -137,7 +137,7 @@ public: * @returns the number of bytes sent and discarded from the buffer, -1 * indicates an error. */ - virtual Q_LONG sendTo(KActiveSocketBase* device, Q_LONG len = -1); + virtual TQ_LONG sendTo(KActiveSocketBase* device, TQ_LONG len = -1); /** * Tries to receive @p len bytes of data from the I/O device. @@ -148,15 +148,15 @@ public: * @returns the number of bytes received and copied into the buffer, * -1 indicates an error. */ - virtual Q_LONG receiveFrom(KActiveSocketBase* device, Q_LONG len = -1); + virtual TQ_LONG receiveFrom(KActiveSocketBase* device, TQ_LONG len = -1); protected: mutable TQMutex m_mutex; TQValueList m_list; TQIODevice::Offset m_offset; ///< offset of the start of data in the first element - Q_LONG m_size; ///< the maximum length of the buffer - mutable Q_LONG m_length; + TQ_LONG m_size; ///< the maximum length of the buffer + mutable TQ_LONG m_length; }; } } // namespace KNetwork::Internal diff --git a/kdecore/network/ksocketdevice.cpp b/kdecore/network/ksocketdevice.cpp index 53a16ca0a..793642bf9 100644 --- a/kdecore/network/ksocketdevice.cpp +++ b/kdecore/network/ksocketdevice.cpp @@ -365,7 +365,7 @@ bool KSocketDevice::disconnect() } #ifdef USE_QT3 -Q_LONG KSocketDevice::bytesAvailable() const +TQ_LONG KSocketDevice::bytesAvailable() const #endif #ifdef USE_QT4 qint64 KSocketDevice::bytesAvailable() const @@ -381,7 +381,7 @@ qint64 KSocketDevice::bytesAvailable() const return nchars; } -Q_LONG KSocketDevice::waitForMore(int msecs, bool *timeout) +TQ_LONG KSocketDevice::waitForMore(int msecs, bool *timeout) { if (m_sockfd == -1) return -1; // there won't ever be anything to read... @@ -393,7 +393,7 @@ Q_LONG KSocketDevice::waitForMore(int msecs, bool *timeout) return bytesAvailable(); } -static int do_read_common(int sockfd, char *data, Q_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false) +static int do_read_common(int sockfd, char *data, TQ_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false) { socklen_t len; if (from) @@ -419,7 +419,7 @@ static int do_read_common(int sockfd, char *data, Q_ULONG maxlen, KSocketAddress return 0; } -Q_LONG KSocketDevice::readBlock(char *data, Q_ULONG maxlen) +TQ_LONG KSocketDevice::readBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -440,7 +440,7 @@ Q_LONG KSocketDevice::readBlock(char *data, Q_ULONG maxlen) return retval; } -Q_LONG KSocketDevice::readBlock(char *data, Q_ULONG maxlen, KSocketAddress &from) +TQ_LONG KSocketDevice::readBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from) { resetError(); if (m_sockfd == -1) @@ -461,7 +461,7 @@ Q_LONG KSocketDevice::readBlock(char *data, Q_ULONG maxlen, KSocketAddress &from return retval; } -Q_LONG KSocketDevice::peekBlock(char *data, Q_ULONG maxlen) +TQ_LONG KSocketDevice::peekBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -482,7 +482,7 @@ Q_LONG KSocketDevice::peekBlock(char *data, Q_ULONG maxlen) return retval; } -Q_LONG KSocketDevice::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) +TQ_LONG KSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) { resetError(); if (m_sockfd == -1) @@ -503,12 +503,12 @@ Q_LONG KSocketDevice::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from return retval; } -Q_LONG KSocketDevice::writeBlock(const char *data, Q_ULONG len) +TQ_LONG KSocketDevice::writeBlock(const char *data, TQ_ULONG len) { return writeBlock(data, len, KSocketAddress()); } -Q_LONG KSocketDevice::writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to) +TQ_LONG KSocketDevice::writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) { resetError(); if (m_sockfd == -1) @@ -884,7 +884,7 @@ KSocketDevice::setDefaultImpl(KSocketDeviceFactoryBase* factory) void KSocketDevice::addNewImpl(KSocketDeviceFactoryBase* factory, int capabilities) { TQMutexLocker locker(&defaultImplFactoryMutex); - if (factories.contains(capabilities)) + if (factories.tqcontains(capabilities)) delete factories[capabilities]; factories.insert(capabilities, factory); } diff --git a/kdecore/network/ksocketdevice.h b/kdecore/network/ksocketdevice.h index 5f86687b2..5324cd02b 100644 --- a/kdecore/network/ksocketdevice.h +++ b/kdecore/network/ksocketdevice.h @@ -199,7 +199,7 @@ public: * Returns the number of bytes available for reading without blocking. */ #ifdef USE_QT3 - virtual Q_LONG bytesAvailable() const; + virtual TQ_LONG bytesAvailable() const; #endif #ifdef USE_QT4 virtual qint64 bytesAvailable() const; @@ -211,37 +211,37 @@ public: * This function is a wrapper against @ref poll. This function will wait * for any read events. */ - virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L); + virtual TQ_LONG waitForMore(int msecs, bool *timeout = 0L); /** * Reads data from this socket. */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); /** * Reads data and the source address from this socket. */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); /** * Peeks data in the socket. */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen); /** * Peeks the data in the socket and the source address. */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); /** * Writes data to the socket. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); /** * Writes the given data to the given destination address. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); /** * Returns this socket's local address. diff --git a/kdecore/network/ksockssocketdevice.cpp b/kdecore/network/ksockssocketdevice.cpp index f67b90bc9..b9fcb6cdd 100644 --- a/kdecore/network/ksockssocketdevice.cpp +++ b/kdecore/network/ksockssocketdevice.cpp @@ -190,7 +190,7 @@ KSocksSocketDevice* KSocksSocketDevice::accept() return new KSocksSocketDevice(newfd); } -static int socks_read_common(int sockfd, char *data, Q_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false) +static int socks_read_common(int sockfd, char *data, TQ_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false) { kde_socklen_t len; if (from) @@ -214,7 +214,7 @@ static int socks_read_common(int sockfd, char *data, Q_ULONG maxlen, KSocketAddr return 0; } -Q_LONG KSocksSocketDevice::readBlock(char *data, Q_ULONG maxlen) +TQ_LONG KSocksSocketDevice::readBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -235,7 +235,7 @@ Q_LONG KSocksSocketDevice::readBlock(char *data, Q_ULONG maxlen) return retval; } -Q_LONG KSocksSocketDevice::readBlock(char *data, Q_ULONG maxlen, KSocketAddress &from) +TQ_LONG KSocksSocketDevice::readBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from) { resetError(); if (m_sockfd == -1) @@ -256,7 +256,7 @@ Q_LONG KSocksSocketDevice::readBlock(char *data, Q_ULONG maxlen, KSocketAddress return retval; } -Q_LONG KSocksSocketDevice::peekBlock(char *data, Q_ULONG maxlen) +TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -277,7 +277,7 @@ Q_LONG KSocksSocketDevice::peekBlock(char *data, Q_ULONG maxlen) return retval; } -Q_LONG KSocksSocketDevice::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from) +TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) { resetError(); if (m_sockfd == -1) @@ -298,12 +298,12 @@ Q_LONG KSocksSocketDevice::peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& return retval; } -Q_LONG KSocksSocketDevice::writeBlock(const char *data, Q_ULONG len) +TQ_LONG KSocksSocketDevice::writeBlock(const char *data, TQ_ULONG len) { return writeBlock(data, len, KSocketAddress()); } -Q_LONG KSocksSocketDevice::writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to) +TQ_LONG KSocksSocketDevice::writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) { resetError(); if (m_sockfd == -1) diff --git a/kdecore/network/ksockssocketdevice.h b/kdecore/network/ksockssocketdevice.h index 62de23f05..1f8453836 100644 --- a/kdecore/network/ksockssocketdevice.h +++ b/kdecore/network/ksockssocketdevice.h @@ -83,20 +83,20 @@ public: /** * Overrides reading. */ - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen); - virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); /** * Overrides peeking. */ - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen); - virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); /** * Overrides writing. */ - virtual Q_LONG writeBlock(const char *data, Q_ULONG len); - virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); /** * Overrides getting socket address. diff --git a/kdecore/network/ksrvresolverworker.cpp b/kdecore/network/ksrvresolverworker.cpp index 07e3555fa..c1df59bde 100644 --- a/kdecore/network/ksrvresolverworker.cpp +++ b/kdecore/network/ksrvresolverworker.cpp @@ -33,7 +33,7 @@ using namespace KNetwork::Internal; namespace { - struct KSrvStartEvent: public QCustomEvent + struct KSrvStartEvent: public TQCustomEvent { inline KSrvStartEvent() : TQCustomEvent(TQEvent::User) { } }; @@ -51,11 +51,11 @@ bool KSrvResolverWorker::preprocess() return false; TQString node = nodeName(); - if (node.find('%') != -1) - node.truncate(node.find('%')); + if (node.tqfind('%') != -1) + node.truncate(node.tqfind('%')); - if (node.isEmpty() || node == TQString::fromLatin1("*") || - node == TQString::fromLatin1("localhost")) + if (node.isEmpty() || node == TQString::tqfromLatin1("*") || + node == TQString::tqfromLatin1("localhost")) return false; // empty == localhost encodedName = KResolver::domainToAscii(node); @@ -225,7 +225,7 @@ bool KSrvResolverWorker::postprocess() void KSrvResolverWorker::customEvent(TQCustomEvent*) { - dns = new TQDns(TQString::fromLatin1(encodedName), TQDns::Srv); + dns = new TQDns(TQString::tqfromLatin1(encodedName), TQDns::Srv); TQObject::connect(dns, TQT_SIGNAL(resultsReady()), this, TQT_SLOT(dnsResultsReady())); } diff --git a/kdecore/network/ksrvresolverworker_p.h b/kdecore/network/ksrvresolverworker_p.h index 90074214f..293308544 100644 --- a/kdecore/network/ksrvresolverworker_p.h +++ b/kdecore/network/ksrvresolverworker_p.h @@ -42,13 +42,14 @@ namespace KNetwork public KNetwork::KResolverWorkerBase { Q_OBJECT + TQ_OBJECT public: struct Entry { TQString name; - Q_UINT16 port; - Q_UINT16 weight; + TQ_UINT16 port; + TQ_UINT16 weight; KNetwork::KResolver* resolver; }; @@ -57,7 +58,7 @@ namespace KNetwork PriorityClass() : totalWeight(0) { } TQValueList entries; - Q_UINT16 totalWeight; + TQ_UINT16 totalWeight; }; private: @@ -66,7 +67,7 @@ namespace KNetwork TQCString encodedName; TQSemaphore *sem; - typedef TQMap Results; + typedef TQMap Results; Results myResults; public: diff --git a/kdecore/network/kstreamsocket.cpp b/kdecore/network/kstreamsocket.cpp index 8ca4f91f6..3861a4e09 100644 --- a/kdecore/network/kstreamsocket.cpp +++ b/kdecore/network/kstreamsocket.cpp @@ -130,7 +130,7 @@ bool KStreamSocket::connect(const TQString& node, const TQString& service) // connection hasn't started yet if (!blocking()) { - TQObject::connect(this, TQT_SIGNAL(hostFound()), TQT_SLOT(hostFoundSlot())); + QObject::connect(this, TQT_SIGNAL(hostFound()), TQT_SLOT(hostFoundSlot())); return lookup(); } @@ -196,7 +196,7 @@ bool KStreamSocket::connect(const KResolverEntry& entry) void KStreamSocket::hostFoundSlot() { - TQObject::disconnect(this, TQT_SLOT(hostFoundSlot())); + QObject::disconnect(this, TQT_SLOT(hostFoundSlot())); if (timeout() > 0) d->timer.start(timeout(), true); TQTimer::singleShot(0, this, TQT_SLOT(connectionEvent())); diff --git a/kdecore/network/kstreamsocket.h b/kdecore/network/kstreamsocket.h index 099826cb8..9b58bf23a 100644 --- a/kdecore/network/kstreamsocket.h +++ b/kdecore/network/kstreamsocket.h @@ -97,6 +97,7 @@ class KStreamSocketPrivate; class KDECORE_EXPORT KStreamSocket: public KClientSocketBase { Q_OBJECT + TQ_OBJECT public: /** -- cgit v1.2.1