diff --git a/applets/digital-clock/package/contents/ui/configTimeZones.qml b/applets/digital-clock/package/contents/ui/configTimeZones.qml index 1170e13b0..b54587b50 100644 --- a/applets/digital-clock/package/contents/ui/configTimeZones.qml +++ b/applets/digital-clock/package/contents/ui/configTimeZones.qml @@ -1,107 +1,107 @@ /* * Copyright 2013 Kai Uwe Broulik * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see */ import QtQuick 2.13 -import QtQuick.Controls 2.13 as QQC2 +import QtQuick.Controls 2.8 as QQC2 import QtQuick.Layouts 1.0 import QtQuick.Dialogs 1.1 import org.kde.plasma.private.digitalclock 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami 2.5 as Kirigami ColumnLayout { id: timeZonesPage property alias cfg_selectedTimeZones: timeZones.selectedTimeZones property alias cfg_wheelChangesTimezone: enableWheelCheckBox.checked TimeZoneModel { id: timeZones onSelectedTimeZonesChanged: { if (selectedTimeZones.length === 0) { messageWidget.visible = true; timeZones.selectLocalTimeZone(); } } } Kirigami.InlineMessage { id: messageWidget Layout.fillWidth: true Layout.margins: Kirigami.Units.smallSpacing type: Kirigami.MessageType.Warning text: i18n("At least one time zone needs to be enabled. 'Local' was enabled automatically.") showCloseButton: true } QQC2.TextField { id: filter Layout.fillWidth: true placeholderText: i18n("Search Time Zones") } Item { Layout.fillWidth: true Layout.fillHeight: true QQC2.ScrollView { anchors.fill: parent clip: true Component.onCompleted: background.visible = true // enable border ListView { id: listView focus: true // keyboard navigation activeFocusOnTab: true // keyboard navigation model: TimeZoneFilterProxy { sourceModel: timeZones filterString: filter.text } delegate: QQC2.CheckDelegate { id: checkbox focus: true // keyboard navigation width: parent.width text: !city || city.indexOf("UTC") === 0 ? comment : comment ? i18n("%1, %2 (%3)", city, region, comment) : i18n("%1, %2", city, region) checked: model.checked onToggled: { model.checked = checkbox.checked listView.currentIndex = index // highlight listView.forceActiveFocus() // keyboard navigation } highlighted: ListView.isCurrentItem } } } } RowLayout { Layout.fillWidth: true QQC2.CheckBox { id: enableWheelCheckBox text: i18n("Switch time zone with mouse wheel") } } } diff --git a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml index 3570c30d6..b06c51c02 100644 --- a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml +++ b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml @@ -1,177 +1,177 @@ /* * Copyright 2013 Bhushan Shah * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.5 import QtQuick.Controls 2.5 as QQC2 import QtQuick.Layouts 1.3 import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.core 2.0 as PlasmaCore Item { id: iconsPage width: childrenRect.width height: childrenRect.height implicitWidth: formLayout.implicitWidth implicitHeight: formLayout.implicitHeight property var cfg_sources: [] function sourcesChanged() { if (! cfg_sources) { cfg_sources = [] } if (cfg_sources.length == 0) { for (var i in dataSourcesColumn.children) { var child = dataSourcesColumn.children[i]; if (child.checked !== undefined) { child.checked = sourceDefaultEnable(child.source); } } } else { for (var i in dataSourcesColumn.children) { var child = dataSourcesColumn.children[i]; if (child.checked !== undefined) { child.checked = cfg_sources.indexOf(child.source) !== -1; } } } } function sourceDefaultEnable(source) { return true; } onCfg_sourcesChanged: { sourcesChanged(); } property int cfg_updateInterval signal sourceAdded(string source) function addSource(source, friendlyName) { var found = false; for (var i = 0; i < sourcesModel.count; ++i) { var obj = sourcesModel.get(i); if (obj.source === source) { found = true; break; } } if (found) { return; } sourcesModel.append( {"source": encodeURIComponent(source), "friendlyName": friendlyName}); } PlasmaCore.DataSource { id: smSource engine: "systemmonitor" onSourceAdded: { iconsPage.sourceAdded(source); } onSourceRemoved: { for (var i = sourcesModel.count - 1; i >= 0; --i) { var obj = sourcesModel.get(i); if (obj.source === source) { sourcesModel.remove(i); } } } } Component.onCompleted: { for (var i in smSource.sources) { var source = smSource.sources[i]; iconsPage.sourceAdded(source); } sourcesChanged(); } ListModel { id: sourcesModel } Kirigami.FormLayout { id: formLayout anchors.left: parent.left anchors.right: parent.right QQC2.SpinBox { id: updateIntervalSpinBox Kirigami.FormData.label: i18n("Update interval:") from: 100 stepSize: 100 to: 1000000 editable: true validator: DoubleValidator { bottom: spinbox.from top: spinbox.to } textFromValue: function(value) { var seconds = value / 1000 - return i18n("%1 seconds", seconds.toFixed(1)) + return i18nc("SpinBox text", "%1 seconds", seconds.toFixed(1)) } valueFromText: function(text) { return parseFloat(text) * 1000 } value: cfg_updateInterval onValueModified: cfg_updateInterval = value } Item { Kirigami.FormData.isSection: true } ColumnLayout { id: dataSourcesColumn Kirigami.FormData.label: i18n("Show:") Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater Repeater { id: repeater model: sourcesModel QQC2.CheckBox { id: checkBox text: model.friendlyName property string source: model.source onCheckedChanged: { if (checked) { if (cfg_sources.indexOf(model.source) == -1) { cfg_sources.push(model.source); } } else { var idx = cfg_sources.indexOf(model.source); if (idx !== -1) { cfg_sources.splice(idx, 1); } } cfg_sourcesChanged(); } } } } } }