[Pkg-owncloud-commits] [owncloud-client] 380/498: Confirm feature: Confirm for any folder, not only shared ones

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 0ccaae9a225b80ccbbfed9aa2be46ecb355adeb3
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Mon Jul 27 09:54:20 2015 +0200

    Confirm feature:  Confirm for any folder, not only shared ones
    
    issue #3148
---
 csync/src/csync_private.h      |  2 +-
 csync/src/csync_update.c       | 10 ++++------
 src/gui/folder.cpp             | 10 +++++-----
 src/gui/folder.h               |  4 ++--
 src/gui/folderstatusmodel.cpp  |  2 +-
 src/gui/generalsettings.cpp    |  4 ++--
 src/gui/generalsettings.ui     |  2 +-
 src/libsync/configfile.cpp     | 16 ++++++++--------
 src/libsync/configfile.h       |  4 ++--
 src/libsync/discoveryphase.cpp | 16 ++++++++--------
 src/libsync/discoveryphase.h   | 12 ++++++------
 src/libsync/syncengine.cpp     |  8 ++++----
 src/libsync/syncengine.h       | 12 ++++++------
 13 files changed, 50 insertions(+), 52 deletions(-)

diff --git a/csync/src/csync_private.h b/csync/src/csync_private.h
index 4209bbe..257d037 100644
--- a/csync/src/csync_private.h
+++ b/csync/src/csync_private.h
@@ -92,7 +92,7 @@ struct csync_s {
 
       /* hooks for checking the white list (uses the update_callback_userdata) */
       int (*checkSelectiveSyncBlackListHook)(void*, const char*);
-      int (*checkSelectiveSyncNewShareHook)(void*, const char*);
+      int (*checkSelectiveSyncNewFolderHook)(void*, const char*);
 
 
       csync_vio_opendir_hook remote_opendir_hook;
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index cf73f31..06cc92f 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -401,12 +401,10 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
                 /* file not found in statedb */
                 st->instruction = CSYNC_INSTRUCTION_NEW;
 
-                if (fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY && ctx->current == REMOTE_REPLICA && ctx->callbacks.checkSelectiveSyncNewShareHook) {
-                    if (strchr(fs->remotePerm, 'S') != NULL) { /* check that the directory is shared */
-                        if (ctx->callbacks.checkSelectiveSyncNewShareHook(ctx->callbacks.update_callback_userdata, path)) {
-                            SAFE_FREE(st);
-                            return 1;
-                        }
+                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)) {
+                        SAFE_FREE(st);
+                        return 1;
                     }
                 }
                 goto out;
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 3a4fede..6f7b38e 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -850,14 +850,14 @@ void Folder::startSync(const QStringList &pathList)
     connect(_engine.data(), SIGNAL(transmissionProgress(ProgressInfo)), this, SLOT(slotTransmissionProgress(ProgressInfo)));
     connect(_engine.data(), SIGNAL(jobCompleted(const SyncFileItem &)), this, SLOT(slotJobCompleted(const SyncFileItem &)));
     connect(_engine.data(), SIGNAL(syncItemDiscovered(const SyncFileItem &)), this, SLOT(slotSyncItemDiscovered(const SyncFileItem &)));
-    connect(_engine.data(), SIGNAL(newSharedFolder(QString)), this, SLOT(slotNewSharedBigFolderDiscovered(QString)));
+    connect(_engine.data(), SIGNAL(newBigFolder(QString)), this, SLOT(slotNewBigFolderDiscovered(QString)));
 
     setDirtyNetworkLimits();
 
     ConfigFile cfgFile;
-    auto newFolderLimit = cfgFile.newSharedFolderSizeLimit();
+    auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
     quint64 limit = newFolderLimit.first ? newFolderLimit.second * 1000 * 1000 : -1; // convert from MB to B
-    _engine->setNewSharedFolderSizeLimit(limit);
+    _engine->setNewBigFolderSizeLimit(limit);
 
     QMetaObject::invokeMethod(_engine.data(), "startSync", Qt::QueuedConnection);
 
@@ -1044,7 +1044,7 @@ void Folder::slotSyncItemDiscovered(const SyncFileItem & item)
     emit ProgressDispatcher::instance()->syncItemDiscovered(alias(), item);
 }
 
-void Folder::slotNewSharedBigFolderDiscovered(const QString &newF)
+void Folder::slotNewBigFolderDiscovered(const QString &newF)
 {
     auto newFolder = newF;
     if (!newFolder.endsWith(QLatin1Char('/'))) {
@@ -1065,7 +1065,7 @@ void Folder::slotNewSharedBigFolderDiscovered(const QString &newF)
     if (!undecidedList.contains(newFolder)) {
         undecidedList.append(newFolder);
         journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList);
-        emit newSharedBigFolderDiscovered(newFolder);
+        emit newBigFolderDiscovered(newFolder);
     }
 }
 
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 067960c..cf72f06 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -198,7 +198,7 @@ signals:
     void syncFinished(const SyncResult &result);
     void scheduleToSync(Folder*);
     void progressInfo(const ProgressInfo& progress);
