|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Handles the updating dialer, toolbar buttons. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPHONEDIALERCONTROLLER_H |
|
20 #define CPHONEDIALERCONTROLLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <akntoolbarobserver.h> |
|
24 #include <mnumberentry.h> |
|
25 #include "mphonenumberentrychangedhandler.h" |
|
26 |
|
27 class CAknToolbar; |
|
28 class CPhoneBubbleWrapper; |
|
29 class CCoeEnv; |
|
30 class CPhoneMenuController; |
|
31 class TPhoneCommandParam; |
|
32 class CAknButton; |
|
33 class TAknsItemID; |
|
34 class MPhoneDialerController; |
|
35 class TPhoneCommandParam; |
|
36 |
|
37 /** |
|
38 * Dialer controller, updates toolbar buttons |
|
39 * |
|
40 * @lib PhoneUIView.lib |
|
41 * @since S60 v5.0 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CPhoneDialerController ): |
|
44 public CBase, public MAknToolbarObserver, public MNumberEntryObserver, |
|
45 public MPhoneNumberEntryChangedHandler |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aBubbleWrapper |
|
51 * @param aCoeEnv |
|
52 * @param aMenuController |
|
53 */ |
|
54 static CPhoneDialerController* NewL( CPhoneBubbleWrapper& aBubbleWrapper, |
|
55 CCoeEnv& aCoeEnv, |
|
56 CPhoneMenuController& aMenuController ); |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CPhoneDialerController(); |
|
61 |
|
62 /** |
|
63 * Updates toolbar buttons according to numberentry state. |
|
64 * |
|
65 * @since S60 v5.0 |
|
66 */ |
|
67 void UpdateToolbar(); |
|
68 |
|
69 /** |
|
70 * Sets state of dtmf dialer visibility. |
|
71 * |
|
72 * @since S60 v5.0 |
|
73 * @param aVisible |
|
74 */ |
|
75 void SetDtmfDialerVisibleL( TBool aVisible ); |
|
76 |
|
77 /** |
|
78 * Returns dtmf dialer visibility status. |
|
79 * |
|
80 * @since S60 v5.0 |
|
81 * @return ETrue if DTMF Dialer is visible |
|
82 */ |
|
83 TBool IsDTMFDialerVisible() const; |
|
84 |
|
85 /** |
|
86 * Sets state of restricted dialer. |
|
87 * |
|
88 * @since S60 v5.0 |
|
89 * @param aRestricted |
|
90 */ |
|
91 void SetRestrictedDialer( TBool aRestricted ); |
|
92 |
|
93 /** |
|
94 * Sets state of service code flag. |
|
95 * |
|
96 * @since S60 v5.0 |
|
97 * @param aCommandParam |
|
98 */ |
|
99 void SetServiceCodeFlagL( TPhoneCommandParam* aCommandParam ); |
|
100 |
|
101 /** |
|
102 * Enables toolbar |
|
103 * |
|
104 * @since S60 v5.0 |
|
105 */ |
|
106 void ShowToolbar(); |
|
107 |
|
108 /** |
|
109 * Disables toolbar |
|
110 * |
|
111 * @since S60 v5.0 |
|
112 */ |
|
113 void HideToolbar(); |
|
114 |
|
115 /** |
|
116 * Sets custom dialer visible. |
|
117 * @param aCustomController Pointer to dialer extension implementation |
|
118 * @since S60 v5.1 |
|
119 */ |
|
120 void ShowCustomizedDialerL( |
|
121 MPhoneDialerController* aCustomController ); |
|
122 |
|
123 /** |
|
124 * Sets custom dialer visible. |
|
125 * @since S60 v5.1 |
|
126 */ |
|
127 void HideCustomizedDialer(); |
|
128 |
|
129 /** |
|
130 * Returns flag indicating if customized dialer is visible. |
|
131 * @return ETrue if customized dialer visible, else EFalse |
|
132 * @since S60 v5.1 |
|
133 */ |
|
134 TBool IsCustomizedDialerVisible() const; |
|
135 |
|
136 /** |
|
137 * Returns sotkeys resource of the customized dialer |
|
138 * @return Customized dialer softkeys resource id |
|
139 * @since S60 v5.1 |
|
140 */ |
|
141 TInt CustomizedCbaResourceId() const; |
|
142 |
|
143 /** |
|
144 * Returns menu resource of the customized dialer |
|
145 * @return Customized dialer menu resource id |
|
146 * @since S60 v5.1 |
|
147 */ |
|
148 TInt CustomizedMenuResourceId() const; |
|
149 |
|
150 public: // from MAknToolbarObserver |
|
151 /** |
|
152 * From base class MAknToolbarObserver |
|
153 * Handles toolbar events for a certain toolbar item. |
|
154 * |
|
155 * @param aCommand The command ID of some toolbar item. |
|
156 */ |
|
157 void OfferToolbarEventL( TInt aCommand ); |
|
158 |
|
159 /** |
|
160 * From base class MAknToolbarObserver |
|
161 * Should be used to set the properties of some toolbar components |
|
162 * before it is drawn. |
|
163 * |
|
164 * @param aResourceId The resource ID for particular toolbar |
|
165 * @param aToolbar The toolbar object pointer |
|
166 */ |
|
167 void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar ); |
|
168 |
|
169 public: // from MNumberEntryObserver |
|
170 /** |
|
171 * From base class MNumberEntryObserver |
|
172 * Indication that numberentry state changed |
|
173 * |
|
174 * @since S60 v5.0 |
|
175 */ |
|
176 void NumberEntryStateChanged( TBool aHidePromptText ); |
|
177 |
|
178 public: // from base class MPhoneNumberEntryChangedHandler |
|
179 |
|
180 /** |
|
181 * From MPhoneNumberEntryChangedHandler |
|
182 * |
|
183 * Handles number entry state change. |
|
184 * Checks has the content of the number entry been modifed. |
|
185 * Informs the via call back functionality the party interested about |
|
186 * the change. (at the moment phone state machine) |
|
187 * |
|
188 * @since S60 5.0 |
|
189 */ |
|
190 void HandleNumberEntryChanged( ); |
|
191 |
|
192 /** |
|
193 * From MPhoneNumberEntryChangedHandler |
|
194 * |
|
195 * Sets the call back function that is used to get notification when the |
|
196 * content of the Number Entry has changed. (Used by the the phone |
|
197 * statemachine.) |
|
198 * |
|
199 * @since S60 5.0 |
|
200 */ |
|
201 void SetNumberEntryChangedCallBack( TPhoneCommandParam* aCommandParam ); |
|
202 |
|
203 private: |
|
204 |
|
205 /** |
|
206 * Creates CAknButton with given parameters and leaves it to |
|
207 * CleanupStack. |
|
208 * |
|
209 * @param aNormalIconId |
|
210 * @param aNormalMaskId |
|
211 * @param aTooltipText |
|
212 * @param aSkinIconId |
|
213 * @param aCommand |
|
214 */ |
|
215 CAknButton* CreateButtonLC( TInt aNormalIconId, |
|
216 TInt aNormalMaskId, |
|
217 const TDesC& aTooltipText, |
|
218 const TAknsItemID& aSkinIconId, |
|
219 TInt aCommand ); |
|
220 |
|
221 /** |
|
222 * Creates button set for an empty Number Entry. |
|
223 */ |
|
224 void CreateButtonSetNumberEntryEmpty(); |
|
225 |
|
226 /** |
|
227 * Creates button set for Number Entry when some charaters |
|
228 * have been entered. |
|
229 */ |
|
230 void CreateButtonSetNumberEntryNotEmpty(); |
|
231 |
|
232 /** |
|
233 * Constructor. |
|
234 * |
|
235 * @param aBubbleWrapper |
|
236 * @param aCoeEnv |
|
237 * @param aMenuController |
|
238 */ |
|
239 CPhoneDialerController( CPhoneBubbleWrapper& aBubbleWrapper, |
|
240 CCoeEnv& aCoeEnv, |
|
241 CPhoneMenuController& aMenuController ); |
|
242 /** |
|
243 * Symbian 2nd phase constructor. |
|
244 * |
|
245 */ |
|
246 void ConstructL(); |
|
247 |
|
248 /** |
|
249 * Searches the skin id for the given icon. |
|
250 */ |
|
251 inline TAknsItemID SkinId( TInt aIconIndex ); |
|
252 |
|
253 /** |
|
254 * Searches the tooltip text for the button using the |
|
255 * the given command id. |
|
256 * |
|
257 * @param aCommandId the command id |
|
258 * @param aText the searched tooltip text |
|
259 */ |
|
260 void GetTooltipTextL( TInt aCommandId, HBufC*& aText ); |
|
261 |
|
262 private: // data |
|
263 /** |
|
264 * AknToolbar. |
|
265 * Not own. |
|
266 */ |
|
267 CAknToolbar* iToolbar; |
|
268 |
|
269 /** |
|
270 * The reference to the Bubblewrapper |
|
271 */ |
|
272 CPhoneBubbleWrapper& iBubbleWrapper; |
|
273 |
|
274 /** |
|
275 * CoeEnv |
|
276 */ |
|
277 CCoeEnv& iCoeEnv; |
|
278 |
|
279 /** |
|
280 * Menucontroller |
|
281 */ |
|
282 CPhoneMenuController& iMenuController; |
|
283 |
|
284 /** |
|
285 * Used to check is the Dialer in DTMF mode |
|
286 */ |
|
287 TBool iDtmfDialerVisible; |
|
288 |
|
289 /** |
|
290 * Used to check is the Dialer in the restricted mode. |
|
291 * 'Send' and 'Add to Contacts' buttons are dimmed. |
|
292 */ |
|
293 TBool iRestrictedDialer; |
|
294 |
|
295 /** |
|
296 * Used to check is the service code flag set. |
|
297 * Tooltip text is changed between 'Send' or 'Call' |
|
298 */ |
|
299 TBool iServiceCodeFlag; |
|
300 |
|
301 /* |
|
302 * Is used to check has the hide prompt text flag changed. |
|
303 */ |
|
304 TBool iPreviousHidePromptTextStatus; |
|
305 |
|
306 // Pointer to dialer extension implementation |
|
307 MPhoneDialerController* iCustomizedDialer; |
|
308 |
|
309 /** |
|
310 * Is used to check should toolbar be updated. |
|
311 */ |
|
312 TBool iUpdateToolbar; |
|
313 |
|
314 }; |
|
315 |
|
316 #include "cphonedialercontroller.inl" |
|
317 |
|
318 #endif // CPHONEDIALERCONTROLLER_H |