mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 19:58:56 +03:00
Selective sync: if one click twice on the button in the wizard, it should keep the blacklist
This commit is contained in:
parent
858218ac34
commit
e5068e7543
3 changed files with 23 additions and 14 deletions
|
@ -246,13 +246,27 @@ QStringList SelectiveSyncTreeView::createBlackList(QTreeWidgetItem* root) const
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SelectiveSyncDialog::SelectiveSyncDialog(Account * account, Folder* folder, QWidget* parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f), _folder(folder)
|
||||
{
|
||||
init(account);
|
||||
_treeView->setFolderInfo(_folder->remotePath(), _folder->alias(), _folder->selectiveSyncBlackList());
|
||||
|
||||
// Make sure we don't get crashes if the folder is destroyed while we are still open
|
||||
connect(_folder, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()));
|
||||
}
|
||||
|
||||
SelectiveSyncDialog::SelectiveSyncDialog(Account* account, const QStringList& blacklist, QWidget* parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f), _folder(0)
|
||||
{
|
||||
init(account);
|
||||
_treeView->setFolderInfo(QString(), QString(), blacklist);
|
||||
}
|
||||
|
||||
void SelectiveSyncDialog::init(Account *account)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
_treeView = new SelectiveSyncTreeView(account, parent);
|
||||
_treeView = new SelectiveSyncTreeView(account, this);
|
||||
layout->addWidget(new QLabel(tr("Only checked folders will sync to this computer")));
|
||||
layout->addWidget(_treeView);
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal);
|
||||
|
@ -262,16 +276,6 @@ SelectiveSyncDialog::SelectiveSyncDialog(Account * account, Folder* folder, QWid
|
|||
button = buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
layout->addWidget(buttonBox);
|
||||
|
||||
if (_folder) {
|
||||
// Make sure we don't get crashes if the folder is destroyed while we are still open
|
||||
connect(_folder, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()));
|
||||
|
||||
_treeView->setFolderInfo(_folder->remotePath(), _folder->alias(), _folder->selectiveSyncBlackList());
|
||||
} else {
|
||||
_treeView->refreshFolders();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SelectiveSyncDialog::accept()
|
||||
|
|
|
@ -56,12 +56,17 @@ public:
|
|||
// Dialog for a specific folder (used from the account settings button)
|
||||
explicit SelectiveSyncDialog(Account *account, Folder *folder, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
|
||||
// Dialog for the whole account (Used from the wizard)
|
||||
explicit SelectiveSyncDialog(Account *account, const QStringList &blacklist, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
|
||||
virtual void accept() Q_DECL_OVERRIDE;
|
||||
|
||||
QStringList createBlackList() const;
|
||||
|
||||
private:
|
||||
|
||||
void init(Account *account);
|
||||
|
||||
SelectiveSyncTreeView *_treeView;
|
||||
|
||||
Folder *_folder;
|
||||
|
|
|
@ -274,7 +274,7 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
|
|||
_ui.rSyncEverything->setChecked(_blacklist.isEmpty());
|
||||
|
||||
Account *acc = static_cast<OwncloudWizard *>(wizard())->account();
|
||||
SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, 0, this);
|
||||
SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _blacklist, this);
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
_blacklist = dlg->createBlackList();
|
||||
if (!_blacklist.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue