|
1 /* |
|
2 * Copyright (c) 2006 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: Presence Service Connection group member subscription implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPSCGROUPCONTENTSUBSCRIPTIONITEM_H |
|
19 #define CPSCGROUPCONTENTSUBSCRIPTIONITEM_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "presenceinfoimp.h" |
|
23 #include "ximpsubscriptionitembase.h" |
|
24 #include "presencetypehelpers.h" |
|
25 |
|
26 class MXIMPItemParentBase; |
|
27 class MXIMPPscContext; |
|
28 class CDesC16Array; |
|
29 class MXIMPIdentity; |
|
30 class CXIMPIdentityImp; |
|
31 class MGroupContentEventObserver; |
|
32 |
|
33 /** |
|
34 * PSC group list subscription implementation |
|
35 * |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 class CGroupContentSubscriptionItem : public CXIMPSubscriptionItemBase |
|
39 { |
|
40 |
|
41 public: // Construction and destruction |
|
42 |
|
43 /** |
|
44 * Construction |
|
45 * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. |
|
46 */ |
|
47 static CGroupContentSubscriptionItem* NewLC( MXIMPItemParentBase& aParent, |
|
48 const CXIMPIdentityImp& aGroupId ); |
|
49 |
|
50 /** |
|
51 * Destruction |
|
52 * - Remember to inform parent about delete. |
|
53 */ |
|
54 virtual ~CGroupContentSubscriptionItem(); |
|
55 |
|
56 private: // Construction and destruction |
|
57 |
|
58 /** |
|
59 * Construction |
|
60 * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. |
|
61 */ |
|
62 CGroupContentSubscriptionItem( MXIMPItemParentBase& aParent ); |
|
63 |
|
64 /** |
|
65 * Construction |
|
66 */ |
|
67 void ConstructL( const CXIMPIdentityImp& aGroupId ); |
|
68 |
|
69 public: // New methods |
|
70 |
|
71 /** |
|
72 * Add subscriber for group content if it hasn't subscribed already. |
|
73 * @param aContext. Context to be added. |
|
74 */ |
|
75 IMPORT_C void AddOrRenewSubscriberL( MXIMPPscContext* aContext ); |
|
76 |
|
77 /** |
|
78 * Set the new list of members. Will create and set |
|
79 * the temporary lists for added, removed and updated lists. |
|
80 * Ownership is transferred! |
|
81 * @param aMemberList The list of groups |
|
82 */ |
|
83 IMPORT_C void SetNewListL( RPrGrpMemInfoImpArray* aMemberList ); |
|
84 |
|
85 /** |
|
86 * Set the added list of members. |
|
87 * Ownership is transferred! |
|
88 * @param aMemberList The list of groups |
|
89 */ |
|
90 IMPORT_C void SetAddedListL( RPrGrpMemInfoImpArray* aMemberList ); |
|
91 |
|
92 /** |
|
93 * Set the removed list of members. Will set |
|
94 * other lists accordingly. |
|
95 * Ownership is transferred! |
|
96 * @param aMemberList The list of groups |
|
97 */ |
|
98 IMPORT_C void SetRemovedListL( RPrGrpMemInfoImpArray* aMemberList ); |
|
99 |
|
100 /** |
|
101 * Used as method for TLinearOrder when ordering items. |
|
102 * @param aA First object for ordering. |
|
103 * @param aB Second object for ordering. |
|
104 * @return Order of params like compare function( -1 0 1 ) |
|
105 */ |
|
106 IMPORT_C static TInt Order( const CGroupContentSubscriptionItem& aA, |
|
107 const CGroupContentSubscriptionItem& aB ); |
|
108 |
|
109 /** |
|
110 * Used as method for TLinearOrder when ordering items. |
|
111 * @param aA First object used as key for ordering. |
|
112 * @param aB Second object for ordering. |
|
113 * @return Order of params like compare function( -1 0 1 ) |
|
114 */ |
|
115 IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, |
|
116 const CGroupContentSubscriptionItem& aB ); |
|
117 |
|
118 /** |
|
119 * Access to group id. |
|
120 * @return Group id. |
|
121 */ |
|
122 IMPORT_C const CXIMPIdentityImp& GroupId() const; |
|
123 |
|
124 /** |
|
125 * Remove the temporary lists. |
|
126 */ |
|
127 IMPORT_C void Clean(); |
|
128 |
|
129 /** |
|
130 * Check if group member exists. |
|
131 * @param aMemberInfo Group member to check |
|
132 * @return ETrue if group member exists. EFalse if not. |
|
133 */ |
|
134 IMPORT_C TBool GroupMemberExistsL( CPresentityGroupMemberInfoImp& aMemberInfo ) const; |
|
135 |
|
136 /** |
|
137 * Check if group member is updated. |
|
138 * @param aMemberInfo Group member to check |
|
139 * @return ETrue if group member updated. EFalse if not. |
|
140 */ |
|
141 IMPORT_C TBool IsGroupMemberUpdatedL( CPresentityGroupMemberInfoImp& aMemberInfo ) const; |
|
142 |
|
143 public: // Methods for accessing array of current members |
|
144 |
|
145 /** |
|
146 * Count of current members |
|
147 * @return Count of current members |
|
148 */ |
|
149 TInt MemberCount() const; |
|
150 |
|
151 /** |
|
152 * Access member in index. |
|
153 * @param aIndex. Index of group member info to get. |
|
154 * @return Group member info from index. |
|
155 */ |
|
156 CPresentityGroupMemberInfoImp& MemberAt( TInt aIndex ); |
|
157 |
|
158 /** |
|
159 * Register event observer |
|
160 * @param aEvent Observer New observer to observe events. |
|
161 */ |
|
162 void RegisterEventObserverL( MGroupContentEventObserver* aEventObserver ); |
|
163 |
|
164 /** |
|
165 * Unregister event observer |
|
166 * @param aEventObserver Canceling observer. |
|
167 */ |
|
168 void UnregisterEventObserver( MGroupContentEventObserver* aEventObserver ); |
|
169 |
|
170 public: // From MXIMPSubscriptionItem |
|
171 |
|
172 /** |
|
173 * @see MXIMPSubscriptionItem |
|
174 */ |
|
175 void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); |
|
176 |
|
177 /** |
|
178 * @see MXIMPSubscriptionItem |
|
179 */ |
|
180 void SynthesiseSubscriptionEventToAllCtxsL(); |
|
181 |
|
182 private: // From CXIMPSubscriptionItemBase |
|
183 |
|
184 /** |
|
185 * @see CXIMPSubscriptionItemBase |
|
186 */ |
|
187 void CleanExpired(); |
|
188 |
|
189 private: // Helper methods |
|
190 |
|
191 /** |
|
192 * Inform observer about change. |
|
193 */ |
|
194 void InformObserversL(); |
|
195 |
|
196 private: // Data |
|
197 |
|
198 /** |
|
199 * Group identity |
|
200 * Own. |
|
201 */ |
|
202 CXIMPIdentityImp* iGroupId; |
|
203 |
|
204 /** |
|
205 * Current members. |
|
206 * Own. |
|
207 */ |
|
208 RPrGrpMemInfoImpArray* iCurrentMembers; |
|
209 |
|
210 /** |
|
211 * List of added members (new since last update). |
|
212 * Own. |
|
213 */ |
|
214 RPrGrpMemInfoImpArray* iAdded; |
|
215 |
|
216 /** |
|
217 * List of removed members (removed since last update). |
|
218 * Own. |
|
219 */ |
|
220 RPrGrpMemInfoImpArray* iRemoved; |
|
221 |
|
222 /** |
|
223 * List of updated members (same as in last update). |
|
224 * Own. |
|
225 */ |
|
226 RPrGrpMemInfoImpArray* iUpdated; |
|
227 |
|
228 /** |
|
229 * Event observers of subscription item. |
|
230 */ |
|
231 RPointerArray< MGroupContentEventObserver > iEventObservers; |
|
232 }; |
|
233 |
|
234 |
|
235 /* ======================================================================== */ |
|
236 |
|
237 |
|
238 |
|
239 #endif // CPSCGROUPCONTENTSUBSCRIPTIONITEM_H |