Blame SOURCES/kde-workspace-4.11.7-weather-fix-bbcukmet-temp.patch

ff3475
diff -ur kde-workspace-4.11.7-weather-fix-bbcukmet/plasma/generic/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp kde-workspace-4.11.7-weather-fix-bbcukmet-temp/plasma/generic/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
ff3475
--- kde-workspace-4.11.7-weather-fix-bbcukmet/plasma/generic/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp	2014-03-16 00:49:44.000000000 +0100
ff3475
+++ kde-workspace-4.11.7-weather-fix-bbcukmet-temp/plasma/generic/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp	2014-03-16 00:53:22.000000000 +0100
ff3475
@@ -690,8 +690,8 @@
ff3475
     QString line;
ff3475
     QString period;
ff3475
     QString summary;
ff3475
-    QRegExp high("-?\\d+.C");
ff3475
-    QRegExp low("-?\\d+.C");
ff3475
+    QRegExp high("Maximum Temperature: (-?\\d+).C", Qt::CaseInsensitive);
ff3475
+    QRegExp  low("Minimum Temperature: (-?\\d+).C", Qt::CaseInsensitive);
ff3475
     while (!xml.atEnd()) {
ff3475
         xml.readNext();
ff3475
         if (xml.name() == "title") {
ff3475
@@ -702,15 +702,22 @@
ff3475
 
ff3475
             period = line.split(',')[0].split(':')[0];
ff3475
             summary = line.split(',')[0].split(':')[1].trimmed();
ff3475
-            high.indexIn(line.split(',')[1].split(':')[1]);
ff3475
-            low.indexIn(line.split(',')[1].split(':')[2]);
ff3475
+
ff3475
+            // Sometimes only one of min or max are reported
ff3475
+            if (high.indexIn(line.split(',')[1]) == -1)
ff3475
+                forecast->tempHigh = 0;
ff3475
+            else
ff3475
+                forecast->tempHigh = high.cap(1).toInt();
ff3475
+
ff3475
+            if (low.indexIn(line.split(',')[1]) == -1)
ff3475
+                forecast->tempLow = 0;
ff3475
+            else
ff3475
+                forecast->tempLow = low.cap(1).toInt();
ff3475
 
ff3475
             forecast->period = period;
ff3475
             forecast->iconName = getWeatherIcon(dayIcons(), summary.toLower());
ff3475
             forecast->summary = i18nc("weather forecast", summary.toUtf8());
ff3475
             kDebug() << "i18n summary string: " << qPrintable(forecast->summary);
ff3475
-            forecast->tempHigh = high.cap(0).toInt();
ff3475
-            forecast->tempLow = low.cap(0).toInt();
ff3475
             m_weatherData[source].forecasts.append(forecast);
ff3475
             forecast = new WeatherData::ForecastInfo;
ff3475
         }