|
1 /* |
|
2 * Copyright (c) 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: |
|
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 // INCLUDE FILES |
|
31 #include "ImpsGroupProps.h" |
|
32 |
|
33 |
|
34 // ================= MEMBER FUNCTIONS ======================= |
|
35 |
|
36 // --------------------------------------------------------- |
|
37 // CImpsGroupProp::CImpsGroupProp |
|
38 // --------------------------------------------------------- |
|
39 // |
|
40 CImpsGroupProp::CImpsGroupProp() |
|
41 { |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CImpsGroupProp::~CImpsGroupProp |
|
46 // --------------------------------------------------------- |
|
47 // |
|
48 CImpsGroupProp::~CImpsGroupProp() |
|
49 { |
|
50 delete iKey; |
|
51 delete iValue; |
|
52 iLink.Deque(); |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------- |
|
56 // CImpsGroupProp::NewL |
|
57 // --------------------------------------------------------- |
|
58 // |
|
59 CImpsGroupProp* CImpsGroupProp::NewL( |
|
60 const TDesC& aKey, |
|
61 const TDesC& aValue ) |
|
62 { |
|
63 CImpsGroupProp* self = new (ELeave) CImpsGroupProp; |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL( aKey, aValue ); |
|
66 CleanupStack::Pop(); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // CImpsGroupProp::Key |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 TPtrC CImpsGroupProp::Key() const |
|
75 { |
|
76 /*LDRA_NOANALYSIS*/ |
|
77 return iKey ? TPtrC( *iKey ) : TPtrC(); |
|
78 /*LDRA_ANALYSIS*/ |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CImpsGroupProp::Value |
|
83 // --------------------------------------------------------- |
|
84 // |
|
85 TPtrC CImpsGroupProp::Value() const |
|
86 { |
|
87 /*LDRA_NOANALYSIS*/ |
|
88 return iValue ? TPtrC( *iValue ) : TPtrC(); |
|
89 /*LDRA_ANALYSIS*/ |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------- |
|
93 // CImpsGroupProp::ConstructL |
|
94 // --------------------------------------------------------- |
|
95 // |
|
96 void CImpsGroupProp::ConstructL( |
|
97 const TDesC& aKey, |
|
98 const TDesC& aValue ) |
|
99 { |
|
100 HBufC* newAttrib = aKey.AllocL(); |
|
101 iKey = newAttrib; |
|
102 newAttrib = aValue.AllocL(); |
|
103 iValue = newAttrib; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // C++ default constructor can NOT contain any code, that |
|
108 // might leave. |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 CImpsGroupProps::CImpsGroupProps() |
|
112 : iReset( ETrue ), |
|
113 iPropertyList(_FOFF( CImpsGroupProp, iLink )), |
|
114 iIter( iPropertyList ), |
|
115 iPrivateMessages( EImpsPropUndef ) |
|
116 { |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------- |
|
120 // CImpsGroupProps::~CImpsGroupProps() |
|
121 // --------------------------------------------------------- |
|
122 // |
|
123 CImpsGroupProps::~CImpsGroupProps() |
|
124 { |
|
125 // Delete all properties |
|
126 TDblQueIter<CImpsGroupProp> rIter( iPropertyList ); |
|
127 |
|
128 rIter.SetToFirst(); |
|
129 |
|
130 while ( rIter ) |
|
131 { |
|
132 CImpsGroupProp* pr = rIter; |
|
133 rIter++; |
|
134 delete pr; |
|
135 } |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------- |
|
139 // CImpsGroupProps::ConstructL |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 void CImpsGroupProps::ConstructL() |
|
143 { |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------- |
|
147 // CImpsGroupProps::Count |
|
148 // --------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C TInt CImpsGroupProps::Count() |
|
151 { |
|
152 // Count all properties |
|
153 TInt counter = 0; |
|
154 TDblQueIter<CImpsGroupProp> rIter( iPropertyList ); |
|
155 rIter.SetToFirst(); |
|
156 while ( rIter ) |
|
157 { |
|
158 rIter++; |
|
159 counter++; |
|
160 } |
|
161 return counter; |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------- |
|
165 // CImpsGroupProps::AddL |
|
166 // --------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C void CImpsGroupProps::AddL( const CImpsGroupProp& aProperty ) |
|
169 { |
|
170 iReset = EFalse; |
|
171 CImpsGroupProp* pr = CImpsGroupProp::NewL( |
|
172 aProperty.iKey->Des(), |
|
173 aProperty.iValue->Des() ); |
|
174 iPropertyList.AddLast( *pr ); |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------- |
|
178 // CImpsGroupProps::FirstL |
|
179 // --------------------------------------------------------- |
|
180 // |
|
181 EXPORT_C const CImpsGroupProp& CImpsGroupProps::FirstL() |
|
182 { |
|
183 iReset = EFalse; |
|
184 iIter.SetToFirst(); |
|
185 CImpsGroupProp* pr = iIter; |
|
186 if ( !pr ) |
|
187 { |
|
188 User::Leave( KErrEof ); |
|
189 } |
|
190 return *pr; |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------- |
|
194 // CImpsGroupProps::NextL |
|
195 // --------------------------------------------------------- |
|
196 // |
|
197 EXPORT_C const CImpsGroupProp& CImpsGroupProps::NextL() |
|
198 { |
|
199 if ( iReset ) |
|
200 { |
|
201 User::Leave( KErrEof ); |
|
202 } |
|
203 iIter++; |
|
204 CImpsGroupProp* pr = iIter; |
|
205 if ( !pr ) |
|
206 { |
|
207 User::Leave( KErrEof ); |
|
208 } |
|
209 return *pr; |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------- |
|
213 // CImpsGroupProps::Reset |
|
214 // --------------------------------------------------------- |
|
215 // |
|
216 void CImpsGroupProps::Reset() |
|
217 { |
|
218 iReset = ETrue; |
|
219 // Delete all properties |
|
220 TDblQueIter<CImpsGroupProp> rIter( iPropertyList ); |
|
221 |
|
222 rIter.SetToFirst(); |
|
223 |
|
224 while ( rIter ) |
|
225 { |
|
226 CImpsGroupProp* pr = rIter; |
|
227 rIter++; |
|
228 delete pr; |
|
229 } |
|
230 |
|
231 iPrivateMessages = EImpsPropUndef; |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------- |
|
235 // CImpsGroupProps::IsPrivateAllowed |
|
236 // --------------------------------------------------------- |
|
237 // |
|
238 TImpsPropertyBool CImpsGroupProps::IsPrivateAllowed() const |
|
239 { |
|
240 return iPrivateMessages; |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------- |
|
244 // CImpsGroupProps::IsPrivateAllowed |
|
245 // --------------------------------------------------------- |
|
246 // |
|
247 void CImpsGroupProps::SetPrivateAllowed( TImpsPropertyBool aValue ) |
|
248 { |
|
249 iPrivateMessages = aValue; |
|
250 } |
|
251 |
|
252 |
|
253 /************ PRIVATE PROPS ********************************/ |
|
254 |
|
255 // --------------------------------------------------------- |
|
256 // CImpsCommonGroupProps::CImpsCommonGroupProps |
|
257 // --------------------------------------------------------- |
|
258 // |
|
259 EXPORT_C CImpsCommonGroupProps::CImpsCommonGroupProps() |
|
260 : CImpsGroupProps(), |
|
261 iAccessOpen( EImpsPropUndef), |
|
262 iTypePublic( EImpsPropUndef ), |
|
263 iSearchable( EImpsPropUndef ), |
|
264 iNbrActive(0), |
|
265 iMaxUsers(0), |
|
266 iName(NULL), |
|
267 iTopic(NULL), |
|
268 iWelcome(NULL), |
|
269 iAutoDelete( EImpsPropUndef ) |
|
270 { |
|
271 |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------- |
|
275 // CImpsCommonGroupProps::NewL |
|
276 // --------------------------------------------------------- |
|
277 // |
|
278 EXPORT_C CImpsCommonGroupProps* CImpsCommonGroupProps::NewL() |
|
279 { |
|
280 CImpsCommonGroupProps* self = new (ELeave) CImpsCommonGroupProps; |
|
281 CleanupStack::PushL( self ); |
|
282 self->ConstructL(); |
|
283 CleanupStack::Pop(); |
|
284 return self; |
|
285 } |
|
286 |
|
287 // --------------------------------------------------------- |
|
288 // CImpsCommonGroupProps::~CImpsCommonGroupProps |
|
289 // --------------------------------------------------------- |
|
290 // |
|
291 EXPORT_C CImpsCommonGroupProps::~CImpsCommonGroupProps() |
|
292 { |
|
293 Reset(); |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------- |
|
297 // CImpsCommonGroupProps::Reset |
|
298 // --------------------------------------------------------- |
|
299 // |
|
300 EXPORT_C void CImpsCommonGroupProps::Reset() |
|
301 { |
|
302 iAccessOpen = EImpsPropUndef; |
|
303 // iTypePublic = EImpsPropUndef; |
|
304 iSearchable = EImpsPropUndef; |
|
305 // iNbrActive = EImpsPropUndef; |
|
306 iMaxUsers = EImpsPropUndef; |
|
307 delete iName; |
|
308 iName = NULL; |
|
309 delete iTopic; |
|
310 iTopic = NULL; |
|
311 delete iWelcome; |
|
312 iWelcome = NULL; |
|
313 CImpsGroupProps::Reset(); |
|
314 } |
|
315 |
|
316 |
|
317 // --------------------------------------------------------- |
|
318 // CImpsCommonGroupProps::Type |
|
319 // --------------------------------------------------------- |
|
320 // |
|
321 EXPORT_C TImpsPropertyType CImpsCommonGroupProps::Type() const |
|
322 { |
|
323 return EImpsPropCommon; |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------- |
|
327 // CImpsCommonGroupProps::IsPrivateAllowed |
|
328 // --------------------------------------------------------- |
|
329 // |
|
330 EXPORT_C TImpsPropertyBool CImpsCommonGroupProps::IsPrivateAllowed() const |
|
331 { |
|
332 return CImpsGroupProps::IsPrivateAllowed(); |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------- |
|
336 // CImpsCommonGroupProps::SetPrivateAllowed |
|
337 // --------------------------------------------------------- |
|
338 // |
|
339 EXPORT_C void CImpsCommonGroupProps::SetPrivateAllowed( |
|
340 TImpsPropertyBool aValue ) |
|
341 { |
|
342 CImpsGroupProps::SetPrivateAllowed( aValue ); |
|
343 } |
|
344 |
|
345 // --------------------------------------------------------- |
|
346 // CImpsCommonGroupProps::IsOpen |
|
347 // --------------------------------------------------------- |
|
348 // |
|
349 EXPORT_C TImpsPropertyBool CImpsCommonGroupProps::IsOpen() const |
|
350 { |
|
351 return iAccessOpen; |
|
352 } |
|
353 |
|
354 // --------------------------------------------------------- |
|
355 // CImpsCommonGroupProps::SetOpen |
|
356 // --------------------------------------------------------- |
|
357 // |
|
358 EXPORT_C void CImpsCommonGroupProps::SetOpen( |
|
359 TImpsPropertyBool aValue ) |
|
360 { |
|
361 iAccessOpen = aValue; |
|
362 } |
|
363 |
|
364 |
|
365 // --------------------------------------------------------- |
|
366 // CImpsCommonGroupProps::IsPublic |
|
367 // --------------------------------------------------------- |
|
368 // |
|
369 EXPORT_C TImpsPropertyBool CImpsCommonGroupProps::IsPublic() const |
|
370 { |
|
371 return iTypePublic; |
|
372 } |
|
373 |
|
374 |
|
375 // --------------------------------------------------------- |
|
376 // CImpsCommonGroupProps::IsSearchable |
|
377 // --------------------------------------------------------- |
|
378 // |
|
379 EXPORT_C TImpsPropertyBool CImpsCommonGroupProps::IsSearchable() const |
|
380 { |
|
381 return iSearchable; |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------- |
|
385 // CImpsCommonGroupProps::SetSearchable |
|
386 // --------------------------------------------------------- |
|
387 // |
|
388 EXPORT_C void CImpsCommonGroupProps::SetSearchable( |
|
389 TImpsPropertyBool aValue ) |
|
390 { |
|
391 iSearchable = aValue; |
|
392 } |
|
393 |
|
394 |
|
395 // --------------------------------------------------------- |
|
396 // CImpsCommonGroupProps::NbrOfUsers |
|
397 // --------------------------------------------------------- |
|
398 // |
|
399 EXPORT_C TInt CImpsCommonGroupProps::NbrOfUsers() const |
|
400 { |
|
401 return iNbrActive; |
|
402 } |
|
403 |
|
404 // --------------------------------------------------------- |
|
405 // CImpsCommonGroupProps::MaxNbrOfUsers |
|
406 // --------------------------------------------------------- |
|
407 // |
|
408 EXPORT_C TInt CImpsCommonGroupProps::MaxNbrOfUsers() const |
|
409 { |
|
410 return iMaxUsers; |
|
411 } |
|
412 |
|
413 // --------------------------------------------------------- |
|
414 // CImpsCommonGroupProps::SetMaxNbrOfUsers |
|
415 // --------------------------------------------------------- |
|
416 // |
|
417 EXPORT_C void CImpsCommonGroupProps::SetMaxNbrOfUsers( |
|
418 TInt aValue ) |
|
419 { |
|
420 iMaxUsers = aValue; |
|
421 } |
|
422 |
|
423 |
|
424 // --------------------------------------------------------- |
|
425 // CImpsCommonGroupProps::GroupName |
|
426 // --------------------------------------------------------- |
|
427 // |
|
428 EXPORT_C TPtrC CImpsCommonGroupProps::GroupName() const |
|
429 { |
|
430 /*LDRA_NOANALYSIS*/ |
|
431 return iName ? TPtrC( *iName ) : TPtrC(); |
|
432 /*LDRA_ANALYSIS*/ |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------- |
|
436 // CImpsCommonGroupProps::SetGroupNameL |
|
437 // --------------------------------------------------------- |
|
438 // |
|
439 EXPORT_C void CImpsCommonGroupProps::SetGroupNameL( |
|
440 const TDesC& aName ) |
|
441 { |
|
442 HBufC* newAttrib = aName.AllocL(); |
|
443 delete iName; |
|
444 iName = newAttrib; |
|
445 } |
|
446 |
|
447 // --------------------------------------------------------- |
|
448 // CImpsCommonGroupProps::Topic |
|
449 // --------------------------------------------------------- |
|
450 // |
|
451 EXPORT_C TPtrC CImpsCommonGroupProps::Topic() const |
|
452 { |
|
453 /*LDRA_NOANALYSIS*/ |
|
454 return iTopic ? TPtrC( *iTopic ) : TPtrC(); |
|
455 /*LDRA_ANALYSIS*/ |
|
456 } |
|
457 |
|
458 // --------------------------------------------------------- |
|
459 // CImpsCommonGroupProps::SetTopicL |
|
460 // --------------------------------------------------------- |
|
461 // |
|
462 EXPORT_C void CImpsCommonGroupProps::SetTopicL( |
|
463 const TDesC& aTopic ) |
|
464 { |
|
465 HBufC* newAttrib = aTopic.AllocL(); |
|
466 delete iTopic; |
|
467 iTopic = newAttrib; |
|
468 } |
|
469 |
|
470 // --------------------------------------------------------- |
|
471 // CImpsCommonGroupProps::Welcome |
|
472 // --------------------------------------------------------- |
|
473 // |
|
474 EXPORT_C TPtrC CImpsCommonGroupProps::Welcome() const |
|
475 { |
|
476 /*LDRA_NOANALYSIS*/ |
|
477 return iWelcome ? TPtrC( *iWelcome ) : TPtrC(); |
|
478 /*LDRA_ANALYSIS*/ |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------- |
|
482 // CImpsCommonGroupProps::SetWelcomeL |
|
483 // --------------------------------------------------------- |
|
484 // |
|
485 EXPORT_C void CImpsCommonGroupProps::SetWelcomeL( |
|
486 const TDesC& aText ) |
|
487 { |
|
488 HBufC* newAttrib = aText.AllocL(); |
|
489 delete iWelcome; |
|
490 iWelcome = newAttrib; |
|
491 } |
|
492 // --------------------------------------------------------- |
|
493 // CImpsCommonGroupProps::AutoDelete |
|
494 // --------------------------------------------------------- |
|
495 // |
|
496 EXPORT_C TImpsPropertyBool CImpsCommonGroupProps::AutoDelete() const |
|
497 { |
|
498 return iAutoDelete; |
|
499 } |
|
500 // --------------------------------------------------------- |
|
501 // CImpsCommonGroupProps::SetAutoDelete |
|
502 // --------------------------------------------------------- |
|
503 // |
|
504 EXPORT_C void CImpsCommonGroupProps::SetAutoDelete( TImpsPropertyBool aValue ) |
|
505 { |
|
506 iAutoDelete = aValue; |
|
507 } |
|
508 /************ PRIVATE PROPS ********************************/ |
|
509 |
|
510 // --------------------------------------------------------- |
|
511 // CImpsPrivateGroupProps::CImpsPrivateGroupProps |
|
512 // --------------------------------------------------------- |
|
513 // |
|
514 EXPORT_C CImpsPrivateGroupProps::CImpsPrivateGroupProps() |
|
515 : CImpsGroupProps(), |
|
516 iMember( EImpsPropUndef ), |
|
517 iPrivilege( EImpsUserUndef ) |
|
518 { |
|
519 |
|
520 } |
|
521 |
|
522 // --------------------------------------------------------- |
|
523 // CImpsPrivateGroupProps::NewL |
|
524 // --------------------------------------------------------- |
|
525 // |
|
526 EXPORT_C CImpsPrivateGroupProps* CImpsPrivateGroupProps::NewL() |
|
527 { |
|
528 CImpsPrivateGroupProps* self = new (ELeave) CImpsPrivateGroupProps; |
|
529 |
|
530 CleanupStack::PushL( self ); |
|
531 self->ConstructL(); |
|
532 CleanupStack::Pop(); |
|
533 |
|
534 return self; |
|
535 } |
|
536 |
|
537 // --------------------------------------------------------- |
|
538 // CImpsPrivateGroupProps::~CImpsPrivateGroupProps |
|
539 // --------------------------------------------------------- |
|
540 // |
|
541 EXPORT_C CImpsPrivateGroupProps::~CImpsPrivateGroupProps() |
|
542 { |
|
543 |
|
544 } |
|
545 |
|
546 // Symbian OS default constructor can leave. |
|
547 void CImpsPrivateGroupProps::ConstructL() |
|
548 { |
|
549 Reset( ); |
|
550 } |
|
551 |
|
552 // --------------------------------------------------------- |
|
553 // CImpsPrivateGroupProps::Reset |
|
554 // --------------------------------------------------------- |
|
555 // |
|
556 EXPORT_C void CImpsPrivateGroupProps::Reset() |
|
557 { |
|
558 iMember = EImpsPropUndef; |
|
559 iPrivilege = EImpsUserUndef; |
|
560 CImpsGroupProps::Reset(); |
|
561 } |
|
562 |
|
563 // --------------------------------------------------------- |
|
564 // CImpsPrivateGroupProps::Type |
|
565 // --------------------------------------------------------- |
|
566 // |
|
567 EXPORT_C TImpsPropertyType CImpsPrivateGroupProps::Type() const |
|
568 { |
|
569 return EImpsPropPrivate; |
|
570 } |
|
571 |
|
572 // --------------------------------------------------------- |
|
573 // CImpsPrivateGroupProps::IsPrivateAllowed |
|
574 // --------------------------------------------------------- |
|
575 // |
|
576 EXPORT_C TImpsPropertyBool CImpsPrivateGroupProps::IsPrivateAllowed() const |
|
577 { |
|
578 return CImpsGroupProps::IsPrivateAllowed(); |
|
579 } |
|
580 |
|
581 // --------------------------------------------------------- |
|
582 // CImpsPrivateGroupProps::SetPrivateAllowed |
|
583 // --------------------------------------------------------- |
|
584 // |
|
585 EXPORT_C void CImpsPrivateGroupProps::SetPrivateAllowed( TImpsPropertyBool aValue ) |
|
586 { |
|
587 CImpsGroupProps::SetPrivateAllowed( aValue ); |
|
588 } |
|
589 |
|
590 // --------------------------------------------------------- |
|
591 // CImpsPrivateGroupProps::IsMember |
|
592 // --------------------------------------------------------- |
|
593 // |
|
594 EXPORT_C TImpsPropertyBool CImpsPrivateGroupProps::IsMember() const |
|
595 { |
|
596 return iMember; |
|
597 } |
|
598 |
|
599 |
|
600 // --------------------------------------------------------- |
|
601 // CImpsPrivateGroupProps::Privileges |
|
602 // --------------------------------------------------------- |
|
603 // |
|
604 EXPORT_C TImpsGroupUsers CImpsPrivateGroupProps::Privileges() const |
|
605 { |
|
606 return iPrivilege; |
|
607 } |
|
608 |
|
609 |
|
610 // EPOC default constructor can leave. |
|
611 void CImpsCommonGroupProps::ConstructL() |
|
612 { |
|
613 Reset( ); |
|
614 } |
|
615 |
|
616 |
|
617 |
|
618 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
619 |
|
620 |
|
621 // End of File |
|
622 |