--- a/applets/weather/package/contents/ui/config/WeatherStationPicker.qml +++ b/applets/weather/package/contents/ui/config/WeatherStationPicker.qml @@ -34,9 +34,13 @@ ColumnLayout { readonly property bool handlesEnterKey: canSearch && searchStringEdit.activeFocus function searchLocation() { + searchTimer.stop(); if (!canSearch) { return; } + if(selectedServices.length == 0) { + return; + } // avoid automatic selection once model is refilled locationListView.currentRow = -1; @@ -64,6 +68,12 @@ ColumnLayout { id: serviceListModel } + Timer { + id: searchTimer + interval: 800; running: false; repeat: false + onTriggered: searchLocation(); + } + QtControls.Menu { id: serviceSelectionMenu @@ -78,6 +88,9 @@ ColumnLayout { model.checked = checked; checked = Qt.binding(function() { return model.checked; }); weatherStationConfigPage.configurationChanged(); + if(model.checked) { + searchLocation(); + } } } onObjectAdded: serviceSelectionMenu.insertItem(index, object) @@ -99,14 +112,11 @@ ColumnLayout { onAccepted: { searchLocation(); } - } - - QtControls.Button { - id: serviceSelectionButton - - iconName: "services" - tooltip: i18nc("@info:tooltip", "Select weather services providers") - menu: serviceSelectionMenu + onTextChanged: { + if(searchStringEdit.text.length >= 3) { + searchTimer.restart(); + } + } } Item { @@ -122,15 +132,10 @@ ColumnLayout { } QtControls.Button { - id: searchButton - - iconName: "edit-find" - text: i18nc("@action:button", "Search") - enabled: canSearch - - onClicked: { - searchLocation(); - } + id: serviceSelectionButton + iconName: "services" + tooltip: i18n("Select weather services providers") + menu: serviceSelectionMenu } } --- a/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml +++ b/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml @@ -45,6 +45,9 @@ Kirigami.FormLayout { Component.onCompleted: { var config = plasmoid.nativeInterface.configValues(); + if(config.services.length == 0) { + config.services = ['wettercom'] + } stationPicker.selectedServices = config.services; source = config.source;