Placeholders: Add an checkbox in the FolderWizard to enable the placeholder feature
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 15 Jan 2018 16:30:33 +0000 (17:30 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:57:48 +0000 (10:57 +0100)
src/gui/accountsettings.cpp
src/gui/folderwizard.cpp
src/gui/folderwizard.h

index b2e1b8e475d458e15c6e27e67787a64dfb280b18..5304d3547e8a13699a7c9fa0fc6a927f80f1379a 100644 (file)
@@ -497,6 +497,7 @@ void AccountSettings::slotFolderWizardAccepted()
         folderWizard->field(QLatin1String("sourceFolder")).toString());
     definition.targetPath = FolderDefinition::prepareTargetPath(
         folderWizard->property("targetPath").toString());
+    definition.usePlaceholders = folderWizard->property("usePlaceholders").toBool();
 
     {
         QDir dir(definition.localPath);
index d22cae46205bbb98446f43a9490a98527e58cd6d..8fc46aaade7f50750d08057994e09bb824b2534b 100644 (file)
@@ -36,6 +36,7 @@
 #include <QTreeWidget>
 #include <QVBoxLayout>
 #include <QEvent>
+#include <QCheckBox>
 
 #include <cstdlib>
 
@@ -492,6 +493,8 @@ FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account)
     auto *layout = new QVBoxLayout(this);
     _selectiveSync = new SelectiveSyncWidget(account, this);
     layout->addWidget(_selectiveSync);
+    _placeholderCheckBox = new QCheckBox(tr("Download placeholders instead of downloading the files (Experimental)"));
+    layout->addWidget(_placeholderCheckBox);
 }
 
 FolderWizardSelectiveSync::~FolderWizardSelectiveSync() = default;
@@ -517,6 +520,7 @@ void FolderWizardSelectiveSync::initializePage()
 bool FolderWizardSelectiveSync::validatePage()
 {
     wizard()->setProperty("selectiveSyncBlackList", QVariant(_selectiveSync->createBlackList()));
+    wizard()->setProperty("usePlaceholders", QVariant(_placeholderCheckBox->isChecked()));
     return true;
 }
 
index e3b29d6f7ba0beadea5aeee885842171d9e8fa2a..42cdfce18c90f456203e2bd74b36d1277a0091e3 100644 (file)
@@ -25,6 +25,8 @@
 #include "ui_folderwizardsourcepage.h"
 #include "ui_folderwizardtargetpage.h"
 
+class QCheckBox;
+
 namespace OCC {
 
 class SelectiveSyncWidget;
@@ -130,6 +132,7 @@ public:
 
 private:
     SelectiveSyncWidget *_selectiveSync;
+    QCheckBox *_placeholderCheckBox;
 };
 
 /**