diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 21:38:25 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 21:38:25 +0000 |
commit | f22f5c856d0ee7ec953825828bba094f14c9cade (patch) | |
tree | 1c89a4d4c420bce13c002b650e610bff026f6d06 /src/dpkg.cpp | |
parent | 0bceb5251f3c826f8fc4ee021ab76ee29f1dfdd7 (diff) | |
download | tdeio-apt-f22f5c856d0ee7ec953825828bba094f14c9cade.tar.gz tdeio-apt-f22f5c856d0ee7ec953825828bba094f14c9cade.zip |
TQt4 port kio-apt
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kio-apt@1239302 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/dpkg.cpp')
-rw-r--r-- | src/dpkg.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/dpkg.cpp b/src/dpkg.cpp index 0a95851..cb19488 100644 --- a/src/dpkg.cpp +++ b/src/dpkg.cpp @@ -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; } |