diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kpf/src/Server.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpf/src/Server.cpp')
-rw-r--r-- | kpf/src/Server.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/kpf/src/Server.cpp b/kpf/src/Server.cpp index 3e59281a..90d94209 100644 --- a/kpf/src/Server.cpp +++ b/kpf/src/Server.cpp @@ -38,12 +38,12 @@ namespace KPF Server::Server ( - const QString & dir, + const TQString & dir, bool followSymlinks, int socket, WebServer * parent ) - : QObject(parent, "Server") + : TQObject(parent, "Server") { d = new Private; @@ -53,38 +53,38 @@ namespace KPF d->followSymlinks = followSymlinks; - d->birth = QDateTime::currentDateTime(); + d->birth = TQDateTime::currentDateTime(); d->socket.setSocket(socket); - connect(&(d->socket), SIGNAL(readyRead()), this, SLOT(slotReadyRead())); + connect(&(d->socket), TQT_SIGNAL(readyRead()), this, TQT_SLOT(slotReadyRead())); connect ( &(d->socket), - SIGNAL(bytesWritten(int)), - SLOT(slotBytesWritten(int)) + TQT_SIGNAL(bytesWritten(int)), + TQT_SLOT(slotBytesWritten(int)) ); connect ( &(d->socket), - SIGNAL(connectionClosed()), - SLOT(slotConnectionClosed()) + TQT_SIGNAL(connectionClosed()), + TQT_SLOT(slotConnectionClosed()) ); connect ( &(d->idleTimer), - SIGNAL(timeout()), - SLOT(slotTimeout()) + TQT_SIGNAL(timeout()), + TQT_SLOT(slotTimeout()) ); connect ( &(d->readTimer), - SIGNAL(timeout()), - SLOT(slotRead()) + TQT_SIGNAL(timeout()), + TQT_SLOT(slotRead()) ); // If nothing happens for a bit, cancel ourselves. @@ -128,7 +128,7 @@ namespace KPF { kpfDebug << d->id << ": socket.canReadLine" << endl; - QString line(d->socket.readLine().stripWhiteSpace()); + TQString line(d->socket.readLine().stripWhiteSpace()); #ifdef KPF_TRAFFIC_DEBUG kpfDebug @@ -194,7 +194,7 @@ namespace KPF } bool - Server::readRequest(const QString & line) + Server::readRequest(const TQString & line) { ++d->requestCount; @@ -205,9 +205,9 @@ namespace KPF << line << "'" << endl; #endif - QStringList l(QStringList::split(' ', line)); + TQStringList l(TQStringList::split(' ', line)); - // A request usually looks like METHOD PATH PROTOCOL but we don't + // A request usually looks like TQT_METHOD PATH PROTOCOL but we don't // require PROTOCOL - we just assume HTTP/0.9 and act accordingly. if (l.count() == 2) @@ -226,7 +226,7 @@ namespace KPF d->request.setMethod (l[0]); d->request.setPath (l[1]); - d->request.setProtocol (l.count() == 3 ? l[2] : QString::null); + d->request.setProtocol (l.count() == 3 ? l[2] : TQString::null); // Before we check the request, say we received it. @@ -238,7 +238,7 @@ namespace KPF bool Server::checkRequest() { - // We only handle METHOD of GET or HEAD. + // We only handle TQT_METHOD of GET or HEAD. if (Request::Unsupported == d->request.method()) { @@ -336,7 +336,7 @@ namespace KPF // This would be cleaner if there was a QValueQueue. // Basically we 'dequeue' the first line from incomingHeaderBuffer. - QString line(d->incomingLineBuffer.first()); + TQString line(d->incomingLineBuffer.first()); d->incomingLineBuffer.remove(d->incomingLineBuffer.begin()); // Unless the line is empty, this is (in theory) a header. @@ -393,7 +393,7 @@ namespace KPF { // The path to the requested resource is relative to our root. - QString filename = d->dir + '/' + d->request.path(); + TQString filename = d->dir + '/' + d->request.path(); kpfDebug << d->id << ": filename: " << filename << endl; @@ -550,25 +550,25 @@ namespace KPF if (206 == d->response.code()) { - QString line = "Content-Range: bytes "; + TQString line = "Content-Range: bytes "; - line += QString::number(d->request.range().first()); + line += TQString::number(d->request.range().first()); line += '-'; if (d->request.range().haveLast()) - line += QString::number(d->request.range().last()); + line += TQString::number(d->request.range().last()); else - line += QString::number(d->resource.size() - 1); + line += TQString::number(d->resource.size() - 1); line += '/'; - line += QString::number(d->resource.size()); + line += TQString::number(d->resource.size()); writeLine(line); } - writeLine("Content-Length: " + QString::number(d->fileBytesLeft)); + writeLine("Content-Length: " + TQString::number(d->fileBytesLeft)); } if (d->requestCount >= MaxKeepAlive && d->request.protocol() >= 1.1) @@ -689,12 +689,12 @@ namespace KPF } void - Server::writeLine(const QString & line) + Server::writeLine(const TQString & line) { // Fill a buffer. We're not allowed to send anything out until our // controller calls write(). - QCString s(line.utf8() + "\r\n"); + TQCString s(line.utf8() + "\r\n"); d->headerBytesLeft += s.length(); d->outgoingHeaderBuffer += s; @@ -717,7 +717,7 @@ namespace KPF // Request from the Response object the text that should be sent // back to the client. - QCString s(d->response.text(d->request)); + TQCString s(d->response.text(d->request)); // Tell our Response object how long it will be in total (it doesn't // know its total size until we tell it about the resource size.) @@ -754,7 +754,7 @@ namespace KPF d->socket.close(); - d->death = QDateTime::currentDateTime(); + d->death = TQDateTime::currentDateTime(); emit(finished(this)); } @@ -789,7 +789,7 @@ namespace KPF // If the socket has been closed (e.g. the remote end hung up) // then we just give up. - if (QSocket::Connection != d->socket.state()) + if (TQSocket::Connection != d->socket.state()) { kpfDebug << d->id << ": Socket closed by client -> finished" << endl; setFinished(Flush); @@ -1020,7 +1020,7 @@ namespace KPF bytesToWrite = min(bytesToWrite, d->socket.outputBufferLeft()); - QByteArray a(bytesToWrite); + TQByteArray a(bytesToWrite); if (0 == bytesToWrite) return true; @@ -1049,14 +1049,14 @@ namespace KPF kpfDebug << d->id << ": Wrote file data: `" - << QCString(a.data(), fileBytesWritten) + << TQCString(a.data(), fileBytesWritten) << "'" << endl; #endif // We should have been able to write the full amount to the socket, // because we tested d->socket.outputBufferLeft(). If we didn't - // manage to write that much, either we have a bug or QSocket does. + // manage to write that much, either we have a bug or TQSocket does. if (fileBytesWritten < fileBytesRead) { |