Fix maximizing replied-to media
The previous index-based handling opened the wrong media, as it used the wrong index.
This commit is contained in:
committed by
Tobias Fella
parent
ad993d4340
commit
10123abc5b
@@ -85,9 +85,14 @@ QHash<int, QByteArray> MediaMessageFilterModel::roleNames() const
|
||||
return roles;
|
||||
}
|
||||
|
||||
int MediaMessageFilterModel::getRowForSourceItem(int sourceRow) const
|
||||
int MediaMessageFilterModel::getRowForEventId(const QString &eventId) const
|
||||
{
|
||||
return mapFromSource(sourceModel()->index(sourceRow, 0)).row();
|
||||
for (auto i = 0; i < rowCount(); i++) {
|
||||
if (data(index(i, 0), MessageModel::EventIdRole).toString() == eventId) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#include "moc_mediamessagefiltermodel.cpp"
|
||||
|
||||
@@ -63,5 +63,5 @@ public:
|
||||
*/
|
||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
Q_INVOKABLE int getRowForSourceItem(int sourceRow) const;
|
||||
int getRowForEventId(const QString &eventId) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user