Fix button logic

This commit is contained in:
Matti Viljanen 2020-03-21 04:03:40 +02:00
parent cc52212eb5
commit c5dbb6d6a3
No known key found for this signature in database
GPG key ID: CF32A1495158F888
2 changed files with 14 additions and 3 deletions

View file

@ -132,7 +132,10 @@ Page {
id: resumeButton
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Resume")
onClicked: battery.chargingEnabled = true
onClicked: {
battery.chargingEnabled = true
settings.limitEnabled = false
}
enabled: !battery.chargingEnabled
}
}
@ -142,7 +145,10 @@ Page {
id: pauseButton
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Pause")
onClicked: battery.chargingEnabled = false
onClicked: {
battery.chargingEnabled = false
settings.limitEnabled = false
}
enabled: battery.chargingEnabled
}
}

View file

@ -22,6 +22,12 @@ import "../components"
Page {
id: settingsPage
onStatusChanged: {
if(status === PageStatus.Activating) {
autoStopCharging.checked = settings.notificationsEnabled
}
}
SilicaFlickable {
anchors.fill: parent
contentHeight: header.height + settingsColumn.height + Theme.horizontalPageMargin
@ -60,7 +66,6 @@ Page {
text: qsTr("Stop charging when limit reached")
description: qsTr("This option stops charging when battery has reached the percentage set in Charging limit value, and resumes charging when charge has decreased below Continue charge limit value. Generally a value close to the Charging limit value is recommened, such as 80% and 75%.")
onCheckedChanged: settings.limitEnabled = checked
Component.onCompleted: checked = settings.limitEnabled
}
MySlider {