-    void newSharedBigFolderDiscovered(const QString &); // A new folder bigger than the threshold was discovered
+    void newBigFolderDiscovered(const QString &); // A new folder bigger than the threshold was discovered
 
 public slots:
 
@@ -253,7 +253,7 @@ private slots:
     void slotEmitFinishedDelayed();
 
     void watcherSlot(QString);
-    void slotNewSharedBigFolderDiscovered(const QString &);
+    void slotNewBigFolderDiscovered(const QString &);
 
 private:
     bool init();
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index c43bc34..a8c23f2 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -58,7 +58,7 @@ void FolderStatusModel::setAccountState(const AccountState* accountState)
 
         connect(f, SIGNAL(progressInfo(ProgressInfo)), this, SLOT(slotSetProgress(ProgressInfo)), Qt::UniqueConnection);
         connect(f, SIGNAL(syncStateChange()), this, SLOT(slotFolderSyncStateChange()), Qt::UniqueConnection);
-        connect(f, SIGNAL(newSharedBigFolderDiscovered(QString)), this, SIGNAL(dirtyChanged()), Qt::UniqueConnection);
+        connect(f, SIGNAL(newBigFolderDiscovered(QString)), this, SIGNAL(dirtyChanged()), Qt::UniqueConnection);
     }
 
     endResetModel();
diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp
index 4a11065..919a67b 100644
--- a/src/gui/generalsettings.cpp
+++ b/src/gui/generalsettings.cpp
@@ -93,7 +93,7 @@ void GeneralSettings::loadMiscSettings()
     _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
     _ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
     _ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
-    auto newFolderLimit = cfgFile.newSharedFolderSizeLimit();
+    auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
     _ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
     _ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
 }
@@ -120,7 +120,7 @@ void GeneralSettings::saveMiscSettings()
     Theme::instance()->setSystrayUseMonoIcons(isChecked);
     cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());
 
-    cfgFile.setNewSharedFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
+    cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
                                         _ui->newFolderLimitSpinBox->value());
 }
 
diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui
index 1d76d52..3742a22 100644
--- a/src/gui/generalsettings.ui
+++ b/src/gui/generalsettings.ui
@@ -58,7 +58,7 @@
         <item>
          <widget class="QCheckBox" name="newFolderLimitCheckBox">
           <property name="text">
-           <string>Ask confirmation before downloading shared folders larger than</string>
+           <string>Ask confirmation before downloading folders larger than</string>
           </property>
           <property name="checked">
            <bool>true</bool>
diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp
index 1c43e48..207858e 100644
--- a/src/libsync/configfile.cpp
+++ b/src/libsync/configfile.cpp
@@ -63,8 +63,8 @@ static const char useDownloadLimitC[] = "BWLimit/useDownloadLimit";
 static const char uploadLimitC[]      = "BWLimit/uploadLimit";
 static const char downloadLimitC[]    = "BWLimit/downloadLimit";
 
-static const char newSharedFolderSizeLimitC[] = "newSharedFolderSizeLimit";
-static const char useNewSharedFolderSizeLimitC[] = "useNewSharedFolderSizeLimit";
+static const char newBigFolderSizeLimitC[] = "newBigFolderSizeLimit";
+static const char useNewBigFolderSizeLimitC[] = "useNewBigFolderSizeLimit";
 
 static const char maxLogLinesC[] = "Logging/maxLogLines";
 
@@ -571,17 +571,17 @@ void ConfigFile::setDownloadLimit(int kbytes)
     setValue(downloadLimitC, kbytes);
 }
 
-QPair<bool, quint64> ConfigFile::newSharedFolderSizeLimit() const
+QPair<bool, quint64> ConfigFile::newBigFolderSizeLimit() const
 {
-    qint64 value = getValue(newSharedFolderSizeLimitC, QString(), 100).toLongLong();
-    bool use = value >= 0 && getValue(useNewSharedFolderSizeLimitC, QString(), true).toBool();
+    qint64 value = getValue(newBigFolderSizeLimitC, QString(), 100).toLongLong();
+    bool use = value >= 0 && getValue(useNewBigFolderSizeLimitC, QString(), true).toBool();
     return qMakePair(use, quint64(qMax<qint64>(0, value)));
 }
 
