From 1c4072e23179fb6f5e473ff010b70f5124a02199 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 24 Oct 2014 15:46:35 +0200 Subject: [PATCH] Selective sync ui: Fix #2390 --- src/mirall/selectivesyncdialog.cpp | 7 +++++-- src/mirall/selectivesyncdialog.h | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mirall/selectivesyncdialog.cpp b/src/mirall/selectivesyncdialog.cpp index 23565cd93..ffe7043ff 100644 --- a/src/mirall/selectivesyncdialog.cpp +++ b/src/mirall/selectivesyncdialog.cpp @@ -81,7 +81,7 @@ void SelectiveSyncTreeView::recursiveInsert(QTreeWidgetItem* parent, QStringList || parent->checkState(0) == Qt::PartiallyChecked) { item->setCheckState(0, Qt::Checked); foreach(const QString &str , _oldBlackList) { - if (str + "/" == path) { + if (str == path) { item->setCheckState(0, Qt::Unchecked); break; } else if (str.startsWith(path)) { @@ -137,6 +137,9 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list) if (paths.last().isEmpty()) paths.removeLast(); if (paths.isEmpty()) continue; + if (!path.endsWith('/')) { + path.append('/'); + } recursiveInsert(root, paths, path); } root->setExpanded(true); @@ -223,7 +226,7 @@ QStringList SelectiveSyncTreeView::createBlackList(QTreeWidgetItem* root) const switch(root->checkState(0)) { case Qt::Unchecked: - return QStringList(root->data(0, Qt::UserRole).toString()); + return QStringList(root->data(0, Qt::UserRole).toString() + "/"); case Qt::Checked: return QStringList(); case Qt::PartiallyChecked: diff --git a/src/mirall/selectivesyncdialog.h b/src/mirall/selectivesyncdialog.h index 3bd5c09b4..cbd05117b 100644 --- a/src/mirall/selectivesyncdialog.h +++ b/src/mirall/selectivesyncdialog.h @@ -29,8 +29,12 @@ class SelectiveSyncTreeView : public QTreeWidget { Q_OBJECT public: explicit SelectiveSyncTreeView(Account *account, QWidget* parent = 0); + + /// Returns a list of blacklisted paths, each including the trailing / QStringList createBlackList(QTreeWidgetItem* root = 0) const; void refreshFolders(); + + // oldBlackList is a list of excluded paths, each including a trailing / void setFolderInfo(const QString &folderPath, const QString &rootName, const QStringList &oldBlackList = QStringList()) { _folderPath = folderPath;