mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 20:28:57 +03:00
Move active folder size limit check to independent convenience method
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
17de46cec2
commit
e5f399ff51
2 changed files with 13 additions and 4 deletions
|
@ -82,11 +82,15 @@ bool DiscoveryPhase::isInSelectiveSyncBlackList(const QString &path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool DiscoveryPhase::activeFolderSizeLimit() const
|
||||
{
|
||||
return _syncOptions._newBigFolderSizeLimit > 0 && _syncOptions._vfs->mode() == Vfs::Off;
|
||||
}
|
||||
|
||||
void DiscoveryPhase::checkFolderSizeLimit(const QString &path,
|
||||
const std::function<void(bool)> callback)
|
||||
{
|
||||
const auto limit = _syncOptions._newBigFolderSizeLimit;
|
||||
if (limit < 0 || _syncOptions._vfs->mode() != Vfs::Off) {
|
||||
if (activeFolderSizeLimit()) {
|
||||
// no limit, everything is allowed;
|
||||
return callback(false);
|
||||
}
|
||||
|
@ -98,8 +102,11 @@ void DiscoveryPhase::checkFolderSizeLimit(const QString &path,
|
|||
|
||||
connect(propfindJob, &PropfindJob::finishedWithError, this, [=] { return callback(false); });
|
||||
connect(propfindJob, &PropfindJob::result, this, [=](const QVariantMap &values) {
|
||||
auto result = values.value(QLatin1String("size")).toLongLong();
|
||||
if (result >= limit) {
|
||||
|
||||
if (const auto result = values.value(QLatin1String("size")).toLongLong(),
|
||||
limit = _syncOptions._newBigFolderSizeLimit;
|
||||
result >= limit) {
|
||||
|
||||
// we tell the UI there is a new folder
|
||||
emit newBigFolder(path, false);
|
||||
return callback(true);
|
||||
|
|
|
@ -255,6 +255,8 @@ class DiscoveryPhase : public QObject
|
|||
|
||||
[[nodiscard]] bool isInSelectiveSyncBlackList(const QString &path) const;
|
||||
|
||||
[[nodiscard]] bool activeFolderSizeLimit() const;
|
||||
|
||||
void checkFolderSizeLimit(const QString &path,
|
||||
const std::function<void(bool)> callback);
|
||||
|
||||
|
|
Loading…
Reference in a new issue