[Pkg-owncloud-commits] [owncloud-client] 65/498: Windows Explorer: fix issues when syncing whole drive.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:35 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 018cc54a945dd78af84a1466e45a2660dc15550d
Author: Christian Burger <christian at krikkel.de>
Date:   Sun May 3 12:34:23 2015 +0100

    Windows Explorer: fix issues when syncing whole drive.
    
    When the local sync target is just a drive letter (e.g. "X:\"), neither
    the display of the sync status via file icon overlay, nor the creation of a
    share link works. In the latter case no pop-up comes up and no server
    request is done.
    
    QDir::cleanPath() usually removes trailing slashes, but not if the path to
    be cleaned is just "X:\". In that case the trailing slash is kept. This
    commit accounts for that exception.
---
 src/gui/folder.cpp    | 14 ++++++++++++--
 src/gui/folder.h      |  5 +++++
 src/gui/folderman.cpp |  2 +-
 src/gui/socketapi.cpp |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index e326210..eec14d1 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -180,12 +180,22 @@ QString Folder::alias() const
 QString Folder::path() const
 {
     QString p(_path);
-    if( ! p.endsWith(QLatin1Char('/')) ) {
-        p.append(QLatin1Char('/'));
+    if( ! p.endsWith(QDir::separator()) ) {
+        p.append(QDir::separator());
     }
     return p;
 }
 
+QString Folder::cleanPath(QString path)
+{
+    QString cleanedPath = QDir::cleanPath(path);
+
+    if(cleanedPath.length() == 3 && cleanedPath.endsWith(":/"))
+        return cleanedPath.left(2);
+
+    return cleanedPath;
+}
+
 bool Folder::isBusy() const
 {
     return !_engine.isNull();
diff --git a/src/gui/folder.h b/src/gui/folder.h
index ae29973..ee4be55 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -72,6 +72,11 @@ public:
     QString path() const;
 
     /**
+     * wrapper for QDir::cleanPath("Z:\\"), which returns "Z:\\", but we need "Z:" instead
+     */
+    static QString cleanPath(QString path);
+
+    /**
      * remote folder path
      */
     QString remotePath() const;
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 5658424..80ae201 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -736,7 +736,7 @@ Folder *FolderMan::folderForPath(const QString &path)
     QString absolutePath = QDir::cleanPath(path)+QLatin1Char('/');
 
     foreach(Folder* folder, this->map().values()) {
-        const QString folderPath = QDir::cleanPath(folder->path())+QLatin1Char('/');
+        const QString folderPath = Folder::cleanPath(folder->path())+QLatin1Char('/');
 
         if(absolutePath.startsWith(folderPath)) {
             //qDebug() << "found folder: " << folder->path() << " for " << absolutePath;
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index af6edba..9a71b2d 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -402,7 +402,7 @@ void SocketApi::command_RETRIEVE_FILE_STATUS(const QString& argument, QLocalSock
         DEBUG << "folder offline or not watched:" << argument;
         statusString = QLatin1String("NOP");
     } else {
-        const QString file = QDir::cleanPath(argument).mid(QDir::cleanPath(syncFolder->path()).length()+1);
+        const QString file = QDir::cleanPath(argument).mid(Folder::cleanPath(syncFolder->path()).length()+1);
         SyncFileStatus fileStatus = this->fileStatus(syncFolder, file, _excludes);
 
         statusString = fileStatus.toSocketAPIString();

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