|
1 /* |
|
2 * Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Group data container implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCAGROUP_H |
|
21 #define CCAGROUP_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 #include "MCAExtendedStoredGroup.h" |
|
28 #include "TStorageManagerGlobals.h" |
|
29 |
|
30 // If new fields are added, increase the version number |
|
31 // (for backward compatibility with older versions) |
|
32 const TInt KCAGroupVersion = 1; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CCAStorage; |
|
36 class RReadStream; |
|
37 class RWriteStream; |
|
38 class MCAStoredGroupsObserver; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Group data implementation |
|
44 * |
|
45 * @lib CAStorage.dll |
|
46 * @since 2.1 |
|
47 */ |
|
48 class CCAGroup : public CBase, |
|
49 public MCAExtendedStoredGroup |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aStorage Storage instance |
|
56 * @param aObserver group data container observer |
|
57 */ |
|
58 IMPORT_C static CCAGroup* NewL( CCAStorage* aStorage, |
|
59 MCAStoredGroupsObserver* aObserver ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 IMPORT_C virtual ~CCAGroup(); |
|
65 |
|
66 public: // Functions from base classes |
|
67 |
|
68 /** |
|
69 * From MCAStoredGroup |
|
70 */ |
|
71 IMPORT_C TBool IsJoined() const; |
|
72 |
|
73 /** |
|
74 * From MCAExtendedStoredGroup |
|
75 */ |
|
76 IMPORT_C void SetJoined( TBool aJoinStatus ); |
|
77 |
|
78 /** |
|
79 * From MCAStoredGroup |
|
80 */ |
|
81 IMPORT_C void GetMembersL( CDesCArray& aMemberList ) const; |
|
82 |
|
83 /** |
|
84 * From MCAExtendedStoredGroup |
|
85 */ |
|
86 IMPORT_C void AddMembersLocallyL( const MDesCArray& aMemberList ); |
|
87 |
|
88 /** |
|
89 * From MCAExtendedStoredGroup |
|
90 */ |
|
91 IMPORT_C void RemoveMembersLocally( const MDesCArray& aMemberList ); |
|
92 |
|
93 /** |
|
94 * From MCAExtendedStoredGroup |
|
95 */ |
|
96 IMPORT_C void ResetMembersLocally(); |
|
97 |
|
98 /** |
|
99 * From MCAStoredGroup |
|
100 */ |
|
101 IMPORT_C void GetParticipantsL( CDesCArray& aParticipantList ) const; |
|
102 |
|
103 /** |
|
104 * From MCAExtendedStoredGroup |
|
105 */ |
|
106 IMPORT_C void AddParticipantL( const MDesCArray& aParticipantList ); |
|
107 |
|
108 /** |
|
109 * From MCAExtendedStoredGroup |
|
110 */ |
|
111 IMPORT_C void RemoveParticipantL( const MDesCArray& aParticipantList ); |
|
112 |
|
113 /** |
|
114 * From MCAExtendedStoredGroup |
|
115 */ |
|
116 IMPORT_C void ResetParticipantsL(); |
|
117 |
|
118 /** |
|
119 * From MCAStoredGroup |
|
120 */ |
|
121 IMPORT_C TStorageManagerGlobals::TCAStorageType StorageType() const; |
|
122 |
|
123 /** |
|
124 * From MCAExtendedStoredGroup |
|
125 */ |
|
126 IMPORT_C void SetStorageType( |
|
127 TStorageManagerGlobals::TCAStorageType aType ); |
|
128 |
|
129 /** |
|
130 * From MCAStoredGroup |
|
131 */ |
|
132 IMPORT_C TBool IsOwnGroup() const; |
|
133 |
|
134 /** |
|
135 * From MCAExtendedStoredGroup |
|
136 */ |
|
137 IMPORT_C void SetOwnGroup( TBool aOwnGroupStatus ); |
|
138 |
|
139 /** |
|
140 * From MCAStoredGroup |
|
141 */ |
|
142 IMPORT_C const TDesC& GroupId() const; |
|
143 |
|
144 /** |
|
145 * From MCAExtendedStoredGroup |
|
146 */ |
|
147 IMPORT_C void SetGroupIdL( const TDesC& aGroupId ); |
|
148 |
|
149 /** |
|
150 * From MCAStoredGroup |
|
151 */ |
|
152 IMPORT_C const TDesC& GroupName() const; |
|
153 |
|
154 /** |
|
155 * From MCAExtendedStoredGroup |
|
156 */ |
|
157 IMPORT_C void SetGroupNameL( const TDesC& aGroupName ); |
|
158 |
|
159 /** |
|
160 * From MCAStoredGroup |
|
161 */ |
|
162 IMPORT_C TBool IsAdmin() const; |
|
163 |
|
164 /** |
|
165 * From MCAExtendedStoredGroup |
|
166 */ |
|
167 IMPORT_C void SetAdmin( const TBool aStatus ); |
|
168 |
|
169 /** |
|
170 * From MCAStoredGroup |
|
171 */ |
|
172 IMPORT_C TInt NumParticipants() const; |
|
173 |
|
174 /** |
|
175 * From MCAStoredGroup |
|
176 */ |
|
177 IMPORT_C TBool IsVisible() const; |
|
178 |
|
179 /** |
|
180 * From MCAExtendedStoredGroup |
|
181 */ |
|
182 IMPORT_C void SetVisible( const TBool aVisible ); |
|
183 |
|
184 /** |
|
185 * From MCAStoredGroup |
|
186 */ |
|
187 IMPORT_C const TDesC& Server() const; |
|
188 |
|
189 /** |
|
190 * From MCAExtendedStoredGroup |
|
191 */ |
|
192 IMPORT_C void SetServerL( const TDesC& aServer ); |
|
193 |
|
194 /** |
|
195 * From MCAExtendedStoredGroup |
|
196 */ |
|
197 IMPORT_C void SaveChangesL(); |
|
198 |
|
199 /** |
|
200 * From MCAExtendedStoredGroup |
|
201 */ |
|
202 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
203 |
|
204 /** |
|
205 * From MCAExtendedStoredGroup |
|
206 */ |
|
207 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
208 |
|
209 /** |
|
210 * From MCAExtendedStoredGroup |
|
211 */ |
|
212 IMPORT_C TInt32 MaximalSize() const; |
|
213 |
|
214 /** |
|
215 * From MCAExtendedStoredGroup |
|
216 */ |
|
217 IMPORT_C TInt32 Version() const; |
|
218 |
|
219 private: |
|
220 |
|
221 /** |
|
222 * C++ default constructor. |
|
223 * @param aStorage Storage instance |
|
224 * @param aObserver group data container observer |
|
225 */ |
|
226 CCAGroup( CCAStorage* aStorage, MCAStoredGroupsObserver* aObserver ); |
|
227 |
|
228 /** |
|
229 * By default Symbian 2nd phase constructor is private. |
|
230 */ |
|
231 void ConstructL(); |
|
232 |
|
233 private: // Data |
|
234 |
|
235 // persistent storage class |
|
236 CCAStorage* iStorage; // used |
|
237 |
|
238 // joined the group (ETrue) |
|
239 TBool iIsJoined; |
|
240 |
|
241 // group is own (ETrue) |
|
242 TBool iIsOwnGroup; |
|
243 |
|
244 // visible in UI (ETrue) |
|
245 TBool iIsVisible; |
|
246 |
|
247 // administrator status in this group (ETrue) |
|
248 TBool iIsAdmin; |
|
249 |
|
250 // the group id |
|
251 HBufC* iGroupId; // owns |
|
252 |
|
253 // the group name |
|
254 HBufC* iGroupName; // owns |
|
255 |
|
256 // the server name for this group |
|
257 HBufC* iServerName; // owns |
|
258 |
|
259 // locally added members of the group |
|
260 CDesCArraySeg* iMembers; // owns |
|
261 |
|
262 // participants of the group |
|
263 CDesCArraySeg* iParticipants; // owns |
|
264 |
|
265 // the storage type of the group |
|
266 TStorageManagerGlobals::TCAStorageType iStorageType; |
|
267 |
|
268 // observer for group events |
|
269 MCAStoredGroupsObserver* iObserver; // used |
|
270 |
|
271 // flag whether to invoke observer or not upon SaveChangesL, |
|
272 // determines whether anything was changed |
|
273 TInt iIsChanged; |
|
274 }; |
|
275 |
|
276 #endif // CCAGROUP_H |
|
277 |
|
278 // End of File |