|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __OBSERVER_H__ |
|
19 #define __OBSERVER_H__ |
|
20 |
|
21 // External includes |
|
22 #include <e32base.h> |
|
23 #include <aicontentobserver.h> |
|
24 #include <hscontentpublisher.h> |
|
25 |
|
26 class RFile; |
|
27 |
|
28 /** |
|
29 * Observer class |
|
30 */ |
|
31 class Observer : public CBase, |
|
32 public MAiContentObserver |
|
33 { |
|
34 public: |
|
35 |
|
36 static Observer* NewL(); |
|
37 |
|
38 virtual ~Observer(); |
|
39 |
|
40 /** |
|
41 * Invoked by the plug-in to inform that it initiates content publishing |
|
42 * transaction. |
|
43 * |
|
44 * @param aTxId - transaction Id |
|
45 * @return KErrNone - transaction is started. |
|
46 * KErrNotSupported - UI Controller does not support transactions, |
|
47 * meaning that content will be rendered every time when Publish |
|
48 * is called. |
|
49 * @since S60 v3.2 |
|
50 */ |
|
51 TInt StartTransaction( TInt aTxId ); |
|
52 |
|
53 inline TInt CancelTransaction( TInt /*aTxId*/ ) |
|
54 { |
|
55 return 10000000000; |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Invoked by the plug-in to request framework that content publishing |
|
60 * transaction must be finalized and content should be rendered to the |
|
61 * screen. |
|
62 * |
|
63 * @param aTxId - transaction Id |
|
64 * @return KErrNone - transaction is over. |
|
65 * KErrNotSupported - UI Controller does not support transactions, |
|
66 * meaning that content will be rendered every time when Publish |
|
67 * is called. |
|
68 * KErrNotFound - transaction with matching id has not been |
|
69 * started. |
|
70 * @since S60 v3.2 |
|
71 */ |
|
72 TInt Commit( TInt aTxId ); |
|
73 |
|
74 /** |
|
75 * Invoked by plug-in to indicate that content publishing transaction |
|
76 * must be cancelled. |
|
77 * |
|
78 * @param aTxId - transaction Id |
|
79 * @return KErrNone - transaction is cancelled. |
|
80 * KErrNotSupported - UI Controller does not support transactions, |
|
81 * meaning that content will be rendered every time when Publish |
|
82 * is called. |
|
83 * KErrNotFound - transaction with matching id has not been |
|
84 * started. |
|
85 * @since S60 v3.2 |
|
86 */ |
|
87 TInt Rollback( TInt aTxId ); |
|
88 |
|
89 /** |
|
90 * Invoked by plug-in to test if content can be published. |
|
91 * |
|
92 * @param aPlugin - Plug-in property extension interface implementation. |
|
93 * @param aContent - identification of content selector, MUST correspond |
|
94 * single content selector supported by plug-in. The framework |
|
95 * utilizes the selector id to match for cid and MIME type. |
|
96 * @param aIndex - index of the content item. |
|
97 * @return ETrue - if content could be published. |
|
98 * @since S60 3.2 |
|
99 */ |
|
100 TBool CanPublish( CHsContentPublisher& aPlugin, TInt aContent, |
|
101 TInt aIndex ); |
|
102 |
|
103 /** |
|
104 * Invoked by the plug-in to inform that content identified by reference |
|
105 * aResource must be published to UI control\element identified by selector |
|
106 * aContent. |
|
107 * |
|
108 * @param aPlugin - Plug-in property extension interface implementation. |
|
109 * @param aContent - identification of content selector, MUST correspond |
|
110 * single content selector supported by plug-in. The framework |
|
111 * utilizes the selector id to match for cid and MIME type. |
|
112 * @param aResource - identification of content reference, MUST correspond |
|
113 * single content reference supported by plug-in. The framework |
|
114 * utilizes the reference if to match for cid and MIME type of the |
|
115 * content supplied with in UI definition. |
|
116 * @param aIndex - index of the content item. |
|
117 * @return KErrNone - if content is published. |
|
118 * KErrNotSupported - if content selector is not supported by |
|
119 * current UI definition. |
|
120 * KErrNotFound - if content reference is not found in current |
|
121 * UI definition. |
|
122 * @since S60 v3.2 |
|
123 */ |
|
124 TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
125 TInt aResource, TInt aIndex ); |
|
126 |
|
127 /** |
|
128 * Invoked by the plug-in to inform that textual content provided within |
|
129 * parameter aText must be published to UI control\element identified by |
|
130 * selector aContent. |
|
131 * |
|
132 * @param aPlugin - Plug-in property extension interface implementation. |
|
133 * @param aContent - identification of content selector, MUST correspond |
|
134 * single content selector supported by plug-in. The framework |
|
135 * utilizes the selector id to match for cid and MIME type. |
|
136 * @param aText - Textual content in UNICODE. |
|
137 * @param aIndex - index of the content item. |
|
138 * @return KErrNone - if content is published. |
|
139 * KErrNotSupported - if content selector is not supported by |
|
140 * current UI definition. |
|
141 * KErrNotFound - if content reference is not found in current |
|
142 * UI definition. |
|
143 * KErrArgument - if content cannot be published to UI element, |
|
144 * e.g. MIME type mismatch. |
|
145 * @since S60 v3.2 |
|
146 */ |
|
147 TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
148 const TDesC16& aText, TInt aIndex ); |
|
149 |
|
150 /** |
|
151 * Invoked by the plug-in to inform that content provided within buffer |
|
152 * aBuf must be published to UI control\element identified by selector |
|
153 * aContent. |
|
154 * |
|
155 * @param aPlugin - Plug-in property extension interface implementation. |
|
156 * @param aContent - identification of content selector, MUST correspond |
|
157 * single content selector supported by plug-in. The framework |
|
158 * utilizes the selector id to match for cid and MIME type. |
|
159 * @param aBuf - instance of content. |
|
160 * @param aIndex - index of the content item. |
|
161 * @return KErrNone - if content is published. |
|
162 * KErrNotSupported - if content selector is not supported by |
|
163 * current UI definition. |
|
164 * KErrNotFound - if content reference is not found in current |
|
165 * UI definition. |
|
166 * KErrArgument - if content cannot be published to UI element, |
|
167 * e.g. MIME type mismatch. |
|
168 * @since S60 v3.2 |
|
169 */ |
|
170 TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
171 const TDesC8& aBuf, TInt aIndex ); |
|
172 |
|
173 /** |
|
174 * Invoked by the plug-in to inform that content from file handle aFile |
|
175 * must be published to UI control\element identified by selector aContent. |
|
176 * |
|
177 * @param aPlugin - Plug-in property extension interface implementation. |
|
178 * @param aContent - identification of content selector, MUST correspond |
|
179 * single content selector supported by plug-in. The framework |
|
180 * utilizes the selector id to match for cid and MIME type. |
|
181 * @param aFile - file handle from where content can be obtained by UI |
|
182 * framework. |
|
183 * @param aIndex - index of the content item. |
|
184 * @return KErrNone - if content is published. |
|
185 * KErrNotSupported - if content selector is not supported by |
|
186 * current UI definition. |
|
187 * KErrNotFound - if content reference is not found in current |
|
188 * UI definition. |
|
189 * KErrArgument - if content cannot be published to UI element, |
|
190 * e.g. MIME type mismatch. |
|
191 * @since S60 v3.2 |
|
192 */ |
|
193 TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
194 RFile& aFile, TInt aIndex ); |
|
195 |
|
196 /** |
|
197 * Invoked by the plug-in to inform that content must be cleaned in UI |
|
198 * control\element identified by selector aContent. |
|
199 * |
|
200 * @param aPlugin - Plug-in property extension interface implementation. |
|
201 * @param aContent - identification of content selector, MUST correspond |
|
202 * single content selector supported by plug-in. The framework |
|
203 * utilizes the selector id to match for cid and MIME type. |
|
204 * @param aIndex - index of the content item. |
|
205 * @return KErrNone - if content is published. |
|
206 * KErrNotSupported - if content selector is not supported by |
|
207 * current UI definition. |
|
208 * KErrNotFound - if content reference is not found in current |
|
209 * UI definition. |
|
210 * @since S60 v3.2 |
|
211 */ |
|
212 TInt Clean( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex ); |
|
213 |
|
214 /** |
|
215 * Returns interface extension. Not used in Series 60 3.1 release. |
|
216 * |
|
217 * @param aUid - UID of the extension interface to access. |
|
218 * @return the extension interface. Actual type depends on the passed aUid |
|
219 * argument. |
|
220 * @since S60 v3.2 |
|
221 */ |
|
222 TAny* Extension( TUid aUid ) ; |
|
223 |
|
224 /** |
|
225 * |
|
226 */ |
|
227 TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const; |
|
228 |
|
229 /** |
|
230 * |
|
231 */ |
|
232 TInt SetProperty( CHsContentPublisher& aPlugin, |
|
233 const TDesC8& aElementId, |
|
234 const TDesC8& aPropertyName, |
|
235 const TDesC8& aPropertyValue ); |
|
236 |
|
237 /** |
|
238 * |
|
239 */ |
|
240 TInt SetProperty( CHsContentPublisher& aPlugin, |
|
241 const TDesC8& aElementId, |
|
242 const TDesC8& aPropertyName, |
|
243 const TDesC8& aPropertyValue, |
|
244 MAiContentObserver::TValueType aValueType ); |
|
245 |
|
246 protected: |
|
247 |
|
248 private: |
|
249 |
|
250 Observer(); |
|
251 |
|
252 void ConstructL(); |
|
253 |
|
254 /** |
|
255 * Leaving version of the commit operation |
|
256 * |
|
257 * @since S60 3.1 |
|
258 */ |
|
259 void DoCommitL( TInt aTxId ); |
|
260 |
|
261 private: // Data |
|
262 |
|
263 /** |
|
264 * Transaction id |
|
265 */ |
|
266 TInt iTransactionId; |
|
267 |
|
268 /** |
|
269 * Flag indicating if transaction is ongoing |
|
270 */ |
|
271 TBool iTransactionOngoing; |
|
272 }; |
|
273 |
|
274 #endif // __OBSERVER_H__ |
|
275 |
|
276 // End of File. |