Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Müller <fmueller@owncloud.com>2022-03-30 21:54:47 +0300
committerHannah von Reth <vonreth@kde.org>2022-04-12 15:51:18 +0300
commita25f0068e1353f116c8ca251bf608fe2e4e794b1 (patch)
treef813f18abb5f43392315e2007dcccd38c1b3bdeb /src/gui/folderman.cpp
parent44db53318351b061ba2db4c7bf6b30a789b8f8b1 (diff)
Implement advanced sync options in wizard
Diffstat (limited to 'src/gui/folderman.cpp')
-rw-r--r--src/gui/folderman.cpp50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index a15d5b7c3..5226ded79 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -16,12 +16,14 @@
#include "account.h"
#include "accountmanager.h"
#include "accountstate.h"
+#include "application.h"
#include "common/asserts.h"
#include "configfile.h"
#include "filesystem.h"
#include "folder.h"
#include "lockwatcher.h"
#include "ocwizard_deprecated.h"
+#include "selectivesyncdialog.h"
#include "socketapi/socketapi.h"
#include "syncresult.h"
#include "theme.h"
@@ -1567,7 +1569,7 @@ 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)
+void FolderMan::addFolderFromWizard(AccountStatePtr accountStatePtr, const QString &localFolder, const QString &remotePath, const QUrl &webDavUrl, Wizard::SyncMode syncMode)
{
// first things first: we need to create the directory to make the sync engine happy (it will refuse to sync otherwise)
QDir().mkdir(localFolder);
@@ -1578,8 +1580,7 @@ Folder *FolderMan::addFolder(AccountStatePtr accountStatePtr, const QString &loc
folderDefinition.setTargetPath(remotePath);
folderDefinition.ignoreHiddenFiles = ignoreHiddenFiles();
- // TODO: reinstate this functionality
- if (OwncloudWizard::useVirtualFileSync()) {
+ if (syncMode == Wizard::SyncMode::UseVfs) {
folderDefinition.virtualFilesMode = bestAvailableVfsMode();
}
@@ -1588,25 +1589,40 @@ Folder *FolderMan::addFolder(AccountStatePtr accountStatePtr, const QString &loc
folderDefinition.navigationPaneClsid = QUuid::createUuid();
#endif
- auto f = addFolder(accountStatePtr, folderDefinition);
+ auto finalize = [this, accountStatePtr, syncMode, localFolder](const FolderDefinition &folderDefinition, const QStringList &blacklist = {}) {
+ auto f = addFolder(accountStatePtr, folderDefinition);
- if (f) {
- if (folderDefinition.virtualFilesMode != Vfs::Off && OwncloudWizard::useVirtualFileSync())
- f->setRootPinState(PinState::OnlineOnly);
+ if (f) {
+ if (folderDefinition.virtualFilesMode != Vfs::Off && syncMode == Wizard::SyncMode::UseVfs)
+ f->setRootPinState(PinState::OnlineOnly);
+
+ f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blacklist);
- 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("/"));
+ 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!";
}
- qCDebug(lcFolderMan) << "Local sync folder" << localFolder << "successfully created!";
+
+ return f;
+ };
+
+ if (syncMode == Wizard::SyncMode::SelectiveSync) {
+ auto dialog = new SelectiveSyncDialog(accountStatePtr->account(), remotePath, reinterpret_cast<QDialog *>(ocApp()->gui()->settingsDialog()));
+
+ connect(dialog, &SelectiveSyncDialog::finished, this, [finalize, folderDefinition, dialog]() {
+ auto folder = finalize(folderDefinition, dialog->createBlackList());
+ });
+
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->show();
} else {
- qCWarning(lcFolderMan) << "Failed to create local sync folder!";
+ finalize(folderDefinition);
}
-
- return f;
}
} // namespace OCC