Add menu entry to show decrypted source
Also make hidden entries not consume space in Menus with some qml
styles.
2 files changed, 14 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 7e124f47..bb793945 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -697,7 +697,20 @@ TimelineModel::viewRawMessage(QString id) const
}
void
+TimelineModel::viewDecryptedRawMessage(QString id) const
+{
+ auto event = events.value(id);
+ if (auto e =
+ std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&event)) {
+ event = decryptEvent(*e).event;
+ }
+ std::string ev = utils::serialize_event(event).dump(4);
+ auto dialog = new dialogs::RawMessage(QString::fromStdString(ev));
+ Q_UNUSED(dialog);
+}
+
+void
TimelineModel::openUserProfile(QString userid) const
{
MainWindow::instance()->openUserProfile(userid, room_id_);
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index bb84bcd8..84e9ec26 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -179,6 +179,7 @@ public:
Q_INVOKABLE QString escapeEmoji(QString str) const;
Q_INVOKABLE void viewRawMessage(QString id) const;
+ Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
Q_INVOKABLE void openUserProfile(QString userid) const;
Q_INVOKABLE void replyAction(QString id);
Q_INVOKABLE void readReceiptsAction(QString id) const;
|