mirror of https://github.com/KDE/kasts.git
Fix issues when there is no feed/entry image
This commit is contained in:
parent
83526b0a12
commit
8506068b1f
|
@ -16,7 +16,7 @@ Kirigami.SwipeListItem {
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: Fetcher.image(entry.image)
|
source: model.entry.image === "" ? "rss" : Fetcher.image(model.entry.image)
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: height
|
width: height
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ Kirigami.ScrollablePage {
|
||||||
height: root.height * 0.2
|
height: root.height * 0.2
|
||||||
|
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: Fetcher.image(page.feed.image)
|
source: page.feed.image === "" ? "rss" : Fetcher.image(page.feed.image)
|
||||||
property int size: Kirigami.Units.iconSizes.large
|
property int size: Kirigami.Units.iconSizes.large
|
||||||
Layout.minimumWidth: size
|
Layout.minimumWidth: size
|
||||||
Layout.minimumHeight: size
|
Layout.minimumHeight: size
|
||||||
|
|
|
@ -21,7 +21,7 @@ Kirigami.ScrollablePage {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: Fetcher.image(feed.image)
|
source: feed.image === "" ? "rss" : Fetcher.image(feed.image)
|
||||||
property int size: Kirigami.Units.iconSizes.huge
|
property int size: Kirigami.Units.iconSizes.huge
|
||||||
Layout.minimumHeight: size
|
Layout.minimumHeight: size
|
||||||
Layout.minimumWidth: size
|
Layout.minimumWidth: size
|
||||||
|
|
|
@ -23,7 +23,7 @@ Kirigami.SwipeListItem {
|
||||||
onMoveRequested: DataManager.moveQueueItem(oldIndex, newIndex)
|
onMoveRequested: DataManager.moveQueueItem(oldIndex, newIndex)
|
||||||
}
|
}
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: Fetcher.image(model.entry.image)
|
source: entry.image === "" ? "rss" : Fetcher.image(entry.image)
|
||||||
property int size: Kirigami.Units.iconSizes.medium
|
property int size: Kirigami.Units.iconSizes.medium
|
||||||
Layout.minimumHeight: size
|
Layout.minimumHeight: size
|
||||||
Layout.minimumWidth: size
|
Layout.minimumWidth: size
|
||||||
|
@ -33,10 +33,10 @@ Kirigami.SwipeListItem {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
text: model.entry.title
|
text: entry.title
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.weight: model.entry.read ? Font.Normal : Font.Bold
|
font.weight: entry.read ? Font.Normal : Font.Bold
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
Loader {
|
Loader {
|
||||||
|
@ -45,11 +45,11 @@ Kirigami.SwipeListItem {
|
||||||
Component {
|
Component {
|
||||||
id: subtitle
|
id: subtitle
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
text: model.entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (model.entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + model.entry.authors[0].name)
|
text: entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + entry.authors[0].name)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Kirigami.Theme.smallFont
|
font: Kirigami.Theme.smallFont
|
||||||
opacity: model.entry.read ? 0.7 : 0.9
|
opacity: entry.read ? 0.7 : 0.9
|
||||||
visible: !downloadProgress.visible
|
visible: !downloadProgress.visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,8 @@ Kirigami.SwipeListItem {
|
||||||
Controls.ProgressBar {
|
Controls.ProgressBar {
|
||||||
from: 0
|
from: 0
|
||||||
to: 100
|
to: 100
|
||||||
value: model.entry.enclosure.downloadProgress
|
value: entry.enclosure.downloadProgress
|
||||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloading
|
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ Kirigami.SwipeListItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
model.entry.read = true
|
entry.read = true
|
||||||
pageStack.push("qrc:/EntryPage.qml", {"entry": model.entry})
|
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
|
||||||
}
|
}
|
||||||
|
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -77,32 +77,32 @@ Kirigami.SwipeListItem {
|
||||||
iconName: "media-playback-start"
|
iconName: "media-playback-start"
|
||||||
text: "Play"
|
text: "Play"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
audio.entry = model.entry
|
audio.entry = entry
|
||||||
audio.play()
|
audio.play()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Download")
|
text: i18n("Download")
|
||||||
icon.name: "download"
|
icon.name: "download"
|
||||||
onTriggered: model.entry.enclosure.download()
|
onTriggered: entry.enclosure.download()
|
||||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloadable
|
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Cancel download")
|
text: i18n("Cancel download")
|
||||||
icon.name: "edit-delete-remove"
|
icon.name: "edit-delete-remove"
|
||||||
onTriggered: model.entry.enclosure.cancelDownload()
|
onTriggered: entry.enclosure.cancelDownload()
|
||||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloading
|
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Delete download")
|
text: i18n("Delete download")
|
||||||
icon.name: "delete"
|
icon.name: "delete"
|
||||||
onTriggered: model.entry.enclosure.deleteFile()
|
onTriggered: entry.enclosure.deleteFile()
|
||||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloaded
|
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Remove from Queue")
|
text: i18n("Remove from Queue")
|
||||||
icon.name: "delete-table-row"
|
icon.name: "delete-table-row"
|
||||||
onTriggered: { DataManager.removeQueueItem(model.entry) }
|
onTriggered: { DataManager.removeQueueItem(entry) }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue