/* hooks for checking the white list (uses the update_callback_userdata) */
int (*checkSelectiveSyncBlackListHook)(void*, const char*);
- int (*checkSelectiveSyncNewFolderHook)(void*, const char*);
+ int (*checkSelectiveSyncNewFolderHook)(void*, const char* /* path */, const char* /* remotePerm */);
csync_vio_opendir_hook remote_opendir_hook;
st->instruction = CSYNC_INSTRUCTION_NEW;
if (fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY && ctx->current == REMOTE_REPLICA && ctx->callbacks.checkSelectiveSyncNewFolderHook) {
- if (ctx->callbacks.checkSelectiveSyncNewFolderHook(ctx->callbacks.update_callback_userdata, path)) {
+ if (ctx->callbacks.checkSelectiveSyncNewFolderHook(ctx->callbacks.update_callback_userdata, path, fs->remotePerm)) {
csync_file_stat_free(st);
return 1;
}
#include <QUrl>
#include "account.h"
#include <QFileInfo>
+#include "theme.h"
+#include <cstring>
+
namespace OCC {
return static_cast<DiscoveryJob*>(data)->isInSelectiveSyncBlackList(path);
}
-bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path)
+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 (_newBigFolderSizeLimit < 0) {
// no limit, everything is allowed;
return false;
}
}
-int DiscoveryJob::checkSelectiveSyncNewFolderCallback(void *data, const char *path)
+int DiscoveryJob::checkSelectiveSyncNewFolderCallback(void *data, const char *path, const char *remotePerm)
{
- return static_cast<DiscoveryJob*>(data)->checkSelectiveSyncNewFolder(QString::fromUtf8(path));
+ return static_cast<DiscoveryJob*>(data)->checkSelectiveSyncNewFolder(QString::fromUtf8(path), remotePerm);
}
*/
bool isInSelectiveSyncBlackList(const char* path) const;
static int isInSelectiveSyncBlackListCallback(void *, const char *);
- bool checkSelectiveSyncNewFolder(const QString &path);
- static int checkSelectiveSyncNewFolderCallback(void*, const char*);
+ bool checkSelectiveSyncNewFolder(const QString &path, const char *remotePerm);
+ static int checkSelectiveSyncNewFolderCallback(void* data, const char* path, const char* remotePerm);
// Just for progress
static void update_job_update_callback (bool local,
{
return QLatin1String("/");
}
+
+bool Theme::dontSyncMountedStorageByDefault() const
+{
+ return false;
+}
+
} // end namespace client
*/
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
QIcon themeIcon(const QString& name, bool sysTray = false, bool sysTrayMenuVisible = false) const;