Port EntryListDelegate to BasicListItem

This commit is contained in:
Tobias Fella 2020-07-29 23:49:23 +02:00
parent 6c02f118e6
commit 5fa40d89d9
1 changed files with 21 additions and 25 deletions

View File

@ -27,31 +27,27 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.alligator 1.0 import org.kde.alligator 1.0
Kirigami.SwipeListItem { Kirigami.SwipeListItem {
ColumnLayout {
spacing: 0 contentItem: Kirigami.BasicListItem {
Layout.fillWidth: true anchors.top: parent.top
Layout.alignment: Qt.AlignVCenter anchors.bottom: parent.bottom
Controls.Label { anchors.left: parent.left
text: model.entry.title text: model.entry.title
Layout.fillWidth: true subtitle: model.entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (model.entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + model.entry.authors[0].name)
elide: Text.ElideRight reserveSpaceForIcon: false
opacity: 1 bold: !model.entry.read
color: model.entry.read ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor
} onClicked: {
Controls.Label { model.entry.read = true
id: subtitleItem pageStack.push("qrc:/EntryPage.qml", {"entry": model.entry})
text: model.entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (model.entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + model.entry.authors[0].name)
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.6
visible: text.length > 0
color: model.entry.read ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor
} }
} }
onClicked: { actions: [
model.entry.read = true Kirigami.Action {
pageStack.push("qrc:/EntryPage.qml", {"entry": model.entry}) text: i18n("Open in Browser")
} icon.name: "globe"
} onTriggered: Qt.openUrlExternally(model.entry.link)
}
]
}