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/newsscroller.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/newsscroller.cpp')
-rw-r--r-- | knewsticker/newsscroller.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/knewsticker/newsscroller.cpp b/knewsticker/newsscroller.cpp index 060b7cd9..76d81050 100644 --- a/knewsticker/newsscroller.cpp +++ b/knewsticker/newsscroller.cpp @@ -55,7 +55,7 @@ public: int w, h; if (m_scroller->m_cfg->showIcons()) { w = m_article->newsSource()->icon().width() + 4 + metrics.width(m_article->headline()); - h = QMAX(metrics.height(), m_article->newsSource()->icon().height()); + h = TQMAX(metrics.height(), m_article->newsSource()->icon().height()); } else { w = metrics.width(m_article->headline()); h = metrics.height(); @@ -128,8 +128,8 @@ private: TQPixmap *m_highlighted; }; -NewsScroller::NewsScroller(TQWidget *parent, ConfigAccess *cfg, const char *name) - : TQFrame(parent, name, WNoAutoErase), +NewsScroller::NewsScroller(TQWidget *tqparent, ConfigAccess *cfg, const char *name) + : TQFrame(tqparent, name, WNoAutoErase), m_cfg(cfg), m_scrollTimer(new TQTimer(this)), m_activeHeadline(0), @@ -150,9 +150,9 @@ NewsScroller::NewsScroller(TQWidget *parent, ConfigAccess *cfg, const char *name reset(); } -TQSize NewsScroller::sizeHint() const +TQSize NewsScroller::tqsizeHint() const { - return TQSize(fontMetrics().width(TQString::fromLatin1("X")) * 20, fontMetrics().height() * 2); + return TQSize(fontMetrics().width(TQString::tqfromLatin1("X")) * 20, fontMetrics().height() * 2); } TQSizePolicy NewsScroller::sizePolicy() const @@ -177,23 +177,23 @@ void NewsScroller::dropEvent(TQDropEvent* event) if ( TQTextDrag::decode(event, newSourceUrl) ) { // <HACK> // This is just for http://www.webreference.com/services/news/ - newSourceUrl = newSourceUrl.replace(TQRegExp( - TQString::fromLatin1("^view-source:http%3A//")), - TQString::fromLatin1("http://")); + newSourceUrl = newSourceUrl.tqreplace(TQRegExp( + TQString::tqfromLatin1("^view-source:http%3A//")), + TQString::tqfromLatin1("http://")); // </HACK> newSourceUrl = newSourceUrl.stripWhiteSpace(); if (!isHeadline(newSourceUrl) && KMessageBox::questionYesNo(this, i18n("<p>Do you really want to add '%1' to" " the list of news sources?</p>") - .arg(newSourceUrl), TQString::null, i18n("Add"), KStdGuiItem::cancel()) == KMessageBox::Yes) { - KConfig cfg(TQString::fromLatin1("knewsticker_panelappletrc"), false, false); + .tqarg(newSourceUrl), TQString(), i18n("Add"), KStdGuiItem::cancel()) == KMessageBox::Yes) { + KConfig cfg(TQString::tqfromLatin1("knewsticker_panelappletrc"), false, false); ConfigAccess configFrontend(&cfg); TQStringList newsSources = configFrontend.newsSources(); TQString name = i18n("Unknown"); - if (newsSources.contains(name)) + if (newsSources.tqcontains(name)) for (unsigned int i = 0; ; i++) - if (!newsSources.contains(i18n("Unknown %1").arg(i))) { - name = i18n("Unknown %1").arg(i); + if (!newsSources.tqcontains(i18n("Unknown %1").tqarg(i))) { + name = i18n("Unknown %1").tqarg(i); break; } @@ -256,7 +256,7 @@ void NewsScroller::scroll(int distance, bool interpret_directions) TQPoint pt = mapFromGlobal(TQCursor::pos()); - if (contentsRect().contains(pt)) + if (contentsRect().tqcontains(pt)) updateActive(pt); update(); @@ -270,7 +270,7 @@ void NewsScroller::enterEvent(TQEvent *) void NewsScroller::mousePressEvent(TQMouseEvent *e) { - if (e->button() == TQMouseEvent::LeftButton || e->button() == TQMouseEvent::MidButton) { + if (e->button() == Qt::LeftButton || e->button() == Qt::MidButton) { m_dragPos = e->pos(); if (m_activeHeadline) @@ -280,14 +280,14 @@ void NewsScroller::mousePressEvent(TQMouseEvent *e) void NewsScroller::mouseReleaseEvent(TQMouseEvent *e) { - if ((e->button() == TQMouseEvent::LeftButton || e->button() == TQMouseEvent::MidButton) + if ((e->button() == Qt::LeftButton || e->button() == Qt::MidButton) && m_activeHeadline && m_activeHeadline->article()->headline() == m_tempHeadline && !m_mouseDrag) { m_activeHeadline->article()->open(); - m_tempHeadline = TQString::null; + m_tempHeadline = TQString(); } - if (e->button() == TQMouseEvent::RightButton) + if (e->button() == Qt::RightButton) emit(contextMenu()); if (m_mouseDrag) { @@ -304,10 +304,10 @@ void NewsScroller::mouseMoveEvent(TQMouseEvent *e) // If not, check whether we need to start a drag. int dragDistance = 0; if (m_cfg->horizontalScrolling()) - dragDistance = QABS(e->x() - m_dragPos.x()); + dragDistance = TQABS(e->x() - m_dragPos.x()); else - dragDistance = QABS(e->y() - m_dragPos.y()); - m_mouseDrag = (e->state() & TQMouseEvent::LeftButton != 0) && + dragDistance = TQABS(e->y() - m_dragPos.y()); + m_mouseDrag = (e->state() & Qt::LeftButton != 0) && dragDistance >= KGlobal::config()->readNumEntry("StartDragDist", KApplication::startDragDistance()); if (m_mouseDrag) // Stop the scroller if we just started a drag. m_scrollTimer->stop(); @@ -344,7 +344,7 @@ void NewsScroller::wheelEvent(TQWheelEvent *e) { // ### This 11 - m_cfg->mouseWheelSpeed() could be eliminated by swapping // the labels of the TQSlider. :] - int distance = qRound(QABS(e->delta()) / (11 - m_cfg->mouseWheelSpeed())); + int distance = tqRound(TQABS(e->delta()) / (11 - m_cfg->mouseWheelSpeed())); int direction = e->delta() > 0 ? -1 : 1; for (int i = 0; i < distance; i++) @@ -440,7 +440,7 @@ void NewsScroller::reset(bool bSeparatorOnly) if (m_cfg->scrollingSpeed()) m_scrollTimer->start(speedAsInterval(m_cfg->scrollingSpeed())); - TQString sep = m_headlines.isEmpty() ? i18n(" +++ No News Available +++") : TQString::fromLatin1(" +++ "); + TQString sep = m_headlines.isEmpty() ? i18n(" +++ No News Available +++") : TQString::tqfromLatin1(" +++ "); int w = fontMetrics().width(sep); int h = fontMetrics().height(); @@ -548,7 +548,7 @@ bool NewsScroller::updateActive(const TQPoint &pt) rect.setWidth(width()); } - if (rect.contains(pt)) + if (rect.tqcontains(pt)) break; } if (*it) |