summaryrefslogtreecommitdiffstats
path: root/akregator/src/articlelistview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /akregator/src/articlelistview.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'akregator/src/articlelistview.cpp')
-rw-r--r--akregator/src/articlelistview.cpp160
1 files changed, 80 insertions, 80 deletions
diff --git a/akregator/src/articlelistview.cpp b/akregator/src/articlelistview.cpp
index 210da275b..72527822c 100644
--- a/akregator/src/articlelistview.cpp
+++ b/akregator/src/articlelistview.cpp
@@ -40,17 +40,17 @@
#include <kcharsets.h>
#include <kurl.h>
-#include <qdatetime.h>
-#include <qpixmap.h>
-#include <qpopupmenu.h>
-#include <qptrlist.h>
-#include <qvaluelist.h>
-#include <qwhatsthis.h>
-#include <qheader.h>
-#include <qdragobject.h>
-#include <qsimplerichtext.h>
-#include <qpainter.h>
-#include <qapplication.h>
+#include <tqdatetime.h>
+#include <tqpixmap.h>
+#include <tqpopupmenu.h>
+#include <tqptrlist.h>
+#include <tqvaluelist.h>
+#include <tqwhatsthis.h>
+#include <tqheader.h>
+#include <tqdragobject.h>
+#include <tqsimplerichtext.h>
+#include <tqpainter.h>
+#include <tqapplication.h>
#include <ctime>
@@ -73,7 +73,7 @@ class ArticleListView::ArticleListViewPrivate
ArticleListView* m_parent;
/** maps article to article item */
- QMap<Article, ArticleItem*> articleMap;
+ TQMap<Article, ArticleItem*> articleMap;
TreeNode* node;
Akregator::Filters::ArticleMatcher textFilter;
Akregator::Filters::ArticleMatcher statusFilter;
@@ -131,13 +131,13 @@ class ArticleListView::ArticleItem : public KListViewItem
friend class ArticleListView;
public:
- ArticleItem( QListView *parent, const Article& a);
+ ArticleItem( TQListView *parent, const Article& a);
~ArticleItem();
Article& article();
- void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align );
- virtual int compare(QListViewItem *i, int col, bool ascending) const;
+ void paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align );
+ virtual int compare(TQListViewItem *i, int col, bool ascending) const;
void updateItem(const Article& article);
@@ -148,14 +148,14 @@ class ArticleListView::ArticleItem : public KListViewItem
private:
Article m_article;
time_t m_pubDate;
- static QPixmap keepFlag() {
- static QPixmap s_keepFlag = QPixmap(locate("data", "akregator/pics/akregator_flag.png"));
+ static TQPixmap keepFlag() {
+ static TQPixmap s_keepFlag = TQPixmap(locate("data", "akregator/pics/akregator_flag.png"));
return s_keepFlag;
}
};
// FIXME: Remove resolveEntities for KDE 4.0, it's now done in the parser
-ArticleListView::ArticleItem::ArticleItem( QListView *parent, const Article& a)
+ArticleListView::ArticleItem::ArticleItem( TQListView *parent, const Article& a)
: KListViewItem( parent, KCharsets::resolveEntities(a.title()), a.feed()->title(), KGlobal::locale()->formatDateTime(a.pubDate(), true, false) ), m_article(a), m_pubDate(a.pubDate().toTime_t())
{
if (a.keep())
@@ -172,19 +172,19 @@ Article& ArticleListView::ArticleItem::article()
}
// paint ze peons
-void ArticleListView::ArticleItem::paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align )
+void ArticleListView::ArticleItem::paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align )
{
if (article().status() == Article::Read)
KListViewItem::paintCell( p, cg, column, width, align );
else
{
// if article status is unread or new, we change the color: FIXME: make colors configurable
- QColorGroup cg2(cg);
+ TQColorGroup cg2(cg);
if (article().status() == Article::Unread)
- cg2.setColor(QColorGroup::Text, Qt::blue);
+ cg2.setColor(TQColorGroup::Text, Qt::blue);
else // New
- cg2.setColor(QColorGroup::Text, Qt::red);
+ cg2.setColor(TQColorGroup::Text, Qt::red);
KListViewItem::paintCell( p, cg2, column, width, align );
}
@@ -194,13 +194,13 @@ void ArticleListView::ArticleItem::paintCell ( QPainter * p, const QColorGroup &
void ArticleListView::ArticleItem::updateItem(const Article& article)
{
m_article = article;
- setPixmap(0, m_article.keep() ? keepFlag() : QPixmap());
+ setPixmap(0, m_article.keep() ? keepFlag() : TQPixmap());
setText(0, KCharsets::resolveEntities(m_article.title()));
setText(1, m_article.feed()->title());
setText(2, KGlobal::locale()->formatDateTime(m_article.pubDate(), true, false));
}
-int ArticleListView::ArticleItem::compare(QListViewItem *i, int col, bool ascending) const {
+int ArticleListView::ArticleItem::compare(TQListViewItem *i, int col, bool ascending) const {
if (col == 2)
{
ArticleItem* item = static_cast<ArticleItem*>(i);
@@ -213,7 +213,7 @@ int ArticleListView::ArticleItem::compare(QListViewItem *i, int col, bool ascend
/* ==================================================================================== */
-ArticleListView::ArticleListView(QWidget *parent, const char *name)
+ArticleListView::ArticleListView(TQWidget *parent, const char *name)
: KListView(parent, name)
{
d = new ArticleListViewPrivate(this);
@@ -226,10 +226,10 @@ ArticleListView::ArticleListView(QWidget *parent, const char *name)
addColumn(i18n("Article"));
addColumn(i18n("Feed"));
addColumn(i18n("Date"));
- setSelectionMode(QListView::Extended);
- setColumnWidthMode(2, QListView::Maximum);
- setColumnWidthMode(1, QListView::Manual);
- setColumnWidthMode(0, QListView::Manual);
+ setSelectionMode(TQListView::Extended);
+ setColumnWidthMode(2, TQListView::Maximum);
+ setColumnWidthMode(1, TQListView::Manual);
+ setColumnWidthMode(0, TQListView::Manual);
setRootIsDecorated(false);
setItemsRenameable(false);
setItemsMovable(false);
@@ -266,18 +266,18 @@ ArticleListView::ArticleListView(QWidget *parent, const char *name)
header()->setStretchEnabled(true, 0);
- QWhatsThis::add(this, i18n("<h2>Article list</h2>"
+ TQWhatsThis::add(this, i18n("<h2>Article list</h2>"
"Here you can browse articles from the currently selected feed. "
"You can also manage articles, as marking them as persistent (\"Keep Article\") or delete them, using the right mouse button menu."
"To view the web page of the article, you can open the article internally in a tab or in an external browser window."));
- connect(this, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(slotCurrentChanged(QListViewItem* )));
- connect(this, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()));
- connect(this, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)), this, SLOT(slotDoubleClicked(QListViewItem*, const QPoint&, int)) );
- connect(this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
- this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)));
+ connect(this, TQT_SIGNAL(currentChanged(TQListViewItem*)), this, TQT_SLOT(slotCurrentChanged(TQListViewItem* )));
+ connect(this, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotSelectionChanged()));
+ connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem*, const TQPoint&, int)), this, TQT_SLOT(slotDoubleClicked(TQListViewItem*, const TQPoint&, int)) );
+ connect(this, TQT_SIGNAL(contextMenu(KListView*, TQListViewItem*, const TQPoint&)),
+ this, TQT_SLOT(slotContextMenu(KListView*, TQListViewItem*, const TQPoint&)));
- connect(this, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int)), this, SLOT(slotMouseButtonPressed(int, QListViewItem *, const QPoint &, int)));
+ connect(this, TQT_SIGNAL(mouseButtonPressed(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonPressed(int, TQListViewItem *, const TQPoint &, int)));
}
Article ArticleListView::currentArticle() const
@@ -314,10 +314,10 @@ void ArticleListView::slotShowNode(TreeNode* node)
setUpdatesEnabled(false);
- QValueList<Article> articles = d->node->articles();
+ TQValueList<Article> articles = d->node->articles();
- QValueList<Article>::ConstIterator end = articles.end();
- QValueList<Article>::ConstIterator it = articles.begin();
+ TQValueList<Article>::ConstIterator end = articles.end();
+ TQValueList<Article>::ConstIterator it = articles.begin();
for (; it != end; ++it)
{
@@ -345,14 +345,14 @@ void ArticleListView::slotClear()
clear();
}
-void ArticleListView::slotArticlesAdded(TreeNode* /*node*/, const QValueList<Article>& list)
+void ArticleListView::slotArticlesAdded(TreeNode* /*node*/, const TQValueList<Article>& list)
{
setUpdatesEnabled(false);
bool statusActive = !(d->statusFilter.matchesAll());
bool textActive = !(d->textFilter.matchesAll());
- for (QValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
+ for (TQValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
{
if (!d->articleMap.contains(*it))
{
@@ -369,7 +369,7 @@ void ArticleListView::slotArticlesAdded(TreeNode* /*node*/, const QValueList<Art
triggerUpdate();
}
-void ArticleListView::slotArticlesUpdated(TreeNode* /*node*/, const QValueList<Article>& list)
+void ArticleListView::slotArticlesUpdated(TreeNode* /*node*/, const TQValueList<Article>& list)
{
setUpdatesEnabled(false);
@@ -380,9 +380,9 @@ void ArticleListView::slotArticlesUpdated(TreeNode* /*node*/, const QValueList<A
bool statusActive = !(d->statusFilter.matchesAll());
bool textActive = !(d->textFilter.matchesAll());
- QListViewItem* next = 0; // the item to select if a selected item is deleted
+ TQListViewItem* next = 0; // the item to select if a selected item is deleted
- for (QValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
+ for (TQValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
{
if (!(*it).isNull() && d->articleMap.contains(*it))
@@ -435,17 +435,17 @@ void ArticleListView::slotArticlesUpdated(TreeNode* /*node*/, const QValueList<A
triggerUpdate();
}
-void ArticleListView::slotArticlesRemoved(TreeNode* /*node*/, const QValueList<Article>& list)
+void ArticleListView::slotArticlesRemoved(TreeNode* /*node*/, const TQValueList<Article>& list)
{
// if only one item is selected and this selected item
// is deleted, we will select the next item in the list
bool singleSelected = selectedArticles().count() == 1;
- QListViewItem* next = 0; // the item to select if a selected item is deleted
+ TQListViewItem* next = 0; // the item to select if a selected item is deleted
setUpdatesEnabled(false);
- for (QValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
+ for (TQValueList<Article>::ConstIterator it = list.begin(); it != list.end(); ++it)
{
if (d->articleMap.contains(*it))
{
@@ -482,18 +482,18 @@ void ArticleListView::slotArticlesRemoved(TreeNode* /*node*/, const QValueList<A
void ArticleListView::connectToNode(TreeNode* node)
{
- connect(node, SIGNAL(signalDestroyed(TreeNode*)), this, SLOT(slotClear()) );
- connect(node, SIGNAL(signalArticlesAdded(TreeNode*, const QValueList<Article>&)), this, SLOT(slotArticlesAdded(TreeNode*, const QValueList<Article>&)) );
- connect(node, SIGNAL(signalArticlesUpdated(TreeNode*, const QValueList<Article>&)), this, SLOT(slotArticlesUpdated(TreeNode*, const QValueList<Article>&)) );
- connect(node, SIGNAL(signalArticlesRemoved(TreeNode*, const QValueList<Article>&)), this, SLOT(slotArticlesRemoved(TreeNode*, const QValueList<Article>&)) );
+ connect(node, TQT_SIGNAL(signalDestroyed(TreeNode*)), this, TQT_SLOT(slotClear()) );
+ connect(node, TQT_SIGNAL(signalArticlesAdded(TreeNode*, const TQValueList<Article>&)), this, TQT_SLOT(slotArticlesAdded(TreeNode*, const TQValueList<Article>&)) );
+ connect(node, TQT_SIGNAL(signalArticlesUpdated(TreeNode*, const TQValueList<Article>&)), this, TQT_SLOT(slotArticlesUpdated(TreeNode*, const TQValueList<Article>&)) );
+ connect(node, TQT_SIGNAL(signalArticlesRemoved(TreeNode*, const TQValueList<Article>&)), this, TQT_SLOT(slotArticlesRemoved(TreeNode*, const TQValueList<Article>&)) );
}
void ArticleListView::disconnectFromNode(TreeNode* node)
{
- disconnect(node, SIGNAL(signalDestroyed(TreeNode*)), this, SLOT(slotClear()) );
- disconnect(node, SIGNAL(signalArticlesAdded(TreeNode*, const QValueList<Article>&)), this, SLOT(slotArticlesAdded(TreeNode*, const QValueList<Article>&)) );
- disconnect(node, SIGNAL(signalArticlesUpdated(TreeNode*, const QValueList<Article>&)), this, SLOT(slotArticlesUpdated(TreeNode*, const QValueList<Article>&)) );
- disconnect(node, SIGNAL(signalArticlesRemoved(TreeNode*, const QValueList<Article>&)), this, SLOT(slotArticlesRemoved(TreeNode*, const QValueList<Article>&)) );
+ disconnect(node, TQT_SIGNAL(signalDestroyed(TreeNode*)), this, TQT_SLOT(slotClear()) );
+ disconnect(node, TQT_SIGNAL(signalArticlesAdded(TreeNode*, const TQValueList<Article>&)), this, TQT_SLOT(slotArticlesAdded(TreeNode*, const TQValueList<Article>&)) );
+ disconnect(node, TQT_SIGNAL(signalArticlesUpdated(TreeNode*, const TQValueList<Article>&)), this, TQT_SLOT(slotArticlesUpdated(TreeNode*, const TQValueList<Article>&)) );
+ disconnect(node, TQT_SIGNAL(signalArticlesRemoved(TreeNode*, const TQValueList<Article>&)), this, TQT_SLOT(slotArticlesRemoved(TreeNode*, const TQValueList<Article>&)) );
}
void ArticleListView::applyFilters()
@@ -505,14 +505,14 @@ void ArticleListView::applyFilters()
if (!statusActive && !textActive)
{
- for (QListViewItemIterator it(this); it.current(); ++it)
+ for (TQListViewItemIterator it(this); it.current(); ++it)
{
(static_cast<ArticleItem*> (it.current()))->setVisible(true);
}
}
else if (statusActive && !textActive)
{
- for (QListViewItemIterator it(this); it.current(); ++it)
+ for (TQListViewItemIterator it(this); it.current(); ++it)
{
ali = static_cast<ArticleItem*> (it.current());
ali->setVisible( d->statusFilter.matches( ali->article()) );
@@ -520,7 +520,7 @@ void ArticleListView::applyFilters()
}
else if (!statusActive && textActive)
{
- for (QListViewItemIterator it(this); it.current(); ++it)
+ for (TQListViewItemIterator it(this); it.current(); ++it)
{
ali = static_cast<ArticleItem*> (it.current());
ali->setVisible( d->textFilter.matches( ali->article()) );
@@ -528,7 +528,7 @@ void ArticleListView::applyFilters()
}
else // both true
{
- for (QListViewItemIterator it(this); it.current(); ++it)
+ for (TQListViewItemIterator it(this); it.current(); ++it)
{
ali = static_cast<ArticleItem*> (it.current());
ali->setVisible( d->statusFilter.matches( ali->article())
@@ -542,7 +542,7 @@ int ArticleListView::visibleArticles()
{
int visible = 0;
ArticleItem* ali = 0;
- for (QListViewItemIterator it(this); it.current(); ++it) {
+ for (TQListViewItemIterator it(this); it.current(); ++it) {
ali = static_cast<ArticleItem*> (it.current());
visible += ali->isVisible() ? 1 : 0;
}
@@ -550,10 +550,10 @@ int ArticleListView::visibleArticles()
}
// from amarok :)
-void ArticleListView::paintInfoBox(const QString &message)
+void ArticleListView::paintInfoBox(const TQString &message)
{
- QPainter p( viewport() );
- QSimpleRichText t( message, QApplication::font() );
+ TQPainter p( viewport() );
+ TQSimpleRichText t( message, TQApplication::font() );
if ( t.width()+30 >= viewport()->width() || t.height()+30 >= viewport()->height() )
//too big, giving up
@@ -566,10 +566,10 @@ void ArticleListView::paintInfoBox(const QString &message)
p.setBrush( colorGroup().background() );
p.drawRoundRect( x, y, w+30, h+30, (8*200)/w, (8*200)/h );
- t.draw( &p, x+15, y+15, QRect(), colorGroup() );
+ t.draw( &p, x+15, y+15, TQRect(), colorGroup() );
}
-void ArticleListView::viewportPaintEvent(QPaintEvent *e)
+void ArticleListView::viewportPaintEvent(TQPaintEvent *e)
{
KListView::viewportPaintEvent(e);
@@ -577,7 +577,7 @@ void ArticleListView::viewportPaintEvent(QPaintEvent *e)
if(!e)
return;
- QString message = QString::null;
+ TQString message = TQString::null;
//kdDebug() << "visible articles: " << visibleArticles() << endl;
@@ -614,10 +614,10 @@ void ArticleListView::viewportPaintEvent(QPaintEvent *e)
paintInfoBox(message);
}
-QDragObject *ArticleListView::dragObject()
+TQDragObject *ArticleListView::dragObject()
{
- QDragObject* d = 0;
- QValueList<Article> articles = selectedArticles();
+ TQDragObject* d = 0;
+ TQValueList<Article> articles = selectedArticles();
if (!articles.isEmpty())
{
d = new ArticleDrag(articles, this);
@@ -731,7 +731,7 @@ void ArticleListView::slotPreviousUnreadArticle()
}
}
-void ArticleListView::keyPressEvent(QKeyEvent* e)
+void ArticleListView::keyPressEvent(TQKeyEvent* e)
{
e->ignore();
}
@@ -750,7 +750,7 @@ void ArticleListView::slotSelectionChanged()
}
}
-void ArticleListView::slotCurrentChanged(QListViewItem* item)
+void ArticleListView::slotCurrentChanged(TQListViewItem* item)
{
ArticleItem* ai = dynamic_cast<ArticleItem*> (item);
if (ai)
@@ -763,22 +763,22 @@ void ArticleListView::slotCurrentChanged(QListViewItem* item)
}
-void ArticleListView::slotDoubleClicked(QListViewItem* item, const QPoint& p, int i)
+void ArticleListView::slotDoubleClicked(TQListViewItem* item, const TQPoint& p, int i)
{
ArticleItem* ali = dynamic_cast<ArticleItem*>(item);
if (ali)
emit signalDoubleClicked(ali->article(), p, i);
}
-void ArticleListView::slotContextMenu(KListView* /*list*/, QListViewItem* /*item*/, const QPoint& p)
+void ArticleListView::slotContextMenu(KListView* /*list*/, TQListViewItem* /*item*/, const TQPoint& p)
{
- QWidget* w = ActionManager::getInstance()->container("article_popup");
- QPopupMenu* popup = static_cast<QPopupMenu *>(w);
+ TQWidget* w = ActionManager::getInstance()->container("article_popup");
+ TQPopupMenu* popup = static_cast<TQPopupMenu *>(w);
if (popup)
popup->exec(p);
}
-void ArticleListView::slotMouseButtonPressed(int button, QListViewItem* item, const QPoint& p, int column)
+void ArticleListView::slotMouseButtonPressed(int button, TQListViewItem* item, const TQPoint& p, int column)
{
ArticleItem* ali = dynamic_cast<ArticleItem*>(item);
if (ali)
@@ -797,11 +797,11 @@ ArticleListView::~ArticleListView()
d = 0;
}
-QValueList<Article> ArticleListView::selectedArticles() const
+TQValueList<Article> ArticleListView::selectedArticles() const
{
- QValueList<Article> ret;
- QPtrList<QListViewItem> items = selectedItems(false);
- for (QListViewItem* i = items.first(); i; i = items.next() )
+ TQValueList<Article> ret;
+ TQPtrList<TQListViewItem> items = selectedItems(false);
+ for (TQListViewItem* i = items.first(); i; i = items.next() )
ret.append((static_cast<ArticleItem*>(i))->article());
return ret;
}