From fbe525108defaa40acc0d89121bd0907b1415db2 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 28 Jun 2023 19:33:22 +0800 Subject: [PATCH] Add slot for existing folders becoming big in Folder Signed-off-by: Claudio Cambra --- src/gui/folder.cpp | 21 +++++++++++++++++++++ src/gui/folder.h | 1 + 2 files changed, 22 insertions(+) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index fc29a11765e9..ee242f840587 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -1182,6 +1182,27 @@ void Folder::slotNewBigFolderDiscovered(const QString &newF, bool isExternal) } } +void Folder::slotExistingFolderNowBig(const QString &folderPath) +{ + const auto trailSlashFolderPath = trailingSlashPath(folderPath); + const auto journal = journalDb(); + + auto undecidedListQueryOk = false; + auto undecidedList = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &undecidedListQueryOk); + if (undecidedListQueryOk) { + if (!undecidedList.contains(trailSlashFolderPath)) { + undecidedList.append(trailSlashFolderPath); + journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList); + emit newBigFolderDiscovered(trailSlashFolderPath); + } + + const auto message = tr("A folder has surpassed the set folder size limit of %1MB: %2.\n" + "Please go into the settings and disable it if you wish to stop synchronising it.") + .arg(QString::number(ConfigFile().newBigFolderSizeLimit().second), folderPath); + Logger::instance()->postOptionalGuiLog(Theme::instance()->appNameGUI(), message); + } +} + void Folder::slotLogPropagationStart() { _fileLog->logLap("Propagation starts"); diff --git a/src/gui/folder.h b/src/gui/folder.h index 9d654baed925..933506e4d9ab 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -402,6 +402,7 @@ private slots: void slotEmitFinishedDelayed(); void slotNewBigFolderDiscovered(const QString &, bool isExternal); + void slotExistingFolderNowBig(const QString &folderPath); void slotLogPropagationStart();