Extract notifying of existing folder now big to separate static method
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 3 Aug 2023 07:19:22 +0000 (15:19 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:44:22 +0000 (17:44 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/folder.cpp
src/gui/folder.h

index e43bcea068c7da3739add4ce165b6ac87a7352fa..ea483ce73fe8c24a8651bd056698dbd50c1f3db4 100644 (file)
@@ -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");
index 821f90716b8d6d48ca057efdc9c00ad048fb14d3..77550e48903dfdb667abcabd6d6e3a291b8d33fc 100644 (file)
@@ -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 "/"