[Pkg-owncloud-commits] [owncloud-client] 87/333: Make the parrallel uploaded also check for problem in Shared

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:37 UTC 2014


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 96c535d7129e22fd150f56b1ec678ee8d80804c7
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Feb 27 12:02:22 2014 +0100

    Make the parrallel uploaded also check for problem in Shared
---
 src/mirall/owncloudpropagator.cpp |  5 +----
 src/mirall/owncloudpropagator.h   |  2 +-
 src/mirall/propagator_legacy.cpp  |  5 +++--
 src/mirall/propagator_qnam.cpp    |  7 +++++++
 src/mirall/propagatorjobs.cpp     | 10 ++++++++--
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index f5f1281..9669c09 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -78,11 +78,8 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
  *
  * Return true if the problem is handled.
  */
-bool PropagateItemJob::checkForProblemsWithShared(const QString& msg)
+bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QString& msg)
 {
-    QString errorString = QString::fromUtf8(ne_get_error(_propagator->_session));
-    int httpStatusCode = errorString.mid(0, errorString.indexOf(QChar(' '))).toInt();
-
     PropagateItemJob *newJob = NULL;
 
     if( httpStatusCode == 403 && _propagator->isInSharedDirectory(_item._file )) {
diff --git a/src/mirall/owncloudpropagator.h b/src/mirall/owncloudpropagator.h
index d9216c7..b80d806 100644
--- a/src/mirall/owncloudpropagator.h
+++ b/src/mirall/owncloudpropagator.h
@@ -135,7 +135,7 @@ class PropagateItemJob : public PropagatorJob {
 protected:
     void done(SyncFileItem::Status status, const QString &errorString = QString());
 
-    bool checkForProblemsWithShared(const QString& msg);
+    bool checkForProblemsWithShared(int httpStatusCode, const QString& msg);
 
     /*
      * set a custom restore job message that is used if the restore job succeeded.
diff --git a/src/mirall/propagator_legacy.cpp b/src/mirall/propagator_legacy.cpp
index 551408a..05ea4ea 100644
--- a/src/mirall/propagator_legacy.cpp
+++ b/src/mirall/propagator_legacy.cpp
@@ -153,8 +153,9 @@ void PropagateUploadFileLegacy::start()
             } else {
                 // Other HBF error conditions.
                 _item._httpErrorCode = hbf_fail_http_code(trans.data());
-                if(checkForProblemsWithShared(tr("The file was edited locally but is part of a read only share. "
-                                                 "It is restored and your edit is in the conflict file.")))
+                if(checkForProblemsWithShared(_item._httpErrorCode,
+                        tr("The file was edited locally but is part of a read only share. "
+                           "It is restored and your edit is in the conflict file.")))
                     return;
 
                 done(SyncFileItem::NormalError, hbf_error_string(trans.data(), state));
diff --git a/src/mirall/propagator_qnam.cpp b/src/mirall/propagator_qnam.cpp
index 7d0ce0e..9b0c5c3 100644
--- a/src/mirall/propagator_qnam.cpp
+++ b/src/mirall/propagator_qnam.cpp
@@ -184,6 +184,13 @@ void PropagateUploadFileQNAM::slotPutFinished()
 //                 _item._httpErrorCode = hbf_fail_http_code(trans.data());
         _item._httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
         _propagator->_activeJobs--;
+
+        if(checkForProblemsWithShared(_item._httpErrorCode,
+            tr("The file was edited locally but is part of a read only share. "
+               "It is restored and your edit is in the conflict file."))) {
+            return;
+        }
+
         done(SyncFileItem::NormalError, job->reply()->errorString());
         return;
     }
diff --git a/src/mirall/propagatorjobs.cpp b/src/mirall/propagatorjobs.cpp
index 2102505..1376a2e 100644
--- a/src/mirall/propagatorjobs.cpp
+++ b/src/mirall/propagatorjobs.cpp
@@ -124,7 +124,10 @@ void PropagateRemoteRemove::start()
     qDebug() << "** DELETE " << uri.data();
     int rc = ne_delete(_propagator->_session, uri.data());
 
-    if( checkForProblemsWithShared(tr("The file has been removed from a read only share. It was restored.")) ) {
+    QString errorString = QString::fromUtf8(ne_get_error(_propagator->_session));
+    int httpStatusCode = errorString.mid(0, errorString.indexOf(QChar(' '))).toInt();
+    if( checkForProblemsWithShared(httpStatusCode,
+            tr("The file has been removed from a read only share. It was restored.")) ) {
         return;
     }
 
@@ -223,7 +226,10 @@ void PropagateRemoteRename::start()
 
         int rc = ne_move(_propagator->_session, 1, uri1.data(), uri2.data());
 
-        if( checkForProblemsWithShared(tr("The file was renamed but is part of a read only share. The original file was restored."))) {
+        QString errorString = QString::fromUtf8(ne_get_error(_propagator->_session));
+        int httpStatusCode = errorString.mid(0, errorString.indexOf(QChar(' '))).toInt();
+        if( checkForProblemsWithShared(httpStatusCode,
+                tr("The file was renamed but is part of a read only share. The original file was restored."))) {
             return;
         }
 

-- 
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