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_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)
protocol_DATA = apt.protocol apt+http.protocol

@ -16,7 +16,7 @@
#include "parsers/parsers.h"
#include <qcstring.h>
#include <tqcstring.h>
#include <kapplication.h>
#include <kinstance.h>
@ -30,7 +30,7 @@
#include <kdebug.h>
#include <qregexp.h>
#include <tqregexp.h>
#include <stdlib.h>
@ -42,33 +42,33 @@ using namespace KIO;
* Common definitions of HTML fragments
*/
static const QString
static const TQString
html_preamble("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\"\n"
"\t\"http://www.w3.org/TR/html4/strict.dtd\">\n"
"<html>\n");
static const QString
static const TQString
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=\"Refresh\" content=\"0 ; URL=%1\">\n"
"</head>\n"
"\n<body></body>\n"
"</html>"));
static const QString
static const TQString
html_head(html_preamble +
QString("<head>\n"
TQString("<head>\n"
"\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
"\t<link rel=\"stylesheet\" href=\"file:%1\">\n"
"\t<title>%2</title>\n"
"</head>\n\n"
"<body>\n"));
static QString close_html_head();
static QString open_html_head(const QString& title, bool links, AptProtocol const& config)
static TQString close_html_head();
static TQString open_html_head(const TQString& title, bool links, AptProtocol const& config)
{
static const QString
static const TQString
html_head_table(
"<table class=\"header\" style=\"background-image: url(file:%1);\"\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=\"header-title\">%4</td>\n");
QString rowspan;
TQString rowspan;
if (links) rowspan = "rowspan=\"2\"";
QString ret =
TQString ret =
html_head
.arg(config.stylesheet())
.arg(title)
.tqarg(config.stylesheet())
.tqarg(title)
+ html_head_table
.arg(config.header_background())
.arg(rowspan)
.arg(config.logo())
.arg(config.logo_alt())
.arg(title);
.tqarg(config.header_background())
.tqarg(rowspan)
.tqarg(config.logo())
.tqarg(config.logo_alt())
.tqarg(title);
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";
}
}
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");
return format.arg(url).arg(long_desc).arg(name);
static const TQString format("\t\t<td><a href=\"%1\" title=\"%2\">%3</a></td>\n");
return format.tqarg(url).tqarg(long_desc).tqarg(name);
}
static QString close_html_head()
static TQString close_html_head()
{
return "\t</tr>\n"
"\t</table>\n"
@ -117,23 +117,23 @@ static QString close_html_head()
"</table>";
}
static const QString
static const TQString
html_tail("<div class=\"footer\">%1</div>\n"
"</body>\n"
"</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;
QString ret;
TQString ret;
if (with_form)
ret = "<hr>\n" + make_html_form();
if (!note.isEmpty())
ret += html_tail.arg(note + ". " + i18n("Page generated by kio_apt."));
else ret += html_tail.arg(i18n("Page generated by kio_apt."));
ret += html_tail.tqarg(note + ". " + i18n("Page generated by kio_apt."));
else ret += html_tail.tqarg(i18n("Page generated by kio_apt."));
return ret;
}
@ -142,30 +142,30 @@ QString AptProtocol::make_html_tail(const QString& note, bool with_form)
* Search form
*/
static const QString
static const TQString
html_form_begin("\n<form action=\"apt:/\" method=\"GET\">\n"
"<table class=\"query\">\n");
static const QString
static const TQString
html_form_end("<tr>\n"
"\t<td class=\"button\" colspan=\"2\"><input type=\"submit\" value=\"%1\"></td>\n"
"</tr>\n"
"</table>\n"
"</form>\n");
static const QString
static const TQString
html_form_line("<tr>\n"
"\t<td><label for=\"%1\">%2</label></td>\n"
"\t<td><input type=\"text\" name=\"%3\" id=\"%4\"></td>\n"
"</tr>\n");
static QString make_html_form_line(const QString& type, const QString& label)
{ return html_form_line.arg(type).arg(label).arg(type).arg(type); }
static TQString make_html_form_line(const TQString& type, const TQString& label)
{ 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";
QString msg = ext_form ? i18n("Hide extended form") : i18n("Show extended form");
TQString cmd = ext_form ? "0" : "1";
TQString msg = ext_form ? i18n("Hide extended form") : i18n("Show extended form");
KURL url(query);
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 */
QString AptProtocol::make_html_form() const
TQString AptProtocol::make_html_form() const
{
bool can_fsearch = false;
bool ext_form = KGlobal::config() -> readBoolEntry("extended_form", true);
@ -190,8 +190,8 @@ QString AptProtocol::make_html_form() const
if (m_adept_batch)
online = online_form && (!m_internal) && ext_form && m_adept_batch -> capabilities(PackageManager::ONLINE);
QString ret;
QTextOStream stream(&ret);
TQString ret;
TQTextOStream stream(&ret);
stream << make_extform_cmd(ext_form, m_query);
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("show", i18n("Package info"));
}
stream << html_form_end.arg( i18n("Search") );
stream << html_form_end.tqarg( i18n("Search") );
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 ),
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") );
connect(&m_process, SIGNAL(token(const QString&, const QString&)),
this, SLOT(token_dispatch(const QString&, const QString&)));
connect(&m_process, TQT_SIGNAL(token(const TQString&, const TQString&)),
this, TQT_SLOT(token_dispatch(const TQString&, const TQString&)));
m_adept_batch = new Dpkg(this);
if (m_adept_batch)
{
connect(m_adept_batch, SIGNAL(token(const QString&, const QString&)),
this, SLOT(token_dispatch(const QString&, const QString&)));
connect(m_adept_batch, TQT_SIGNAL(token(const TQString&, const TQString&)),
this, TQT_SLOT(token_dispatch(const TQString&, const TQString&)));
}
}
AptProtocol::~AptProtocol() {}
QString AptProtocol::stylesheet() const { return m_stylesheet; }
QString AptProtocol::logo() const { return m_logo; }
QString AptProtocol::logo_alt() const { return m_logo_alt; }
QString AptProtocol::header_background() const { return m_header_background; }
TQString AptProtocol::stylesheet() const { return m_stylesheet; }
TQString AptProtocol::logo() const { return m_logo; }
TQString AptProtocol::logo_alt() const { return m_logo_alt; }
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())
(*m_parser)(this, name, val);
}
void AptProtocol::data(const QCString& string)
void AptProtocol::data(const TQCString& string)
{
using namespace Parsers;
(*this) << string;
}
void AptProtocol::data(const QString& string)
void AptProtocol::data(const TQString& string)
{
using namespace Parsers;
(*this) << string;
@ -279,7 +279,7 @@ void AptProtocol::data(const char* string)
(*this) << string;
}
void AptProtocol::data(const QByteArray& array)
void AptProtocol::data(const TQByteArray& array)
{ SlaveBase::data(array); }
void AptProtocol::mimetype( const KURL & /*url*/ )
@ -288,12 +288,12 @@ void AptProtocol::mimetype( const KURL & /*url*/ )
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))
{
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 true;
@ -304,10 +304,10 @@ bool AptProtocol::check_validpackage(const QString& query)
* 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;
QString ret = map[name];
if (!map.tqcontains(name)) return def;
TQString ret = map[name];
map.remove(name);
return ret;
}
@ -324,23 +324,23 @@ void AptProtocol::get ( const KURL& url )
apt:/
*/
typedef void (AptProtocol::*Command)(const QString&, const QueryOptions&);
static const QString commands[] =
typedef void (AptProtocol::*Command)(const TQString&, const QueryOptions&);
static const TQString commands[] =
{ "search", "show", "policy",
"fsearch", "list", "online",
"get", QString::null };
"get", TQString() };
static const Command methods[] =
{ &AptProtocol::search, &AptProtocol::show, &AptProtocol::policy,
&AptProtocol::searchfile, &AptProtocol::listfiles, &AptProtocol::online,
&AptProtocol::adept_batch };
QString command, query;
TQString command, query;
Command method = 0;
QueryOptions options = url.queryItems(KURL::CaseInsensitiveKeys);
// canonize the part before ? : remove the first /
QString path = url.path();
QString host = url.host();
TQString path = url.path();
TQString host = url.host();
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)
{
const QString cmd_it = commands[cmd_idx];
const TQString cmd_it = commands[cmd_idx];
// Look if the command is in the path part
if (command.isEmpty() && cmd_it == path)
@ -360,7 +360,7 @@ void AptProtocol::get ( const KURL& url )
command = cmd_it;
method = methods[cmd_idx];
}
if (options.contains(cmd_it))
if (options.tqcontains(cmd_it))
{
if (options[cmd_it].isEmpty() && !options[cmd_it].isNull())
@ -393,7 +393,7 @@ void AptProtocol::get ( const KURL& url )
// Interpret the ioslave config options
// 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())
{
bool ext_form = (opt != "0");
@ -442,7 +442,7 @@ void AptProtocol::get ( const KURL& url )
if (m_query != url)
{
redirection(m_query);
data(QByteArray());
data(TQByteArray());
finished();
return;
}
@ -462,14 +462,14 @@ void AptProtocol::help()
{
mimeType("text/html");
QString buffer;
QTextOStream stream(&buffer);
TQString buffer;
TQTextOStream stream(&buffer);
stream
<< open_html_head(i18n("Search Form"), false, *this)
<< make_html_form()
<< make_html_tail(QString::null, false);
<< make_html_tail(TQString(), false);
data(buffer);
data(QByteArray());
data(TQByteArray());
finished();
}
@ -483,23 +483,23 @@ void AptProtocol::help()
* apt-cache search
*/
void AptProtocol::search( const QString& query, const QueryOptions& /*options*/ )
void AptProtocol::search( const TQString& query, const QueryOptions& /*options*/ )
{
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)(this, "begin", 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;
}
(*m_parser)(this, "end", QString::null);
(*m_parser)(this, "end", TQString());
data(make_html_tail( i18n("%1 results").arg(m_parser -> result_count())) );
data(QByteArray());
data(make_html_tail( i18n("%1 results").tqarg(m_parser -> result_count())) );
data(TQByteArray());
finished();
}
@ -512,10 +512,10 @@ void AptProtocol::search( const QString& query, const QueryOptions& /*options*/
* 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";
QString msg = show_filelist ? i18n("Hide file list") : i18n("Show file list");
TQString value = show_filelist ? "0" : "1";
TQString msg = show_filelist ? i18n("Hide file list") : i18n("Show file list");
KURL url(query);
url.addQueryItem("show_filelist", value);
@ -529,11 +529,11 @@ static QString filelist_cmd(bool show_filelist, const KURL& query)
"</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 (options.contains("show_filelist"))
if (options.tqcontains("show_filelist"))
{
KGlobal::config() -> writeEntry("show_filelist", options["show_filelist"] != "0");
KGlobal::config() -> sync();
@ -541,7 +541,7 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
mimeType("text/html");
QString installed_version;
TQString installed_version;
/** First, we parse policy
* 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 */
Parsers::Policy* policy = new Parsers::Policy(package, m_act);
m_parser.reset(policy);
(*m_parser)(this, "begin", QString::null);
(*m_parser)(this, "begin", TQString());
{
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;
}
installed_version = policy->getInstalled();
bool can_list = can_listfiles(!installed_version.isEmpty());
QString buffer;
QTextOStream s(&buffer);
TQString buffer;
TQTextOStream s(&buffer);
if (can_list)
{
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"), "")
<< close_html_head();
}
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);
}
(*m_parser)(this, "end", QString::null);
(*m_parser)(this, "end", TQString());
/** Add package description section */
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))
{
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;
}
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(QByteArray());
data(TQByteArray());
finished();
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");
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))
{
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;
}
(*m_parser)(this, "end", QString::null);
(*m_parser)(this, "end", TQString());
data("\n</div>\n");
}
@ -637,7 +637,7 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
data(make_html_tail());
data(QByteArray());
data(TQByteArray());
finished();
}
@ -648,25 +648,25 @@ void AptProtocol::show(const QString& package, const QueryOptions& options)
* 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;
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)(this, "begin", QString::null);
(*m_parser)(this, "begin", TQString());
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;
}
(*m_parser)(this, "end", QString::null);
(*m_parser)(this, "end", TQString());
data(make_html_tail());
data(QByteArray());
data(TQByteArray());
finished();
}
@ -676,7 +676,7 @@ void AptProtocol::policy( const QString& query, const QueryOptions& /*options*/
* Search the package which contains a specific file
*/
static const QString
static const TQString
html_dpkgs_begin("\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;
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;
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)(this, "begin", QString::null);
(*m_parser)(this, "begin", TQString());
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;
}
(*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(QByteArray());
data( html_dpkgs_end + make_html_tail(i18n("%1 files found").tqarg(m_parser -> result_count())) );
data(TQByteArray());
finished();
}
@ -724,7 +724,7 @@ bool AptProtocol::can_listfiles(bool is_installed) const
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 (!check_validpackage(query)) return;
@ -733,26 +733,26 @@ void AptProtocol::listfiles(const QString& query, const QueryOptions& /*options*
KURL ret_url = buildURL("show", query);
QString buffer;
QTextOStream stream(&buffer);
TQString buffer;
TQTextOStream stream(&buffer);
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"), "")
<< close_html_head()
<< endl;
data(buffer);
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 ))
{
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;
}
(*m_parser)(this, "end", QString::null);
(*m_parser)(this, "end", TQString());
data(make_html_tail());
data(QByteArray());
data(TQByteArray());
finished();
}
@ -770,9 +770,9 @@ void AptProtocol::listfiles(const QString& query, const QueryOptions& /*options*
// 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);
finished();
return;
@ -781,15 +781,15 @@ void AptProtocol::online(const QString& query, const QueryOptions& options)
/***********************************************************************************
* 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;
QString command;
QString url;
QStringList plist;
QStringList puninst;
QStringList pinst;
TQString command;
TQString url;
TQStringList plist;
TQStringList puninst;
TQStringList pinst;
int pcount;
int ip;
@ -805,29 +805,29 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
return;
}
if (!options.contains("package"))
if (!options.tqcontains("package"))
{
error(ERR_SLAVE_DEFINED, i18n("No package specified"));
return;
}
plist = QStringList::split(", ", options["package"], false);
plist = TQStringList::split(", ", options["package"], false);
pcount = plist.count();
command += plist.join(" ");
if (pcount == 1)
{
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
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
{
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
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;
@ -841,15 +841,15 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
for(int i = 0; i != pcount; ++i)
{
QString installed_version;
TQString installed_version;
Parsers::Policy* policy = new Parsers::Policy(plist[i], m_act);
m_parser.reset(policy);
(*m_parser)(this, "begin", QString::null);
(*m_parser)(this, "begin", TQString());
{
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;
}
@ -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)
{
@ -873,8 +873,8 @@ void AptProtocol::adept_batch(const QString& query, const QueryOptions& options)
}
else
{
QString toto = puninst.join(" ");
messageBox(Information,i18n("There was a problem installing %1.").arg(toto));
TQString toto = puninst.join(" ");
messageBox(Information,i18n("There was a problem installing %1.").tqarg(toto));
}
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
url += plist[0];
redirection(url);
data(QByteArray());
data(TQByteArray());
finished();
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;
url.setProtocol("apt");

@ -1,8 +1,8 @@
#ifndef KIOAPT_APTPROTOCOL_H
#define KIOAPT_APTPROTOCOL_H
#include <qstring.h>
#include <qcstring.h>
#include <tqstring.h>
#include <tqcstring.h>
#include <kurl.h>
#include <kio/global.h>
@ -14,22 +14,23 @@
#include <memory>
class QCString;
class TQCString;
namespace Parsers
{
class Parser;
}
class AptProtocol : public QObject, public KIO::SlaveBase {
class AptProtocol : public TQObject, public KIO::SlaveBase {
Q_OBJECT
TQ_OBJECT
friend class AptCache;
AptCache m_process;
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
* 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) */
bool m_act, m_search, m_internal;
QString m_stylesheet;
QString m_header_background;
QString m_logo;
QString m_logo_alt;
TQString m_stylesheet;
TQString m_header_background;
TQString m_logo;
TQString m_logo_alt;
public:
AptProtocol( const QCString &pool_socket, const QCString &app_socket );
AptProtocol( const TQCString &pool_socket, const TQCString &app_socket );
virtual ~AptProtocol();
virtual void mimetype( const KURL& url );
virtual void get ( const KURL& url );
@ -63,26 +64,26 @@ public:
* SlaveBase::data() sends a byte array as is. Since we
* definitely don't want to send \0 to the master,
* we redefine data() for strings */
void data(const QCString& string);
void data(const TQCString& string);
/** @overload */
void data(const QString& string);
void data(const TQString& string);
/** @overload */
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;
QString stylesheet() const;
QString header_background() const;
QString logo() const;
QString logo_alt() const;
TQString stylesheet() const;
TQString header_background() const;
TQString logo() const;
TQString logo_alt() const;
private slots:
void token_dispatch(const QString& tag, const QString& value);
void token_dispatch(const TQString& tag, const TQString& value);
private:
std::auto_ptr<Parsers::Parser> m_parser;
@ -90,24 +91,24 @@ private:
/** apt-cache search
* Performs apt-cache search, with the query encoded in url.query()
* 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
* Performs apt-cache search, with the package name encoded in url.query()
* and sends the result as an HTML file.
* 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
* Performs apt-cache policy, with the package name encoded in url.query()
* and sends the result as an HTML file.
* 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
* 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
@ -116,19 +117,19 @@ private:
/** Offline listing of the file of a package */
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.
* Searches the package which contains the specified file */
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;
void online( const QString& query, const QueryOptions& options);
void online( const TQString& query, const QueryOptions& options);
bool check_validpackage(const QString& query);
QString make_html_form() const;
QString make_html_tail(const QString& note = QString::null, bool with_form = true);
bool check_validpackage(const TQString& query);
TQString make_html_form() const;
TQString make_html_tail(const TQString& note = TQString(), bool with_form = true);
KShellProcess * p;

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

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

@ -16,15 +16,15 @@
#include <klocale.h>
#include <kdebug.h>
#include <qstringlist.h>
#include <qregexp.h>
#include <tqstringlist.h>
#include <tqregexp.h>
Dpkg::Dpkg(QObject *parent, const char *name)
: PackageManager(parent, name)
Dpkg::Dpkg(TQObject *tqparent, const char *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()
@ -46,15 +46,15 @@ void Dpkg::readReady(KProcIO*)
{
bool partial;
QString newline;
QStringList lines;
TQString newline;
TQStringList lines;
while(m_process.readln(newline, true, &partial) != -1)
{
if (partial) m_buffer += newline;
else
{
newline.truncate(newline.length());
QString line(m_buffer + newline);
TQString line(m_buffer + newline);
lines << line;
m_buffer = "";
}
@ -64,10 +64,10 @@ void Dpkg::readReady(KProcIO*)
(this->*m_receive)(lines);
}
bool Dpkg::search( const QString & file )
bool Dpkg::search( const TQString & file )
{
m_process.resetAll();
m_buffer = QString::null;
m_buffer = TQString();
m_process.clearArguments();
m_process << "dpkg" << "-S" << file;
@ -75,41 +75,41 @@ bool Dpkg::search( const QString & file )
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
// 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;
if ((*i).isEmpty()) continue;
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;
}
int semicolon = (*i).find(':');
int semicolon = (*i).tqfind(':');
if (semicolon == -1)
{
kdDebug(DEBUG_ZONE) << "receiveSearch unmatched line : " << *i << endl;
continue;
}
QStringList packages = QStringList::split(',', (*i).left(semicolon));
QString file = (*i).right( (*i).length() - semicolon - 1 );
TQStringList packages = TQStringList::split(',', (*i).left(semicolon));
TQString file = (*i).right( (*i).length() - semicolon - 1 );
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());
}
}
bool Dpkg::list( const QString & package )
bool Dpkg::list( const TQString & package )
{
m_process.resetAll();
m_buffer = QString::null;
m_buffer = TQString();
m_process.clearArguments();
m_process << "dpkg" << "-L" << package;
@ -117,25 +117,25 @@ bool Dpkg::list( const QString & package )
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");
for (QStringList::ConstIterator i = line.begin(); i != line.end(); ++i)
static TQRegExp rx_notfound("Package (.*) is not installed");
for (TQStringList::ConstIterator i = line.begin(); i != line.end(); ++i)
{
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("/"))
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"
"<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"; }
static const QString
static const TQString
html_form_end("<tr>\n"
"\t<td class=\"button\" colspan=\"2\">\n"
"\t\t<input type=\"submit\" value=\"%1\">\n"
@ -146,38 +146,38 @@ static const QString
"</table>\n"
"</form>\n");
static const QString
static const TQString
html_form_line_begin("<tr>\n"
"\t<td><label for=\"%1\">%2</label></td>\n"
"\t<td>\n");
static const QString
static const TQString
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
html_form_line_begin.arg(type).arg(label)
+ QString("<input type=\"text\" name=\"%1\" id=\"%2\">").arg(type).arg(type)
html_form_line_begin.tqarg(type).tqarg(label)
+ TQString("<input type=\"text\" name=\"%1\" id=\"%2\">").tqarg(type).tqarg(type)
+ 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
html_form_line_begin.arg(type).arg(label)
+ QString("\t<select name=\"%1\" id=\"%2\">\n").arg(type).arg(type);
html_form_line_begin.tqarg(type).tqarg(label)
+ 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"; }
static QString end_form_combo()
static TQString end_form_combo()
{ return "\t</select>\n\t</td>\n</tr>\n"; }
QString Dpkg::getOnlineForm()
TQString Dpkg::getOnlineForm()
{
QString buffer;
QTextOStream stream(&buffer);
TQString buffer;
TQTextOStream stream(&buffer);
stream
<< html_form_begin
<< make_title( i18n("packages.ubuntu.com"))
@ -201,7 +201,7 @@ QString Dpkg::getOnlineForm()
<< make_form_option("warty", "warty")
<< end_form_combo()
<< html_form_end.arg(i18n("Go online!"));
<< html_form_end.tqarg(i18n("Go online!"));
return buffer;
}

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

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

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

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

@ -13,7 +13,7 @@
#include <kio/slavebase.h>
#include <klocale.h>
#include <qregexp.h>
#include <tqregexp.h>
#include <kurl.h>
namespace Parsers
@ -22,11 +22,11 @@ namespace Parsers
: m_links(links) {}
/** 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")
{
@ -62,7 +62,7 @@ namespace Parsers
files.sort();
*slave <<
"<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();
}
}

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

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

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

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

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

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

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

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

Loading…
Cancel
Save