New parent dialog

Move the add new offical parent to a dialog and make sure that the join room dialog only shows spaces.
This commit is contained in:
James Graham
2023-10-15 11:28:17 +00:00
parent ac6f9ea219
commit f5417a6227
6 changed files with 205 additions and 127 deletions

View File

@@ -124,6 +124,20 @@ void PublicRoomListModel::setKeyword(const QString &value)
Q_EMIT hasMoreChanged();
}
bool PublicRoomListModel::showOnlySpaces() const
{
return m_showOnlySpaces;
}
void PublicRoomListModel::setShowOnlySpaces(bool showOnlySpaces)
{
if (showOnlySpaces == m_showOnlySpaces) {
return;
}
m_showOnlySpaces = showOnlySpaces;
Q_EMIT showOnlySpacesChanged();
}
void PublicRoomListModel::next(int count)
{
if (count < 1) {
@@ -136,7 +150,11 @@ void PublicRoomListModel::next(int count)
return;
}
job = m_connection->callApi<QueryPublicRoomsJob>(m_server, count, nextBatch, QueryPublicRoomsJob::Filter{m_keyword, {}});
QStringList roomTypes;
if (m_showOnlySpaces) {
roomTypes += QLatin1String("m.space");
}
job = m_connection->callApi<QueryPublicRoomsJob>(m_server, count, nextBatch, QueryPublicRoomsJob::Filter{m_keyword, roomTypes});
Q_EMIT loadingChanged();
connect(job, &BaseJob::finished, this, [this] {