[localeq], working Offline.qml

This commit is contained in:
demmm 2021-05-25 22:52:10 +02:00
parent 74c8f34b79
commit ffe3209121

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <https://calamares.io> === /* === This file is part of Calamares - <https://calamares.io> ===
* *
* SPDX-FileCopyrightText: 2020 Anke Boersma <demm@kaosx.us> * SPDX-FileCopyrightText: 2020-2021 Anke Boersma <demm@kaosx.us>
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.
@ -21,6 +21,10 @@ Page {
width: 800 //parent.width width: 800 //parent.width
height: 500 height: 500
id: control
property string currentRegion
property string currentZone
StackView { StackView {
id: stack id: stack
anchors.fill: parent anchors.fill: parent
@ -34,7 +38,7 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignCenter horizontalAlignment: Text.AlignCenter
text: qsTr("Select your preferred Region, or use the default one based on your current location.") text: qsTr("Select your preferred Region, or use the default settings.")
} }
ListView { ListView {
@ -62,9 +66,8 @@ Page {
opacity: 0.7 opacity: 0.7
} }
// model loads, dozens of variations tried for currentIndex all fail
model: config.regionModel model: config.regionModel
currentIndex: config.currentIndex currentIndex: -1
delegate: ItemDelegate { delegate: ItemDelegate {
hoverEnabled: true hoverEnabled: true
@ -73,7 +76,7 @@ Page {
Label { Label {
text: name text: model.name
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
width: parent.width width: parent.width
@ -89,8 +92,9 @@ Page {
onClicked: { onClicked: {
list.model.currentIndex = index list.currentIndex = index
// correct to use config.currentTimezoneName when index is updated? control.currentRegion = model.name
config.regionalZonesModel.region = control.currentRegion
tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName) tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName)
stack.push(zoneView) stack.push(zoneView)
} }
@ -136,9 +140,8 @@ Page {
opacity: 0.7 opacity: 0.7
} }
// model loads, dozens of variations tried for currentIndex all fail
model: config.regionalZonesModel model: config.regionalZonesModel
currentIndex: config.currentIndex currentIndex : -1
delegate: ItemDelegate { delegate: ItemDelegate {
hoverEnabled: true hoverEnabled: true
@ -147,7 +150,7 @@ Page {
Label { Label {
text: name text: model.name
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
width: parent.width width: parent.width
@ -163,9 +166,10 @@ Page {
onClicked: { onClicked: {
list2.model.currentIndex = index list2.currentIndex = index
list2.positionViewAtIndex(index, ListView.Center) list2.positionViewAtIndex(index, ListView.Center)
// correct to use config.currentTimezoneName when index is updated? control.currentZone = model.name
config.setCurrentLocation(control.currentRegion, control.currentZone)
tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName) tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName)
} }
} }