Skip to content

Commit

Permalink
count the files deletion and warn if threshold is exceeded
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>

[skip ci]
  • Loading branch information
mgallien authored and backportbot[bot] committed Sep 30, 2024
1 parent 274669e commit 53a822f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static constexpr char fullLocalDiscoveryIntervalC[] = "fullLocalDiscoveryInterva
static constexpr char notificationRefreshIntervalC[] = "notificationRefreshInterval";
static constexpr char monoIconsC[] = "monoIcons";
static constexpr char promptDeleteC[] = "promptDeleteAllFiles";
static constexpr char deleteFilesThresholdC[] = "deleteFilesThreshold";
static constexpr char crashReporterC[] = "crashReporter";
static constexpr char optionalServerNotificationsC[] = "optionalServerNotifications";
static constexpr char showCallNotificationsC[] = "showCallNotifications";
Expand Down Expand Up @@ -1019,7 +1020,7 @@ bool ConfigFile::showMainDialogAsNormalWindow() const {
bool ConfigFile::promptDeleteFiles() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(promptDeleteC), false).toBool();
return settings.value(QLatin1String(promptDeleteC), true).toBool();
}

void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)
Expand All @@ -1028,6 +1029,18 @@ void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)
settings.setValue(QLatin1String(promptDeleteC), promptDeleteFiles);
}

int ConfigFile::deleteFilesThreshold() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(deleteFilesThresholdC), deleteFilesThresholdDefaultValue).toInt();
}

void ConfigFile::setDeleteFilesThreshold(int thresholdValue)
{
QSettings settings(configFile(), QSettings::IniFormat);
settings.setValue(QLatin1String(deleteFilesThresholdC), thresholdValue);
}

bool ConfigFile::monoIcons() const
{
QSettings settings(configFile(), QSettings::IniFormat);
Expand Down
3 changes: 3 additions & 0 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
[[nodiscard]] bool promptDeleteFiles() const;
void setPromptDeleteFiles(bool promptDeleteFiles);

[[nodiscard]] int deleteFilesThreshold() const;
void setDeleteFilesThreshold(int thresholdValue);

[[nodiscard]] bool crashReporter() const;
void setCrashReporter(bool enabled);

Expand Down

0 comments on commit 53a822f

Please sign in to comment.