Commit 91fa0231 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Improve display of the updates page header

The bug was already solved, but update items would get on top of it
sometimes.
Make the header a page header rather than a listview's.

BUG: 384351
parent 08d19bc8
......@@ -16,6 +16,27 @@ DiscoverPage
property string footerLabel: ""
ResourcesUpdatesModel {
id: resourcesUpdatesModel
onPassiveMessage: window.showPassiveNotification(message)
onIsProgressingChanged: {
if (!isProgressing) {
resourcesUpdatesModel.prepare()
}
}
Component.onCompleted: {
if (!isProgressing) {
resourcesUpdatesModel.prepare()
}
}
}
UpdateModel {
id: updateModel
backend: resourcesUpdatesModel
}
Kirigami.Action
{
id: updateAction
......@@ -39,71 +60,47 @@ DiscoverPage
readonly property QtObject currentAction: resourcesUpdatesModel.isProgressing ? cancelUpdateAction : updateAction
actions.main: applicationWindow().wideScreen ? null : currentAction
//TODO: use supportsRefreshing to fetch updates
mainItem: ListView
{
id: updatesView
currentIndex: -1
ResourcesUpdatesModel {
id: resourcesUpdatesModel
onPassiveMessage: window.showPassiveNotification(message)
onIsProgressingChanged: {
if (!isProgressing) {
resourcesUpdatesModel.prepare()
}
}
header: QQC2.ToolBar {
visible: (updateModel.totalUpdatesCount > 0 && resourcesUpdatesModel.isProgressing) || updateModel.hasUpdates
Component.onCompleted: {
if (!isProgressing) {
resourcesUpdatesModel.prepare()
}
RowLayout {
anchors.fill: parent
LabelBackground {
Layout.leftMargin: Kirigami.Units.gridUnit
text: updateModel.toUpdateCount + " (" + updateModel.updateSize+")"
}
}
UpdateModel {
id: updateModel
backend: resourcesUpdatesModel
}
headerPositioning: ListView.OverlayHeader
header: QQC2.ToolBar {
anchors {
right: parent.right
left: parent.left
QQC2.Label {
text: i18n("updates selected")
}
LabelBackground {
id: unselectedItem
text: page.unselected
visible: page.unselected>0
}
QQC2.Label {
text: i18n("updates not selected")
visible: unselectedItem.visible
}
visible: (updateModel.totalUpdatesCount > 0 && resourcesUpdatesModel.isProgressing) || updateModel.hasUpdates
contentItem: RowLayout {
LabelBackground {
Layout.leftMargin: Kirigami.Units.gridUnit
text: updateModel.toUpdateCount + " (" + updateModel.updateSize+")"
}
QQC2.Label {
text: i18n("updates selected")
}
LabelBackground {
id: unselectedItem
text: page.unselected
visible: page.unselected>0
}
QQC2.Label {
text: i18n("updates not selected")
visible: unselectedItem.visible
}
Item {
Layout.fillWidth: true
}
Item {
Layout.fillWidth: true
}
Button {
Layout.minimumWidth: Kirigami.Units.gridUnit * 6
Layout.rightMargin: Kirigami.Units.gridUnit
text: page.currentAction.text
visible: !page.actions.main
onClicked: page.currentAction.trigger()
}
Button {
Layout.minimumWidth: Kirigami.Units.gridUnit * 6
Layout.rightMargin: Kirigami.Units.gridUnit
text: page.currentAction.text
visible: !page.actions.main
onClicked: page.currentAction.trigger()
}
}
}
//TODO: use supportsRefreshing to fetch updates
ListView
{
id: updatesView
currentIndex: -1
footer: ColumnLayout {
anchors.right: parent.right
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment