Gui: Allow to add multiple sync folder connection of the same folder

... or child folders

There is also no real reason to forbid the user from syncing the same
folder to multiple location on its hardrive.
A real use case is when the user uncheck a big directory using "choose
what to sync", but would still like to sync a folder within this disabled
tree. The user can now do this with the "add folder" feature

Since 2.3, we even support syncing the same local folder to multiple
remote folder, so why not allow syncing the same remote folder several
times?

Relates to issue #3645
This commit is contained in:
Olivier Goffart 2017-09-14 15:09:21 +02:00 committed by Roeland Jago Douma
parent 76d95f8b87
commit faa7fd1b32
No known key found for this signature in database
GPG key ID: F941078878347C0C
4 changed files with 2 additions and 29 deletions

View file

@ -87,8 +87,7 @@ have the following features:
**Log Out**, and **Remove**. **Log Out**, and **Remove**.
* Used and available space on the server. * Used and available space on the server.
* Current synchronization status. * Current synchronization status.
* **Add Folder Sync Connection** button, which is active only when you have * **Add Folder Sync Connection** button.
removed synchronization on an account (see **Remove Sync** below).
The little button with three dots (the overflow menu) that sits to the right of The little button with three dots (the overflow menu) that sits to the right of
the sync status bar offers four additional options: the sync status bar offers four additional options:

View file

@ -80,11 +80,6 @@ Adding a Folder Sync Connection
Adding a new sync is initiated by clicking ``Add Folder Sync Connection`` in Adding a new sync is initiated by clicking ``Add Folder Sync Connection`` in
the ``Account`` settings. the ``Account`` settings.
..note:: To add a folder, you must not already sync a folder that contains this
folder. By default, the wizard sets up the root folder of the ownCloud
server to sync all of your ownCloud account. In consequence, you will
first need to remove this folder prior to specifying new syncs.
.. image:: images/folderwizard_local.png .. image:: images/folderwizard_local.png
:scale: 50 % :scale: 50 %

View file

@ -113,12 +113,6 @@ Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const
ret = Qt::ItemNeverHasChildren; ret = Qt::ItemNeverHasChildren;
if (!_accountState->isConnected()) { if (!_accountState->isConnected()) {
return ret; return ret;
} else if (_folders.count() == 1) {
auto remotePath = _folders.at(0)._folder->remotePath();
// special case when syncing the entire owncloud: disable the add folder button (#3438)
if (remotePath.isEmpty() || remotePath == QLatin1String("/")) {
return ret;
}
} }
return Qt::ItemIsEnabled | ret; return Qt::ItemIsEnabled | ret;
} }
@ -148,15 +142,6 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
if (!_accountState->isConnected()) { if (!_accountState->isConnected()) {
return tr("You need to be connected to add a folder"); return tr("You need to be connected to add a folder");
} }
if (_folders.count() == 1) {
auto remotePath = _folders.at(0)._folder->remotePath();
if (remotePath.isEmpty() || remotePath == QLatin1String("/")) {
// Syncing the entire owncloud: disable the add folder button (#3438)
return tr("Adding folder is disabled because you are already syncing all your files. "
"If you want to sync multiple folders, please remove the currently "
"configured root folder.");
}
}
return tr("Click this button to add a folder to synchronize."); return tr("Click this button to add a folder to synchronize.");
} }
return QVariant(); return QVariant();

View file

@ -445,16 +445,10 @@ bool FolderWizardRemotePath::isComplete() const
} else if (dir.startsWith(curDir + QLatin1Char('/'))) { } else if (dir.startsWith(curDir + QLatin1Char('/'))) {
warnStrings.append(tr("You are already syncing <i>%1</i>, which is a parent folder of <i>%2</i>.").arg(Utility::escape(curDir), Utility::escape(dir))); warnStrings.append(tr("You are already syncing <i>%1</i>, which is a parent folder of <i>%2</i>.").arg(Utility::escape(curDir), Utility::escape(dir)));
} }
if (curDir == QLatin1String("/")) {
warnStrings.append(tr("You are already syncing all your files. Syncing another folder is <b>not</b> supported. "
"If you want to sync multiple folders, please remove the currently configured "
"root folder sync."));
}
} }
showWarn(formatWarnings(warnStrings)); showWarn(formatWarnings(warnStrings));
return warnStrings.isEmpty(); return true;
} }
void FolderWizardRemotePath::cleanupPage() void FolderWizardRemotePath::cleanupPage()