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

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