[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/dataengines/weather/ions
From: Shawn Starr <shawn.starr () rogers ! com>
Date: 2009-03-31 20:16:37
Message-ID: 1238530597.610975.21229.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 947585 by spstarr:
for NOAA ion, we now can support searching by airport / station ID just like lweather
M +17 -1 ion_noaa.cpp
--- trunk/KDE/kdebase/workspace/plasma/dataengines/weather/ions/ion_noaa.cpp #947584:947585
@@ -27,6 +27,7 @@
struct XMLMapInfo {
QString stateName;
QString stationName;
+ QString stationID;
QString XMLurl;
QString sourceOptions;
};
@@ -37,6 +38,7 @@
QHash<QString, QString> m_locations;
QString m_state;
QString m_station_name;
+ QString m_station_id;
QString m_xmlurl;
// Weather information
@@ -109,6 +111,8 @@
{
QStringList placeList;
QHash<QString, QString>::const_iterator it = d->m_locations.constBegin();
+ QHash<QString, NOAAIon::Private::XMLMapInfo>::const_iterator it_station = d->m_place.constBegin();
+
while (it != d->m_locations.constEnd()) {
if (it.value().toLower().contains(source.toLower())) {
placeList.append(QString("place|%1").arg(it.value().split('|')[1]));
@@ -116,6 +120,15 @@
++it;
}
+ // If the source name might look like a station ID, check these too and return the name
+ while (it_station != d->m_place.constEnd()) {
+ if (it_station.value().stationID.contains(source.toUpper().split('|')[1])) {
+ QString matchID = it_station.value().stationName + ", " + it_station.value().stateName;
+ placeList.append(QString("place|%1").arg(matchID));
+ }
+ ++it_station;
+ }
+
// Check if placeList is empty if so, return nothing.
if (placeList.isEmpty()) {
return QStringList();
@@ -256,7 +269,9 @@
}
if (d->m_xmlSetup.isStartElement()) {
- if (d->m_xmlSetup.name() == "state") {
+ if (d->m_xmlSetup.name() == "station_id") {
+ d->m_station_id = d->m_xmlSetup.readElementText();
+ } else if (d->m_xmlSetup.name() == "state") {
d->m_state = d->m_xmlSetup.readElementText();
} else if (d->m_xmlSetup.name() == "station_name") {
d->m_station_name = d->m_xmlSetup.readElementText();
@@ -266,6 +281,7 @@
tmp = "noaa|" + d->m_station_name + ", " + d->m_state; // Build the key name.
d->m_place[tmp].stateName = d->m_state;
d->m_place[tmp].stationName = d->m_station_name;
+ d->m_place[tmp].stationID = d->m_station_id;
d->m_place[tmp].XMLurl = d->m_xmlurl.replace("http://", "http://www.");
d->m_locations[tmp] = tmp;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic