diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /knewsticker/knewsticker.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knewsticker/knewsticker.cpp')
-rw-r--r-- | knewsticker/knewsticker.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/knewsticker/knewsticker.cpp b/knewsticker/knewsticker.cpp index 6d2f90cb..9b15f5da 100644 --- a/knewsticker/knewsticker.cpp +++ b/knewsticker/knewsticker.cpp @@ -27,36 +27,36 @@ #include <kstandarddirs.h> #include <kstartupinfo.h> -#include <qcursor.h> -#include <qlayout.h> -#include <qtimer.h> -#include <qtooltip.h> +#include <tqcursor.h> +#include <tqlayout.h> +#include <tqtimer.h> +#include <tqtooltip.h> #include <dcopclient.h> -KNewsTicker::KNewsTicker(const QString &cfgFile, Type t, int actions, QWidget *parent, const char *name) +KNewsTicker::KNewsTicker(const TQString &cfgFile, Type t, int actions, TQWidget *parent, const char *name) : ConfigIface(), DCOPObject("KNewsTicker"), KPanelApplet(cfgFile, t, actions, parent, name), m_instance(new KInstance("knewsticker")), m_dcopClient(new DCOPClient()), m_cfg(new ConfigAccess(config())), - m_newsTimer(new QTimer(this)), - m_updateTimer(new QTimer(this)), + m_newsTimer(new TQTimer(this)), + m_updateTimer(new TQTimer(this)), m_newsIconMgr(NewsIconMgr::self()), m_aboutData(new KAboutData("knewsticker", I18N_NOOP("KNewsTicker"), "v0.2", I18N_NOOP("A news ticker applet."), KAboutData::License_BSD, I18N_NOOP("(c) 2000, 2001 The KNewsTicker developers"))) { - QHBoxLayout *layout = new QHBoxLayout(this); + TQHBoxLayout *layout = new TQHBoxLayout(this); m_contextMenu = new KNewsTickerMenu(this); - connect(m_contextMenu, SIGNAL(aboutToHide()), - SLOT(slotContextMenuAboutToHide())); + connect(m_contextMenu, TQT_SIGNAL(aboutToHide()), + TQT_SLOT(slotContextMenuAboutToHide())); setCustomMenu(m_contextMenu); m_arrowButton = new KArrowButton(this); - QToolTip::add(m_arrowButton, i18n("Show menu")); - connect(m_arrowButton, SIGNAL(clicked()), SLOT(slotArrowButtonPressed())); + TQToolTip::add(m_arrowButton, i18n("Show menu")); + connect(m_arrowButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotArrowButtonPressed())); m_arrowButton->setFocusPolicy(NoFocus); setupArrowButton(); layout->addWidget(m_arrowButton); @@ -66,12 +66,12 @@ KNewsTicker::KNewsTicker(const QString &cfgFile, Type t, int actions, QWidget *p m_dcopClient->registerAs("knewsticker", false); - QToolTip::add(m_scroller, QString::null); - connect(m_scroller, SIGNAL(contextMenu()), SLOT(slotOpenContextMenu())); + TQToolTip::add(m_scroller, TQString::null); + connect(m_scroller, TQT_SIGNAL(contextMenu()), TQT_SLOT(slotOpenContextMenu())); - connect(m_newsTimer, SIGNAL(timeout()), SLOT(slotUpdateNews())); + connect(m_newsTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotUpdateNews())); - connect(m_updateTimer, SIGNAL(timeout()), SLOT(slotNotifyOfFailures())); + connect(m_updateTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotNotifyOfFailures())); m_aboutData->addAuthor("Frerich Raabe", I18N_NOOP("Original author"), "raabe@kde.org"); @@ -106,7 +106,7 @@ int KNewsTicker::widthForHeight(int) const void KNewsTicker::preferences() { KNewsTickerConfig dlg(m_cfg, this); - if (dlg.exec() == QDialog::Accepted) { + if (dlg.exec() == TQDialog::Accepted) { reparseConfig(); } } @@ -119,7 +119,7 @@ void KNewsTicker::about() void KNewsTicker::help() { - kapp->invokeHelp(QString::null, QString::fromLatin1("knewsticker")); + kapp->invokeHelp(TQString::null, TQString::fromLatin1("knewsticker")); } void KNewsTicker::reportBug() @@ -133,18 +133,18 @@ void KNewsTicker::reparseConfig() m_cfg->reparseConfiguration(); m_newsSources.clear(); - QStringList newsSources = m_cfg->newsSources(); - QStringList::ConstIterator it = newsSources.begin(); - QStringList::ConstIterator end = newsSources.end(); + TQStringList newsSources = m_cfg->newsSources(); + TQStringList::ConstIterator it = newsSources.begin(); + TQStringList::ConstIterator end = newsSources.end(); for (; it != end; ++it) { NewsSourceBase::Ptr ns = m_cfg->newsSource((*it)); if (!ns->data().enabled) continue; - connect(ns, SIGNAL(newNewsAvailable(const NewsSourceBase::Ptr &, bool)), - SLOT(slotNewsSourceUpdated(const NewsSourceBase::Ptr &, bool))); - connect(ns, SIGNAL(invalidInput(const NewsSourceBase::Ptr &)), - SLOT(slotNewsSourceFailed(const NewsSourceBase::Ptr &))); + connect(ns, TQT_SIGNAL(newNewsAvailable(const NewsSourceBase::Ptr &, bool)), + TQT_SLOT(slotNewsSourceUpdated(const NewsSourceBase::Ptr &, bool))); + connect(ns, TQT_SIGNAL(invalidInput(const NewsSourceBase::Ptr &)), + TQT_SLOT(slotNewsSourceFailed(const NewsSourceBase::Ptr &))); m_newsSources.append(ns); } @@ -212,7 +212,7 @@ void KNewsTicker::slotNewsSourceUpdated(const NewsSourceBase::Ptr &ns, if (m_newNews) { KNotifyClient::Instance instance(m_instance); - KNotifyClient::event(winId(), QString::fromLatin1("NewNews")); + KNotifyClient::event(winId(), TQString::fromLatin1("NewNews")); } } @@ -222,22 +222,22 @@ void KNewsTicker::slotNewsSourceFailed(const NewsSourceBase::Ptr &ns) slotNewsSourceUpdated(ns); } -void KNewsTicker::mousePressEvent(QMouseEvent *e) +void KNewsTicker::mousePressEvent(TQMouseEvent *e) { - if (e->button() == QMouseEvent::RightButton) + if (e->button() == TQMouseEvent::RightButton) slotOpenContextMenu(); } void KNewsTicker::slotOpenContextMenu() { m_contextMenu->setFullMenu(true); - m_contextMenu->exec(QCursor::pos()); + m_contextMenu->exec(TQCursor::pos()); } void KNewsTicker::slotArrowButtonPressed() { - QPoint pos(m_arrowButton->mapToGlobal(QPoint(0, 0))); - QSize size(m_arrowButton->size()); + TQPoint pos(m_arrowButton->mapToGlobal(TQPoint(0, 0))); + TQSize size(m_arrowButton->size()); if (position() == KPanelApplet::pTop) { pos.setY(pos.y() + size.height() + 2); @@ -259,12 +259,12 @@ void KNewsTicker::positionChange(Position) { delete layout(); - QBoxLayout *layout; + TQBoxLayout *layout; if (orientation() == Horizontal) - layout = new QHBoxLayout(this); + layout = new TQHBoxLayout(this); else - layout = new QVBoxLayout(this); + layout = new TQVBoxLayout(this); if (m_arrowButton) { layout->addWidget(m_arrowButton); @@ -283,7 +283,7 @@ void KNewsTicker::slotContextMenuAboutToHide() void KNewsTicker::slotNotifyOfFailures() { KNotifyClient::Instance instance(m_instance); - QString notification = QString::null; + TQString notification = TQString::null; if (m_failedNewsUpdates.count() == 1) notification = i18n("<qt>Could not update news site '%1'.<br>" @@ -292,16 +292,16 @@ void KNewsTicker::slotNotifyOfFailures() else if (m_failedNewsUpdates.count() > 1 && m_failedNewsUpdates.count() < 8) { notification = i18n("<qt>The following news sites had problems. Their" " resource files are probably invalid or broken.<ul>"); - QStringList::ConstIterator it = m_failedNewsUpdates.begin(); - QStringList::ConstIterator end = m_failedNewsUpdates.end(); + TQStringList::ConstIterator it = m_failedNewsUpdates.begin(); + TQStringList::ConstIterator end = m_failedNewsUpdates.end(); for (; it != end; ++it) - notification += QString::fromLatin1("<li>%1</li>").arg(*it); - notification += QString::fromLatin1("</ul></qt>"); + notification += TQString::fromLatin1("<li>%1</li>").arg(*it); + notification += TQString::fromLatin1("</ul></qt>"); } else notification = i18n("Failed to update several news" " sites. The Internet connection might be cut."); - KNotifyClient::event(winId(), QString::fromLatin1("InvalidRDF"), notification); + KNotifyClient::event(winId(), TQString::fromLatin1("InvalidRDF"), notification); } void KNewsTicker::setInterval(const uint interval) @@ -367,19 +367,19 @@ void KNewsTicker::setSlowedScrolling(bool slowedScrolling) m_cfg->setSlowedScrolling(slowedScrolling); } -void KNewsTicker::setForegroundColor(const QColor &foregroundColor) +void KNewsTicker::setForegroundColor(const TQColor &foregroundColor) { m_cfg->setForegroundColor(foregroundColor); m_scroller->reset(false); } -void KNewsTicker::setBackgroundColor(const QColor &backgroundColor) +void KNewsTicker::setBackgroundColor(const TQColor &backgroundColor) { m_cfg->setBackgroundColor(backgroundColor); m_scroller->reset(false); } -void KNewsTicker::setHighlightedColor(const QColor &highlightedColor) +void KNewsTicker::setHighlightedColor(const TQColor &highlightedColor) { m_cfg->setHighlightedColor(highlightedColor); m_scroller->reset(false); @@ -417,10 +417,10 @@ void KNewsTickerMenu::populateMenu() * Perhaps this hardcoded stuff should be replaced by some kind of * themeing functionality? */ - const QPixmap lookIcon = SmallIcon(QString::fromLatin1("viewmag")); - const QPixmap newArticleIcon = SmallIcon(QString::fromLatin1("info")); - const QPixmap oldArticleIcon = SmallIcon(QString::fromLatin1("mime_empty")); - const QPixmap noArticlesIcon = SmallIcon(QString::fromLatin1("remove")); + const TQPixmap lookIcon = SmallIcon(TQString::fromLatin1("viewmag")); + const TQPixmap newArticleIcon = SmallIcon(TQString::fromLatin1("info")); + const TQPixmap oldArticleIcon = SmallIcon(TQString::fromLatin1("mime_empty")); + const TQPixmap noArticlesIcon = SmallIcon(TQString::fromLatin1("remove")); unsigned int articleIdx = 0; const NewsSourceBase::List sources = m_parent->m_newsSources; @@ -429,7 +429,7 @@ void KNewsTickerMenu::populateMenu() NewsSourceBase::Ptr ns = *nIt; KPopupMenu *submenu = new KPopupMenu; - int checkNewsId = submenu->insertItem(lookIcon, i18n("Check News"), this, SLOT(slotCheckNews(int)), 0, sources.findIndex(ns) + 1000); + int checkNewsId = submenu->insertItem(lookIcon, i18n("Check News"), this, TQT_SLOT(slotCheckNews(int)), 0, sources.findIndex(ns) + 1000); setItemParameter(checkNewsId, sources.findIndex(ns)); submenu->insertSeparator(); @@ -441,12 +441,12 @@ void KNewsTickerMenu::populateMenu() Article::List::ConstIterator artIt = articles.begin(); for (; artIt != articles.end(); ++artIt) { Article::Ptr a = *artIt; - QString headline = a->headline().replace('&', "&&"); + TQString headline = a->headline().replace('&', "&&"); int id; if ( a->read() ) - id = submenu->insertItem(oldArticleIcon, headline, this, SLOT(slotOpenArticle(int)), 0, articleIdx+2000); + id = submenu->insertItem(oldArticleIcon, headline, this, TQT_SLOT(slotOpenArticle(int)), 0, articleIdx+2000); else - id = submenu->insertItem(newArticleIcon, headline, this, SLOT(slotOpenArticle(int)), 0, articleIdx+2000); + id = submenu->insertItem(newArticleIcon, headline, this, TQT_SLOT(slotOpenArticle(int)), 0, articleIdx+2000); kdDebug( 5005 ) << "Setting articles index for " << a->headline() << " to " << articleIdx << endl; setItemParameter( id, articleIdx++ ); } @@ -460,23 +460,23 @@ void KNewsTickerMenu::populateMenu() if (!m_parent->m_cfg->newsSources().isEmpty()) insertSeparator(); - insertItem(lookIcon, i18n("Check News"), m_parent, SLOT(slotUpdateNews())); - int i = insertItem(i18n("Offline Mode"), this, SLOT(slotToggleOfflineMode()), 0, 4711 ); + insertItem(lookIcon, i18n("Check News"), m_parent, TQT_SLOT(slotUpdateNews())); + int i = insertItem(i18n("Offline Mode"), this, TQT_SLOT(slotToggleOfflineMode()), 0, 4711 ); setItemChecked(i, m_parent->m_cfg->offlineMode()); if (m_fullMenu) { insertSeparator(); - const QPixmap logoIcon = SmallIcon(QString::fromLatin1("knewsticker")); - const QPixmap helpIcon = SmallIcon(QString::fromLatin1("help")); - const QPixmap confIcon = SmallIcon(QString::fromLatin1("configure")); + const TQPixmap logoIcon = SmallIcon(TQString::fromLatin1("knewsticker")); + const TQPixmap helpIcon = SmallIcon(TQString::fromLatin1("help")); + const TQPixmap confIcon = SmallIcon(TQString::fromLatin1("configure")); insertTitle(logoIcon, i18n("KNewsTicker"), 0, 0); - insertItem(helpIcon, i18n("Help"), this, SLOT(slotShowHelp())); - insertItem(logoIcon, i18n("About KNewsTicker"), this, SLOT(slotShowAbout())); + insertItem(helpIcon, i18n("Help"), this, TQT_SLOT(slotShowHelp())); + insertItem(logoIcon, i18n("About KNewsTicker"), this, TQT_SLOT(slotShowAbout())); insertSeparator(); - insertItem(confIcon, i18n("Configure KNewsTicker..."), this, SLOT(slotConfigure())); + insertItem(confIcon, i18n("Configure KNewsTicker..."), this, TQT_SLOT(slotConfigure())); } } @@ -533,9 +533,9 @@ void KNewsTickerMenu::slotOpenArticle(int idx) extern "C" { - KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString &configFile) + KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString &configFile) { - KGlobal::locale()->insertCatalogue(QString::fromLatin1("knewsticker")); + KGlobal::locale()->insertCatalogue(TQString::fromLatin1("knewsticker")); return new KNewsTicker(configFile, KPanelApplet::Stretch, KPanelApplet::Preferences | KPanelApplet::About | KPanelApplet::Help | KPanelApplet::ReportBug, |