2014-08-11 17:09:17 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Olivier Goffart <ogoffart@woboq.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <QDialog>
|
2014-08-15 16:58:16 +04:00
|
|
|
#include <QTreeWidget>
|
2014-08-11 17:09:17 +04:00
|
|
|
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
class QTreeWidget;
|
2014-10-22 15:48:05 +04:00
|
|
|
class QLabel;
|
2014-08-11 17:09:17 +04:00
|
|
|
namespace Mirall {
|
|
|
|
|
2014-08-27 21:03:11 +04:00
|
|
|
class Account;
|
|
|
|
|
2014-08-11 17:09:17 +04:00
|
|
|
class Folder;
|
|
|
|
|
2014-08-15 16:58:16 +04:00
|
|
|
class SelectiveSyncTreeView : public QTreeWidget {
|
2014-08-11 17:09:17 +04:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-08-27 21:03:11 +04:00
|
|
|
explicit SelectiveSyncTreeView(Account *account, QWidget* parent = 0);
|
2014-08-15 14:29:10 +04:00
|
|
|
QStringList createBlackList(QTreeWidgetItem* root = 0) const;
|
2014-08-11 17:09:17 +04:00
|
|
|
void refreshFolders();
|
2014-08-15 18:26:38 +04:00
|
|
|
void setFolderInfo(const QString &folderPath, const QString &rootName,
|
2014-08-18 17:45:58 +04:00
|
|
|
const QStringList &oldBlackList = QStringList()) {
|
2014-08-15 18:26:38 +04:00
|
|
|
_folderPath = folderPath;
|
|
|
|
_rootName = rootName;
|
|
|
|
_oldBlackList = oldBlackList;
|
|
|
|
refreshFolders();
|
|
|
|
}
|
2014-08-15 16:58:16 +04:00
|
|
|
private slots:
|
2014-08-11 17:09:17 +04:00
|
|
|
void slotUpdateDirectories(const QStringList &);
|
|
|
|
void slotItemExpanded(QTreeWidgetItem *);
|
|
|
|
void slotItemChanged(QTreeWidgetItem*,int);
|
|
|
|
private:
|
|
|
|
void recursiveInsert(QTreeWidgetItem* parent, QStringList pathTrail, QString path);
|
2014-08-15 16:58:16 +04:00
|
|
|
QString _folderPath;
|
|
|
|
QString _rootName;
|
|
|
|
QStringList _oldBlackList;
|
2014-10-08 20:56:30 +04:00
|
|
|
bool _inserting; // set to true when we are inserting new items on the list
|
2014-08-27 21:03:11 +04:00
|
|
|
Account *_account;
|
2014-10-22 15:48:05 +04:00
|
|
|
QLabel *_loading;
|
2014-08-15 16:58:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class SelectiveSyncDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-08-27 21:03:11 +04:00
|
|
|
// Dialog for a specific folder (used from the account settings button)
|
|
|
|
explicit SelectiveSyncDialog(Account *account, Folder *folder, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
2014-08-15 16:58:16 +04:00
|
|
|
|
2014-08-28 14:25:44 +04:00
|
|
|
// Dialog for the whole account (Used from the wizard)
|
|
|
|
explicit SelectiveSyncDialog(Account *account, const QStringList &blacklist, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
|
|
|
|
2014-08-15 16:58:16 +04:00
|
|
|
virtual void accept() Q_DECL_OVERRIDE;
|
|
|
|
|
2014-08-27 21:03:11 +04:00
|
|
|
QStringList createBlackList() const;
|
|
|
|
|
2014-08-15 16:58:16 +04:00
|
|
|
private:
|
|
|
|
|
2014-08-28 14:25:44 +04:00
|
|
|
void init(Account *account);
|
|
|
|
|
2014-08-15 16:58:16 +04:00
|
|
|
SelectiveSyncTreeView *_treeView;
|
2014-08-11 17:09:17 +04:00
|
|
|
|
|
|
|
Folder *_folder;
|
|
|
|
};
|
|
|
|
|
2014-08-18 17:45:58 +04:00
|
|
|
}
|