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
v3.5.13-sru
tpearson 14 years ago
parent 0bceb5251f
commit f22f5c856d

@ -7,7 +7,7 @@ METASOURCES = AUTO
kio_apt_la_SOURCES = aptcache.cpp apt.cpp regexps.cpp packagemanager.cpp dpkg.cpp kio_apt_la_SOURCES = aptcache.cpp apt.cpp regexps.cpp packagemanager.cpp dpkg.cpp
kio_apt_la_LIBADD = $(top_builddir)/src/parsers/libparsers.la -lkio kio_apt_la_LIBADD = $(top_builddir)/src/parsers/libparsers.la -lkio
kio_apt_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_PLUGIN) kio_apt_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_PLUGIN) $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KURL)
protocoldir = $(kde_servicesdir) protocoldir = $(kde_servicesdir)
protocol_DATA = apt.protocol apt+http.protocol protocol_DATA = apt.protocol apt+http.protocol

@ -16,7 +16,7 @@
#include "parsers/parsers.h" #include "parsers/parsers.h"
#include <qcstring.h> #include <tqcstring.h>
#include <kapplication.h> #include <kapplication.h>
#include <kinstance.h> #include <kinstance.h>
@ -30,7 +30,7 @@
#include <kdebug.h> #include <kdebug.h>
#include <qregexp.h> #include <tqregexp.h>
#include <stdlib.h> #include <stdlib.h>
@ -42,33 +42,33 @@ using namespace KIO;
* Common definitions of HTML fragments * Common definitions of HTML fragments
*/ */
static const QString static const TQString
html_preamble("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\"\n" html_preamble("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\"\n"
"\t\"http://www.w3.org/TR/html4/strict.dtd\">\n" "\t\"http://www.w3.org/TR/html4/strict.dtd\">\n"
"<html>\n"); "<html>\n");
static const QString static const TQString
html_redirect(html_preamble + html_redirect(html_preamble +
QString("<head>\n" TQString("<head>\n"
"\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"
"\t<meta http-equiv=\"Refresh\" content=\"0 ; URL=%1\">\n" "\t<meta http-equiv=\"Refresh\" content=\"0 ; URL=%1\">\n"
"</head>\n" "</head>\n"
"\n<body></body>\n" "\n<body></body>\n"
"</html>")); "</html>"));
static const QString static const TQString
html_head(html_preamble + html_head(html_preamble +
QString("<head>\n" TQString("<head>\n"
"\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n" "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
"\t<link rel=\"stylesheet\" href=\"file:%1\">\n" "\t<link rel=\"stylesheet\" href=\"file:%1\">\n"
"\t<title>%2</title>\n" "\t<title>%2</title>\n"
"</head>\n\n" "</head>\n\n"
"<body>\n")); "<body>\n"));
static QString close_html_head(); static TQString close_html_head();
static QString open_html_head(const QString& title, bool links, AptProtocol const& config) static TQString open_html_head(const TQString& title, bool links, AptProtocol const& config)
{ {
static const QString static const TQString
html_head_table( html_head_table(
"<table class=\"header\" style=\"background-image: url(file:%1);\"\n" "<table class=\"header\" style=\"background-image: url(file:%1);\"\n"
"\t\tcellspacing=\"0\" cellpadding=\"0\">\n" "\t\tcellspacing=\"0\" cellpadding=\"0\">\n"
@ -76,18 +76,18 @@ static QString open_html_head(const QString& title, bool links, AptProtocol cons
"\t<td class=\"logo\" %2><img src=\"file:%3\" alt=\"%4\" style=\"border: 0px\" /></td>\n" "\t<td class=\"logo\" %2><img src=\"file:%3\" alt=\"%4\" style=\"border: 0px\" /></td>\n"
"\t<td class=\"header-title\">%4</td>\n"); "\t<td class=\"header-title\">%4</td>\n");
QString rowspan; TQString rowspan;
if (links) rowspan = "rowspan=\"2\""; if (links) rowspan = "rowspan=\"2\"";
QString ret = TQString ret =
html_head html_head
.arg(config.stylesheet()) .tqarg(config.stylesheet())
.arg(title) .tqarg(title)
+ html_head_table + html_head_table
.arg(config.header_background()) .tqarg(config.header_background())
.arg(rowspan) .tqarg(rowspan)
.arg(config.logo()) .tqarg(config.logo())
.arg(config.logo_alt()) .tqarg(config.logo_alt())
.arg(title); .tqarg(title);
if (links) if (links)
{ {
@ -103,12 +103,12 @@ static QString open_html_head(const QString& title, bool links, AptProtocol cons
return ret + "</tr>\n</table>\n\n"; return ret + "</tr>\n</table>\n\n";
} }
} }
static QString add_html_head_link(const QString& url, const QString& name, const QString& long_desc) static TQString add_html_head_link(const TQString& url, const TQString& name, const TQString& long_desc)
{ {
static const QString format("\t\t<td><a href=\"%1\" title=\"%2\">%3</a></td>\n"); static const TQString format("\t\t<td><a href=\"%1\" title=\"%2\">%3</a></td>\n");
return format.arg(url).arg(long_desc).arg(name); return format.tqarg(url).tqarg(long_desc).tqarg(name);
} }
static QString close_html_head() static TQString close_html_head()
{ {
return "\t</tr>\n" return "\t</tr>\n"
"\t</table>\n" "\t</table>\n"
@ -117,23 +117,23 @@ static QString close_html_head()
"</table>"; "</table>";
} }
static const QString static const TQString
html_tail("<div class=\"footer\">%1</div>\n" html_tail("<div class=\"footer\">%1</div>\n"
"</body>\n" "</body>\n"
"</html>"); "</html>");
QString AptProtocol::make_html_tail(const QString& note, bool with_form) TQString AptProtocol::make_html_tail(const TQString& note, bool with_form)
{ {
with_form = m_search && with_form; with_form = m_search && with_form;
QString ret; TQString ret;
if (with_form) if (with_form)
ret = "<hr>\n" + make_html_form(); ret = "<hr>\n" + make_html_form();
if (!note.isEmpty()) if (!note.isEmpty())
ret += html_tail.arg(note + ". " + i18n("Page generated by kio_apt.")); ret += html_tail.tqarg(note + ". " + i18n("Page generated by kio_apt."));
else ret += html_tail.arg(i18n("Page generated by kio_apt.")); else ret += html_tail.tqarg(i18n("Page generated by kio_apt."));
return ret; return ret;
} }
@ -142,30 +142,30 @@ QString AptProtocol::make_html_tail(const QString& note, bool with_form)
* Search form * Search form
*/ */
static const QString static const TQString
html_form_begin("\n<form action=\"apt:/\" method=\"GET\">\n" html_form_begin("\n<form action=\"apt:/\" method=\"GET\">\n"
"<table class=\"query\">\n"); "<table class=\"query\">\n");
static const QString static const TQString
html_form_end("<tr>\n" html_form_end("<tr>\n"
"\t<td class=\"button\" colspan=\"2\"><input type=\"submit\" value=\"%1\"></td>\n" "\t<td class=\"button\" colspan=\"2\"><input type=\"submit\" value=\"%1\"></td>\n"
"</tr>\n" "</tr>\n"
"</table>\n" "</table>\n"
"</form>\n"); "</form>\n");
static const QString static const TQString
html_form_line("<tr>\n" html_form_line("<tr>\n"
"\t<td><label for=\"%1\">%2</label></td>\n" "\t<td><label for=\"%1\">%2</label></td>\n"
"\t<td><input type=\"text\" name=\"%3\" id=\"%4\"></td>\n" "\t<td><input type=\"text\" name=\"%3\" id=\"%4\"></td>\n"
"</tr>\n"); "</tr>\n");
static QString make_html_form_line(const QString& type, const QString& label) static TQString make_html_form_line(const TQString& type, const TQString& label)
{ return html_form_line.arg(type).arg(label).arg(type).arg(type); } { return html_form_line.tqarg(type).tqarg(label).tqarg(type).tqarg(type); }
static QString make_extform_cmd(bool ext_form, const KURL& query) static TQString make_extform_cmd(bool ext_form, const KURL& query)
{ {
QString cmd = ext_form ? "0" : "1"; TQString cmd = ext_form ? "0" : "1";
QString msg = ext_form ? i18n("Hide extended form") : i18n("Show extended form"); TQString msg = ext_form ? i18n("Hide extended form") : i18n("Show extended form");
KURL url(query); KURL url(query);
url.addQueryItem("extended_form", cmd); url.addQueryItem("extended_form", cmd);
@ -178,7 +178,7 @@ static QString make_extform_cmd(bool ext_form, const KURL& query)
} }
/** Prints the HTML code for the query form */ /** Prints the HTML code for the query form */
QString AptProtocol::make_html_form() const TQString AptProtocol::make_html_form() const
{ {
bool can_fsearch = false; bool can_fsearch = false;
bool ext_form = KGlobal::config() -> readBoolEntry("extended_form", true); bool ext_form = KGlobal::config() -> readBoolEntry("extended_form", true);
@ -190,8 +190,8 @@ QString AptProtocol::make_html_form() const
if (m_adept_batch) if (m_adept_batch)
online = online_form && (!m_internal) && ext_form && m_adept_batch -> capabilities(PackageManager::ONLINE); online = online_form && (!m_internal) && ext_form && m_adept_batch -> capabilities(PackageManager::ONLINE);
QString ret; TQString ret;
QTextOStream stream(&ret); TQTextOStream stream(&ret);
stream << make_extform_cmd(ext_form, m_query); stream << make_extform_cmd(ext_form, m_query);
if (online) if (online)
@ -206,7 +206,7 @@ QString AptProtocol::make_html_form() const
stream << make_html_form_line("fsearch", i18n("File search")); stream << make_html_form_line("fsearch", i18n("File search"));
stream << make_html_form_line("show", i18n("Package info")); stream << make_html_form_line("show", i18n("Package info"));
} }
stream << html_form_end.arg( i18n("Search") ); stream << html_form_end.tqarg( i18n("Search") );
if (online) if (online)
{ {
@ -220,7 +220,7 @@ QString AptProtocol::make_html_form() const
/****************************************************************************************/ /****************************************************************************************/
AptProtocol::AptProtocol( const QCString &pool_socket, const QCString &app_socket ) AptProtocol::AptProtocol( const TQCString &pool_socket, const TQCString &app_socket )
: SlaveBase( "kio_apt", pool_socket, app_socket ), : SlaveBase( "kio_apt", pool_socket, app_socket ),
m_adept_batch(0), m_parser(0) m_adept_batch(0), m_parser(0)
@ -236,38 +236,38 @@ AptProtocol::AptProtocol( const QCString &pool_socket, const QCString &app_socke
m_logo_alt = KGlobal::config() -> readEntryUntranslated("alt_tag", i18n("KDE on Debian") ); m_logo_alt = KGlobal::config() -> readEntryUntranslated("alt_tag", i18n("KDE on Debian") );
connect(&m_process, SIGNAL(token(const QString&, const QString&)), connect(&m_process, TQT_SIGNAL(token(const TQString&, const TQString&)),
this, SLOT(token_dispatch(const QString&, const QString&))); this, TQT_SLOT(token_dispatch(const TQString&, const TQString&)));
m_adept_batch = new Dpkg(this); m_adept_batch = new Dpkg(this);
if (m_adept_batch) if (m_adept_batch)
{ {
connect(m_adept_batch, SIGNAL(token(const QString&, const QString&)), connect(m_adept_batch, TQT_SIGNAL(token(const TQString&, const TQString&)),
this, SLOT(token_dispatch(const QString&, const QString&))); this, TQT_SLOT(token_dispatch(const TQString&, const TQString&)));
} }
} }
AptProtocol::~AptProtocol() {} AptProtocol::~AptProtocol() {}
QString AptProtocol::stylesheet() const { return m_stylesheet; } TQString AptProtocol::stylesheet() const { return m_stylesheet; }
QString AptProtocol::logo() const { return m_logo; } TQString AptProtocol::logo() const { return m_logo; }
QString AptProtocol::logo_alt() const { return m_logo_alt; } TQString AptProtocol::logo_alt() const { return m_logo_alt; }
QString AptProtocol::header_background() const { return m_header_background; } TQString AptProtocol::header_background() const { return m_header_background; }
void AptProtocol::token_dispatch(const QString& name, const QString& val) void AptProtocol::token_dispatch(const TQString& name, const TQString& val)
{ {
if (m_parser.get()) if (m_parser.get())
(*m_parser)(this, name, val); (*m_parser)(this, name, val);
} }
void AptProtocol::data(const QCString& string) void AptProtocol::data(const TQCString& string)
{ {
using namespace Parsers; using namespace Parsers;
(*this) << string; (*this) << string;
} }
void AptProtocol::data(const QString& string) void AptProtocol::data(const TQString& string)
{ {
using namespace Parsers; using namespace Parsers;
(*this) << string; (*this) << string;
@ -279,7 +279,7 @@ void AptProtocol::data(const char* string)
(*this) << string; (*this) << string;
} }
void AptProtocol::data(const QByteArray& array) void AptProtocol::data(const TQByteArray& array)
{ SlaveBase::data(array); } { SlaveBase::data(array); }
void AptProtocol::mimetype( const KURL & /*url*/ ) void AptProtocol::mimetype( const KURL & /*url*/ )
@ -288,12 +288,12 @@ void AptProtocol::mimetype( const KURL & /*url*/ )
finished(); finished();
} }
bool AptProtocol::check_validpackage(const QString& query) bool AptProtocol::check_validpackage(const TQString& query)
{ {
static QRegExp rx_pkgname(rxs_pkgname); static TQRegExp rx_pkgname(rxs_pkgname);
if (!rx_pkgname.exactMatch(query)) if (!rx_pkgname.exactMatch(query))
{ {
error( ERR_SLAVE_DEFINED, i18n("\"%1\" is not a valid package name").arg(query) ); error( ERR_SLAVE_DEFINED, i18n("\"%1\" is not a valid package name").tqarg(query) );
return false; return false;
} }
return true; return true;
@ -304,10 +304,10 @@ bool AptProtocol::check_validpackage(const QString& query)
* Main entry point * Main entry point
*/ */
static QString read_option(QMap<QString, QString>& map, const QString& name, const QString& def) static TQString read_option(TQMap<TQString, TQString>& map, const TQString& name, const TQString& def)
{ {
if (!map.contains(name)) return def; if (!map.tqcontains(name)) return def;
QString ret = map[name]; TQString ret = map[name];
map.remove(name); map.remove(name);
return ret; return ret;
} }
@ -324,23 +324,23 @@ void AptProtocol::get ( const KURL& url )
apt:/ apt:/
*/ */
typedef void (AptProtocol::*Command)(const QString&, const QueryOptions&); typedef void (AptProtocol::*Command)(const TQString&, const QueryOptions&);
static const QString commands[] = static const TQString commands[] =
{ "search", "show", "policy", { "search", "show", "policy",
"fsearch", "list", "online", "fsearch", "list", "online",
"get", QString::null }; "get", TQString() };
static const Command methods[] = static const Command methods[] =
{ &AptProtocol::search, &AptProtocol::show, &AptProtocol::policy, { &AptProtocol::search, &AptProtocol::show, &AptProtocol::policy,
&AptProtocol::searchfile, &AptProtocol::listfiles, &AptProtocol::online, &AptProtocol::searchfile, &AptProtocol::listfiles, &AptProtocol::online,
&AptProtocol::adept_batch }; &AptProtocol::adept_batch };
QString command, query; TQString command, query;
Command method = 0; Command method = 0;
QueryOptions options = url.queryItems(KURL::CaseInsensitiveKeys); QueryOptions options = url.queryItems(KURL::CaseInsensitiveKeys);
// canonize the part before ? : remove the first / // canonize the part before ? : remove the first /
QString path = url.path(); TQString path = url.path();
QString host = url.host(); TQString host = url.host();
if ( path.isEmpty() && !host.isEmpty() ) if ( path.isEmpty() && !host.isEmpty() )
{ {
@ -352,7 +352,7 @@ void AptProtocol::get ( const KURL& url )
for (int cmd_idx = 0; !commands[cmd_idx].isNull(); ++cmd_idx) for (int cmd_idx = 0; !commands[cmd_idx].isNull(); ++cmd_idx)
{ {
const QString cmd_it = commands[cmd_idx]; const TQString cmd_it = commands[cmd_idx];
// Look if the command is in the path part // Look if the command is in the path part
if (command.isEmpty() && cmd_it == path) if (command.isEmpty() && cmd_it == path)
@ -360,7 +360,7 @@ void AptProtocol::get ( const KURL& url )
command = cmd_it; command = cmd_it;
method = methods[cmd_idx]; method = methods[cmd_idx];
} }
if (options.contains(cmd_it)) if (options.tqcontains(cmd_it))
{ {
if (options[cmd_it].isEmpty() && !options[cmd_it].isNull()) if (options[cmd_it].isEmpty() && !options[cmd_it].isNull())
@ -393,7 +393,7 @@ void AptProtocol::get ( const KURL& url )
// Interpret the ioslave config options // Interpret the ioslave config options
// and remove them from the options map // and remove them from the options map
QString opt = read_option(options, "extended_form", QString::null); TQString opt = read_option(options, "extended_form", TQString());
if (!opt.isNull()) if (!opt.isNull())
{ {
bool ext_form = (opt != "0"); bool ext_form = (opt != "0");
@ -442,7 +442,7 @@ void AptProtocol::get ( const KURL& url )
if (m_query != url) if (m_query != url)
{ {
redirection(m_query); redirection(m_query);
data(QByteArray()); data(TQByteArray());
finished(); finished();
return; return;
} }
@ -462,14 +462,14 @@ void AptProtocol::help()
{ {
mimeType("text/html"); mimeType("text/html");
QString buffer; TQString buffer;
QTextOStream stream(&buffer); TQTextOStream stream(&buffer);
stream stream
<< open_html_head(i18n("Search Form"), false, *this) << open_html_head(i18n("Search Form"), false, *this)
<< make_html_form() << make_html_form()
<< make_html_tail(QString::null, false); << make_html_tail(TQString(), false);
data(buffer); data(buffer);
data(QByteArray()); data(TQByteArray());
finished(); finished();
} }
@ -483,23 +483,23 @@ void AptProtocol::help()
* apt-cache search * apt-cache search
*/ */
void AptProtocol::search( const QString& query, const QueryOptions& /*options*/ ) void AptProtocol::search( const TQString& query, const QueryOptions& /*options*/ )
{ {
mimeType("text/html"); mimeType("text/html");
data(open_html_head(i18n("Package search result for \"%1\"").arg(query), false, *this)); data(open_html_head(i18n("Package search result for \"%1\"").tqarg(query), false, *this));
m_parser.reset(new Parsers::Search); m_parser.reset(new Parsers::Search);
(*m_parser)(this, "begin", query); (*m_parser)(this, "begin", query);
if (!m_process.search( query )) if (!m_process.search( query ))
{ {
error(ERR_SLAVE_DEFINED, i18n("Error launching the search").arg(query)); error(ERR_SLAVE_DEFINED, i18n("Error launching the search").tqarg(query));
return; return;
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
data(make_html_tail( i18n("%1 results").arg(m_parser -> result_count())) ); data(make_html_tail( i18n("%1 results").tqarg(m_parser -> result_count())) );
data(QByteArray()); data(TQByteArray());
finished(); finished();
} }
@ -512,10 +512,10 @@ void AptProtocol::search( const QString& query, const QueryOptions& /*options*/
* apt-cache show * apt-cache show
*/ */
static QString filelist_cmd(bool show_filelist, const KURL& query) static TQString filelist_cmd(bool show_filelist, const KURL& query)
{ {
QString value = show_filelist ? "0" : "1"; TQString value = show_filelist ? "0" : "1";
QString msg = show_filelist ? i18n("Hide file list") : i18n("Show file list"); TQString msg = show_filelist ? i18n("Hide file list") : i18n("Show file list");
KURL url(query); KURL url(query);
url.addQueryItem("show_filelist", value); url.addQueryItem("show_filelist", value);
@ -529,11 +529,11 @@ static QString filelist_cmd(bool show_filelist, const KURL& query)
"</div>"; "</div>";
} }
void AptProtocol::show(const QString& package, const QueryOptions& options) void AptProtocol::show(const TQString& package, const QueryOptions& options)
{ {
if (!check_validpackage(package)) return; if (!check_validpackage(package)) return;
if (options.contains("show_filelist")) if (options.tqcontains("show_filelist"))
{ {
KGlobal::config() -> writeEntry("show_filelist", options["show_filelist"] != "0"); KGlobal::config() -> writeEntry("show_filelist", options["show_filelist"] != "0");
KGlobal::config() -> sync(); KGlobal::config() -> sync();
@ -541,7 +541,7 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
mimeType("text/html"); mimeType("text/html");
QString installed_version; TQString installed_version;
/** First, we parse policy /** First, we parse policy
* We use here the fact that HTML is generated * We use here the fact that HTML is generated
@ -550,53 +550,53 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
* is installed or not */ * is installed or not */
Parsers::Policy* policy = new Parsers::Policy(package, m_act); Parsers::Policy* policy = new Parsers::Policy(package, m_act);
m_parser.reset(policy); m_parser.reset(policy);
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
{ {
if (!m_process.policy( package )) if (!m_process.policy( package ))
{ {
error(ERR_SLAVE_DEFINED, i18n("Can't launch \"apt-cache policy %1\"").arg(package)); error(ERR_SLAVE_DEFINED, i18n("Can't launch \"apt-cache policy %1\"").tqarg(package));
return; return;
} }
installed_version = policy->getInstalled(); installed_version = policy->getInstalled();
bool can_list = can_listfiles(!installed_version.isEmpty()); bool can_list = can_listfiles(!installed_version.isEmpty());
QString buffer; TQString buffer;
QTextOStream s(&buffer); TQTextOStream s(&buffer);
if (can_list) if (can_list)
{ {
KURL url = buildURL("list", package); KURL url = buildURL("list", package);
s << open_html_head(i18n("Package description for \"%1\"").arg(package), true, *this) s << open_html_head(i18n("Package description for \"%1\"").tqarg(package), true, *this)
<< add_html_head_link(url.htmlURL(), i18n("List package files"), "") << add_html_head_link(url.htmlURL(), i18n("List package files"), "")
<< close_html_head(); << close_html_head();
} }
else else
{ {
s << open_html_head(i18n("Package description for \"%1\"").arg(package), false, *this); s << open_html_head(i18n("Package description for \"%1\"").tqarg(package), false, *this);
} }
data(buffer); data(buffer);
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
/** Add package description section */ /** Add package description section */
m_parser.reset(new Parsers::Show(package, installed_version, m_act)); m_parser.reset(new Parsers::Show(package, installed_version, m_act));
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
{ {
if (!m_process.show(package)) if (!m_process.show(package))
{ {
error(ERR_SLAVE_DEFINED, i18n("Can't launch \"apt-cache show %1\"").arg(package)); error(ERR_SLAVE_DEFINED, i18n("Can't launch \"apt-cache show %1\"").tqarg(package));
return; return;
} }
if (!m_parser -> result_count()) if (!m_parser -> result_count())
{ {
data("<div class=\"error\">" + i18n("No package found named \"%1\"").arg(package) + "</div>\n"); data("<div class=\"error\">" + i18n("No package found named \"%1\"").tqarg(package) + "</div>\n");
data(make_html_tail()); data(make_html_tail());
data(QByteArray()); data(TQByteArray());
finished(); finished();
return; return;
} }
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
@ -612,13 +612,13 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
+ "<div class=\"filelist\">\n"); + "<div class=\"filelist\">\n");
m_parser.reset(new Parsers::List(!m_internal)); m_parser.reset(new Parsers::List(!m_internal));
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
if (!m_adept_batch -> list(package)) if (!m_adept_batch -> list(package))
{ {
error(ERR_SLAVE_DEFINED, i18n("Error listing files of %1").arg(package)); error(ERR_SLAVE_DEFINED, i18n("Error listing files of %1").tqarg(package));
return; return;
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
data("\n</div>\n"); data("\n</div>\n");
} }
@ -637,7 +637,7 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
data(make_html_tail()); data(make_html_tail());
data(QByteArray()); data(TQByteArray());
finished(); finished();
} }
@ -648,25 +648,25 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
* apt-cache policy * apt-cache policy
*/ */
void AptProtocol::policy( const QString& query, const QueryOptions& /*options*/ ) void AptProtocol::policy( const TQString& query, const QueryOptions& /*options*/ )
{ {
if (!check_validpackage(query)) return; if (!check_validpackage(query)) return;
mimeType("text/html"); mimeType("text/html");
data( open_html_head(i18n("Apt policy for \"%1\"").arg(query), false, *this) ); data( open_html_head(i18n("Apt policy for \"%1\"").tqarg(query), false, *this) );
m_parser.reset(new Parsers::Policy(query, m_act)); m_parser.reset(new Parsers::Policy(query, m_act));
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
if (!m_process.policy( query )) if (!m_process.policy( query ))
{ {
error(ERR_SLAVE_DEFINED, i18n("Can't launch the policy for %1").arg(query)); error(ERR_SLAVE_DEFINED, i18n("Can't launch the policy for %1").tqarg(query));
return; return;
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
data(make_html_tail()); data(make_html_tail());
data(QByteArray()); data(TQByteArray());
finished(); finished();
} }
@ -676,7 +676,7 @@ void AptProtocol::policy( const QString& query, const QueryOptions& /*options*/
* Search the package which contains a specific file * Search the package which contains a specific file
*/ */
static const QString static const TQString
html_dpkgs_begin("\n\n<table>\n"), html_dpkgs_begin("\n\n<table>\n"),
html_dpkgs_end("\n\n</table>\n"); html_dpkgs_end("\n\n</table>\n");
@ -688,24 +688,24 @@ bool AptProtocol::can_searchfile(bool is_installed) const
if (!caps) return false; if (!caps) return false;
return is_installed || !(caps & PackageManager::INSTALLED_ONLY); return is_installed || !(caps & PackageManager::INSTALLED_ONLY);
} }
void AptProtocol::searchfile(const QString& query, const QueryOptions& /*options*/) void AptProtocol::searchfile(const TQString& query, const QueryOptions& /*options*/)
{ {
if (!can_searchfile(true)) return; if (!can_searchfile(true)) return;
mimeType("text/html"); mimeType("text/html");
data( open_html_head(i18n("File search for \"%1\"").arg(query), false, *this) + html_dpkgs_begin ); data( open_html_head(i18n("File search for \"%1\"").tqarg(query), false, *this) + html_dpkgs_begin );
m_parser.reset(new Parsers::FileSearch); m_parser.reset(new Parsers::FileSearch);
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
if (!m_adept_batch -> search( query )) if (!m_adept_batch -> search( query ))
{ {
error(ERR_SLAVE_DEFINED, i18n("Can't launch the package manager").arg(query)); error(ERR_SLAVE_DEFINED, i18n("Can't launch the package manager").tqarg(query));
return; return;
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
data( html_dpkgs_end + make_html_tail(i18n("%1 files found").arg(m_parser -> result_count())) ); data( html_dpkgs_end + make_html_tail(i18n("%1 files found").tqarg(m_parser -> result_count())) );
data(QByteArray()); data(TQByteArray());
finished(); finished();
} }
@ -724,7 +724,7 @@ bool AptProtocol::can_listfiles(bool is_installed) const
return is_installed || !(caps & PackageManager::INSTALLED_ONLY); return is_installed || !(caps & PackageManager::INSTALLED_ONLY);
} }
void AptProtocol::listfiles(const QString& query, const QueryOptions& /*options*/) void AptProtocol::listfiles(const TQString& query, const QueryOptions& /*options*/)
{ {
if (!can_listfiles(true)) return; if (!can_listfiles(true)) return;
if (!check_validpackage(query)) return; if (!check_validpackage(query)) return;
@ -733,26 +733,26 @@ void AptProtocol::listfiles(const QString& query, const QueryOptions& /*options*
KURL ret_url = buildURL("show", query); KURL ret_url = buildURL("show", query);
QString buffer; TQString buffer;
QTextOStream stream(&buffer); TQTextOStream stream(&buffer);
stream stream
<< open_html_head(i18n("Files in \"%1\"").arg(query), true, *this) << open_html_head(i18n("Files in \"%1\"").tqarg(query), true, *this)
<< add_html_head_link(ret_url.htmlURL(), i18n("Show package info"), "") << add_html_head_link(ret_url.htmlURL(), i18n("Show package info"), "")
<< close_html_head() << close_html_head()
<< endl; << endl;
data(buffer); data(buffer);
m_parser.reset(new Parsers::List(!m_internal)); m_parser.reset(new Parsers::List(!m_internal));
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
if (!m_adept_batch -> list( query )) if (!m_adept_batch -> list( query ))
{ {
error(ERR_SLAVE_DEFINED, i18n("Can't launch the package manager").arg(query)); error(ERR_SLAVE_DEFINED, i18n("Can't launch the package manager").tqarg(query));
return; return;
} }
(*m_parser)(this, "end", QString::null); (*m_parser)(this, "end", TQString());
data(make_html_tail()); data(make_html_tail());
data(QByteArray()); data(TQByteArray());
finished(); finished();
} }
@ -770,9 +770,9 @@ void AptProtocol::listfiles(const QString& query, const QueryOptions& /*options*
// return false; // return false;
//} //}
void AptProtocol::online(const QString& query, const QueryOptions& options) void AptProtocol::online(const TQString& query, const QueryOptions& options)
{ {
QString url = m_adept_batch -> getOnlineURL(query, options); TQString url = m_adept_batch -> getOnlineURL(query, options);
redirection(url); redirection(url);
finished(); finished();
return; return;
@ -781,15 +781,15 @@ void AptProtocol::online(const QString& query, const QueryOptions& options)
/*********************************************************************************** /***********************************************************************************
* Send commands for adept_batch * Send commands for adept_batch
*/ */
void AptProtocol::adept_batch(const QString& query, const QueryOptions& options) void AptProtocol::adept_batch(const TQString& query, const QueryOptions& options)
{ {
p=NULL; p=NULL;
QString command; TQString command;
QString url; TQString url;
QStringList plist; TQStringList plist;
QStringList puninst; TQStringList puninst;
QStringList pinst; TQStringList pinst;
int pcount; int pcount;
int ip; int ip;
@ -805,29 +805,29 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
return; return;
} }
if (!options.contains("package")) if (!options.tqcontains("package"))
{ {
error(ERR_SLAVE_DEFINED, i18n("No package specified")); error(ERR_SLAVE_DEFINED, i18n("No package specified"));
return; return;
} }
plist = QStringList::split(", ", options["package"], false); plist = TQStringList::split(", ", options["package"], false);
pcount = plist.count(); pcount = plist.count();
command += plist.join(" "); command += plist.join(" ");
if (pcount == 1) if (pcount == 1)
{ {
if (query == "install") if (query == "install")
ip = SlaveBase::messageBox(QuestionYesNo, i18n("Do you want to install %1 ?").arg(plist[0]), i18n("Package Installation")); ip = SlaveBase::messageBox(QuestionYesNo, i18n("Do you want to install %1 ?").tqarg(plist[0]), i18n("Package Installation"));
else else
ip = SlaveBase::messageBox(QuestionYesNo, i18n("Do you want to remove %1 ?").arg(plist[0]), i18n("Package Removal")); ip = SlaveBase::messageBox(QuestionYesNo, i18n("Do you want to remove %1 ?").tqarg(plist[0]), i18n("Package Removal"));
} }
else else
{ {
if (query == "install") if (query == "install")
ip = SlaveBase::messageBox(QuestionYesNo,i18n("Do you want to install the following %1 packages ?\n%2").arg(pcount).arg(options["package"])); ip = SlaveBase::messageBox(QuestionYesNo,i18n("Do you want to install the following %1 packages ?\n%2").tqarg(pcount).tqarg(options["package"]));
else else
ip = SlaveBase::messageBox(QuestionYesNo,i18n("Do you want to remove the following %1 packages ?\n").arg(pcount).arg(options["package"])); ip = SlaveBase::messageBox(QuestionYesNo,i18n("Do you want to remove the following %1 packages ?\n").tqarg(pcount).tqarg(options["package"]));
} }
kdDebug(DEBUG_ZONE) << command << endl; kdDebug(DEBUG_ZONE) << command << endl;
@ -841,15 +841,15 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
for(int i = 0; i != pcount; ++i) for(int i = 0; i != pcount; ++i)
{ {
QString installed_version; TQString installed_version;
Parsers::Policy* policy = new Parsers::Policy(plist[i], m_act); Parsers::Policy* policy = new Parsers::Policy(plist[i], m_act);
m_parser.reset(policy); m_parser.reset(policy);
(*m_parser)(this, "begin", QString::null); (*m_parser)(this, "begin", TQString());
{ {
if (!m_process.policy( plist[i] )) if (!m_process.policy( plist[i] ))
{ {
error(ERR_SLAVE_DEFINED, i18n("Can't launch \"apt-cache policy %1\"").arg(plist[i])); error(ERR_SLAVE_DEFINED, i18n("Can't launch \"apt-cache policy %1\"").tqarg(plist[i]));
return; return;
} }
@ -865,7 +865,7 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
} }
} }
if (options.contains("weblinkinstall")) if (options.tqcontains("weblinkinstall"))
{ {
if (puninst.count() == 0) if (puninst.count() == 0)
{ {
@ -873,8 +873,8 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
} }
else else
{ {
QString toto = puninst.join(" "); TQString toto = puninst.join(" ");
messageBox(Information,i18n("There was a problem installing %1.").arg(toto)); messageBox(Information,i18n("There was a problem installing %1.").tqarg(toto));
} }
return; return;
} }
@ -884,7 +884,7 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
// Outside of a weblink, only one package can be installed at time // Outside of a weblink, only one package can be installed at time
url += plist[0]; url += plist[0];
redirection(url); redirection(url);
data(QByteArray()); data(TQByteArray());
finished(); finished();
return; return;
} }
@ -895,7 +895,7 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
} }
} }
KURL AptProtocol::buildURL( const QString & command, const QString & query ) const KURL AptProtocol::buildURL( const TQString & command, const TQString & query ) const
{ {
KURL url; KURL url;
url.setProtocol("apt"); url.setProtocol("apt");

@ -1,8 +1,8 @@
#ifndef KIOAPT_APTPROTOCOL_H #ifndef KIOAPT_APTPROTOCOL_H
#define KIOAPT_APTPROTOCOL_H #define KIOAPT_APTPROTOCOL_H
#include <qstring.h> #include <tqstring.h>
#include <qcstring.h> #include <tqcstring.h>
#include <kurl.h> #include <kurl.h>
#include <kio/global.h> #include <kio/global.h>
@ -14,22 +14,23 @@
#include <memory> #include <memory>
class QCString; class TQCString;
namespace Parsers namespace Parsers
{ {
class Parser; class Parser;
} }
class AptProtocol : public QObject, public KIO::SlaveBase { class AptProtocol : public TQObject, public KIO::SlaveBase {
Q_OBJECT Q_OBJECT
TQ_OBJECT
friend class AptCache; friend class AptCache;
AptCache m_process; AptCache m_process;
PackageManager* m_adept_batch; PackageManager* m_adept_batch;
typedef QMap<QString, QString> QueryOptions; typedef TQMap<TQString, TQString> QueryOptions;
/** This this the URL that should be used if we want /** This this the URL that should be used if we want
* to get the same output again. It is especially * to get the same output again. It is especially
@ -47,14 +48,14 @@ class AptProtocol : public QObject, public KIO::SlaveBase {
* mode (for forbidding install, for instance) */ * mode (for forbidding install, for instance) */
bool m_act, m_search, m_internal; bool m_act, m_search, m_internal;
QString m_stylesheet; TQString m_stylesheet;
QString m_header_background; TQString m_header_background;
QString m_logo; TQString m_logo;
QString m_logo_alt; TQString m_logo_alt;
public: public:
AptProtocol( const QCString &pool_socket, const QCString &app_socket ); AptProtocol( const TQCString &pool_socket, const TQCString &app_socket );
virtual ~AptProtocol(); virtual ~AptProtocol();
virtual void mimetype( const KURL& url ); virtual void mimetype( const KURL& url );
virtual void get ( const KURL& url ); virtual void get ( const KURL& url );
@ -63,26 +64,26 @@ public:
* SlaveBase::data() sends a byte array as is. Since we * SlaveBase::data() sends a byte array as is. Since we
* definitely don't want to send \0 to the master, * definitely don't want to send \0 to the master,
* we redefine data() for strings */ * we redefine data() for strings */
void data(const QCString& string); void data(const TQCString& string);
/** @overload */ /** @overload */
void data(const QString& string); void data(const TQString& string);
/** @overload */ /** @overload */
void data(const char* string); void data(const char* string);
void data(const QByteArray& array); void data(const TQByteArray& array);
KURL buildURL(const QString& command, const QString& query) const; KURL buildURL(const TQString& command, const TQString& query) const;
KURL buildURL(const KURL& query) const; KURL buildURL(const KURL& query) const;
QString stylesheet() const; TQString stylesheet() const;
QString header_background() const; TQString header_background() const;
QString logo() const; TQString logo() const;
QString logo_alt() const; TQString logo_alt() const;
private slots: private slots:
void token_dispatch(const QString& tag, const QString& value); void token_dispatch(const TQString& tag, const TQString& value);
private: private:
std::auto_ptr<Parsers::Parser> m_parser; std::auto_ptr<Parsers::Parser> m_parser;
@ -90,24 +91,24 @@ private:
/** apt-cache search /** apt-cache search
* Performs apt-cache search, with the query encoded in url.query() * Performs apt-cache search, with the query encoded in url.query()
* and sends the result as an HTML file */ * and sends the result as an HTML file */
void search( const QString& url, const QueryOptions& options ); void search( const TQString& url, const QueryOptions& options );
/** apt-cache show /** apt-cache show
* Performs apt-cache search, with the package name encoded in url.query() * Performs apt-cache search, with the package name encoded in url.query()
* and sends the result as an HTML file. * and sends the result as an HTML file.
* It checks that the query contains a valid package name */ * It checks that the query contains a valid package name */
void show( const QString& url, const QueryOptions& options ); void show( const TQString& url, const QueryOptions& options );
/** apt-cache policy /** apt-cache policy
* Performs apt-cache policy, with the package name encoded in url.query() * Performs apt-cache policy, with the package name encoded in url.query()
* and sends the result as an HTML file. * and sends the result as an HTML file.
* It checks that the query contains a valid package name */ * It checks that the query contains a valid package name */
void policy( const QString& url, const QueryOptions& options ); void policy( const TQString& url, const QueryOptions& options );
/** /**
* Sends an application/x-adept_batch file with commands * Sends an application/x-adept_batch file with commands
* understandable by adept_batch */ * understandable by adept_batch */
void adept_batch( const QString& url, const QueryOptions& options ); void adept_batch( const TQString& url, const QueryOptions& options );
/** /**
* Shows a form where one can enter parameters for some queries * Shows a form where one can enter parameters for some queries
@ -116,19 +117,19 @@ private:
/** Offline listing of the file of a package */ /** Offline listing of the file of a package */
bool can_listfiles(bool is_installed) const; bool can_listfiles(bool is_installed) const;
void listfiles( const QString& query, const QueryOptions& options); void listfiles( const TQString& query, const QueryOptions& options);
/** Offline file search. /** Offline file search.
* Searches the package which contains the specified file */ * Searches the package which contains the specified file */
bool can_searchfile(bool is_installed) const; bool can_searchfile(bool is_installed) const;
void searchfile( const QString& query, const QueryOptions& options); void searchfile( const TQString& query, const QueryOptions& options);
bool can_online(int mode) const; bool can_online(int mode) const;
void online( const QString& query, const QueryOptions& options); void online( const TQString& query, const QueryOptions& options);
bool check_validpackage(const QString& query); bool check_validpackage(const TQString& query);
QString make_html_form() const; TQString make_html_form() const;
QString make_html_tail(const QString& note = QString::null, bool with_form = true); TQString make_html_tail(const TQString& note = TQString(), bool with_form = true);
KShellProcess * p; KShellProcess * p;

@ -13,8 +13,8 @@
#include "regexps.h" #include "regexps.h"
#include <qstringlist.h> #include <tqstringlist.h>
#include <qregexp.h> #include <tqregexp.h>
#include <kdebug.h> #include <kdebug.h>
@ -25,20 +25,20 @@
AptCache::AptCache() AptCache::AptCache()
{ {
connect(&m_process, SIGNAL(receivedStderr(KProcess*, char*, int)), connect(&m_process, TQT_SIGNAL(receivedStderr(KProcess*, char*, int)),
this, SLOT(receivedStdErr(KProcess*, char*, int ))); this, TQT_SLOT(receivedStdErr(KProcess*, char*, int )));
connect(&m_process, SIGNAL(receivedStdout(KProcess*, char*, int)), connect(&m_process, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)),
this, SLOT(receivedStdOut(KProcess*, char*, int ))); this, TQT_SLOT(receivedStdOut(KProcess*, char*, int )));
} }
AptCache::~AptCache() {} AptCache::~AptCache() {}
static QStringList received(QString& buffer, char* input, int input_len) static TQStringList received(TQString& buffer, char* input, int input_len)
{ {
buffer += QString::fromLatin1(input, input_len); buffer += TQString::tqfromLatin1(input, input_len);
QStringList ret = QStringList::split('\n', buffer, true); TQStringList ret = TQStringList::split('\n', buffer, true);
if (!buffer.endsWith("\n")) if (!buffer.endsWith("\n"))
{ {
buffer = ret.last(); buffer = ret.last();
@ -51,10 +51,10 @@ static QStringList received(QString& buffer, char* input, int input_len)
} }
void AptCache::receivedStdErr( KProcess * /*process*/, char * buffer, int len ) void AptCache::receivedStdErr( KProcess * /*process*/, char * buffer, int len )
{ {
static QRegExp rx_we("(W|E):\\s+(.*)"); static TQRegExp rx_we("(W|E):\\s+(.*)");
QStringList lines = received(m_received_err, buffer, len); TQStringList lines = received(m_received_err, buffer, len);
for (QStringList::ConstIterator i = lines.begin(); i != lines.end(); ++i) for (TQStringList::ConstIterator i = lines.begin(); i != lines.end(); ++i)
{ {
if (rx_we.exactMatch(*i)) if (rx_we.exactMatch(*i))
{ {
@ -69,7 +69,7 @@ void AptCache::receivedStdErr( KProcess * /*process*/, char * buffer, int len )
} }
void AptCache::receivedStdOut( KProcess * /*process*/, char * buffer, int len ) void AptCache::receivedStdOut( KProcess * /*process*/, char * buffer, int len )
{ {
QStringList lines = received(m_received_out, buffer, len); TQStringList lines = received(m_received_out, buffer, len);
(this->*m_receive)(lines); (this->*m_receive)(lines);
} }
@ -84,22 +84,22 @@ void AptCache::clear()
m_received_out = ""; m_received_out = "";
} }
bool AptCache::search(const QString& expression) bool AptCache::search(const TQString& expression)
{ {
clear(); clear();
m_process.setEnvironment("LANGUAGE", "C"); m_process.setEnvironment("LANGUAGE", "C");
m_process << "apt-cache" << "search"; m_process << "apt-cache" << "search";
m_process << QStringList::split(" ", expression); m_process << TQStringList::split(" ", expression);
m_receive = &AptCache::receiveSearch; m_receive = &AptCache::receiveSearch;
return m_process.start(KProcess::Block, KProcess::Stdout ); return m_process.start(KProcess::Block, KProcess::Stdout );
} }
void AptCache::receiveSearch(const QStringList& lines) void AptCache::receiveSearch(const TQStringList& lines)
{ {
static QRegExp rx_parse("([^ ]+) - (.*)"); static TQRegExp rx_parse("([^ ]+) - (.*)");
QStringList::ConstIterator i; TQStringList::ConstIterator i;
for (i = lines.begin(); i != lines.end(); ++i) for (i = lines.begin(); i != lines.end(); ++i)
{ {
if ((*i).isEmpty()) continue; if ((*i).isEmpty()) continue;
@ -117,7 +117,7 @@ void AptCache::receiveSearch(const QStringList& lines)
} }
} }
bool AptCache::show(const QString& package) bool AptCache::show(const TQString& package)
{ {
clear(); clear();
@ -127,19 +127,19 @@ bool AptCache::show(const QString& package)
return m_process.start(KProcess::Block, KProcess::Stdout ); return m_process.start(KProcess::Block, KProcess::Stdout );
} }
void AptCache::receiveShow(const QStringList& lines) void AptCache::receiveShow(const TQStringList& lines)
{ {
static bool pkgfield = false, insert_newline = false; static bool pkgfield = false, insert_newline = false;
static int indent = 0; static int indent = 0;
static QRegExp rx_attribute("([\\w-]+): (.*)"); static TQRegExp rx_attribute("([\\w-]+): (.*)");
static const QString pkg_fields[] = static const TQString pkg_fields[] =
{ "Suggests", "Replaces", "Depends", "Conflicts", QString::null }; { "Suggests", "Replaces", "Depends", "Conflicts", TQString() };
QStringList::ConstIterator i; TQStringList::ConstIterator i;
for (i = lines.begin(); i != lines.end(); ++i) for (i = lines.begin(); i != lines.end(); ++i)
{ {
QString data(*i); TQString data(*i);
if (data.isEmpty()) continue; if (data.isEmpty()) continue;
if (rx_attribute.exactMatch(*i)) if (rx_attribute.exactMatch(*i))
@ -153,7 +153,7 @@ void AptCache::receiveShow(const QStringList& lines)
insert_newline = pkgfield = false; insert_newline = pkgfield = false;
indent = 0; indent = 0;
const QString * test_field; const TQString * test_field;
for (test_field = pkg_fields; !test_field -> isNull(); ++test_field) for (test_field = pkg_fields; !test_field -> isNull(); ++test_field)
if (*test_field == m_attribute) if (*test_field == m_attribute)
{ {
@ -168,7 +168,7 @@ void AptCache::receiveShow(const QStringList& lines)
parse_pkgfield(data); parse_pkgfield(data);
else else
{ {
int new_indent = data.find( QRegExp("[^\\s]") ); int new_indent = data.tqfind( TQRegExp("[^\\s]") );
// new_indent > 0 means that we are in a multi-line // new_indent > 0 means that we are in a multi-line
// field. Those lines always begin with " ", so we want // field. Those lines always begin with " ", so we want
@ -177,7 +177,7 @@ void AptCache::receiveShow(const QStringList& lines)
if (new_indent != indent) if (new_indent != indent)
{ {
emit token("indent", QString::number(new_indent) ); emit token("indent", TQString::number(new_indent) );
indent = new_indent; indent = new_indent;
insert_newline = false; insert_newline = false;
} }
@ -200,20 +200,20 @@ void AptCache::receiveShow(const QStringList& lines)
} }
} }
void AptCache::parse_pkgfield(const QString& data) void AptCache::parse_pkgfield(const TQString& data)
{ {
QStringList split(QStringList::split(",", data)); TQStringList split(TQStringList::split(",", data));
for (QStringList::ConstIterator i = split.begin(); i != split.end(); ++i) for (TQStringList::ConstIterator i = split.begin(); i != split.end(); ++i)
{ {
if (i != split.begin()) emit token("data", ", "); if (i != split.begin()) emit token("data", ", ");
QStringList bar(QStringList::split("|", *i)); TQStringList bar(TQStringList::split("|", *i));
for (QStringList::ConstIterator j = bar.begin(); j != bar.end(); ++j) for (TQStringList::ConstIterator j = bar.begin(); j != bar.end(); ++j)
{ {
if (j != bar.begin()) emit token("data", " | "); if (j != bar.begin()) emit token("data", " | ");
QString pkg, remaining; TQString pkg, remaining;
int paren = (*j).find('('); int paren = (*j).tqfind('(');
if (paren != -1) if (paren != -1)
{ {
pkg = (*j).left(paren - 1); pkg = (*j).left(paren - 1);
@ -233,7 +233,7 @@ void AptCache::parse_pkgfield(const QString& data)
} }
} }
bool AptCache::policy( const QString & package ) bool AptCache::policy( const TQString & package )
{ {
clear(); clear();
@ -243,32 +243,32 @@ bool AptCache::policy( const QString & package )
return m_process.start(KProcess::Block, KProcess::Stdout ); return m_process.start(KProcess::Block, KProcess::Stdout );
} }
void AptCache::receivePolicy(const QStringList& lines) void AptCache::receivePolicy(const TQStringList& lines)
{ {
static QRegExp rx_pkgname("(\\w[\\w+-.]+):"); static TQRegExp rx_pkgname("(\\w[\\w+-.]+):");
static QRegExp rx_location("^\\s*\\d+\\s[^\\d]"); static TQRegExp rx_location("^\\s*\\d+\\s[^\\d]");
for(QStringList::ConstIterator l = lines.begin(); l != lines.end(); ++l) for(TQStringList::ConstIterator l = lines.begin(); l != lines.end(); ++l)
{ {
if ((*l).isEmpty()) continue; if ((*l).isEmpty()) continue;
QString data( (*l).stripWhiteSpace() ); TQString data( (*l).stripWhiteSpace() );
if (rx_pkgname.exactMatch(*l)) if (rx_pkgname.exactMatch(*l))
emit token("package", rx_pkgname.cap(1)); emit token("package", rx_pkgname.cap(1));
else if (data.startsWith("Installed:", false)) else if (data.tqstartsWith("Installed:", false))
{ {
data = data.right(data.length() - 11); data = data.right(data.length() - 11);
emit token("installed", data); emit token("installed", data);
m_installed = data; m_installed = data;
} }
else if (data.startsWith("Candidate:", false)) else if (data.tqstartsWith("Candidate:", false))
{ {
data = data.right(data.length() - 11); data = data.right(data.length() - 11);
emit token("candidate", data); emit token("candidate", data);
m_candidate = data; m_candidate = data;
} }
else if (data.startsWith("Version table:", false)) else if (data.tqstartsWith("Version table:", false))
emit token("version_table", QString::null); emit token("version_table", TQString());
else if (rx_location.search(data) > -1) else if (rx_location.search(data) > -1)
emit token("location", data); emit token("location", data);
else else
@ -282,9 +282,9 @@ void AptCache::receivePolicy(const QStringList& lines)
} }
} }
QString AptCache::policy_installed() const TQString AptCache::policy_installed() const
{ return m_installed; } { return m_installed; }
QString AptCache::policy_candidate() const TQString AptCache::policy_candidate() const
{ return m_candidate; } { return m_candidate; }

@ -10,9 +10,9 @@
#ifndef KIOAPT_APTCACHE_H #ifndef KIOAPT_APTCACHE_H
#define KIOAPT_APTCACHE_H #define KIOAPT_APTCACHE_H
#include <qvaluelist.h> #include <tqvaluelist.h>
#include <qmap.h> #include <tqmap.h>
#include <qstring.h> #include <tqstring.h>
#include <kprocess.h> #include <kprocess.h>
class AptProtocol; class AptProtocol;
@ -20,19 +20,20 @@ class AptProtocol;
/** /**
@author Sylvain Joyeux @author Sylvain Joyeux
*/ */
class AptCache : public QObject { class AptCache : public TQObject {
Q_OBJECT Q_OBJECT
TQ_OBJECT
typedef void (AptCache::*ReceiveMethod) (const QStringList& lines); typedef void (AptCache::*ReceiveMethod) (const TQStringList& lines);
ReceiveMethod m_receive; ReceiveMethod m_receive;
// KProcIO messes the stderr and the stdout lines :( // KProcIO messes the stderr and the stdout lines :(
KProcess m_process; KProcess m_process;
QString m_received_out, m_received_err; TQString m_received_out, m_received_err;
QString m_attribute; TQString m_attribute;
QString m_installed, m_candidate; TQString m_installed, m_candidate;
private slots: private slots:
void receivedStdErr(KProcess* process, char* buffer, int len); void receivedStdErr(KProcess* process, char* buffer, int len);
@ -40,21 +41,21 @@ private slots:
private: private:
void clear(); void clear();
void receiveSearch(const QStringList& lines); void receiveSearch(const TQStringList& lines);
void receiveShow(const QStringList& lines); void receiveShow(const TQStringList& lines);
void receivePolicy(const QStringList& lines); void receivePolicy(const TQStringList& lines);
void parse_pkgfield(const QString& data); void parse_pkgfield(const TQString& data);
public: public:
AptCache(); AptCache();
~AptCache(); ~AptCache();
bool search(const QString& expression); bool search(const TQString& expression);
bool show(const QString& package); bool show(const TQString& package);
bool policy(const QString& package); bool policy(const TQString& package);
QString policy_installed() const; TQString policy_installed() const;
QString policy_candidate() const; TQString policy_candidate() const;
signals: signals:
/** Tags: /** Tags:
@ -75,7 +76,7 @@ signals:
* file (file_name) [for dpkg] * file (file_name) [for dpkg]
* end * end
*/ */
void token(const QString& tag, const QString& value); void token(const TQString& tag, const TQString& value);
}; };
#endif #endif

@ -16,15 +16,15 @@
#include <klocale.h> #include <klocale.h>
#include <kdebug.h> #include <kdebug.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <qregexp.h> #include <tqregexp.h>
Dpkg::Dpkg(QObject *parent, const char *name) Dpkg::Dpkg(TQObject *tqparent, const char *name)
: PackageManager(parent, name) : PackageManager(tqparent, name)
{ {
connect(&m_process, SIGNAL(readReady (KProcIO *)), this, SLOT(readReady(KProcIO*))); connect(&m_process, TQT_SIGNAL(readReady (KProcIO *)), this, TQT_SLOT(readReady(KProcIO*)));
} }
Dpkg::~Dpkg() Dpkg::~Dpkg()
@ -46,15 +46,15 @@ void Dpkg::readReady(KProcIO*)
{ {
bool partial; bool partial;
QString newline; TQString newline;
QStringList lines; TQStringList lines;
while(m_process.readln(newline, true, &partial) != -1) while(m_process.readln(newline, true, &partial) != -1)
{ {
if (partial) m_buffer += newline; if (partial) m_buffer += newline;
else else
{ {
newline.truncate(newline.length()); newline.truncate(newline.length());
QString line(m_buffer + newline); TQString line(m_buffer + newline);
lines << line; lines << line;
m_buffer = ""; m_buffer = "";
} }
@ -64,10 +64,10 @@ void Dpkg::readReady(KProcIO*)
(this->*m_receive)(lines); (this->*m_receive)(lines);
} }
bool Dpkg::search( const QString & file ) bool Dpkg::search( const TQString & file )
{ {
m_process.resetAll(); m_process.resetAll();
m_buffer = QString::null; m_buffer = TQString();
m_process.clearArguments(); m_process.clearArguments();
m_process << "dpkg" << "-S" << file; m_process << "dpkg" << "-S" << file;
@ -75,41 +75,41 @@ bool Dpkg::search( const QString & file )
return m_process.start(KProcess::Block, KProcess::Stdout ); return m_process.start(KProcess::Block, KProcess::Stdout );
} }
void Dpkg::receiveSearch( const QStringList & line ) void Dpkg::receiveSearch( const TQStringList & line )
{ {
static QRegExp rx_notfound("dpkg: (.*) not found"); static TQRegExp rx_notfound("dpkg: (.*) not found");
// the format of the dpkg -S answer is // the format of the dpkg -S answer is
// package1[, package2[, package3...]]: file // package1[, package2[, package3...]]: file
for (QStringList::ConstIterator i = line.begin(); i != line.end(); ++i) for (TQStringList::ConstIterator i = line.begin(); i != line.end(); ++i)
{ {
//kdDebug(DEBUG_ZONE) << *i << endl; //kdDebug(DEBUG_ZONE) << *i << endl;
if ((*i).isEmpty()) continue; if ((*i).isEmpty()) continue;
if (rx_notfound.exactMatch(*i)) if (rx_notfound.exactMatch(*i))
{ {
emit token("error", i18n("%1 not found").arg(rx_notfound.cap(1))); emit token("error", i18n("%1 not found").tqarg(rx_notfound.cap(1)));
continue; continue;
} }
int semicolon = (*i).find(':'); int semicolon = (*i).tqfind(':');
if (semicolon == -1) if (semicolon == -1)
{ {
kdDebug(DEBUG_ZONE) << "receiveSearch unmatched line : " << *i << endl; kdDebug(DEBUG_ZONE) << "receiveSearch unmatched line : " << *i << endl;
continue; continue;
} }
QStringList packages = QStringList::split(',', (*i).left(semicolon)); TQStringList packages = TQStringList::split(',', (*i).left(semicolon));
QString file = (*i).right( (*i).length() - semicolon - 1 ); TQString file = (*i).right( (*i).length() - semicolon - 1 );
emit token("file", file.stripWhiteSpace()); emit token("file", file.stripWhiteSpace());
for (QStringList::ConstIterator j = packages.begin(); j != packages.end(); ++j) for (TQStringList::ConstIterator j = packages.begin(); j != packages.end(); ++j)
emit token("package", (*j).stripWhiteSpace()); emit token("package", (*j).stripWhiteSpace());
} }
} }
bool Dpkg::list( const QString & package ) bool Dpkg::list( const TQString & package )
{ {
m_process.resetAll(); m_process.resetAll();
m_buffer = QString::null; m_buffer = TQString();
m_process.clearArguments(); m_process.clearArguments();
m_process << "dpkg" << "-L" << package; m_process << "dpkg" << "-L" << package;
@ -117,25 +117,25 @@ bool Dpkg::list( const QString & package )
return m_process.start(KProcess::Block, KProcess::Stdout ); return m_process.start(KProcess::Block, KProcess::Stdout );
} }
void Dpkg::receiveList( const QStringList & line ) void Dpkg::receiveList( const TQStringList & line )
{ {
static QRegExp rx_notfound("Package (.*) is not installed"); static TQRegExp rx_notfound("Package (.*) is not installed");
for (QStringList::ConstIterator i = line.begin(); i != line.end(); ++i) for (TQStringList::ConstIterator i = line.begin(); i != line.end(); ++i)
{ {
if (rx_notfound.search(*i) > -1) if (rx_notfound.search(*i) > -1)
emit token("error", i18n("Package %1 is not installed").arg(rx_notfound.cap(1))); emit token("error", i18n("Package %1 is not installed").tqarg(rx_notfound.cap(1)));
else if ((*i).startsWith("/")) else if ((*i).startsWith("/"))
emit token("file", *i); emit token("file", *i);
} }
} }
static const QString static const TQString
html_form_begin("\n<form action=\"http://packages.ubuntu.com/cgi-bin/search_contents.pl\" method=\"GET\">\n" html_form_begin("\n<form action=\"http://packages.ubuntu.com/cgi-bin/search_contents.pl\" method=\"GET\">\n"
"<table class=\"query\">\n"); "<table class=\"query\">\n");
static QString make_title(const QString& title) static TQString make_title(const TQString& title)
{ return "\t<tr><td class=\"title\" colspan=\"2\">" + title + "</td></tr>\n"; } { return "\t<tr><td class=\"title\" colspan=\"2\">" + title + "</td></tr>\n"; }
static const QString static const TQString
html_form_end("<tr>\n" html_form_end("<tr>\n"
"\t<td class=\"button\" colspan=\"2\">\n" "\t<td class=\"button\" colspan=\"2\">\n"
"\t\t<input type=\"submit\" value=\"%1\">\n" "\t\t<input type=\"submit\" value=\"%1\">\n"
@ -146,38 +146,38 @@ static const QString
"</table>\n" "</table>\n"
"</form>\n"); "</form>\n");
static const QString static const TQString
html_form_line_begin("<tr>\n" html_form_line_begin("<tr>\n"
"\t<td><label for=\"%1\">%2</label></td>\n" "\t<td><label for=\"%1\">%2</label></td>\n"
"\t<td>\n"); "\t<td>\n");
static const QString static const TQString
html_form_line_end("</td>\n</tr>\n"); html_form_line_end("</td>\n</tr>\n");
static const QString html_form_combo("<select name=\"%1\" id=\"%2\">"); static const TQString html_form_combo("<select name=\"%1\" id=\"%2\">");
static QString make_form_text(const QString& type, const QString& label) static TQString make_form_text(const TQString& type, const TQString& label)
{ {
return return
html_form_line_begin.arg(type).arg(label) html_form_line_begin.tqarg(type).tqarg(label)
+ QString("<input type=\"text\" name=\"%1\" id=\"%2\">").arg(type).arg(type) + TQString("<input type=\"text\" name=\"%1\" id=\"%2\">").tqarg(type).tqarg(type)
+ html_form_line_end; + html_form_line_end;
} }
static QString begin_form_combo(const QString& type, const QString& label) static TQString begin_form_combo(const TQString& type, const TQString& label)
{ {
return return
html_form_line_begin.arg(type).arg(label) html_form_line_begin.tqarg(type).tqarg(label)
+ QString("\t<select name=\"%1\" id=\"%2\">\n").arg(type).arg(type); + TQString("\t<select name=\"%1\" id=\"%2\">\n").tqarg(type).tqarg(type);
} }
static QString make_form_option(const QString& name, const QString& text) static TQString make_form_option(const TQString& name, const TQString& text)
{ return "\t\t<option value=" + name + ">" + text + "</option>\n"; } { return "\t\t<option value=" + name + ">" + text + "</option>\n"; }
static QString end_form_combo() static TQString end_form_combo()
{ return "\t</select>\n\t</td>\n</tr>\n"; } { return "\t</select>\n\t</td>\n</tr>\n"; }
QString Dpkg::getOnlineForm() TQString Dpkg::getOnlineForm()
{ {
QString buffer; TQString buffer;
QTextOStream stream(&buffer); TQTextOStream stream(&buffer);
stream stream
<< html_form_begin << html_form_begin
<< make_title( i18n("packages.ubuntu.com")) << make_title( i18n("packages.ubuntu.com"))
@ -201,7 +201,7 @@ QString Dpkg::getOnlineForm()
<< make_form_option("warty", "warty") << make_form_option("warty", "warty")
<< end_form_combo() << end_form_combo()
<< html_form_end.arg(i18n("Go online!")); << html_form_end.tqarg(i18n("Go online!"));
return buffer; return buffer;
} }

@ -21,30 +21,31 @@
class Dpkg : public PackageManager class Dpkg : public PackageManager
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
typedef void (Dpkg::*ReceiveMethod) (const QStringList& lines); typedef void (Dpkg::*ReceiveMethod) (const TQStringList& lines);
ReceiveMethod m_receive; ReceiveMethod m_receive;
KProcIO m_process; KProcIO m_process;
QString m_buffer; TQString m_buffer;
private slots: private slots:
void readReady(KProcIO* io); void readReady(KProcIO* io);
private: private:
void receiveSearch(const QStringList& line); void receiveSearch(const TQStringList& line);
void receiveList(const QStringList& line); void receiveList(const TQStringList& line);
public: public:
Dpkg(QObject *parent = 0, const char *name = 0); Dpkg(TQObject *tqparent = 0, const char *name = 0);
~Dpkg(); ~Dpkg();
virtual bool list(const QString& package); virtual bool list(const TQString& package);
virtual bool search(const QString& file); virtual bool search(const TQString& file);
virtual int capabilities(int query) const; virtual int capabilities(int query) const;
virtual QString getOnlineForm(); virtual TQString getOnlineForm();
}; };
#endif #endif

@ -9,23 +9,23 @@
***************************************************************************/ ***************************************************************************/
#include "packagemanager.h" #include "packagemanager.h"
PackageManager::PackageManager(QObject *parent, const char *name) PackageManager::PackageManager(TQObject *tqparent, const char *name)
: QObject(parent, name) {} : TQObject(tqparent, name) {}
PackageManager::~PackageManager() {} PackageManager::~PackageManager() {}
bool PackageManager::list( const QString & /*package*/ ) { return false; } bool PackageManager::list( const TQString & /*package*/ ) { return false; }
bool PackageManager::search( const QString & /*file*/ ) { return false; } bool PackageManager::search( const TQString & /*file*/ ) { return false; }
int PackageManager::capabilities( int /*query*/ ) const { return 0; } int PackageManager::capabilities( int /*query*/ ) const { return 0; }
QString PackageManager::getOnlineForm() TQString PackageManager::getOnlineForm()
{ return QString::null; } { return TQString(); }
QString PackageManager::getOnlineURL TQString PackageManager::getOnlineURL
( const QString& /* query */ ( const TQString& /* query */
, const QMap<QString, QString>& /*options*/ ) , const TQMap<TQString, TQString>& /*options*/ )
{ return QString::null; } { return TQString(); }
#include "packagemanager.moc" #include "packagemanager.moc"

@ -10,7 +10,7 @@
#ifndef PACKAGEMANAGER_H #ifndef PACKAGEMANAGER_H
#define PACKAGEMANAGER_H #define PACKAGEMANAGER_H
#include <qobject.h> #include <tqobject.h>
/** Base class for accessing package-manager specific /** Base class for accessing package-manager specific
* functionalities. ATM, it supports listing files in a * functionalities. ATM, it supports listing files in a
@ -21,15 +21,16 @@
* @author Sylvain Joyeux * @author Sylvain Joyeux
*/ */
class PackageManager : public QObject class PackageManager : public TQObject
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
PackageManager(QObject *parent = 0, const char *name = 0); PackageManager(TQObject *tqparent = 0, const char *name = 0);
virtual ~PackageManager(); virtual ~PackageManager();
virtual bool search(const QString& file); virtual bool search(const TQString& file);
virtual bool list(const QString& package); virtual bool list(const TQString& package);
/** Checks what the package manager is capable of. /** Checks what the package manager is capable of.
* The \c cap parameter should be a or of exactly * The \c cap parameter should be a or of exactly
@ -47,8 +48,8 @@ public:
* installed */ * installed */
virtual int capabilities(int query) const; virtual int capabilities(int query) const;
virtual QString getOnlineForm(); virtual TQString getOnlineForm();
virtual QString getOnlineURL(const QString& query, const QMap<QString, QString>& options); virtual TQString getOnlineURL(const TQString& query, const TQMap<TQString, TQString>& options);
enum Capabilities enum Capabilities
{ {
@ -70,7 +71,7 @@ signals:
* file (file_name) [for dpkg] * file (file_name) [for dpkg]
* end * end
*/ */
void token(const QString& tag, const QString& value); void token(const TQString& tag, const TQString& value);
}; };
#endif #endif

@ -10,16 +10,16 @@
#include "parsers.h" #include "parsers.h"
#include "../apt.h" #include "../apt.h"
static QString static TQString
html_dpkgs_line_begin("<tr><td class=\"file\">%1</td><td>\n\t"), html_dpkgs_line_begin("<tr><td class=\"file\">%1</td><td>\n\t"),
html_dpkgs_line_end("\n</td></tr>\n"); html_dpkgs_line_end("\n</td></tr>\n");
namespace Parsers namespace Parsers
{ {
void FileSearch::operator() (AptProtocol* slave, const QString & tag, const QString & value ) void FileSearch::operator() (AptProtocol* slave, const TQString & tag, const TQString & value )
{ {
static QString buffer; static TQString buffer;
if (tag == "begin") if (tag == "begin")
{ {
m_result_count = 0; m_result_count = 0;
@ -33,7 +33,7 @@ void FileSearch::operator() (AptProtocol* slave, const QString & tag, const QStr
if (m_result_count) if (m_result_count)
*slave << buffer + html_dpkgs_line_end; *slave << buffer + html_dpkgs_line_end;
*slave << html_dpkgs_line_begin.arg(value); *slave << html_dpkgs_line_begin.tqarg(value);
++m_result_count; ++m_result_count;
buffer = ""; buffer = "";
} }

@ -13,7 +13,7 @@
#include <kio/slavebase.h> #include <kio/slavebase.h>
#include <klocale.h> #include <klocale.h>
#include <qregexp.h> #include <tqregexp.h>
#include <kurl.h> #include <kurl.h>
namespace Parsers namespace Parsers
@ -22,11 +22,11 @@ namespace Parsers
: m_links(links) {} : m_links(links) {}
/** Parses the tokens sent by PackageManager::list */ /** Parses the tokens sent by PackageManager::list */
void List::operator() (AptProtocol* slave, const QString& tag, const QString& value ) void List::operator() (AptProtocol* slave, const TQString& tag, const TQString& value )
{ {
static QRegExp rx_manpage("/man/.*\\.\\d[^/]*$"); static TQRegExp rx_manpage("/man/.*\\.\\d[^/]*$");
static QStringList files; static TQStringList files;
if (tag == "begin") if (tag == "begin")
{ {
@ -62,7 +62,7 @@ namespace Parsers
files.sort(); files.sort();
*slave << *slave <<
"<div class=\"filelist\">\n" + files.join("\n<br>") + "\n</div>\n" "<div class=\"filelist\">\n" + files.join("\n<br>") + "\n</div>\n"
"<div class=\"footer\">" + i18n("%1 files in the package").arg(result_count()) + "</div>\n"; "<div class=\"footer\">" + i18n("%1 files in the package").tqarg(result_count()) + "</div>\n";
files.clear(); files.clear();
} }
} }

@ -14,7 +14,7 @@
#include <kio/slavebase.h> #include <kio/slavebase.h>
#include <qhtmlstream.h> #include <qhtmlstream.h>
#include <qregexp.h> #include <tqregexp.h>
#include <stdlib.h> #include <stdlib.h>
@ -22,14 +22,14 @@ namespace Parsers
{ {
static void print_czstring(KIO::SlaveBase& slave, const char* data, int len) static void print_czstring(KIO::SlaveBase& slave, const char* data, int len)
{ {
QByteArray nonull; TQByteArray nonull;
nonull.setRawData(data, len); nonull.setRawData(data, len);
slave.data(nonull); slave.data(nonull);
nonull.resetRawData(data, len); nonull.resetRawData(data, len);
} }
void operator << (KIO::SlaveBase& slave, const QCString& string) void operator << (KIO::SlaveBase& slave, const TQCString& string)
{ print_czstring(slave, string.data(), string.size() - 1); } { print_czstring(slave, string.data(), string.size() - 1); }
void operator << (KIO::SlaveBase& slave, const QString& string) void operator << (KIO::SlaveBase& slave, const TQString& string)
{ slave << string.utf8(); } { slave << string.utf8(); }
void operator << (KIO::SlaveBase& slave, const char* string) void operator << (KIO::SlaveBase& slave, const char* string)
{ print_czstring(slave, string, strlen(string)); } { print_czstring(slave, string, strlen(string)); }
@ -39,7 +39,7 @@ namespace Parsers
Parser::Parser( ) {} Parser::Parser( ) {}
Parser::~Parser( ) {} Parser::~Parser( ) {}
void Parser::attribute_begin(QHtmlStream& stream, const QString& text) void Parser::attribute_begin(TQHtmlStream& stream, const TQString& text)
{ {
stream stream
<< block("tr") << endl << block("tr") << endl
@ -48,15 +48,15 @@ namespace Parsers
<< close() << endl << close() << endl
<< block("td"); << block("td");
} }
void Parser::attribute_end(QHtmlStream& stream) void Parser::attribute_end(TQHtmlStream& stream)
{ stream << close() << endl << close(); } { stream << close() << endl << close(); }
// void Parser::operator ( )( KIO::SlaveBase * /*slave*/, // void Parser::operator ( )( KIO::SlaveBase * /*slave*/,
// const QString & /*tag*/, const QString & /*value*/ ) // const TQString & /*tag*/, const TQString & /*value*/ )
// {} // {}
QString mangle_version(QString version) TQString mangle_version(TQString version)
{ return "version_" + version.replace(QRegExp("[-:\\.\\+]"), QString("_")); } { return "version_" + version.tqreplace(TQRegExp("[-:\\.\\+]"), TQString("_")); }
} }

@ -11,13 +11,13 @@
#ifndef PARSERS_H #ifndef PARSERS_H
#define PARSERS_H #define PARSERS_H
#include <qstring.h> #include <tqstring.h>
namespace KIO namespace KIO
{ {
class SlaveBase; class SlaveBase;
} }
class QHtmlStream; class TQHtmlStream;
class AptProtocol; class AptProtocol;
/** Here are defined the functional objects that takes the tokens /** Here are defined the functional objects that takes the tokens
@ -29,20 +29,20 @@ namespace Parsers
protected: protected:
int m_result_count; int m_result_count;
static void attribute_begin(QHtmlStream& stream, const QString& text); static void attribute_begin(TQHtmlStream& stream, const TQString& text);
static void attribute_end(QHtmlStream& stream); static void attribute_end(TQHtmlStream& stream);
public: public:
Parser(); Parser();
virtual ~Parser(); virtual ~Parser();
int result_count() const { return m_result_count; } int result_count() const { return m_result_count; }
virtual void operator () (AptProtocol* slave, const QString& tag, const QString& value) = 0; virtual void operator () (AptProtocol* slave, const TQString& tag, const TQString& value) = 0;
}; };
class Search : public Parser class Search : public Parser
{ {
public: public:
void operator () (AptProtocol* slave, const QString& tag, const QString& value); void operator () (AptProtocol* slave, const TQString& tag, const TQString& value);
}; };
class List : public Parser class List : public Parser
@ -50,42 +50,42 @@ namespace Parsers
bool m_links; bool m_links;
public: public:
List(bool show_links); List(bool show_links);
void operator () (AptProtocol* slave, const QString& tag, const QString& value); void operator () (AptProtocol* slave, const TQString& tag, const TQString& value);
}; };
class FileSearch : public Parser class FileSearch : public Parser
{ {
public: public:
void operator () (AptProtocol* slave, const QString& tag, const QString& value); void operator () (AptProtocol* slave, const TQString& tag, const TQString& value);
}; };
class Show : public Parser class Show : public Parser
{ {
QString m_package, m_installed; TQString m_package, m_installed;
bool m_act; bool m_act;
public: public:
Show(const QString& package, const QString& installed, bool act); Show(const TQString& package, const TQString& installed, bool act);
void operator () (AptProtocol* slave, const QString& tag, const QString& value); void operator () (AptProtocol* slave, const TQString& tag, const TQString& value);
}; };
class Policy : public Parser class Policy : public Parser
{ {
QString m_package, m_installed; TQString m_package, m_installed;
bool m_has_adept_batch; bool m_has_adept_batch;
bool m_act; bool m_act;
public: public:
Policy(const QString& package, bool act); Policy(const TQString& package, bool act);
QString getInstalled() const { return m_installed; } TQString getInstalled() const { return m_installed; }
void operator () (AptProtocol* slave, const QString& tag, const QString& value); void operator () (AptProtocol* slave, const TQString& tag, const TQString& value);
}; };
void operator << (KIO::SlaveBase& slave, const QCString& string); void operator << (KIO::SlaveBase& slave, const TQCString& string);
void operator << (KIO::SlaveBase& slave, const QString& string); void operator << (KIO::SlaveBase& slave, const TQString& string);
void operator << (KIO::SlaveBase& slave, const char* string); void operator << (KIO::SlaveBase& slave, const char* string);
QString mangle_version(QString version); TQString mangle_version(TQString version);
} }
#endif #endif

@ -14,9 +14,9 @@
#include <klocale.h> #include <klocale.h>
#include <kdebug.h> #include <kdebug.h>
#include <qhtmlstream.h> #include <qhtmlstream.h>
#include <qregexp.h> #include <tqregexp.h>
static void policy_begin(QHtmlStream& stream) static void policy_begin(TQHtmlStream& stream)
{ {
stream stream
<< block("div") << endl << block("div") << endl
@ -26,7 +26,7 @@ static void policy_begin(QHtmlStream& stream)
<< block("tbody"); << block("tbody");
} }
static void add_button(QHtmlStream& stream, const QString& mode, const QString& text, const QString& package) static void add_button(TQHtmlStream& stream, const TQString& mode, const TQString& text, const TQString& package)
{ {
stream stream
<< block("form") << block("form")
@ -48,7 +48,7 @@ static void add_button(QHtmlStream& stream, const QString& mode, const QString&
<< close() << endl; << close() << endl;
} }
static void add_version_link(QHtmlStream& stream, AptProtocol* slave, const QString& package, const QString& version) static void add_version_link(TQHtmlStream& stream, AptProtocol* slave, const TQString& package, const TQString& version)
{ {
KURL url(slave->buildURL("show", package)); KURL url(slave->buildURL("show", package));
url.setHTMLRef(Parsers::mangle_version(version)); url.setHTMLRef(Parsers::mangle_version(version));
@ -63,25 +63,25 @@ static void add_version_link(QHtmlStream& stream, AptProtocol* slave, const QStr
namespace Parsers namespace Parsers
{ {
Policy::Policy(const QString& package, bool act) Policy::Policy(const TQString& package, bool act)
: m_package(package), m_act(false) : m_package(package), m_act(false)
{ {
m_act = act; m_act = act;
} }
void Policy::operator() (AptProtocol* slave, const QString& type, const QString& value) void Policy::operator() (AptProtocol* slave, const TQString& type, const TQString& value)
{ {
static bool first_version = false, received_sth = false; static bool first_version = false, received_sth = false;
static QString buffer; static TQString buffer;
static QHtmlStream* stream; static TQHtmlStream* stream;
static QRegExp rx_notinstalled("(none)"); static TQRegExp rx_notinstalled("(none)");
kdDebug() << "policy : " << type << " " << value << endl; kdDebug() << "policy : " << type << " " << value << endl;
if (type == "begin") if (type == "begin")
{ {
stream = new QHtmlStream(&buffer); stream = new TQHtmlStream(&buffer);
policy_begin(*stream); policy_begin(*stream);
} }
else if (type == "installed") else if (type == "installed")
@ -91,7 +91,7 @@ void Policy::operator() (AptProtocol* slave, const QString& type, const QString&
attribute_begin(*stream, i18n("Installed")); attribute_begin(*stream, i18n("Installed"));
if (rx_notinstalled.match(value) >= 0) if (rx_notinstalled.match(value) >= 0)
{ {
m_installed = QString::null; m_installed = TQString();
*stream << i18n("no"); *stream << i18n("no");
} }
else else
@ -149,8 +149,8 @@ void Policy::operator() (AptProtocol* slave, const QString& type, const QString&
} }
else if (type == "version") else if (type == "version")
{ {
QString version = value.section(' ', 0, 0); TQString version = value.section(' ', 0, 0);
QString pin = value.section(' ', 1, 1); TQString pin = value.section(' ', 1, 1);
if (first_version) if (first_version)
{ {
@ -163,7 +163,7 @@ void Policy::operator() (AptProtocol* slave, const QString& type, const QString&
*stream << close() << close(); *stream << close() << close();
}*/ }*/
QString version_link; TQString version_link;
version_link = "<a href=\"apt:/show?" + m_package + "#" + mangle_version(version) + "\">" version_link = "<a href=\"apt:/show?" + m_package + "#" + mangle_version(version) + "\">"
+ version + "</a>"; + version + "</a>";
@ -175,8 +175,8 @@ void Policy::operator() (AptProtocol* slave, const QString& type, const QString&
} }
else if (type == "location") else if (type == "location")
{ {
QStringList sections = QStringList::split(' ', value); TQStringList sections = TQStringList::split(' ', value);
QString pin = sections.first(); TQString pin = sections.first();
sections.pop_front(); sections.pop_front();
// remove the "Packages" field if it is here // remove the "Packages" field if it is here
if (sections.last() == "Packages") if (sections.last() == "Packages")
@ -193,7 +193,7 @@ void Policy::operator() (AptProtocol* slave, const QString& type, const QString&
*slave << buffer; *slave << buffer;
} }
buffer = QString::null; buffer = TQString();
received_sth = false; received_sth = false;
delete stream; delete stream;
} }

@ -7,33 +7,33 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
***************************************************************************/ ***************************************************************************/
#ifndef QHtmlStream_H #ifndef TQHtmlStream_H
#define QHtmlStream_H #define TQHtmlStream_H
#include <qtextstream.h> #include <tqtextstream.h>
#include <qstringlist.h> #include <tqstringlist.h>
class QHtmlStream; class TQHtmlStream;
class QHtmlStreamManip; class TQHtmlStreamManip;
/** /**
@author Sylvain Joyeux @author Sylvain Joyeux
*/ */
class QHtmlStreamManip class TQHtmlStreamManip
{ {
protected: protected:
virtual void apply(QHtmlStream& stream) const = 0; virtual void apply(TQHtmlStream& stream) const = 0;
public: public:
virtual ~QHtmlStreamManip() {}; virtual ~TQHtmlStreamManip() {};
void operator () (QHtmlStream& stream) const void operator () (TQHtmlStream& stream) const
{ apply(stream); } { apply(stream); }
}; };
class QHtmlStream class TQHtmlStream
{ {
QTextOStream m_stream; TQTextOStream m_stream;
enum States enum States
{ {
@ -45,8 +45,8 @@ class QHtmlStream
int m_state, m_enclosing_state; int m_state, m_enclosing_state;
bool m_newline; bool m_newline;
QString m_indent; TQString m_indent;
QStringList m_blockstack; TQStringList m_blockstack;
void finalize_open() void finalize_open()
{ {
@ -71,7 +71,7 @@ class QHtmlStream
} }
template<class T> template<class T>
QHtmlStream& output(const T& o) TQHtmlStream& output(const T& o)
{ {
indent(); indent();
@ -98,11 +98,11 @@ class QHtmlStream
} }
public: public:
QHtmlStream(QString* buffer) TQHtmlStream(TQString* buffer)
: m_stream(buffer), m_state(NORMAL_FLOW), m_newline(true) {} : m_stream(buffer), m_state(NORMAL_FLOW), m_newline(true) {}
~QHtmlStream() {} ~TQHtmlStream() {}
void tag(const QString& name, const QString& cl, const QString& id) void tag(const TQString& name, const TQString& cl, const TQString& id)
{ {
finalize_open(); finalize_open();
indent(); indent();
@ -116,7 +116,7 @@ public:
m_stream << " id=\"" << id << "\""; m_stream << " id=\"" << id << "\"";
} }
void block(const QString& name, const QString& cl, const QString& id) void block(const TQString& name, const TQString& cl, const TQString& id)
{ {
finalize_open(); finalize_open();
indent(); indent();
@ -132,7 +132,7 @@ public:
m_stream << " id=\"" << id << "\""; m_stream << " id=\"" << id << "\"";
} }
void parameter(const QString& param_name) void parameter(const TQString& param_name)
{ {
if (m_state == NORMAL_FLOW) return; if (m_state == NORMAL_FLOW) return;
@ -165,34 +165,34 @@ public:
finalize_open(); finalize_open();
} }
QHtmlStream & operator<< ( QChar c ) { return output(c); } TQHtmlStream & operator<< ( TQChar c ) { return output(c); }
QHtmlStream & operator<< ( char c ) { return output(c); } TQHtmlStream & operator<< ( char c ) { return output(c); }
QHtmlStream & operator<< ( signed short i ) { return output(i); } TQHtmlStream & operator<< ( signed short i ) { return output(i); }
QHtmlStream & operator<< ( unsigned short i ) { return output(i); } TQHtmlStream & operator<< ( unsigned short i ) { return output(i); }
QHtmlStream & operator<< ( signed int i ) { return output(i); } TQHtmlStream & operator<< ( signed int i ) { return output(i); }
QHtmlStream & operator<< ( unsigned int i ) { return output(i); } TQHtmlStream & operator<< ( unsigned int i ) { return output(i); }
QHtmlStream & operator<< ( signed long i ) { return output(i); } TQHtmlStream & operator<< ( signed long i ) { return output(i); }
QHtmlStream & operator<< ( unsigned long i ) { return output(i); } TQHtmlStream & operator<< ( unsigned long i ) { return output(i); }
QHtmlStream & operator<< ( float f ) { return output(f); } TQHtmlStream & operator<< ( float f ) { return output(f); }
QHtmlStream & operator<< ( double f ) { return output(f); } TQHtmlStream & operator<< ( double f ) { return output(f); }
QHtmlStream & operator<< ( const char * s ) { return output(s); } TQHtmlStream & operator<< ( const char * s ) { return output(s); }
QHtmlStream & operator<< ( const QString & s ) { return output(s); } TQHtmlStream & operator<< ( const TQString & s ) { return output(s); }
QHtmlStream & operator<< ( const QCString & s ) { return output(s); } TQHtmlStream & operator<< ( const TQCString & s ) { return output(s); }
QHtmlStream & operator<< ( const QHtmlStreamManip& op ) TQHtmlStream & operator<< ( const TQHtmlStreamManip& op )
{ {
op(*this); op(*this);
return *this; return *this;
} }
QHtmlStream & operator<< (QTSManip m) TQHtmlStream & operator<< (TQTSManip m)
{ {
finalize_open(); finalize_open();
m_stream << m; m_stream << m;
return (*this); return (*this);
} }
QHtmlStream & operator<< (QTSFUNC f) TQHtmlStream & operator<< (TQTSFUNC f)
{ {
finalize_open(); finalize_open();
int old_flags = m_stream.flags(); int old_flags = m_stream.flags();
@ -207,79 +207,79 @@ public:
* Stream manipulators * Stream manipulators
*/ */
class QHtmlStreamManip0 : public QHtmlStreamManip class TQHtmlStreamManip0 : public TQHtmlStreamManip
{ {
public: public:
typedef void (QHtmlStream::*Method)(); typedef void (TQHtmlStream::*Method)();
private: private:
Method m_method; Method m_method;
void apply (QHtmlStream& stream) const void apply (TQHtmlStream& stream) const
{ (stream.*m_method)(); } { (stream.*m_method)(); }
public: public:
QHtmlStreamManip0(Method m) TQHtmlStreamManip0(Method m)
: m_method(m) {} : m_method(m) {}
}; };
class QHtmlStreamManip1 : public QHtmlStreamManip class TQHtmlStreamManip1 : public TQHtmlStreamManip
{ {
public: public:
typedef void (QHtmlStream::*Method)(const QString& param); typedef void (TQHtmlStream::*Method)(const TQString& param);
private: private:
Method m_method; Method m_method;
QString m_param; TQString m_param;
void apply(QHtmlStream& stream) const void apply(TQHtmlStream& stream) const
{ (stream.*m_method)(m_param); } { (stream.*m_method)(m_param); }
public: public:
QHtmlStreamManip1(Method m, const QString& param) TQHtmlStreamManip1(Method m, const TQString& param)
: m_method(m), m_param(param) {} : m_method(m), m_param(param) {}
}; };
class QHtmlStreamManip3 : public QHtmlStreamManip class TQHtmlStreamManip3 : public TQHtmlStreamManip
{ {
public: public:
typedef void (QHtmlStream::*Method)(const QString& param0, const QString& param1, const QString& param2); typedef void (TQHtmlStream::*Method)(const TQString& param0, const TQString& param1, const TQString& param2);
private: private:
Method m_method; Method m_method;
QString m_param0, m_param1, m_param2; TQString m_param0, m_param1, m_param2;
void apply(QHtmlStream& stream) const void apply(TQHtmlStream& stream) const
{ (stream.*m_method)(m_param0, m_param1, m_param2); } { (stream.*m_method)(m_param0, m_param1, m_param2); }
public: public:
QHtmlStreamManip3(Method m, const QString& param0, const QString& param1, const QString& param2) TQHtmlStreamManip3(Method m, const TQString& param0, const TQString& param1, const TQString& param2)
: m_method(m), : m_method(m),
m_param0(param0), m_param1(param1), m_param2(param2) {} m_param0(param0), m_param1(param1), m_param2(param2) {}
}; };
class CloseAll : public QHtmlStreamManip class CloseAll : public TQHtmlStreamManip
{ {
private: private:
bool m_indent; bool m_indent;
void apply(QHtmlStream& stream) const void apply(TQHtmlStream& stream) const
{ stream.close_all(m_indent); } { stream.close_all(m_indent); }
public: public:
CloseAll(bool indent) : m_indent(indent) {} CloseAll(bool indent) : m_indent(indent) {}
}; };
inline QHtmlStreamManip3 tag(const QString& name, const QString& cl = QString::null, const QString& id = QString::null) inline TQHtmlStreamManip3 tag(const TQString& name, const TQString& cl = TQString(), const TQString& id = TQString())
{ return QHtmlStreamManip3(&QHtmlStream::tag, name, cl, id); } { return TQHtmlStreamManip3(&TQHtmlStream::tag, name, cl, id); }
inline QHtmlStreamManip3 block(const QString& name, const QString& cl = QString::null, const QString& id = QString::null) inline TQHtmlStreamManip3 block(const TQString& name, const TQString& cl = TQString(), const TQString& id = TQString())
{ return QHtmlStreamManip3(&QHtmlStream::block, name, cl, id); } { return TQHtmlStreamManip3(&TQHtmlStream::block, name, cl, id); }
inline QHtmlStreamManip1 param(const QString& name) inline TQHtmlStreamManip1 param(const TQString& name)
{ return QHtmlStreamManip1(&QHtmlStream::parameter, name); } { return TQHtmlStreamManip1(&TQHtmlStream::parameter, name); }
inline QHtmlStreamManip0 close() inline TQHtmlStreamManip0 close()
{ return QHtmlStreamManip0(&QHtmlStream::close); } { return TQHtmlStreamManip0(&TQHtmlStream::close); }
inline QHtmlStreamManip0 data() inline TQHtmlStreamManip0 data()
{ return QHtmlStreamManip0(&QHtmlStream::data); } { return TQHtmlStreamManip0(&TQHtmlStream::data); }
inline CloseAll close_all(bool indent = true) inline CloseAll close_all(bool indent = true)
{ return CloseAll(indent); } { return CloseAll(indent); }

@ -18,11 +18,11 @@
namespace Parsers namespace Parsers
{ {
/** Parses the output of apt-cache search */ /** Parses the output of apt-cache search */
void Search::operator() (AptProtocol* slave, const QString& tag, const QString& value) void Search::operator() (AptProtocol* slave, const TQString& tag, const TQString& value)
{ {
static QMap<QString, QString> results; static TQMap<TQString, TQString> results;
static QString cur_package; static TQString cur_package;
static QString query; static TQString query;
if (tag == "begin") if (tag == "begin")
{ {
@ -42,16 +42,16 @@ void Search::operator() (AptProtocol* slave, const QString& tag, const QString&
{ {
// We separate results whose package name matches the query // We separate results whose package name matches the query
// and those who matches only with the description // and those who matches only with the description
QString normal, special; TQString normal, special;
QHtmlStream sstream(&special), nstream(&normal); TQHtmlStream sstream(&special), nstream(&normal);
// QMap iteration sorts wrt the key < operator // TQMap iteration sorts wrt the key < operator
// with QStrings, it means case insensitive sort // with TQStrings, it means case insensitive sort
QMap<QString, QString>::ConstIterator i; TQMap<TQString, TQString>::ConstIterator i;
for (i = results.begin(); i != results.end(); ++i) for (i = results.begin(); i != results.end(); ++i)
{ {
const QString key = i.key(); const TQString key = i.key();
QHtmlStream* stream = &nstream; TQHtmlStream* stream = &nstream;
if (key == query) if (key == query)
stream = &sstream; stream = &sstream;
@ -66,8 +66,8 @@ void Search::operator() (AptProtocol* slave, const QString& tag, const QString&
} }
if (!special.isEmpty()) if (!special.isEmpty())
*slave << QString("<table>") + special + QString("</table>\n<hr>\n"); *slave << TQString("<table>") + special + TQString("</table>\n<hr>\n");
*slave << QString("<table>") + normal + QString("</table>"); *slave << TQString("<table>") + normal + TQString("</table>");
results.clear(); results.clear();
} }

@ -12,60 +12,60 @@
#include "../apt.h" #include "../apt.h"
#include <klocale.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_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_classed("<tr class=\"%1\"><td class=\"attname\">%2</td>\n\t<td>\n\t\t"),
html_attribute_end("\n\t</td>\n</tr>\n"); html_attribute_end("\n\t</td>\n</tr>\n");
// Converts the special chars in orig into its HTML equivalents // Converts the special chars in orig into its HTML equivalents
static QString text2html(const QString& orig) static TQString text2html(const TQString& orig)
{ QString ret(orig); { TQString ret(orig);
ret = ret.replace("<(?!a href)", "&lt;"); ret = ret.tqreplace("<(?!a href)", "&lt;");
//ret = ret.replace( QRegExp("\n"), "<br />\n"); //ret = ret.tqreplace( TQRegExp("\n"), "<br />\n");
return ret; return ret;
} }
static void close_indent(int indent, QString& buffer) static void close_indent(int indent, TQString& buffer)
{ {
if (buffer.isEmpty()) return; if (buffer.isEmpty()) return;
if (indent) if (indent)
buffer += "\n\t\t</div>"; 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; if (buffer.isEmpty()) return;
close_indent(indent, buffer); close_indent(indent, buffer);
buffer += html_attribute_end; 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; if (buffer.isEmpty()) return;
close_item(indent, buffer); close_item(indent, buffer);
buffer = version + "<table class=\"version\">\n" + buffer + "</table>\n"; buffer = version + "<table class=\"version\">\n" + buffer + "</table>\n";
} }
static QString version_header_link(const KURL& url, const QString& name) static TQString version_header_link(const KURL& url, const TQString& name)
{ return QString("\t<a class=\"links\" href=\"" + url.htmlURL() + "\">" + name + "</a>\n"); } { return TQString("\t<a class=\"links\" href=\"" + url.htmlURL() + "\">" + name + "</a>\n"); }
namespace Parsers 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_package(package), m_installed(installed_version), m_act(false)
{ {
m_act = act; 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 // Since we want to show the version first, we should wait for it
// before sending anything // before sending anything
static QString version; static TQString version;
static QString buffer; static TQString buffer;
static QString attribute; static TQString attribute;
static int indent; static int indent;
static bool multiline = false; static bool multiline = false;
static bool first_line = false, new_paragraph = true; 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); close_item(indent, buffer);
buffer += buffer +=
html_attribute_begin.arg(value) html_attribute_begin.tqarg(value)
+ "&nbsp;"; + "&nbsp;";
close_item(indent, buffer); close_item(indent, buffer);
buffer += html_attribute_begin.arg("&nbsp;"); buffer += html_attribute_begin.tqarg("&nbsp;");
} }
else if (value != "Version" && value != "Package") else if (value != "Version" && value != "Package")
{ {
close_item(indent, buffer); close_item(indent, buffer);
buffer += html_attribute_begin.arg(value); buffer += html_attribute_begin.tqarg(value);
} }
if (value == "Description") if (value == "Description")
@ -137,18 +137,18 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va
{ {
KURL action ("apt:/get"); KURL action ("apt:/get");
QString item_id = mangle_version(value); TQString item_id = mangle_version(value);
if (value == m_installed) if (value == m_installed)
{ {
action.setQuery("remove"); action.setQuery("remove");
version = QString("<div class=\"version-header-installed\" id=\"%1\">").arg(item_id) version = TQString("<div class=\"version-header-installed\" id=\"%1\">").tqarg(item_id)
+ i18n("Installed version %1").arg(value); + i18n("Installed version %1").tqarg(value);
} }
else else
{ {
action.setQuery("install"); action.setQuery("install");
version = QString("<div class=\"version-header\" id=\"%1\">").arg(item_id) version = TQString("<div class=\"version-header\" id=\"%1\">").tqarg(item_id)
+ i18n("Version %1").arg(value); + i18n("Version %1").tqarg(value);
} }
action.addQueryItem("package", m_package); action.addQueryItem("package", m_package);
@ -168,7 +168,7 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va
{ {
if (multiline) if (multiline)
{ {
static const QRegExp rx_empty("^\\s*$"); static const TQRegExp rx_empty("^\\s*$");
if (rx_empty.exactMatch(value)) if (rx_empty.exactMatch(value))
{ {
buffer += "</p>"; buffer += "</p>";
@ -185,7 +185,7 @@ void Show::operator() (AptProtocol* slave, const QString& tag, const QString& va
new_paragraph = false; 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") else if (tag == "package_link")
buffer += "<a href=\"" + slave->buildURL("show", value).htmlURL() + "\">" + value + "</a>"; buffer += "<a href=\"" + slave->buildURL("show", value).htmlURL() + "\">" + value + "</a>";

@ -13,10 +13,10 @@
#include <kdebug.h> #include <kdebug.h>
bool match_dversion(QString version) bool match_dversion(TQString version)
{ {
static QRegExp rx_revision(rxs_revision); static TQRegExp rx_revision(rxs_revision);
QString allowed_vchars = ".+\\w"; TQString allowed_vchars = ".+\\w";
kdDebug(DEBUG_ZONE) << version << endl; kdDebug(DEBUG_ZONE) << version << endl;
if (version[1] == ':') if (version[1] == ':')
@ -28,11 +28,11 @@ bool match_dversion(QString version)
} }
kdDebug(DEBUG_ZONE) << version << endl; kdDebug(DEBUG_ZONE) << version << endl;
int rev_pos = version.findRev('-'); int rev_pos = version.tqfindRev('-');
if (rev_pos > -1) if (rev_pos > -1)
{ {
allowed_vchars += "-"; allowed_vchars += "-";
QString revision = version.right( version.length() - rev_pos - 1); TQString revision = version.right( version.length() - rev_pos - 1);
if (! rx_revision.exactMatch(revision)) if (! rx_revision.exactMatch(revision))
return false; return false;
@ -40,6 +40,6 @@ bool match_dversion(QString version)
version.truncate( version.length() - rev_pos - 1 ); version.truncate( version.length() - rev_pos - 1 );
} }
QRegExp rx_version("\\d[" + allowed_vchars + "]*"); TQRegExp rx_version("\\d[" + allowed_vchars + "]*");
return rx_version.exactMatch(version); return rx_version.exactMatch(version);
} }

@ -11,13 +11,13 @@
#ifndef REGEXPS_H #ifndef REGEXPS_H
#define REGEXPS_H #define REGEXPS_H
#include <qstring.h> #include <tqstring.h>
#include <qregexp.h> #include <tqregexp.h>
static const QString rxs_pkgname("\\w[\\w+-.]+"); static const TQString rxs_pkgname("\\w[\\w+-.]+");
static const QString rxs_revision("\\w[.+\\w]*"); static const TQString rxs_revision("\\w[.+\\w]*");
bool match_dversion(QString version); bool match_dversion(TQString version);
#endif #endif

Loading…
Cancel
Save