File indexing completed on 2024-05-26 05:14:09
0001 /* 0002 SPDX-FileCopyrightText: 2006-2008 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "attributestorage_p.h" 0010 #include "cachepolicy.h" 0011 #include "collection.h" 0012 #include "collectionstatistics.h" 0013 0014 #include <QStringList> 0015 0016 #include <QSharedData> 0017 0018 using namespace Akonadi; 0019 0020 /** 0021 * @internal 0022 */ 0023 class Akonadi::CollectionPrivate : public QSharedData 0024 { 0025 public: 0026 CollectionPrivate(Collection::Id id = -1) 0027 : QSharedData() 0028 , displayPreference(Collection::ListDefault) 0029 , syncPreference(Collection::ListDefault) 0030 , indexPreference(Collection::ListDefault) 0031 , listPreferenceChanged(false) 0032 , enabled(true) 0033 , enabledChanged(false) 0034 , contentTypesChanged(false) 0035 , cachePolicyChanged(false) 0036 , isVirtual(false) 0037 , mId(id) 0038 { 0039 } 0040 0041 CollectionPrivate(const CollectionPrivate &other) 0042 : QSharedData(other) 0043 , displayPreference(other.displayPreference) 0044 , syncPreference(other.syncPreference) 0045 , indexPreference(other.indexPreference) 0046 , listPreferenceChanged(other.listPreferenceChanged) 0047 , enabled(other.enabled) 0048 , enabledChanged(other.enabledChanged) 0049 , contentTypesChanged(other.contentTypesChanged) 0050 , cachePolicyChanged(other.cachePolicyChanged) 0051 , isVirtual(other.isVirtual) 0052 , mId(other.mId) 0053 , mRemoteId(other.mRemoteId) 0054 , mRemoteRevision(other.mRemoteRevision) 0055 , mAttributeStorage(other.mAttributeStorage) 0056 , name(other.name) 0057 , resource(other.resource) 0058 , statistics(other.statistics) 0059 , contentTypes(other.contentTypes) 0060 , cachePolicy(other.cachePolicy) 0061 , keepLocalChanges(other.keepLocalChanges) 0062 { 0063 if (other.mParent) { 0064 mParent.reset(new Collection(*(other.mParent))); 0065 } 0066 } 0067 0068 void resetChangeLog() 0069 { 0070 contentTypesChanged = false; 0071 cachePolicyChanged = false; 0072 enabledChanged = false; 0073 listPreferenceChanged = false; 0074 mAttributeStorage.resetChangeLog(); 0075 } 0076 0077 static Collection newRoot() 0078 { 0079 Collection rootCollection(0); 0080 rootCollection.setContentMimeTypes({Collection::mimeType()}); 0081 return rootCollection; 0082 } 0083 0084 // Make use of the 4-bytes padding from QSharedData 0085 Collection::ListPreference displayPreference : 2; 0086 Collection::ListPreference syncPreference : 2; 0087 Collection::ListPreference indexPreference : 2; 0088 bool listPreferenceChanged : 1; 0089 bool enabled : 1; 0090 bool enabledChanged : 1; 0091 bool contentTypesChanged : 1; 0092 bool cachePolicyChanged : 1; 0093 bool isVirtual : 1; 0094 // 2 bytes padding here 0095 0096 Collection::Id mId; 0097 QString mRemoteId; 0098 QString mRemoteRevision; 0099 mutable QScopedPointer<Collection> mParent; 0100 AttributeStorage mAttributeStorage; 0101 QString name; 0102 QString resource; 0103 CollectionStatistics statistics; 0104 QStringList contentTypes; 0105 static const Collection root; 0106 CachePolicy cachePolicy; 0107 QSet<QByteArray> keepLocalChanges; 0108 };