Make FeedList sorting update when the feed details (e.g. title) have been updated

This commit is contained in:
Bart De Vries 2021-09-25 09:58:36 +02:00
parent 074dad647b
commit 78986c5da7
2 changed files with 8 additions and 2 deletions

View File

@ -36,6 +36,14 @@ FeedsModel::FeedsModel(QObject *parent)
} }
} }
}); });
connect(&Fetcher::instance(), &Fetcher::feedDetailsUpdated, this, [=](const QString &url) {
for (int i = 0; i < rowCount(QModelIndex()); i++) {
if (data(index(i, 0), UrlRole).toString() == url) {
Q_EMIT dataChanged(index(i, 0), index(i, 0));
return;
}
}
});
} }
QHash<int, QByteArray> FeedsModel::roleNames() const QHash<int, QByteArray> FeedsModel::roleNames() const

View File

@ -239,8 +239,6 @@ Kirigami.ScrollablePage {
feeds[i] = feedList.model.data(feedList.selectionForContextMenu[i], FeedsModel.FeedRole); feeds[i] = feedList.model.data(feedList.selectionForContextMenu[i], FeedsModel.FeedRole);
} }
for (var i in feeds) { for (var i in feeds) {
console.log(lastFeed);
console.log(feeds[i].url);
if (lastFeed === feeds[i].url) { if (lastFeed === feeds[i].url) {
while (pageStack.depth > 1) { while (pageStack.depth > 1) {
pageStack.pop(); pageStack.pop();