1 | /* |
2 | Copyright (c) 2007 Volker Krause <vkrause@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU Library General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or (at your |
7 | option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, but WITHOUT |
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
12 | License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to the |
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 | 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef AKONADI_SUBSCRIPTIONMODEL_P_H |
21 | #define AKONADI_SUBSCRIPTIONMODEL_P_H |
22 | |
23 | #include <akonadi/collection.h> |
24 | #include <akonadi/collectionmodel.h> |
25 | |
26 | namespace Akonadi { |
27 | |
28 | /** |
29 | * @internal |
30 | * @deprecated This should be replaced by something based on EntityTreeModel |
31 | * |
32 | * An extended collection model used for the subscription dialog. |
33 | */ |
34 | class SubscriptionModel : public CollectionModel |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | /** Additional roles. */ |
39 | enum Roles { |
40 | SubscriptionChangedRole = CollectionModel::UserRole + 1 ///< Indicate the subscription status has been changed. |
41 | }; |
42 | |
43 | /** |
44 | Create a new subscription model. |
45 | @param parent The parent object. |
46 | */ |
47 | explicit SubscriptionModel(QObject *parent = 0); |
48 | |
49 | /** |
50 | Destructor. |
51 | */ |
52 | ~SubscriptionModel(); |
53 | |
54 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
55 | Qt::ItemFlags flags(const QModelIndex &index) const; |
56 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); |
57 | |
58 | Collection::List subscribed() const; |
59 | Collection::List unsubscribed() const; |
60 | |
61 | /** |
62 | * @param showHidden shows hidden collection if set as @c true |
63 | * @since: 4.9 |
64 | */ |
65 | void showHiddenCollection(bool showHidden); |
66 | |
67 | Q_SIGNALS: |
68 | /** |
69 | Emitted when the collection model is fully loaded. |
70 | */ |
71 | void loaded(); |
72 | |
73 | private: |
74 | class Private; |
75 | Private *const d; |
76 | Q_PRIVATE_SLOT(d, void listResult(KJob *)) |
77 | }; |
78 | |
79 | } |
80 | |
81 | #endif |
82 | |