00001 #ifndef QMESSAGEDELEGATE_H 00002 #define QMESSAGEDELEGATE_H 00003 00004 #include <QStyledItemDelegate> 00005 #include <QApplication> 00006 #include <datatypes/account.h> 00007 #include <servicemgr.h> 00008 00009 class QMessageDelegate : public QStyledItemDelegate 00010 { 00011 Q_OBJECT 00012 public: 00013 explicit QMessageDelegate(ServiceMgr *sm, QObject *parent = 0); 00014 00015 void paint(QPainter *painter, const QStyleOptionViewItem &option, 00016 const QModelIndex &index ) const; 00017 00018 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; 00019 00020 private: 00021 ServiceMgr *sm; 00022 00023 AccountList mAccountList; 00024 QSet<QString> mLocalAccountIds; 00025 00026 public slots: 00027 void updateAccountList(QString id, AccountList list); 00028 }; 00029 00030 #endif // QMESSAGEDELEGATE_H