[Pkg-owncloud-commits] [owncloud-client] 87/218: Use a themable WebDAV path all over.

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:49 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 16d6418d10f7b1abcc91fb2238fc29e651efbe29
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Feb 18 17:49:07 2015 +0100

    Use a themable WebDAV path all over.
    
    This is needed for enterprise#481
---
 src/cmd/cmd.cpp                      |  6 +++---
 src/gui/socketapi.cpp                |  2 +-
 src/gui/wizard/owncloudsetuppage.cpp | 12 ++++++++----
 src/libsync/account.cpp              |  3 ++-
 src/libsync/account.h                |  2 +-
 src/libsync/discoveryphase.cpp       |  2 +-
 src/libsync/owncloudpropagator.cpp   |  2 +-
 src/libsync/owncloudpropagator.h     |  4 ++--
 src/libsync/theme.cpp                |  4 ++++
 src/libsync/theme.h                  |  8 ++++++++
 10 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp
index 73b93c8..d1683d5 100644
--- a/src/cmd/cmd.cpp
+++ b/src/cmd/cmd.cpp
@@ -185,12 +185,12 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
     }
 
     options->target_url = args.takeLast();
-    // check if the remote.php/webdav tail was added and append if not.
+    // check if the webDAV path was added to the url and append if not.
     if(!options->target_url.endsWith("/")) {
         options->target_url.append("/");
     }
-    if( !options->target_url.contains("remote.php/webdav/")) {
-        options->target_url.append("remote.php/webdav/");
+    if( !options->target_url.contains( Theme::instance()->webDavPath() )) {
+        options->target_url.append(Theme::instance()->webDavPath());
     }
     if (options->target_url.startsWith("http"))
         options->target_url.replace(0, 4, "owncloud");
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index b238764..ba18f2c 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -655,7 +655,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
         if (rec._remotePerm.isNull()) {
             // probably owncloud 6, that does not have permissions flag yet.
             QString url = folder->remoteUrl().toString() + fileName;
-            if (url.contains(QLatin1String("/remote.php/webdav/Shared/"))) {
+            if (url.contains( Theme::instance()->webDavPath() + QLatin1String("Shared/") )) {
                 status.setSharedWithMe(true);
             }
         } else if (rec._remotePerm.contains("S")) {
diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp
index 838ab4b..18e9d78 100644
--- a/src/gui/wizard/owncloudsetuppage.cpp
+++ b/src/gui/wizard/owncloudsetuppage.cpp
@@ -106,11 +106,15 @@ void OwncloudSetupPage::slotUrlChanged(const QString& url)
     if (url.endsWith("index.php")) {
         newUrl.chop(9);
     }
-    if (url.endsWith("remote.php/webdav")) {
-        newUrl.chop(17);
+    QString webDavPath = Theme::instance()->webDavPath();
+    if (url.endsWith(webDavPath)) {
+        newUrl.chop( webDavPath.length() );
     }
-    if (url.endsWith("remote.php/webdav/")) {
-        newUrl.chop(18);
+    if( webDavPath.endsWith(QLatin1Char('/')) ) {
+        webDavPath.chop(1); // cut off the slash
+        if( url.endsWith(webDavPath)) {
+            newUrl.chop(webDavPath.length());
+        }
     }
     if (newUrl != url) {
         _ui.leUrl->setText(newUrl);
diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp
index 1c75a08..0308980 100644
--- a/src/libsync/account.cpp
+++ b/src/libsync/account.cpp
@@ -19,6 +19,7 @@
 #include "creds/abstractcredentials.h"
 #include "../3rdparty/certificates/p12topem.h"
 #include "capabilities.h"
+#include "theme.h"
 
 #include <QSettings>
 #include <QMutex>
@@ -40,7 +41,7 @@ Account::Account(QObject *parent)
     , _am(0)
     , _credentials(0)
     , _treatSslErrorsAsFailure(false)
-    , _davPath("remote.php/webdav/")
+    , _davPath( Theme::instance()->webDavPath() )
     , _wasMigrated(false)
 {
     qRegisterMetaType<AccountPtr>("AccountPtr");
diff --git a/src/libsync/account.h b/src/libsync/account.h
index 4f98aa8..986bf85 100644
--- a/src/libsync/account.h
+++ b/src/libsync/account.h
@@ -193,7 +193,7 @@ private:
     static QString _configFileName;
     QByteArray _pemCertificate; 
     QString _pemPrivateKey;  
-    QString _davPath; // default "remote.php/webdav/";
+    QString _davPath; // defaults to value from theme, might be overwritten in brandings
     bool _wasMigrated;
     friend class AccountManager;
 };
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index dd7b45c..dcf2500 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -300,7 +300,7 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap
         }
 
     } else {
-        // Remove /remote.php/webdav/folder/ from /remote.php/webdav/folder/subfile.txt
+        // Remove <webDAV-Url>/folder/ from <webDAV-Url>/folder/subfile.txt
         file.remove(0, _lsColJob->reply()->request().url().path().length());
         // remove trailing slash
         while (file.endsWith('/')) {
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index c89cdb5..0ba8f4b 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -368,7 +368,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
 bool OwncloudPropagator::isInSharedDirectory(const QString& file)
 {
     bool re = false;
-    if( _remoteDir.contains("remote.php/webdav/Shared") ) {
+    if( _remoteDir.contains( _account->davPath() + QLatin1String("Shared") ) ) {
         // The Shared directory is synced as its own sync connection
         re = true;
     } else {
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index ca22aab..564e7a5 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -249,8 +249,8 @@ public:
     ne_session_s * const _session;
 
     const QString _localDir; // absolute path to the local directory. ends with '/'
-    const QString _remoteDir; // path to the root of the remote. ends with '/'  (include remote.php/webdav)
-    const QString _remoteFolder; // folder. (same as remoteDir but without remote.php/webdav)
+    const QString _remoteDir; // path to the root of the remote. ends with '/'  (include WebDAV path)
+    const QString _remoteFolder; // folder. (same as remoteDir but without the WebDAV path)
 
     SyncJournalDb * const _journal;
     bool _finishedEmited; // used to ensure that finished is only emit once
diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index 737b304..257c05b 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -407,6 +407,10 @@ bool Theme::wizardSelectiveSyncDefaultNothing() const
     return false;
 }
 
+QString Theme::webDavPath() const
+{
+    return QLatin1String("remote.php/webdav/");
+}
 
 } // end namespace client
 
diff --git a/src/libsync/theme.h b/src/libsync/theme.h
index 3836c73..05acf80 100644
--- a/src/libsync/theme.h
+++ b/src/libsync/theme.h
@@ -219,6 +219,14 @@ public:
      **/
     virtual qint64 newBigFolderSizeLimit() const;
 
+    /**
+     * Alternative path on the server that provides access to the webdav capabilities
+     *
+     * Attention: Make sure that this string does NOT have a leading slash and that
+     * it has a trailing slash, for example "remote.php/webdav/".
+     */
+    virtual QString webDavPath() const;
+
 protected:
 #ifndef TOKEN_AUTH_ONLY
     QIcon themeIcon(const QString& name, bool sysTray = false) const;

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