-void ConfigFile::setNewSharedFolderSizeLimit(bool isChecked, quint64 mbytes)
+void ConfigFile::setNewBigFolderSizeLimit(bool isChecked, quint64 mbytes)
 {
-    setValue(newSharedFolderSizeLimitC, mbytes);
-    setValue(useNewSharedFolderSizeLimitC, isChecked);
+    setValue(newBigFolderSizeLimitC, mbytes);
+    setValue(useNewBigFolderSizeLimitC, isChecked);
 }
 
 bool ConfigFile::monoIcons() const
diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h
index ba0aa7c..c8c501a 100644
--- a/src/libsync/configfile.h
+++ b/src/libsync/configfile.h
@@ -100,8 +100,8 @@ public:
     void setUploadLimit(int kbytes);
     void setDownloadLimit(int kbytes);
     /** [checked, size in MB] **/
-    QPair<bool, quint64> newSharedFolderSizeLimit() const;
-    void setNewSharedFolderSizeLimit(bool isChecked, quint64 mbytes);
+    QPair<bool, quint64> newBigFolderSizeLimit() const;
+    void setNewBigFolderSizeLimit(bool isChecked, quint64 mbytes);
 
     static bool setConfDir(const QString &value);
 
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index 6024306..e151955 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -62,14 +62,14 @@ int DiscoveryJob::isInSelectiveSyncBlackListCallback(void *data, const char *pat
     return static_cast<DiscoveryJob*>(data)->isInSelectiveSyncBlackList(QString::fromUtf8(path));
 }
 
-bool DiscoveryJob::checkSelectiveSyncNewShare(const QString& path)
+bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path)
 {
     // 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 (_newSharedFolderSizeLimit < 0) {
+    if (_newBigFolderSizeLimit < 0) {
         // no limit, everything is allowed;
         return false;
     }
@@ -83,10 +83,10 @@ bool DiscoveryJob::checkSelectiveSyncNewShare(const QString& path)
         _vioWaitCondition.wait(&_vioMutex);
     }
 
-    auto limit = _newSharedFolderSizeLimit;
+    auto limit = _newBigFolderSizeLimit;
     if (result > limit) {
         // we tell the UI there is a new folder
-        emit newSharedFolder(path);
+        emit newBigFolder(path);
         return true;
     } else {
         // it is not too big, put it in the white list (so we will not do more query for the children)
@@ -100,9 +100,9 @@ bool DiscoveryJob::checkSelectiveSyncNewShare(const QString& path)
     }
 }
 
-int DiscoveryJob::checkSelectiveSyncNewShareCallback(void *data, const char *path)
+int DiscoveryJob::checkSelectiveSyncNewFolderCallback(void *data, const char *path)
 {
-    return static_cast<DiscoveryJob*>(data)->checkSelectiveSyncNewShare(QString::fromUtf8(path));
+    return static_cast<DiscoveryJob*>(data)->checkSelectiveSyncNewFolder(QString::fromUtf8(path));
 }
 
 
