Improve the search pages, especially in error and searching states
Someone hit a nasty bug while attempting to find a KDE room on the kde.org server, the error wouldn't come up normally and the dialog would be blank. That's because that specific placeholder message doesn't appear until you type something into the search field, which is weird. There is a few other oddities with SearchPage that I squashed, including showing the loading placeholder in more appropiate situations.
This commit is contained in:
@@ -172,6 +172,8 @@ void PublicRoomListModel::next(int limit)
|
||||
}
|
||||
m_redirectedText.clear();
|
||||
Q_EMIT redirectedChanged();
|
||||
m_errorText.clear();
|
||||
Q_EMIT errorTextChanged();
|
||||
|
||||
if (job) {
|
||||
qCDebug(PublicRoomList) << "Other job running, ignore";
|
||||
@@ -200,9 +202,12 @@ void PublicRoomListModel::next(int limit)
|
||||
this->beginInsertRows({}, rooms.count(), rooms.count() + job->chunk().count() - 1);
|
||||
rooms.append(job->chunk());
|
||||
this->endInsertRows();
|
||||
} else if (job->error() == BaseJob::ContentAccessError) {
|
||||
} else if (job->error() == BaseJob::ContentAccessError && !m_searchText.isEmpty()) {
|
||||
m_redirectedText = job->jsonData()[u"error"_s].toString();
|
||||
Q_EMIT redirectedChanged();
|
||||
} else {
|
||||
m_errorText = job->jsonData()[u"error"_s].toString();
|
||||
Q_EMIT errorTextChanged();
|
||||
}
|
||||
|
||||
this->job = nullptr;
|
||||
@@ -329,4 +334,9 @@ QString PublicRoomListModel::redirectedText() const
|
||||
return m_redirectedText;
|
||||
}
|
||||
|
||||
QString PublicRoomListModel::errorText() const
|
||||
{
|
||||
return m_errorText;
|
||||
}
|
||||
|
||||
#include "moc_publicroomlistmodel.cpp"
|
||||
|
||||
Reference in New Issue
Block a user