1 /* |
|
2 * Copyright (c) 2005-2006 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: Implementation for a shortcut. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAISCUTSHORTCUT_H |
|
20 #define CAISCUTSHORTCUT_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "taiscutparser.h" |
|
25 |
|
26 class CAiScutEngine; |
|
27 class CAiScutTarget; |
|
28 class MAiContentObserver; |
|
29 class MAiPropertyExtension; |
|
30 |
|
31 /** |
|
32 * Implementation for a shortcut |
|
33 * |
|
34 * Handles parsing and launching an application shortcut |
|
35 * |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 class CAiScutShortcut : public CTimer |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 /** |
|
44 * First phase constructor. |
|
45 * Leaves the object on cleanup stack |
|
46 * |
|
47 * @since S60 v3.2 |
|
48 * @param aId Shortcut id |
|
49 * @param aTarget The shortcut definition string. |
|
50 * @param aEngine Reference to shortcut plug-in engine |
|
51 */ |
|
52 static CAiScutShortcut* NewLC(TInt aId, const TDesC& aTarget, |
|
53 CAiScutEngine& aEngine); |
|
54 |
|
55 /** |
|
56 * First phase constructor |
|
57 * |
|
58 * @since S60 v3.2 |
|
59 * @param aId Shortcut id |
|
60 * @param aTarget The shortcut definition string |
|
61 * @param aEngine Reference to shortcut plug-in engine |
|
62 */ |
|
63 static CAiScutShortcut* NewL(TInt aId, const TDesC& aTarget, |
|
64 CAiScutEngine& aEngine); |
|
65 |
|
66 virtual ~CAiScutShortcut(); |
|
67 |
|
68 /** |
|
69 * Returns the shortcut id |
|
70 * |
|
71 * @since S60 v3.2 |
|
72 * @return Shortcut id |
|
73 */ |
|
74 TInt32 Id() const; |
|
75 |
|
76 /** |
|
77 * Publishes the shortcut content, non leaving version |
|
78 * |
|
79 * @since S60 v3.2 |
|
80 * @param aPlugin Reference to plug-in |
|
81 * @param aObserver Content observer to publish to |
|
82 */ |
|
83 void Publish(MAiPropertyExtension& aPlugin, MAiContentObserver& aObserver); |
|
84 |
|
85 /** |
|
86 * Checks if the application pointed to can be launched and reverts to the |
|
87 * default setting if not. If no valid target can be found, the shortcut |
|
88 * becomes empty. May only leave with KErrNotReady to signify that application |
|
89 * architecture server or message server is not ready and access check should |
|
90 * be retried later. |
|
91 * |
|
92 * @since S60 v3.2 |
|
93 * @param aCheckType Specifies which kind of shortcuts should check its access |
|
94 * @return ETrue if the shortcut target is accessible |
|
95 */ |
|
96 TBool CheckAccessL(TInt aCheckType); |
|
97 |
|
98 /** |
|
99 * |
|
100 */ |
|
101 TBool IsTargetChanged() const; |
|
102 |
|
103 /** |
|
104 * Changes the shortcut target to the user defined setting |
|
105 * |
|
106 * @since S60 v3.2 |
|
107 * @param aNewTarget The new user defined shortcut target |
|
108 */ |
|
109 void SetUserTarget(const TDesC& aNewTarget); |
|
110 |
|
111 /** |
|
112 * Deletes the user target. |
|
113 * |
|
114 * @since S60 v3.2 |
|
115 */ |
|
116 void DeleteUserTarget(); |
|
117 |
|
118 /** |
|
119 * Launches the shortcut |
|
120 * |
|
121 * @since S60 v3.2 |
|
122 */ |
|
123 void LaunchL(); |
|
124 |
|
125 /** |
|
126 * Launches the shortcut |
|
127 * |
|
128 * @since S60 v5.1 |
|
129 * @param aMessage A message to pass |
|
130 */ |
|
131 void LaunchL(const TDesC8& aMessage); |
|
132 |
|
133 /** |
|
134 * Set call state |
|
135 * |
|
136 * @since S60 v3.2 |
|
137 */ |
|
138 void SetCallState(TBool aStatus); |
|
139 |
|
140 /** |
|
141 * |
|
142 * @since S60 v3.2 |
|
143 */ |
|
144 void SetToBePublished(TBool aFlag); |
|
145 |
|
146 /** |
|
147 * |
|
148 * @since S60 v3.2 |
|
149 */ |
|
150 TBool NeedsToBePublished(); |
|
151 |
|
152 /** |
|
153 * Return shortcut type. |
|
154 * |
|
155 * @since S60 v3.2 |
|
156 */ |
|
157 TShortcutType Type() const; |
|
158 |
|
159 /** |
|
160 * Return application uid of this shortcut. |
|
161 * |
|
162 * @since S60 v3.2 |
|
163 */ |
|
164 TUid AppUid() const; |
|
165 |
|
166 /** |
|
167 * Return an additional id this target may use when |
|
168 * launching. |
|
169 * |
|
170 * @since S60 v3.2 |
|
171 */ |
|
172 TUid AdditionalUid() const; |
|
173 |
|
174 /** |
|
175 * Return current valid definition. |
|
176 * |
|
177 * @since S60 v3.2 |
|
178 */ |
|
179 TPtrC ActiveDefinition(); |
|
180 |
|
181 /** |
|
182 * Set the icon to publish to softkeys, |
|
183 * icon area or to touch toolbar. Uses |
|
184 * aIcon.iDestination to determine which icon |
|
185 * is in question |
|
186 * |
|
187 * @since S60 v5.0 |
|
188 */ |
|
189 void SetIcon(TAiScutIcon aIcon); |
|
190 |
|
191 |
|
192 protected: |
|
193 |
|
194 |
|
195 CAiScutShortcut(TInt aId, CAiScutEngine& aEngine); |
|
196 |
|
197 void ConstructL(const TDesC& aTarget); |
|
198 |
|
199 /** |
|
200 * Creates a shortcut target object |
|
201 * |
|
202 * @since S60 v3.2 |
|
203 * @param aDefinition Shortcut target definition |
|
204 * @return Pointer to shortcut target object |
|
205 */ |
|
206 CAiScutTarget* CreateTargetL( |
|
207 const TDesC& aDefinition, TBool aCreateUserTarget); |
|
208 |
|
209 /** |
|
210 * Publishes the shortcut content, leaving version |
|
211 * |
|
212 * @since S60 v3.2 |
|
213 * @param aPlugin Reference to plug-in |
|
214 * @param aObserver Content observer to publish to |
|
215 */ |
|
216 virtual void PublishL(MAiPropertyExtension& aPlugin, MAiContentObserver& aObserver); |
|
217 |
|
218 /** |
|
219 * Publishes shortcut caption |
|
220 * |
|
221 * @since S60 v3.2 |
|
222 * @param aPlugin Reference to plug-in |
|
223 * @param aObserver Content observer to publish to |
|
224 */ |
|
225 virtual TInt PublishCaption( |
|
226 MAiPropertyExtension& aPlugin, MAiContentObserver& aObserver, |
|
227 TInt aCaptionContentId) const; |
|
228 |
|
229 /** |
|
230 * Publishes shortcut icon |
|
231 * |
|
232 * @since S60 v3.2 |
|
233 * @param aPlugin Reference to plug-in |
|
234 * @param aObserver Content observer to publish to |
|
235 */ |
|
236 virtual TInt PublishIcon( |
|
237 MAiPropertyExtension& aPlugin, MAiContentObserver& aObserver, TInt aIconContentId); |
|
238 |
|
239 /** |
|
240 * Set the icon to use instead of default icon |
|
241 * |
|
242 * @since S60 v3.2 |
|
243 */ |
|
244 void SetOverrideIcon(TAiScutIcon aIcon); |
|
245 |
|
246 /** |
|
247 * Set the icon to publish to softkeys |
|
248 * |
|
249 * @since S60 v3.2 |
|
250 */ |
|
251 void SetSoftkeyIcon(TAiScutIcon aIcon); |
|
252 |
|
253 /** |
|
254 * Set the icon to publish to touch toolbar |
|
255 * |
|
256 * @since S60 v5.0 |
|
257 */ |
|
258 void SetToolbarIcon(TAiScutIcon aIcon); |
|
259 |
|
260 // from CActive/CTimer |
|
261 |
|
262 TInt RunError(TInt aError); |
|
263 |
|
264 void DoCancel(); |
|
265 |
|
266 void RunL(); |
|
267 |
|
268 protected: // data |
|
269 |
|
270 /** |
|
271 * Shortcut id. |
|
272 */ |
|
273 TInt32 iId; |
|
274 |
|
275 /** |
|
276 * Default shortcut target. |
|
277 * Own. |
|
278 */ |
|
279 CAiScutTarget* iDefaultTarget; |
|
280 |
|
281 /** |
|
282 * User defined shortcut target. |
|
283 * Own. |
|
284 */ |
|
285 CAiScutTarget* iUserTarget; |
|
286 |
|
287 /** |
|
288 * Stores the old target data while the new one is being published. |
|
289 * During publishing the framework might still dereference pointers in the old |
|
290 * target so it must be kept alive until the new target is successfully published. |
|
291 * If publishing fails, this is taken back to use and the new target is deleted. |
|
292 * Own. |
|
293 */ |
|
294 CAiScutTarget* iRetiredTarget; |
|
295 |
|
296 /** |
|
297 * Pointer to the last published target. |
|
298 * DO NOT DELETE THROUGH THIS! |
|
299 * Not own. |
|
300 */ |
|
301 CAiScutTarget* iLastPublishedTarget; |
|
302 |
|
303 /** |
|
304 * Pointer to the active target. |
|
305 * Can point either to iDefaultTarget, iUserTarget or NULL |
|
306 * DO NOT DELETE THROUGH THIS! |
|
307 * Not own. |
|
308 */ |
|
309 CAiScutTarget* iActiveTarget; |
|
310 |
|
311 /** |
|
312 * Reference to the shortcut plug-in engine. |
|
313 */ |
|
314 CAiScutEngine& iEngine; |
|
315 |
|
316 /** |
|
317 * Boolean indicating if this shortcut needs to be published. |
|
318 */ |
|
319 TBool iNeedsToBePublished; |
|
320 |
|
321 /** |
|
322 * Call state |
|
323 */ |
|
324 TBool iActiveCall; |
|
325 |
|
326 /** |
|
327 * Force the publish of this shortcut. For example |
|
328 * after call state has changed the actual shortcut |
|
329 * isn't changed but it still needs to be published. |
|
330 */ |
|
331 TBool iForcePublish; |
|
332 |
|
333 }; |
|
334 |
|
335 #endif // CAISCUTSHORTCUT_H |
|
336 |
|
337 // End of File. |
|