From 1c1403293485f35fd53db45aaa77a01cdd9627e7 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 28 Jun 2011 20:34:15 +0000 Subject: TQt4 port ktorrent This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1238733 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- plugins/webinterface/httpclienthandler.cpp | 62 ++++---- plugins/webinterface/httpclienthandler.h | 29 ++-- plugins/webinterface/httpresponseheader.cpp | 16 +-- plugins/webinterface/httpresponseheader.h | 10 +- plugins/webinterface/httpserver.cpp | 174 +++++++++++------------ plugins/webinterface/httpserver.h | 39 ++--- plugins/webinterface/php_handler.cpp | 38 ++--- plugins/webinterface/php_handler.h | 17 +-- plugins/webinterface/php_interface.cpp | 160 ++++++++++----------- plugins/webinterface/php_interface.h | 6 +- plugins/webinterface/webinterfaceplugin.cpp | 6 +- plugins/webinterface/webinterfaceplugin.h | 5 +- plugins/webinterface/webinterfacepref.ui | 50 +++---- plugins/webinterface/webinterfaceprefpage.cpp | 4 +- plugins/webinterface/webinterfaceprefpage.h | 2 +- plugins/webinterface/webinterfaceprefwidget.cpp | 40 +++--- plugins/webinterface/webinterfaceprefwidget.h | 5 +- plugins/webinterface/www/coldmilk/page_update.js | 10 +- plugins/webinterface/www/coldmilk/rest.php | 4 +- plugins/webinterface/www/default/details.php | 4 +- plugins/webinterface/www/default/interface.php | 8 +- plugins/webinterface/www/default/wz_tooltip.js | 4 +- plugins/webinterface/www/mobile/interface.php | 4 +- plugins/webinterface/www/mobile/torrent.php | 6 +- 24 files changed, 354 insertions(+), 349 deletions(-) (limited to 'plugins/webinterface') diff --git a/plugins/webinterface/httpclienthandler.cpp b/plugins/webinterface/httpclienthandler.cpp index d925466..1ad2d8d 100644 --- a/plugins/webinterface/httpclienthandler.cpp +++ b/plugins/webinterface/httpclienthandler.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include -#include +#include +#include #include #include #include "httpserver.h" @@ -31,7 +31,7 @@ using namespace bt; namespace kt { - HttpClientHandler::HttpClientHandler(HttpServer* srv,QSocket* sock) : srv(srv),client(sock),php_response_hdr(200) + HttpClientHandler::HttpClientHandler(HttpServer* srv,TQSocket* sock) : srv(srv),client(sock),php_response_hdr(200) { state = WAITING_FOR_REQUEST; bytes_read = 0; @@ -51,7 +51,7 @@ namespace kt { while (client->canReadLine()) { - QString line = client->readLine(); + TQString line = client->readLine(); header_data += line; if (header_data.endsWith("\r\n\r\n")) { @@ -87,7 +87,7 @@ namespace kt void HttpClientHandler::handleRequest() { - header = QHttpRequestHeader(header_data); + header = TQHttpRequestHeader(header_data); // Out(SYS_WEB|LOG_DEBUG) << "Parsing request : " << header.toString() << endl; if (header.method() == "POST") { @@ -112,7 +112,7 @@ namespace kt } } - bool HttpClientHandler::sendFile(HttpResponseHeader & hdr,const QString & full_path) + bool HttpClientHandler::sendFile(HttpResponseHeader & hdr,const TQString & full_path) { // Out(SYS_WEB|LOG_DEBUG) << "Sending file " << full_path << endl; // first look in cache @@ -131,12 +131,12 @@ namespace kt srv->insertIntoCache(full_path,c); } - hdr.setValue("Content-Length",QString::number(c->getSize())); + hdr.setValue("Content-Length",TQString::number(c->getSize())); // Out(SYS_WEB|LOG_DEBUG) << "HTTP header : " << endl; // Out(SYS_WEB|LOG_DEBUG) << hdr.toString() << endl; - QCString d = hdr.toString().utf8(); + TQCString d = hdr.toString().utf8(); client->writeBlock(d.data(),d.length()); Uint32 written = 0; @@ -156,14 +156,14 @@ namespace kt #define HTTP_500_ERROR "HTTP/1.1 500 Internal Server ErrorHTTP/1.1 Internal Server Error
%1" - void HttpClientHandler::send404(HttpResponseHeader & hdr,const QString & path) + void HttpClientHandler::send404(HttpResponseHeader & hdr,const TQString & path) { // Out(SYS_WEB|LOG_DEBUG) << "Sending 404 " << path << endl; - QString data = HTTP_404_ERROR; - hdr.setValue("Content-Length",QString::number(data.length())); + TQString data = HTTP_404_ERROR; + hdr.setValue("Content-Length",TQString::number(data.length())); - QTextStream os(client); - os.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream os(client); + os.setEncoding( TQTextStream::UnicodeUTF8 ); os << hdr.toString(); os << data; } @@ -171,11 +171,11 @@ namespace kt void HttpClientHandler::send500(HttpResponseHeader & hdr) { // Out(SYS_WEB|LOG_DEBUG) << "Sending 500 " << endl; - QString data = QString(HTTP_500_ERROR).arg("An internal server error occured !"); - hdr.setValue("Content-Length",QString::number(data.length())); + TQString data = TQString(HTTP_500_ERROR).tqarg("An internal server error occured !"); + hdr.setValue("Content-Length",TQString::number(data.length())); - QTextStream os(client); - os.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream os(client); + os.setEncoding( TQTextStream::UnicodeUTF8 ); os << hdr.toString(); os << data; } @@ -183,28 +183,28 @@ namespace kt void HttpClientHandler::sendResponse(const HttpResponseHeader & hdr) { // Out(SYS_WEB|LOG_DEBUG) << "Sending response " << hdr.toString() << endl; - QTextStream os(client); - os.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream os(client); + os.setEncoding( TQTextStream::UnicodeUTF8 ); os << hdr.toString(); } void HttpClientHandler::executePHPScript( PhpInterface* php_iface, HttpResponseHeader & hdr, - const QString & php_exe, - const QString & php_file, - const QMap & args) + const TQString & php_exe, + const TQString & php_file, + const TQMap & args) { // Out(SYS_WEB|LOG_DEBUG) << "Launching PHP script " << php_file << endl; php = new PhpHandler(php_exe,php_iface); if (!php->executeScript(php_file,args)) { - QString data = QString(HTTP_500_ERROR).arg("Failed to launch PHP executable !"); + TQString data = TQString(HTTP_500_ERROR).tqarg("Failed to launch PHP executable !"); hdr.setResponseCode(500); - hdr.setValue("Content-Length",QString::number(data.utf8().length())); + hdr.setValue("Content-Length",TQString::number(data.utf8().length())); - QTextStream os(client); - os.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream os(client); + os.setEncoding( TQTextStream::UnicodeUTF8 ); os << hdr.toString(); os << data; state = WAITING_FOR_REQUEST; @@ -212,18 +212,18 @@ namespace kt else { php_response_hdr = hdr; - connect(php,SIGNAL(finished()),this,SLOT(onPHPFinished())); + connect(php,TQT_SIGNAL(finished()),this,TQT_SLOT(onPHPFinished())); state = PROCESSING_PHP; } } void HttpClientHandler::onPHPFinished() { - const QByteArray & output = php->getOutput(); - php_response_hdr.setValue("Content-Length",QString::number(output.size())); + const TQByteArray & output = php->getOutput(); + php_response_hdr.setValue("Content-Length",TQString::number(output.size())); - QTextStream os(client); - os.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream os(client); + os.setEncoding( TQTextStream::UnicodeUTF8 ); os << php_response_hdr.toString(); os.writeRawBytes(output.data(),output.size()); diff --git a/plugins/webinterface/httpclienthandler.h b/plugins/webinterface/httpclienthandler.h index cacf463..c76be5c 100644 --- a/plugins/webinterface/httpclienthandler.h +++ b/plugins/webinterface/httpclienthandler.h @@ -21,12 +21,12 @@ #define KTHTTPCLIENTHANDLER_H -#include -#include +#include +#include #include #include "httpresponseheader.h" -class QSocket; +class TQSocket; namespace kt @@ -38,9 +38,10 @@ namespace kt /** @author Joris Guisson */ - class HttpClientHandler : public QObject + class HttpClientHandler : public TQObject { Q_OBJECT + TQ_OBJECT enum State { WAITING_FOR_REQUEST, @@ -48,20 +49,20 @@ namespace kt PROCESSING_PHP }; public: - HttpClientHandler(HttpServer* srv,QSocket* sock); + HttpClientHandler(HttpServer* srv,TQSocket* sock); virtual ~HttpClientHandler(); void readyToRead(); - bool sendFile(HttpResponseHeader & hdr,const QString & full_path); + bool sendFile(HttpResponseHeader & hdr,const TQString & full_path); void sendResponse(const HttpResponseHeader & hdr); - void send404(HttpResponseHeader & hdr,const QString & path); + void send404(HttpResponseHeader & hdr,const TQString & path); void send500(HttpResponseHeader & hdr); void executePHPScript(PhpInterface* php_iface, HttpResponseHeader & hdr, - const QString & php_exe, - const QString & php_file, - const QMap & args); + const TQString & php_exe, + const TQString & php_file, + const TQMap & args); private: void handleRequest(); @@ -71,11 +72,11 @@ namespace kt private: HttpServer* srv; - QSocket* client; + TQSocket* client; State state; - QHttpRequestHeader header; - QString header_data; - QByteArray request_data; + TQHttpRequestHeader header; + TQString header_data; + TQByteArray request_data; bt::Uint32 bytes_read; PhpHandler* php; HttpResponseHeader php_response_hdr; diff --git a/plugins/webinterface/httpresponseheader.cpp b/plugins/webinterface/httpresponseheader.cpp index da7556f..7b87892 100644 --- a/plugins/webinterface/httpresponseheader.cpp +++ b/plugins/webinterface/httpresponseheader.cpp @@ -21,7 +21,7 @@ namespace kt { - static QString ResponseCodeToString(int r) + static TQString ResponseCodeToString(int r) { switch (r) { @@ -30,7 +30,7 @@ namespace kt case 304: return "Not Modified"; case 404: return "Not Found"; } - return QString::null; + return TQString(); } HttpResponseHeader::HttpResponseHeader(int response_code) @@ -53,20 +53,20 @@ namespace kt response_code = rc; } - void HttpResponseHeader::setValue(const QString & key,const QString & value) + void HttpResponseHeader::setValue(const TQString & key,const TQString & value) { fields[key] = value; } - QString HttpResponseHeader::toString() const + TQString HttpResponseHeader::toString() const { - QString str; - str += QString("HTTP/1.1 %1 %2\r\n").arg(response_code).arg(ResponseCodeToString(response_code)); + TQString str; + str += TQString("HTTP/1.1 %1 %2\r\n").tqarg(response_code).tqarg(ResponseCodeToString(response_code)); - QMap::const_iterator itr = fields.begin(); + TQMap::const_iterator itr = fields.begin(); while (itr != fields.end()) { - str += QString("%1: %2\r\n").arg(itr.key()).arg(itr.data()); + str += TQString("%1: %2\r\n").tqarg(itr.key()).tqarg(itr.data()); itr++; } str += "\r\n"; diff --git a/plugins/webinterface/httpresponseheader.h b/plugins/webinterface/httpresponseheader.h index 9672191..417fe6b 100644 --- a/plugins/webinterface/httpresponseheader.h +++ b/plugins/webinterface/httpresponseheader.h @@ -21,8 +21,8 @@ #define KTHTTPRESPONSEHEADER_H -#include -#include +#include +#include namespace kt { @@ -33,16 +33,16 @@ namespace kt class HttpResponseHeader { int response_code; - QMap fields; + TQMap fields; public: HttpResponseHeader(int response_code); HttpResponseHeader(const HttpResponseHeader & hdr); virtual ~HttpResponseHeader(); void setResponseCode(int response_code); - void setValue(const QString & key,const QString & value); + void setValue(const TQString & key,const TQString & value); - QString toString() const; + TQString toString() const; }; diff --git a/plugins/webinterface/httpserver.cpp b/plugins/webinterface/httpserver.cpp index e2c0eeb..06d8d34 100644 --- a/plugins/webinterface/httpserver.cpp +++ b/plugins/webinterface/httpserver.cpp @@ -17,9 +17,9 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include #include @@ -27,9 +27,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -53,12 +53,12 @@ namespace kt - HttpServer::HttpServer(CoreInterface *core, int port) : QServerSocket(port, 5),core(core),cache(10,23) + HttpServer::HttpServer(CoreInterface *core, int port) : TQServerSocket(port, 5),core(core),cache(10,23) { php_i = new PhpInterface(core); clients.setAutoDelete(true); - QStringList dirList = KGlobal::instance()->dirs()->findDirs("data", "ktorrent/www"); + TQStringList dirList = KGlobal::instance()->dirs()->findDirs("data", "ktorrent/www"); rootDir = *(dirList.begin()); Out(SYS_WEB|LOG_DEBUG) << "WWW Root Directory "<< rootDir <setSocket(s); - connect(socket, SIGNAL(readyRead()), this, SLOT(slotSocketReadyToRead())); - connect(socket, SIGNAL(delayedCloseFinished()), this, SLOT(slotConnectionClosed())); - connect(socket, SIGNAL(connectionClosed()), this, SLOT(slotConnectionClosed())); + connect(socket, TQT_SIGNAL(readyRead()), this, TQT_SLOT(slotSocketReadyToRead())); + connect(socket, TQT_SIGNAL(delayedCloseFinished()), this, TQT_SLOT(slotConnectionClosed())); + connect(socket, TQT_SIGNAL(connectionClosed()), this, TQT_SLOT(slotConnectionClosed())); HttpClientHandler* handler = new HttpClientHandler(this,socket); clients.insert(socket,handler); - Out(SYS_WEB|LOG_NOTICE) << "connection from "<< socket->peerAddress().toString() << endl; + Out(SYS_WEB|LOG_NOTICE) << "connection from "<< TQString(socket->peerAddress().toString()) << endl; } void HttpServer::slotSocketReadyToRead() { - QSocket* client = (QSocket*)sender(); - HttpClientHandler* handler = clients.find(client); + TQSocket* client = (TQSocket*)sender(); + HttpClientHandler* handler = clients.tqfind(client); if (!handler) { client->deleteLater(); @@ -98,10 +98,10 @@ namespace kt handler->readyToRead(); } - static int DecodeEscapedChar(QString & password,int idx) + static int DecodeEscapedChar(TQString & password,int idx) { - QChar a = password[idx + 1].lower(); - QChar b = password[idx + 2].lower(); + TQChar a = password[idx + 1].lower(); + TQChar b = password[idx + 2].lower(); if (!a.isNumber() && !(a.latin1() >= 'a' && a.latin1() <= 'f')) return idx + 2; // not a valid hex digit @@ -112,21 +112,21 @@ namespace kt Uint8 h = (a.latin1() - (a.isNumber() ? '0' : 'a')) << 4; Uint8 l = (b.latin1() - (b.isNumber() ? '0' : 'a')); char r = (char) h | l; // combine them and cast to a char - password.replace(idx,3,r); + password.tqreplace(idx,3,r); return idx + 1; } - bool HttpServer::checkLogin(const QHttpRequestHeader & hdr,const QByteArray & data) + bool HttpServer::checkLogin(const TQHttpRequestHeader & hdr,const TQByteArray & data) { if (hdr.contentType() != "application/x-www-form-urlencoded") return false; - QString username; - QString password; - QStringList params = QStringList::split("&",QString(data)); - for (QStringList::iterator i = params.begin();i != params.end();i++) + TQString username; + TQString password; + TQStringList params = TQStringList::split("&",TQString(data)); + for (TQStringList::iterator i = params.begin();i != params.end();i++) { - QString t = *i; + TQString t = *i; if (t.section("=",0,0) == "username") username = t.section("=",1,1); else if (t.section("=",0,0) == "password") @@ -134,7 +134,7 @@ namespace kt // check for passwords with url encoded stuff in them and decode them if necessary int idx = 0; - while ((idx = password.find('%',idx)) > 0) + while ((idx = password.tqfind('%',idx)) > 0) { if (idx + 2 < password.length()) { @@ -154,7 +154,7 @@ namespace kt { session.logged_in = true; session.sessionId=rand(); - session.last_access=QTime::currentTime(); + session.last_access=TQTime::currentTime(); Out(SYS_WEB|LOG_NOTICE) << "Webgui login succesfull !" << endl; return true; } @@ -163,19 +163,19 @@ namespace kt return false; } - bool HttpServer::checkSession(const QHttpRequestHeader & hdr) + bool HttpServer::checkSession(const TQHttpRequestHeader & hdr) { // check session in cookie int session_id = 0; if (hdr.hasKey("Cookie")) { - QString cookie = hdr.value("Cookie"); - int idx = cookie.find("KT_SESSID="); + TQString cookie = hdr.value("Cookie"); + int idx = cookie.tqfind("KT_SESSID="); if (idx == -1) return false; - QString number; - idx += QString("KT_SESSID=").length(); + TQString number; + idx += TQString("KT_SESSID=").length(); while (idx < cookie.length()) { if (cookie[idx] >= '0' && cookie[idx] <= '9') @@ -193,9 +193,9 @@ namespace kt if (session_id == session.sessionId) { // check if the session hasn't expired yet - if(session.last_access.secsTo(QTime::currentTime())sendFile(rhdr,path)) { HttpResponseHeader nhdr(404); @@ -272,9 +272,9 @@ namespace kt Out(SYS_WEB|LOG_NOTICE) << "Redirecting to /login.html" << endl; } - void HttpServer::handleGet(HttpClientHandler* hdlr,const QHttpRequestHeader & hdr,bool do_not_check_session) + void HttpServer::handleGet(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,bool do_not_check_session) { - QString file = hdr.path(); + TQString file = hdr.path(); if (file == "/") file = "/login.html"; @@ -283,7 +283,7 @@ namespace kt KURL url; url.setEncodedPathAndQuery(file); - QString path = rootDir + bt::DirSeparator() + WebInterfacePluginSettings::skin() + url.path(); + TQString path = rootDir + bt::DirSeparator() + WebInterfacePluginSettings::skin() + url.path(); // first check if the file exists (if not send 404) if (!bt::Exists(path)) { @@ -293,8 +293,8 @@ namespace kt return; } - QFileInfo fi(path); - QString ext = fi.extension(); + TQFileInfo fi(path); + TQString ext = fi.extension(); // if it is the login page send that if (file == "/login.html" || file == "/") @@ -328,8 +328,8 @@ namespace kt if (path.endsWith("login.html")) { // clear cookie in case of login page - QDateTime dt = QDateTime::currentDateTime().addDays(-1); - QString cookie = QString("KT_SESSID=666; expires=%1 +0000").arg(DateTimeToString(dt,true)); + TQDateTime dt = TQDateTime::tqcurrentDateTime().addDays(-1); + TQString cookie = TQString("KT_SESSID=666; expires=%1 +0000").tqarg(DateTimeToString(dt,true)); rhdr.setValue("Set-Cookie",cookie); } @@ -344,14 +344,14 @@ namespace kt { if (hdr.hasKey("If-Modified-Since")) { - QDateTime dt = parseDate(hdr.value("If-Modified-Since")); + TQDateTime dt = parseDate(hdr.value("If-Modified-Since")); if (dt.isValid() && dt < fi.lastModified()) { HttpResponseHeader rhdr(304); setDefaultResponseHeaders(rhdr,"text/html",true); rhdr.setValue("Cache-Control","max-age=0"); rhdr.setValue("Last-Modified",DateTimeToString(fi.lastModified(),false)); - rhdr.setValue("Expires",DateTimeToString(QDateTime::currentDateTime(Qt::UTC).addSecs(3600),false)); + rhdr.setValue("Expires",DateTimeToString(TQDateTime::tqcurrentDateTime(Qt::UTC).addSecs(3600),false)); hdlr->sendResponse(rhdr); return; } @@ -361,7 +361,7 @@ namespace kt HttpResponseHeader rhdr(200); setDefaultResponseHeaders(rhdr,ExtensionToContentType(ext),true); rhdr.setValue("Last-Modified",DateTimeToString(fi.lastModified(),false)); - rhdr.setValue("Expires",DateTimeToString(QDateTime::currentDateTime(Qt::UTC).addSecs(3600),false)); + rhdr.setValue("Expires",DateTimeToString(TQDateTime::tqcurrentDateTime(Qt::UTC).addSecs(3600),false)); rhdr.setValue("Cache-Control","private"); if (!hdlr->sendFile(rhdr,path)) { @@ -381,7 +381,7 @@ namespace kt { // first send back login page redirectToLoginPage(hdlr); - QTimer::singleShot(1000,kapp,SLOT(quit())); + TQTimer::singleShot(1000,kapp,TQT_SLOT(quit())); } else if (redirect) { @@ -409,7 +409,7 @@ namespace kt } } - void HttpServer::handlePost(HttpClientHandler* hdlr,const QHttpRequestHeader & hdr,const QByteArray & data) + void HttpServer::handlePost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data) { // this is either a file or a login if (hdr.value("Content-Type").startsWith("multipart/form-data")) @@ -418,7 +418,7 @@ namespace kt } else if (!checkLogin(hdr,data)) { - QHttpRequestHeader tmp = hdr; + TQHttpRequestHeader tmp = hdr; tmp.setRequest("GET","/login.html",1,1); handleGet(hdlr,tmp); } @@ -428,11 +428,11 @@ namespace kt } } - void HttpServer::handleTorrentPost(HttpClientHandler* hdlr,const QHttpRequestHeader & hdr,const QByteArray & data) + void HttpServer::handleTorrentPost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data) { const char* ptr = data.data(); Uint32 len = data.size(); - int pos = QString(data).find("\r\n\r\n"); + int pos = TQString(data).tqfind("\r\n\r\n"); if (pos == -1 || pos + 4 >= len || ptr[pos + 4] != 'd') { @@ -444,7 +444,7 @@ namespace kt // save torrent to a temporary file KTempFile tmp_file(locateLocal("tmp", "ktwebgui-"), ".torrent"); - QDataStream* out = tmp_file.dataStream(); + TQDataStream* out = tmp_file.dataStream(); if (!out) { HttpResponseHeader rhdr(500); @@ -472,11 +472,11 @@ namespace kt void HttpServer::slotConnectionClosed() { - QSocket* socket= (QSocket*)sender(); + TQSocket* socket= (TQSocket*)sender(); clients.erase(socket); } - QDateTime HttpServer::parseDate(const QString & str) + TQDateTime HttpServer::parseDate(const TQString & str) { /* Potential date formats : @@ -484,66 +484,66 @@ namespace kt Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format */ - QStringList sl = QStringList::split(" ",str); + TQStringList sl = TQStringList::split(" ",str); if (sl.count() == 6) { // RFC 1123 format - QDate d; - QString month = sl[2]; + TQDate d; + TQString month = sl[2]; int m = -1; for (int i = 1;i <= 12 && m < 0;i++) - if (QDate::shortMonthName(i) == month) + if (TQDate::shortMonthName(i) == month) m = i; d.setYMD(sl[3].toInt(),m,sl[1].toInt()); - QTime t = QTime::fromString(sl[4],Qt::ISODate); - return QDateTime(d,t); + TQTime t = TQTime::fromString(sl[4],Qt::ISODate); + return TQDateTime(d,t); } else if (sl.count() == 4) { // RFC 1036 - QStringList dl = QStringList::split("-",sl[1]); + TQStringList dl = TQStringList::split("-",sl[1]); if (dl.count() != 3) - return QDateTime(); + return TQDateTime(); - QDate d; - QString month = dl[1]; + TQDate d; + TQString month = dl[1]; int m = -1; for (int i = 1;i <= 12 && m < 0;i++) - if (QDate::shortMonthName(i) == month) + if (TQDate::shortMonthName(i) == month) m = i; d.setYMD(2000 + dl[2].toInt(),m,dl[0].toInt()); - QTime t = QTime::fromString(sl[2],Qt::ISODate); - return QDateTime(d,t); + TQTime t = TQTime::fromString(sl[2],Qt::ISODate); + return TQDateTime(d,t); } else if (sl.count() == 5) { // ANSI C - QDate d; - QString month = sl[1]; + TQDate d; + TQString month = sl[1]; int m = -1; for (int i = 1;i <= 12 && m < 0;i++) - if (QDate::shortMonthName(i) == month) + if (TQDate::shortMonthName(i) == month) m = i; d.setYMD(sl[4].toInt(),m,sl[2].toInt()); - QTime t = QTime::fromString(sl[3],Qt::ISODate); - return QDateTime(d,t); + TQTime t = TQTime::fromString(sl[3],Qt::ISODate); + return TQDateTime(d,t); } else - return QDateTime(); + return TQDateTime(); } - bt::MMapFile* HttpServer::cacheLookup(const QString & name) + bt::MMapFile* HttpServer::cacheLookup(const TQString & name) { - return cache.find(name); + return cache.tqfind(name); } - void HttpServer::insertIntoCache(const QString & name,bt::MMapFile* file) + void HttpServer::insertIntoCache(const TQString & name,bt::MMapFile* file) { cache.insert(name,file); } diff --git a/plugins/webinterface/httpserver.h b/plugins/webinterface/httpserver.h index 28be441..dcdfdfe 100644 --- a/plugins/webinterface/httpserver.h +++ b/plugins/webinterface/httpserver.h @@ -20,13 +20,13 @@ #ifndef HTTPSERVER_H #define HTTPSERVER_H -#include -#include -#include -#include +#include +#include +#include +#include #include -class QSocket; +class TQSocket; namespace bt { @@ -43,7 +43,7 @@ namespace kt struct Session { bool logged_in; - QTime last_access; + TQTime last_access; int sessionId; }; @@ -62,41 +62,42 @@ namespace kt - class HttpServer : public QServerSocket + class HttpServer : public TQServerSocket { Q_OBJECT + TQ_OBJECT public: HttpServer(CoreInterface *core, int port); virtual ~HttpServer(); void newConnection(int s); - void handleGet(HttpClientHandler* hdlr,const QHttpRequestHeader & hdr,bool do_not_check_session = false); - void handlePost(HttpClientHandler* hdlr,const QHttpRequestHeader & hdr,const QByteArray & data); + void handleGet(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,bool do_not_check_session = false); + void handlePost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data); void handleUnsupportedMethod(HttpClientHandler* hdlr); - bt::MMapFile* cacheLookup(const QString & name); - void insertIntoCache(const QString & name,bt::MMapFile* file); + bt::MMapFile* cacheLookup(const TQString & name); + void insertIntoCache(const TQString & name,bt::MMapFile* file); protected slots: void slotSocketReadyToRead(); void slotConnectionClosed(); private: - bool checkSession(const QHttpRequestHeader & hdr); - bool checkLogin(const QHttpRequestHeader & hdr,const QByteArray & data); - void setDefaultResponseHeaders(HttpResponseHeader & hdr,const QString & content_type,bool with_session_info); - void handleTorrentPost(HttpClientHandler* hdlr,const QHttpRequestHeader & hdr,const QByteArray & data); - QDateTime parseDate(const QString & str); + bool checkSession(const TQHttpRequestHeader & hdr); + bool checkLogin(const TQHttpRequestHeader & hdr,const TQByteArray & data); + void setDefaultResponseHeaders(HttpResponseHeader & hdr,const TQString & content_type,bool with_session_info); + void handleTorrentPost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data); + TQDateTime parseDate(const TQString & str); void redirectToLoginPage(HttpClientHandler* hdlr); private: - QString rootDir; + TQString rootDir; int sessionTTL; PhpInterface *php_i; Session session; - bt::PtrMap clients; + bt::PtrMap clients; CoreInterface *core; - QCache cache; + TQCache cache; }; diff --git a/plugins/webinterface/php_handler.cpp b/plugins/webinterface/php_handler.cpp index d04c3b6..852f1fd 100644 --- a/plugins/webinterface/php_handler.cpp +++ b/plugins/webinterface/php_handler.cpp @@ -33,24 +33,24 @@ using namespace bt; namespace kt { - QMap PhpHandler::scripts; + TQMap PhpHandler::scripts; - PhpHandler::PhpHandler(const QString & php_exe,PhpInterface *php) : QProcess(php_exe),php_i(php) + PhpHandler::PhpHandler(const TQString & php_exe,PhpInterface *php) : TQProcess(php_exe),php_i(php) { - connect(this,SIGNAL(readyReadStdout()),this,SLOT(onReadyReadStdout())); - connect(this,SIGNAL(processExited()),this,SLOT(onExited())); + connect(this,TQT_SIGNAL(readyReadStdout()),this,TQT_SLOT(onReadyReadStdout())); + connect(this,TQT_SIGNAL(processExited()),this,TQT_SLOT(onExited())); } PhpHandler::~PhpHandler() { } - bool PhpHandler::executeScript(const QString & path,const QMap & args) + bool PhpHandler::executeScript(const TQString & path,const TQMap & args) { - QByteArray php_s; - if (!scripts.contains(path)) + TQByteArray php_s; + if (!scripts.tqcontains(path)) { - QFile fptr(path); + TQFile fptr(path); if (!fptr.open(IO_ReadOnly)) { Out(SYS_WEB|LOG_DEBUG) << "Failed to open " << path << endl; @@ -66,32 +66,32 @@ namespace kt output.resize(0); - int firstphptag = QCString(php_s).find("globalInfo(ts); - php_i->downloadStatus(ts); + php_i->downloadtqStatus(ts); - QMap::const_iterator it; + TQMap::const_iterator it; for ( it = args.begin(); it != args.end(); ++it ) { - ts << QString("$_REQUEST['%1']=\"%2\";\n").arg(it.key()).arg(it.data()); + ts << TQString("$_REQUEST['%1']=\"%2\";\n").tqarg(it.key()).tqarg(it.data()); } ts.writeRawBytes(php_s.data() + off,php_s.size() - off); // the rest of the script ts << flush; #if 0 - QFile dinges("output.php"); + TQFile dinges("output.php"); if (dinges.open(IO_WriteOnly)) { - QTextStream out(&dinges); + TQTextStream out(&dinges); out.writeRawBytes(data.data(),data.size()); dinges.close(); } @@ -108,10 +108,10 @@ namespace kt void PhpHandler::onReadyReadStdout() { - QTextStream out(output,IO_WriteOnly|IO_Append); + TQTextStream out(output,IO_WriteOnly|IO_Append); while (canReadLineStdout()) { - QByteArray d = readStdout(); + TQByteArray d = readStdout(); out.writeRawBytes(d.data(),d.size()); } } diff --git a/plugins/webinterface/php_handler.h b/plugins/webinterface/php_handler.h index b9bfcb6..197bdb7 100644 --- a/plugins/webinterface/php_handler.h +++ b/plugins/webinterface/php_handler.h @@ -20,24 +20,25 @@ #ifndef PHP_HANDLER_H #define PHP_HANDLER_H -#include +#include #include -#include +#include namespace kt { class PhpInterface; - class PhpHandler : public QProcess + class PhpHandler : public TQProcess { Q_OBJECT + TQ_OBJECT public: - PhpHandler(const QString & php_exe,PhpInterface *php); + PhpHandler(const TQString & php_exe,PhpInterface *php); virtual ~PhpHandler(); - bool executeScript(const QString & path,const QMap & args); - const QByteArray & getOutput() const {return output;}; + bool executeScript(const TQString & path,const TQMap & args); + const TQByteArray & getOutput() const {return output;}; public slots: void onExited(); @@ -47,10 +48,10 @@ namespace kt void finished(); private: - QByteArray output; + TQByteArray output; PhpInterface *php_i; - static QMap scripts; + static TQMap scripts; }; } diff --git a/plugins/webinterface/php_interface.cpp b/plugins/webinterface/php_interface.cpp index 8ee7d0b..4206caa 100644 --- a/plugins/webinterface/php_interface.cpp +++ b/plugins/webinterface/php_interface.cpp @@ -36,7 +36,7 @@ using namespace bt; namespace kt { - extern QString DataDir(); + extern TQString DataDir(); using bt::FIRST_PRIORITY; using bt::NORMAL_PRIORITY; @@ -44,23 +44,23 @@ namespace kt using bt::EXCLUDED; - QString BytesToString2(Uint64 bytes,int precision = 2) + TQString BytesToString2(Uint64 bytes,int precision = 2) { KLocale* loc = KGlobal::locale(); if (bytes >= 1024 * 1024 * 1024) - return QString("%1 GB").arg(loc->formatNumber(bytes / TO_GIG,precision < 0 ? 2 : precision)); + return TQString("%1 GB").tqarg(loc->formatNumber(bytes / TO_GIG,precision < 0 ? 2 : precision)); else if (bytes >= 1024*1024) - return QString("%1 MB").arg(loc->formatNumber(bytes / TO_MEG,precision < 0 ? 1 : precision)); + return TQString("%1 MB").tqarg(loc->formatNumber(bytes / TO_MEG,precision < 0 ? 1 : precision)); else if (bytes >= 1024) - return QString("%1 KB").arg(loc->formatNumber(bytes / TO_KB,precision < 0 ? 1 : precision)); + return TQString("%1 KB").tqarg(loc->formatNumber(bytes / TO_KB,precision < 0 ? 1 : precision)); else - return QString("%1 B").arg(bytes); + return TQString("%1 B").tqarg(bytes); } - QString KBytesPerSecToString2(double speed,int precision = 2) + TQString KBytesPerSecToString2(double speed,int precision = 2) { KLocale* loc = KGlobal::locale(); - return QString("%1 KB/s").arg(loc->formatNumber(speed,precision)); + return TQString("%1 KB/s").tqarg(loc->formatNumber(speed,precision)); } /************************ @@ -72,62 +72,62 @@ namespace kt } /*Generate php code - * function downloadStatus() + * function downloadtqStatus() * { * return array( ... ); * } */ - void PhpCodeGenerator::downloadStatus(QTextStream & out) + void PhpCodeGenerator::downloadtqStatus(TQTextStream & out) { TorrentStats stats; //Priority file_priority; - QString status; - out << "function downloadStatus()\n{\nreturn array("; + TQString status; + out << "function downloadtqStatus()\n{\nreturn array("; - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if (k > 0) out << ",\n"; stats=(*i)->getStats(); - out << QString("\n%1 => array(").arg(k); + out << TQString("\n%1 => array(").tqarg(k); - out << QString("\"imported_bytes\" => %1,\n").arg(stats.imported_bytes); - out << QString("\"bytes_downloaded\" => \"%1\",\n").arg(BytesToString2(stats.bytes_downloaded)); - out << QString("\"bytes_uploaded\" => \"%1\",\n").arg(BytesToString2(stats.bytes_uploaded)); - out << QString("\"bytes_left\" => %1,\n").arg(stats.bytes_left); - out << QString("\"bytes_left_to_download\" => %1,\n").arg(stats.bytes_left_to_download); - out << QString("\"total_bytes\" => \"%1\",\n").arg(BytesToString2(stats.total_bytes)); - out << QString("\"total_bytes_to_download\" => %1,\n").arg(stats.total_bytes_to_download); - out << QString("\"download_rate\" => \"%1\",\n").arg(KBytesPerSecToString2(stats.download_rate / 1024.0)); - out << QString("\"upload_rate\" => \"%1\",\n").arg(KBytesPerSecToString2(stats.upload_rate / 1024.0)); - out << QString("\"num_peers\" => %1,\n").arg(stats.num_peers); - out << QString("\"num_chunks_downloading\" => %1,\n").arg(stats.num_chunks_downloading); - out << QString("\"total_chunks\" => %1,\n").arg(stats.total_chunks); - out << QString("\"num_chunks_downloaded\" => %1,\n").arg(stats.num_chunks_downloaded); - out << QString("\"num_chunks_excluded\" => %1,\n").arg(stats.num_chunks_excluded); - out << QString("\"chunk_size\" => %1,\n").arg(stats.chunk_size); - out << QString("\"seeders_total\" => %1,\n").arg(stats.seeders_total); - out << QString("\"seeders_connected_to\" => %1,\n").arg(stats.seeders_connected_to); - out << QString("\"leechers_total\" => %1,\n").arg(stats.leechers_total); - out << QString("\"leechers_connected_to\" => %1,\n").arg(stats.leechers_connected_to); - out << QString("\"status\" => %1,\n").arg(stats.status); - out << QString("\"running\" => %1,\n").arg(stats.running); - out << QString("\"trackerstatus\" => \"%1\",\n").arg(stats.trackerstatus.replace("\\", "\\\\").replace("\"", "\\\"").replace("$", "\\$")); - out << QString("\"session_bytes_downloaded\" => %1,\n").arg(stats.session_bytes_downloaded); - out << QString("\"session_bytes_uploaded\" => %1,\n").arg(stats.session_bytes_uploaded); - out << QString("\"trk_bytes_downloaded\" => %1,\n").arg(stats.trk_bytes_downloaded); - out << QString("\"trk_bytes_uploaded\" => %1,\n").arg(stats.trk_bytes_uploaded); - out << QString("\"torrent_name\" => \"%1\",\n").arg(stats.torrent_name.replace("\\", "\\\\").replace("\"", "\\\"").replace("$", "\\$")); - out << QString("\"output_path\" => \"%1\",\n").arg(stats.output_path.replace("\\", "\\\\").replace("\"", "\\\"").replace("$", "\\$")); - out << QString("\"stopped_by_error\" => \"%1\",\n").arg(stats.stopped_by_error); - out << QString("\"completed\" => \"%1\",\n").arg(stats.completed); - out << QString("\"user_controlled\" => \"%1\",\n").arg(stats.user_controlled); - out << QString("\"max_share_ratio\" => %1,\n").arg(stats.max_share_ratio); - out << QString("\"priv_torrent\" => \"%1\",\n").arg(stats.priv_torrent); - out << QString("\"num_files\" => \"%1\",\n").arg((*i)->getNumFiles()); - out << QString("\"files\" => array("); + out << TQString("\"imported_bytes\" => %1,\n").tqarg(stats.imported_bytes); + out << TQString("\"bytes_downloaded\" => \"%1\",\n").tqarg(BytesToString2(stats.bytes_downloaded)); + out << TQString("\"bytes_uploaded\" => \"%1\",\n").tqarg(BytesToString2(stats.bytes_uploaded)); + out << TQString("\"bytes_left\" => %1,\n").tqarg(stats.bytes_left); + out << TQString("\"bytes_left_to_download\" => %1,\n").tqarg(stats.bytes_left_to_download); + out << TQString("\"total_bytes\" => \"%1\",\n").tqarg(BytesToString2(stats.total_bytes)); + out << TQString("\"total_bytes_to_download\" => %1,\n").tqarg(stats.total_bytes_to_download); + out << TQString("\"download_rate\" => \"%1\",\n").tqarg(KBytesPerSecToString2(stats.download_rate / 1024.0)); + out << TQString("\"upload_rate\" => \"%1\",\n").tqarg(KBytesPerSecToString2(stats.upload_rate / 1024.0)); + out << TQString("\"num_peers\" => %1,\n").tqarg(stats.num_peers); + out << TQString("\"num_chunks_downloading\" => %1,\n").tqarg(stats.num_chunks_downloading); + out << TQString("\"total_chunks\" => %1,\n").tqarg(stats.total_chunks); + out << TQString("\"num_chunks_downloaded\" => %1,\n").tqarg(stats.num_chunks_downloaded); + out << TQString("\"num_chunks_excluded\" => %1,\n").tqarg(stats.num_chunks_excluded); + out << TQString("\"chunk_size\" => %1,\n").tqarg(stats.chunk_size); + out << TQString("\"seeders_total\" => %1,\n").tqarg(stats.seeders_total); + out << TQString("\"seeders_connected_to\" => %1,\n").tqarg(stats.seeders_connected_to); + out << TQString("\"leechers_total\" => %1,\n").tqarg(stats.leechers_total); + out << TQString("\"leechers_connected_to\" => %1,\n").tqarg(stats.leechers_connected_to); + out << TQString("\"status\" => %1,\n").tqarg(stats.status); + out << TQString("\"running\" => %1,\n").tqarg(stats.running); + out << TQString("\"trackerstatus\" => \"%1\",\n").tqarg(stats.trackerstatus.tqreplace("\\", "\\\\").tqreplace("\"", "\\\"").tqreplace("$", "\\$")); + out << TQString("\"session_bytes_downloaded\" => %1,\n").tqarg(stats.session_bytes_downloaded); + out << TQString("\"session_bytes_uploaded\" => %1,\n").tqarg(stats.session_bytes_uploaded); + out << TQString("\"trk_bytes_downloaded\" => %1,\n").tqarg(stats.trk_bytes_downloaded); + out << TQString("\"trk_bytes_uploaded\" => %1,\n").tqarg(stats.trk_bytes_uploaded); + out << TQString("\"torrent_name\" => \"%1\",\n").tqarg(stats.torrent_name.tqreplace("\\", "\\\\").tqreplace("\"", "\\\"").tqreplace("$", "\\$")); + out << TQString("\"output_path\" => \"%1\",\n").tqarg(stats.output_path.tqreplace("\\", "\\\\").tqreplace("\"", "\\\"").tqreplace("$", "\\$")); + out << TQString("\"stopped_by_error\" => \"%1\",\n").tqarg(stats.stopped_by_error); + out << TQString("\"completed\" => \"%1\",\n").tqarg(stats.completed); + out << TQString("\"user_controlled\" => \"%1\",\n").tqarg(stats.user_controlled); + out << TQString("\"max_share_ratio\" => %1,\n").tqarg(stats.max_share_ratio); + out << TQString("\"priv_torrent\" => \"%1\",\n").tqarg(stats.priv_torrent); + out << TQString("\"num_files\" => \"%1\",\n").tqarg((*i)->getNumFiles()); + out << TQString("\"files\" => array("); out << flush; if (stats.multi_file_torrent) { @@ -138,12 +138,12 @@ namespace kt out << ",\n"; TorrentFileInterface & file = (*i)->getTorrentFile(j); - out << QString("\"%1\" => array(\n").arg(j); - out << QString("\"name\" => \"%1\",\n").arg(file.getPath()); - out << QString("\"size\" => \"%1\",\n").arg(KIO::convertSize(file.getSize())); - out << QString("\"perc_done\" => \"%1\",\n").arg(file.getDownloadPercentage()); - out << QString("\"status\" => \"%1\"\n").arg(file.getPriority()); - out << QString(")\n"); + out << TQString("\"%1\" => array(\n").tqarg(j); + out << TQString("\"name\" => \"%1\",\n").tqarg(file.getPath()); + out << TQString("\"size\" => \"%1\",\n").tqarg(KIO::convertSize(file.getSize())); + out << TQString("\"perc_done\" => \"%1\",\n").tqarg(file.getDownloadPercentage()); + out << TQString("\"status\" => \"%1\"\n").tqarg(file.getPriority()); + out << TQString(")\n"); out << flush; } } @@ -156,26 +156,26 @@ namespace kt } /*Generate php code - * function globalStatus() + * function globaltqStatus() * { * return array( ... ); * } */ - void PhpCodeGenerator::globalInfo(QTextStream & out) + void PhpCodeGenerator::globalInfo(TQTextStream & out) { out << "function globalInfo()\n{\nreturn array("; CurrentStats stats=core->getStats(); - out << QString("\"download_speed\" => \"%1\",").arg(KBytesPerSecToString2(stats.download_speed / 1024.0)); - out << QString("\"upload_speed\" => \"%1\",").arg(KBytesPerSecToString2(stats.upload_speed / 1024.0)); - out << QString("\"bytes_downloaded\" => \"%1\",").arg(stats.bytes_downloaded); - out << QString("\"bytes_uploaded\" => \"%1\",").arg(stats.bytes_uploaded); - out << QString("\"max_download_speed\" => \"%1\",").arg(core->getMaxDownloadSpeed()); - out << QString("\"max_upload_speed\" => \"%1\",").arg(core->getMaxUploadSpeed()); - out << QString("\"max_downloads\" => \"%1\",").arg(Settings::maxDownloads()); - out << QString("\"max_seeds\"=> \"%1\",").arg(Settings::maxSeeds()); - out << QString("\"dht_support\" => \"%1\",").arg(Settings::dhtSupport()); - out << QString("\"use_encryption\" => \"%1\"").arg(Settings::useEncryption()); + out << TQString("\"download_speed\" => \"%1\",").tqarg(KBytesPerSecToString2(stats.download_speed / 1024.0)); + out << TQString("\"upload_speed\" => \"%1\",").tqarg(KBytesPerSecToString2(stats.upload_speed / 1024.0)); + out << TQString("\"bytes_downloaded\" => \"%1\",").tqarg(stats.bytes_downloaded); + out << TQString("\"bytes_uploaded\" => \"%1\",").tqarg(stats.bytes_uploaded); + out << TQString("\"max_download_speed\" => \"%1\",").tqarg(core->getMaxDownloadSpeed()); + out << TQString("\"max_upload_speed\" => \"%1\",").tqarg(core->getMaxUploadSpeed()); + out << TQString("\"max_downloads\" => \"%1\",").tqarg(Settings::maxDownloads()); + out << TQString("\"max_seeds\"=> \"%1\",").tqarg(Settings::maxSeeds()); + out << TQString("\"dht_support\" => \"%1\",").tqarg(Settings::dhtSupport()); + out << TQString("\"use_encryption\" => \"%1\"").tqarg(Settings::useEncryption()); out << ");\n}\n"; } @@ -193,14 +193,14 @@ namespace kt bool ret = false; shutdown = false; int separator_loc; - QString parse; - QString torrent_num; - QString file_num; + TQString parse; + TQString torrent_num; + TQString file_num; KURL redirected_url; redirected_url.setPath(url.path()); - const QMap & params = url.queryItems(); - QMap::ConstIterator it; + const TQMap & params = url.queryItems(); + TQMap::ConstIterator it; for ( it = params.begin(); it != params.end(); ++it ) { @@ -263,14 +263,14 @@ namespace kt break; case 'f': //parse argument into torrent number and file number - separator_loc=it.data().find('-'); + separator_loc=it.data().tqfind('-'); parse=it.data(); torrent_num.append(parse.left(separator_loc)); file_num.append(parse.right(parse.length()-(separator_loc+1))); if(it.key()=="file_lp") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(torrent_num.toInt()==k) @@ -284,7 +284,7 @@ namespace kt } else if(it.key()=="file_np") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(torrent_num.toInt()==k) @@ -298,7 +298,7 @@ namespace kt } else if(it.key()=="file_hp") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(torrent_num.toInt()==k) @@ -312,7 +312,7 @@ namespace kt } else if(it.key()=="file_stop") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(torrent_num.toInt()==k) @@ -410,7 +410,7 @@ namespace kt case 'r': if(it.key()=="remove") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(it.data().toInt()==k) @@ -433,7 +433,7 @@ namespace kt } else if(it.key()=="stop") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(it.data().toInt()==k) @@ -446,7 +446,7 @@ namespace kt } else if(it.key()=="start") { - QPtrList::iterator i= core->getQueueManager()->begin(); + TQPtrList::iterator i= core->getQueueManager()->begin(); for(int k=0; i != core->getQueueManager()->end(); i++, k++) { if(it.data().toInt()==k) diff --git a/plugins/webinterface/php_interface.h b/plugins/webinterface/php_interface.h index be79019..4995ae6 100644 --- a/plugins/webinterface/php_interface.h +++ b/plugins/webinterface/php_interface.h @@ -21,7 +21,7 @@ #ifndef PHP_INTERFACE_H #define PHP_INTERFACE_H -#include +#include #include #include #include @@ -40,8 +40,8 @@ namespace kt PhpCodeGenerator(CoreInterface *c); virtual ~PhpCodeGenerator(){} - void downloadStatus(QTextStream & out); - void globalInfo(QTextStream & out); + void downloadtqStatus(TQTextStream & out); + void globalInfo(TQTextStream & out); private: CoreInterface *core; }; diff --git a/plugins/webinterface/webinterfaceplugin.cpp b/plugins/webinterface/webinterfaceplugin.cpp index bce4115..513f3b8 100644 --- a/plugins/webinterface/webinterfaceplugin.cpp +++ b/plugins/webinterface/webinterfaceplugin.cpp @@ -40,8 +40,8 @@ K_EXPORT_COMPONENT_FACTORY(ktwebinterfaceplugin,KGenericFactory WebInterfacePreference - + WebInterfacePreference @@ -20,7 +20,7 @@ 0 - + 500 350 @@ -33,7 +33,7 @@ unnamed - + buttonGroup1 @@ -44,15 +44,15 @@ unnamed - + - layout5 + tqlayout5 unnamed - + textLabel1 @@ -74,7 +74,7 @@ 8080 - + forward @@ -92,14 +92,14 @@ Expanding - + 54 21 - + textLabel4 @@ -126,15 +126,15 @@ - + - layout4 + tqlayout4 unnamed - + textLabel1_2 @@ -142,30 +142,30 @@ Select interface: - + interfaceSkinBox - + - layout6 + tqlayout6 unnamed - + - layout5 + tqlayout5 unnamed - + textLabel5 @@ -180,7 +180,7 @@ - + btnPassword @@ -190,15 +190,15 @@ - + - layout7 + tqlayout7 unnamed - + textLabel2 @@ -239,11 +239,11 @@ changeLedState() - + btnUpdate_clicked() changeLedState() - - + + knuminput.h knuminput.h diff --git a/plugins/webinterface/webinterfaceprefpage.cpp b/plugins/webinterface/webinterfaceprefpage.cpp index 20dbc97..1e1bc16 100644 --- a/plugins/webinterface/webinterfaceprefpage.cpp +++ b/plugins/webinterface/webinterfaceprefpage.cpp @@ -43,9 +43,9 @@ namespace kt return true; } - void WebInterfacePrefPage::createWidget(QWidget* parent) + void WebInterfacePrefPage::createWidget(TQWidget* tqparent) { - m_widget = new WebInterfacePrefWidget(parent); + m_widget = new WebInterfacePrefWidget(tqparent); } void WebInterfacePrefPage::updateData() diff --git a/plugins/webinterface/webinterfaceprefpage.h b/plugins/webinterface/webinterfaceprefpage.h index a10f1c9..ee796af 100644 --- a/plugins/webinterface/webinterfaceprefpage.h +++ b/plugins/webinterface/webinterfaceprefpage.h @@ -41,7 +41,7 @@ namespace kt virtual ~WebInterfacePrefPage(); virtual bool apply(); - virtual void createWidget(QWidget* parent); + virtual void createWidget(TQWidget* tqparent); virtual void updateData(); virtual void deleteWidget(); diff --git a/plugins/webinterface/webinterfaceprefwidget.cpp b/plugins/webinterface/webinterfaceprefwidget.cpp index fc11d89..ccf9555 100644 --- a/plugins/webinterface/webinterfaceprefwidget.cpp +++ b/plugins/webinterface/webinterfaceprefwidget.cpp @@ -26,17 +26,17 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include #include -#include +#include #include #include @@ -44,16 +44,16 @@ using namespace bt; namespace kt { -WebInterfacePrefWidget::WebInterfacePrefWidget(QWidget *parent, const char *name):WebInterfacePreference(parent,name) +WebInterfacePrefWidget::WebInterfacePrefWidget(TQWidget *tqparent, const char *name):WebInterfacePreference(tqparent,name) { port->setValue(WebInterfacePluginSettings::port()); forward->setChecked(WebInterfacePluginSettings::forward()); sessionTTL->setValue(WebInterfacePluginSettings::sessionTTL()); - QStringList dirList=KGlobal::instance()->dirs()->findDirs("data", "ktorrent/www"); - QDir d(*(dirList.begin())); - QStringList skinList=d.entryList(QDir::Dirs); - for ( QStringList::Iterator it = skinList.begin(); it != skinList.end(); ++it ){ + TQStringList dirList=KGlobal::instance()->dirs()->findDirs("data", "ktorrent/www"); + TQDir d(*(dirList.begin())); + TQStringList skinList=d.entryList(TQDir::Dirs); + for ( TQStringList::Iterator it = skinList.begin(); it != skinList.end(); ++it ){ if(*it=="." || *it=="..") continue; interfaceSkinBox->insertItem(*it); @@ -62,11 +62,11 @@ WebInterfacePrefWidget::WebInterfacePrefWidget(QWidget *parent, const char *name interfaceSkinBox->setCurrentText (WebInterfacePluginSettings::skin()); if(WebInterfacePluginSettings::phpExecutablePath().isEmpty()){ - QString phpPath=KStandardDirs::findExe("php"); - if(phpPath==QString::null) + TQString phpPath=KStandardDirs::findExe("php"); + if(phpPath==TQString()) phpPath=KStandardDirs::findExe("php-cli"); - if(phpPath==QString::null) + if(phpPath==TQString()) phpExecutablePath->setURL (i18n("Php executable is not in default path, please enter the path manually")); else phpExecutablePath->setURL (phpPath); @@ -102,7 +102,7 @@ bool WebInterfacePrefWidget::apply() void WebInterfacePrefWidget::btnUpdate_clicked() { - QCString passwd; + TQCString passwd; int result = KPasswordDialog::getNewPassword(passwd, i18n("Please enter a new password for the web interface.")); if (result == KPasswordDialog::Accepted) password=passwd; @@ -111,25 +111,25 @@ void WebInterfacePrefWidget::btnUpdate_clicked() void WebInterfacePrefWidget::changeLedState() { - QFileInfo fi(phpExecutablePath->url()); + TQFileInfo fi(phpExecutablePath->url()); if(fi.isExecutable() && (fi.isFile() || fi.isSymLink())){ - QToolTip::add( kled, i18n("%1 exists and it is executable").arg(phpExecutablePath->url())); + TQToolTip::add( kled, i18n("%1 exists and it is executable").tqarg(phpExecutablePath->url())); kled->setColor(green); } else if (!fi.exists()){ - QToolTip::add( kled, i18n("%1 does not exist").arg(phpExecutablePath->url()) ); + TQToolTip::add( kled, i18n("%1 does not exist").tqarg(phpExecutablePath->url()) ); kled->setColor(red); } else if (!fi.isExecutable()){ - QToolTip::add( kled, i18n("%1 is not executable").arg(phpExecutablePath->url()) ); + TQToolTip::add( kled, i18n("%1 is not executable").tqarg(phpExecutablePath->url()) ); kled->setColor(red); } else if (fi.isDir()){ - QToolTip::add( kled, i18n("%1 is a directory").arg(phpExecutablePath->url()) ); + TQToolTip::add( kled, i18n("%1 is a directory").tqarg(phpExecutablePath->url()) ); kled->setColor(red); } else{ - QToolTip::add( kled, i18n("%1 is not php executable path").arg(phpExecutablePath->url()) ); + TQToolTip::add( kled, i18n("%1 is not php executable path").tqarg(phpExecutablePath->url()) ); kled->setColor(red); } } diff --git a/plugins/webinterface/webinterfaceprefwidget.h b/plugins/webinterface/webinterfaceprefwidget.h index b328efe..52bde80 100644 --- a/plugins/webinterface/webinterfaceprefwidget.h +++ b/plugins/webinterface/webinterfaceprefwidget.h @@ -28,10 +28,11 @@ namespace kt class WebInterfacePrefWidget:public WebInterfacePreference { Q_OBJECT + TQ_OBJECT public: - WebInterfacePrefWidget(QWidget *parent = 0, const char *name = 0); + WebInterfacePrefWidget(TQWidget *tqparent = 0, const char *name = 0); bool apply(); - QCString password; + TQCString password; public slots: void btnUpdate_clicked(); void changeLedState(); diff --git a/plugins/webinterface/www/coldmilk/page_update.js b/plugins/webinterface/www/coldmilk/page_update.js index c004456..dcbe62b 100644 --- a/plugins/webinterface/www/coldmilk/page_update.js +++ b/plugins/webinterface/www/coldmilk/page_update.js @@ -141,7 +141,7 @@ function update_status_bar(xmldoc) { document.createTextNode("down: " + down + " / up: " + up)); } var oldtable = document.getElementById('status_bar_table'); - oldtable.parentNode.replaceChild(newtable, oldtable); + oldtable.tqparentNode.replaceChild(newtable, oldtable); } function update_torrent_table(xmldoc) { @@ -159,7 +159,7 @@ function update_torrent_table(xmldoc) { _torrent_table_header(newtable.insertRow(0)); var oldtable = document.getElementById('torrent_list_table'); - oldtable.parentNode.replaceChild(newtable, oldtable); + oldtable.tqparentNode.replaceChild(newtable, oldtable); } function _torrent_table_row(torrent, table, i) { @@ -327,7 +327,7 @@ function get_torrents_details(xmldoc) { _torrent_table_header(newtable.insertRow(0));*/ var oldtable = document.getElementById('torrents_details_files'); - oldtable.parentNode.replaceChild(newtable, oldtable); + oldtable.tqparentNode.replaceChild(newtable, oldtable); } function _create_action_button(button_name, image_src, command) { @@ -403,7 +403,7 @@ function _get_file_status_name(status_id) } function _torrents_details_header(row) { - headers = new Array("Actions", "File", "Size", "Perc done", "Status"); + headers = new Array("Actions", "File", "Size", "Perc done", "tqStatus"); for (var i in headers) { var header = document.createElement("th"); header.appendChild(document.createTextNode(headers[i])); @@ -414,7 +414,7 @@ function _torrents_details_header(row) { function _torrent_table_header(row) { headers = new Array( - "Actions", "File", "Status", + "Actions", "File", "tqStatus", "Speed", "Size", "Peers", "Transferred", "% done" ); diff --git a/plugins/webinterface/www/coldmilk/rest.php b/plugins/webinterface/www/coldmilk/rest.php index bab7e68..a61cbfe 100644 --- a/plugins/webinterface/www/coldmilk/rest.php +++ b/plugins/webinterface/www/coldmilk/rest.php @@ -174,7 +174,7 @@ class RestInterface { // Truncate long torrent name, and HTML escape it. // This is a helper function for download_status. private function _clean_name($name) { - $name = str_replace("'", "\'", $name); + $name = str_tqreplace("'", "\'", $name); if (strlen($name) > 30) { $name = substr($name, 0, 27); $name .= "..."; @@ -203,7 +203,7 @@ class RestInterface { class KTorrentXML extends DomDocument { private $root_element; public function __construct($root, $value = null, $attributes = null) { - parent::__construct('1.0'); + tqparent::__construct('1.0'); $this->root_element = $this->createElement($root); $this->appendChild($this->root_element); $this->formatOutput = true; diff --git a/plugins/webinterface/www/default/details.php b/plugins/webinterface/www/default/details.php index a19d57e..92c8d48 100644 --- a/plugins/webinterface/www/default/details.php +++ b/plugins/webinterface/www/default/details.php @@ -1,5 +1,5 @@ Actions File - Status + tqStatus Size Complete diff --git a/plugins/webinterface/www/default/interface.php b/plugins/webinterface/www/default/interface.php index 6432798..929bd94 100644 --- a/plugins/webinterface/www/default/interface.php +++ b/plugins/webinterface/www/default/interface.php @@ -1,6 +1,6 @@ 'Checking Data' ); if (array_key_exists($status_id, $table)) return $table[$status_id]; - else return 'Not supported Status'; + else return 'Not supported tqStatus'; } function generate_button_code($img, $alt, $href='') @@ -104,7 +104,7 @@ function generate_button_code($img, $alt, $href='') Actions File - Status + tqStatus Downloaded Size Uploaded @@ -118,7 +118,7 @@ function generate_button_code($img, $alt, $href='') foreach ($stats as $torrent) { echo "\t\t".''."\n\t\t\t"; - $torrent_name = str_replace("'", "\'", $torrent['torrent_name']); + $torrent_name = str_tqreplace("'", "\'", $torrent['torrent_name']); if($torrent['total_bytes_to_download']!=0) $perc = round(100.0 - ($torrent['bytes_left_to_download'] / $torrent['total_bytes_to_download']) * 100.0, 2); else $perc = 0; if(strlen($torrent['torrent_name'])>30) $display_name=substr($torrent['torrent_name'], 0, 30)." ..."; diff --git a/plugins/webinterface/www/default/wz_tooltip.js b/plugins/webinterface/www/default/wz_tooltip.js index 1329a1b..546b421 100644 --- a/plugins/webinterface/www/default/wz_tooltip.js +++ b/plugins/webinterface/www/default/wz_tooltip.js @@ -300,7 +300,7 @@ function tt_DeAlt(t_tag) { if(t_tag.alt) t_tag.alt = ""; if(t_tag.title) t_tag.title = ""; - var t_c = t_tag.children || t_tag.childNodes || null; + var t_c = t_tag.tqchildren || t_tag.childNodes || null; if(t_c) { for(var t_i = t_c.length; t_i; ) @@ -327,7 +327,7 @@ function tt_OpDeHref(t_e) window.status = tt_tag.t_href; break; } - t_tag = t_tag.parentElement; + t_tag = t_tag.tqparentElement; } } } diff --git a/plugins/webinterface/www/mobile/interface.php b/plugins/webinterface/www/mobile/interface.php index 57582de..d2fdea9 100644 --- a/plugins/webinterface/www/mobile/interface.php +++ b/plugins/webinterface/www/mobile/interface.php @@ -18,7 +18,7 @@ "; @@ -59,7 +59,7 @@ echo ""; break; default: - echo ""; + echo ""; } echo ""; $a=$a+1; diff --git a/plugins/webinterface/www/mobile/torrent.php b/plugins/webinterface/www/mobile/torrent.php index a1e451d..31d980e 100644 --- a/plugins/webinterface/www/mobile/torrent.php +++ b/plugins/webinterface/www/mobile/torrent.php @@ -8,7 +8,7 @@ ktorrent->transfers->{$t['torrent_name']}"; echo ""; @@ -31,7 +31,7 @@ "; - echo ""; + echo ""; switch ($t['status']) { case 0: echo ""; @@ -67,7 +67,7 @@ echo ""; break; default: - echo ""; + echo ""; } echo ""; echo ""; -- cgit v1.2.1
Checking DataNot supported StatusNot supported tqStatus$perc%
refresh
Status: tqStatus: NOT_STARTEDCHECKING_DATANot supported StatusNot supported tqStatus