Add action to user detail dialog to search for their messages in room
In other messaging applications (e.g. Discord) this is possible through text modifiers like "from:@user". We don't support that, and I'm not super keen on implementing yet-another-parsing-thing, so an action in the user detail dialog should work for now. Very useful to sift through large rooms but when you only care about a specific person's messages (maybe your own?)
This commit is contained in:
@@ -37,6 +37,11 @@ class SearchModel : public MessageModel
|
||||
*/
|
||||
Q_PROPERTY(bool searching READ searching NOTIFY searchingChanged)
|
||||
|
||||
/**
|
||||
* @brief If set, limits the search to this specific sender.
|
||||
*/
|
||||
Q_PROPERTY(QString senderId READ senderId WRITE setSenderId NOTIFY senderIdChanged)
|
||||
|
||||
public:
|
||||
explicit SearchModel(QObject *parent = nullptr);
|
||||
|
||||
@@ -45,6 +50,9 @@ public:
|
||||
|
||||
bool searching() const;
|
||||
|
||||
QString senderId() const;
|
||||
void setSenderId(const QString &sender);
|
||||
|
||||
/**
|
||||
* @brief Number of rows in the model.
|
||||
*
|
||||
@@ -61,6 +69,7 @@ Q_SIGNALS:
|
||||
void searchTextChanged();
|
||||
void roomChanged();
|
||||
void searchingChanged();
|
||||
void senderIdChanged();
|
||||
|
||||
private:
|
||||
std::optional<std::reference_wrapper<const Quotient::RoomEvent>> getEventForIndex(QModelIndex index) const override;
|
||||
@@ -71,4 +80,5 @@ private:
|
||||
std::optional<Quotient::SearchJob::ResultRoomEvents> m_result = std::nullopt;
|
||||
Quotient::SearchJob *m_job = nullptr;
|
||||
bool m_searching = false;
|
||||
QString m_senderId;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user