diff --git a/applets/digital-clock/package/contents/config/main.xml b/applets/digital-clock/package/contents/config/main.xml --- a/applets/digital-clock/package/contents/config/main.xml +++ b/applets/digital-clock/package/contents/config/main.xml @@ -19,9 +19,13 @@ false - + shortDate + + + ddd d + diff --git a/applets/digital-clock/package/contents/ui/DigitalClock.qml b/applets/digital-clock/package/contents/ui/DigitalClock.qml --- a/applets/digital-clock/package/contents/ui/DigitalClock.qml +++ b/applets/digital-clock/package/contents/ui/DigitalClock.qml @@ -33,14 +33,16 @@ property bool showSeconds: plasmoid.configuration.showSeconds property bool showLocalTimezone: plasmoid.configuration.showLocalTimezone property bool showDate: plasmoid.configuration.showDate - property int dateFormat: { - if (plasmoid.configuration.dateFormat === "longDate") { - return Qt.SystemLocaleLongDate; + property var dateFormat: { + if (plasmoid.configuration.dateFormat === "custom") { + return plasmoid.configuration.dateFormatStr; // str + } else if (plasmoid.configuration.dateFormat === "longDate") { + return Qt.SystemLocaleLongDate; // int } else if (plasmoid.configuration.dateFormat === "isoDate") { - return Qt.ISODate; + return Qt.ISODate; // int + } else { // "shortDate" + return Qt.SystemLocaleShortDate; // int } - - return Qt.SystemLocaleShortDate; } property string lastSelectedTimezone: plasmoid.configuration.lastSelectedTimezone diff --git a/applets/digital-clock/package/contents/ui/configAppearance.qml b/applets/digital-clock/package/contents/ui/configAppearance.qml --- a/applets/digital-clock/package/contents/ui/configAppearance.qml +++ b/applets/digital-clock/package/contents/ui/configAppearance.qml @@ -44,6 +44,7 @@ property alias cfg_showDate: showDate.checked property string cfg_dateFormat: "shortDate" + property alias cfg_dateFormatStr: dateFormatTextField.text property alias cfg_use24hFormat: use24hFormat.checked onCfg_fontFamilyChanged: { @@ -137,6 +138,10 @@ { 'label': i18n("ISO Date"), 'name': "isoDate" + }, + { + 'label': i18nc("custom date format", "Custom"), + 'name': "custom" } ] onCurrentIndexChanged: cfg_dateFormat = model[currentIndex]["name"] @@ -150,6 +155,42 @@ } } + QtControls.TextField { + id: dateFormatTextField + QtLayouts.Layout.fillWidth: true + visible: cfg_dateFormat == "custom" + } + + QtControls.Label { + text: i18n("Time Format Documentation") + visible: cfg_dateFormat == "custom" + wrapMode: Text.Wrap + QtLayouts.Layout.preferredWidth: QtLayouts.Layout.maximumWidth + QtLayouts.Layout.maximumWidth: units.gridUnit * 16 + + onLinkActivated: Qt.openUrlExternally(link) + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton // We don't want to eat clicks on the Label + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } + } + + QtControls.Label { + text: i18n("Color Format Documentation") + visible: cfg_dateFormat == "custom" + wrapMode: Text.Wrap + QtLayouts.Layout.preferredWidth: QtLayouts.Layout.maximumWidth + QtLayouts.Layout.maximumWidth: units.gridUnit * 16 + + onLinkActivated: Qt.openUrlExternally(link) + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton // We don't want to eat clicks on the Label + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } + } + Item { Kirigami.FormData.isSection: true }