Fix indentation in FeedListPage

This commit is contained in:
Tobias Fella 2020-05-31 18:21:02 +02:00
parent 22e766f214
commit 47a5d7afec

View File

@ -27,134 +27,134 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.alligator 1.0 import org.kde.alligator 1.0
Kirigami.ScrollablePage { Kirigami.ScrollablePage {
title: "Alligator" title: "Alligator"
property var lastFeed: "" property var lastFeed: ""
supportsRefreshing: true supportsRefreshing: true
onRefreshingChanged: onRefreshingChanged:
if(refreshing) { if(refreshing) {
timer.running = true timer.running = true
Fetcher.fetchAll() Fetcher.fetchAll()
}
Timer {
id: timer
interval: 1000
onTriggered: refreshing = false
} }
actions.main: Kirigami.Action { Timer {
text: i18n("Add feed") id: timer
iconName: "list-add" interval: 1000
onTriggered: { onTriggered: refreshing = false
addSheet.open() }
}
actions.main: Kirigami.Action {
text: i18n("Add feed")
iconName: "list-add"
onTriggered: {
addSheet.open()
} }
Kirigami.OverlaySheet {
id: addSheet
header: Kirigami.Heading {
text: i18n("Add new Feed")
}
contentItem: Kirigami.FormLayout {
Controls.TextField {
id: urlField
//placeholderText: "https://example.org/feed.xml"
text: "https://planet.kde.org/global/atom.xml/"
Kirigami.FormData.label: "Url:"
}
Controls.Button {
text: i18n("Add Feed")
enabled: urlField.text
onClicked: {
Database.addFeed(urlField.text)
addSheet.close()
}
}
}
}
Kirigami.PlaceholderMessage {
visible: feedList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18n("No Feeds added yet.")
}
ListView {
id: feedList
visible: count !== 0
anchors.fill: parent
model: FeedListModel {
id: feedListModel
} }
/* Kirigami.OverlaySheet {
header: id: addSheet
Kirigami.AbstractListItem { header: Kirigami.Heading {
Controls.Label { text: i18n("Add new Feed")
text: i18n("All feeds") }
}
width: parent.width; contentItem: Kirigami.FormLayout {
height: Kirigami.Units.gridUnit * 2 Controls.TextField {
id: urlField
//placeholderText: "https://example.org/feed.xml"
text: "https://planet.kde.org/global/atom.xml/"
Kirigami.FormData.label: "Url:"
}
Controls.Button {
text: i18n("Add Feed")
enabled: urlField.text
onClicked: { onClicked: {
feedList.focus = false Database.addFeed(urlField.text)
pageStack.push("qrc:/EntryListPage.qml") addSheet.close()
} }
} }
*/ }
}
delegate: Kirigami.SwipeListItem { Kirigami.PlaceholderMessage {
height: Kirigami.Units.gridUnit*2 visible: feedList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18n("No Feeds added yet.")
}
ListView {
id: feedList
visible: count !== 0
anchors.fill: parent
model: FeedListModel {
id: feedListModel
}
/*
header:
Kirigami.AbstractListItem {
Controls.Label {
text: i18n("All feeds")
}
width: parent.width;
height: Kirigami.Units.gridUnit * 2
onClicked: {
feedList.focus = false
pageStack.push("qrc:/EntryListPage.qml")
}
}
*/
delegate: Kirigami.SwipeListItem {
height: Kirigami.Units.gridUnit*2
Item {
Item { Item {
Item { id: icon
id: icon width: height
height: parent.height
Kirigami.Icon {
source: Fetcher.image(model.feed.image)
width: height width: height
height: parent.height height: parent.height
Kirigami.Icon { visible: !busy.visible
source: Fetcher.image(model.feed.image)
width: height
height: parent.height
visible: !busy.visible
}
Controls.BusyIndicator {
id: busy
width: height
height: parent.height
visible: model.feed.refreshing
}
} }
Controls.BusyIndicator {
Controls.Label { id: busy
text: model.feed.name width: height
height: parent.height height: parent.height
anchors.left: icon.right visible: model.feed.refreshing
leftPadding: 0.5*Kirigami.Units.gridUnit
} }
} }
actions: [ Controls.Label {
Kirigami.Action { text: model.feed.name
icon.name: "delete" height: parent.height
onTriggered: { anchors.left: icon.right
if(pageStack.depth > 1 && model.feed.url === lastFeed) leftPadding: 0.5*Kirigami.Units.gridUnit
pageStack.pop()
feedListModel.removeFeed(index)
}
}
]
onClicked: {
lastFeed = model.feed.url
pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed})
} }
} }
actions: [
Kirigami.Action {
icon.name: "delete"
onTriggered: {
if(pageStack.depth > 1 && model.feed.url === lastFeed)
pageStack.pop()
feedListModel.removeFeed(index)
}
}
]
onClicked: {
lastFeed = model.feed.url
pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed})
}
} }
} }
}