Search
SailfishOS Open Build Service
>
Projects
>
sailfishos
:
chum
:
testing
>
ktrip
> _service:tar_git:git-0002-Wait-till-location-query-has-finished-before-making-.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File _service:tar_git:git-0002-Wait-till-location-query-has-finished-before-making-.patch of Package ktrip
From 9fea45af4fd49cddd5113be02ec96e4aadc57794 Mon Sep 17 00:00:00 2001 From: Rinigus Saar <rinigus.git@gmail.com> Date: Sat, 6 May 2023 17:16:36 +0300 Subject: [PATCH 19/20] Wait till location query has finished before making a new one This fixes frequent crashes of KTrip when you type location name faster than the backend is able to resolve. In addition, it shows cached locations if there is no query entered by user --- src/qml/LocationQueryPage.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/qml/LocationQueryPage.qml b/src/qml/LocationQueryPage.qml index 04ee200..2dc98e9 100644 --- a/src/qml/LocationQueryPage.qml +++ b/src/qml/LocationQueryPage.qml @@ -13,17 +13,23 @@ import org.kde.ktrip 1.0 Kirigami.ScrollablePage { - property bool showCached: true + property bool showCached: !(queryTextField.text) property var callback + property string _lastQuery + header: Kirigami.SearchField { id: queryTextField visible: Manager.enabledBackends.length !== 0 width: parent.width - onAccepted: { - queryModel.request = Controller.createLocationRequest(text) - showCached = false + onAccepted: query() + } + + function query() { + if (queryTextField.text && queryTextField.text !== _lastQuery && !queryModel.loading) { + _lastQuery = queryTextField.text + queryModel.request = Controller.createLocationRequest(_lastQuery) } } @@ -69,6 +75,10 @@ Kirigami.ScrollablePage KPT.LocationQueryModel { id: queryModel manager: Manager + onLoadingChanged: { + if (!loading && queryTextField.text) + Qt.callLater(query) + } } LocationCacheModel { -- 2.39.3