1 | /****************************************************************************** |
2 | * |
3 | * Copyright (c) 2009 Szymon Stefanek <s.stefanek at gmail dot com> |
4 | * |
5 | * This library is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU Library General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or (at your |
8 | * option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, but WITHOUT |
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
13 | * License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public License |
16 | * along with this library; see the file COPYING.LIB. If not, write to the |
17 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 | * MA, 02110-1301, USA. |
19 | * |
20 | *****************************************************************************/ |
21 | |
22 | #ifndef AKONADI_ENTITYHIDDENATTRIBUTE_H |
23 | #define AKONADI_ENTITYHIDDENATTRIBUTE_H |
24 | |
25 | #include <akonadi/attribute.h> |
26 | |
27 | namespace Akonadi { |
28 | |
29 | /** |
30 | * @short An Attribute that marks that an entity should be hidden in the UI. |
31 | * |
32 | * This class represents the attribute of all hidden items. The hidden |
33 | * items shouldn't be displayed in UI applications (unless in some kind |
34 | * of "debug" mode). |
35 | * |
36 | * Example: |
37 | * |
38 | * @code |
39 | * |
40 | * using namespace Akonadi; |
41 | * |
42 | * ... |
43 | * // hide a collection by setting the hidden attribute |
44 | * Collection collection = collectionFetchJob->collections().first(); |
45 | * collection.attribute<EntityHiddenAttribute>( Entity::AddIfMissing ); |
46 | * new CollectionModifyJob( collection, this ); // save back to storage |
47 | * |
48 | * // check if the collection is hidden |
49 | * if ( collection.hasAttribute<EntityHiddenAttribute>() ) |
50 | * qDebug() << "collection is hidden"; |
51 | * else |
52 | * qDebug() << "collection is visible"; |
53 | * |
54 | * @endcode |
55 | * |
56 | * @author Szymon Stefanek <s.stefanek@gmail.com> |
57 | * @see Akonadi::Attribute |
58 | * @since 4.4 |
59 | */ |
60 | class AKONADI_EXPORT EntityHiddenAttribute : public Attribute |
61 | { |
62 | public: |
63 | /** |
64 | * Creates a new entity hidden attribute. |
65 | */ |
66 | EntityHiddenAttribute(); |
67 | |
68 | /** |
69 | * Destroys the entity hidden attribute. |
70 | */ |
71 | ~EntityHiddenAttribute(); |
72 | |
73 | /** |
74 | * Reimplemented from Attribute |
75 | */ |
76 | QByteArray type() const; |
77 | |
78 | /** |
79 | * Reimplemented from Attribute |
80 | */ |
81 | EntityHiddenAttribute *clone() const; |
82 | |
83 | /** |
84 | * Reimplemented from Attribute |
85 | */ |
86 | QByteArray serialized() const; |
87 | |
88 | /** |
89 | * Reimplemented from Attribute |
90 | */ |
91 | void deserialize(const QByteArray &data); |
92 | |
93 | private: |
94 | //@cond PRIVATE |
95 | class Private; |
96 | Private *const d; |
97 | //@endcond |
98 | }; |
99 | |
100 | } |
101 | |
102 | #endif |
103 | |