mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
SyncEngine: add an api to set the maximum size of new shared folder that do not require confirmation
This commit is contained in:
parent
7bb2834d8b
commit
a621223cc8
4 changed files with 15 additions and 1 deletions
|
@ -69,6 +69,11 @@ bool DiscoveryJob::checkSelectiveSyncNewShare(const QString& path)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (_newSharedFolderSizeLimit < 0) {
|
||||
// no limit, everything is allowed;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Go in the main thread to do a PROPFIND to know the size of this directory
|
||||
qint64 result = -1;
|
||||
|
||||
|
@ -78,7 +83,7 @@ bool DiscoveryJob::checkSelectiveSyncNewShare(const QString& path)
|
|||
_vioWaitCondition.wait(&_vioMutex);
|
||||
}
|
||||
|
||||
auto limit = 100*1000*1000L; // 100 MB; (FIXME, make it cnfigurable)
|
||||
auto limit = _newSharedFolderSizeLimit;
|
||||
if (true || result > limit) {
|
||||
// we tell the UI there is a new folder
|
||||
emit newSharedFolder(path);
|
||||
|
|
|
@ -178,6 +178,7 @@ public:
|
|||
|
||||
QStringList _selectiveSyncBlackList;
|
||||
QStringList _selectiveSyncWhiteList;
|
||||
qint64 _newSharedFolderSizeLimit = 0;
|
||||
Q_INVOKABLE void start();
|
||||
signals:
|
||||
void finished(int result);
|
||||
|
|
|
@ -640,6 +640,7 @@ void SyncEngine::startSync()
|
|||
discoveryJob->_selectiveSyncBlackList = selectiveSyncBlackList;
|
||||
discoveryJob->_selectiveSyncWhiteList =
|
||||
_journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList);
|
||||
discoveryJob->_newSharedFolderSizeLimit = _newSharedFolderSizeLimit;
|
||||
discoveryJob->moveToThread(&_thread);
|
||||
connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
|
||||
connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
|
||||
|
|
|
@ -62,6 +62,11 @@ public:
|
|||
/* Abort the sync. Called from the main thread */
|
||||
void abort();
|
||||
|
||||
/* Set the maximum size a shared folder can have without asking for confirmation
|
||||
* -1 means infinite
|
||||
*/
|
||||
void setNewSharedFolderSizeLimit(qint64 limit) { _newSharedFolderSizeLimit = limit; }
|
||||
|
||||
Utility::StopWatch &stopWatch() { return _stopWatch; }
|
||||
|
||||
/* Return true if we detected that another sync is needed to complete the sync */
|
||||
|
@ -197,6 +202,8 @@ private:
|
|||
|
||||
int _uploadLimit;
|
||||
int _downloadLimit;
|
||||
/* maximum size a shared folder can have without asking for confirmation: -1 means infinite */
|
||||
qint64 _newSharedFolderSizeLimit = -1;
|
||||
|
||||
// hash containing the permissions on the remote directory
|
||||
QHash<QString, QByteArray> _remotePerms;
|
||||
|
|
Loading…
Reference in a new issue