1
/****************************************************************************
2
* Copyright (C) 2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
* This library is free software; you can redistribute it and/or *
6
* modify it under the terms of the GNU Lesser General Public *
7
* License as published by the Free Software Foundation; either *
8
* version 2.1 of the License, or (at your option) any later version. *
10
* This library 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 GNU *
13
* Lesser General Public License for more details. *
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
#ifndef AKONADI_CONTACT_COLLECTION_MODEL_H
19
#define AKONADI_CONTACT_COLLECTION_MODEL_H
21
#include <QtGui/QSortFilterProxyModel>
22
#include "../lib/typedefs.h"
25
class CollectionModel;
28
///Filter out notes and emails collections
29
class LIB_EXPORT AkonadiContactCollectionModel : public QSortFilterProxyModel
33
virtual ~AkonadiContactCollectionModel();
36
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
37
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const;
38
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role );
45
static AkonadiContactCollectionModel* instance();
48
virtual bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
51
explicit AkonadiContactCollectionModel(QObject* parent);
52
QHash<int,bool> m_hChecked;
53
QHash<int,bool> m_hLoaded ;
54
Akonadi::CollectionModel* m_pParentModel;
57
static AkonadiContactCollectionModel* m_spInstance;
60
void digg(const QModelIndex& idx);
63
void slotInsertCollection(const QModelIndex&,int,int);
64
void slotRemoveCollection(const QModelIndex&,int,int);