[Pkg-owncloud-commits] [owncloud-client] 26/219: Selective sync: if one click twice on the button in the wizard, it should keep the blacklist

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:05 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit e5068e75434594d11574fb1f9dea8fd638c77026
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Aug 28 12:25:44 2014 +0200

    Selective sync:  if one click twice on the button in the wizard, it should keep the blacklist
---
 src/mirall/selectivesyncdialog.cpp       | 30 +++++++++++++++++-------------
 src/mirall/selectivesyncdialog.h         |  5 +++++
 src/wizard/owncloudadvancedsetuppage.cpp |  2 +-
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/mirall/selectivesyncdialog.cpp b/src/mirall/selectivesyncdialog.cpp
index 86f1182..2580f4d 100644
--- a/src/mirall/selectivesyncdialog.cpp
+++ b/src/mirall/selectivesyncdialog.cpp
@@ -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()
diff --git a/src/mirall/selectivesyncdialog.h b/src/mirall/selectivesyncdialog.h
index 6c68128..3a618e7 100644
--- a/src/mirall/selectivesyncdialog.h
+++ b/src/mirall/selectivesyncdialog.h
@@ -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;
diff --git a/src/wizard/owncloudadvancedsetuppage.cpp b/src/wizard/owncloudadvancedsetuppage.cpp
index b250925..ba76988 100644
--- a/src/wizard/owncloudadvancedsetuppage.cpp
+++ b/src/wizard/owncloudadvancedsetuppage.cpp
@@ -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()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list