From 002bf6133156c21adbdc4ab538a31305b45337e7 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 15 Jul 2023 11:18:37 +0300 Subject: [PATCH] kdeplasma-addons: stop emitting the finished signal of WeatherLocation once a valid source is found how valid the source is is entirely different thing, more than one weather source can match a given location (look for "multiple" in the ions and think why it is a thing) Signed-off-by: Ivailo Monev --- kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp b/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp index e06d6f1c..b2d68bda 100644 --- a/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp +++ b/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp @@ -29,7 +29,8 @@ public: Private(WeatherLocation *location) : q(location), locationEngine(nullptr), - weatherEngine(nullptr) + weatherEngine(nullptr), + foundsource(false) { } @@ -42,10 +43,11 @@ public: } validators.remove(validator); - if (!source.isEmpty()) { + if (!source.isEmpty() && !foundsource) { + foundsource = true; emit q->finished(source); } - if (validators.isEmpty()) { + if (!foundsource && validators.isEmpty()) { emit q->finished(QString()); } } @@ -53,6 +55,7 @@ public: WeatherLocation *q; Plasma::DataEngine *locationEngine; Plasma::DataEngine *weatherEngine; + bool foundsource; QMap validators; };