Commit 74f0f259 authored by Nate Graham's avatar Nate Graham 🔩

[Digital Clock] Replace 12/24hr tri-state checkbox in config UI with combobox

Summary:
The use of a tri-state checkbox for the three possible states (12hr, 24hr, use locale
default) is not ideal because it violates the convention regarding what tri-state
checkboxes are used for: nested lists where some sub-items can be unselected.

This patch replaces it with a combobox that clearly indicates all three states.

While we're at it, we add a button to open the Formats KCM in case people want to change their region.

BUG: 402487
FIXED-IN: 5.16.0

Test Plan:
Tested functionality with `en_US` locale. Check out the clock in the bottom-right corner of
the following screenshots:

Default state: "Use Region Defaults": {F6645570}

Force 12 hour time: {F6645573}

Force 24-hour time: {F6645574}

Reviewers: #plasma, Zren, #vdg, davidedmundson, ndavis

Reviewed By: #plasma, #vdg, davidedmundson, ndavis

Subscribers: cfeck, totte, ndavis, abetts, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D19230
parent ee648c4c
...@@ -24,6 +24,7 @@ import QtQuick 2.0 ...@@ -24,6 +24,7 @@ import QtQuick 2.0
import QtQuick.Controls 2.3 as QtControls import QtQuick.Controls 2.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.calendar 2.0 as PlasmaCalendar import org.kde.plasma.calendar 2.0 as PlasmaCalendar
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.5 as Kirigami import org.kde.kirigami 2.5 as Kirigami
QtLayouts.ColumnLayout { QtLayouts.ColumnLayout {
...@@ -45,7 +46,7 @@ QtLayouts.ColumnLayout { ...@@ -45,7 +46,7 @@ QtLayouts.ColumnLayout {
property alias cfg_showDate: showDate.checked property alias cfg_showDate: showDate.checked
property string cfg_dateFormat: "shortDate" property string cfg_dateFormat: "shortDate"
property alias cfg_customDateFormat: customDateFormat.text property alias cfg_customDateFormat: customDateFormat.text
property alias cfg_use24hFormat: use24hFormat.checkState property alias cfg_use24hFormat: use24hFormat.currentIndex
onCfg_fontFamilyChanged: { onCfg_fontFamilyChanged: {
// HACK by the time we populate our model and/or the ComboBox is finished the value is still undefined // HACK by the time we populate our model and/or the ComboBox is finished the value is still undefined
...@@ -88,12 +89,6 @@ QtLayouts.ColumnLayout { ...@@ -88,12 +89,6 @@ QtLayouts.ColumnLayout {
text: i18n("Show seconds") text: i18n("Show seconds")
} }
QtControls.CheckBox {
id: use24hFormat
text: i18nc("Checkbox label; means 24h clock format, without am/pm", "Use 24-hour Clock")
tristate: true
}
QtControls.CheckBox { QtControls.CheckBox {
id: showLocalTimezone id: showLocalTimezone
text: i18n("Show local time zone") text: i18n("Show local time zone")
...@@ -122,6 +117,31 @@ QtLayouts.ColumnLayout { ...@@ -122,6 +117,31 @@ QtLayouts.ColumnLayout {
Kirigami.FormData.isSection: true Kirigami.FormData.isSection: true
} }
QtLayouts.RowLayout {
QtLayouts.Layout.fillWidth: true
Kirigami.FormData.label: i18n("Time display:")
QtControls.ComboBox {
id: use24hFormat
model: [
i18n("12-Hour"),
i18n("Use Region Defaults"),
i18n("24-Hour")
]
onCurrentIndexChanged: cfg_use24hFormat = currentIndex
}
QtControls.Button {
text: i18n("Change Regional Settings...")
icon.name: "preferences-desktop-locale"
onClicked: KCMShell.open("formats.desktop")
}
}
Item {
Kirigami.FormData.isSection: true
}
QtControls.ComboBox { QtControls.ComboBox {
id: dateFormat id: dateFormat
Kirigami.FormData.label: i18n("Date format:") Kirigami.FormData.label: i18n("Date format:")
......
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