1 // Copyright (c) 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 the License "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 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @internalComponent |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef APSICONCAPTIONOVERRIDE_H |
|
24 #define APSICONCAPTIONOVERRIDE_H |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <e32hashtab.h> |
|
28 |
|
29 class CRepository; |
|
30 class CApaIconCaptionOverrideStore; |
|
31 |
|
32 |
|
33 /** |
|
34 * Read icon and caption details for an app according to the |
|
35 * language downgrade path, with ELangNone used as the default |
|
36 * language if no better match found. |
|
37 |
|
38 @see CApaIconCaptionOverrideStore |
|
39 */ |
|
40 NONSHARABLE_CLASS(TApaIconCaptionOverrideReader) |
|
41 { |
|
42 public: |
|
43 TApaIconCaptionOverrideReader(const CApaIconCaptionOverrideStore& aStore, const RArray<TLanguage>& aLanguageDowngradePath); |
|
44 |
|
45 const TDesC* ShortCaption() const; |
|
46 const TDesC* Caption() const; |
|
47 TBool NumIconsSet() const; |
|
48 TInt NumIcons() const; |
|
49 const TDesC* IconFileName() const; |
|
50 |
|
51 private: |
|
52 const TDesC* GetString(TUint32 aFieldId) const; |
|
53 const TInt* GetInt(TUint32 aFieldId) const; |
|
54 |
|
55 private: |
|
56 const CApaIconCaptionOverrideStore& iStore; |
|
57 const RArray<TLanguage>& iLanguageDowngradePath; |
|
58 }; |
|
59 |
|
60 /** |
|
61 * Stores the icon and caption overrides for an application. |
|
62 */ |
|
63 NONSHARABLE_CLASS(CApaIconCaptionOverridesForApp) : public CBase |
|
64 { |
|
65 public: |
|
66 static CApaIconCaptionOverridesForApp* NewL(); |
|
67 ~CApaIconCaptionOverridesForApp(); |
|
68 CApaIconCaptionOverridesForApp(); |
|
69 void ConstructL(); |
|
70 |
|
71 void LoadFromCenRepL(CRepository* aRepository, TUint32 aAppKey); |
|
72 |
|
73 TApaIconCaptionOverrideReader Reader(const RArray<TLanguage>& aLanguageDowngradePath) const; |
|
74 |
|
75 private: |
|
76 CApaIconCaptionOverrideStore* iStore; |
|
77 }; |
|
78 |
|
79 |
|
80 /** |
|
81 * Store all of the icon and caption override data indexed by app UID |
|
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 |
|
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 NONSHARABLE_CLASS(CApaIconCaptionCenrepObserver) : public CActive |
|
107 { |
|
108 public: |
|
109 static CApaIconCaptionCenrepObserver* NewL(CApaIconCaptionOverrides& aOverrides); |
|
110 CApaIconCaptionCenrepObserver(CApaIconCaptionOverrides& aOverrides); |
|
111 ~CApaIconCaptionCenrepObserver(); |
|
112 void ConstructL(); |
|
113 void LoadOverridesL(); |
|
114 |
|
115 private: |
|
116 void Start(); |
|
117 |
|
118 void RunL(); |
|
119 void DoCancel(); |
|
120 TInt RunError(TInt aError); |
|
121 |
|
122 private: |
|
123 CApaIconCaptionOverrides& iOverrides; |
|
124 CRepository* iRepository; // owned |
|
125 }; |
|
126 |
|
127 |
|
128 #endif |
|