MessageEventModel plain text role

Update the message role to be named plainText and use it the message delegate for openMessageContext.
This removes the need for plainText in controller so it is removed.
This commit is contained in:
James Graham
2023-04-27 16:58:52 +00:00
parent af078f03d0
commit 4b879be4ea
6 changed files with 6 additions and 19 deletions

View File

@@ -34,7 +34,7 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
{
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
roles[DelegateTypeRole] = "delegateType";
roles[MessageRole] = "message";
roles[PlainText] = "plainText";
roles[EventIdRole] = "eventId";
roles[TimeRole] = "time";
roles[SectionRole] = "section";
@@ -493,7 +493,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
return {};
}
if (role == MessageRole) {
if (role == PlainText) {
return m_currentRoom->eventToString(evt);
}

View File

@@ -58,7 +58,7 @@ public:
*/
enum EventRoles {
DelegateTypeRole = Qt::UserRole + 1, /**< The delegate type of the message. */
MessageRole, /**< Plain text representation of the message. */
PlainText, /**< Plain text representation of the message. */
EventIdRole, /**< The matrix event ID of the event. */
TimeRole, /**< The timestamp for when the event was sent. */
SectionRole, /**< The date of the event as a string. */