diff data/fileio/FileSource.cpp @ 1007:ba404199345f tonioni

Merge from default branch
author Chris Cannam
date Mon, 10 Nov 2014 09:19:49 +0000
parents 60e2927b1475
children 3a48b22fed48
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/data/fileio/FileSource.cpp	Mon Nov 10 09:19:49 2014 +0000
@@ -78,6 +78,7 @@
     m_reply(0),
     m_preferredContentType(preferredContentType),
     m_ok(false),
+    m_cancelled(false),
     m_lastStatus(0),
     m_resource(fileOrUrl.startsWith(':')),
     m_remote(isRemote(fileOrUrl)),
@@ -167,6 +168,7 @@
     m_localFile(0),
     m_reply(0),
     m_ok(false),
+    m_cancelled(false),
     m_lastStatus(0),
     m_resource(false),
     m_remote(isRemote(url.toString())),
@@ -199,6 +201,7 @@
     m_localFile(0),
     m_reply(0),
     m_ok(rf.m_ok),
+    m_cancelled(rf.m_cancelled),
     m_lastStatus(rf.m_lastStatus),
     m_resource(rf.m_resource),
     m_remote(rf.m_remote),
@@ -484,6 +487,7 @@
     m_done = true;
     if (m_reply) {
         QNetworkReply *r = m_reply;
+        disconnect(r, 0, this, 0);
         m_reply = 0;
         // Can only call abort() when there are no errors.
         if (r->error() == QNetworkReply::NoError) {
@@ -571,6 +575,12 @@
 }
 
 bool
+FileSource::wasCancelled() const
+{
+    return m_cancelled;
+}
+
+bool
 FileSource::isResource() const
 {
     return m_resource;
@@ -710,6 +720,7 @@
     cleanup();
 
     m_ok = false;
+    m_cancelled = true;
     m_errorString = tr("Download cancelled");
 }