]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Add UI element in general settings to stop syncing existing folders that have now...
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 24 Jul 2023 07:50:03 +0000 (15:50 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:44:21 +0000 (17:44 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/generalsettings.cpp
src/gui/generalsettings.ui

index 82931e5fc708ded6431890855296d7895e0a6774..394d13c0d9772823c7bff2df53ba304dd1b7666a 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->existingFolderLimitCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
+    connect(_ui->stopExistingFolderNowBigSyncCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
     connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
     connect(_ui->moveFilesToTrashCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
 
@@ -262,8 +263,10 @@ void GeneralSettings::loadMiscSettings()
     auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
     _ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
     _ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
-    _ui->existingFolderLimitCheckBox->setEnabled(newFolderLimit.first);
-    _ui->existingFolderLimitCheckBox->setChecked(newFolderLimit.first && cfgFile.notifyExistingFoldersOverLimit());
+    _ui->existingFolderLimitCheckBox->setEnabled(_ui->newFolderLimitCheckBox->isChecked());
+    _ui->existingFolderLimitCheckBox->setChecked(_ui->newFolderLimitCheckBox->isChecked() && cfgFile.notifyExistingFoldersOverLimit());
+    _ui->stopExistingFolderNowBigSyncCheckBox->setEnabled(_ui->existingFolderLimitCheckBox->isChecked());
+    _ui->stopExistingFolderNowBigSyncCheckBox->setChecked(_ui->existingFolderLimitCheckBox->isChecked() && cfgFile.stopSyncingExistingFoldersOverLimit());
     _ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
     _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
 }
@@ -433,6 +436,8 @@ void GeneralSettings::saveMiscSettings()
 
     const auto useMonoIcons = _ui->monoIconsCheckBox->isChecked();
     const auto newFolderLimitEnabled = _ui->newFolderLimitCheckBox->isChecked();
+    const auto existingFolderLimitEnabled = newFolderLimitEnabled && _ui->existingFolderLimitCheckBox->isChecked();
+    const auto stopSyncingExistingFoldersOverLimit = existingFolderLimitEnabled && _ui->stopExistingFolderNowBigSyncCheckBox->isChecked();
     Theme::instance()->setSystrayUseMonoIcons(useMonoIcons);
 
     cfgFile.setMonoIcons(useMonoIcons);
@@ -440,9 +445,11 @@ void GeneralSettings::saveMiscSettings()
     cfgFile.setMoveToTrash(_ui->moveFilesToTrashCheckBox->isChecked());
     cfgFile.setNewBigFolderSizeLimit(newFolderLimitEnabled, _ui->newFolderLimitSpinBox->value());
     cfgFile.setConfirmExternalStorage(_ui->newExternalStorage->isChecked());
-    cfgFile.setNotifyExistingFoldersOverLimit(_ui->existingFolderLimitCheckBox->isChecked());
+    cfgFile.setNotifyExistingFoldersOverLimit(existingFolderLimitEnabled);
+    cfgFile.setStopSyncingExistingFoldersOverLimit(stopSyncingExistingFoldersOverLimit);
 
     _ui->existingFolderLimitCheckBox->setEnabled(newFolderLimitEnabled);
+    _ui->stopExistingFolderNowBigSyncCheckBox->setEnabled(existingFolderLimitEnabled);
 }
 
 void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
index ee037123133cae8ed4faf93e84c76cc51aada9fe..dad84c66c7ea3568e814192c49524c9cbcec9039 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>556</width>
-    <height>613</height>
+    <width>581</width>
+    <height>663</height>
    </rect>
   </property>
   <property name="windowTitle">
      <layout class="QVBoxLayout" name="verticalLayout">
       <item>
        <layout class="QVBoxLayout" name="verticalLayout_4">
+        <property name="spacing">
+         <number>0</number>
+        </property>
         <item>
          <layout class="QHBoxLayout" name="horizontalLayout_3">
           <item>
            </widget>
           </item>
           <item>
-           <spacer name="horizontalSpacer">
+           <widget class="QLabel" name="label">
+            <property name="text">
+             <string extracomment="Trailing part of &quot;Ask confirmation before syncing folder larger than&quot; ">MB</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_5">
+          <item>
+           <spacer name="horizontalSpacer_3">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
             </property>
+            <property name="sizeType">
+             <enum>QSizePolicy::Fixed</enum>
+            </property>
             <property name="sizeHint" stdset="0">
              <size>
-              <width>40</width>
+              <width>20</width>
               <height>20</height>
              </size>
             </property>
            </spacer>
           </item>
           <item>
-           <widget class="QLabel" name="label">
+           <widget class="QCheckBox" name="existingFolderLimitCheckBox">
             <property name="text">
-             <string extracomment="Trailing part of &quot;Ask confirmation before syncing folder larger than&quot; ">MB</string>
+             <string>Notify when synchronised folders grow larger than specified limit</string>
             </property>
            </widget>
           </item>
          </layout>
         </item>
         <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_5">
+         <layout class="QHBoxLayout" name="horizontalLayout">
           <item>
-           <spacer name="horizontalSpacer_3">
+           <spacer name="horizontalSpacer_5">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
             </property>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
-              <width>20</width>
+              <width>40</width>
               <height>20</height>
              </size>
             </property>
            </spacer>
           </item>
           <item>
-           <widget class="QCheckBox" name="existingFolderLimitCheckBox">
+           <widget class="QCheckBox" name="stopExistingFolderNowBigSyncCheckBox">
             <property name="text">
-             <string>Notify when synchronised folders grow larger than specified limit</string>
+             <string>Automatically disable synchronisation of folders that overcome limit</string>
             </property>
            </widget>
           </item>