diff options
Diffstat (limited to 'knewsticker/knewstickerconfig.cpp')
-rw-r--r-- | knewsticker/knewstickerconfig.cpp | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/knewsticker/knewstickerconfig.cpp b/knewsticker/knewstickerconfig.cpp index 528269a0..4aa04851 100644 --- a/knewsticker/knewstickerconfig.cpp +++ b/knewsticker/knewstickerconfig.cpp @@ -26,15 +26,15 @@ #include <knuminput.h> #include <kpopupmenu.h> -#include <qcursor.h> -#include <qcheckbox.h> -#include <qdragobject.h> -#include <qlabel.h> -#include <qslider.h> -#include <qregexp.h> +#include <tqcursor.h> +#include <tqcheckbox.h> +#include <tqdragobject.h> +#include <tqlabel.h> +#include <tqslider.h> +#include <tqregexp.h> -CategoryItem::CategoryItem(QListView *parent, const QString &text) - : QListViewItem(parent, text) +CategoryItem::CategoryItem(TQListView *parent, const TQString &text) + : TQListViewItem(parent, text) { setOpen(true); } @@ -42,16 +42,16 @@ CategoryItem::CategoryItem(QListView *parent, const QString &text) void CategoryItem::setOpen(bool open) { if (open) - setPixmap(0, SmallIcon(QString::fromLatin1("folder_open"))); + setPixmap(0, SmallIcon(TQString::fromLatin1("folder_open"))); else - setPixmap(0, SmallIcon(QString::fromLatin1("folder"))); + setPixmap(0, SmallIcon(TQString::fromLatin1("folder"))); - QListViewItem::setOpen(open); + TQListViewItem::setOpen(open); } NewsSourceItem::NewsSourceItem(KNewsTickerConfig *kcm, CategoryItem *parent, const NewsSourceBase::Data &nsd) - : QCheckListItem(parent, QString::null, QCheckListItem::CheckBox), + : TQCheckListItem(parent, TQString::null, TQCheckListItem::CheckBox), m_parent(parent), m_kcm(kcm) { @@ -76,7 +76,7 @@ void NewsSourceItem::setData(const NewsSourceBase::Data &nsd) setOn(nsd.enabled); setText(0, nsd.name); setText(1, nsd.sourceFile); - setText(2, QString::number(nsd.maxArticles)); + setText(2, TQString::number(nsd.maxArticles)); m_icon = nsd.icon; m_isProgram = nsd.isProgram; @@ -84,12 +84,12 @@ void NewsSourceItem::setData(const NewsSourceBase::Data &nsd) m_kcm->getNewsIcon(this, KURL( m_icon )); } -void NewsSourceItem::setIcon(const QPixmap &pixmap) +void NewsSourceItem::setIcon(const TQPixmap &pixmap) { setPixmap(0, pixmap); } -KNewsTickerConfig::KNewsTickerConfig(ConfigAccess *cfg, QWidget *parent, const char *name) +KNewsTickerConfig::KNewsTickerConfig(ConfigAccess *cfg, TQWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Configuration"), Ok|Close), m_cfg(cfg), m_child(new KNewsTickerConfigWidget(this)), @@ -109,31 +109,31 @@ KNewsTickerConfig::KNewsTickerConfig(ConfigAccess *cfg, QWidget *parent, const m_child->lvNewsSources->viewport()->installEventFilter(this); m_child->lvNewsSources->installEventFilter(this); - connect(m_newsIconMgr, SIGNAL(gotIcon(const KURL &, const QPixmap &)), SLOT(slotGotNewsIcon(const KURL &, const QPixmap &))); - connect(m_child->bChooseFont, SIGNAL(clicked()), SLOT(slotChooseFont())); - - connect(m_child->lvNewsSources, SIGNAL(contextMenu(KListView *, QListViewItem *, const QPoint &)), - SLOT(slotNewsSourceContextMenu(KListView *, QListViewItem *, const QPoint &))); - connect(m_child->lvNewsSources, SIGNAL(selectionChanged()), - SLOT(slotNewsSourceSelectionChanged())); - connect(m_child->lvNewsSources, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), - SLOT(slotModifyNewsSource(QListViewItem *, const QPoint &, int))); - connect(m_child->bAddNewsSource, SIGNAL(clicked()), SLOT(slotAddNewsSource())); - connect(m_child->bRemoveNewsSource, SIGNAL(clicked()), SLOT(slotRemoveNewsSource())); - connect(m_child->bModifyNewsSource, SIGNAL(clicked()), SLOT(slotModifyNewsSource())); - - connect(m_child->lvFilters, SIGNAL(selectionChanged(QListViewItem *)), - SLOT(slotFilterSelectionChanged(QListViewItem *))); - connect(m_child->comboFilterAction, SIGNAL(activated(const QString &)), - SLOT(slotFilterActionChanged(const QString &))); - connect(m_child->comboFilterNewsSource, SIGNAL(activated(const QString &)), - SLOT(slotFilterNewsSourceChanged(const QString &))); - connect(m_child->comboFilterCondition, SIGNAL(activated(const QString &)), - SLOT(slotFilterConditionChanged(const QString &))); - connect(m_child->leFilterExpression, SIGNAL(textChanged(const QString &)), - SLOT(slotFilterExpressionChanged(const QString &))); - connect(m_child->bAddFilter, SIGNAL(clicked()), SLOT(slotAddFilter())); - connect(m_child->bRemoveFilter, SIGNAL(clicked()), SLOT(slotRemoveFilter())); + connect(m_newsIconMgr, TQT_SIGNAL(gotIcon(const KURL &, const TQPixmap &)), TQT_SLOT(slotGotNewsIcon(const KURL &, const TQPixmap &))); + connect(m_child->bChooseFont, TQT_SIGNAL(clicked()), TQT_SLOT(slotChooseFont())); + + connect(m_child->lvNewsSources, TQT_SIGNAL(contextMenu(KListView *, TQListViewItem *, const TQPoint &)), + TQT_SLOT(slotNewsSourceContextMenu(KListView *, TQListViewItem *, const TQPoint &))); + connect(m_child->lvNewsSources, TQT_SIGNAL(selectionChanged()), + TQT_SLOT(slotNewsSourceSelectionChanged())); + connect(m_child->lvNewsSources, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(slotModifyNewsSource(TQListViewItem *, const TQPoint &, int))); + connect(m_child->bAddNewsSource, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddNewsSource())); + connect(m_child->bRemoveNewsSource, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveNewsSource())); + connect(m_child->bModifyNewsSource, TQT_SIGNAL(clicked()), TQT_SLOT(slotModifyNewsSource())); + + connect(m_child->lvFilters, TQT_SIGNAL(selectionChanged(TQListViewItem *)), + TQT_SLOT(slotFilterSelectionChanged(TQListViewItem *))); + connect(m_child->comboFilterAction, TQT_SIGNAL(activated(const TQString &)), + TQT_SLOT(slotFilterActionChanged(const TQString &))); + connect(m_child->comboFilterNewsSource, TQT_SIGNAL(activated(const TQString &)), + TQT_SLOT(slotFilterNewsSourceChanged(const TQString &))); + connect(m_child->comboFilterCondition, TQT_SIGNAL(activated(const TQString &)), + TQT_SLOT(slotFilterConditionChanged(const TQString &))); + connect(m_child->leFilterExpression, TQT_SIGNAL(textChanged(const TQString &)), + TQT_SLOT(slotFilterExpressionChanged(const TQString &))); + connect(m_child->bAddFilter, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddFilter())); + connect(m_child->bRemoveFilter, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveFilter())); load(); @@ -162,8 +162,8 @@ void KNewsTickerConfig::load() m_child->cbShowIcons->setChecked(m_cfg->showIcons()); m_child->lvNewsSources->clear(); - QStringList nsList = m_cfg->newsSources(); - for (QStringList::Iterator it = nsList.begin(); it != nsList.end(); ++it) + TQStringList nsList = m_cfg->newsSources(); + for (TQStringList::Iterator it = nsList.begin(); it != nsList.end(); ++it) addNewsSource(m_cfg->newsSource((*it))->data()); ArticleFilter::List filterList = m_cfg->filters(); @@ -193,8 +193,8 @@ void KNewsTickerConfig::save() m_cfg->setUnderlineHighlighted(m_child->cbUnderlineHighlighted->isChecked()); m_cfg->setShowIcons(m_child->cbShowIcons->isChecked()); - QStringList newsSources; - for (QListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) + TQStringList newsSources; + for (TQListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) if (NewsSourceItem *item = dynamic_cast<NewsSourceItem *>(it.current())) { newsSources += item->data().name; m_cfg->setNewsSource(item->data()); @@ -204,8 +204,8 @@ void KNewsTickerConfig::save() ArticleFilter::List filters; ArticleFilter f; unsigned int i = 0; - for (QListViewItemIterator it(m_child->lvFilters); it.current(); it++) - if (QCheckListItem *item = dynamic_cast<QCheckListItem *>(it.current())) { + for (TQListViewItemIterator it(m_child->lvFilters); it.current(); it++) + if (TQCheckListItem *item = dynamic_cast<TQCheckListItem *>(it.current())) { filters.append(i); f.setAction(item->text(0)); f.setNewsSource(item->text(2)); @@ -218,30 +218,30 @@ void KNewsTickerConfig::save() m_cfg->setFilters(filters); } -bool KNewsTickerConfig::eventFilter(QObject *o, QEvent *e) +bool KNewsTickerConfig::eventFilter(TQObject *o, TQEvent *e) { //<HACK> - // "if ( e->type() == QEvent::DragEnter ) {" shoult normaly be enough. but there must be a bug somewhere in KListView. - if ( e->type() == QEvent::DragMove ) { + // "if ( e->type() == TQEvent::DragEnter ) {" shoult normaly be enough. but there must be a bug somewhere in KListView. + if ( e->type() == TQEvent::DragMove ) { //</HACK> - QDragEnterEvent *d = (QDragEnterEvent*)e; - d->accept(QTextDrag::canDecode(d)); + TQDragEnterEvent *d = (TQDragEnterEvent*)e; + d->accept(TQTextDrag::canDecode(d)); return true; // eat event } - else if ( e->type() == QEvent::Drop) { - QDropEvent *d = (QDropEvent*)e; - QString newSourceUrl; - if ( QTextDrag::decode(d, newSourceUrl) ) { + else if ( e->type() == TQEvent::Drop) { + TQDropEvent *d = (TQDropEvent*)e; + TQString newSourceUrl; + if ( TQTextDrag::decode(d, newSourceUrl) ) { // <HACK> // This is just for http://www.webreference.com/services/news/ - newSourceUrl = newSourceUrl.replace( QRegExp("^view-source:http%3A//"), "http://" ); + newSourceUrl = newSourceUrl.replace( TQRegExp("^view-source:http%3A//"), "http://" ); // </HACK> newSourceUrl = newSourceUrl.stripWhiteSpace(); //look for a new Name of Source: - QString name = i18n("Unknown"); + TQString name = i18n("Unknown"); bool validName = false; - for (QListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { + for (TQListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { if (it.current()->text(0) == name) { validName = false; break; @@ -252,7 +252,7 @@ bool KNewsTickerConfig::eventFilter(QObject *o, QEvent *e) int i = 0; while (validName == false) { name = i18n("Unknown %1").arg(i); - for (QListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { + for (TQListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { if (it.current()->text(0) == name) { i++; validName = false; @@ -265,17 +265,17 @@ bool KNewsTickerConfig::eventFilter(QObject *o, QEvent *e) NewsSourceBase::Data nsd(name, newSourceUrl, "" , NewsSourceBase::Computers , 10, true, false); NewsSourceDlgImpl nsDlg(this, 0L, true); - connect(&nsDlg, SIGNAL(newsSource(const NewsSourceBase::Data &)), - SLOT(slotAddNewsSource(const NewsSourceBase::Data &))); + connect(&nsDlg, TQT_SIGNAL(newsSource(const NewsSourceBase::Data &)), + TQT_SLOT(slotAddNewsSource(const NewsSourceBase::Data &))); nsDlg.setup(nsd, false); nsDlg.exec(); } return true; // eat event } - return QWidget::eventFilter( o, e ); + return TQWidget::eventFilter( o, e ); } -void KNewsTickerConfig::resizeEvent(QResizeEvent *) +void KNewsTickerConfig::resizeEvent(TQResizeEvent *) { m_child->resize(width(), height()); } @@ -285,7 +285,7 @@ void KNewsTickerConfig::addNewsSource(const NewsSourceBase::Data &nsd, { CategoryItem *catItem = 0L; - for (QListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { + for (TQListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { if (it.current()->text(0) == NewsSourceBase::subjectText(nsd.subject)) { catItem = static_cast<CategoryItem *>(it.current()); break; @@ -305,7 +305,7 @@ void KNewsTickerConfig::addNewsSource(const NewsSourceBase::Data &nsd, void KNewsTickerConfig::addFilter(const ArticleFilter &fd) { - QCheckListItem *item = new QCheckListItem(m_child->lvFilters, fd.action(), QCheckListItem::CheckBox); + TQCheckListItem *item = new TQCheckListItem(m_child->lvFilters, fd.action(), TQCheckListItem::CheckBox); item->setOn(fd.enabled()); item->setText(1, m_child->lArticles->text()); item->setText(2, fd.newsSource()); @@ -320,11 +320,11 @@ void KNewsTickerConfig::removeNewsSource() " source?</p>", "<p>Do you really want to remove these %n news" " sources?</p>", - m_child->lvNewsSources->selectedItems().count()), QString::null, KStdGuiItem::del()) == KMessageBox::Continue) { + m_child->lvNewsSources->selectedItems().count()), TQString::null, KStdGuiItem::del()) == KMessageBox::Continue) { int itemCount = m_child->lvNewsSources->selectedItems().count(); for (int j = 0; j < itemCount; j++) { if (m_child->lvNewsSources->selectedItems().isEmpty()) { break; } - QListViewItem *item = m_child->lvNewsSources->selectedItems().take(0); + TQListViewItem *item = m_child->lvNewsSources->selectedItems().take(0); for (int i = 0; i < m_child->comboFilterNewsSource->count(); i++) if (m_child->comboFilterNewsSource->text(i) == item->text(0)) { m_child->comboFilterNewsSource->removeItem(i); @@ -340,26 +340,26 @@ void KNewsTickerConfig::removeNewsSource() } } -void KNewsTickerConfig::removeFilter(QListViewItem *item) +void KNewsTickerConfig::removeFilter(TQListViewItem *item) { if (KMessageBox::warningContinueCancel(this, i18n("<p>Do you really want to remove the selected" - " filter?</p>"), QString::null, KStdGuiItem::del()) == KMessageBox::Continue) { + " filter?</p>"), TQString::null, KStdGuiItem::del()) == KMessageBox::Continue) { delete item; m_child->bRemoveFilter->setEnabled(false); } } -void KNewsTickerConfig::slotNewsSourceContextMenu(KListView *, QListViewItem *item, const QPoint &) +void KNewsTickerConfig::slotNewsSourceContextMenu(KListView *, TQListViewItem *item, const TQPoint &) { if (!dynamic_cast<NewsSourceItem *>(item)) return; KPopupMenu *menu = new KPopupMenu(); - QPixmap addIcon = SmallIcon(QString::fromLatin1("news_subscribe")); - QPixmap modifyIcon = SmallIcon(QString::fromLatin1("edit")); - QPixmap removeIcon = SmallIcon(QString::fromLatin1("news_unsubscribe")); - QPixmap logoIcon = SmallIcon(QString::fromLatin1("knewsticker")); + TQPixmap addIcon = SmallIcon(TQString::fromLatin1("news_subscribe")); + TQPixmap modifyIcon = SmallIcon(TQString::fromLatin1("edit")); + TQPixmap removeIcon = SmallIcon(TQString::fromLatin1("news_unsubscribe")); + TQPixmap logoIcon = SmallIcon(TQString::fromLatin1("knewsticker")); menu->insertTitle(logoIcon, i18n("Edit News Source")); menu->insertItem(addIcon, i18n("&Add News Source"), 0); @@ -377,7 +377,7 @@ void KNewsTickerConfig::slotNewsSourceContextMenu(KListView *, QListViewItem *it menu->setItemEnabled(2, false); } - switch (menu->exec(QCursor::pos())) { + switch (menu->exec(TQCursor::pos())) { case 0: slotAddNewsSource(); break; case 1: modifyNewsSource(item); break; case 2: removeNewsSource(); break; @@ -402,8 +402,8 @@ void KNewsTickerConfig::slotChooseFont() void KNewsTickerConfig::slotAddNewsSource() { NewsSourceDlgImpl nsDlg(this, 0L, true); - connect(&nsDlg, SIGNAL(newsSource(const NewsSourceBase::Data &)), - SLOT(slotAddNewsSource(const NewsSourceBase::Data &))); + connect(&nsDlg, TQT_SIGNAL(newsSource(const NewsSourceBase::Data &)), + TQT_SLOT(slotAddNewsSource(const NewsSourceBase::Data &))); nsDlg.exec(); } @@ -421,14 +421,14 @@ void KNewsTickerConfig::slotModifyNewsSource() void KNewsTickerConfig::slotModifyNewsSource(const NewsSourceBase::Data &nsd) { if (m_modifyItem->data().subject != nsd.subject) { - QListViewItem *parentItem = m_modifyItem->parentItem(); + TQListViewItem *parentItem = m_modifyItem->parentItem(); parentItem->takeItem(m_modifyItem); if (parentItem->childCount() == 0) delete parentItem; CategoryItem *catItem = 0L; - for (QListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { + for (TQListViewItemIterator it(m_child->lvNewsSources); it.current(); it++) { if (it.current()->text(0) == NewsSourceBase::subjectText(nsd.subject)) { catItem = static_cast<CategoryItem *>(it.current()); break; @@ -445,13 +445,13 @@ void KNewsTickerConfig::slotModifyNewsSource(const NewsSourceBase::Data &nsd) m_modifyItem->setData(nsd); } -void KNewsTickerConfig::slotModifyNewsSource(QListViewItem *item, const QPoint &, int) +void KNewsTickerConfig::slotModifyNewsSource(TQListViewItem *item, const TQPoint &, int) { if (dynamic_cast<NewsSourceItem *>(item)) modifyNewsSource(item); } -void KNewsTickerConfig::modifyNewsSource(QListViewItem *item) +void KNewsTickerConfig::modifyNewsSource(TQListViewItem *item) { if ((m_modifyItem = dynamic_cast<NewsSourceItem *>(item))) openModifyDialog(); @@ -460,8 +460,8 @@ void KNewsTickerConfig::modifyNewsSource(QListViewItem *item) void KNewsTickerConfig::openModifyDialog() { NewsSourceDlgImpl nsDlg(this, 0L, true); - connect(&nsDlg, SIGNAL(newsSource(const NewsSourceBase::Data &)), - SLOT(slotModifyNewsSource(const NewsSourceBase::Data &))); + connect(&nsDlg, TQT_SIGNAL(newsSource(const NewsSourceBase::Data &)), + TQT_SLOT(slotModifyNewsSource(const NewsSourceBase::Data &))); nsDlg.setup(m_modifyItem->data(), true); nsDlg.exec(); } @@ -484,7 +484,7 @@ void KNewsTickerConfig::slotRemoveNewsSource() void KNewsTickerConfig::slotRemoveFilter() { - QListViewItem *item=m_child->lvFilters->selectedItem(); + TQListViewItem *item=m_child->lvFilters->selectedItem(); if(!item) return; removeFilter(item); @@ -496,7 +496,7 @@ void KNewsTickerConfig::slotNewsSourceSelectionChanged() m_child->bModifyNewsSource->setEnabled(m_child->lvNewsSources->selectedItems().count() == 1); } -void KNewsTickerConfig::slotFilterSelectionChanged(QListViewItem *item) +void KNewsTickerConfig::slotFilterSelectionChanged(TQListViewItem *item) { for (int i = 0; i < m_child->comboFilterAction->count(); i++) if (m_child->comboFilterAction->text(i) == item->text(0)) { @@ -521,36 +521,36 @@ void KNewsTickerConfig::slotFilterSelectionChanged(QListViewItem *item) m_child->bRemoveFilter->setEnabled(item); } -void KNewsTickerConfig::slotFilterActionChanged(const QString &action) +void KNewsTickerConfig::slotFilterActionChanged(const TQString &action) { - QListViewItem *item = m_child->lvFilters->selectedItem(); + TQListViewItem *item = m_child->lvFilters->selectedItem(); if (item) { item->setText(0, action); } } -void KNewsTickerConfig::slotFilterNewsSourceChanged(const QString &newsSource) +void KNewsTickerConfig::slotFilterNewsSourceChanged(const TQString &newsSource) { - QListViewItem *item = m_child->lvFilters->selectedItem(); + TQListViewItem *item = m_child->lvFilters->selectedItem(); if (item) { item->setText(2, newsSource); } } -void KNewsTickerConfig::slotFilterConditionChanged(const QString &condition) +void KNewsTickerConfig::slotFilterConditionChanged(const TQString &condition) { - QListViewItem *item = m_child->lvFilters->selectedItem(); + TQListViewItem *item = m_child->lvFilters->selectedItem(); if (item) { item->setText(4, condition); } } -void KNewsTickerConfig::slotFilterExpressionChanged(const QString &expression) +void KNewsTickerConfig::slotFilterExpressionChanged(const TQString &expression) { - QListViewItem *item = m_child->lvFilters->selectedItem(); + TQListViewItem *item = m_child->lvFilters->selectedItem(); if (item) { item->setText(5, expression); @@ -563,7 +563,7 @@ void KNewsTickerConfig::getNewsIcon(NewsSourceItem *item, const KURL &url) m_newsIconMgr->getIcon(url); } -void KNewsTickerConfig::slotGotNewsIcon(const KURL &url, const QPixmap &pixmap) +void KNewsTickerConfig::slotGotNewsIcon(const KURL &url, const TQPixmap &pixmap) { if (m_itemIconMap.find(url.url()) == m_itemIconMap.end()) { kdDebug(5005) << "Got unknown icon for URL " << url << endl; |