|
1 /* |
|
2 * Copyright (c) 2002-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: Defines the public client side interface class to access the |
|
15 Skin Server and the skin change observer class to listen for |
|
16 skin changes in the system. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef AKNSSRVCLIENT_H |
|
22 #define AKNSSRVCLIENT_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <badesca.h> |
|
27 #include <AknsItemDef.h> |
|
28 #include <AknsItemID.h> |
|
29 #include <AknsSrvSkinInformationPkg.h> |
|
30 |
|
31 #include "AknsSrvChunkLookup.h" |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 /** |
|
36 * Reasons for panicing client thread. |
|
37 * |
|
38 * @since 2.0 |
|
39 */ |
|
40 enum TAknSkinSrvPanic |
|
41 { |
|
42 EAknsSrvBadRequest = 0, |
|
43 EAknsSrvNotConnected = 2, |
|
44 EAknsSrvNotifyHandlerMissing = 3, |
|
45 EAknsSrvNoActiveScheduler = 4, |
|
46 EAknsSrvCannotCreateSharedChunk = 6, |
|
47 EAknsSrvBadAlignment = 8, |
|
48 EAknsSrvFatalMergeFailure = 10, |
|
49 EAknsSrvCannotAdjustChunk = 12, |
|
50 EAknsSrvTooManyItemDefs = 14, |
|
51 EAknsSrvCannotRestoreDefaults = 16, |
|
52 EAknsSrvNotifyListImbalance = 18, |
|
53 EAknsSrvInvalidMessageHandle = 20, |
|
54 EAknsSrvInvalidBuildConf = 22, |
|
55 EAknsSrvFatalDRMFailure = 24 |
|
56 }; |
|
57 |
|
58 enum TAknsSrvInifileType |
|
59 { |
|
60 EAknsSrvInifileSSWP, |
|
61 EAknsSrvInifileSSSS, |
|
62 }; |
|
63 |
|
64 enum TAknsSrcScreenMode |
|
65 { |
|
66 EAknsSrcScrModeNone = 0, |
|
67 EAknsSrvScrModePortrait = 1, |
|
68 EAknsSrvScrModeLandscape = 2, |
|
69 EAknsSrvScrModeSquare = 3 |
|
70 }; |
|
71 |
|
72 /** |
|
73 * Skin server panic category string. |
|
74 * |
|
75 * @since 2.0 |
|
76 */ |
|
77 _LIT( KAknSkinSrvPanicCategory, "AknSkinServer" ); |
|
78 |
|
79 /** |
|
80 * Enumeration of skin item definition classes. |
|
81 * |
|
82 * @since 2.0 |
|
83 */ |
|
84 enum TAknsItemDefClass |
|
85 { |
|
86 /** |
|
87 * Skin item definition class enumeration value for bitmaps, |
|
88 * including layout backgrounds but excluding application icons. |
|
89 */ |
|
90 EAknsItemDefClassBitmaps = 1, |
|
91 |
|
92 /** |
|
93 * Skin item definition class enumeration value for application icons. |
|
94 */ |
|
95 EAknsItemDefClassAppIcons = 2, |
|
96 |
|
97 /** |
|
98 * Skin item definition class enumeration value for color sets. |
|
99 */ |
|
100 EAknsItemDefClassColorSets = 4 |
|
101 }; |
|
102 |
|
103 /** |
|
104 * Skin package change reason codes used by |
|
105 * @c MAknsSkinChangeObserver::SkinPackageChanged |
|
106 * |
|
107 * @since 2.5 |
|
108 */ |
|
109 enum TAknsSkinStatusPackageChangeReason |
|
110 { |
|
111 /** |
|
112 * Enumeration value that indicates change in skin package list. |
|
113 * |
|
114 * @since 2.5 |
|
115 */ |
|
116 EAknsSkinStatusPackageListUpdate = 1 |
|
117 }; |
|
118 |
|
119 /** |
|
120 * Skin configuration change reason codes used by |
|
121 * @c MAknsSkinChangeObserver::SkinConfigurationChanged |
|
122 * |
|
123 * @since 2.5 |
|
124 */ |
|
125 enum TAknsSkinStatusConfigurationChangeReason |
|
126 { |
|
127 /** |
|
128 * Enumeration value that indicates completion of skin content merge, |
|
129 * i.e. the new configuration is available for reading. |
|
130 * |
|
131 * @since 2.5 |
|
132 */ |
|
133 EAknsSkinStatusConfigurationMerged = 1, |
|
134 |
|
135 /** |
|
136 * Enumeration value that indicates completion of event propagation |
|
137 * to clients, i.e. the new configuration has been deployed to |
|
138 * the registered clients. |
|
139 * |
|
140 * @since 2.5 |
|
141 */ |
|
142 EAknsSkinStatusConfigurationDeployed = 2, |
|
143 |
|
144 /** |
|
145 * Enumeration value that indicates unsuccessful completion of |
|
146 * skin activation because of an out-of-memory condition. |
|
147 * |
|
148 * @since 2.5 |
|
149 */ |
|
150 EAknsSkinStatusConfigurationFailedOOM = 3, |
|
151 |
|
152 /** |
|
153 * Enumeration value that indicates unsuccessful completion of |
|
154 * skin activation because of a corrupted skin package. |
|
155 * |
|
156 * @since 2.5 |
|
157 */ |
|
158 EAknsSkinStatusConfigurationFailedCorrupt = 4, |
|
159 /** |
|
160 * Enumeration value that indicates a change in the |
|
161 * state of the morphing skin items |
|
162 * |
|
163 * @since 3.0 |
|
164 */ |
|
165 EAknsSkinStatusMorphingStateChange = 5, |
|
166 EAknsSkinStatusWallpaperChanged = 6, |
|
167 |
|
168 /** |
|
169 * Enumeration value that indicates a change in the |
|
170 * state of animation Background |
|
171 * |
|
172 * @since 5.2 |
|
173 */ |
|
174 EAknsSkinStatusAnimBackgroundChanged = 7, |
|
175 |
|
176 EAknsSkinStatusSlideSetWallpaperChanged = 8 |
|
177 |
|
178 }; |
|
179 |
|
180 // CONSTANTS |
|
181 |
|
182 _LIT( KAknsSrvRAMBitmapName, "RAM:BmpHandle"); |
|
183 |
|
184 // CLASS DECLARATION |
|
185 |
|
186 /** |
|
187 * An user implementable interface class to handle the skin change |
|
188 * notifications. |
|
189 * |
|
190 * @since 2.0 |
|
191 */ |
|
192 class MAknsSkinChangeObserver |
|
193 { |
|
194 public: |
|
195 |
|
196 /** |
|
197 * Called by the skin server when skin content is changed and the |
|
198 * connected client wants to be informed. |
|
199 * |
|
200 * @since 2.0 |
|
201 */ |
|
202 virtual void SkinContentChanged() = 0; |
|
203 |
|
204 /** |
|
205 * Called by the skin server to indicate that the current skin |
|
206 * configuration has changed. |
|
207 * |
|
208 * @param aReason Reason code. |
|
209 * |
|
210 * @since 2.5 |
|
211 */ |
|
212 virtual void SkinConfigurationChanged( |
|
213 const TAknsSkinStatusConfigurationChangeReason aReason ) = 0; |
|
214 |
|
215 /** |
|
216 * Called by the skin server to indicate that the available |
|
217 * skin packages have changed. |
|
218 * |
|
219 * @param aReason Reason code. |
|
220 * |
|
221 * @since 2.5 |
|
222 */ |
|
223 virtual void SkinPackageChanged( |
|
224 const TAknsSkinStatusPackageChangeReason aReason ) = 0; |
|
225 |
|
226 /** |
|
227 * Called by the skin server to ask for local cache cleanup. |
|
228 * |
|
229 * @since 3.1 |
|
230 * |
|
231 */ |
|
232 virtual void FlushLocalCaches() {}; |
|
233 }; |
|
234 |
|
235 // FORWARD DECLARATIONS |
|
236 |
|
237 class CAknsSkinChangeHandler; |
|
238 struct TAknsSrvClientMemberData; |
|
239 |
|
240 // CLASS DECLARATION |
|
241 |
|
242 /** |
|
243 * The client side interface class for the skins server |
|
244 * Provides functionality to change the system skin, to retrieve skin content |
|
245 * definitions from the server and to listen for skin change events. |
|
246 * |
|
247 * @lib AknSkinSrv.lib |
|
248 * |
|
249 * @since 2.0 |
|
250 */ |
|
251 class RAknsSrvSession : public RSessionBase |
|
252 { |
|
253 public: |
|
254 |
|
255 /** |
|
256 * C++ default constructor. |
|
257 */ |
|
258 IMPORT_C RAknsSrvSession(); |
|
259 |
|
260 /** |
|
261 * Starts the server if it's not allready started and creates a new |
|
262 * session. |
|
263 * |
|
264 * @since 2.0 |
|
265 * |
|
266 * @param aObserver Skin change observer. |
|
267 * @param aPriority Observer priority. |
|
268 * |
|
269 * @return KErrNone if connection was succesfull, or otherwise one of |
|
270 * the standard system wide error codes. |
|
271 */ |
|
272 IMPORT_C TInt Connect( MAknsSkinChangeObserver* aObserver = NULL, |
|
273 TInt aPriority = CActive::EPriorityStandard ); |
|
274 |
|
275 /** |
|
276 * Closes the session. |
|
277 * |
|
278 * @since 2.0 |
|
279 * |
|
280 */ |
|
281 IMPORT_C void Close(); //lint !e1511 Hiding allowed |
|
282 |
|
283 /** |
|
284 * Enables the servers skin change notifications mechanism. If the skin |
|
285 * definitions have changed, or there are pending notification events, |
|
286 * SkinContentChanged() is called for all sessions. |
|
287 * The function affects all sessions. |
|
288 * |
|
289 * @since 2.0 |
|
290 * |
|
291 */ |
|
292 IMPORT_C void EnableSkinChangeNotify(); |
|
293 |
|
294 |
|
295 /** |
|
296 * Disables the servers skin change notification mechanism. After this |
|
297 * call no notification events are generated until a subsequent |
|
298 * EnableSkinChangeNotify() is called. The function affects all sessions. |
|
299 * |
|
300 * @since 2.0 |
|
301 * |
|
302 */ |
|
303 IMPORT_C void DisableSkinChangeNotify(); |
|
304 |
|
305 /** |
|
306 * Notifies the server that the skin client has encountered an error |
|
307 * while doing a skin change. After this call the server falls back to |
|
308 * the system default skin and ignores any calls to this funcion to |
|
309 * avoid infite loop. |
|
310 * |
|
311 * @since 2.0 |
|
312 * |
|
313 * @param aErrorCode Error code. |
|
314 */ |
|
315 IMPORT_C void ClientError(TInt aErrorCode = 0); |
|
316 |
|
317 /** |
|
318 * Sets all the active item definition sets (including all the classes). |
|
319 * Item definition sets of the skin with the given package ID are |
|
320 * activated and clients are notified about the skin change. |
|
321 * |
|
322 * @since 2.0 |
|
323 * |
|
324 * @param aPID Package ID of the skin to be activated. |
|
325 * |
|
326 * @return KErrNone if succesfull or one of the system wide error codes. |
|
327 */ |
|
328 IMPORT_C TInt SetAllDefinitionSets( const TAknsPkgID aPID ); |
|
329 |
|
330 /** |
|
331 * Retrieves skin information for all the available skins packages |
|
332 * in specified location. After a call to this function, the ownewship |
|
333 * of the array and the items in it is transferred to the caller. |
|
334 * |
|
335 * @since 2.0 |
|
336 * |
|
337 * @param aLocation the location from where to look for the skin |
|
338 * packages. Default value is phone (i.e., c and z drives). |
|
339 * |
|
340 * @return A pointer to an array containing pointers to |
|
341 * CAknsSrvSkinInformationPkg instances, or an empty array if no skin |
|
342 * packages were found in the specified location. If the same skin |
|
343 * was found multiple times, only the first match is included in the |
|
344 * array. |
|
345 * |
|
346 * @par Exceptions: |
|
347 * If enumeration failed, method leaves with an error code. |
|
348 */ |
|
349 IMPORT_C CArrayPtr<CAknsSrvSkinInformationPkg>* |
|
350 EnumerateSkinPackagesL( |
|
351 TAknSkinSrvSkinPackageLocation aLocation = EAknsSrvPhone ); |
|
352 |
|
353 /** |
|
354 * Creates a chunk lookup object. |
|
355 * |
|
356 * @since 2.0 |
|
357 * |
|
358 * @return Newly created chunk lookup object. |
|
359 * |
|
360 * @par Exceptions: |
|
361 * If construction fails, method leaves with an error code. |
|
362 */ |
|
363 IMPORT_C CAknsSrvChunkLookup* CreateChunkLookupL(); |
|
364 |
|
365 /** |
|
366 * Sets the idle state wallpaper. |
|
367 * |
|
368 * @since 2.0 |
|
369 * |
|
370 * @param aFilename a fully qualified path(incl. path + filename) |
|
371 * to the mbm file containing the wallpaper |
|
372 * @param aIndex the index of the bitmap in the mbm file |
|
373 * @param aMaskIndex the index of the mask bitmap in the mbm file |
|
374 * |
|
375 * @return If the call fails, one of the system wide error codes is |
|
376 * returned. |
|
377 */ |
|
378 IMPORT_C TInt SetIdleWallpaper(const TDesC& aFilename); |
|
379 |
|
380 /** |
|
381 * Stores a duplicate of the given bitmap (optionally with mask). |
|
382 * |
|
383 * @param aIID Item ID used as a key. |
|
384 * |
|
385 * @param aType Layout type used as a key. |
|
386 * |
|
387 * @param aBmp Pointer to a bitmap. Must be non-NULL. No ownership |
|
388 * is transferred. |
|
389 * |
|
390 * @param aMask Pointer to a mask, or @c NULL. No ownership is |
|
391 * transferred. |
|
392 * |
|
393 * @since 2.8 |
|
394 */ |
|
395 IMPORT_C TInt StoreScalableGraphics(const TAknsItemID& aIID, |
|
396 const TInt aType, const TSize& aLayoutSize, const CFbsBitmap* aBmp, |
|
397 const CFbsBitmap* aMask, TBool aMorphing = EFalse ); |
|
398 |
|
399 /** |
|
400 * Instructs the server to cleanup any stored layout bitmaps. |
|
401 * |
|
402 * @return Error code. |
|
403 * |
|
404 * @since 2.8 |
|
405 */ |
|
406 IMPORT_C TInt ClearScalableGraphics(); |
|
407 |
|
408 /** |
|
409 * Acknowledges the skin change notification. |
|
410 * |
|
411 * @return Error code. |
|
412 * |
|
413 * @since 2.7 |
|
414 */ |
|
415 TInt AcknowledgeSkinChangeNotification(); |
|
416 |
|
417 IMPORT_C TInt DeleteSkin(const TAknsPkgID aPID, TAknSkinSrvSkinPackageLocation aLocation ); |
|
418 IMPORT_C TInt CopySkin(const TAknsPkgID aPID, TAknSkinSrvSkinPackageLocation aSourceLocation, TAknSkinSrvSkinPackageLocation aDestLocation); |
|
419 IMPORT_C TInt OpenBitmapFile( const TDesC& aFilename, TInt &aFileHandle); |
|
420 IMPORT_C TInt OpenInifile(const TAknsPkgID aPID, TAknSkinSrvSkinPackageLocation aLocation, TInt& aFilehandle, TBool aWriteToFile); |
|
421 IMPORT_C TInt CopySoundFile(const TDesC& aSourceFilename, const TDesC& aTargetFilename); |
|
422 IMPORT_C void DecodeWallpaperImageL(const TDesC& aFilename, const TSize& aTargetSize, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask); |
|
423 IMPORT_C TInt OpenImageInifile(TAknsSrvInifileType aType, TInt& aFilehandle); |
|
424 IMPORT_C TInt SetSlideSetWallpaper(const CDesCArray& aFilenameArray); |
|
425 #if defined(RD_SLIDESHOW_WALLPAPER) |
|
426 void DoWriteInifileL(const CDesCArray& aFilenameArray); |
|
427 #endif |
|
428 IMPORT_C void FreeUnnecessaryLayoutBitmaps(TAknsSrcScreenMode aMode); |
|
429 |
|
430 /* |
|
431 * Checks if AppArc has been configured using CenRep for this application UID. If so, skinned icon graphics are NOT |
|
432 * created when calling AknsUtils::CreateAppIconLC. Instead, configured icon (which is defined in the |
|
433 * AppArc's CenRep file) is used. Note that icon configuration can wary depending on active language. |
|
434 * |
|
435 * @since 5.0 |
|
436 * |
|
437 * @param aAppUid - Application UID of application to be checked. |
|
438 * @return zero, if no cenrep-based configuration is used. |
|
439 * Non-zero is returned, if application UID is configured using AppArc's CenRep file. |
|
440 */ |
|
441 IMPORT_C TInt CheckIconConfiguration( TUid aAppUid ); |
|
442 |
|
443 /** |
|
444 * Add one wallpaper. |
|
445 * |
|
446 * @param aFilename a fully qualified path(incl. path + filename) |
|
447 * of the wallpaper |
|
448 * @param aTargetSize - Decoded size. |
|
449 * if not set, Both portait and landscape(base on screen size) will be decoded. |
|
450 */ |
|
451 IMPORT_C void AddWallpaperL( const TDesC& aFilename, const TSize& aTargetSize ); |
|
452 |
|
453 /** |
|
454 * Remove one decoded wallpaper. |
|
455 * |
|
456 * @param aFilename a fully qualified path(incl. path + filename) |
|
457 * of the wallpaper |
|
458 */ |
|
459 IMPORT_C void RemoveWallpaper( const TDesC& aFilename ); |
|
460 |
|
461 /** |
|
462 * Remove all decoded wallpaper. |
|
463 */ |
|
464 IMPORT_C void RemoveAllWallpapers( ); |
|
465 |
|
466 /** |
|
467 * Get a decoded wallpaper. |
|
468 */ |
|
469 IMPORT_C CFbsBitmap* WallpaperImageL( const TDesC& aFilename ); |
|
470 |
|
471 private: // Reserved exports |
|
472 |
|
473 /** |
|
474 * Reserved for future use. |
|
475 * |
|
476 * @since 2.0 |
|
477 * |
|
478 * @return Always returns zero. |
|
479 */ |
|
480 IMPORT_C TInt Reserved1(); |
|
481 |
|
482 /** |
|
483 * Reserved for future use. |
|
484 * |
|
485 * @since 2.0 |
|
486 * |
|
487 * @return Always returns zero. |
|
488 */ |
|
489 IMPORT_C TInt Reserved2(); |
|
490 |
|
491 /** |
|
492 * Reserved for future use. |
|
493 * |
|
494 * @since 2.0 |
|
495 * |
|
496 * @return Always returns zero. |
|
497 */ |
|
498 IMPORT_C TInt Reserved3(); |
|
499 |
|
500 /** |
|
501 * Reserved for future use. |
|
502 * |
|
503 * @since 2.0 |
|
504 */ |
|
505 IMPORT_C void Reserved4(); |
|
506 |
|
507 private: |
|
508 |
|
509 /** |
|
510 * Gets the server version. |
|
511 */ |
|
512 TVersion Version() const; |
|
513 |
|
514 /** |
|
515 * Cancels send operation. |
|
516 */ |
|
517 void SendCancel(); |
|
518 |
|
519 /** |
|
520 * Completes event handling. |
|
521 */ |
|
522 void EventHandled(); |
|
523 |
|
524 private: // Data |
|
525 |
|
526 // Holds member variables of this class. |
|
527 TAknsSrvClientMemberData* iMemberData; |
|
528 |
|
529 private: // Friend classes |
|
530 friend class CAknsSkinChangeHandler; |
|
531 |
|
532 }; |
|
533 |
|
534 #endif // AKNSSRVCLIENT_H |
|
535 |
|
536 // End of File |