From b3f29f592b26806d4a82067bbb64f9ffd044d474 Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Thu, 28 Jan 2021 23:35:02 +0530 Subject: Changed edit method from double clicking to an edit button --- src/timeline/TimelineModel.cpp | 19 ++++++++++++++++++- src/timeline/TimelineModel.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/timeline') diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index ffb0beec..41c0b40e 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -22,6 +22,7 @@ #include "TimelineViewManager.h" #include "Utils.h" #include "dialogs/RawMessage.h" +#include Q_DECLARE_METATYPE(QModelIndex) @@ -260,6 +261,17 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj connect(&events, &EventStore::updateFlowEventId, this, [this](std::string event_id) { this->updateFlowEventId(event_id); }); + + const auto userid = utils::localUser().toStdString(); + http::client()->get_profile( + userid, [this](const mtx::responses::Profile &res, mtx::http::RequestErr err) { + if (err) { + nhlog::net()->warn("failed to retrieve own profile info"); + return; + } + + globalUsername = QString::fromStdString(res.display_name); + }); } QHash @@ -801,7 +813,12 @@ TimelineModel::viewDecryptedRawMessage(QString id) const void TimelineModel::openUserProfile(QString userid, bool global) { - emit openProfile(new UserProfile(global ? "" : room_id_, global ? utils::localUser() : userid, manager_, this)); + if (global) { + emit openProfile(new UserProfile("",utils::localUser(), + manager_, this, globalUsername)); + } else { + emit openProfile(new UserProfile(room_id_, userid, manager_, this)); + } } void diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 51b8049e..e6cb7d3a 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -317,6 +317,7 @@ private: mutable EventStore events; QString room_id_; + QString globalUsername; bool decryptDescription = true; bool m_paginationInProgress = false; -- cgit 1.5.1