Fixed a broken merge
[irwi] / src / remotedbmgr.cpp
index 67a6d4c..f824c79 100644 (file)
@@ -27,7 +27,7 @@ RemoteDBMgr::~RemoteDBMgr()
 
 void RemoteDBMgr::getDBAsync()
 {
-    if (db.isEmpty()) {
+    if (db.isEmpty() && !processing) {
         QSettings settings(this);
         netAM.get(QNetworkRequest(QUrl(settings.value("baseUrl",
             "http://mercury.wipsl.com/irwi/").toString() + "db/db.xml")));
@@ -39,7 +39,7 @@ void RemoteDBMgr::getDBAsync()
 
 void RemoteDBMgr::dbDownloadFinished(QNetworkReply *reply)
 {
-    if (reply->error() == QNetworkReply::NoError) {
+    if (processing = (reply->error() == QNetworkReply::NoError)) {
         QByteArray ba = reply->readAll();
         QBuffer buf(&ba);
         buf.open(QIODevice::ReadOnly);
@@ -52,6 +52,7 @@ void RemoteDBMgr::dbDownloadFinished(QNetworkReply *reply)
             emit dbReady(&db);
         }
     }
+    processing = false;
 }
 
 void RemoteDBMgr::parse(QDomDocument &doc)
@@ -91,12 +92,11 @@ RemoteList RemoteDBMgr::parseRemotes(QDomElement &mfgEl)
     for (int i = 0; i < models.size(); ++i) {
         QDomElement modelEl = models.at(i).toElement();
         if (!modelEl.isNull()) {
-            if (modelEl.hasAttribute("id")
-                && modelEl.hasAttribute("name")
+            if (modelEl.hasAttribute("name")
                 && modelEl.hasAttribute("rating")
                 && modelEl.hasAttribute("vote_count")) {
                 remotes << new Remote(modelEl.attribute("name"),
-                                      modelEl.attribute("id"),
+                                      mfgEl.attribute("id"),
                                       modelEl.attribute("rating").toInt(),
                                       modelEl.attribute("vote_count").toInt());
             }