0
|
1 |
/*
|
|
2 |
* Copyright (c) {Year(s)} {Copyright owner}.
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* {Name} {Company} ? Initial contribution
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
* {Name} {Company} ? {{Description of contribution}}
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
* {{Description of the file}}
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef __HSPUBLISHERIMPL_H__
|
|
22 |
#define __HSPUBLISHERIMPL_H__
|
|
23 |
|
|
24 |
// System includes
|
|
25 |
#include <e32base.h>
|
|
26 |
#include <liwcommon.h>
|
|
27 |
|
|
28 |
// User includes
|
|
29 |
|
|
30 |
// Forward declarations
|
|
31 |
class MHsWidgetObserver;
|
|
32 |
class CLiwServiceHandler;
|
|
33 |
class CLiwCriteriaItem;
|
|
34 |
class CLiwGenericParamList;
|
|
35 |
class MLiwInterface;
|
|
36 |
class CFbsBitmap;
|
|
37 |
class CTransaction;
|
|
38 |
|
|
39 |
// Constants
|
|
40 |
|
|
41 |
// Class declaration
|
|
42 |
NONSHARABLE_CLASS( CHsPublisherImpl ) : public CBase,
|
|
43 |
public MLiwNotifyCallback
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
// constructors and destructor
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Constructor
|
|
50 |
*
|
|
51 |
* @param aObserver Widget observer interface.
|
|
52 |
* @param aEnablePersist ETrue if publisher wants to save published data to SQL database for later usage.
|
|
53 |
* This option should be used with caution as it taxes runtime performance and resources.
|
|
54 |
*/
|
|
55 |
static CHsPublisherImpl* NewL(
|
|
56 |
MHsWidgetObserver& aObserver,
|
|
57 |
TBool aEnablePersist );
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Constructor
|
|
61 |
*
|
|
62 |
* @param aObserver Widget observer interface.
|
|
63 |
* @param aEnablePersist ETrue if publisher wants to save published data to SQL database for later usage.
|
|
64 |
* This option should be used with caution as it taxes runtime performance and resources.
|
|
65 |
*/
|
|
66 |
static CHsPublisherImpl* NewLC(
|
|
67 |
MHsWidgetObserver& aObserver,
|
|
68 |
TBool aEnablePersist );
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Destructor
|
|
72 |
*/
|
|
73 |
~CHsPublisherImpl();
|
|
74 |
|
|
75 |
private:
|
|
76 |
// from MLiwNotifyCallback
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Handles notifications caused by an asynchronous Execute*CmdL call
|
|
80 |
* or an event.
|
|
81 |
*
|
|
82 |
* @param aCmdId The service command associated to the event.
|
|
83 |
* @param aEventId Occured event, see LiwCommon.hrh.
|
|
84 |
* @param aEventParamList Event parameters, if any, as defined per
|
|
85 |
* each event.
|
|
86 |
* @param aInParamList Input parameters, if any, given in the
|
|
87 |
* related HandleCommmandL.
|
|
88 |
* @return Error code for the callback.
|
|
89 |
*/
|
|
90 |
TInt HandleNotifyL( TInt aCmdId, TInt aEventId,
|
|
91 |
CLiwGenericParamList& aEventParamList,
|
|
92 |
const CLiwGenericParamList& aInParamList );
|
|
93 |
|
|
94 |
public:
|
|
95 |
// new functions
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Publishes text to a <text> element in the widget.
|
|
99 |
*
|
|
100 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
101 |
* @param aElementId Element id identifying the text element in the widget.
|
|
102 |
* @param aText Text to set.
|
|
103 |
*/
|
|
104 |
void PublishTextL(
|
|
105 |
const TDesC& aWidgetId,
|
|
106 |
const TDesC8& aElementId,
|
|
107 |
const TDesC& aText );
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Publishes image to an <image> element in the widget.
|
|
111 |
*
|
|
112 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
113 |
* @param aElementId Element id identifying the image element in the widget.
|
|
114 |
* @param aImage Image to set.
|
|
115 |
* @param aMask Mask to set.
|
|
116 |
*/
|
|
117 |
void PublishImageL(
|
|
118 |
const TDesC& aWidgetId,
|
|
119 |
const TDesC8& aElementId,
|
|
120 |
const CFbsBitmap* aImage,
|
|
121 |
const CFbsBitmap* aMask );
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Publishes image to an <image> element in the widget.
|
|
125 |
*
|
|
126 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
127 |
* @param aElementId Element id identifying the image element in the widget.
|
|
128 |
* @param aImageHandle Handle to Image to set.
|
|
129 |
* @param aMaskHandle Handle to mask to set.
|
|
130 |
*/
|
|
131 |
void PublishImageL(
|
|
132 |
const TDesC& aWidgetId,
|
|
133 |
const TDesC8& aElementId,
|
|
134 |
TInt aImageHandle,
|
|
135 |
TInt aMaskHandle );
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Publishes image to an <image> element in the widget.
|
|
139 |
*
|
|
140 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
141 |
* @param aElementId Element id identifying the image element in the widget.
|
|
142 |
* @param aSource Source for the image. Supported source formats are:
|
|
143 |
* - Filesystem path, i.e. _LIT( KMyImagePath, "c:\\data\\Installs\\MyWidget\\image.jpg");
|
|
144 |
* - skin(<majorId> <minorId>), i.e. _LIT( KMySkinImage, "skin(270501603 8586)" );
|
|
145 |
* - mif(<MifFileName.mif> <bitmapId> <maskId>), i.e. _LIT( KMyMifImage, "mif(c:\\data\\Installs\\MyWidget\\mymwidget.mif 16384 16385" );
|
|
146 |
*/
|
|
147 |
void PublishImageL(
|
|
148 |
const TDesC& aWidgetId,
|
|
149 |
const TDesC8& aElementId,
|
|
150 |
const TDesC& aSource );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Publishes stream to a <data> element in widget.
|
|
154 |
*
|
|
155 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
156 |
* @param aElementId Element id identifying the data element in the widget.
|
|
157 |
* @param aStream The stream as descriptor.
|
|
158 |
*/
|
|
159 |
void PublishStreamL(
|
|
160 |
const TDesC& aWidgetId,
|
|
161 |
const TDesC8& aElementId,
|
|
162 |
const TDesC8& aStream );
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Cleans published text from a <text> element.
|
|
166 |
*
|
|
167 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
168 |
* @param aElementId Element id identifying the data element in the widget.
|
|
169 |
*/
|
|
170 |
void CleanTextL( const TDesC& aWidgetId,
|
|
171 |
const TDesC8& aElementId );
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Cleans published image from an <image> element.
|
|
175 |
*
|
|
176 |
* @param aWidgetId Widget Id identifying the widget instance.
|
|
177 |
* @param aElementId Element id identifying the data element in the widget.
|
|
178 |
*/
|
|
179 |
void CleanImageL( const TDesC& aWidgetId,
|
|
180 |
const TDesC8& aElementId );
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Starts a publish transaction. Transaction must be committed
|
|
184 |
* with CommitTransaction method.
|
|
185 |
*
|
|
186 |
* @param aWidget Widget Id identifying the transaction for widget instance.
|
|
187 |
* @return System wide error code.
|
|
188 |
*/
|
|
189 |
void StartTransactionL(
|
|
190 |
const TDesC& aWidgetId );
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Commits the publish transaction and flushes changes to Homescreen.
|
|
194 |
*
|
|
195 |
* @param aWidget Widget Id identifying the transaction for the widget instance.
|
|
196 |
*/
|
|
197 |
void CommitTransactionL(
|
|
198 |
const TDesC& aWidgetId );
|
|
199 |
|
|
200 |
private:
|
|
201 |
// new functions
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Attaches to CPS service.
|
|
205 |
*/
|
|
206 |
void AttachL();
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Detaches from CPS servive.
|
|
210 |
*/
|
|
211 |
void DetachL();
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Process CPS notification and delegates it to MHsWidgetObserver.
|
|
215 |
*
|
|
216 |
* @param aWidgetId The widget instance from the event was initiated.
|
|
217 |
* @param aEvent Event which maps to Content Model.
|
|
218 |
*/
|
|
219 |
void ProcessEvent(
|
|
220 |
const TDesC& aWidgetId,
|
|
221 |
const TDesC8& aEvent ) const;
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Gets transaction for aWidgetId.
|
|
225 |
*
|
|
226 |
* @param aWidgetId The widget instance to use in transaction look-up.
|
|
227 |
* @return Transaction, NULL if not found.
|
|
228 |
*/
|
|
229 |
CTransaction* Transaction( const TDesC& aWidgetId ) const;
|
|
230 |
|
|
231 |
private:
|
|
232 |
// private constructors
|
|
233 |
|
|
234 |
/**
|
|
235 |
* C++ constructor
|
|
236 |
*/
|
|
237 |
CHsPublisherImpl(
|
|
238 |
MHsWidgetObserver& aObserver,
|
|
239 |
TBool aEnablePersist );
|
|
240 |
|
|
241 |
/**
|
|
242 |
* 2nd phase constructor
|
|
243 |
*/
|
|
244 |
void ConstructL();
|
|
245 |
|
|
246 |
private:
|
|
247 |
// data
|
|
248 |
|
|
249 |
/** HS Widget observer, not owned */
|
|
250 |
MHsWidgetObserver& iObserver;
|
|
251 |
/** SAPI service handler, owned */
|
|
252 |
CLiwServiceHandler* iServiceHandler;
|
|
253 |
/** CPS SAPI service, owned */
|
|
254 |
CLiwCriteriaItem* iCpsService;
|
|
255 |
/** Cps interface, owned */
|
|
256 |
MLiwInterface* iCpsInterface;
|
|
257 |
/** Publish transactions, owned */
|
|
258 |
RPointerArray< CTransaction > iTransactions;
|
|
259 |
/** Attached succesfully to CPS service */
|
|
260 |
TBool iCpServiceAvailable;
|
|
261 |
/** Flag Enable persist */
|
|
262 |
TBool iEnablePersist;
|
|
263 |
};
|
|
264 |
|
|
265 |
#endif // __HSPUBLISHERIMPL_H__
|
|
266 |
|
|
267 |
// End of file
|