]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Add checkbox to general settings to enabling file removal meaning moving files to...
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 05:50:10 +0000 (13:50 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 20 Jul 2023 16:08:00 +0000 (00:08 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/generalsettings.cpp
src/gui/generalsettings.ui

index b01a742d1f64c025b97f19eacd923bb6f780770a..eb468939629fd89815bced68938dbf8a25a9d18b 100644 (file)
@@ -187,6 +187,7 @@ GeneralSettings::GeneralSettings(QWidget *parent)
     connect(_ui->newFolderLimitCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
     connect(_ui->newFolderLimitSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &GeneralSettings::saveMiscSettings);
     connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
+    connect(_ui->moveFilesToTrashCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
 
 #ifndef WITH_CRASHREPORTER
     _ui->crashreporterCheckBox->setVisible(false);
@@ -246,17 +247,20 @@ void GeneralSettings::loadMiscSettings()
 {
     QScopedValueRollback<bool> scope(_currentlyLoading, true);
     ConfigFile cfgFile;
+
     _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
     _ui->serverNotificationsCheckBox->setChecked(cfgFile.optionalServerNotifications());
     _ui->callNotificationsCheckBox->setEnabled(_ui->serverNotificationsCheckBox->isEnabled());
     _ui->callNotificationsCheckBox->setChecked(cfgFile.showCallNotifications());
     _ui->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane());
     _ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
+    _ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
+    _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
+    _ui->moveFilesToTrashCheckBox->setChecked(cfgFile.moveToTrash());
+
     auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
     _ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
     _ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
-    _ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
-    _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
 }
 
 #if defined(BUILD_UPDATER)
@@ -406,17 +410,20 @@ void GeneralSettings::slotToggleAutoUpdateCheck()
 
 void GeneralSettings::saveMiscSettings()
 {
-    if (_currentlyLoading)
+    if (_currentlyLoading) {
         return;
+    }
+
     ConfigFile cfgFile;
-    bool isChecked = _ui->monoIconsCheckBox->isChecked();
-    cfgFile.setMonoIcons(isChecked);
-    Theme::instance()->setSystrayUseMonoIcons(isChecked);
-    cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());
 
-    cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
-        _ui->newFolderLimitSpinBox->value());
+    const auto monoIconsChecked = _ui->monoIconsCheckBox->isChecked();
+    cfgFile.setMonoIcons(monoIconsChecked);
+    Theme::instance()->setSystrayUseMonoIcons(monoIconsChecked);
+
+    cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());
+    cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(), _ui->newFolderLimitSpinBox->value());
     cfgFile.setConfirmExternalStorage(_ui->newExternalStorage->isChecked());
+    cfgFile.setMoveToTrash(_ui->moveFilesToTrashCheckBox->isChecked());
 }
 
 void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
index 00cbeb14953b256d03774a719156077b6edca6ea..ee82031c911ea9ea2f65b7327a7d1b95767e8465 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>556</width>
-    <height>563</height>
+    <height>613</height>
    </rect>
   </property>
   <property name="windowTitle">
         </item>
        </layout>
       </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QCheckBox" name="moveFilesToTrashCheckBox">
+          <property name="text">
+           <string>Move removed files to trash</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
       <item>
        <layout class="QHBoxLayout" name="horizontalLayout_10">
         <item>