summary refs log tree commit diff
path: root/src/timeline/RoomlistModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-28 22:14:59 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-28 22:14:59 +0200
commit298822baeaffdc83386e003099e34819bcd7d18c (patch)
tree1caa2bc8475385b1743c9c82a8d98caae3e374fb /src/timeline/RoomlistModel.cpp
parentReimplement room context menus (diff)
downloadnheko-298822baeaffdc83386e003099e34819bcd7d18c.tar.xz
Move currentRoom/timeline handling to roomlist
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r--src/timeline/RoomlistModel.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp

index 63054aa9..ad4177a4 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp
@@ -341,6 +341,8 @@ RoomlistModel::clear() models.clear(); invites.clear(); roomids.clear(); + currentRoom_ = nullptr; + emit currentRoomChanged(); endResetModel(); } @@ -390,6 +392,17 @@ RoomlistModel::leave(QString roomid) } } +void +RoomlistModel::setCurrentRoom(QString roomid) +{ + nhlog::ui()->debug("Trying to switch to: {}", roomid.toStdString()); + if (models.contains(roomid)) { + currentRoom_ = models.value(roomid); + emit currentRoomChanged(); + nhlog::ui()->debug("Switched to: {}", roomid.toStdString()); + } +} + namespace { enum NotificationImportance : short { @@ -463,6 +476,11 @@ FilteredRoomlistModel::FilteredRoomlistModel(RoomlistModel *model, QObject *pare invalidate(); }); + connect(roomlistmodel, + &RoomlistModel::currentRoomChanged, + this, + &FilteredRoomlistModel::currentRoomChanged); + sort(0); }