2 * birthdaymodel.h - model class for birthdays from address book
4 * Copyright © 2009 by 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 BIRTHDAYMODEL_H
22 #define BIRTHDAYMODEL_H
24 #include <Akonadi/Contact/ContactsTreeModel>
26 #include <QSortFilterProxyModel>
34 * @short Provides the global model for all contacts
36 * This model provides the EntityTreeModel for all contacts.
37 * The model is accessable via the static instance() method.
39 class BirthdayModel
: public Akonadi::ContactsTreeModel
43 enum { // data columns
44 NameColumn
, DateColumn
,
49 * Destroys the global contact model.
54 * Returns the global contact model instance.
56 static BirthdayModel
* instance();
58 QVariant
entityData(const Akonadi::Item
&, int column
, int role
= Qt::DisplayRole
) const Q_DECL_OVERRIDE
;
59 QVariant
entityData(const Akonadi::Collection
& collection
, int column
, int role
= Qt::DisplayRole
) const Q_DECL_OVERRIDE
60 { return Akonadi::ContactsTreeModel::entityData(collection
, column
, role
); }
63 explicit BirthdayModel(Akonadi::ChangeRecorder
* recorder
);
65 static BirthdayModel
* mInstance
;
69 class BirthdaySortModel
: public QSortFilterProxyModel
73 explicit BirthdaySortModel(QObject
* parent
= Q_NULLPTR
);
75 void setPrefixSuffix(const QString
& prefix
, const QString
& suffix
);
78 bool filterAcceptsRow(int sourceRow
, const QModelIndex
& sourceParent
) const Q_DECL_OVERRIDE
;
81 QStringList mContactsWithAlarm
;