Show encryption errors in qml and add request keys button

This commit is contained in:
Nicolas Werner 2021-08-07 22:51:09 +02:00
parent 9f742fe23d
commit 72bbad7485
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
14 changed files with 220 additions and 165 deletions

View file

@ -452,6 +452,7 @@ TimelineModel::roleNames() const
{IsEditable, "isEditable"},
{IsEncrypted, "isEncrypted"},
{Trustlevel, "trustlevel"},
{EncryptionError, "encryptionError"},
{ReplyTo, "replyTo"},
{Reactions, "reactions"},
{RoomId, "roomId"},
@ -639,6 +640,9 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
return crypto::Trust::Unverified;
}
case EncryptionError:
return events.decryptionError(event_id(event));
case ReplyTo:
return QVariant(QString::fromStdString(relations(event).reply_to().value_or("")));
case Reactions: {
@ -690,6 +694,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
m.insert(names[RoomName], data(event, static_cast<int>(RoomName)));
m.insert(names[RoomTopic], data(event, static_cast<int>(RoomTopic)));
m.insert(names[CallType], data(event, static_cast<int>(CallType)));
m.insert(names[EncryptionError], data(event, static_cast<int>(EncryptionError)));
return QVariant(m);
}
@ -1551,6 +1556,17 @@ TimelineModel::scrollTimerEvent()
}
}
void
TimelineModel::requestKeyForEvent(QString id)
{
auto encrypted_event = events.get(id.toStdString(), "", false);
if (encrypted_event) {
if (auto ev = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
encrypted_event))
events.requestSession(*ev, true);
}
}
void
TimelineModel::copyLinkToEvent(QString eventId) const
{