From cf7726353a98fc2a9751ed8c0e231e3aec142897 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 10 Sep 2015 15:39:37 +0200 Subject: [PATCH] Always use the webdav path from the Account object. The Account object has the themed webdav path if it is branded. --- src/cmd/cmd.cpp | 27 ++++++++++++++++----------- src/gui/socketapi.cpp | 3 ++- src/gui/wizard/owncloudsetuppage.cpp | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index d1683d55f..37fbcabde 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -185,15 +185,7 @@ void parseOptions( const QStringList& app_args, CmdOptions *options ) } options->target_url = args.takeLast(); - // 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( Theme::instance()->webDavPath() )) { - options->target_url.append(Theme::instance()->webDavPath()); - } - if (options->target_url.startsWith("http")) - options->target_url.replace(0, 4, "owncloud"); + options->source_dir = args.takeLast(); if (!options->source_dir.endsWith('/')) { options->source_dir.append('/'); @@ -280,6 +272,21 @@ int main(int argc, char **argv) { parseOptions( app.arguments(), &options ); + AccountPtr account = Account::create(); + + if( !account ) { + qFatal("Could not initialize account!"); + return EXIT_FAILURE; + } + // 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( account->davPath() )) { + options.target_url.append(account->davPath()); + } + if (options.target_url.startsWith("http")) + options.target_url.replace(0, 4, "owncloud"); QUrl url = QUrl::fromUserInput(options.target_url); // Order of retrieval attempt (later attempts override earlier ones): @@ -331,8 +338,6 @@ int main(int argc, char **argv) { // take the unmodified url to pass to csync_create() QByteArray remUrl = options.target_url.toUtf8(); - AccountPtr account = Account::create(); - // Find the folder and the original owncloud url QStringList splitted = url.path().split(account->davPath()); url.setPath(splitted.value(0)); diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index ba18f2cbf..1db9696c8 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -26,6 +26,7 @@ #include "syncfileitem.h" #include "filesystem.h" #include "version.h" +#include "account.h" #include "accountstate.h" #include @@ -655,7 +656,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( Theme::instance()->webDavPath() + QLatin1String("Shared/") )) { + if (url.contains( folder->accountState()->account()->davPath() + 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 18e9d78a3..616caa007 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -106,7 +106,7 @@ void OwncloudSetupPage::slotUrlChanged(const QString& url) if (url.endsWith("index.php")) { newUrl.chop(9); } - QString webDavPath = Theme::instance()->webDavPath(); + QString webDavPath = _ocWizard->account()->davPath(); if (url.endsWith(webDavPath)) { newUrl.chop( webDavPath.length() ); } -- 2.30.2