diff options
Diffstat (limited to 'lib/compatibility/knewstuff/downloaddialog.cpp')
-rw-r--r-- | lib/compatibility/knewstuff/downloaddialog.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/lib/compatibility/knewstuff/downloaddialog.cpp b/lib/compatibility/knewstuff/downloaddialog.cpp index be3cf66d..b14ff38b 100644 --- a/lib/compatibility/knewstuff/downloaddialog.cpp +++ b/lib/compatibility/knewstuff/downloaddialog.cpp @@ -37,28 +37,28 @@ #include <knewstuff/knewstuffgeneric.h> #include <knewstuff/engine.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qdom.h> -#include <qlabel.h> -#include <qtextbrowser.h> -#include <qtimer.h> // hack +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqdom.h> +#include <tqlabel.h> +#include <tqtextbrowser.h> +#include <tqtimer.h> // hack using namespace KNS; class NumSortListViewItem : public KListViewItem { public: - NumSortListViewItem( QListView * parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null ) : + NumSortListViewItem( TQListView * parent, TQString label1, TQString label2 = TQString::null, TQString label3 = TQString::null, TQString label4 = TQString::null, TQString label5 = TQString::null, TQString label6 = TQString::null, TQString label7 = TQString::null, TQString label8 = TQString::null ) : KListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 ) { } - QString key(int col, bool asc) const { + TQString key(int col, bool asc) const { if (col == 2) { - QString s; + TQString s; s.sprintf("%08d", text(col).toInt()); return s; } @@ -67,21 +67,21 @@ class NumSortListViewItem : public KListViewItem }; // BEGIN deprecated for KDE 4 -DownloadDialog::DownloadDialog(Engine *engine, QWidget *) +DownloadDialog::DownloadDialog(Engine *engine, TQWidget *) : KDialogBase(KDialogBase::IconList, i18n("Get Hot New Stuff"), KDialogBase::Close, KDialogBase::Close) { init(engine); } -DownloadDialog::DownloadDialog(QWidget *) +DownloadDialog::DownloadDialog(TQWidget *) : KDialogBase(KDialogBase::IconList, i18n("Get Hot New Stuff"), KDialogBase::Close, KDialogBase::Close) { init(0); } -void DownloadDialog::open(QString type) +void DownloadDialog::open(TQString type) { DownloadDialog d; d.setType(type); @@ -90,14 +90,14 @@ void DownloadDialog::open(QString type) } // END deprecated for KDE 4 -DownloadDialog::DownloadDialog(Engine *engine, QWidget *, const QString& caption) +DownloadDialog::DownloadDialog(Engine *engine, TQWidget *, const TQString& caption) : KDialogBase(KDialogBase::IconList, (caption.isNull() ? i18n("Get Hot New Stuff") : caption), KDialogBase::Close, KDialogBase::Close) { init(engine); } -DownloadDialog::DownloadDialog(QWidget *, const QString& caption) +DownloadDialog::DownloadDialog(TQWidget *, const TQString& caption) : KDialogBase(KDialogBase::IconList, (caption.isNull() ? i18n("Get Hot New Stuff") : caption), KDialogBase::Close, KDialogBase::Close) { @@ -111,12 +111,12 @@ void DownloadDialog::init(Engine *engine) m_engine = engine; m_page = NULL; - connect(this, SIGNAL(aboutToShowPage(QWidget*)), SLOT(slotPage(QWidget*))); + connect(this, TQT_SIGNAL(aboutToShowPage(TQWidget*)), TQT_SLOT(slotPage(TQWidget*))); if(!engine) { m_loader = new ProviderLoader(this); - connect(m_loader, SIGNAL(providersLoaded(Provider::List*)), SLOT(slotProviders(Provider::List*))); + connect(m_loader, TQT_SIGNAL(providersLoaded(Provider::List*)), TQT_SLOT(slotProviders(Provider::List*))); } } @@ -129,17 +129,17 @@ void DownloadDialog::load() m_loader->load(m_filter, m_providerlist); } -void DownloadDialog::load(QString providerList) +void DownloadDialog::load(TQString providerList) { m_loader->load(m_filter, providerList); } void DownloadDialog::clear() { - QMap<QWidget*, QValueList<KListView*>* >::Iterator it; + TQMap<TQWidget*, TQValueList<KListView*>* >::Iterator it; for(it = m_map.begin(); it != m_map.end(); ++it) { - QValueList<KListView*> *v = it.data(); + TQValueList<KListView*> *v = it.data(); kdDebug() << "clear listviews in " << v << endl; if(v) { @@ -158,7 +158,7 @@ void DownloadDialog::clear() void DownloadDialog::slotProviders(Provider::List *list) { Provider *p; - /*QFrame *frame;*/ + /*TQFrame *frame;*/ for(p = list->first(); p; p = list->next()) { @@ -175,19 +175,19 @@ void DownloadDialog::slotProviders(Provider::List *list) void DownloadDialog::addProvider(Provider *p) { - QFrame *frame; + TQFrame *frame; KTabCtl *ctl; - QWidget *w_d, *w_r, *w_l; - QWidget *w2; + TQWidget *w_d, *w_r, *w_l; + TQWidget *w2; KListView *lvtmp_r, *lvtmp_d, *lvtmp_l; - QTextBrowser *rt; - QString tmp; + TQTextBrowser *rt; + TQString tmp; int ret; - QPixmap pix; + TQPixmap pix; if(m_map.count() == 0) { - frame = addPage(i18n("Welcome"), i18n("Welcome"), QPixmap("")); + frame = addPage(i18n("Welcome"), i18n("Welcome"), TQPixmap("")); delete frame; } @@ -196,15 +196,15 @@ void DownloadDialog::addProvider(Provider *p) ret = true; if(!p->icon().isValid()) ret = false; else ret = KIO::NetAccess::download(p->icon(), tmp, this); - if(ret) pix = QPixmap(tmp); + if(ret) pix = TQPixmap(tmp); else pix = KGlobal::iconLoader()->loadIcon("knewstuff", KIcon::Panel); frame = addPage(p->name(), p->name(), pix); m_frame = frame; - w2 = new QWidget(frame); - w_d = new QWidget(frame); - w_r = new QWidget(frame); - w_l = new QWidget(frame); + w2 = new TQWidget(frame); + w_d = new TQWidget(frame); + w_r = new TQWidget(frame); + w_l = new TQWidget(frame); ctl = new KTabCtl(frame); ctl->addTab(w_r, i18n("Highest Rated")); @@ -212,9 +212,9 @@ void DownloadDialog::addProvider(Provider *p) ctl->addTab(w_l, i18n("Latest")); m_curtab = 0; - connect(ctl, SIGNAL(tabSelected(int)), SLOT(slotTab(int))); + connect(ctl, TQT_SIGNAL(tabSelected(int)), TQT_SLOT(slotTab(int))); - QHBoxLayout *box = new QHBoxLayout(frame); + TQHBoxLayout *box = new TQHBoxLayout(frame); box->add(ctl); lvtmp_r = new KListView(w_r); @@ -235,40 +235,40 @@ void DownloadDialog::addProvider(Provider *p) lvtmp_l->addColumn(i18n("Release Date")); lvtmp_l->setSorting(2, false); - connect(lvtmp_r, SIGNAL(selectionChanged()), SLOT(slotSelected())); - connect(lvtmp_d, SIGNAL(selectionChanged()), SLOT(slotSelected())); - connect(lvtmp_l, SIGNAL(selectionChanged()), SLOT(slotSelected())); + connect(lvtmp_r, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelected())); + connect(lvtmp_d, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelected())); + connect(lvtmp_l, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelected())); - rt = new QTextBrowser(frame); + rt = new TQTextBrowser(frame); rt->setMinimumWidth(150); - QPushButton *in = new QPushButton(i18n("Install"), frame); - QPushButton *de = new QPushButton(i18n("Details"), frame); + TQPushButton *in = new TQPushButton(i18n("Install"), frame); + TQPushButton *de = new TQPushButton(i18n("Details"), frame); in->setEnabled(false); de->setEnabled(false); box->addSpacing(spacingHint()); - QVBoxLayout *vbox = new QVBoxLayout(box); + TQVBoxLayout *vbox = new TQVBoxLayout(box); vbox->add(rt); vbox->addSpacing(spacingHint()); vbox->add(de); vbox->add(in); - connect(in, SIGNAL(clicked()), SLOT(slotInstall())); - connect(de, SIGNAL(clicked()), SLOT(slotDetails())); + connect(in, TQT_SIGNAL(clicked()), TQT_SLOT(slotInstall())); + connect(de, TQT_SIGNAL(clicked()), TQT_SLOT(slotDetails())); - QVBoxLayout *box2 = new QVBoxLayout(w_r); + TQVBoxLayout *box2 = new TQVBoxLayout(w_r); box2->add(lvtmp_r); - QVBoxLayout *box3 = new QVBoxLayout(w_d); + TQVBoxLayout *box3 = new TQVBoxLayout(w_d); box3->add(lvtmp_d); - QVBoxLayout *box4 = new QVBoxLayout(w_l); + TQVBoxLayout *box4 = new TQVBoxLayout(w_l); box4->add(lvtmp_l); - QValueList<KListView*> *v = new QValueList<KListView*>; + TQValueList<KListView*> *v = new TQValueList<KListView*>; *v << lvtmp_r << lvtmp_d << lvtmp_l; m_map[frame] = v; m_rts[frame] = rt; - QValueList<QPushButton*> *vb = new QValueList<QPushButton*>; + TQValueList<TQPushButton*> *vb = new TQValueList<TQPushButton*>; *vb << in << de; m_buttons[frame] = vb; m_providers[frame] = p; @@ -277,13 +277,13 @@ void DownloadDialog::addProvider(Provider *p) if(m_engine) slotPage(frame); - QTimer::singleShot(100, this, SLOT(slotFinish())); + TQTimer::singleShot(100, this, TQT_SLOT(slotFinish())); } void DownloadDialog::slotResult(KIO::Job *job) { - QDomDocument dom; - QDomElement knewstuff; + TQDomDocument dom; + TQDomElement knewstuff; kdDebug() << "got data: " << m_data[job] << endl; @@ -292,9 +292,9 @@ void DownloadDialog::slotResult(KIO::Job *job) dom.setContent(m_data[job]); knewstuff = dom.documentElement(); - for(QDomNode pn = knewstuff.firstChild(); !pn.isNull(); pn = pn.nextSibling()) + for(TQDomNode pn = knewstuff.firstChild(); !pn.isNull(); pn = pn.nextSibling()) { - QDomElement stuff = pn.toElement(); + TQDomElement stuff = pn.toElement(); kdDebug() << "element: " << stuff.tagName() << endl; @@ -323,8 +323,8 @@ void DownloadDialog::slotResult(KIO::Job *job) int DownloadDialog::installStatus(Entry *entry) { - QDate date; - QString datestring; + TQDate date; + TQString datestring; int installed; kapp->config()->setGroup("KNewStuffStatus"); @@ -332,7 +332,7 @@ int DownloadDialog::installStatus(Entry *entry) if(datestring.isNull()) installed = 0; else { - date = QDate::fromString(datestring, Qt::ISODate); + date = TQDate::fromString(datestring, Qt::ISODate); if(!date.isValid()) installed = 0; else if(date < entry->releaseDate()) installed = -1; else installed = 1; @@ -343,14 +343,14 @@ int DownloadDialog::installStatus(Entry *entry) void DownloadDialog::addEntry(Entry *entry) { - QPixmap pix; + TQPixmap pix; int installed; /*if(m_engine) { if(m_map.count() == 0) { - m_frame = addPage(i18n("Welcome"), i18n("Welcome"), QPixmap("")); + m_frame = addPage(i18n("Welcome"), i18n("Welcome"), TQPixmap("")); Provider *p = new Provider(); p->setName(i18n("Generic")); addProvider(p); @@ -361,12 +361,12 @@ void DownloadDialog::addEntry(Entry *entry) if(installed > 0) pix = KGlobal::iconLoader()->loadIcon("ok", KIcon::Small); else if(installed < 0) pix = KGlobal::iconLoader()->loadIcon("history", KIcon::Small); - else pix = QPixmap(); + else pix = TQPixmap(); KListViewItem *tmp_r = new KListViewItem(lv_r, - entry->name(), entry->version(), QString("%1").arg(entry->rating())); + entry->name(), entry->version(), TQString("%1").arg(entry->rating())); KListViewItem *tmp_d = new NumSortListViewItem(lv_d, - entry->name(), entry->version(), QString("%1").arg(entry->downloads())); + entry->name(), entry->version(), TQString("%1").arg(entry->downloads())); KListViewItem *tmp_l = new KListViewItem(lv_l, entry->name(), entry->version(), KGlobal::locale()->formatDate(entry->releaseDate())); @@ -379,10 +379,10 @@ void DownloadDialog::addEntry(Entry *entry) kdDebug() << "added entry " << entry->name() << endl; } -void DownloadDialog::slotData(KIO::Job *job, const QByteArray &a) +void DownloadDialog::slotData(KIO::Job *job, const TQByteArray &a) { - QCString tmp(a, a.size() + 1); - m_data[job].append(QString::fromUtf8(tmp)); + TQCString tmp(a, a.size() + 1); + m_data[job].append(TQString::fromUtf8(tmp)); } void DownloadDialog::slotDetails() @@ -390,9 +390,9 @@ void DownloadDialog::slotDetails() Entry *e = getEntry(); if(!e) return; - QString lang = KGlobal::locale()->language(); + TQString lang = KGlobal::locale()->language(); - QString info = i18n + TQString info = i18n ( "Name: %1\n" "Author: %2\n" @@ -447,7 +447,7 @@ void DownloadDialog::slotInstall() KURL dest = KURL(m_s->downloadDestination(e)); KIO::FileCopyJob *job = KIO::file_copy(source, dest, -1, true); - connect(job, SIGNAL(result(KIO::Job*)), SLOT(slotInstalled(KIO::Job*))); + connect(job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotInstalled(KIO::Job*))); } } @@ -457,7 +457,7 @@ void DownloadDialog::install(Entry *e) kapp->config()->writeEntry(m_entryname, e->releaseDate().toString(Qt::ISODate)); kapp->config()->sync(); - QPixmap pix = KGlobal::iconLoader()->loadIcon("ok", KIcon::Small); + TQPixmap pix = KGlobal::iconLoader()->loadIcon("ok", KIcon::Small); m_entryitem = lv_r->findItem(m_entryname, 0); if(m_entryitem) m_entryitem->setPixmap(0, pix); m_entryitem = lv_d->findItem(m_entryname, 0); @@ -466,7 +466,7 @@ void DownloadDialog::install(Entry *e) if(m_entryitem) m_entryitem->setPixmap(0, pix); - QPushButton *in; + TQPushButton *in; in = *(m_buttons[m_page]->at(0)); if(in) in->setEnabled(false); } @@ -505,29 +505,29 @@ void DownloadDialog::slotTab(int tab) void DownloadDialog::slotSelected() { - QString tmp; + TQString tmp; bool enabled; Entry *e = getEntry(); - QString lang = KGlobal::locale()->language(); + TQString lang = KGlobal::locale()->language(); if(e) { if(!e->preview(lang).isValid()) { - m_rt->setText(QString("<b>%1</b><br>%2<br>%3<br><br><i>%4</i><br>(%5)").arg( + m_rt->setText(TQString("<b>%1</b><br>%2<br>%3<br><br><i>%4</i><br>(%5)").arg( e->name()).arg(e->author()).arg(KGlobal::locale()->formatDate(e->releaseDate())).arg(e->summary(lang)).arg(e->license())); } else { KIO::NetAccess::download(e->preview(lang), tmp, this); - m_rt->setText(QString("<b>%1</b><br>%2<br>%3<br><br><img src='%4'><br><i>%5</i><br>(%6)").arg( + m_rt->setText(TQString("<b>%1</b><br>%2<br>%3<br><br><img src='%4'><br><i>%5</i><br>(%6)").arg( e->name()).arg(e->author()).arg(KGlobal::locale()->formatDate(e->releaseDate())).arg(tmp).arg(e->summary(lang)).arg(e->license())); } if(installStatus(e) == 1) enabled = false; else enabled = true; - QPushButton *de, *in; + TQPushButton *de, *in; in = *(m_buttons[m_page]->at(0)); de = *(m_buttons[m_page]->at(1)); if(in) in->setEnabled(enabled); @@ -552,7 +552,7 @@ Entry *DownloadDialog::getEntry() return 0; } -void DownloadDialog::slotPage(QWidget *w) +void DownloadDialog::slotPage(TQWidget *w) { Provider *p; @@ -589,17 +589,17 @@ void DownloadDialog::loadProvider(Provider *p) m_jobs[job] = p; - connect(job, SIGNAL(result(KIO::Job*)), SLOT(slotResult(KIO::Job*))); - connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); + connect(job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotResult(KIO::Job*))); + connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); } -void DownloadDialog::setType(QString type) +void DownloadDialog::setType(TQString type) { m_filter = type; } -void DownloadDialog::setProviderList(const QString& providerList) +void DownloadDialog::setProviderList(const TQString& providerList) { m_providerlist = providerList; } @@ -612,7 +612,7 @@ void DownloadDialog::slotApply() { } -void DownloadDialog::open(const QString& type, const QString& caption) +void DownloadDialog::open(const TQString& type, const TQString& caption) { DownloadDialog d(0, caption); d.setType(type); |