|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // apsiconcaptionoverride.h |
|
15 // |
|
16 |
|
17 #ifndef __APSICONCAPTIONOVERRIDE_H__ |
|
18 #define __APSICONCAPTIONOVERRIDE_H__ |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <e32hashtab.h> |
|
22 |
|
23 |
|
24 class CRepository; |
|
25 class CApaIconCaptionOverrideStore; |
|
26 |
|
27 /** |
|
28 Exposes access to an application's configuration information to the Apparc Server. |
|
29 |
|
30 Retrieves the caption, icon information from the store (CApaIconCaptionOverrideStore). |
|
31 |
|
32 Reads the configuration information with reference to the language downgrade path, with |
|
33 ELangNone used as the default language, if no better match is found. |
|
34 |
|
35 @internalComponent |
|
36 @see CApaIconCaptionOverrideStore |
|
37 */ |
|
38 NONSHARABLE_CLASS(TApaIconCaptionOverrideReader) |
|
39 { |
|
40 public: |
|
41 TApaIconCaptionOverrideReader(const CApaIconCaptionOverrideStore& aStore, const RArray<TLanguage>& aLanguageDowngradePath); |
|
42 const TDesC* ShortCaption() const; |
|
43 const TDesC* Caption() const; |
|
44 TBool NumIconsSet() const; |
|
45 TInt NumIcons() const; |
|
46 const TDesC* IconFileName() const; |
|
47 |
|
48 private: |
|
49 const TDesC* GetString(TUint32 aFieldId) const; |
|
50 const TInt* GetInt(TUint32 aFieldId) const; |
|
51 |
|
52 private: |
|
53 const CApaIconCaptionOverrideStore& iStore; |
|
54 const RArray<TLanguage>& iLanguageDowngradePath; |
|
55 }; |
|
56 |
|
57 /** |
|
58 Stores the icon and caption overrides for an application. |
|
59 |
|
60 @internalComponent |
|
61 */ |
|
62 NONSHARABLE_CLASS(CApaIconCaptionOverridesForApp) : public CBase |
|
63 { |
|
64 public: |
|
65 static CApaIconCaptionOverridesForApp* NewL(); |
|
66 ~CApaIconCaptionOverridesForApp(); |
|
67 CApaIconCaptionOverridesForApp(); |
|
68 void ConstructL(); |
|
69 |
|
70 void LoadFromCenRepL(CRepository* aRepository, TUint32 aAppKey); |
|
71 TApaIconCaptionOverrideReader Reader(const RArray<TLanguage>& aLanguageDowngradePath) const; |
|
72 |
|
73 private: |
|
74 CApaIconCaptionOverrideStore* iStore; |
|
75 }; |
|
76 |
|
77 /** |
|
78 Stores the icon and caption override data indexed by application UID. |
|
79 Keeps a map of app UIDs to configuration information for that application. |
|
80 |
|
81 @internalComponent |
|
82 */ |
|
83 NONSHARABLE_CLASS(CApaIconCaptionOverrides) : public CBase |
|
84 { |
|
85 public: |
|
86 CApaIconCaptionOverrides(); |
|
87 ~CApaIconCaptionOverrides(); |
|
88 |
|
89 void LoadFromCenRepL(); |
|
90 void LoadFromCenRepL(CRepository* aRepository); |
|
91 |
|
92 CApaIconCaptionOverridesForApp* OverrideForApp(TUid aAppUid) const; |
|
93 void SetOverrideForAppL(TUid aAppUid, CApaIconCaptionOverridesForApp* aOverrides); // takes ownership aOverrides |
|
94 |
|
95 private: |
|
96 void DeleteOverrides(); |
|
97 |
|
98 private: |
|
99 typedef RHashMap<TInt, CApaIconCaptionOverridesForApp*> RAppOverrideMap; |
|
100 RAppOverrideMap iMap; |
|
101 }; |
|
102 |
|
103 /** |
|
104 Watches for changes in the Central Repositiory and update the overrides when they occur. |
|
105 |
|
106 @internalComponent |
|
107 */ |
|
108 NONSHARABLE_CLASS(CApaIconCaptionCenrepObserver) : public CActive |
|
109 { |
|
110 public: |
|
111 static CApaIconCaptionCenrepObserver* NewL(CApaIconCaptionOverrides& aOverrides); |
|
112 CApaIconCaptionCenrepObserver(CApaIconCaptionOverrides& aOverrides); |
|
113 ~CApaIconCaptionCenrepObserver(); |
|
114 void ConstructL(); |
|
115 |
|
116 void LoadOverridesL(); |
|
117 |
|
118 private: |
|
119 void Start(); |
|
120 // from CActive |
|
121 void RunL(); |
|
122 void DoCancel(); |
|
123 |
|
124 private: |
|
125 CApaIconCaptionOverrides& iOverrides; |
|
126 CRepository* iRepository; // owned |
|
127 }; |
|
128 |
|
129 #endif // __APSICONCAPTIONOVERRIDE_H__ |