[Pkg-owncloud-commits] [owncloud-client] 02/159: Propagator: Introduce custom property to make error soft

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri May 1 13:05:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 06a2f58c5121597b2f29c2e4780e3680689e8d1f
Author: Markus Goetz <markus at woboq.com>
Date:   Tue Mar 17 23:31:30 2015 +0100

    Propagator: Introduce custom property to make error soft
    
    This can be set by a custom credential QNAM.
---
 src/libsync/propagatedownload.cpp | 12 ++++++++++++
 src/libsync/propagatedownload.h   |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index 9084d97..85b8fab 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -368,6 +368,7 @@ void PropagateDownloadFileQNAM::start()
     _job->start();
 }
 
+const char owncloudCustomSoftErrorStringC[] = "owncloud-custom-soft-error-string";
 void PropagateDownloadFileQNAM::slotGetFinished()
 {
     _propagator->_activeJobs--;
@@ -407,7 +408,18 @@ void PropagateDownloadFileQNAM::slotGetFinished()
             return;
         }
 
+        // This gives a custom QNAM (by the user of libowncloudsync) to abort() a QNetworkReply in its metaDataChanged() slot and
+        // set a custom error string to make this a soft error. In contrast to the default hard error this won't bring down
+        // the whole sync and allows for a custom error message.
+        QNetworkReply *reply = job->reply();
+        if (err == QNetworkReply::OperationCanceledError && reply->property(owncloudCustomSoftErrorStringC).isValid()) {
+            job->setErrorString(reply->property(owncloudCustomSoftErrorStringC).toString());
+            job->setErrorStatus(SyncFileItem::SoftError);
+        }
+
         SyncFileItem::Status status = job->errorStatus();
+
+
         if (status == SyncFileItem::NoStatus) {
             status = classifyError(err, _item._httpErrorCode);
         }
diff --git a/src/libsync/propagatedownload.h b/src/libsync/propagatedownload.h
index ad71f74..47c6070 100644
--- a/src/libsync/propagatedownload.h
+++ b/src/libsync/propagatedownload.h
@@ -78,8 +78,10 @@ public:
     qint64 currentDownloadPosition();
 
     QString errorString() const;
+    void setErrorString(const QString& s) { _errorString = s; }
 
     SyncFileItem::Status errorStatus() { return _errorStatus; }
+    void setErrorStatus(const SyncFileItem::Status & s) { _errorStatus = s; }
 
     virtual void slotTimeout() Q_DECL_OVERRIDE;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list