2 This file is part of KAddressBook.
4 Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef MODELCOLUMNMANAGER_H
22 #define MODELCOLUMNMANAGER_H
24 #include <Akonadi/Contact/ContactsTreeModel>
31 * @short A manager for the contacts model columns.
33 * This class manages which columns shall be provided by the
34 * contacts model. It keeps track of the configuration file
35 * and the user configuration.
37 * @author Tobias Koenig <tokoe@kde.org>
39 class ModelColumnManager
: public QObject
44 * Creates a new model column manager.
46 * @param model The model that shall be managed.
47 * @param parent The parent object.
49 explicit ModelColumnManager(Akonadi::ContactsTreeModel
*model
, QObject
*parent
= Q_NULLPTR
);
52 * Loads the user configuration and applies it to the model.
57 * Stores the user configuration.
62 * Sets the widget that shall provide a RMB menu to
63 * configure the columns to be shown.
65 void setWidget(QWidget
*view
);
68 bool eventFilter(QObject
*watched
, QEvent
*event
) Q_DECL_OVERRIDE
;
71 void adaptHeaderView();
74 Akonadi::ContactsTreeModel
*mModel
;
75 Akonadi::ContactsTreeModel::Columns mColumns
;