+QVariant ChatLineModelItem::contentsData(int role) const {
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ case ChatLineModel::EditRole:
+ return _styledMsg.plainContents();
+ case ChatLineModel::BackgroundRole:
+ return backgroundBrush(UiStyle::Contents);
+ case ChatLineModel::SelectedBackgroundRole:
+ return backgroundBrush(UiStyle::Contents, true);
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(_styledMsg.contentsFormatList());
+ case ChatLineModel::WrapListRole:
+ if(_wrapList.isEmpty())
+ computeWrapList();
+ return QVariant::fromValue<ChatLineModel::WrapList>(_wrapList);
+ }
+ return QVariant();
+}
+
+quint32 ChatLineModelItem::messageLabel() const {
+ quint32 label = _styledMsg.senderHash() << 16;
+ if(_styledMsg.flags() & Message::Self)
+ label |= UiStyle::OwnMsg;
+ if(_styledMsg.flags() & Message::Highlight)
+ label |= UiStyle::Highlight;
+ return label;