diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 21:38:25 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 21:38:25 +0000 |
commit | f22f5c856d0ee7ec953825828bba094f14c9cade (patch) | |
tree | 1c89a4d4c420bce13c002b650e610bff026f6d06 /src/parsers/show.cpp | |
parent | 0bceb5251f3c826f8fc4ee021ab76ee29f1dfdd7 (diff) | |
download | tdeio-apt-f22f5c856d0ee7ec953825828bba094f14c9cade.tar.gz tdeio-apt-f22f5c856d0ee7ec953825828bba094f14c9cade.zip |
TQt4 port kio-apt
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kio-apt@1239302 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/parsers/show.cpp')
-rw-r--r-- | src/parsers/show.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/parsers/show.cpp b/src/parsers/show.cpp index 0a1c503..2d7b0c4 100644 --- a/src/parsers/show.cpp +++ b/src/parsers/show.cpp @@ -12,60 +12,60 @@ #include "../apt.h" #include <klocale.h> -#include <qregexp.h> +#include <tqregexp.h> -static const QString +static const TQString html_attribute_begin("<tr><td class=\"attname\">%1</td>\n\t<td>\n\t\t"), html_attribute_classed("<tr class=\"%1\"><td class=\"attname\">%2</td>\n\t<td>\n\t\t"), html_attribute_end("\n\t</td>\n</tr>\n"); // Converts the special chars in orig into its HTML equivalents -static QString text2html(const QString& orig) -{ QString ret(orig); - ret = ret.replace("<(?!a href)", "<"); - //ret = ret.replace( QRegExp("\n"), "<br />\n"); +static TQString text2html(const TQString& orig) +{ TQString ret(orig); + ret = ret.tqreplace("<(?!a href)", "<"); + //ret = ret.tqreplace( TQRegExp("\n"), "<br />\n"); return ret; } -static void close_indent(int indent, QString& buffer) +static void close_indent(int indent, TQString& buffer) { if (buffer.isEmpty()) return; if (indent) buffer += "\n\t\t</div>"; } -static void close_item(int indent, QString& buffer) +static void close_item(int indent, TQString& buffer) { if (buffer.isEmpty()) return; close_indent(indent, buffer); buffer += html_attribute_end; } -static void close_table(const QString& version, int indent, QString& buffer) +static void close_table(const TQString& version, int indent, TQString& buffer) { if (buffer.isEmpty()) return; close_item(indent, buffer); buffer = version + "<table class=\"version\">\n" + buffer + "</table>\n"; } -static QString version_header_link(const KURL& url, const QString& name) -{ return QString("\t<a class=\"links\" href=\"" + url.htmlURL() + "\">" + name + "</a>\n"); } +static TQString version_header_link(const KURL& url, const TQString& name) +{ return TQString("\t<a class=\"links\" href=\"" + url.htmlURL() + "\">" + name + "</a>\n"); } namespace Parsers { -Show::Show(const QString& package, const QString& installed_version, bool act) +Show::Show(const TQString& package, const TQString& installed_version, bool act) : m_package(package), m_installed(installed_version), m_act(false) { m_act = act; } -void Show::operator() (AptProtocol* slave, const QString& tag, const QString& value) +void Show::operator() (AptProtocol* slave, const TQString& tag, const TQString& value) { // Since we want to show the version first, we should wait for it // before sending anything - static QString version; - static QString buffer; - static QString attribute; + static TQString version; + static TQString buffer; + static TQString attribute; static int indent; static bool multiline = false; static bool first_line = false, new_paragraph = true; @@ -101,16 +101,16 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va { close_item(indent, buffer); buffer += - html_attribute_begin.arg(value) + html_attribute_begin.tqarg(value) + " "; close_item(indent, buffer); - buffer += html_attribute_begin.arg(" "); + buffer += html_attribute_begin.tqarg(" "); } else if (value != "Version" && value != "Package") { close_item(indent, buffer); - buffer += html_attribute_begin.arg(value); + buffer += html_attribute_begin.tqarg(value); } if (value == "Description") @@ -137,18 +137,18 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va { KURL action ("apt:/get"); - QString item_id = mangle_version(value); + TQString item_id = mangle_version(value); if (value == m_installed) { action.setQuery("remove"); - version = QString("<div class=\"version-header-installed\" id=\"%1\">").arg(item_id) - + i18n("Installed version %1").arg(value); + version = TQString("<div class=\"version-header-installed\" id=\"%1\">").tqarg(item_id) + + i18n("Installed version %1").tqarg(value); } else { action.setQuery("install"); - version = QString("<div class=\"version-header\" id=\"%1\">").arg(item_id) - + i18n("Version %1").arg(value); + version = TQString("<div class=\"version-header\" id=\"%1\">").tqarg(item_id) + + i18n("Version %1").tqarg(value); } action.addQueryItem("package", m_package); @@ -168,7 +168,7 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va { if (multiline) { - static const QRegExp rx_empty("^\\s*$"); + static const TQRegExp rx_empty("^\\s*$"); if (rx_empty.exactMatch(value)) { buffer += "</p>"; @@ -185,7 +185,7 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va new_paragraph = false; } } - buffer += text2html(QString(value).replace(QRegExp("(http://\\S+)"),QString("<a href=\"\\1\">\\1</a>"))); + buffer += text2html(TQString(value).tqreplace(TQRegExp("(http://\\S+)"),TQString("<a href=\"\\1\">\\1</a>"))); } else if (tag == "package_link") buffer += "<a href=\"" + slave->buildURL("show", value).htmlURL() + "\">" + value + "</a>"; |