@@ -594,7 +594,7 @@ void DiscoveryJob::start() {
     _csync_ctx->callbacks.update_callback_userdata = this;
     _csync_ctx->callbacks.update_callback = update_job_update_callback;
     _csync_ctx->callbacks.checkSelectiveSyncBlackListHook = isInSelectiveSyncBlackListCallback;
-    _csync_ctx->callbacks.checkSelectiveSyncNewShareHook = checkSelectiveSyncNewShareCallback;
+    _csync_ctx->callbacks.checkSelectiveSyncNewFolderHook = checkSelectiveSyncNewFolderCallback;
 
     _csync_ctx->callbacks.remote_opendir_hook = remote_vio_opendir_hook;
     _csync_ctx->callbacks.remote_readdir_hook = remote_vio_readdir_hook;
@@ -607,7 +607,7 @@ void DiscoveryJob::start() {
     _lastUpdateProgressCallbackCall.invalidate();
     int ret = csync_update(_csync_ctx);
 
-    _csync_ctx->callbacks.checkSelectiveSyncNewShareHook = 0;
+    _csync_ctx->callbacks.checkSelectiveSyncNewFolderHook = 0;
     _csync_ctx->callbacks.checkSelectiveSyncBlackListHook = 0;
     _csync_ctx->callbacks.update_callback = 0;
     _csync_ctx->callbacks.update_callback_userdata = 0;
diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h
index bd6d198..1690e92 100644
--- a/src/libsync/discoveryphase.h
+++ b/src/libsync/discoveryphase.h
@@ -161,8 +161,8 @@ class DiscoveryJob : public QObject {
      */
     bool isInSelectiveSyncBlackList(const QString &path) const;
     static int isInSelectiveSyncBlackListCallback(void *, const char *);
-    bool checkSelectiveSyncNewShare(const QString &path);
-    static int checkSelectiveSyncNewShareCallback(void*, const char*);
+    bool checkSelectiveSyncNewFolder(const QString &path);
+    static int checkSelectiveSyncNewFolderCallback(void*, const char*);
 
     // Just for progress
     static void update_job_update_callback (bool local,
@@ -182,7 +182,7 @@ class DiscoveryJob : public QObject {
 
 public:
     explicit DiscoveryJob(CSYNC *ctx, QObject* parent = 0)
-            : QObject(parent), _csync_ctx(ctx), _newSharedFolderSizeLimit(-1) {
+            : QObject(parent), _csync_ctx(ctx), _newBigFolderSizeLimit(-1) {
         // We need to forward the log property as csync uses thread local
         // and updates run in another thread
         _log_callback = csync_get_log_callback();
@@ -192,7 +192,7 @@ public:
 
     QStringList _selectiveSyncBlackList;
     QStringList _selectiveSyncWhiteList;
-    qint64 _newSharedFolderSizeLimit;
+    qint64 _newBigFolderSizeLimit;
     Q_INVOKABLE void start();
 signals:
     void finished(int result);
@@ -202,8 +202,8 @@ signals:
     void doOpendirSignal(QString url, DiscoveryDirectoryResult*);
     void doGetSizeSignal(const QString &path, qint64 *result);
 
-    // A new shared folder was discovered and was not synced because of the confirmation feature
-    void newSharedFolder(const QString &folder);
+    // A new folder was discovered and was not synced because of the confirmation feature
+    void newBigFolder(const QString &folder);
 };
 
 }
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 2db1530..131b0ae 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -70,7 +70,7 @@ SyncEngine::SyncEngine(AccountPtr account, CSYNC *ctx, const QString& localPath,
   , _hasRemoveFile(false)
   , _uploadLimit(0)
   , _downloadLimit(0)
-  , _newSharedFolderSizeLimit(-1)
+  , _newBigFolderSizeLimit(-1)
   , _anotherSyncNeeded(false)
 {
     qRegisterMetaType<SyncFileItem>("SyncFileItem");
@@ -657,14 +657,14 @@ void SyncEngine::startSync()
     discoveryJob->_selectiveSyncBlackList = selectiveSyncBlackList;
     discoveryJob->_selectiveSyncWhiteList =
         _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList);
-    discoveryJob->_newSharedFolderSizeLimit = _newSharedFolderSizeLimit;
+    discoveryJob->_newBigFolderSizeLimit = _newBigFolderSizeLimit;
     discoveryJob->moveToThread(&_thread);
     connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
     connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
             this, SIGNAL(folderDiscovered(bool,QString)));
 
-    connect(discoveryJob, SIGNAL(newSharedFolder(QString)),
-            this, SIGNAL(newSharedFolder(QString)));
+    connect(discoveryJob, SIGNAL(newBigFolder(QString)),
+            this, SIGNAL(newBigFolder(QString)));
 
 
     // This is used for the DiscoveryJob to be able to request the main thread/
diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h
index 3f346d7..8668eef 100644
--- a/src/libsync/syncengine.h
+++ b/src/libsync/syncengine.h
@@ -66,10 +66,10 @@ public:
     /* Abort the sync.  Called from the main thread */
     void abort();
 
-    /* Set the maximum size a shared folder can have without asking for confirmation
+    /* Set the maximum size a folder can have without asking for confirmation
      * -1 means infinite
      */
-    void setNewSharedFolderSizeLimit(qint64 limit) { _newSharedFolderSizeLimit = limit; }
+    void setNewBigFolderSizeLimit(qint64 limit) { _newBigFolderSizeLimit = limit; }
 
     Utility::StopWatch &stopWatch() { return _stopWatch; }
 
@@ -116,8 +116,8 @@ signals:
 
     void aboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel);
 
-    // A new shared folder was discovered and was not synced because of the confirmation feature
-    void newSharedFolder(const QString &folder);
+    // A new folder was discovered and was not synced because of the confirmation feature
+    void newBigFolder(const QString &folder);
 
 private slots:
     void slotRootEtagReceived(QString);
@@ -206,8 +206,8 @@ private:
 
     int _uploadLimit;
     int _downloadLimit;
-    /* maximum size a shared folder can have without asking for confirmation: -1 means infinite */
-    qint64 _newSharedFolderSizeLimit;
+    /* maximum size a folder can have without asking for confirmation: -1 means infinite */
+    qint64 _newBigFolderSizeLimit;
 
     // hash containing the permissions on the remote directory
     QHash<QString, QByteArray> _remotePerms;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list