|
1 /* |
|
2 * Copyright (c) 2009 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: Controller for DTMF mode of Dialer |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <StringLoader.h> |
|
19 #include <phoneui.rsg> |
|
20 #include <phoneui.mbg> |
|
21 #include <AknsUtils.h> |
|
22 #include <data_caging_path_literals.hrh> |
|
23 #include "phoneappcommands.hrh" |
|
24 #include "cphonedtmfdialercontroller.h" |
|
25 #include "cphonemainresourceresolver.h" |
|
26 #include "phonerssbase.h" |
|
27 |
|
28 _LIT ( KPhoneMifFileName, "phoneui.mif" ); |
|
29 |
|
30 const CPhoneDialerController::TLocalButtonData KSendDtmfButtonData = |
|
31 { |
|
32 EPhoneCmdDtmfOk, |
|
33 EAknsMinorGenericQgnIndiButtonSendDtmf, |
|
34 EMbmPhoneuiQgn_indi_button_send_dtmf, |
|
35 EMbmPhoneuiQgn_indi_button_send_dtmf_mask, |
|
36 R_PHONEUI_DIALER_TOOLTIP_SEND |
|
37 }; |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CPhoneDtmfDialerController |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CPhoneDtmfDialerController::CPhoneDtmfDialerController( |
|
44 CPhoneBubbleWrapper* aBubbleWrapper, |
|
45 CCoeEnv& aCoeEnv ) : |
|
46 CPhoneDialerController( aBubbleWrapper, aCoeEnv ) |
|
47 { |
|
48 // No implementation required |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // ~CPhoneDtmfDialerController |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CPhoneDtmfDialerController::~CPhoneDtmfDialerController() |
|
56 { |
|
57 delete iPromptText; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // NewLC |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CPhoneDtmfDialerController* CPhoneDtmfDialerController::NewLC( |
|
65 CPhoneBubbleWrapper* aBubbleWrapper, |
|
66 CCoeEnv& aCoeEnv ) |
|
67 { |
|
68 CPhoneDtmfDialerController* self = |
|
69 new (ELeave) CPhoneDtmfDialerController( aBubbleWrapper, aCoeEnv ); |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // NewL |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CPhoneDtmfDialerController* CPhoneDtmfDialerController::NewL( |
|
80 CPhoneBubbleWrapper* aBubbleWrapper, |
|
81 CCoeEnv& aCoeEnv ) |
|
82 { |
|
83 CPhoneDtmfDialerController* self = |
|
84 CPhoneDtmfDialerController::NewLC( aBubbleWrapper, aCoeEnv ); |
|
85 CleanupStack::Pop( self ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // ConstructL |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CPhoneDtmfDialerController::ConstructL() |
|
94 { |
|
95 CPhoneDialerController::ConstructL(); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // NumberEntryPromptTextL |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 const TDesC& CPhoneDtmfDialerController::NumberEntryPromptTextL() |
|
103 { |
|
104 if ( !iPromptText ) |
|
105 { |
|
106 // Load prompt text when it's needed for the first time. |
|
107 // It can't be loaded in constructor as resource resolver |
|
108 // is not yet properly set up at that time. |
|
109 TInt resourceId = |
|
110 CPhoneMainResourceResolver::Instance()-> |
|
111 ResolveResourceID( EPhoneDtmfDialerNumberEntryPromptText ); |
|
112 iPromptText = StringLoader::LoadL( resourceId, &iCoeEnv ); |
|
113 } |
|
114 if ( iPromptText ) |
|
115 { |
|
116 return *iPromptText; |
|
117 } |
|
118 return KNullDesC; |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // GetButtonDataL |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 TInt CPhoneDtmfDialerController::GetButtonData( TButtonIndex aIndex, RPointerArray<CButtonData>& aData ) const |
|
126 { |
|
127 TInt err = KErrNone; |
|
128 |
|
129 if ( aIndex == ECallButton ) |
|
130 { |
|
131 TFileName mifPath( KDriveZ ); |
|
132 mifPath.Append( KDC_APP_BITMAP_DIR ); |
|
133 mifPath.Append( KPhoneMifFileName ); |
|
134 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
135 CButtonData* btnData = NULL; |
|
136 TRAP( err, btnData = CreateButtonDataL( KSendDtmfButtonData, skin, mifPath ) ); |
|
137 if ( !err ) |
|
138 { |
|
139 err = aData.Append( btnData ); |
|
140 if ( err ) |
|
141 { |
|
142 // append failed, delete created data to avoid memory leak |
|
143 delete btnData; |
|
144 } |
|
145 } |
|
146 } |
|
147 else if ( aIndex == EClearButton ) |
|
148 { |
|
149 // let base class handle backspace |
|
150 err = CPhoneDialerController::GetButtonData( aIndex, aData ); |
|
151 } |
|
152 else |
|
153 { |
|
154 // leave Phonebook button empty |
|
155 } |
|
156 return err; |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // ButtonState |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 TInt CPhoneDtmfDialerController::ButtonState( TButtonIndex aIndex ) const |
|
164 { |
|
165 TInt state = KErrNotFound; |
|
166 // Call button has one only one state, phonebook button has no states. |
|
167 // Clear button is handled by the base class. |
|
168 if ( aIndex == ECallButton ) |
|
169 { |
|
170 state = 0; |
|
171 } |
|
172 else if ( aIndex == EClearButton ) |
|
173 { |
|
174 state = CPhoneDialerController::ButtonState( aIndex ); |
|
175 } |
|
176 return state; |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // GetButtonDimmed |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 TBool CPhoneDtmfDialerController::ButtonDimmed( TButtonIndex aIndex ) const |
|
184 { |
|
185 TBool dimmed = ETrue; |
|
186 // Call button is dimmed while number entry is empty. Phonebook button |
|
187 // is empty and always dimmed. Clear button is handled by the base class. |
|
188 if ( aIndex == ECallButton ) |
|
189 { |
|
190 dimmed = !iNumberAvailable; |
|
191 } |
|
192 else if ( aIndex == EClearButton ) |
|
193 { |
|
194 dimmed = CPhoneDialerController::ButtonDimmed( EClearButton ); |
|
195 } |
|
196 return dimmed; |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // EasyDialingAllowed |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 TBool CPhoneDtmfDialerController::EasyDialingAllowed() const |
|
204 { |
|
205 return EFalse; |
|
206 } |
|
207 |
|
208 // end of file |