Selective sync ui: Fix #2390

This commit is contained in:
Christian Kamm 2014-10-24 15:46:35 +02:00
parent 86e13ea06f
commit 1c4072e231
2 changed files with 9 additions and 2 deletions

View file

@ -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:

View file

@ -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;