1/*
2 Copyright (c) 2006 - 2008 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_COLLECTION_P_H
21#define AKONADI_COLLECTION_P_H
22
23#include "collection.h"
24#include "cachepolicy.h"
25#include "collectionstatistics.h"
26#include "entity_p.h"
27
28#include "qstringlist.h"
29
30using namespace Akonadi;
31
32/**
33 * @internal
34 */
35class Akonadi::CollectionPrivate : public EntityPrivate
36{
37public:
38 CollectionPrivate(Collection::Id id = -1)
39 : EntityPrivate(id)
40 , contentTypesChanged(false)
41 , cachePolicyChanged(false)
42 , isVirtual(false)
43 , enabled(true)
44 , enabledChanged(false)
45 , displayPreference(Collection::ListDefault)
46 , syncPreference(Collection::ListDefault)
47 , indexPreference(Collection::ListDefault)
48 , listPreferenceChanged(false)
49 , referenced(false)
50 , referencedChanged(false)
51 {}
52
53 CollectionPrivate(const CollectionPrivate &other)
54 : EntityPrivate(other)
55 {
56 name = other.name;
57 resource = other.resource;
58 statistics = other.statistics;
59 contentTypes = other.contentTypes;
60 cachePolicy = other.cachePolicy;
61 contentTypesChanged = other.contentTypesChanged;
62 cachePolicyChanged = other.cachePolicyChanged;
63 isVirtual = other.isVirtual;
64 enabled = other.enabled;
65 enabledChanged = other.enabledChanged;
66 displayPreference = other.displayPreference;
67 syncPreference = other.syncPreference;
68 indexPreference = other.indexPreference;
69 listPreferenceChanged = other.listPreferenceChanged;
70 referenced = other.referenced;
71 referencedChanged = other.referencedChanged;
72 }
73
74 ~CollectionPrivate()
75 {
76 }
77
78 CollectionPrivate *clone() const
79 {
80 return new CollectionPrivate(*this);
81 }
82
83 void resetChangeLog()
84 {
85 contentTypesChanged = false;
86 cachePolicyChanged = false;
87 enabledChanged = false;
88 listPreferenceChanged = false;
89 referencedChanged = false;
90 EntityPrivate::resetChangeLog();
91 }
92
93 static Collection newRoot()
94 {
95 Collection rootCollection(0);
96 QStringList types;
97 types << Collection::mimeType();
98 rootCollection.setContentMimeTypes(types);
99 return rootCollection;
100 }
101
102 QString name;
103 QString resource;
104 CollectionStatistics statistics;
105 QStringList contentTypes;
106 static const Collection root;
107 CachePolicy cachePolicy;
108 bool contentTypesChanged: 1;
109 bool cachePolicyChanged: 1;
110 bool isVirtual: 1;
111 bool enabled;
112 bool enabledChanged;
113 Collection::ListPreference displayPreference;
114 Collection::ListPreference syncPreference;
115 Collection::ListPreference indexPreference;
116 bool listPreferenceChanged;
117 bool referenced;
118 bool referencedChanged;
119};
120
121#endif
122