- switch(column) {
- case ChatLineModel::TimestampColumn: part = &_timestamp; break;
- case ChatLineModel::SenderColumn: part = &_sender; break;
- case ChatLineModel::ContentsColumn: part = &_contents; break;
- default: return MessageModelItem::data(column, role);
+QVariant ChatLineModelItem::timestampData(int role) const {
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ return _styledMsg.decoratedTimestamp();
+ case ChatLineModel::EditRole:
+ return _styledMsg.timestamp();
+ case ChatLineModel::BackgroundRole:
+ return backgroundBrush(UiStyle::Timestamp);
+ case ChatLineModel::SelectedBackgroundRole:
+ return backgroundBrush(UiStyle::Timestamp, true);
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
+ << qMakePair((quint16)0, (quint32)UiStyle::formatType(_styledMsg.type()) | UiStyle::Timestamp));
+ }
+ return QVariant();
+}
+
+QVariant ChatLineModelItem::senderData(int role) const {
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ return _styledMsg.decoratedSender();
+ case ChatLineModel::EditRole:
+ return _styledMsg.plainSender();
+ case ChatLineModel::BackgroundRole:
+ return backgroundBrush(UiStyle::Sender);
+ case ChatLineModel::SelectedBackgroundRole:
+ return backgroundBrush(UiStyle::Sender, true);
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
+ << qMakePair((quint16)0, (quint32)UiStyle::formatType(_styledMsg.type()) | UiStyle::Sender));