Added two checkboxes in the Account Wizard in the advanced page to change the first options.
Also added a checkbox in the general settings to ask for confirmation for external storages.
Theme options allow to hide the checkboxes in the wizard.
As described in issue #5340
ui->selectiveSyncButtons->setVisible(true);
ui->bigFolderUi->setVisible(false);
} else {
- QString wholeMsg = tr("There are new folders that were not synchronized because they are too big: ") + msg;
- ui->selectiveSyncNotification->setText(wholeMsg);
+ ConfigFile cfg;
+ QString info =
+ !cfg.confirmExternalStorage() ? tr("There are folders that were not synchronized because they are too big: ") :
+ !cfg.newBigFolderSizeLimit().first ? tr("There are folders that were not synchronized because they are external storages: ") :
+ tr("There are folders that were not synchronized because they are too big or external storages: ");
+
+ ui->selectiveSyncNotification->setText(info + msg);
ui->selectiveSyncButtons->setVisible(false);
ui->bigFolderUi->setVisible(true);
shouldBeVisible = true;
setDirtyNetworkLimits();
+ SyncOptions opt;
ConfigFile cfgFile;
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
- quint64 limit = newFolderLimit.first ? newFolderLimit.second * 1000 * 1000 : -1; // convert from MB to B
- _engine->setNewBigFolderSizeLimit(limit);
+ opt._newBigFolderSizeLimit = newFolderLimit.first ? newFolderLimit.second * 1000LL * 1000LL : -1; // convert from MB to B
+ opt._confirmExternalStorage = cfgFile.confirmExternalStorage();
+ _engine->setSyncOptions(opt);
_engine->setIgnoreHiddenFiles(_definition.ignoreHiddenFiles);
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
_ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
_ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
+ _ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
+ _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
}
void GeneralSettings::slotUpdateInfo()
cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
_ui->newFolderLimitSpinBox->value());
+ cfgFile.setConfirmExternalStorage(_ui->newExternalStorage->isChecked());
}
void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
<rect>
<x>0</x>
<y>0</y>
- <width>706</width>
+ <width>785</width>
<height>523</height>
</rect>
</property>
<string>Advanced</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QPushButton" name="ignoredFilesButton">
- <property name="text">
- <string>Edit &Ignored Files</string>
- </property>
- </widget>
- </item>
<item row="0" column="1" colspan="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
</property>
</spacer>
</item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QCheckBox" name="crashreporterCheckBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>S&how crash reporter</string>
+ </property>
+ </widget>
+ </item>
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="newFolderLimitCheckBox">
<property name="text">
- <string>Ask &confirmation before downloading folders larger than</string>
+ <string>Ask for confirmation before synchronizing folders larger than</string>
</property>
<property name="checked">
<bool>true</bool>
<item>
<widget class="QLabel" name="label">
<property name="text">
- <string>MB</string>
+ <string extracomment="Trailing part of "Ask confirmation before syncing folder larger than" ">MB</string>
</property>
</widget>
</item>
</item>
</layout>
</item>
- <item row="2" column="0" colspan="2">
- <widget class="QCheckBox" name="crashreporterCheckBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>S&how crash reporter</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
+ <item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_5">
</item>
</layout>
</item>
+ <item row="0" column="0">
+ <widget class="QPushButton" name="ignoredFilesButton">
+ <property name="text">
+ <string>Edit &Ignored Files</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QCheckBox" name="newExternalStorage">
+ <property name="text">
+ <string>Ask for confirmation before synchronizing external storages</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
_ui.lServerIcon->setPixmap(appIcon.pixmap(48));
_ui.lLocalIcon->setText(QString());
_ui.lLocalIcon->setPixmap(QPixmap(Theme::hidpiFileName(":/client/resources/folder-sync.png")));
+
+ if (theme->wizardHideExternalStorageConfirmationCheckbox()) {
+ _ui.confCheckBoxExternal->hide();
+ }
+ if (theme->wizardHideFolderSizeLimitCheckbox()) {
+ _ui.confCheckBoxSize->hide();
+ _ui.confSpinBox->hide();
+ _ui.confTraillingSizeLabel->hide();
+ }
}
void OwncloudAdvancedSetupPage::setupCustomization()
_selectiveSyncBlacklist = QStringList("/");
QTimer::singleShot(0, this, SLOT(slotSelectiveSyncClicked()));
}
+
+ ConfigFile cfgFile;
+ auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
+ _ui.confCheckBoxSize->setChecked(newFolderLimit.first);
+ _ui.confSpinBox->setValue(newFolderLimit.second);
+ _ui.confCheckBoxExternal->setChecked(cfgFile.confirmExternalStorage());
}
// Called if the user changes the user- or url field. Adjust the texts and
startSpinner();
emit completeChanged();
+ if (_ui.rSyncEverything->isChecked()) {
+ ConfigFile cfgFile;
+ cfgFile.setNewBigFolderSizeLimit(_ui.confCheckBoxSize->isChecked(),
+ _ui.confSpinBox->value());
+ cfgFile.setConfirmExternalStorage(_ui.confCheckBoxExternal->isChecked());
+ }
+
emit createLocalAndRemoteFolders(localFolder(), _remoteFolder);
return false;
} else {
<rect>
<x>0</x>
<y>0</y>
- <width>917</width>
- <height>493</height>
+ <width>1099</width>
+ <height>636</height>
</rect>
</property>
<property name="sizePolicy">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
<item>
<widget class="QRadioButton" name="rSyncEverything">
<property name="text">
</item>
</layout>
</item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="confCheckBoxSize">
+ <property name="text">
+ <string>Ask for confirmation before synchroni&zing folders larger than</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="confSpinBox">
+ <property name="maximum">
+ <number>1000000000</number>
+ </property>
+ <property name="value">
+ <number>500</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="confTraillingSizeLabel">
+ <property name="text">
+ <string extracomment="Trailing part of "Ask confirmation before syncing folder larger than" ">MB</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="confCheckBoxExternal">
+ <property name="text">
+ <string>Ask for confirmation before synchronizing e&xternal storages</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>rSyncEverything</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>confCheckBoxSize</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>217</x>
+ <y>78</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>298</x>
+ <y>126</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>rSyncEverything</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>confSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>311</x>
+ <y>83</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>952</x>
+ <y>134</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>rSyncEverything</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>confTraillingSizeLabel</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>277</x>
+ <y>76</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>1076</x>
+ <y>136</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>rSyncEverything</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>confCheckBoxExternal</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>181</x>
+ <y>78</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>382</x>
+ <y>174</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
static const char newBigFolderSizeLimitC[] = "newBigFolderSizeLimit";
static const char useNewBigFolderSizeLimitC[] = "useNewBigFolderSizeLimit";
+static const char confirmExternalStorageC[] = "confirmExternalStorage";
static const char maxLogLinesC[] = "Logging/maxLogLines";
setValue(useNewBigFolderSizeLimitC, isChecked);
}
+bool ConfigFile::confirmExternalStorage() const
+{
+ return getValue(confirmExternalStorageC, QString(), true).toBool();
+}
+
+void ConfigFile::setConfirmExternalStorage(bool isChecked)
+{
+ setValue(confirmExternalStorageC, isChecked);
+}
+
bool ConfigFile::promptDeleteFiles() const
{
QSettings settings(configFile(), QSettings::IniFormat);
/** [checked, size in MB] **/
QPair<bool, quint64> newBigFolderSizeLimit() const;
void setNewBigFolderSizeLimit(bool isChecked, quint64 mbytes);
+ bool confirmExternalStorage() const;
+ void setConfirmExternalStorage(bool);
static bool setConfDir(const QString &value);
bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *remotePerm)
{
- // If this path or the parent is in the white list, then we do not block this file
- if (findPathInList(_selectiveSyncWhiteList, path)) {
- return false;
- }
- if (Theme::instance()->dontSyncMountedStorageByDefault()) {
- // 'M' in the permission means that it is unselected by default. (issue #5331)
- if (std::strchr(remotePerm, 'M')) {
- emit newBigFolder(path);
- return true;
+ if (_syncOptions._confirmExternalStorage && std::strchr(remotePerm, 'M')) {
+ // 'M' in the permission means external storage.
+
+ // Only allow it if the white list contains exactly this path (not parents)
+ // We want to ask confirmation for external storage even if the parents where selected
+ if (_selectiveSyncWhiteList.contains(path + QLatin1Char('/'))) {
+ return false;
}
+
+ // FIXME! if the parent folder has 'M': return false
+
+ emit newBigFolder(path);
+ return true;
+ }
+
+ // If this path or the parent is in the white list, then we do not block this file
+ if (findPathInList(_selectiveSyncWhiteList, path)) {
+ return false;
}
- if (_newBigFolderSizeLimit < 0) {
+ auto limit = _syncOptions._newBigFolderSizeLimit;
+ if (limit < 0) {
// no limit, everything is allowed;
return false;
}
_vioWaitCondition.wait(&_vioMutex);
}
- auto limit = _newBigFolderSizeLimit;
if (result >= limit) {
// we tell the UI there is a new folder
emit newBigFolder(path);
* if the files are new, or changed.
*/
+struct SyncOptions {
+ /** Maximum size (in Bytes) a folder can have without asking for confirmation.
+ * -1 means infinite */
+ qint64 _newBigFolderSizeLimit = -1;
+ /** If a confirmation should be asked for external storages */
+ bool _confirmExternalStorage = false;
+};
+
+
/**
* @brief The FileStatPointer class
* @ingroup libsync
public:
explicit DiscoveryJob(CSYNC *ctx, QObject* parent = 0)
- : QObject(parent), _csync_ctx(ctx), _newBigFolderSizeLimit(-1) {
+ : QObject(parent), _csync_ctx(ctx) {
// We need to forward the log property as csync uses thread local
// and updates run in another thread
_log_callback = csync_get_log_callback();
QStringList _selectiveSyncBlackList;
QStringList _selectiveSyncWhiteList;
- qint64 _newBigFolderSizeLimit;
+ SyncOptions _syncOptions;
Q_INVOKABLE void start();
signals:
void finished(int result);
, _backInTimeFiles(0)
, _uploadLimit(0)
, _downloadLimit(0)
- , _newBigFolderSizeLimit(-1)
, _checksum_hook(journal)
, _anotherSyncNeeded(NoFollowUpSync)
{
return;
}
- discoveryJob->_newBigFolderSizeLimit = _newBigFolderSizeLimit;
+ discoveryJob->_syncOptions = _syncOptions;
discoveryJob->moveToThread(&_thread);
connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
bool isSyncRunning() const { return _syncRunning; }
- /* Set the maximum size a folder can have without asking for confirmation
- * -1 means infinite
- */
- void setNewBigFolderSizeLimit(qint64 limit) { _newBigFolderSizeLimit = limit; }
+ void setSyncOptions(const SyncOptions &options) { _syncOptions = options; }
bool ignoreHiddenFiles() const { return _csync_ctx->ignore_hidden_files; }
void setIgnoreHiddenFiles(bool ignore) { _csync_ctx->ignore_hidden_files = ignore; }
int _uploadLimit;
int _downloadLimit;
- /* maximum size a folder can have without asking for confirmation: -1 means infinite */
- qint64 _newBigFolderSizeLimit;
+ SyncOptions _syncOptions;
// hash containing the permissions on the remote directory
QHash<QString, QByteArray> _remotePerms;
return 500;
}
+bool Theme::wizardHideExternalStorageConfirmationCheckbox() const
+{
+ return false;
+}
+
+bool Theme::wizardHideFolderSizeLimitCheckbox() const
+{
+ return false;
+}
QString Theme::gitSHA1() const
{
return QLatin1String("/");
}
-bool Theme::dontSyncMountedStorageByDefault() const
-{
- return false;
-}
} // end namespace client
**/
virtual qint64 newBigFolderSizeLimit() const;
+ /**
+ * Hide the checkbox that says "Ask for confirmation before synchronizing folders larger than X MB"
+ * in the account wizard
+ */
+ virtual bool wizardHideFolderSizeLimitCheckbox() const;
+ /**
+ * Hide the checkbox that says "Ask for confirmation before synchronizing external storages"
+ * in the account wizard
+ */
+ virtual bool wizardHideExternalStorageConfirmationCheckbox() const;
+
/**
* Alternative path on the server that provides access to the webdav capabilities
*
*/
virtual QString quotaBaseFolder() const;
- /**
- * By default, mounted storage will not be sync'ed (i.e, they will be disabled in the
- * selective sync
- */
- virtual bool dontSyncMountedStorageByDefault() const;
protected:
#ifndef TOKEN_AUTH_ONLY