diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-13 19:15:58 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-13 19:15:58 +0300 |
commit | 8767ea181db6fb2ae9c51a316814c3b4640e08f3 (patch) | |
tree | 7151232e3fe0d6fe95ea370cdfbb19989d0d465d /src/timeline | |
parent | Temporary fix to work with mx-reply tags (diff) | |
download | nheko-8767ea181db6fb2ae9c51a316814c3b4640e08f3.tar.xz |
Mark unread rooms as such in the room list
fixes #313
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/TimelineItem.cpp | 22 | ||||
-rw-r--r-- | src/timeline/TimelineItem.h | 6 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/timeline/TimelineItem.cpp b/src/timeline/TimelineItem.cpp index c2bd98d9..18598487 100644 --- a/src/timeline/TimelineItem.cpp +++ b/src/timeline/TimelineItem.cpp @@ -317,16 +317,23 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty, if (formatted_body == body.trimmed().toHtmlEscaped()) formatted_body = body.toHtmlEscaped(); + QString emptyEventId; + if (ty == mtx::events::MessageType::Emote) { formatted_body = QString("<em>%1</em>").arg(formatted_body); - descriptionMsg_ = {"", + descriptionMsg_ = {emptyEventId, + "", userid, QString("* %1 %2").arg(displayName).arg(body), utils::descriptiveTime(timestamp), timestamp}; } else { - descriptionMsg_ = { - "You: ", userid, body, utils::descriptiveTime(timestamp), timestamp}; + descriptionMsg_ = {emptyEventId, + "You: ", + userid, + body, + utils::descriptiveTime(timestamp), + timestamp}; } formatted_body = utils::linkifyMessage(formatted_body); @@ -496,7 +503,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Notice auto formatted_body = utils::linkifyMessage(utils::getMessageBody(event).trimmed()); auto body = QString::fromStdString(event.content.body).trimmed().toHtmlEscaped(); - descriptionMsg_ = {Cache::displayName(room_id_, sender), + descriptionMsg_ = {event_id_, + Cache::displayName(room_id_, sender), sender, " sent a notification", utils::descriptiveTime(timestamp), @@ -545,7 +553,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote> auto displayName = Cache::displayName(room_id_, sender); formatted_body = QString("<em>%1</em>").arg(formatted_body); - descriptionMsg_ = {"", + descriptionMsg_ = {event_id_, + "", sender, QString("* %1 %2").arg(displayName).arg(body), utils::descriptiveTime(timestamp), @@ -592,7 +601,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text> auto displayName = Cache::displayName(room_id_, sender); QSettings settings; - descriptionMsg_ = {sender == settings.value("auth/user_id") ? "You" : displayName, + descriptionMsg_ = {event_id_, + sender == settings.value("auth/user_id") ? "You" : displayName, sender, QString(": %1").arg(body), utils::descriptiveTime(timestamp), diff --git a/src/timeline/TimelineItem.h b/src/timeline/TimelineItem.h index 32d586f5..b98dd148 100644 --- a/src/timeline/TimelineItem.h +++ b/src/timeline/TimelineItem.h @@ -319,7 +319,8 @@ TimelineItem::setupLocalWidgetLayout(Widget *widget, const QString &userid, bool auto displayName = Cache::displayName(room_id_, userid); auto timestamp = QDateTime::currentDateTime(); - descriptionMsg_ = {"You", + descriptionMsg_ = {"", // No event_id up until this point. + "You", userid, QString(" %1").arg(utils::messageDescription<Widget>()), utils::descriptiveTime(timestamp), @@ -358,7 +359,8 @@ TimelineItem::setupWidgetLayout(Widget *widget, const Event &event, bool withSen auto displayName = Cache::displayName(room_id_, sender); QSettings settings; - descriptionMsg_ = {sender == settings.value("auth/user_id") ? "You" : displayName, + descriptionMsg_ = {event_id_, + sender == settings.value("auth/user_id") ? "You" : displayName, sender, QString(" %1").arg(utils::messageDescription<Widget>()), utils::descriptiveTime(timestamp), |