[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/~ervin/zanshin/src
From: Mario Bensi <nef () ipsquad ! net>
Date: 2009-02-05 17:04:53
Message-ID: 1233853493.816331.22076.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 921783 by bensi:
fix the display of multicontext on actionlist
M +32 -0 actionlistmodel.cpp
M +1 -0 actionlistmodel.h
--- branches/work/~ervin/zanshin/src/actionlistmodel.cpp #921782:921783
@@ -25,12 +25,18 @@
#include <akonadi/item.h>
+#include <boost/shared_ptr.hpp>
+
+#include <kcal/todo.h>
+
#include <QtCore/QStringList>
#include "todocategoriesmodel.h"
#include "todoflatmodel.h"
#include "todotreemodel.h"
+typedef boost::shared_ptr<KCal::Incidence> IncidencePtr;
+
ActionListModel::ActionListModel(QObject *parent)
: QSortFilterProxyModel(parent), m_mode(StandardMode)
{
@@ -70,6 +76,32 @@
}
}
+QVariant ActionListModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() >= rowCount()) {
+ return QVariant();
+ }
+
+ const Akonadi::Item item = itemForIndex(index);
+
+ if (!item.hasPayload<IncidencePtr>()) {
+ return QVariant();
+ }
+
+ const IncidencePtr incidence = item.payload<IncidencePtr>();
+
+ switch( role ) {
+ case Qt::DisplayRole:
+ case Qt::EditRole:
+ switch(index.column()) {
+ case TodoFlatModel::Categories:
+ return incidence->categories().join(", ");
+ }
+ }
+
+ return sourceModel()->data(index, role);
+}
+
void ActionListModel::setMode(Mode mode)
{
m_mode = mode;
--- branches/work/~ervin/zanshin/src/actionlistmodel.h #921782:921783
@@ -50,6 +50,7 @@
Akonadi::Item itemForIndex(const QModelIndex &index) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant data(const QModelIndex &index, int role) const;
void setMode(Mode mode);
void setSourceFocusIndex(const QModelIndex &sourceIndex);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic