OSDN Git Service

plasma: do not emit useless data from hostip geolocation provider
authorIvailo Monev <xakepa10@gmail.com>
Tue, 26 Apr 2022 03:59:05 +0000 (06:59 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 26 Apr 2022 03:59:35 +0000 (06:59 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
plasma/dataengines/geolocation/location_hostip.cpp

index f5c0c20..164084b 100644 (file)
@@ -55,6 +55,17 @@ public:
                 }
             }
         }
+
+        if (country.contains(QLatin1String("Unknown Country"))) {
+            country = QString();
+        }
+        if (city.contains(QLatin1String("Unknown City"))) {
+            city = QString();
+        }
+        if (country.isEmpty() && city.isEmpty()) {
+            return;
+        }
+
         // ordering of first three to preserve backwards compatibility
         outd["accuracy"] = 40000;
         outd["country"] = country;