|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * WV group properties. |
|
16 * WV CSP 1.1 recommends some properties and the classes here provide support |
|
17 * for them. Additionally is is possible to create and read extra properties |
|
18 * not mentioned in CSP 1.1. |
|
19 * Because of any of the predefined properties may be missing, we use |
|
20 * the value -1 to denote undefined value. |
|
21 * |
|
22 * Notice that the mutators do not change the values immediately in a remote |
|
23 * service, but only after the properties have been assigned to the service |
|
24 * through SetGroupPropertiesL method in RImpsGroupClient interface. |
|
25 * |
|
26 * |
|
27 */ |
|
28 |
|
29 |
|
30 #ifndef CImpsGroupProps_H |
|
31 #define CImpsGroupProps_H |
|
32 |
|
33 // INCLUDES |
|
34 #include <e32base.h> |
|
35 |
|
36 // Values for user types |
|
37 enum TImpsGroupUsers |
|
38 { |
|
39 EImpsUserUndef = 0, |
|
40 EImpsAdmin, |
|
41 EImpsModerator, |
|
42 EImpsOrdinary |
|
43 }; |
|
44 |
|
45 // Property set type |
|
46 enum TImpsPropertyType |
|
47 { |
|
48 EImpsPropPrivate = 1, |
|
49 EImpsPropCommon |
|
50 }; |
|
51 |
|
52 // Property values |
|
53 enum TImpsPropertyBool |
|
54 { |
|
55 EImpsPropUndef = -1, // undefined |
|
56 EImpsPropNo = 0, // false, no, ... |
|
57 EImpsPropYes = 1 // true, yes |
|
58 }; |
|
59 |
|
60 |
|
61 // CLASS DECLARATION |
|
62 |
|
63 /** |
|
64 * CImpsGroupProp |
|
65 * |
|
66 * A single property. used for external properties not mentioned in CSP. |
|
67 * |
|
68 */ |
|
69 |
|
70 class CImpsGroupProp :public CBase |
|
71 { |
|
72 public: // Constructors and destructor |
|
73 |
|
74 /** |
|
75 * Two-phased constructor. |
|
76 * @param aKey property key |
|
77 * @param aValue property value |
|
78 */ |
|
79 IMPORT_C static CImpsGroupProp* NewL( |
|
80 const TDesC& aKey, |
|
81 const TDesC& aValue ); |
|
82 |
|
83 /** |
|
84 * Destructor. |
|
85 */ |
|
86 virtual ~CImpsGroupProp(); |
|
87 |
|
88 public: // New functions |
|
89 |
|
90 /** |
|
91 * Key accessor |
|
92 * @return key |
|
93 */ |
|
94 IMPORT_C TPtrC Key() const; |
|
95 |
|
96 /** |
|
97 * Value accessor |
|
98 * @return value |
|
99 */ |
|
100 IMPORT_C TPtrC Value() const; |
|
101 |
|
102 protected: |
|
103 |
|
104 |
|
105 /** |
|
106 * C++ constructor. |
|
107 */ |
|
108 CImpsGroupProp( ); |
|
109 |
|
110 private: |
|
111 |
|
112 /** |
|
113 * Actual construction. |
|
114 * @param aKey property key |
|
115 * @param aValue property value |
|
116 */ |
|
117 void ConstructL( |
|
118 const TDesC& aKey, |
|
119 const TDesC& aValue ); |
|
120 |
|
121 public: // Data |
|
122 |
|
123 TDblQueLink iLink; |
|
124 |
|
125 private: // Data |
|
126 |
|
127 HBufC* iKey; |
|
128 HBufC* iValue; |
|
129 |
|
130 public: // Friend classes |
|
131 |
|
132 friend class CImpsGroupProps; |
|
133 |
|
134 }; |
|
135 |
|
136 /** |
|
137 * CImpsGroupProps |
|
138 * |
|
139 * WV Group properties base class. |
|
140 */ |
|
141 class CImpsGroupProps :public CBase |
|
142 { |
|
143 public: // Constructors and destructor |
|
144 |
|
145 /** |
|
146 * Destructor. |
|
147 */ |
|
148 IMPORT_C virtual ~CImpsGroupProps(); |
|
149 |
|
150 /** |
|
151 * Initialize member data |
|
152 */ |
|
153 IMPORT_C virtual void Reset() = 0; |
|
154 |
|
155 /** |
|
156 * Returns the type of the properties |
|
157 */ |
|
158 IMPORT_C virtual TImpsPropertyType Type() const = 0; |
|
159 |
|
160 public: // New functions |
|
161 |
|
162 /** |
|
163 * Get current number of extra properties |
|
164 */ |
|
165 IMPORT_C TInt Count(); |
|
166 |
|
167 /** |
|
168 * Add new extra property |
|
169 * @param aProperty new property. |
|
170 * The data is copied to internal structures. |
|
171 */ |
|
172 IMPORT_C void AddL( const CImpsGroupProp& aProperty ); |
|
173 |
|
174 /** |
|
175 * Access first extra property |
|
176 * Leaves with KErrEof if no data |
|
177 * @return first property |
|
178 */ |
|
179 IMPORT_C const CImpsGroupProp& FirstL(); |
|
180 |
|
181 /** |
|
182 * Access next property |
|
183 * Leaves with KErrEof if no data |
|
184 * @return next property |
|
185 */ |
|
186 IMPORT_C const CImpsGroupProp& NextL(); |
|
187 |
|
188 protected: |
|
189 |
|
190 /** |
|
191 * C++ constructor |
|
192 */ |
|
193 IMPORT_C CImpsGroupProps(); |
|
194 |
|
195 /** |
|
196 * Is private messages allowed |
|
197 * @return EImpsPropYes if allowed |
|
198 */ |
|
199 TImpsPropertyBool IsPrivateAllowed() const; |
|
200 |
|
201 /** |
|
202 * Mutator for private messaging flag |
|
203 * @param aValue EImpsPropYes if private messaging allowed |
|
204 */ |
|
205 void SetPrivateAllowed( TImpsPropertyBool aValue ); |
|
206 |
|
207 private: |
|
208 |
|
209 /** |
|
210 * Actual construction. |
|
211 */ |
|
212 void ConstructL(); |
|
213 |
|
214 private: |
|
215 TBool iReset; // Is reset called |
|
216 |
|
217 public: // Data |
|
218 // Linked list for extra properties |
|
219 TDblQue<CImpsGroupProp> iPropertyList; |
|
220 |
|
221 // Pointer to the current value |
|
222 TDblQueIter<CImpsGroupProp> iIter; |
|
223 |
|
224 protected: // Data |
|
225 TImpsPropertyBool iPrivateMessages; // private messaging allowed |
|
226 |
|
227 }; |
|
228 |
|
229 class CImpsPrivateGroupProps :public CImpsGroupProps |
|
230 { |
|
231 public: // Constructors and destructor |
|
232 |
|
233 /** |
|
234 * Two-phased constructor. |
|
235 */ |
|
236 IMPORT_C static CImpsPrivateGroupProps* NewL(); |
|
237 |
|
238 /** |
|
239 * Destructor. |
|
240 */ |
|
241 IMPORT_C virtual ~CImpsPrivateGroupProps(); |
|
242 |
|
243 /** |
|
244 * Initialize member data |
|
245 */ |
|
246 IMPORT_C void Reset(); |
|
247 |
|
248 /** |
|
249 * Returns the type of the properties |
|
250 */ |
|
251 IMPORT_C virtual TImpsPropertyType Type() const; |
|
252 |
|
253 /** |
|
254 * Is private messages allowed |
|
255 * @return EImpsPropYes if allowed |
|
256 */ |
|
257 IMPORT_C TImpsPropertyBool IsPrivateAllowed() const; |
|
258 |
|
259 /** |
|
260 * Mutator for private messaging flag |
|
261 * @param aValue EImpsPropYes if private messaging allowed |
|
262 */ |
|
263 IMPORT_C void SetPrivateAllowed( TImpsPropertyBool aValue ); |
|
264 |
|
265 /** |
|
266 * Is the user a member |
|
267 * @return EImpsPropYes if user is a member |
|
268 */ |
|
269 IMPORT_C TImpsPropertyBool IsMember() const; |
|
270 |
|
271 /** |
|
272 * Privilege accessor |
|
273 * @return user privileges (role) in the group |
|
274 */ |
|
275 IMPORT_C TImpsGroupUsers Privileges() const; |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 protected: |
|
281 /** |
|
282 * C++ constructor. |
|
283 */ |
|
284 IMPORT_C CImpsPrivateGroupProps(); |
|
285 |
|
286 /** |
|
287 * Actual construction |
|
288 */ |
|
289 void ConstructL(); |
|
290 |
|
291 protected: |
|
292 |
|
293 TImpsPropertyBool iMember; // Am i member |
|
294 TImpsGroupUsers iPrivilege; // privilege level |
|
295 |
|
296 }; |
|
297 |
|
298 |
|
299 class CImpsCommonGroupProps :public CImpsGroupProps |
|
300 { |
|
301 public: // Constructors and destructor |
|
302 |
|
303 /** |
|
304 * Two-phased constructor. |
|
305 */ |
|
306 IMPORT_C static CImpsCommonGroupProps* NewL(); |
|
307 |
|
308 /** |
|
309 * Destructor. |
|
310 */ |
|
311 IMPORT_C virtual ~CImpsCommonGroupProps(); |
|
312 |
|
313 /** |
|
314 * Initialize member data |
|
315 */ |
|
316 IMPORT_C void Reset(); |
|
317 |
|
318 /** |
|
319 * Returns the type of the properties |
|
320 */ |
|
321 IMPORT_C virtual TImpsPropertyType Type() const; |
|
322 |
|
323 /** |
|
324 * Is private messages allowed |
|
325 * @return EImpsPropYes if allowed |
|
326 */ |
|
327 IMPORT_C TImpsPropertyBool IsPrivateAllowed() const; |
|
328 |
|
329 /** |
|
330 * Mutator for private messaging flag |
|
331 * @param aValue EImpsPropYes if private messaging allowed |
|
332 */ |
|
333 IMPORT_C void SetPrivateAllowed( TImpsPropertyBool aValue ); |
|
334 |
|
335 /** |
|
336 * Is group open or closed |
|
337 * @return EImpsPropYes if open |
|
338 */ |
|
339 IMPORT_C TImpsPropertyBool IsOpen() const; |
|
340 |
|
341 /** |
|
342 * Access type mutator |
|
343 * @param aType EImpsPropYes if open |
|
344 */ |
|
345 IMPORT_C void SetOpen( TImpsPropertyBool aType ); |
|
346 |
|
347 /** |
|
348 * Is group public or private |
|
349 * @return EImpsPropYes if public |
|
350 */ |
|
351 IMPORT_C TImpsPropertyBool IsPublic() const; |
|
352 |
|
353 /** |
|
354 * Is group searchable |
|
355 * @return EImpsPropYes if searchable |
|
356 */ |
|
357 IMPORT_C TImpsPropertyBool IsSearchable() const; |
|
358 |
|
359 /** |
|
360 * Access type mutator |
|
361 * @param aType EImpsPropYes if searchable |
|
362 */ |
|
363 IMPORT_C void SetSearchable( TImpsPropertyBool aType ); |
|
364 |
|
365 /** |
|
366 * Number of current joined active users |
|
367 * @return number of users, -1 if not specified |
|
368 */ |
|
369 IMPORT_C TInt NbrOfUsers() const; |
|
370 |
|
371 /** |
|
372 * Maximum number of active users |
|
373 * @return number of users, -1 if not specified |
|
374 */ |
|
375 IMPORT_C TInt MaxNbrOfUsers() const; |
|
376 |
|
377 /** |
|
378 * Mutator for maximum number of users |
|
379 * @param aNbr new maximum number of users. -1 means undefined |
|
380 */ |
|
381 IMPORT_C void SetMaxNbrOfUsers( TInt aNbr ); |
|
382 |
|
383 /** |
|
384 * Name of the group |
|
385 * @return name of the group |
|
386 */ |
|
387 IMPORT_C TPtrC GroupName() const; |
|
388 |
|
389 /** |
|
390 * Group name mutator |
|
391 * @param aName new grop name |
|
392 */ |
|
393 IMPORT_C void SetGroupNameL( const TDesC& aName ); |
|
394 |
|
395 /** |
|
396 * Topic of the group |
|
397 * @return name of the group |
|
398 */ |
|
399 IMPORT_C TPtrC Topic() const; |
|
400 |
|
401 /** |
|
402 * Topic mutator |
|
403 * @param aTopic new grop topic description |
|
404 */ |
|
405 IMPORT_C void SetTopicL( const TDesC& aTopic ); |
|
406 |
|
407 /** |
|
408 * Welcome text of the group |
|
409 * @return text |
|
410 */ |
|
411 IMPORT_C TPtrC Welcome() const; |
|
412 |
|
413 /** |
|
414 * Topic mutator |
|
415 * @param aText new group wellcome test |
|
416 */ |
|
417 IMPORT_C void SetWelcomeL( const TDesC& aText ); |
|
418 |
|
419 /** |
|
420 * AutoDelete for CSP 1.2 |
|
421 * @return EImpsPropYes if used |
|
422 */ |
|
423 IMPORT_C TImpsPropertyBool AutoDelete() const; |
|
424 |
|
425 /** |
|
426 * Mutator for auto delete flag in CSP 1.2 |
|
427 * @param aValue EImpsPropYes if used |
|
428 */ |
|
429 IMPORT_C void SetAutoDelete( TImpsPropertyBool aValue ); |
|
430 |
|
431 |
|
432 protected: |
|
433 /** |
|
434 * C++ constructor |
|
435 */ |
|
436 IMPORT_C CImpsCommonGroupProps(); |
|
437 |
|
438 private: |
|
439 /** |
|
440 * By default Symbian OS constructor is private. |
|
441 */ |
|
442 void ConstructL(); |
|
443 |
|
444 protected: |
|
445 |
|
446 TImpsPropertyBool iAccessOpen; // access type open/closed |
|
447 TImpsPropertyBool iTypePublic; // type public/private |
|
448 TImpsPropertyBool iSearchable; // is searchable |
|
449 TInt iNbrActive; // nbr of active users |
|
450 TInt iMaxUsers; // max nbr of users |
|
451 HBufC* iName; // name |
|
452 HBufC* iTopic; |
|
453 HBufC* iWelcome; // welcome note |
|
454 TImpsPropertyBool iAutoDelete; // auto delete for CSP 1.2 |
|
455 }; |
|
456 |
|
457 |
|
458 #endif |
|
459 |