diff options
author | Fabian Müller <fmueller@owncloud.com> | 2022-03-22 17:06:35 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2022-03-24 13:32:50 +0300 |
commit | b22989d75109e6e1282bc42b70968ef3dee6f750 (patch) | |
tree | 6edbce4cb2d4e4837f094566c4f903559e67e398 /src/gui/folderman.cpp | |
parent | cf93da2e4de381ca9470fd3a2fb0db330129c7b2 (diff) |
Rewrite wizard from scratch
Diffstat (limited to 'src/gui/folderman.cpp')
-rw-r--r-- | src/gui/folderman.cpp | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index e68dc1cbe..df643627e 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -13,17 +13,18 @@ */ #include "folderman.h" -#include "configfile.h" -#include "folder.h" -#include "syncresult.h" -#include "theme.h" -#include "socketapi/socketapi.h" #include "account.h" -#include "accountstate.h" #include "accountmanager.h" +#include "accountstate.h" +#include "common/asserts.h" +#include "configfile.h" #include "filesystem.h" +#include "folder.h" #include "lockwatcher.h" -#include "common/asserts.h" +#include "ocwizard_deprecated.h" +#include "socketapi/socketapi.h" +#include "syncresult.h" +#include "theme.h" #include <syncengine.h> #ifdef Q_OS_MAC @@ -1568,4 +1569,46 @@ bool FolderMan::checkVfsAvailability(const QString &path, Vfs::Mode mode) const return unsupportedConfiguration(path) && Vfs::checkAvailability(path, mode); } +Folder *FolderMan::addFolder(AccountStatePtr accountStatePtr, const QString &localFolder, const QString &remotePath, const QUrl &webDavUrl) +{ + // first things first: we need to create the directory to make the sync engine happy (it will refuse to sync otherwise) + QDir().mkdir(localFolder); + + qCInfo(lcFolderMan) << "Adding folder definition for" << localFolder << remotePath; + FolderDefinition folderDefinition(webDavUrl); + folderDefinition.setLocalPath(localFolder); + folderDefinition.setTargetPath(remotePath); + folderDefinition.ignoreHiddenFiles = ignoreHiddenFiles(); + + // TODO: reinstate this functionality + if (OwncloudWizard::useVirtualFileSync()) { + folderDefinition.virtualFilesMode = bestAvailableVfsMode(); + } + +#ifdef Q_OS_WIN + if (_navigationPaneHelper.showInExplorerNavigationPane()) + folderDefinition.navigationPaneClsid = QUuid::createUuid(); +#endif + + auto f = addFolder(accountStatePtr, folderDefinition); + + if (f) { + if (folderDefinition.virtualFilesMode != Vfs::Off && OwncloudWizard::useVirtualFileSync()) + f->setRootPinState(PinState::OnlineOnly); + + f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, + OwncloudWizard::selectiveSyncBlacklist()); + if (!OwncloudWizard::isConfirmBigFolderChecked()) { + // The user already accepted the selective sync dialog. everything is in the white list + f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, + QStringList() << QLatin1String("/")); + } + qCDebug(lcFolderMan) << "Local sync folder" << localFolder << "successfully created!"; + } else { + qCWarning(lcFolderMan) << "Failed to create local sync folder!"; + } + + return f; +} + } // namespace OCC |