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:
Tobias Fella
2025-07-07 15:24:08 +02:00
committed by Tobias Fella
parent ad993d4340
commit 10123abc5b
6 changed files with 20 additions and 22 deletions

View File

@@ -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"

View File

@@ -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;
};