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

a59559
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
a59559
--- 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
a59559
+++ 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
a59559
@@ -690,8 +690,8 @@
a59559
     QString line;
a59559
     QString period;
a59559
     QString summary;
a59559
-    QRegExp high("-?\\d+.C");
a59559
-    QRegExp low("-?\\d+.C");
a59559
+    QRegExp high("Maximum Temperature: (-?\\d+).C", Qt::CaseInsensitive);
a59559
+    QRegExp  low("Minimum Temperature: (-?\\d+).C", Qt::CaseInsensitive);
a59559
     while (!xml.atEnd()) {
a59559
         xml.readNext();
a59559
         if (xml.name() == "title") {
a59559
@@ -702,15 +702,22 @@
a59559
 
a59559
             period = line.split(',')[0].split(':')[0];
a59559
             summary = line.split(',')[0].split(':')[1].trimmed();
a59559
-            high.indexIn(line.split(',')[1].split(':')[1]);
a59559
-            low.indexIn(line.split(',')[1].split(':')[2]);
a59559
+
a59559
+            // Sometimes only one of min or max are reported
a59559
+            if (high.indexIn(line.split(',')[1]) == -1)
a59559
+                forecast->tempHigh = 0;
a59559
+            else
a59559
+                forecast->tempHigh = high.cap(1).toInt();
a59559
+
a59559
+            if (low.indexIn(line.split(',')[1]) == -1)
a59559
+                forecast->tempLow = 0;
a59559
+            else
a59559
+                forecast->tempLow = low.cap(1).toInt();
a59559
 
a59559
             forecast->period = period;
a59559
             forecast->iconName = getWeatherIcon(dayIcons(), summary.toLower());
a59559
             forecast->summary = i18nc("weather forecast", summary.toUtf8());
a59559
             kDebug() << "i18n summary string: " << qPrintable(forecast->summary);
a59559
-            forecast->tempHigh = high.cap(0).toInt();
a59559
-            forecast->tempLow = low.cap(0).toInt();
a59559
             m_weatherData[source].forecasts.append(forecast);
a59559
             forecast = new WeatherData::ForecastInfo;
a59559
         }