00001 #ifndef QMESSAGELISTMODEL_H
00002 #define QMESSAGELISTMODEL_H
00003
00004 #include <QAbstractListModel>
00005 #include <datatypes/message.h>
00006 #include <datatypes/friend.h>
00007
00008 class QMessageListModel : public QAbstractListModel
00009 {
00010 Q_OBJECT
00011 public:
00012 explicit QMessageListModel(QObject *parent = 0):
00013 QAbstractListModel(parent) {};
00014
00015 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00016 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00017 QVariant data(const QModelIndex &index, int role) const;
00018 QVariant headerData(int section, Qt::Orientation orientation,
00019 int role = Qt::DisplayRole) const;
00020
00021 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
00022
00023 void setNameFilter(const QString &str);
00024
00025 QModelIndex getIndex(const Message& msg) const;
00026 QModelIndex getIndex(int column, const Message& msg) const;
00027 QModelIndex getIndex(const QString& accountId, const QString& messageId) const;
00028
00029 void setMessagesList(MessageList &list);
00030
00031
00032 MessageList msgList;
00033
00034 public slots:
00035 void updateList(const MessageList &list);
00036
00037 private:
00038 MessageList shownMessagesList;
00039
00040 QString nameFilter;
00041
00042 void updateShownMessagesList();
00043 };
00044
00045 #endif // QMESSAGELISTMODEL_H