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: Class for application shortcut target. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAISCUTTARGETAPP_H |
|
20 #define CAISCUTTARGETAPP_H |
|
21 |
|
22 #include "caiscuttarget.h" |
|
23 |
|
24 class CPeriodic; |
|
25 class MAknsSkinInstance; |
|
26 /** |
|
27 * Implements an application shortcut target |
|
28 * |
|
29 * Handles parsing and launching an application shortcut target |
|
30 * |
|
31 * @since S60 v3.2 |
|
32 */ |
|
33 class CAiScutTargetApp : public CAiScutTarget |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * First phase constructor |
|
40 * |
|
41 * @since S60 v3.2 |
|
42 * @param aEngine Reference to the plug-in engine |
|
43 * @param aParser Shortcut definition parser |
|
44 */ |
|
45 static CAiScutTargetApp* NewL( |
|
46 CAiScutEngine& aEngine, TShortcutType aType, const TAiScutParser& aParser); |
|
47 |
|
48 virtual ~CAiScutTargetApp(); |
|
49 |
|
50 /** |
|
51 * Returns the shortcut definition string |
|
52 * |
|
53 * @since S60 v3.2 |
|
54 * @return Shortcut definition string |
|
55 */ |
|
56 TPtrC Definition() const; |
|
57 |
|
58 /** |
|
59 * Returns the shortcut target caption. |
|
60 * Caption can be either a descriptor or a resource id. |
|
61 * If the return value has a non-zero value, it is the resource id. |
|
62 * Zero indicates that the descriptor reference parameter is used. |
|
63 * Default implementation returns KErrNotSupported; |
|
64 * |
|
65 * Getting the target caption and icon utilizes the "lazy evaluation" idiom |
|
66 * which means they are created only when they are first needed. This is because |
|
67 * there are (atleast) two scenarios where they are never needed: |
|
68 * 1. The active theme does not support shortcut captions or icons. |
|
69 * 2. Shortcuts launched using LaunchByValue are never published. |
|
70 * |
|
71 * @since S60 v3.2 |
|
72 * @param aDes On return, the descriptor if used |
|
73 * @return The resource id or zero to indicate that the descriptor is used. |
|
74 */ |
|
75 TInt GetCaption(TPtrC& aDes, TAiScutAppTitleType aTitleType) const; |
|
76 |
|
77 /** |
|
78 * Returns the shortcut target icon. |
|
79 * Icon can be either an icon pointer or a resource id. |
|
80 * If the return value has a non-zero value, it is the resource id. |
|
81 * Zero indicates that the icon pointer is used. |
|
82 * Default implementation returns KErrNotSupported; |
|
83 * |
|
84 * Uses the "lazy evaluation" idiom to get the icon. See Caption() |
|
85 * |
|
86 * @since S60 v3.2 |
|
87 * @param aIcon On return, the icon pointer if used |
|
88 * @return The resource id or zero to indicate that the icon pointer is used. |
|
89 */ |
|
90 TInt GetIcon(CGulIcon*& aIcon) const; |
|
91 |
|
92 /** |
|
93 * Returns the shortcut icon that can be published to toolbar |
|
94 * Icon can be either an icon pointer or a resource id. |
|
95 * If the return value has a non-zero value, it is the resource id. |
|
96 * Zero indicates that the icon pointer is used. |
|
97 * Default implementation returns the icon that has possibly |
|
98 * been set with @c SetSoftkeyIcon() and returns |
|
99 * KErrNotSupported if no softkey icon has been set. |
|
100 * |
|
101 * Uses the "lazy evaluation" idiom to get the icon. See Caption() |
|
102 * |
|
103 * @since S60 v3.2 |
|
104 * @param aIcon On return, the icon pointer if used |
|
105 * @return The resource id or zero to indicate that the icon pointer is used. |
|
106 */ |
|
107 TInt GetToolbarIcon(CGulIcon*& aIcon) const; |
|
108 |
|
109 /** |
|
110 * Checks if the shortcut target is accessible |
|
111 * |
|
112 * @since S60 v3.2 |
|
113 * @param aCheckType Specifies which kind of shortcuts should check its access |
|
114 * @return ETrue if accessible, EFalse if not |
|
115 */ |
|
116 TBool IsAccessibleL(TInt aCheckType); |
|
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 */ |
|
130 void LaunchL( const TDesC8& aCustomMessage ); |
|
131 |
|
132 /** |
|
133 * Return application uid this target launches. |
|
134 * |
|
135 * @since S60 v3.2 |
|
136 */ |
|
137 TUid AppUid() const; |
|
138 |
|
139 /** |
|
140 * Return an additional id this target may use when |
|
141 * launching. Default implementation return TUid(-1) |
|
142 * |
|
143 * @since S60 v3.2 |
|
144 */ |
|
145 TUid AdditionalUid() const; |
|
146 |
|
147 protected: |
|
148 |
|
149 private: |
|
150 |
|
151 CAiScutTargetApp(CAiScutEngine& aEngine, TShortcutType aType, const TUid aUid); |
|
152 |
|
153 void ConstructL(const TAiScutParser& aParser); |
|
154 |
|
155 /** |
|
156 * |
|
157 */ |
|
158 void GetCaptionL(TAiScutAppTitleType aTitleType) const; |
|
159 |
|
160 /** |
|
161 * Creates the application icon |
|
162 * |
|
163 * @since S60 v3.2 |
|
164 */ |
|
165 void CreateAppIconL(CGulIcon*& aIcon) const; |
|
166 |
|
167 /** |
|
168 * Creates the NonNative application icon |
|
169 * |
|
170 * @since S60 v3.2 |
|
171 */ |
|
172 CGulIcon* CreateNonNativeIconL() const; |
|
173 |
|
174 /** |
|
175 * Performs Central Repository shortcut set |
|
176 * for EasyVoIP application. |
|
177 */ |
|
178 void SetEasyVoIPShortcutStartL() const; |
|
179 |
|
180 CGulIcon* CreateSubstituteIconL( MAknsSkinInstance* aSkin, TUid aAppUid, TUid iViewUid ) const; |
|
181 private: // data |
|
182 |
|
183 /** |
|
184 * Application uid. |
|
185 */ |
|
186 TUid iAppUid; |
|
187 |
|
188 /** |
|
189 * Possible view uid. |
|
190 */ |
|
191 TUid iViewUid; |
|
192 |
|
193 /** |
|
194 * Shortcut caption. |
|
195 * Own. |
|
196 */ |
|
197 mutable HBufC* iCaption; |
|
198 |
|
199 /** |
|
200 * Shortcut short caption. |
|
201 * Own. |
|
202 */ |
|
203 mutable HBufC* iShortCaption; |
|
204 |
|
205 /** |
|
206 * Holds the shortcut definition string. |
|
207 * Own. |
|
208 */ |
|
209 HBufC* iDefinition; |
|
210 |
|
211 /** |
|
212 * Run the application in the background. |
|
213 */ |
|
214 TBool iBackground; |
|
215 |
|
216 /** |
|
217 * Command line parameter. |
|
218 * Own. |
|
219 */ |
|
220 HBufC8* iMsg; |
|
221 |
|
222 }; |
|
223 |
|
224 #endif // CAISCUTTARGETAPP_H |
|
225 |
|
226 // End of File. |
|