diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /knewsticker/knewsticker.cpp | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knewsticker/knewsticker.cpp')
-rw-r--r-- | knewsticker/knewsticker.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/knewsticker/knewsticker.cpp b/knewsticker/knewsticker.cpp index 9b15f5da..545aba63 100644 --- a/knewsticker/knewsticker.cpp +++ b/knewsticker/knewsticker.cpp @@ -34,9 +34,9 @@ #include <dcopclient.h> -KNewsTicker::KNewsTicker(const TQString &cfgFile, Type t, int actions, TQWidget *parent, const char *name) +KNewsTicker::KNewsTicker(const TQString &cfgFile, Type t, int actions, TQWidget *tqparent, const char *name) : ConfigIface(), DCOPObject("KNewsTicker"), - KPanelApplet(cfgFile, t, actions, parent, name), + KPanelApplet(cfgFile, t, actions, tqparent, name), m_instance(new KInstance("knewsticker")), m_dcopClient(new DCOPClient()), m_cfg(new ConfigAccess(config())), @@ -47,7 +47,7 @@ KNewsTicker::KNewsTicker(const TQString &cfgFile, Type t, int actions, TQWidget I18N_NOOP("A news ticker applet."), KAboutData::License_BSD, I18N_NOOP("(c) 2000, 2001 The KNewsTicker developers"))) { - TQHBoxLayout *layout = new TQHBoxLayout(this); + TQHBoxLayout *tqlayout = new TQHBoxLayout(this); m_contextMenu = new KNewsTickerMenu(this); connect(m_contextMenu, TQT_SIGNAL(aboutToHide()), @@ -57,16 +57,16 @@ KNewsTicker::KNewsTicker(const TQString &cfgFile, Type t, int actions, TQWidget m_arrowButton = new KArrowButton(this); TQToolTip::add(m_arrowButton, i18n("Show menu")); connect(m_arrowButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotArrowButtonPressed())); - m_arrowButton->setFocusPolicy(NoFocus); + m_arrowButton->setFocusPolicy(TQ_NoFocus); setupArrowButton(); - layout->addWidget(m_arrowButton); + tqlayout->addWidget(m_arrowButton); m_scroller = new NewsScroller(this, m_cfg); - layout->addWidget(m_scroller); + tqlayout->addWidget(m_scroller); m_dcopClient->registerAs("knewsticker", false); - TQToolTip::add(m_scroller, TQString::null); + TQToolTip::add(m_scroller, TQString()); connect(m_scroller, TQT_SIGNAL(contextMenu()), TQT_SLOT(slotOpenContextMenu())); connect(m_newsTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotUpdateNews())); @@ -95,12 +95,12 @@ KNewsTicker::~KNewsTicker() int KNewsTicker::heightForWidth(int) const { - return m_scroller->sizeHint().height() + m_arrowButton->height(); + return m_scroller->tqsizeHint().height() + m_arrowButton->height(); } int KNewsTicker::widthForHeight(int) const { - return m_scroller->sizeHint().width() + m_arrowButton->width(); + return m_scroller->tqsizeHint().width() + m_arrowButton->width(); } void KNewsTicker::preferences() @@ -119,7 +119,7 @@ void KNewsTicker::about() void KNewsTicker::help() { - kapp->invokeHelp(TQString::null, TQString::fromLatin1("knewsticker")); + kapp->invokeHelp(TQString(), TQString::tqfromLatin1("knewsticker")); } void KNewsTicker::reportBug() @@ -212,7 +212,7 @@ void KNewsTicker::slotNewsSourceUpdated(const NewsSourceBase::Ptr &ns, if (m_newNews) { KNotifyClient::Instance instance(m_instance); - KNotifyClient::event(winId(), TQString::fromLatin1("NewNews")); + KNotifyClient::event(winId(), TQString::tqfromLatin1("NewNews")); } } @@ -224,7 +224,7 @@ void KNewsTicker::slotNewsSourceFailed(const NewsSourceBase::Ptr &ns) void KNewsTicker::mousePressEvent(TQMouseEvent *e) { - if (e->button() == TQMouseEvent::RightButton) + if (e->button() == Qt::RightButton) slotOpenContextMenu(); } @@ -242,13 +242,13 @@ void KNewsTicker::slotArrowButtonPressed() if (position() == KPanelApplet::pTop) { pos.setY(pos.y() + size.height() + 2); } else if (position() == KPanelApplet::pBottom) { - const int y = pos.y() - m_contextMenu->sizeHint().height() - 2; - pos.setY(QMAX(0, y)); + const int y = pos.y() - m_contextMenu->tqsizeHint().height() - 2; + pos.setY(TQMAX(0, y)); } else if (position() == KPanelApplet::pLeft ) { pos.setX(pos.x() + size.width() + 2); } else { // position() == KPanelApplet::pRight - const int x = pos.x() - m_contextMenu->sizeHint().width() - 2; - pos.setX(QMAX(0, x)); + const int x = pos.x() - m_contextMenu->tqsizeHint().width() - 2; + pos.setX(TQMAX(0, x)); } m_contextMenu->setFullMenu(true); @@ -257,21 +257,21 @@ void KNewsTicker::slotArrowButtonPressed() void KNewsTicker::positionChange(Position) { - delete layout(); + delete tqlayout(); - TQBoxLayout *layout; + TQBoxLayout *tqlayout; - if (orientation() == Horizontal) - layout = new TQHBoxLayout(this); + if (orientation() ==Qt::Horizontal) + tqlayout = new TQHBoxLayout(this); else - layout = new TQVBoxLayout(this); + tqlayout = new TQVBoxLayout(this); if (m_arrowButton) { - layout->addWidget(m_arrowButton); + tqlayout->addWidget(m_arrowButton); setupArrowButton(); } - layout->addWidget(m_scroller); + tqlayout->addWidget(m_scroller); } void KNewsTicker::slotContextMenuAboutToHide() @@ -283,25 +283,25 @@ void KNewsTicker::slotContextMenuAboutToHide() void KNewsTicker::slotNotifyOfFailures() { KNotifyClient::Instance instance(m_instance); - TQString notification = TQString::null; + TQString notification = TQString(); if (m_failedNewsUpdates.count() == 1) notification = i18n("<qt>Could not update news site '%1'.<br>" "The supplied resource file is probably invalid or" - " broken.</qt>").arg(m_failedNewsUpdates.first()); + " broken.</qt>").tqarg(m_failedNewsUpdates.first()); 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>"); TQStringList::ConstIterator it = m_failedNewsUpdates.begin(); TQStringList::ConstIterator end = m_failedNewsUpdates.end(); for (; it != end; ++it) - notification += TQString::fromLatin1("<li>%1</li>").arg(*it); - notification += TQString::fromLatin1("</ul></qt>"); + notification += TQString::tqfromLatin1("<li>%1</li>").tqarg(*it); + notification += TQString::tqfromLatin1("</ul></qt>"); } else notification = i18n("Failed to update several news" " sites. The Internet connection might be cut."); - KNotifyClient::event(winId(), TQString::fromLatin1("InvalidRDF"), notification); + KNotifyClient::event(winId(), TQString::tqfromLatin1("InvalidRDF"), notification); } void KNewsTicker::setInterval(const uint interval) @@ -387,23 +387,23 @@ void KNewsTicker::setHighlightedColor(const TQColor &highlightedColor) void KNewsTicker::setupArrowButton() { - ArrowType at; + Qt::ArrowType at; - if (orientation() == Horizontal) { + if (orientation() ==Qt::Horizontal) { m_arrowButton->setFixedWidth(12); m_arrowButton->setMaximumHeight(128); - at = (position() == KPanelApplet::pTop ? DownArrow : UpArrow); + at = (position() == KPanelApplet::pTop ? Qt::DownArrow : Qt::UpArrow); } else { m_arrowButton->setMaximumWidth(128); m_arrowButton->setFixedHeight(12); - at = (position() == KPanelApplet::pLeft ? RightArrow : LeftArrow); + at = (position() == KPanelApplet::pLeft ? Qt::RightArrow : Qt::LeftArrow); } m_arrowButton->setArrowType(at); } -KNewsTickerMenu::KNewsTickerMenu(KNewsTicker *parent, const char *name) - : KPopupMenu(parent, name), - m_parent(parent), +KNewsTickerMenu::KNewsTickerMenu(KNewsTicker *tqparent, const char *name) + : KPopupMenu(tqparent, name), + m_parent(tqparent), m_fullMenu(false) { populateMenu(); @@ -417,10 +417,10 @@ void KNewsTickerMenu::populateMenu() * Perhaps this hardcoded stuff should be replaced by some kind of * themeing functionality? */ - 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")); + const TQPixmap lookIcon = SmallIcon(TQString::tqfromLatin1("viewmag")); + const TQPixmap newArticleIcon = SmallIcon(TQString::tqfromLatin1("info")); + const TQPixmap oldArticleIcon = SmallIcon(TQString::tqfromLatin1("mime_empty")); + const TQPixmap noArticlesIcon = SmallIcon(TQString::tqfromLatin1("remove")); unsigned int articleIdx = 0; const NewsSourceBase::List sources = m_parent->m_newsSources; @@ -429,19 +429,19 @@ void KNewsTickerMenu::populateMenu() NewsSourceBase::Ptr ns = *nIt; KPopupMenu *submenu = new KPopupMenu; - int checkNewsId = submenu->insertItem(lookIcon, i18n("Check News"), this, TQT_SLOT(slotCheckNews(int)), 0, sources.findIndex(ns) + 1000); - setItemParameter(checkNewsId, sources.findIndex(ns)); + int checkNewsId = submenu->insertItem(lookIcon, i18n("Check News"), TQT_TQOBJECT(this), TQT_SLOT(slotCheckNews(int)), 0, sources.tqfindIndex(ns) + 1000); + setItemParameter(checkNewsId, sources.tqfindIndex(ns)); submenu->insertSeparator(); - if (m_parent->m_pendingNewsUpdates.contains(ns->newsSourceName())) { + if (m_parent->m_pendingNewsUpdates.tqcontains(ns->newsSourceName())) { submenu->insertItem(noArticlesIcon, i18n("Currently Being Updated, No Articles Available")); } else if (!ns->articles().isEmpty()) { const Article::List articles = ns->articles(); Article::List::ConstIterator artIt = articles.begin(); for (; artIt != articles.end(); ++artIt) { Article::Ptr a = *artIt; - TQString headline = a->headline().replace('&', "&&"); + TQString headline = a->headline().tqreplace('&', "&&"); int id; if ( a->read() ) id = submenu->insertItem(oldArticleIcon, headline, this, TQT_SLOT(slotOpenArticle(int)), 0, articleIdx+2000); @@ -454,7 +454,7 @@ void KNewsTickerMenu::populateMenu() submenu->insertItem(noArticlesIcon, i18n("No Articles Available")); } - insertItem(ns->icon(), ns->newsSourceName().replace('&', "&&"), submenu); + insertItem(ns->icon(), ns->newsSourceName().tqreplace('&', "&&"), submenu); } if (!m_parent->m_cfg->newsSources().isEmpty()) @@ -467,9 +467,9 @@ void KNewsTickerMenu::populateMenu() if (m_fullMenu) { insertSeparator(); - const TQPixmap logoIcon = SmallIcon(TQString::fromLatin1("knewsticker")); - const TQPixmap helpIcon = SmallIcon(TQString::fromLatin1("help")); - const TQPixmap confIcon = SmallIcon(TQString::fromLatin1("configure")); + const TQPixmap logoIcon = SmallIcon(TQString::tqfromLatin1("knewsticker")); + const TQPixmap helpIcon = SmallIcon(TQString::tqfromLatin1("help")); + const TQPixmap confIcon = SmallIcon(TQString::tqfromLatin1("configure")); insertTitle(logoIcon, i18n("KNewsTicker"), 0, 0); @@ -533,13 +533,13 @@ void KNewsTickerMenu::slotOpenArticle(int idx) extern "C" { - KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString &configFile) + KDE_EXPORT KPanelApplet* init(TQWidget *tqparent, const TQString &configFile) { - KGlobal::locale()->insertCatalogue(TQString::fromLatin1("knewsticker")); + KGlobal::locale()->insertCatalogue(TQString::tqfromLatin1("knewsticker")); return new KNewsTicker(configFile, KPanelApplet::Stretch, KPanelApplet::Preferences | KPanelApplet::About | KPanelApplet::Help | KPanelApplet::ReportBug, - parent, "knewsticker"); + tqparent, "knewsticker"); } } |