diff options
Diffstat (limited to 'src/newstuff')
-rw-r--r-- | src/newstuff/dialog.cpp | 246 | ||||
-rw-r--r-- | src/newstuff/dialog.h | 47 | ||||
-rw-r--r-- | src/newstuff/manager.cpp | 170 | ||||
-rw-r--r-- | src/newstuff/manager.h | 47 | ||||
-rw-r--r-- | src/newstuff/newscript.cpp | 10 | ||||
-rw-r--r-- | src/newstuff/newscript.h | 9 | ||||
-rw-r--r-- | src/newstuff/providerloader.cpp | 38 | ||||
-rw-r--r-- | src/newstuff/providerloader.h | 27 |
8 files changed, 299 insertions, 295 deletions
diff --git a/src/newstuff/dialog.cpp b/src/newstuff/dialog.cpp index c13a249..6cacc72 100644 --- a/src/newstuff/dialog.cpp +++ b/src/newstuff/dialog.cpp @@ -30,15 +30,15 @@ #include <knewstuff/provider.h> #include <ktempfile.h> -#include <qlabel.h> -#include <qtextedit.h> -#include <qlayout.h> -#include <qwhatsthis.h> -#include <qregexp.h> -#include <qvbox.h> -#include <qimage.h> -#include <qtimer.h> -#include <qprogressbar.h> +#include <tqlabel.h> +#include <tqtextedit.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include <tqregexp.h> +#include <tqvbox.h> +#include <tqimage.h> +#include <tqtimer.h> +#include <tqprogressbar.h> #if KDE_IS_VERSION(3,4,90) #define ENTRYNAME(e) e->name(m_lang) @@ -47,7 +47,7 @@ #else #define ENTRYNAME(e) e->name() #define ENTRYSUMM(e) e->summary() -#define ENTRYEMAIL(e) QString() +#define ENTRYEMAIL(e) TQString() #endif namespace { @@ -60,26 +60,26 @@ using Tellico::NewStuff::Dialog; class Dialog::Item : public GUI::ListViewItem { public: - Item(GUI::ListView* parent) : GUI::ListViewItem(parent) {} + Item(GUI::ListView* tqparent) : GUI::ListViewItem(tqparent) {} - InstallStatus status() const { return m_status; } - void setStatus(InstallStatus status) { + InstalltqStatus status() const { return m_status; } + void settqStatus(InstalltqStatus status) { m_status = status; if(m_status == Current) { - setPixmap(0, SmallIcon(QString::fromLatin1("ok"))); + setPixmap(0, SmallIcon(TQString::tqfromLatin1("ok"))); } else if(m_status == OldVersion) { - setPixmap(0, SmallIcon(QString::fromLatin1("reload"))); + setPixmap(0, SmallIcon(TQString::tqfromLatin1("reload"))); } } - QString key(int col, bool asc) const { + TQString key(int col, bool asc) const { if(col == 2 || col == 3) { - QString s; + TQString s; s.sprintf("%08d", text(col).toInt()); return s; } else if(col == 4) { - QString s; - QDate date = KGlobal::locale()->readDate(text(col)); + TQString s; + TQDate date = KGlobal::locale()->readDate(text(col)); s.sprintf("%08d", date.year() * 366 + date.dayOfYear()); return s; } @@ -87,162 +87,162 @@ public: } private: - InstallStatus m_status; + InstalltqStatus m_status; }; -Dialog::Dialog(NewStuff::DataType type_, QWidget* parent_) - : KDialogBase(KDialogBase::Plain, i18n("Get Hot New Stuff"), 0, (KDialogBase::ButtonCode)0, parent_) - , m_manager(new Manager(this)) +Dialog::Dialog(NewStuff::DataType type_, TQWidget* tqparent_) + : KDialogBase(KDialogBase::Plain, i18n("Get Hot New Stuff"), 0, (KDialogBase::ButtonCode)0, tqparent_) + , m_manager(new Manager(TQT_TQOBJECT(this))) , m_type(type_) - , m_timer(new QTimer(this)) + , m_timer(new TQTimer(this)) , m_cursorSaver(new GUI::CursorSaver()) , m_tempPreviewImage(0) , m_lastPreviewItem(0) { m_lang = KGlobal::locale()->language(); - QFrame* frame = plainPage(); - QBoxLayout* boxLayout = new QVBoxLayout(frame, 0, KDialog::spacingHint()); + TQFrame* frame = plainPage(); + TQBoxLayout* boxLayout = new TQVBoxLayout(frame, 0, KDialog::spacingHint()); - m_split = new QSplitter(Qt::Vertical, frame); + m_split = new TQSplitter(Qt::Vertical, frame); boxLayout->addWidget(m_split); m_listView = new GUI::ListView(m_split); m_listView->setAllColumnsShowFocus(true); - m_listView->setSelectionMode(QListView::Single); + m_listView->setSelectionMode(TQListView::Single); m_listView->addColumn(i18n("Name")); m_listView->addColumn(i18n("Version")); m_listView->addColumn(i18n("Rating")); m_listView->addColumn(i18n("Downloads")); m_listView->addColumn(i18n("Release Date")); m_listView->setSorting(2, false); - m_listView->setResizeMode(QListView::AllColumns); - connect(m_listView, SIGNAL(clicked(QListViewItem*)), SLOT(slotSelected(QListViewItem*))); - QWhatsThis::add(m_listView, i18n("This is a list of all the items available for download. " + m_listView->setResizeMode(TQListView::AllColumns); + connect(m_listView, TQT_SIGNAL(clicked(TQListViewItem*)), TQT_SLOT(slotSelected(TQListViewItem*))); + TQWhatsThis::add(m_listView, i18n("This is a list of all the items available for download. " "Previously installed items have a checkmark icon, while " "items with new version available have an update icon")); - QWidget* widget = new QWidget(m_split); - QBoxLayout* boxLayout2 = new QVBoxLayout(widget, 0, KDialog::spacingHint()); + TQWidget* widget = new TQWidget(m_split); + TQBoxLayout* boxLayout2 = new TQVBoxLayout(widget, 0, KDialog::spacingHint()); - m_iconLabel = new QLabel(widget); - m_iconLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); + m_iconLabel = new TQLabel(widget); + m_iconLabel->tqsetAlignment(TQt::AlignTop | TQt::AlignLeft); m_iconLabel->setMargin(0); - m_nameLabel = new QLabel(widget); - QFont font = m_nameLabel->font(); + m_nameLabel = new TQLabel(widget); + TQFont font = m_nameLabel->font(); font.setBold(true); font.setItalic(true); m_nameLabel->setFont(font); - QWhatsThis::add(m_nameLabel, i18n("The name and license of the selected item")); + TQWhatsThis::add(m_nameLabel, i18n("The name and license of the selected item")); - m_infoLabel = new QLabel(widget); - QWhatsThis::add(m_infoLabel, i18n("The author of the selected item")); + m_infoLabel = new TQLabel(widget); + TQWhatsThis::add(m_infoLabel, i18n("The author of the selected item")); m_install = new KPushButton(i18n("Install"), widget); - m_install->setIconSet(SmallIconSet(QString::fromLatin1("knewstuff"))); + m_install->setIconSet(SmallIconSet(TQString::tqfromLatin1("knewstuff"))); m_install->setEnabled(false); - connect(m_install, SIGNAL(clicked()), SLOT(slotInstall())); + connect(m_install, TQT_SIGNAL(clicked()), TQT_SLOT(slotInstall())); // the button's text changes later // I don't want it resizing, so figure out the maximum size and set that m_install->polish(); - int maxWidth = m_install->sizeHint().width(); - int maxHeight = m_install->sizeHint().height(); - m_install->setGuiItem(KGuiItem(i18n("Update"), SmallIconSet(QString::fromLatin1("knewstuff")))); - maxWidth = QMAX(maxWidth, m_install->sizeHint().width()); - maxHeight = QMAX(maxHeight, m_install->sizeHint().height()); + int maxWidth = m_install->tqsizeHint().width(); + int maxHeight = m_install->tqsizeHint().height(); + m_install->setGuiItem(KGuiItem(i18n("Update"), SmallIconSet(TQString::tqfromLatin1("knewstuff")))); + maxWidth = TQMAX(maxWidth, m_install->tqsizeHint().width()); + maxHeight = TQMAX(maxHeight, m_install->tqsizeHint().height()); m_install->setMinimumWidth(maxWidth); m_install->setMinimumHeight(maxHeight); - QPixmap pix; + TQPixmap pix; if(m_type == EntryTemplate) { - pix = DesktopIcon(QString::fromLatin1("looknfeel"), KIcon::SizeLarge); - QWhatsThis::add(m_install, i18n("Download and install the selected template.")); + pix = DesktopIcon(TQString::tqfromLatin1("looknfeel"), KIcon::SizeLarge); + TQWhatsThis::add(m_install, i18n("Download and install the selected template.")); } else { - pix = UserIcon(QString::fromLatin1("script")); - QWhatsThis::add(m_install, i18n("Download and install the selected script. Some scripts " + pix = UserIcon(TQString::tqfromLatin1("script")); + TQWhatsThis::add(m_install, i18n("Download and install the selected script. Some scripts " "may need to be configured after being installed.")); } m_iconLabel->setPixmap(pix); - QBoxLayout* boxLayout3 = new QHBoxLayout(boxLayout2); + TQBoxLayout* boxLayout3 = new TQHBoxLayout(boxLayout2); - QBoxLayout* boxLayout4 = new QVBoxLayout(boxLayout3); + TQBoxLayout* boxLayout4 = new TQVBoxLayout(boxLayout3); boxLayout4->addWidget(m_iconLabel); boxLayout4->addStretch(10); boxLayout3->addSpacing(4); - QBoxLayout* boxLayout5 = new QVBoxLayout(boxLayout3); + TQBoxLayout* boxLayout5 = new TQVBoxLayout(boxLayout3); boxLayout5->addWidget(m_nameLabel); boxLayout5->addWidget(m_infoLabel); boxLayout5->addStretch(10); boxLayout3->addStretch(10); - QBoxLayout* boxLayout6 = new QVBoxLayout(boxLayout3); + TQBoxLayout* boxLayout6 = new TQVBoxLayout(boxLayout3); boxLayout6->addWidget(m_install); boxLayout6->addStretch(10); - m_descLabel = new QTextEdit(widget); + m_descLabel = new TQTextEdit(widget); m_descLabel->setReadOnly(true); - m_descLabel->setTextFormat(Qt::RichText); - m_descLabel->setPaper(colorGroup().background()); + m_descLabel->setTextFormat(TQt::RichText); + m_descLabel->setPaper(tqcolorGroup().background()); m_descLabel->setMinimumHeight(5 * fontMetrics().height()); boxLayout2->addWidget(m_descLabel, 10); - QWhatsThis::add(m_descLabel, i18n("A description of the selected item is shown here.")); + TQWhatsThis::add(m_descLabel, i18n("A description of the selected item is shown here.")); - QHBox* box = new QHBox(frame, "statusbox"); + TQHBox* box = new TQHBox(frame, "statusbox"); boxLayout->addWidget(box); box->setSpacing(KDialog::spacingHint()); m_statusBar = new KStatusBar(box, "statusbar"); - m_statusBar->insertItem(QString::null, PROGRESS_STATUS_ID, 1, false); + m_statusBar->insertItem(TQString(), PROGRESS_STATUS_ID, 1, false); m_statusBar->setItemAlignment(PROGRESS_STATUS_ID, AlignLeft | AlignVCenter); - m_progress = new QProgressBar(m_statusBar, "progress"); + m_progress = new TQProgressBar(m_statusBar, "progress"); m_progress->setTotalSteps(0); m_progress->setFixedHeight(fontMetrics().height()+2); m_statusBar->addWidget(m_progress, 0, true); KPushButton* closeButton = new KPushButton(KStdGuiItem::close(), box); - connect(closeButton, SIGNAL(clicked()), SLOT(slotClose())); + connect(closeButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotClose())); closeButton->setFocus(); - connect(m_timer, SIGNAL(timeout()), SLOT(slotMoveProgress())); + connect(m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(slotMoveProgress())); - setMinimumWidth(QMAX(minimumWidth(), NEW_STUFF_MIN_WIDTH)); - setMinimumHeight(QMAX(minimumHeight(), NEW_STUFF_MIN_HEIGHT)); - resize(configDialogSize(QString::fromLatin1("NewStuff Dialog Options"))); + setMinimumWidth(TQMAX(minimumWidth(), NEW_STUFF_MIN_WIDTH)); + setMinimumHeight(TQMAX(minimumHeight(), NEW_STUFF_MIN_HEIGHT)); + resize(configDialogSize(TQString::tqfromLatin1("NewStuff Dialog Options"))); KConfigGroup dialogConfig(KGlobal::config(), "NewStuff Dialog Options"); - QValueList<int> splitList = dialogConfig.readIntListEntry("Splitter Sizes"); + TQValueList<int> splitList = dialogConfig.readIntListEntry("Splitter Sizes"); if(!splitList.empty()) { m_split->setSizes(splitList); } - setStatus(i18n("Downloading information...")); + settqStatus(i18n("Downloading information...")); ProviderLoader* loader = new Tellico::NewStuff::ProviderLoader(this); - connect(loader, SIGNAL(providersLoaded(QPtrList<KNS::Provider>*)), SLOT(slotProviders(QPtrList<KNS::Provider>*))); - connect(loader, SIGNAL(percent(KIO::Job*, unsigned long)), SLOT(slotShowPercent(KIO::Job*, unsigned long))); - connect(loader, SIGNAL(error()), SLOT(slotProviderError())); + connect(loader, TQT_SIGNAL(providersLoaded(TQPtrList<KNS::Provider>*)), TQT_SLOT(slotProviders(TQPtrList<KNS::Provider>*))); + connect(loader, TQT_SIGNAL(percent(KIO::Job*, unsigned long)), TQT_SLOT(slotShowPercent(KIO::Job*, unsigned long))); + connect(loader, TQT_SIGNAL(error()), TQT_SLOT(slotProviderError())); KConfigGroup config(KGlobal::config(), "KNewStuff"); - QString prov = config.readEntry("ProvidersUrl"); + TQString prov = config.readEntry("ProvidersUrl"); if(prov.isEmpty()) { if(m_type == EntryTemplate) { - prov = QString::fromLatin1("http://periapsis.org/tellico/newstuff/tellicotemplates-providers.php"); - QString alt = QString::fromLatin1("http://download.kde.org/khotnewstuff/tellicotemplates-providers.xml"); + prov = TQString::tqfromLatin1("http://periapsis.org/tellico/newstuff/tellicotemplates-providers.php"); + TQString alt = TQString::tqfromLatin1("http://download.kde.org/khotnewstuff/tellicotemplates-providers.xml"); loader->setAlternativeProvider(alt); } else { - prov = QString::fromLatin1("http://periapsis.org/tellico/newstuff/tellicoscripts-providers.php"); + prov = TQString::tqfromLatin1("http://periapsis.org/tellico/newstuff/tellicoscripts-providers.php"); } } if(m_type == EntryTemplate) { - m_typeName = QString::fromLatin1("tellico/entry-template"); + m_typeName = TQString::tqfromLatin1("tellico/entry-template"); } else { - m_typeName = QString::fromLatin1("tellico/data-source"); + m_typeName = TQString::tqfromLatin1("tellico/data-source"); } loader->load(m_typeName, prov); @@ -253,7 +253,7 @@ Dialog::~Dialog() { delete m_cursorSaver; m_cursorSaver = 0; - saveDialogSize(QString::fromLatin1("NewStuff Dialog Options")); + saveDialogSize(TQString::tqfromLatin1("NewStuff Dialog Options")); KConfigGroup config(KGlobal::config(), "NewStuff Dialog Options"); config.writeEntry("Splitter Sizes", m_split->sizes()); } @@ -261,50 +261,50 @@ Dialog::~Dialog() { void Dialog::slotProviderError() { if(m_listView->childCount() == 0) { myDebug() << "NewStuff::Dialog::slotCheckError() - no available items" << endl; - setStatus(QString()); + settqStatus(TQString()); delete m_cursorSaver; m_cursorSaver = 0; } } -void Dialog::slotProviders(QPtrList<KNS::Provider>* list_) { +void Dialog::slotProviders(TQPtrList<KNS::Provider>* list_) { for(KNS::Provider* prov = list_->first(); prov; prov = list_->next()) { KIO::TransferJob* job = KIO::get(prov->downloadUrl()); m_jobs[job] = prov; - connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(job, SIGNAL(result(KIO::Job*)), SLOT(slotResult(KIO::Job*))); - connect(job, SIGNAL(percent(KIO::Job*, unsigned long)), - SLOT(slotShowPercent(KIO::Job*, unsigned long))); + connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotResult(KIO::Job*))); + connect(job, TQT_SIGNAL(percent(KIO::Job*, unsigned long)), + TQT_SLOT(slotShowPercent(KIO::Job*, unsigned long))); } } -void Dialog::slotData(KIO::Job* job_, const QByteArray& data_) { - QDataStream stream(m_data[job_], IO_WriteOnly | IO_Append); +void Dialog::slotData(KIO::Job* job_, const TQByteArray& data_) { + TQDataStream stream(m_data[job_], IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } void Dialog::slotResult(KIO::Job* job_) { // myDebug() << "NewStuff::Dialog::slotResult()" << endl; - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data[job_])) { KNS::Provider* prov = m_jobs[job_]; KURL u = prov ? prov->downloadUrl() : KURL(); myDebug() << "NewStuff::Dialog::slotResult() - can't load result: " << u.url() << endl; m_jobs.remove(job_); if(m_jobs.isEmpty()) { - setStatus(i18n("Ready.")); + settqStatus(i18n("Ready.")); delete m_cursorSaver; m_cursorSaver = 0; } return; } - QDomElement knewstuff = dom.documentElement(); + TQDomElement knewstuff = dom.documentElement(); - for(QDomNode pn = knewstuff.firstChild(); !pn.isNull(); pn = pn.nextSibling()) { - QDomElement stuff = pn.toElement(); + for(TQDomNode pn = knewstuff.firstChild(); !pn.isNull(); pn = pn.nextSibling()) { + TQDomElement stuff = pn.toElement(); if(stuff.isNull()) { continue; } @@ -321,7 +321,7 @@ void Dialog::slotResult(KIO::Job* job_) { } m_jobs.remove(job_); if(m_jobs.isEmpty()) { - setStatus(i18n("Ready.")); + settqStatus(i18n("Ready.")); delete m_cursorSaver; m_cursorSaver = 0; } @@ -335,10 +335,10 @@ void Dialog::addEntry(KNS::Entry* entry_) { Item* item = new Item(m_listView); item->setText(0, ENTRYNAME(entry_)); item->setText(1, entry_->version()); - item->setText(2, QString::number(entry_->rating())); - item->setText(3, QString::number(entry_->downloads())); + item->setText(2, TQString::number(entry_->rating())); + item->setText(3, TQString::number(entry_->downloads())); item->setText(4, KGlobal::locale()->formatDate(entry_->releaseDate(), true /*short format */)); - item->setStatus(NewStuff::Manager::installStatus(entry_)); + item->settqStatus(NewStuff::Manager::installtqStatus(entry_)); m_entryMap.insert(item, entry_); if(!m_listView->selectedItem()) { @@ -347,7 +347,7 @@ void Dialog::addEntry(KNS::Entry* entry_) { } } -void Dialog::slotSelected(QListViewItem* item_) { +void Dialog::slotSelected(TQListViewItem* item_) { if(!item_) { return; } @@ -365,22 +365,22 @@ void Dialog::slotSelected(QListViewItem* item_) { KURL dest; dest.setPath(m_tempPreviewImage->name()); KIO::FileCopyJob* job = KIO::file_copy(preview, dest, -1, true, false, false); - connect(job, SIGNAL(result(KIO::Job*)), SLOT(slotPreviewResult(KIO::Job*))); - connect(job, SIGNAL(percent(KIO::Job*, unsigned long)), - SLOT(slotShowPercent(KIO::Job*, unsigned long))); + connect(job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotPreviewResult(KIO::Job*))); + connect(job, TQT_SIGNAL(percent(KIO::Job*, unsigned long)), + TQT_SLOT(slotShowPercent(KIO::Job*, unsigned long))); m_lastPreviewItem = item_; } - QPixmap pix = m_type == EntryTemplate - ? DesktopIcon(QString::fromLatin1("looknfeel"), KIcon::SizeLarge) - : UserIcon(QString::fromLatin1("script")); + TQPixmap pix = m_type == EntryTemplate + ? DesktopIcon(TQString::tqfromLatin1("looknfeel"), KIcon::SizeLarge) + : UserIcon(TQString::tqfromLatin1("script")); m_iconLabel->setPixmap(pix); - QString license = entry->license(); + TQString license = entry->license(); if(!license.isEmpty()) { license.prepend('(').append(')'); } - QString name = QString::fromLatin1("%1 %2").arg(ENTRYNAME(entry)).arg(license); - QFont font = m_nameLabel->font(); + TQString name = TQString::tqfromLatin1("%1 %2").tqarg(ENTRYNAME(entry)).tqarg(license); + TQFont font = m_nameLabel->font(); font.setBold(true); font.setItalic(false); m_nameLabel->setFont(font); @@ -388,17 +388,17 @@ void Dialog::slotSelected(QListViewItem* item_) { m_infoLabel->setText(entry->author()); - QString desc = entry->summary(m_lang); - desc.replace(QRegExp(QString::fromLatin1("\\n")), QString::fromLatin1("<br>")); + TQString desc = entry->summary(m_lang); + desc.tqreplace(TQRegExp(TQString::tqfromLatin1("\\n")), TQString::tqfromLatin1("<br>")); m_descLabel->setText(desc); - InstallStatus installed = static_cast<Item*>(item_)->status(); + InstalltqStatus installed = static_cast<Item*>(item_)->status(); m_install->setText(installed == OldVersion ? i18n("Update Stuff", "Update") : i18n("Install")); m_install->setEnabled(installed != Current); } void Dialog::slotInstall() { - QListViewItem* item = m_listView->currentItem(); + TQListViewItem* item = m_listView->currentItem(); if(!item) { return; } @@ -410,28 +410,28 @@ void Dialog::slotInstall() { delete m_cursorSaver; m_cursorSaver = new GUI::CursorSaver(); - setStatus(i18n("Installing item...")); + settqStatus(i18n("Installing item...")); m_progress->show(); m_timer->start(100); - connect(m_manager, SIGNAL(signalInstalled(KNS::Entry*)), SLOT(slotDoneInstall(KNS::Entry*))); + connect(m_manager, TQT_SIGNAL(signalInstalled(KNS::Entry*)), TQT_SLOT(slotDoneInstall(KNS::Entry*))); m_manager->install(m_type, entry); delete m_cursorSaver; m_cursorSaver = 0; } void Dialog::slotDoneInstall(KNS::Entry* entry_) { - QMap<QListViewItem*, KNS::Entry*>::Iterator it; + TQMap<TQListViewItem*, KNS::Entry*>::Iterator it; for(it = m_entryMap.begin(); entry_ && it != m_entryMap.end(); ++it) { if(it.data() == entry_) { - InstallStatus installed = Manager::installStatus(entry_); - static_cast<Item*>(it.key())->setStatus(installed); + InstalltqStatus installed = Manager::installtqStatus(entry_); + static_cast<Item*>(it.key())->settqStatus(installed); m_install->setEnabled(installed != Current); break; } } delete m_cursorSaver; m_cursorSaver = 0; - setStatus(i18n("Ready.")); + settqStatus(i18n("Ready.")); m_timer->stop(); m_progress->hide(); } @@ -440,8 +440,8 @@ void Dialog::slotMoveProgress() { m_progress->setProgress(m_progress->progress()+5); } -void Dialog::setStatus(const QString& text_) { - m_statusBar->changeItem(QChar(' ') + text_, PROGRESS_STATUS_ID); +void Dialog::settqStatus(const TQString& text_) { + m_statusBar->changeItem(TQChar(' ') + text_, PROGRESS_STATUS_ID); } void Dialog::slotShowPercent(KIO::Job*, unsigned long pct_) { @@ -458,12 +458,12 @@ void Dialog::slotPreviewResult(KIO::Job* job_) { if(job->error()) { return; } - QString tmpFile = job->destURL().path(); // might be different than m_tempPreviewImage->name() - QPixmap pix(tmpFile); + TQString tmpFile = job->destURL().path(); // might be different than m_tempPreviewImage->name() + TQPixmap pix(tmpFile); if(!pix.isNull()) { if(pix.width() > 64 || pix.height() > 64) { - pix.convertFromImage(pix.convertToImage().smoothScale(64, 64, QImage::ScaleMin)); + pix.convertFromImage(pix.convertToImage().smoothScale(64, 64, TQ_ScaleMin)); } // only set label if it's still current if(m_listView->selectedItem() == m_lastPreviewItem) { diff --git a/src/newstuff/dialog.h b/src/newstuff/dialog.h index f1c5e48..b719b72 100644 --- a/src/newstuff/dialog.h +++ b/src/newstuff/dialog.h @@ -28,10 +28,10 @@ namespace KNS { class Provider; } -class QProgressBar; -class QSplitter; -class QLabel; -class QTextEdit; +class TQProgressBar; +class TQSplitter; +class TQLabel; +class TQTextEdit; namespace Tellico { namespace GUI { @@ -43,22 +43,23 @@ namespace Tellico { class Dialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: - Dialog(DataType type, QWidget* parent); + Dialog(DataType type, TQWidget* tqparent); virtual ~Dialog(); - QPtrList<DataSourceInfo> dataSourceInfo() const { return m_manager->dataSourceInfo(); } + TQPtrList<DataSourceInfo> dataSourceInfo() const { return m_manager->dataSourceInfo(); } private slots: - void slotProviders(QPtrList<KNS::Provider>* list); - void slotData(KIO::Job* job, const QByteArray& data); + void slotProviders(TQPtrList<KNS::Provider>* list); + void slotData(KIO::Job* job, const TQByteArray& data); void slotResult(KIO::Job* job); void slotPreviewResult(KIO::Job* job); void slotShowPercent(KIO::Job* job, unsigned long percent); - void slotSelected(QListViewItem* item); + void slotSelected(TQListViewItem* item); void slotInstall(); void slotDoneInstall(KNS::Entry* entry); @@ -68,32 +69,32 @@ private slots: private: class Item; - void setStatus(const QString& status); + void settqStatus(const TQString& status); void addEntry(KNS::Entry* entry); Manager* const m_manager; DataType m_type; - QString m_lang; - QString m_typeName; + TQString m_lang; + TQString m_typeName; - QSplitter* m_split; + TQSplitter* m_split; GUI::ListView* m_listView; - QLabel* m_iconLabel; - QLabel* m_nameLabel; - QLabel* m_infoLabel; - QTextEdit* m_descLabel; + TQLabel* m_iconLabel; + TQLabel* m_nameLabel; + TQLabel* m_infoLabel; + TQTextEdit* m_descLabel; KPushButton* m_install; KStatusBar* m_statusBar; - QProgressBar* m_progress; - QTimer* m_timer; + TQProgressBar* m_progress; + TQTimer* m_timer; GUI::CursorSaver* m_cursorSaver; KTempFile* m_tempPreviewImage; - QMap<KIO::Job*, KNS::Provider*> m_jobs; - QMap<KIO::Job*, QByteArray> m_data; + TQMap<KIO::Job*, KNS::Provider*> m_jobs; + TQMap<KIO::Job*, TQByteArray> m_data; - QMap<QListViewItem*, KNS::Entry*> m_entryMap; - QListViewItem* m_lastPreviewItem; + TQMap<TQListViewItem*, KNS::Entry*> m_entryMap; + TQListViewItem* m_lastPreviewItem; }; } diff --git a/src/newstuff/manager.cpp b/src/newstuff/manager.cpp index 3b7efbf..01d9932 100644 --- a/src/newstuff/manager.cpp +++ b/src/newstuff/manager.cpp @@ -31,18 +31,18 @@ #include <knewstuff/entry.h> #include <kstandarddirs.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qptrstack.h> -#include <qvaluestack.h> -#include <qwidget.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqptrstack.h> +#include <tqvaluestack.h> +#include <tqwidget.h> #include <sys/types.h> #include <sys/stat.h> using Tellico::NewStuff::Manager; -Manager::Manager(QObject* parent_) : QObject(parent_), m_tempFile(0) { +Manager::Manager(TQObject* tqparent_) : TQObject(tqparent_), m_tempFile(0) { m_infoList.setAutoDelete(true); } @@ -51,11 +51,11 @@ Manager::~Manager() { m_tempFile = 0; } -bool Manager::installTemplate(const KURL& url_, const QString& entryName_) { +bool Manager::installTemplate(const KURL& url_, const TQString& entryName_) { FileHandler::FileRef* ref = FileHandler::fileRef(url_); - QString xslFile; - QStringList allFiles; + TQString xslFile; + TQStringList allFiles; bool success = true; @@ -64,23 +64,23 @@ bool Manager::installTemplate(const KURL& url_, const QString& entryName_) { KTar archive(ref->fileName()); if(archive.open(IO_ReadOnly)) { const KArchiveDirectory* archiveDir = archive.directory(); - archiveDir->copyTo(Tellico::saveLocation(QString::fromLatin1("entry-templates/"))); + archiveDir->copyTo(Tellico::saveLocation(TQString::tqfromLatin1("entry-templates/"))); allFiles = archiveFiles(archiveDir); // remember files installed for template xslFile = findXSL(archiveDir); } else { // assume it's an xsl file - QString name = entryName_; + TQString name = entryName_; if(name.isEmpty()) { name = url_.fileName(); } - if(!name.endsWith(QString::fromLatin1(".xsl"))) { - name += QString::fromLatin1(".xsl"); + if(!name.endsWith(TQString::tqfromLatin1(".xsl"))) { + name += TQString::tqfromLatin1(".xsl"); } KURL dest; - dest.setPath(Tellico::saveLocation(QString::fromLatin1("entry-templates/")) + name); + dest.setPath(Tellico::saveLocation(TQString::tqfromLatin1("entry-templates/")) + name); success = true; - if(QFile::exists(dest.path())) { + if(TQFile::exists(dest.path())) { myDebug() << "Manager::installTemplate() - " << dest.path() << " exists!" << endl; success = false; } else if(KIO::NetAccess::file_copy(url_, dest)) { @@ -105,9 +105,9 @@ bool Manager::installTemplate(const KURL& url_, const QString& entryName_) { return success; } -bool Manager::removeTemplate(const QString& name_) { +bool Manager::removeTemplate(const TQString& name_) { KConfigGroup fileGroup(KGlobal::config(), "KNewStuffFiles"); - QStringList files = fileGroup.readListEntry(name_); + TQStringList files = fileGroup.readListEntry(name_); // at least, delete xsl file if(files.isEmpty()) { kdWarning() << "Manager::deleteTemplate() no file list found for " << name_ << endl; @@ -115,13 +115,13 @@ bool Manager::removeTemplate(const QString& name_) { } bool success = true; - QString path = Tellico::saveLocation(QString::fromLatin1("entry-templates/")); - for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { - if((*it).endsWith(QChar('/'))) { + TQString path = Tellico::saveLocation(TQString::tqfromLatin1("entry-templates/")); + for(TQStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { + if((*it).endsWith(TQChar('/'))) { // ok to not delete all directories - QDir().rmdir(path + *it); + TQDir().rmdir(path + *it); } else { - success = success && QFile(path + *it).remove(); + success = success && TQFile(path + *it).remove(); if(!success) { myDebug() << "Manager::removeTemplate() - failed to remove " << (path+*it) << endl; } @@ -130,8 +130,8 @@ bool Manager::removeTemplate(const QString& name_) { // remove config entries even if unsuccessful fileGroup.deleteEntry(name_); - KConfigGroup statusGroup(KGlobal::config(), "KNewStuffStatus"); - QString entryName = statusGroup.readEntry(name_); + KConfigGroup statusGroup(KGlobal::config(), "KNewStufftqStatus"); + TQString entryName = statusGroup.readEntry(name_); statusGroup.deleteEntry(name_); statusGroup.deleteEntry(entryName); @@ -149,24 +149,24 @@ bool Manager::installScript(const KURL& url_) { const KArchiveDirectory* archiveDir = archive.directory(); - QString exeFile = findEXE(archiveDir); + TQString exeFile = findEXE(archiveDir); if(exeFile.isEmpty()) { myDebug() << "Manager::installScript() - no exe file found" << endl; return false; } - QFileInfo exeInfo(exeFile); + TQFileInfo exeInfo(exeFile); DataSourceInfo* info = new DataSourceInfo(); - QString copyTarget = Tellico::saveLocation(QString::fromLatin1("data-sources/")); - QString scriptFolder; + TQString copyTarget = Tellico::saveLocation(TQString::tqfromLatin1("data-sources/")); + TQString scriptFolder; // package could have a top-level directory or not // it should have a directory... const KArchiveEntry* firstEntry = archiveDir->entry(archiveDir->entries().first()); if(firstEntry->isFile()) { copyTarget += exeInfo.baseName(true) + '/'; - if(QFile::exists(copyTarget)) { + if(TQFile::exists(copyTarget)) { KURL u; u.setPath(scriptFolder); myLog() << "Manager::installScript() - deleting " << scriptFolder << endl; @@ -176,7 +176,7 @@ bool Manager::installScript(const KURL& url_) { scriptFolder = copyTarget; } else { scriptFolder = copyTarget + firstEntry->name() + '/'; - if(QFile::exists(copyTarget + exeFile)) { + if(TQFile::exists(copyTarget + exeFile)) { info->isUpdate = true; } } @@ -185,7 +185,7 @@ bool Manager::installScript(const KURL& url_) { archiveDir->copyTo(copyTarget); info->specFile = scriptFolder + exeInfo.baseName(true) + ".spec"; - if(!QFile::exists(info->specFile)) { + if(!TQFile::exists(info->specFile)) { myDebug() << "Manager::installScript() - no spec file for script! " << info->specFile << endl; delete info; return false; @@ -197,7 +197,7 @@ bool Manager::installScript(const KURL& url_) { KURL dest; dest.setPath(info->sourceExec); KFileItem item(KFileItem::Unknown, KFileItem::Unknown, dest, true); - ::chmod(QFile::encodeName(dest.path()), item.permissions() | S_IXUSR); + ::chmod(TQFile::encodeName(dest.path()), item.permissions() | S_IXUSR); { KConfig spec(info->specFile, false, false); @@ -224,18 +224,18 @@ bool Manager::installScript(const KURL& url_) { return true; } -bool Manager::removeScript(const QString& name_) { +bool Manager::removeScript(const TQString& name_) { KConfigGroup fileGroup(KGlobal::config(), "KNewStuffFiles"); - QStringList files = fileGroup.readListEntry(name_); + TQStringList files = fileGroup.readListEntry(name_); bool success = true; - QString path = Tellico::saveLocation(QString::fromLatin1("data-sources/")); - for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { - if((*it).endsWith(QChar('/'))) { + TQString path = Tellico::saveLocation(TQString::tqfromLatin1("data-sources/")); + for(TQStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { + if((*it).endsWith(TQChar('/'))) { // ok to not delete all directories - QDir().rmdir(path + *it); + TQDir().rmdir(path + *it); } else { - success = success && QFile(path + *it).remove(); + success = success && TQFile(path + *it).remove(); if(!success) { myDebug() << "Manager::removeScript() - failed to remove " << (path+*it) << endl; } @@ -244,22 +244,22 @@ bool Manager::removeScript(const QString& name_) { // remove config entries even if unsuccessful fileGroup.deleteEntry(name_); - KConfigGroup statusGroup(KGlobal::config(), "KNewStuffStatus"); - QString entryName = statusGroup.readEntry(name_); + KConfigGroup statusGroup(KGlobal::config(), "KNewStufftqStatus"); + TQString entryName = statusGroup.readEntry(name_); statusGroup.deleteEntry(name_); statusGroup.deleteEntry(entryName); return success; } -Tellico::NewStuff::InstallStatus Manager::installStatus(KNS::Entry* entry_) { - KConfigGroup config(KGlobal::config(), "KNewStuffStatus"); - QString datestring = config.readEntry(entry_->name()); +Tellico::NewStuff::InstalltqStatus Manager::installtqStatus(KNS::Entry* entry_) { + KConfigGroup config(KGlobal::config(), "KNewStufftqStatus"); + TQString datestring = config.readEntry(entry_->name()); if(datestring.isEmpty()) { return NotInstalled; } - QDate date = QDate::fromString(datestring, Qt::ISODate); + TQDate date = TQDate::fromString(datestring, Qt::ISODate); if(!date.isValid()) { return NotInstalled; } @@ -269,22 +269,22 @@ Tellico::NewStuff::InstallStatus Manager::installStatus(KNS::Entry* entry_) { // also check that executable files exists KConfigGroup fileGroup(KGlobal::config(), "KNewStuffFiles"); - QStringList files = fileGroup.readListEntry(entry_->name()); - QString path = Tellico::saveLocation(QString::fromLatin1("data-sources/")); - for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { - if(!QFile::exists(path + *it)) { + TQStringList files = fileGroup.readListEntry(entry_->name()); + TQString path = Tellico::saveLocation(TQString::tqfromLatin1("data-sources/")); + for(TQStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { + if(!TQFile::exists(path + *it)) { return NotInstalled; } } return Current; } -QStringList Manager::archiveFiles(const KArchiveDirectory* dir_, const QString& path_) { - QStringList list; +TQStringList Manager::archiveFiles(const KArchiveDirectory* dir_, const TQString& path_) { + TQStringList list; - const QStringList dirEntries = dir_->entries(); - for(QStringList::ConstIterator it = dirEntries.begin(); it != dirEntries.end(); ++it) { - const QString& entry = *it; + const TQStringList dirEntries = dir_->entries(); + for(TQStringList::ConstIterator it = dirEntries.begin(); it != dirEntries.end(); ++it) { + const TQString& entry = *it; const KArchiveEntry* curEntry = dir_->entry(entry); if(curEntry->isFile()) { list += path_ + entry; @@ -299,30 +299,30 @@ QStringList Manager::archiveFiles(const KArchiveDirectory* dir_, const QString& } // don't recurse, the .xsl must be in top directory -QString Manager::findXSL(const KArchiveDirectory* dir_) { - const QStringList entries = dir_->entries(); - for(QStringList::ConstIterator it = entries.begin(); it != entries.end(); ++it) { - const QString& entry = *it; - if(entry.endsWith(QString::fromLatin1(".xsl"))) { +TQString Manager::findXSL(const KArchiveDirectory* dir_) { + const TQStringList entries = dir_->entries(); + for(TQStringList::ConstIterator it = entries.begin(); it != entries.end(); ++it) { + const TQString& entry = *it; + if(entry.endsWith(TQString::tqfromLatin1(".xsl"))) { return entry; } } - return QString(); + return TQString(); } -QString Manager::findEXE(const KArchiveDirectory* dir_) { - QPtrStack<KArchiveDirectory> dirStack; - QValueStack<QString> dirNameStack; +TQString Manager::findEXE(const KArchiveDirectory* dir_) { + TQPtrStack<KArchiveDirectory> dirStack; + TQValueStack<TQString> dirNameStack; dirStack.push(dir_); - dirNameStack.push(QString()); + dirNameStack.push(TQString()); do { - const QString dirName = dirNameStack.pop(); + const TQString dirName = dirNameStack.pop(); const KArchiveDirectory* curDir = dirStack.pop(); - const QStringList entries = curDir->entries(); - for(QStringList::ConstIterator it = entries.begin(); it != entries.end(); ++it) { - const QString& entry = *it; + const TQStringList entries = curDir->entries(); + for(TQStringList::ConstIterator it = entries.begin(); it != entries.end(); ++it) { + const TQString& entry = *it; const KArchiveEntry* archEntry = curDir->entry(entry); if(archEntry->isFile() && (archEntry->permissions() & S_IEXEC)) { @@ -334,7 +334,7 @@ QString Manager::findEXE(const KArchiveDirectory* dir_) { } } while(!dirStack.isEmpty()); - return QString(); + return TQString(); } void Manager::install(DataType type_, KNS::Entry* entry_) { @@ -347,14 +347,14 @@ void Manager::install(DataType type_, KNS::Entry* entry_) { KURL destination; destination.setPath(m_tempFile->name()); KIO::FileCopyJob* job = KIO::file_copy(entry_->payload(), destination, -1, true); - connect(job, SIGNAL(result(KIO::Job*)), SLOT(slotDownloadJobResult(KIO::Job*))); + connect(job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotDownloadJobResult(KIO::Job*))); m_jobMap.insert(job, EntryPair(entry_, type_)); } void Manager::slotDownloadJobResult(KIO::Job* job_) { KIO::FileCopyJob* job = static_cast<KIO::FileCopyJob*>(job_); if(job->error()) { - GUI::CursorSaver cs(Qt::arrowCursor); + GUI::CursorSaver cs(TQt::arrowCursor); delete m_tempFile; m_tempFile = 0; job->showErrorDialog(Kernel::self()->widget()); @@ -372,7 +372,7 @@ void Manager::slotDownloadJobResult(KIO::Job* job_) { #if KDE_IS_VERSION(3,3,90) // needed so the GPG signature can be checked NewScript* newScript = new NewScript(this, Kernel::self()->widget()); - connect(newScript, SIGNAL(installFinished()), this, SLOT(slotInstallFinished())); + connect(newScript, TQT_SIGNAL(installFinished()), this, TQT_SLOT(slotInstallFinished())); // need to delete temp file if install was not a success // if it was a success, it gets deleted later deleteTempFile = !newScript->install(job->destURL().path()); @@ -390,16 +390,16 @@ void Manager::slotDownloadJobResult(KIO::Job* job_) { } void Manager::slotInstallFinished() { - const NewScript* newScript = ::qt_cast<const NewScript*>(sender()); + const NewScript* newScript = ::tqqt_cast<const NewScript*>(sender()); if(newScript && newScript->successfulInstall()) { - const QString name = m_urlNameMap[newScript->url()]; + const TQString name = m_urlNameMap[newScript->url()]; KNS::Entry* entry = m_scriptEntryMap[newScript]; - KConfigGroup config(KGlobal::config(), "KNewStuffStatus"); + KConfigGroup config(KGlobal::config(), "KNewStufftqStatus"); // have to keep a config entry that maps the name of the file to the name // of the newstuff entry, so we can track which entries are installed // name and entry-name() are probably the same for scripts, but not a problem config.writeEntry(name, entry->name()); - config.writeEntry(entry->name(), entry->releaseDate().toString(Qt::ISODate)); + config.writeEntry(entry->name(), TQString(entry->releaseDate().toString(Qt::ISODate))); config.sync(); emit signalInstalled(entry); } else { @@ -413,32 +413,32 @@ void Manager::slotInstallFinished() { bool Manager::checkCommonFile() { // look for a file that gets installed to know the installation directory // need to check timestamps - QString userDataDir = Tellico::saveLocation(QString::null); - QString userCommonFile = userDataDir + '/' + QString::fromLatin1("tellico-common.xsl"); - if(QFile::exists(userCommonFile)) { + TQString userDataDir = Tellico::saveLocation(TQString()); + TQString userCommonFile = userDataDir + '/' + TQString::tqfromLatin1("tellico-common.xsl"); + if(TQFile::exists(userCommonFile)) { // check timestamps // pics/tellico.png is not likely to be in a user directory - QString installDir = KGlobal::dirs()->findResourceDir("appdata", QString::fromLatin1("pics/tellico.png")); - QString installCommonFile = installDir + '/' + QString::fromLatin1("tellico-common.xsl"); + TQString installDir = KGlobal::dirs()->findResourceDir("appdata", TQString::tqfromLatin1("pics/tellico.png")); + TQString installCommonFile = installDir + '/' + TQString::tqfromLatin1("tellico-common.xsl"); #ifndef NDEBUG if(userCommonFile == installCommonFile) { kdWarning() << "Manager::checkCommonFile() - install location is same as user location" << endl; } #endif - QFileInfo installInfo(installCommonFile); - QFileInfo userInfo(userCommonFile); + TQFileInfo installInfo(installCommonFile); + TQFileInfo userInfo(userCommonFile); if(installInfo.lastModified() > userInfo.lastModified()) { // the installed file has been modified more recently than the user's // remove user's tellico-common.xsl file so it gets copied again myLog() << "Manager::checkCommonFile() - removing " << userCommonFile << endl; myLog() << "Manager::checkCommonFile() - copying " << installCommonFile << endl; - QFile::remove(userCommonFile); + TQFile::remove(userCommonFile); } else { return true; } } KURL src, dest; - src.setPath(KGlobal::dirs()->findResource("appdata", QString::fromLatin1("tellico-common.xsl"))); + src.setPath(KGlobal::dirs()->findResource("appdata", TQString::tqfromLatin1("tellico-common.xsl"))); dest.setPath(userCommonFile); return KIO::NetAccess::file_copy(src, dest); } diff --git a/src/newstuff/manager.h b/src/newstuff/manager.h index 4102be3..53c6726 100644 --- a/src/newstuff/manager.h +++ b/src/newstuff/manager.h @@ -18,10 +18,10 @@ class KArchiveDirectory; class KURL; class KTempFile; -#include <qobject.h> -#include <qptrlist.h> +#include <tqobject.h> +#include <tqptrlist.h> -class QStringList; +class TQStringList; namespace KNS { class Entry; @@ -40,7 +40,7 @@ enum DataType { DataScript }; -enum InstallStatus { +enum InstalltqStatus { NotInstalled, OldVersion, Current @@ -48,29 +48,30 @@ enum InstallStatus { struct DataSourceInfo { DataSourceInfo() : isUpdate(false) {} - QString specFile; // full path of .spec file - QString sourceName; - QString sourceExec; // full executable path of script + TQString specFile; // full path of .spec file + TQString sourceName; + TQString sourceExec; // full executable path of script bool isUpdate : 1; // whether the info is for an updated source }; -class Manager : public QObject { +class Manager : public TQObject { Q_OBJECT + TQ_OBJECT public: - Manager(QObject* parent); + Manager(TQObject* tqparent); ~Manager(); void install(DataType type, KNS::Entry* entry); - QPtrList<DataSourceInfo> dataSourceInfo() const { return m_infoList; } + TQPtrList<DataSourceInfo> dataSourceInfo() const { return m_infoList; } - bool installTemplate(const KURL& url, const QString& entryName = QString::null); - bool removeTemplate(const QString& name); + bool installTemplate(const KURL& url, const TQString& entryName = TQString()); + bool removeTemplate(const TQString& name); bool installScript(const KURL& url); - bool removeScript(const QString& name); + bool removeScript(const TQString& name); - static InstallStatus installStatus(KNS::Entry* entry); + static InstalltqStatus installtqStatus(KNS::Entry* entry); static bool checkCommonFile(); signals: @@ -81,17 +82,17 @@ private slots: void slotInstallFinished(); private: - static QStringList archiveFiles(const KArchiveDirectory* dir, - const QString& path = QString::null); + static TQStringList archiveFiles(const KArchiveDirectory* dir, + const TQString& path = TQString()); - static QString findXSL(const KArchiveDirectory* dir); - static QString findEXE(const KArchiveDirectory* dir); + static TQString findXSL(const KArchiveDirectory* dir); + static TQString findEXE(const KArchiveDirectory* dir); - typedef QPair<KNS::Entry*, DataType> EntryPair; - QMap<KIO::Job*, EntryPair> m_jobMap; - QMap<KURL, QString> m_urlNameMap; - QMap<const NewScript*, KNS::Entry*> m_scriptEntryMap; - QPtrList<DataSourceInfo> m_infoList; + typedef TQPair<KNS::Entry*, DataType> EntryPair; + TQMap<KIO::Job*, EntryPair> m_jobMap; + TQMap<KURL, TQString> m_urlNameMap; + TQMap<const NewScript*, KNS::Entry*> m_scriptEntryMap; + TQPtrList<DataSourceInfo> m_infoList; KTempFile* m_tempFile; }; diff --git a/src/newstuff/newscript.cpp b/src/newstuff/newscript.cpp index 045f881..e942d06 100644 --- a/src/newstuff/newscript.cpp +++ b/src/newstuff/newscript.cpp @@ -16,15 +16,15 @@ #include <kurl.h> -#include <qwidget.h> +#include <tqwidget.h> using Tellico::NewStuff::NewScript; -NewScript::NewScript(Manager* manager_, QWidget* parentWidget_) +NewScript::NewScript(Manager* manager_, TQWidget* tqparentWidget_) #if KDE_IS_VERSION(3,3,90) - : KNewStuffSecure(QString::fromLatin1("tellico/data-source"), parentWidget_) + : KNewStuffSecure(TQString::tqfromLatin1("tellico/data-source"), tqparentWidget_) #else - : QObject(parentWidget_) + : TQObject(tqparentWidget_) #endif , m_manager(manager_), m_success(false) { } @@ -41,7 +41,7 @@ void NewScript::installResource() { #include <knewstuff/knewstuffsecure.h> #define SUPERCLASS KNewStuffSecure #else -#define SUPERCLASS QObject +#define SUPERCLASS TQObject #endif #include "newscript.moc" diff --git a/src/newstuff/newscript.h b/src/newstuff/newscript.h index 8bc3154..9fd694e 100644 --- a/src/newstuff/newscript.h +++ b/src/newstuff/newscript.h @@ -21,10 +21,10 @@ #include <knewstuff/knewstuffsecure.h> #define SUPERCLASS KNewStuffSecure #else -#define SUPERCLASS QObject +#define SUPERCLASS TQObject #endif -#include <qobject.h> +#include <tqobject.h> namespace Tellico { namespace NewStuff { @@ -33,9 +33,10 @@ class Manager; class NewScript : public SUPERCLASS { Q_OBJECT + TQ_OBJECT public: - NewScript(Manager* manager, QWidget* parentWidget = 0); + NewScript(Manager* manager, TQWidget* tqparentWidget = 0); virtual ~NewScript() {} const KURL& url() const { return m_url; } @@ -47,7 +48,7 @@ private: Manager* m_manager; #if !KDE_IS_VERSION(3,3,90) // KNewStuffSecure has a protected variable - QString m_tarName; + TQString m_tarName; #endif KURL m_url; bool m_success : 1; diff --git a/src/newstuff/providerloader.cpp b/src/newstuff/providerloader.cpp index b3f95ae..1cad0ef 100644 --- a/src/newstuff/providerloader.cpp +++ b/src/newstuff/providerloader.cpp @@ -26,17 +26,17 @@ #include <kmessagebox.h> #include <klocale.h> -#include <qdom.h> +#include <tqdom.h> using Tellico::NewStuff::ProviderLoader; -ProviderLoader::ProviderLoader( QWidget *parentWidget ) : - mParentWidget( parentWidget ), mTryAlt(true) +ProviderLoader::ProviderLoader( TQWidget *tqparentWidget ) : + mParentWidget( tqparentWidget ), mTryAlt(true) { mProviders.setAutoDelete( true ); } -void ProviderLoader::load( const QString &type, const QString &providersList ) +void ProviderLoader::load( const TQString &type, const TQString &providersList ) { mProviders.clear(); mJobData.truncate(0); @@ -44,21 +44,21 @@ void ProviderLoader::load( const QString &type, const QString &providersList ) // myLog() << "ProviderLoader::load(): providersList: " << providersList << endl; KIO::TransferJob *job = KIO::get( KURL( providersList ), false, false ); - connect( job, SIGNAL( result( KIO::Job * ) ), - SLOT( slotJobResult( KIO::Job * ) ) ); - connect( job, SIGNAL( data( KIO::Job *, const QByteArray & ) ), - SLOT( slotJobData( KIO::Job *, const QByteArray & ) ) ); - connect( job, SIGNAL( percent (KIO::Job *, unsigned long) ), - SIGNAL( percent (KIO::Job *, unsigned long) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotJobResult( KIO::Job * ) ) ); + connect( job, TQT_SIGNAL( data( KIO::Job *, const TQByteArray & ) ), + TQT_SLOT( slotJobData( KIO::Job *, const TQByteArray & ) ) ); + connect( job, TQT_SIGNAL( percent (KIO::Job *, unsigned long) ), + TQT_SIGNAL( percent (KIO::Job *, unsigned long) ) ); // job->dumpObjectInfo(); } -void ProviderLoader::slotJobData( KIO::Job *, const QByteArray &data ) +void ProviderLoader::slotJobData( KIO::Job *, const TQByteArray &data ) { if ( data.size() == 0 ) return; - QCString str( data, data.size() + 1 ); - mJobData.append( QString::fromUtf8( str ) ); + TQCString str( data, data.size() + 1 ); + mJobData.append( TQString::fromUtf8( str ) ); } void ProviderLoader::slotJobResult( KIO::Job *job ) @@ -67,29 +67,29 @@ void ProviderLoader::slotJobResult( KIO::Job *job ) job->showErrorDialog( mParentWidget ); if(mTryAlt && !mAltProvider.isEmpty()) { mTryAlt = false; - load(QString(), mAltProvider); + load(TQString(), mAltProvider); } else { emit error(); } return; } - QDomDocument doc; + TQDomDocument doc; if ( !doc.setContent( mJobData ) ) { myDebug() << "ProviderLoader::slotJobResult() - error parsing providers list." << endl; if(mTryAlt && !mAltProvider.isEmpty()) { mTryAlt = false; - load(QString(), mAltProvider); + load(TQString(), mAltProvider); } else { emit error(); } return; } - QDomElement providers = doc.documentElement(); - QDomNode n; + TQDomElement providers = doc.documentElement(); + TQDomNode n; for ( n = providers.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement p = n.toElement(); + TQDomElement p = n.toElement(); if ( p.tagName() == Latin1Literal("provider") ) { mProviders.append( new KNS::Provider( p ) ); diff --git a/src/newstuff/providerloader.h b/src/newstuff/providerloader.h index 3d2968c..a492dcc 100644 --- a/src/newstuff/providerloader.h +++ b/src/newstuff/providerloader.h @@ -21,8 +21,8 @@ #ifndef TELLICO_NEWSTUFF_PROVIDERLOADER_H #define TELLICO_NEWSTUFF_PROVIDERLOADER_H -#include <qobject.h> -#include <qptrlist.h> +#include <tqobject.h> +#include <tqptrlist.h> namespace KIO { class Job; @@ -34,15 +34,16 @@ namespace KNS { namespace Tellico { namespace NewStuff { -class ProviderLoader : public QObject { +class ProviderLoader : public TQObject { Q_OBJECT + TQ_OBJECT public: /** * Constructor. * - * @param parentWidget the parent widget + * @param tqparentWidget the tqparent widget */ - ProviderLoader( QWidget *parentWidget ); + ProviderLoader( TQWidget *tqparentWidget ); /** * Starts asynchronously loading the list of providers of the @@ -53,29 +54,29 @@ public: * we first try the ProvidersUrl from KGlobal::config, then we * fall back to a hardcoded value. */ - void load( const QString &type, const QString &providerList = QString::null ); + void load( const TQString &type, const TQString &providerList = TQString() ); - void setAlternativeProvider(const QString& alt) { mAltProvider = alt; } + void setAlternativeProvider(const TQString& alt) { mAltProvider = alt; } signals: /** * Indicates that the list of providers has been successfully loaded. */ - void providersLoaded( QPtrList<KNS::Provider>* ); + void providersLoaded( TQPtrList<KNS::Provider>* ); void percent(KIO::Job *job, unsigned long percent); void error(); protected slots: - void slotJobData( KIO::Job *, const QByteArray & ); + void slotJobData( KIO::Job *, const TQByteArray & ); void slotJobResult( KIO::Job * ); private: - QWidget *mParentWidget; + TQWidget *mParentWidget; - QString mJobData; + TQString mJobData; - QPtrList<KNS::Provider> mProviders; - QString mAltProvider; + TQPtrList<KNS::Provider> mProviders; + TQString mAltProvider; bool mTryAlt; }; |