Skip to content

Commit

Permalink
Respect write access in spinbox, date/time selectors and misc buttons
Browse files Browse the repository at this point in the history
Fixes #1764

(cherry picked from commit 3c18855)
  • Loading branch information
blammit authored and chriadam committed Nov 29, 2024
1 parent bc0fa11 commit 9a8ba4a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/listitems/ListDateSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ListButton {
property var date: dataItem.isValid ? new Date(dataItem.value * 1000) : null

button.text: date == null ? "--" : Qt.formatDate(date, "yyyy-MM-dd")
enabled: dataItem.uid === "" || dataItem.isValid
enabled: userHasWriteAccess && (dataItem.uid === "" || dataItem.isValid)

onClicked: Global.dialogLayer.open(dateSelectorComponent, {
year: date ? date.getFullYear() : ClockTime.year,
Expand Down
2 changes: 1 addition & 1 deletion components/listitems/ListSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ListButton {
signal selectorAccepted(newValue: var)

button.text: value === undefined ? "--" : Units.formatNumber(value, decimals) + root.suffix
enabled: dataItem.uid === "" || dataItem.isValid
enabled: userHasWriteAccess && (dataItem.uid === "" || dataItem.isValid)

onClicked: Global.dialogLayer.open(numberSelectorComponent, {value: value})

Expand Down
2 changes: 1 addition & 1 deletion components/listitems/ListTimeSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ListButton {
property real value: !dataItem.isValid ? 0 : dataItem.value

button.text: hour < 0 || minute < 0 ? "--" : ClockTime.formatTime(hour, minute)
enabled: dataItem.uid === "" || dataItem.isValid
enabled: userHasWriteAccess && (dataItem.uid === "" || dataItem.isValid)

onClicked: Global.dialogLayer.open(timeSelectorComponent, {hour: hour, minute: minute})

Expand Down
2 changes: 1 addition & 1 deletion components/settings/FirmwareCheckListButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ListButton {
? qsTrId("settings_firmware_checking")
//% "Press to check"
: qsTrId("settings_firmware_press_to_check")
enabled: !Global.firmwareUpdate.busy
enabled: userHasWriteAccess && !Global.firmwareUpdate.busy
writeAccessLevel: VenusOS.User_AccessType_User

onClicked: {
Expand Down
2 changes: 1 addition & 1 deletion components/settings/ListClearHistoryButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ListButton {
id: timer
interval: 2000
}
enabled: !timer.running
enabled: userHasWriteAccess && !timer.running

onClicked: {
/*
Expand Down

0 comments on commit 9a8ba4a

Please sign in to comment.