Port FeedListDelegate to BasicListItem

This commit is contained in:
Tobias Fella 2020-07-29 23:41:11 +02:00
parent c8dea42485
commit 6c02f118e6
2 changed files with 12 additions and 15 deletions

View File

@ -116,6 +116,7 @@ void Entry::setRead(bool read)
query.bindValue(QStringLiteral(":feed"), m_feed->url()); query.bindValue(QStringLiteral(":feed"), m_feed->url());
query.bindValue(QStringLiteral(":read"), m_read); query.bindValue(QStringLiteral(":read"), m_read);
Database::instance().execute(query); Database::instance().execute(query);
Q_EMIT m_feed->unreadEntryCountChanged();
} }
QString Entry::adjustedContent(int width, int fontSize) QString Entry::adjustedContent(int width, int fontSize)

View File

@ -27,18 +27,18 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.alligator 1.0 import org.kde.alligator 1.0
Kirigami.SwipeListItem { Kirigami.SwipeListItem {
height: Kirigami.Units.gridUnit*2
Item { contentItem: Kirigami.BasicListItem {
FeedImage { anchors.top: parent.top
id: image anchors.bottom: parent.bottom
feed: model.feed text: model.feed.name
} icon: model.feed.refreshing ? "view-refresh" : model.feed.image === "" ? "rss" : model.feed.image
Controls.Label { subtitle: i18np("%1 unread entry", "%1 unread entries", model.feed.unreadEntryCount)
text: model.feed.name
height: parent.height
anchors.left: image.right onClicked: {
leftPadding: 0.5*Kirigami.Units.gridUnit lastFeed = model.feed.url
pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed})
} }
} }
@ -54,8 +54,4 @@ Kirigami.SwipeListItem {
] ]
onClicked: {
lastFeed = model.feed.url
pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed})
}
} }