From cbad4347bd51dd58fb26adb4ef9c0c458840b727 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 3 Aug 2023 15:19:22 +0800 Subject: [PATCH] Extract notifying of existing folder now big to separate static method Signed-off-by: Claudio Cambra --- src/gui/folder.cpp | 16 +++++++++++----- src/gui/folder.h | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index e43bcea06..ea483ce73 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -1288,11 +1288,7 @@ void Folder::slotExistingFolderNowBig(const QString &folderPath) emit newBigFolderDiscovered(trailSlashFolderPath); } - const auto messageInstruction = - stopSyncing ? "Synchronisation of this folder has been disabled." : "Synchronisation of this folder can be disabled in the settings window."; - const auto message = tr("A folder has surpassed the set folder size limit of %1MB: %2.\n%3") - .arg(QString::number(ConfigFile().newBigFolderSizeLimit().second), folderPath, messageInstruction); - Logger::instance()->postGuiLog(Theme::instance()->appNameGUI(), message); + postExistingFolderNowBigNotification(folderPath); auto whitelistActivityLink = ActivityLink(); whitelistActivityLink._label = tr("Keep syncing"); @@ -1327,6 +1323,16 @@ void Folder::slotExistingFolderNowBig(const QString &folderPath) } } +void Folder::postExistingFolderNowBigNotification(const QString &folderPath) +{ + const auto stopSyncing = ConfigFile().stopSyncingExistingFoldersOverLimit(); + const auto messageInstruction = + stopSyncing ? "Synchronisation of this folder has been disabled." : "Synchronisation of this folder can be disabled in the settings window."; + const auto message = tr("A folder has surpassed the set folder size limit of %1MB: %2.\n%3") + .arg(QString::number(ConfigFile().newBigFolderSizeLimit().second), folderPath, messageInstruction); + Logger::instance()->postGuiLog(Theme::instance()->appNameGUI(), message); +} + void Folder::slotLogPropagationStart() { _fileLog->logLap("Propagation starts"); diff --git a/src/gui/folder.h b/src/gui/folder.h index 821f90716..77550e489 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -474,6 +474,8 @@ private: void appendPathToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType); void removePathFromSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType); + static void postExistingFolderNowBigNotification(const QString &folderPath); + AccountStatePtr _accountState; FolderDefinition _definition; QString _canonicalLocalPath; // As returned with QFileInfo:canonicalFilePath. Always ends with "/"