nextcloud-desktop/src/mirall/selectivesyncdialog.h

78 lines
2.3 KiB
C
Raw Normal View History

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>
#include <QTreeWidget>
2014-08-11 17:09:17 +04:00
class QTreeWidgetItem;
class QTreeWidget;
class QLabel;
2014-08-11 17:09:17 +04:00
namespace Mirall {
class Account;
2014-08-11 17:09:17 +04:00
class Folder;
class SelectiveSyncTreeView : public QTreeWidget {
2014-08-11 17:09:17 +04:00
Q_OBJECT
public:
explicit SelectiveSyncTreeView(Account *account, QWidget* parent = 0);
QStringList createBlackList(QTreeWidgetItem* root = 0) const;
2014-08-11 17:09:17 +04:00
void refreshFolders();
void setFolderInfo(const QString &folderPath, const QString &rootName,
2014-08-18 17:45:58 +04:00
const QStringList &oldBlackList = QStringList()) {
_folderPath = folderPath;
_rootName = rootName;
_oldBlackList = oldBlackList;
refreshFolders();
}
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);
QString _folderPath;
QString _rootName;
QStringList _oldBlackList;
bool _inserting; // set to true when we are inserting new items on the list
Account *_account;
QLabel *_loading;
};
class SelectiveSyncDialog : public QDialog {
Q_OBJECT
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;
2014-08-11 17:09:17 +04:00
Folder *_folder;
};
2014-08-18 17:45:58 +04:00
}