1 /* |
|
2 * Copyright (c) 2008 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: service manager for a specific service |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CSERVICEWIDGETSERVICEMANAGER_H |
|
22 #define CSERVICEWIDGETSERVICEMANAGER_H |
|
23 |
|
24 #include <vwsdef.h> |
|
25 #include <e32base.h> |
|
26 #include "mservicewidgetobservers.h" |
|
27 #include "servicewidgetcpglobals.h" |
|
28 |
|
29 class CServiceWidgetContentPublisher; |
|
30 class CServiceWidgetPresenceHandler; |
|
31 class CServiceWidgetCchHandler; |
|
32 class CServiceWidgetMessageHandler; |
|
33 class CServiceWidgetTimer; |
|
34 class CCoeEnv; |
|
35 class CServiceWidgetBrandHandler; |
|
36 class MVIMPSTSettingsStore; |
|
37 /** |
|
38 * |
|
39 * content harvester plugin |
|
40 * layout Description of servicewidgetplugin and numbering of boxes |
|
41 * |
|
42 * ------------------------------------- |
|
43 * | 1 A | User ( Offline ) |offline| Text Row 1 |
|
44 * | V | 2 |icon 3 | |
|
45 * | A |---------------------------- |
|
46 |
|
47 * | T | n new message | if nothing display "click to online" |
|
48 * | AR | or n online friends 4 | Text Row 2 |
|
49 * ------------------------------------- |
|
50 * new message has higher priority than friends invite |
|
51 * friends invite has higher priority than n online user |
|
52 * any fried come online show for x second and go to back again |
|
53 * |
|
54 * @lib servicewidgetplugin |
|
55 * @since S60 3.2 |
|
56 */ |
|
57 |
|
58 class CServiceWidgetServiceManager : public CBase, |
|
59 public MServiceWidgetNewMessageObserver, |
|
60 public MServiceWidgetPresenceObserver, |
|
61 public MServiceWidgetServiceStateObserver, |
|
62 public MServiceWidgetTimerObserver |
|
63 { |
|
64 public: |
|
65 |
|
66 // to change priority , rearange this |
|
67 enum TIMWidgetContentPriority |
|
68 { |
|
69 EIMUknown = -1, // no priority |
|
70 EIMNewMessage = 0, // highest priority |
|
71 EIMFriendInvite, |
|
72 EIMPresence, // lowest priority |
|
73 }; |
|
74 |
|
75 |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 * @param aServiceId, a service id |
|
79 * @param aContentPublisher, content publisher reference |
|
80 * @param aSettingStore, reference to settings store |
|
81 * @return the instance of same class |
|
82 */ |
|
83 static CServiceWidgetServiceManager* NewL(TUint32 aServiceId, |
|
84 CServiceWidgetContentPublisher& aContentPublisher, |
|
85 MVIMPSTSettingsStore& aSettingStore ); |
|
86 |
|
87 |
|
88 /** |
|
89 * Standard C++ destructor |
|
90 */ |
|
91 ~CServiceWidgetServiceManager(); |
|
92 |
|
93 |
|
94 public : // new method |
|
95 |
|
96 |
|
97 /** |
|
98 * update the content in widgets |
|
99 */ |
|
100 void UpdateContentsL(); |
|
101 /** |
|
102 * Returns the service ID for which Service Manager is created |
|
103 */ |
|
104 TInt ServiceId(); |
|
105 |
|
106 /** |
|
107 * Unregisters widget when service is deleted |
|
108 */ |
|
109 void UnregisterWidgetL(); |
|
110 |
|
111 /** |
|
112 * Registers widget when service is installed |
|
113 */ |
|
114 void RegisterWidgetL(); |
|
115 |
|
116 /** |
|
117 * Returns the service Name for which Service Manager is created |
|
118 */ |
|
119 const TDesC& ServiceName(); |
|
120 |
|
121 /** |
|
122 * Intialize all objects once widget is Activated on Home Screen |
|
123 */ |
|
124 void ActivateWidgetL(TDesC& aInstId); |
|
125 /** |
|
126 * destroy all objects once widget is deactivated from Home Screen |
|
127 */ |
|
128 void DeactivateWidgetL(TDesC& aInstId); |
|
129 /** |
|
130 *Executes action based on iExecuteOperation |
|
131 */ |
|
132 |
|
133 void ExecuteActionL(); |
|
134 |
|
135 |
|
136 public : // MServiceWidgetContentPrioritizer |
|
137 /** |
|
138 * from MServiceWidgetNewMessageObserver |
|
139 * Gets called when data update is available as new messgae recieved. |
|
140 * Client can then decide wether to use the old one |
|
141 * or the updated one. |
|
142 * @param aSenderId, sender name |
|
143 * @param aMessageText, new message details |
|
144 */ |
|
145 void HandleNewMessageL(const TDesC& aSenderId , |
|
146 const TDesC& aMessageText ) ; |
|
147 |
|
148 /** |
|
149 * from MServiceWidgetNewMessageObserver |
|
150 * im cache call back |
|
151 * @param aState service state |
|
152 */ |
|
153 void HandleCountChangedL(); |
|
154 |
|
155 /** |
|
156 * from MServiceWidgetPresenceObserver |
|
157 * Handler for own status change notification |
|
158 */ |
|
159 void HandleOwnStatusChangeL(TWSPresenceStatus aStatus) ; |
|
160 |
|
161 /** |
|
162 * from MServiceWidgetPresenceObserver |
|
163 * Handler for AllBuddiesPresenceInService method of MPresenceCacheReader. |
|
164 * @param aErrorCode |
|
165 * @param aPresenceBuddyInfoList presence infos for all buddies requested. |
|
166 * Ownership to callee. Can be null if not found. |
|
167 */ |
|
168 void HandleChangeL() ; |
|
169 |
|
170 /** |
|
171 * from MServiceWidgetPresenceObserver |
|
172 * Handler for AllBuddiesPresenceInService method of MPresenceCacheReader. |
|
173 * @param aErrorCode |
|
174 * @param aPresenceBuddyInfoList presence infos for all buddies requested. |
|
175 * Ownership to callee. Can be null if not found. |
|
176 */ |
|
177 void HandleBuddyPresenceChangeL( const TDesC& aBuddyId, |
|
178 TWSPresenceStatus aStatus, |
|
179 const TDesC& aStatusText ); |
|
180 |
|
181 /** |
|
182 * from MServiceWidgetPresenceObserver |
|
183 * Gets called when data update is available as new messgae recieved. |
|
184 * Client can then decide wether to use the old one |
|
185 * or the updated one. |
|
186 * @param aSenderId, sender name |
|
187 * @param aMessageText, new message details |
|
188 */ |
|
189 void HandleAddRequestL(const TDesC& aRequesterId ) ; |
|
190 |
|
191 |
|
192 /** |
|
193 * from MServiceWidgetServiceStateObserver |
|
194 * Handler cch server |
|
195 * @param aState service state |
|
196 */ |
|
197 void HandleServiceStatusChangedL(TSWSTRegistrationState aState) ; |
|
198 |
|
199 /** |
|
200 * from MServiceWidgetTimerObserver |
|
201 * timer expiration call back |
|
202 * @param aState service state |
|
203 */ |
|
204 void HandleTimerExpiredL(); |
|
205 |
|
206 /** |
|
207 * WidgetSuspended |
|
208 * @param aIsWidgetSuspended True - widget is suspended on Homescreen |
|
209 * False - Widget is active |
|
210 */ |
|
211 void WidgetSuspended( TBool aIsWidgetSuspended ); |
|
212 |
|
213 |
|
214 private: |
|
215 /** |
|
216 * Constructor |
|
217 * @param aServiceId, a service id |
|
218 * @param aContentPublisher, content publisher reference |
|
219 * @param aSettingStore, reference to settings store |
|
220 */ |
|
221 CServiceWidgetServiceManager(TUint32 aServiceId, |
|
222 CServiceWidgetContentPublisher& aContentPublisher, |
|
223 MVIMPSTSettingsStore& aSettingStore ); |
|
224 |
|
225 /** |
|
226 * provides the two phase construction |
|
227 */ |
|
228 void ConstructL(); |
|
229 |
|
230 /** |
|
231 * load the resource file in memory for use |
|
232 */ |
|
233 void LoadResourceFileL(); |
|
234 |
|
235 |
|
236 /** |
|
237 * read and set the current data |
|
238 */ |
|
239 void SetCurrentTextDataL(); |
|
240 |
|
241 /** |
|
242 * create the second row data |
|
243 * @return created text : ownership transfer to caller |
|
244 */ |
|
245 HBufC* GetSecondRowDataLC() ; |
|
246 |
|
247 /** |
|
248 * create all handlers if service enable |
|
249 * delete all handlers if service loggedoff |
|
250 * @param aState service state |
|
251 */ |
|
252 void CreateHandlersL(); |
|
253 |
|
254 |
|
255 /** |
|
256 * reset the priority to zero |
|
257 */ |
|
258 inline void ResetPriority() |
|
259 { |
|
260 iPriority = 0 ; |
|
261 } |
|
262 |
|
263 |
|
264 private : |
|
265 // owns : service id |
|
266 TInt iServiceId; |
|
267 //not owns : Publisher client |
|
268 CServiceWidgetContentPublisher& iContentPublisher; |
|
269 //not owns : settings store |
|
270 MVIMPSTSettingsStore& iSettingStore; |
|
271 // owns : cch handler |
|
272 CServiceWidgetCchHandler* iCchHandler; |
|
273 // owns : presence handler |
|
274 CServiceWidgetPresenceHandler* iPresenceHandler; |
|
275 // owns : message handler |
|
276 CServiceWidgetMessageHandler* iMessageHandler; |
|
277 // owns : current priority for second row box |
|
278 TInt iPriority; |
|
279 // owns : service state |
|
280 TSWSTRegistrationState iServiceState; |
|
281 // owns : timer |
|
282 CServiceWidgetTimer* iWidgetTimer; |
|
283 // owns : |
|
284 TSWAExecuteOperation iExecuteOperation; |
|
285 //owns : brand icons |
|
286 CServiceWidgetBrandHandler* iBrandHandler; |
|
287 // Not owns : A static CEikonEnv |
|
288 CCoeEnv* iEnv; |
|
289 //tabview id for the service |
|
290 TInt iServiceviewId; |
|
291 //owns : service Name |
|
292 HBufC* iServiceName; |
|
293 // ETrue if widget is suspended |
|
294 TBool iIsWidgetSuspended; |
|
295 |
|
296 //Widget InstanceId |
|
297 HBufC* iInstId; |
|
298 // Service tab UID from spsettings |
|
299 TInt iServiceTabUid; |
|
300 }; |
|
301 |
|
302 #endif // CSERVICEWIDGETSERVICEMANAGER_H |
|
303 |
|
304 |
|
305 // End of File |
|