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 @@ -22,6 +22,10 @@ shortDate + + + ddd, dd MMM + 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 @@ -38,6 +38,8 @@ return Qt.SystemLocaleLongDate; } else if (plasmoid.configuration.dateFormat === "isoDate") { return Qt.ISODate; + } else if (plasmoid.configuration.dateFormat === "customDate") { + return 999; } return Qt.SystemLocaleShortDate; @@ -61,6 +63,10 @@ onDateFormatChanged: { setupLabels(); } + + onCustomDateFormatChanged: { + setupLabels(); + } onDisplayTimezoneAsCodeChanged: { setupLabels(); } onStateChanged: { setupLabels(); } @@ -610,7 +616,7 @@ if (main.showDate) { - dateLabel.text = Qt.formatDate(main.currentTime, main.dateFormat); + dateLabel.text = Qt.formatDate( main.currentTime, main.dateFormat === 999 ? main.customDateFormat : main.dateFormat ); } else { // clear it so it doesn't take space in the layout dateLabel.text = ""; 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 @@ -45,6 +45,8 @@ property alias cfg_showDate: showDate.checked property string cfg_dateFormat: "shortDate" property alias cfg_use24hFormat: use24hFormat.checked + + property string cfg_customDateFormat: "" onCfg_fontFamilyChanged: { // HACK by the time we populate our model and/or the ComboBox is finished the value is still undefined @@ -57,6 +59,10 @@ } } } + + onCfg_customDateFormatChanged:{ + appearancePage.configurationChanged() + } ListModel { id: fontsModel @@ -137,6 +143,10 @@ { 'label': i18n("ISO Date"), 'name': "isoDate" + }, + { + 'label': i18n("Custom"), + 'name': "customDate" } ] onCurrentIndexChanged: cfg_dateFormat = model[currentIndex]["name"] @@ -149,6 +159,21 @@ } } } + + QtControls.TextField{ + id: customDateFormat + + text: cfg_customDateFormat + visible: cfg_dateFormat == "customDate" + + onEditingFinished:{ + cfg_customDateFormat = text + } + + Component.onCompleted: { + text = plasmoid.configuration.customDateFormat + } + } Item { Kirigami.FormData.isSection: true @@ -209,5 +234,7 @@ } else { timezoneCityRadio.checked = true; } + + cfg_customDateFormat = plasmoid.configuration.customDateFormat } }