Skip to content

Commit

Permalink
Extract notifying of existing folder now big to separate static method
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Aug 3, 2023
1 parent 57690ec commit 5e3488d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ private slots:
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 "/"
Expand Down

0 comments on commit 5e3488d

Please sign in to comment.