rssguard/src/core/feedsmodelstandardfeed.cpp
2013-12-12 22:28:51 +01:00

51 lines
1.2 KiB
C++

#include <QVariant>
#include "core/defs.h"
#include "gui/iconthemefactory.h"
#include "core/feedsmodelstandardfeed.h"
FeedsModelStandardFeed::FeedsModelStandardFeed(FeedsModelRootItem *parent_item)
: FeedsModelFeed(parent_item) {
}
FeedsModelStandardFeed::~FeedsModelStandardFeed() {
qDebug("Destroying FeedsModelStandardFeed instance.");
}
void FeedsModelStandardFeed::setDescription(const QString &description) {
m_description = description;
}
void FeedsModelStandardFeed::setTitle(const QString &title) {
m_title = title;
}
QVariant FeedsModelStandardFeed::data(int column, int role) const {
switch (role) {
case Qt::DisplayRole:
if (column == FDS_TITLE_INDEX) {
return m_title;
}
else if (column == FDS_COUNTS_INDEX) {
return QString("(%1)").arg(QString::number(countOfUnreadMessages()));
}
case Qt::DecorationRole:
return column == FDS_TITLE_INDEX ?
m_icon :
QVariant();
case Qt::TextAlignmentRole:
if (column == FDS_COUNTS_INDEX) {
return Qt::AlignCenter;
}
else {
return QVariant();
}
default:
return QVariant();
}
}