Some changes in standard categories.

This commit is contained in:
Martin Rotter 2013-12-15 10:53:26 +01:00
parent d868134375
commit dadf34e60e
2 changed files with 21 additions and 2 deletions

View File

@ -17,6 +17,21 @@ FeedsModelStandardCategory::~FeedsModelStandardCategory() {
QVariant FeedsModelStandardCategory::data(int column, int role) const {
switch (role) {
case Qt::ToolTipRole:
if (column == FDS_MODEL_TITLE_INDEX) {
return QObject::tr("%1\n\n"
"Category type: standard\n"
"Creation date: %2").arg(m_title,
m_creationDate.toString(Qt::DefaultLocaleShortDate));
}
else if (column == FDS_MODEL_COUNTS_INDEX) {
// TODO: tady dat plural a singular
return QObject::tr("%1 unread messages.").arg(countOfUnreadMessages());
}
else {
return QVariant();
}
case Qt::DisplayRole:
if (column == FDS_MODEL_TITLE_INDEX) {
return QString("%1%2").arg(m_title, "-C");
@ -24,6 +39,9 @@ QVariant FeedsModelStandardCategory::data(int column, int role) const {
else if (column == FDS_MODEL_COUNTS_INDEX) {
return QString("(%1)").arg(QString::number(countOfUnreadMessages()));
}
else {
return QVariant();
}
case Qt::DecorationRole:
return column == FDS_MODEL_TITLE_INDEX ?

View File

@ -18,10 +18,11 @@ class FeedsModelStandardCategory : public FeedsModelCategory {
explicit FeedsModelStandardCategory(FeedsModelRootItem *parent_item = NULL);
virtual ~FeedsModelStandardCategory();
void update();
QVariant data(int column, int role) const;
// Performs update on all children of this category.
void update();
static FeedsModelStandardCategory *loadFromRecord(const QSqlRecord &record);
};