]> git.mxchange.org Git - simgear.git/commitdiff
Allow updating a Catalog URL explicitly.
authorJames Turner <zakalawe@mac.com>
Wed, 25 May 2016 20:46:16 +0000 (21:46 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
Needed for fallback Catalog URL support.

simgear/package/Catalog.cxx
simgear/package/Catalog.hxx

index 2ce17d5ebcad9db638771fc63034ae0dc06499b3..8e912ff9dc4649b057459183ca76fc86d6d83550 100644 (file)
@@ -144,7 +144,7 @@ protected:
                        " to \n\t" << url);
 
                 // update the URL and kick off a new request
-                m_owner->m_url = url;
+                m_owner->setUrl(url);
                 Downloader* dl = new Downloader(m_owner, url);
                 m_owner->root()->makeHTTPRequest(dl);
             } else {
@@ -437,6 +437,14 @@ std::string Catalog::url() const
     return m_url;
 }
 
+void Catalog::setUrl(const std::string &url)
+{
+    m_url = url;
+    if (m_status == Delegate::FAIL_NOT_FOUND) {
+        m_status = Delegate::FAIL_UNKNOWN;
+    }
+}
+
 std::string Catalog::name() const
 {
     return getLocalisedString(m_props, "name");
@@ -505,8 +513,8 @@ std::string Catalog::getLocalisedString(const SGPropertyNode* aRoot, const char*
 
 void Catalog::refreshComplete(Delegate::StatusCode aReason)
 {
-    changeStatus(aReason);
     m_refreshRequest.reset();
+    changeStatus(aReason);
 }
 
 void Catalog::changeStatus(Delegate::StatusCode newStatus)
index 11928b1ccfdcb626a57ba69e9af7c19dd75b1469..8c6e2efcf2a849cf90f56fa01dbbc4e444f64099 100644 (file)
@@ -106,6 +106,12 @@ public:
 
     std::string url() const;
 
+    /**
+     * update the URL of a package. Does not trigger a refresh, but resets
+     * error state if the previous URL was not found.
+     */
+    void setUrl(const std::string& url);
+
     std::string name() const;
 
     std::string description() const;