diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-06-11 14:51:29 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-06-11 14:51:29 +0200 |
commit | 8d2d8dc26727a5b46613d83522490f568aef7cad (patch) | |
tree | 1007bc7030db1bd8de8bca4438118ba622d72364 /src/timeline/RoomlistModel.cpp | |
parent | Render community items (diff) | |
download | nheko-8d2d8dc26727a5b46613d83522490f568aef7cad.tar.xz |
Enable toggling tags
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r-- | src/timeline/RoomlistModel.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index 4dd44b30..c0fb74a4 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -324,6 +324,7 @@ RoomlistModel::initializeRooms() models.clear(); roomids.clear(); invites.clear(); + currentRoom_ = nullptr; invites = cache::client()->invites(); for (const auto &id : invites.keys()) @@ -461,6 +462,22 @@ FilteredRoomlistModel::lessThan(const QModelIndex &left, const QModelIndex &righ return left.row() < right.row(); } +bool +FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) const +{ + if (filterType == FilterBy::Nothing) + return true; + else if (filterType == FilterBy::Tag) { + auto tags = sourceModel() + ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags) + .toStringList(); + + return tags.contains(filterStr); + } else { + return true; + } +} + FilteredRoomlistModel::FilteredRoomlistModel(RoomlistModel *model, QObject *parent) : QSortFilterProxyModel(parent) , roomlistmodel(model) |