[Pkg-owncloud-commits] [owncloud-client] 25/83: Added method localFileNameClash

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat May 31 11:31:40 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 57359968ede25738d4138787102ef759b8ca2dfe
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Fri May 23 18:54:35 2014 +0200

    Added method localFileNameClash
    
    Also reordered the implementations a bit.
---
 src/mirall/owncloudpropagator.cpp | 59 ++++++++++++++++++++++++++++++---------
 src/mirall/owncloudpropagator.h   |  1 +
 src/mirall/propagatorjobs.h       |  2 +-
 3 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index edb9677..3bcf042 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -21,6 +21,11 @@
 #include "propagator_legacy.h"
 #include "mirall/utility.h"
 
+#ifdef Q_OS_WIN
+#include <windef.h>
+#include <winbase.h>
+#endif
+
 #include <QStack>
 
 namespace Mirall {
@@ -153,6 +158,8 @@ void PropagateItemJob::slotRestoreJobCompleted(const SyncFileItem& item )
     }
 }
 
+// ================================================================================
+
 PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
     switch(item._instruction) {
         case CSYNC_INSTRUCTION_REMOVE:
@@ -281,6 +288,45 @@ bool OwncloudPropagator::useLegacyJobs()
     return env=="true" || env =="1";
 }
 
+int OwncloudPropagator::httpTimeout()
+{
+    static int timeout;
+    if (!timeout) {
+        timeout = qgetenv("OWNCLOUD_TIMEOUT").toUInt();
+        if (timeout == 0) {
+            timeout = 300; // default to 300 secs
+        }
+    }
+    return timeout;
+}
+
+bool OwncloudPropagator::localFileNameClash( const QString& relFile )
+{
+    bool re = false;
+    const QString file( _localDir + relFile );
+    qDebug() << "CaseClashCheck for " << file;
+#ifdef Q_OS_WIN
+    WIN32_FIND_DATA FindFileData;
+    HANDLE hFind;
+
+    hFind = FindFirstFileW( (wchar_t*)file.utf16(), &FindFileData);
+    if (hFind == INVALID_HANDLE_VALUE) {
+        qDebug() << "FindFirstFile failed " << GetLastError();
+        // returns false.
+    } else {
+        QString realFileName = QString::fromWCharArray( FindFileData.cFileName );
+        qDebug() << Q_FUNC_INFO << "Real file name is " << realFileName;
+        FindClose(hFind);
+
+        if( ! file.endsWith(realFileName, Qt::CaseSensitive) ) {
+            re = true;
+        }
+    }
+#endif
+    return re;
+}
+
+// ================================================================================
 
 void PropagateDirectory::start()
 {
@@ -339,17 +385,4 @@ void PropagateDirectory::slotSubJobReady()
     }
 }
 
-int OwncloudPropagator::httpTimeout()
-{
-    static int timeout;
-    if (!timeout) {
-        timeout = qgetenv("OWNCLOUD_TIMEOUT").toUInt();
-        if (timeout == 0) {
-            timeout = 300; // default to 300 secs
-        }
-    }
-    return timeout;
-}
-
-
 }
diff --git a/src/mirall/owncloudpropagator.h b/src/mirall/owncloudpropagator.h
index cda037f..bc95f42 100644
--- a/src/mirall/owncloudpropagator.h
+++ b/src/mirall/owncloudpropagator.h
@@ -211,6 +211,7 @@ public:
     int _activeJobs;
 
     bool isInSharedDirectory(const QString& file);
+    bool localFileNameClash(const QString& relfile);
 
     void abort() {
         _abortRequested.fetchAndStoreOrdered(true);
diff --git a/src/mirall/propagatorjobs.h b/src/mirall/propagatorjobs.h
index c256c05..8a47f2a 100644
--- a/src/mirall/propagatorjobs.h
+++ b/src/mirall/propagatorjobs.h
@@ -81,7 +81,7 @@ class PropagateLocalMkdir : public PropagateItemJob {
 public:
     PropagateLocalMkdir (OwncloudPropagator* propagator,const SyncFileItem& item)  : PropagateItemJob(propagator, item) {}
     void start();
-    bool hasCaseClash( const QString& file );
+
 };
 class PropagateRemoteRemove : public PropagateNeonJob {
     Q_OBJECT

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