[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:       2007-10-13 18:23:20
Message-ID: 1192299800.478104.10236.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 724876 by spstarr:

bbc ion: Make this compile and partly async This ion still is not finished yet. Now \
that ion backend is async friendly, we can fix this plugin properly now.

 M  +24 -39    ion_bbcukmet.cpp  
 M  +6 -6      ion_bbcukmet.h  


--- trunk/KDE/kdebase/workspace/plasma/dataengines/weather/ions/ion_bbcukmet.cpp \
#724875:724876 @@ -80,22 +80,19 @@
 }
 
 // Get a specific Ion's data
-void UKMETIon::fetch()
+bool UKMETIon::updateIonSource(const QString& source)
 {
-    kDebug() << "fetch()";
-    foreach(QString key, this->ionSourceDict()) {
-       // if we already have this place stored, don't search again for it, just get \
                forecast/obs info.
-       if (!d->m_locations.contains(key)) {
-           searchPlace(key);
-       } else {
-           cachedLocation(key);
-       }
-
-    }
+       Q_UNUSED(source)
+       //if (!d->m_locations.contains(source)) {
+       //    searchPlace(source);
+       //} else {
+       //    cachedLocation(source);
+      // }
+return true;
 }
 
 // Parses city list and gets the correct city based on ID number
-void UKMETIon::searchPlace(QString key)
+void UKMETIon::searchPlace(const QString& key)
 {
     KUrl url;
     url = "http://www.bbc.co.uk/cgi-perl/weather/search/new_search.pl?x=0&y=0&=Submit&search_query=" \
+ key + "&tmpl=wap"; @@ -112,7 +109,7 @@
     }
 }
 
-bool UKMETIon::readSearchXMLData(QString key, QXmlStreamReader& xml)
+bool UKMETIon::readSearchXMLData(const QString& key, QXmlStreamReader& xml)
 {
     while (!xml.atEnd()) {
         xml.readNext();
@@ -134,7 +131,7 @@
 return !xml.error();
 }
 
-void UKMETIon::cachedLocation(QString key)
+void UKMETIon::cachedLocation(const QString& key)
 {
     d->m_job = 0;
     kDebug() << "cachedLocation: d->m_place[key].place = " << d->m_place[key].place;
@@ -153,9 +150,9 @@
     }
 }
  
-void UKMETIon::parseSearchLocations(QString key, QXmlStreamReader& xml)
+void UKMETIon::parseSearchLocations(const QString& source, QXmlStreamReader& xml)
 { 
-    Q_UNUSED(key) 
+    Q_UNUSED(source) 
     int flag = 0;
     QString url;
     QString place;
@@ -201,28 +198,22 @@
         } 
     }
     // All Locations
-    foreach(QString name, d->m_locations) {
-       if (d->m_place[name].ukPlace) {
-           //kDebug() << "UKMET: LIST OF UK PLACE: " << name;
-           setData("FoundPlaces", name, QString("%1|%2").arg(name).arg("Local"));
-           //kDebug() << "UKMET: URL OF UK PLACE: " << d->m_place[name].XMLurl;
-       }
+    if (d->m_place[source].ukPlace) {
+        //kDebug() << "UKMET: LIST OF UK PLACE: " << source;
+        setData("FoundPlaces", source, QString("%1|%2").arg(source).arg("Local"));
+        //kDebug() << "UKMET: URL OF UK PLACE: " << d->m_place[source].XMLurl;
     }
 
-    foreach(QString name, d->m_locations) {
-       if (!d->m_place[name].ukPlace) {
-           //kDebug() << "UKMET: LIST OF WORLD PLACE: " << name;
-           setData("FoundPlaces", name, QString("%1|%2").arg(name).arg("World"));
-           //kDebug() << "UKMET: URL OF WORLD PLACE: " << d->m_place[name].XMLurl;
-       }
+    if (!d->m_place[source].ukPlace) {
+        //kDebug() << "UKMET: LIST OF WORLD PLACE: " << source;
+        setData("FoundPlaces", source, QString("%1|%2").arg(source).arg("World"));
+        //kDebug() << "UKMET: URL OF WORLD PLACE: " << d->m_place[source].XMLurl;
     }
-    //this->removeSource(key);
 }
 
 // handle when no XML tag is found
 void UKMETIon::parseUnknownElement(QXmlStreamReader& xml)
 {
-
     while (!xml.atEnd()) {
         xml.readNext();
 
@@ -399,16 +390,10 @@
     return false;
 }
 
-void UKMETIon::updateData()
+void UKMETIon::updateWeather(const QString& source)
 {
-    QVector<QString> sources;
-    sources = this->ionSourceDict();
-    foreach(QString keyname, sources) {
-        if (!this->validLocation(keyname)) {
-            kDebug() << "UKMETIon::updateData() " << keyname << " is not a valid \
                location";
-            this->removeSource(keyname);
-        }
-    }
+    Q_UNUSED(source)
+    return;
 }
 
 #include "ion_bbcukmet.moc"
--- trunk/KDE/kdebase/workspace/plasma/dataengines/weather/ions/ion_bbcukmet.h \
#724875:724876 @@ -53,8 +53,8 @@
     UKMETIon(QObject *parent, const QVariantList &args);
     ~UKMETIon();
     void init();  // Setup the city location, fetching the correct URL name.
-    void fetch(); // Find a place
-    void updateData(void); // Sync data source with Applet
+    bool updateIonSource(const QString& source);
+    void updateWeather(const QString& source); // Sync data source with Applet
     void option(int option, QVariant value);
 
 protected slots:
@@ -67,10 +67,10 @@
     /* UKMET Methods - Internal for Ion */
 
     // Load and Parse the place search XML listings
-    void searchPlace(QString key);
-    void cachedLocation(QString key);
-    bool readSearchXMLData(QString key, QXmlStreamReader& xml);
-    void parseSearchLocations(QString key, QXmlStreamReader& xml);
+    void searchPlace(const QString& key);
+    void cachedLocation(const QString& key);
+    bool readSearchXMLData(const QString& key, QXmlStreamReader& xml);
+    void parseSearchLocations(const QString& key, QXmlStreamReader& xml);
     bool validLocation(QString key);
 
     // Observation parsing methods


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic