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 <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-07-15 11:18:37 +03:00
parent 7bb0c86cf6
commit 002bf61331

View file

@ -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<WeatherValidator*,QString> validators;
};