Add the ability to scroll up in the message search window

This wasn't a thing yet, so the search experience compared to something
like Element Web was much worse. Now you can scroll back as far as any
other client can!

I had to do a bit of refactoring to stop resetting the model all the
time, and append instead. Otherwise, it was quite straightforward to
implement.
This commit is contained in:
Joshua Goins
2025-09-05 13:35:42 -04:00
parent 94ea1305b2
commit 88e1e1dd2a
2 changed files with 33 additions and 17 deletions

View File

@@ -65,6 +65,9 @@ public:
*/
Q_INVOKABLE void search();
void fetchMore(const QModelIndex &parent) override;
bool canFetchMore(const QModelIndex &parent) const override;
Q_SIGNALS:
void searchTextChanged();
void roomChanged();
@@ -77,8 +80,9 @@ private:
void setSearching(bool searching);
QString m_searchText;
std::optional<Quotient::SearchJob::ResultRoomEvents> m_result = std::nullopt;
std::vector<Quotient::SearchJob::Result> m_results;
Quotient::SearchJob *m_job = nullptr;
bool m_searching = false;
QString m_senderId;
QString m_nextBatch;
};