diff options
-rw-r--r-- | kio_gopher.cpp | 62 | ||||
-rw-r--r-- | kio_gopher.h | 14 |
2 files changed, 38 insertions, 38 deletions
diff --git a/kio_gopher.cpp b/kio_gopher.cpp index baf5457..8e5a28e 100644 --- a/kio_gopher.cpp +++ b/kio_gopher.cpp @@ -16,8 +16,8 @@ #include <klocale.h> #include <kmimetype.h> -#include <qbuffer.h> -#include <qfile.h> +#include <ntqbuffer.h> +#include <ntqfile.h> using namespace KIO; @@ -41,7 +41,7 @@ extern "C" /* gopher */ -gopher::gopher(const QByteArray &pool_socket, const QByteArray &app_socket) : TCPSlaveBase("gopher", pool_socket, app_socket) +gopher::gopher(const TQByteArray &pool_socket, const TQByteArray &app_socket) : TCPSlaveBase("gopher", pool_socket, app_socket) { } @@ -56,9 +56,9 @@ void gopher::get(const KUrl& url ) // <gophertype><selector>%09<search> // <gophertype><selector>%09<search>%09<gopher+_string> int port; - QChar type; - QString path(url.path()); - QString query(url.query()); + TQChar type; + TQString path(url.path()); + TQString query(url.query()); // determine the type if (path != "/" && path != "") type = path[1]; @@ -82,8 +82,8 @@ void gopher::get(const KUrl& url ) { int i, bytes; char aux[10240]; - QBuffer received; - received.open(QIODevice::WriteOnly); + TQBuffer received; + received.open(TQIODevice::WriteOnly); infoMessage(i18n("Connecting to %1...", url.host())); infoMessage(i18n("%1 contacted. Retrieving data...", url.host())); @@ -104,7 +104,7 @@ void gopher::get(const KUrl& url ) infoMessage(i18n("Retrieved %1 bytes from %2...", bytes, url.host())); } - if (type == '1' || type =='7') processDirectory(new QByteArray(received.buffer().data(), bytes + 1), url.host(), url.path()); + if (type == '1' || type =='7') processDirectory(new TQByteArray(received.buffer().data(), bytes + 1), url.host(), url.path()); else { KMimeType::Ptr result = KMimeType::findByContent(received.buffer()); @@ -116,12 +116,12 @@ void gopher::get(const KUrl& url ) finished(); } -void gopher::processDirectory(QByteArray *received, const QString &host, const QString &path) +void gopher::processDirectory(TQByteArray *received, const TQString &host, const TQString &path) { int i, remove; - QString pathToShow; - QByteArray show; - QByteArray info; + TQString pathToShow; + TQByteArray show; + TQByteArray info; if (path == "/" || path == "/1") pathToShow = ""; else pathToShow = path; mimeType("text/html"); @@ -155,13 +155,13 @@ void gopher::processDirectory(QByteArray *received, const QString &host, const Q delete received; } -void gopher::processDirectoryLine(const QByteArray &d, QByteArray &show, QByteArray &info) +void gopher::processDirectoryLine(const TQByteArray &d, TQByteArray &show, TQByteArray &info) { // gopher <type><display><tab><selector><tab><server><tab><port><\r><\n> // gopher+ <type><display><tab><selector><tab><server><tab><port><tab><things><\r><\n> int i; - QByteArray type, name, url, server, port; - QByteArray data = d; + TQByteArray type, name, url, server, port; + TQByteArray data = d; type = data.left(1); data.remove(0, 1); @@ -215,8 +215,8 @@ void gopher::processDirectoryLine(const QByteArray &d, QByteArray &show, QByteAr show.append("\t\t\t<div>"); // support the non-standard extension for URL to external sites // in this case, url begins with 'URL:' - QByteArray finalUrl; - QByteArray iconUrl; + TQByteArray finalUrl; + TQByteArray iconUrl; if (url.startsWith("URL:")) { finalUrl = url.mid(4); @@ -243,12 +243,12 @@ void gopher::processDirectoryLine(const QByteArray &d, QByteArray &show, QByteAr } } -QByteArray gopher::parsePort(QByteArray *received) +TQByteArray gopher::parsePort(TQByteArray *received) { int i = 0; - QByteArray port; + TQByteArray port; bool found = false; - QChar c; + TQChar c; while (!found && i < received -> size()) { c = received -> at(i); @@ -260,7 +260,7 @@ QByteArray gopher::parsePort(QByteArray *received) return port; } -void gopher::findLine(QByteArray *received, int *i, int *remove) +void gopher::findLine(TQByteArray *received, int *i, int *remove) { // it's not in the rfc but most servers don't follow the spec // find lines ending only in \n and in \r\n @@ -288,11 +288,11 @@ void gopher::findLine(QByteArray *received, int *i, int *remove) } } -void gopher::handleSearch(const QString &host, const QString &path, int port) +void gopher::handleSearch(const TQString &host, const TQString &path, int port) { - QByteArray show; - QString sPort; - if (port != 70) sPort = ':' + QString::number(port); + TQByteArray show; + TQString sPort; + if (port != 70) sPort = ':' + TQString::number(port); mimeType("text/html"); show.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"); show.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"); @@ -330,9 +330,9 @@ void gopher::handleSearch(const QString &host, const QString &path, int port) data(show); } -void gopher::addIcon(const QString &type, const QByteArray &url, QByteArray &show) +void gopher::addIcon(const TQString &type, const TQByteArray &url, TQByteArray &show) { - QString icon; + TQString icon; if (type == "1") icon = "inode-directory.png"; else if (type == "3") icon = "dialog-error.png"; else if (type == "7") icon = "system-search.png"; @@ -343,9 +343,9 @@ void gopher::addIcon(const QString &type, const QByteArray &url, QByteArray &sho KMimeType::Ptr mime = KMimeType::findByUrl(KUrl(url), 0, false, true); icon = mime->iconName(); } - QFile file(m_iconLoader.iconPath(icon, -16)); - file.open(QIODevice::ReadOnly); - QByteArray ba = file.readAll(); + TQFile file(m_iconLoader.iconPath(icon, -16)); + file.open(TQIODevice::ReadOnly); + TQByteArray ba = file.readAll(); show.append("<img width=\"16\" height=\"16\" src=\"data:image/png;base64,"); show.append(KCodecs::base64Encode(ba)); show.append("\" /> "); diff --git a/kio_gopher.h b/kio_gopher.h index 755d6e9..b21e225 100644 --- a/kio_gopher.h +++ b/kio_gopher.h @@ -17,17 +17,17 @@ class gopher : public KIO::TCPSlaveBase { public: - gopher(const QByteArray &pool_socket, const QByteArray &app_socket); + gopher(const TQByteArray &pool_socket, const TQByteArray &app_socket); void get(const KUrl& url); private: - void processDirectory(QByteArray *received, const QString &host, const QString &path); - void processDirectoryLine(const QByteArray &data, QByteArray &show, QByteArray &info); - QByteArray parsePort(QByteArray *received); - void findLine(QByteArray *received, int *i, int *remove); - void handleSearch(const QString &host, const QString &path, int port); - void addIcon(const QString &type, const QByteArray &url, QByteArray &show); + void processDirectory(TQByteArray *received, const TQString &host, const TQString &path); + void processDirectoryLine(const TQByteArray &data, TQByteArray &show, TQByteArray &info); + TQByteArray parsePort(TQByteArray *received); + void findLine(TQByteArray *received, int *i, int *remove); + void handleSearch(const TQString &host, const TQString &path, int port); + void addIcon(const TQString &type, const TQByteArray &url, TQByteArray &show); KIconLoader m_iconLoader; }; |