Space Search

Allow to refine searches to spaces only in the main exlore function.
Show which rooms are spaces in the search page.

Closes #577
This commit is contained in:
James Graham
2024-03-30 19:37:46 +00:00
parent 482d61ee47
commit 64b8cd5bcc
6 changed files with 64 additions and 7 deletions

View File

@@ -124,6 +124,15 @@ void PublicRoomListModel::setShowOnlySpaces(bool showOnlySpaces)
}
m_showOnlySpaces = showOnlySpaces;
Q_EMIT showOnlySpacesChanged();
nextBatch = QString();
attempted = false;
if (job) {
job->abandon();
job = nullptr;
Q_EMIT searchingChanged();
}
}
void PublicRoomListModel::search(int limit)
@@ -243,6 +252,9 @@ QVariant PublicRoomListModel::data(const QModelIndex &index, int role) const
return m_connection->room(room.roomId, JoinState::Join) != nullptr;
}
if (role == IsSpaceRole) {
return room.roomType == QLatin1String("m.space");
}
return {};
}
@@ -259,6 +271,7 @@ QHash<int, QByteArray> PublicRoomListModel::roleNames() const
roles[AllowGuestsRole] = "allowGuests";
roles[WorldReadableRole] = "worldReadable";
roles[IsJoinedRole] = "isJoined";
roles[IsSpaceRole] = "isSpace";
roles[AliasRole] = "alias";
return roles;