1 /* 2 * Copyright 2009 Cristian Oneț <onet.cristian@gmail.com> 3 * Copyright 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License as 7 * published by the Free Software Foundation; either version 2 of 8 * the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef ACCOUNTSVIEWPROXYMODEL_H 20 #define ACCOUNTSVIEWPROXYMODEL_H 21 22 #include "kmm_widgets_export.h" 23 24 // ---------------------------------------------------------------------------- 25 // QT Includes 26 27 #include <QSet> 28 #include <QPoint> 29 30 // ---------------------------------------------------------------------------- 31 // KDE Includes 32 33 // ---------------------------------------------------------------------------- 34 // Project Includes 35 36 #include "accountsproxymodel.h" 37 #include "modelenums.h" 38 39 class QPoint; 40 41 /** 42 * This model is specialized to organize the data for the accounts tree view 43 * based on the data of the @ref AccountsModel. 44 */ 45 class AccountsViewProxyModelPrivate; 46 class KMM_WIDGETS_EXPORT AccountsViewProxyModel : public AccountsProxyModel 47 { 48 Q_OBJECT 49 Q_DISABLE_COPY(AccountsViewProxyModel) 50 51 public: 52 explicit AccountsViewProxyModel(QObject *parent = nullptr); 53 ~AccountsViewProxyModel() override; 54 55 void setColumnVisibility(eAccountsModel::Column column, bool visible); 56 QSet<eAccountsModel::Column> getVisibleColumns(); 57 58 public Q_SLOTS: 59 void slotColumnsMenu(const QPoint); 60 61 Q_SIGNALS: 62 void columnToggled(const eAccountsModel::Column column, const bool show); 63 64 protected: 65 AccountsViewProxyModel(AccountsViewProxyModelPrivate &dd, QObject *parent); 66 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; 67 bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const override; 68 69 private: 70 Q_DECLARE_PRIVATE(AccountsViewProxyModel) 71 }; 72 73 #endif 74