|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Base class for renderers in native ui controller. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_AINATIVERENDERER_H |
|
20 #define M_AINATIVERENDERER_H |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 |
|
25 // User includes |
|
26 #include <aidevicestatuscontentmodel.h> |
|
27 #include <aiprofileplugincontentmodel.h> |
|
28 |
|
29 // Forward declarations |
|
30 class CHsContentPublisher; |
|
31 class RFile; |
|
32 |
|
33 namespace AiNativeUiController |
|
34 { |
|
35 |
|
36 /** |
|
37 * Base class for renderers in native ui controller. |
|
38 * |
|
39 * @since S60 3.2 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CAiNativeRenderer ) : public CBase |
|
42 { |
|
43 public: |
|
44 |
|
45 ~CAiNativeRenderer(); |
|
46 |
|
47 public: |
|
48 // new methods |
|
49 |
|
50 /** |
|
51 * Publish resource. |
|
52 * |
|
53 * @since S60 3.2 |
|
54 * @param aPlugin is publishing plugin. |
|
55 * @param aContent is id of the content. |
|
56 * @param aResource is id of the resource. |
|
57 * @param aIndex is index of the content. |
|
58 * @return KErrNone if publish is successful. |
|
59 */ |
|
60 virtual TInt Publish( CHsContentPublisher& aPlugin, |
|
61 TInt aContent, |
|
62 TInt aResource, |
|
63 TInt aIndex ); |
|
64 |
|
65 /** |
|
66 * Publish unicode text. |
|
67 * |
|
68 * @since S60 3.2 |
|
69 * @param aPlugin is publishing plugin. |
|
70 * @param aContent is id of the content. |
|
71 * @param aText is published text. |
|
72 * @param aIndex is index of the content. |
|
73 * @return KErrNone if publish is successful. |
|
74 */ |
|
75 virtual TInt Publish( CHsContentPublisher& aPlugin, |
|
76 TInt aContent, |
|
77 const TDesC16& aText, |
|
78 TInt aIndex ); |
|
79 |
|
80 /** |
|
81 * Publish data. |
|
82 * |
|
83 * @since S60 3.2 |
|
84 * @param aPlugin is publishing plugin. |
|
85 * @param aContent is id of the content. |
|
86 * @param aBuf is published data. |
|
87 * @param aIndex is index of the content. |
|
88 * @return KErrNone if publish is successful. |
|
89 */ |
|
90 virtual TInt Publish( CHsContentPublisher& aPlugin, |
|
91 TInt aContent, |
|
92 const TDesC8& aBuf, |
|
93 TInt aIndex ); |
|
94 |
|
95 /** |
|
96 * Publish content of the file. |
|
97 * |
|
98 * @since S60 3.2 |
|
99 * @param aPlugin is publishing plugin. |
|
100 * @param aContent is id of the content. |
|
101 * @param aFile is reference to opened file. |
|
102 * @param aIndex is index of the content. |
|
103 * @return KErrNone if publish is successful. |
|
104 */ |
|
105 virtual TInt Publish( CHsContentPublisher& aPlugin, |
|
106 TInt aContent, |
|
107 RFile& aFile, |
|
108 TInt aIndex ); |
|
109 |
|
110 /** |
|
111 * Clean content. |
|
112 * |
|
113 * @since S60 3.2 |
|
114 * @param aPlugin is publishing plugin. |
|
115 * @param aContent is id of the content. |
|
116 * @param aIndex is index of the content. |
|
117 * @return KErrNone if cleaning works. |
|
118 */ |
|
119 virtual TInt Clean( CHsContentPublisher& aPlugin, TInt aContent ); |
|
120 |
|
121 /** |
|
122 * Renderer must implement this method if it needs to support resource publishing. |
|
123 * |
|
124 * Default implementation leaves with KErrNotFound. |
|
125 * |
|
126 * @since S60 3.2 |
|
127 * @param aPlugin is publishing plugin. |
|
128 * @param aContent is id of the content. |
|
129 * @param aResource is id of the resource. |
|
130 * @param aIndex is index of the content. |
|
131 */ |
|
132 virtual void DoPublishL( CHsContentPublisher& aPlugin, |
|
133 TInt aContent, |
|
134 TInt aResource, |
|
135 TInt aIndex ); |
|
136 |
|
137 /** |
|
138 * Renderer must implement this method if it needs to support unicode text publishing. |
|
139 * |
|
140 * Default implementation leaves with KErrNotFound. |
|
141 * |
|
142 * @since S60 3.2 |
|
143 * @param aPlugin is publishing plugin. |
|
144 * @param aContent is id of the content. |
|
145 * @param aText is published text. |
|
146 * @param aIndex is index of the content. |
|
147 */ |
|
148 virtual void DoPublishL( CHsContentPublisher& aPlugin, |
|
149 TInt aContent, |
|
150 const TDesC16& aText, |
|
151 TInt aIndex ); |
|
152 |
|
153 /** |
|
154 * Renderer must implement this method if it needs to support data publishing. |
|
155 * |
|
156 * Default implementation leaves with KErrNotFound. |
|
157 * |
|
158 * @since S60 3.2 |
|
159 * @param aPlugin is publishing plugin. |
|
160 * @param aContent is id of the content. |
|
161 * @param aBuf is published data. |
|
162 * @param aIndex is index of the content. |
|
163 */ |
|
164 virtual void DoPublishL( CHsContentPublisher& aPlugin, |
|
165 TInt aContent, |
|
166 const TDesC8& aBuf, |
|
167 TInt aIndex ); |
|
168 |
|
169 /** |
|
170 * Renderer must implement this method if it needs to support file publishing. |
|
171 * |
|
172 * Default implementation leaves with KErrNotFound. |
|
173 * |
|
174 * @since S60 3.2 |
|
175 * @param aPlugin is publishing plugin. |
|
176 * @param aContent is id of the content. |
|
177 * @param aFile is reference to file client. |
|
178 * @param aIndex is index of the content. |
|
179 */ |
|
180 virtual void DoPublishL( CHsContentPublisher& aPlugin, |
|
181 TInt aContent, |
|
182 RFile& aFile, |
|
183 TInt aIndex ); |
|
184 |
|
185 /** |
|
186 * Renderer must implement this method if it needs to support content cleaning. |
|
187 * |
|
188 * Default implementation leaves with KErrNotFound. |
|
189 * |
|
190 * @since S60 3.2 |
|
191 * @param aPlugin is publishing plugin. |
|
192 * @param aContent is id of the content. |
|
193 */ |
|
194 virtual void DoCleanL( CHsContentPublisher& aPlugin, TInt aContent ); |
|
195 |
|
196 /** |
|
197 * Called when UI switches to foreground. |
|
198 */ |
|
199 virtual void FocusObtainedL() { }; |
|
200 |
|
201 /** |
|
202 * Called when UI switches to background. |
|
203 */ |
|
204 virtual void FocusLostL() { }; |
|
205 |
|
206 /** |
|
207 * Called when transaction is committed. |
|
208 */ |
|
209 virtual void TransactionCommittedL() { }; |
|
210 |
|
211 /** |
|
212 * Called when keylock state is enabled. |
|
213 */ |
|
214 virtual void KeylockEnabledL() { }; |
|
215 |
|
216 /** |
|
217 * Called when keylock state is disabled. |
|
218 */ |
|
219 virtual void KeylockDisabledL() { }; |
|
220 |
|
221 /** |
|
222 * LoadUIDefinitionL |
|
223 */ |
|
224 virtual void LoadUIDefinitionL() { }; |
|
225 |
|
226 protected: |
|
227 |
|
228 /** |
|
229 * Get integer content id using textual id. |
|
230 * |
|
231 * @since S60 3.2 |
|
232 * @param aCid is textual content id. |
|
233 * @return content id. |
|
234 */ |
|
235 TInt GetIntContentId( const TDesC& aCid ) const; |
|
236 |
|
237 /** |
|
238 * Does mime type check. |
|
239 * |
|
240 * @since S60 3.2 |
|
241 * @param aContentId is content id. |
|
242 * @param aMimeType is mime type. |
|
243 * @return ETrue if match is successful. |
|
244 */ |
|
245 TBool MatchMimeType( CHsContentPublisher& aPlugin, TInt aContentId, const TDesC8& aMimeType ) const; |
|
246 |
|
247 |
|
248 /** |
|
249 * Does mime type check. |
|
250 * |
|
251 * @since S60 3.2 |
|
252 * @param aPlugin is publishing plugin. |
|
253 * @param aContentId is id of the content. |
|
254 */ |
|
255 void DoMimeTypeCheckL( CHsContentPublisher& aPlugin, TInt aContentId ); |
|
256 |
|
257 }; |
|
258 |
|
259 } // namespace AiNativeUiController |
|
260 |
|
261 #endif // M_AINATIVERENDERER_H |