96 |
97 |
97 return self; |
98 return self; |
98 } |
99 } |
99 |
100 |
100 // ----------------------------------------------------------- |
101 // ----------------------------------------------------------- |
101 // CPhoneTransferDialerController::Initialize |
|
102 // ----------------------------------------------------------- |
|
103 // |
|
104 void CPhoneTransferDialerController::InitializeL( CAknToolbar& aToolbar ) |
|
105 { |
|
106 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
107 "CPhoneTransferDialerController::InitializeL()"); |
|
108 |
|
109 if ( !iIsInitialized ) |
|
110 { |
|
111 __PHONELOG1( |
|
112 EAll, |
|
113 PhoneUIVoIPExtension, |
|
114 "Toolbar control count:=%d", |
|
115 aToolbar.CountComponentControls()); |
|
116 iToolbar = &aToolbar; |
|
117 // Create transfer specific buttons and add them to the |
|
118 // toolbar starting from index 0 |
|
119 CAknButton* button( NULL ); |
|
120 |
|
121 for( TInt i = 0; i < KButtonCount; i++ ) |
|
122 { |
|
123 TAknsItemID skinId = SkinId( bArray[i].iIconIndex ); |
|
124 // Load tooltip text. |
|
125 HBufC* tooltipText = GetTooltipTextL( bArray[i].iCommandId ); |
|
126 CleanupStack::PushL( tooltipText ); |
|
127 button = CreateButtonLC( |
|
128 bArray[i].iIconIndex, |
|
129 bArray[i].iMaskIndex, |
|
130 *tooltipText, |
|
131 skinId ); |
|
132 // Toolbar takes ownership of the button |
|
133 iToolbar->AddItemL( button, EAknCtButton, bArray[i].iCommandId, 0, i ); |
|
134 CleanupStack::Pop( button ); |
|
135 CleanupStack::PopAndDestroy( tooltipText ); |
|
136 } |
|
137 iIsInitialized = ETrue; |
|
138 } |
|
139 |
|
140 iNumberEntryIsEmpty = ETrue; |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------- |
|
144 // CPhoneTransferDialerController::CbaResourceId |
102 // CPhoneTransferDialerController::CbaResourceId |
145 // ----------------------------------------------------------- |
103 // ----------------------------------------------------------- |
146 // |
104 // |
147 TInt CPhoneTransferDialerController::CbaResourceId() const |
105 TInt CPhoneTransferDialerController::CbaResourceId() const |
148 { |
106 { |
175 "CPhoneTransferDialerController::NumberEntryPromptTextL()"); |
133 "CPhoneTransferDialerController::NumberEntryPromptTextL()"); |
176 if ( !iNumberEntryPromptText ) |
134 if ( !iNumberEntryPromptText ) |
177 { |
135 { |
178 iNumberEntryPromptText = StringLoader::LoadL( |
136 iNumberEntryPromptText = StringLoader::LoadL( |
179 CPhoneMainResourceResolver::Instance()-> |
137 CPhoneMainResourceResolver::Instance()-> |
180 ResolveResourceID( EPhoneVoIPTransferAddress ) ); |
138 ResolveResourceID( EPhoneVoIPTransferAddress ), &iCoeEnv ); |
181 } |
139 } |
182 |
140 |
183 return *iNumberEntryPromptText; |
141 return *iNumberEntryPromptText; |
184 } |
142 } |
185 |
143 |
186 // ----------------------------------------------------------- |
144 // --------------------------------------------------------------------------- |
187 // CPhoneTransferDialerController::HandleNumberEntryIsEmpty |
145 // GetButtonData |
188 // ----------------------------------------------------------- |
146 // --------------------------------------------------------------------------- |
189 // |
147 // |
190 void CPhoneTransferDialerController::HandleNumberEntryIsEmpty( TBool aIsEmpty ) |
148 TInt CPhoneTransferDialerController::GetButtonData( TButtonIndex aIndex, RPointerArray<CButtonData>& aData ) const |
|
149 { |
|
150 TInt err = KErrNone; |
|
151 |
|
152 TInt arrayIdx = KErrNotFound; |
|
153 if ( aIndex == ECallButton ) |
|
154 { |
|
155 arrayIdx = 0; |
|
156 } |
|
157 else if ( aIndex == EPhonebookButton ) |
|
158 { |
|
159 arrayIdx = 1; |
|
160 } |
|
161 |
|
162 if ( arrayIdx >= 0 ) |
|
163 { |
|
164 const TPhoneDialerToolbarButton& arrItem = bArray[ arrayIdx ]; |
|
165 CButtonData* btn = NULL; |
|
166 TRAP( err, btn = CreateButtonDataL( arrItem.iCommandId, |
|
167 arrItem.iIconIndex, |
|
168 arrItem.iMaskIndex ) ); |
|
169 if ( !err ) |
|
170 { |
|
171 err = aData.Append( btn ); |
|
172 if ( err ) |
|
173 { |
|
174 delete btn; |
|
175 } |
|
176 } |
|
177 } |
|
178 else |
|
179 { |
|
180 // Trust base class on other buttons (i.e. the clear button) |
|
181 err = CPhoneDialerController::GetButtonData( aIndex, aData ); |
|
182 } |
|
183 |
|
184 return err; |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // ButtonState |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 TInt CPhoneTransferDialerController::ButtonState( TButtonIndex aIndex ) const |
|
192 { |
|
193 // Out button have only one state. Trust base class on clear button |
|
194 if ( aIndex == ECallButton || aIndex == EPhonebookButton ) |
|
195 { |
|
196 return 0; |
|
197 } |
|
198 else |
|
199 { |
|
200 return CPhoneDialerController::ButtonState( aIndex ); |
|
201 } |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // ButtonDimmed |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 TBool CPhoneTransferDialerController::ButtonDimmed( TButtonIndex aIndex ) const |
|
209 { |
|
210 TBool dimmed = EFalse; |
|
211 |
|
212 // Ok is dimmed when there's no number. Search is dimmed when there is |
|
213 // a number. Trust base class on clear button. |
|
214 if ( aIndex == ECallButton ) |
|
215 { |
|
216 dimmed = !iNumberAvailable; |
|
217 } |
|
218 else if ( aIndex == EPhonebookButton ) |
|
219 { |
|
220 dimmed = iNumberAvailable; |
|
221 } |
|
222 else |
|
223 { |
|
224 dimmed = CPhoneDialerController::ButtonDimmed( aIndex ); |
|
225 } |
|
226 return dimmed; |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------------------------- |
|
230 // EasyDialingAllowed |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 TBool CPhoneTransferDialerController::EasyDialingAllowed() const |
|
234 { |
|
235 return EFalse; |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------------------------- |
|
239 // PhoneTransferDialerController::CreateButtonDataL |
|
240 // --------------------------------------------------------------------------- |
|
241 // |
|
242 MPhoneDialerController::CButtonData* CPhoneTransferDialerController::CreateButtonDataL( |
|
243 TInt aCommandId, |
|
244 TInt aNormalIconId, |
|
245 TInt aNormalMaskId ) const |
191 { |
246 { |
192 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
247 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
193 "CPhoneTransferDialerController::HandleNumberEntryIsEmpty()"); |
248 "CPhoneTransferDialerController::CreateButtonDataL()"); |
194 __ASSERT_DEBUG( iToolbar, Panic( EPhoneCtrlInvariant ) ); |
249 |
195 iToolbar->SetItemDimmed( EPhoneCmdTransferDialerOk, aIsEmpty, EFalse ); |
250 // Load tooltip text. |
196 iToolbar->SetItemDimmed( EPhoneCmdTransferDialerSearch, !aIsEmpty, EFalse ); |
251 HBufC* tooltipText = GetTooltipTextL( aCommandId ); |
197 iToolbar->SetItemDimmed( EPhoneDialerCmdClear, aIsEmpty, EFalse ); |
252 CleanupStack::PushL( tooltipText ); |
198 iNumberEntryIsEmpty = aIsEmpty; |
253 |
199 } |
254 // Load icon |
200 |
|
201 // ----------------------------------------------------------- |
|
202 // CPhoneTransferDialerController::ShowButtons |
|
203 // ----------------------------------------------------------- |
|
204 // |
|
205 void CPhoneTransferDialerController::ShowButtons( TBool aShow ) |
|
206 { |
|
207 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
208 "CPhoneTransferDialerController::ShowButtons()"); |
|
209 __ASSERT_DEBUG( iToolbar, Panic( EPhoneCtrlInvariant ) ); |
|
210 for( TInt i = 0; i < KButtonCount; i++ ) |
|
211 { |
|
212 iToolbar->HideItem( bArray[ i ].iCommandId, !aShow, EFalse ); |
|
213 } |
|
214 |
|
215 if ( aShow ) |
|
216 { |
|
217 iToolbar->SetItemDimmed( EPhoneCmdTransferDialerOk, ETrue, EFalse ); |
|
218 iToolbar->SetItemDimmed( EPhoneCmdTransferDialerSearch, EFalse, EFalse ); |
|
219 iToolbar->SetItemDimmed( EPhoneDialerCmdClear, ETrue, EFalse ); |
|
220 } |
|
221 |
|
222 iToolbar->DrawDeferred(); |
|
223 } |
|
224 |
|
225 // --------------------------------------------------------------------------- |
|
226 // PhoneTransferDialerController::CreateButtonLC |
|
227 // --------------------------------------------------------------------------- |
|
228 // |
|
229 CAknButton* CPhoneTransferDialerController::CreateButtonLC( |
|
230 TInt aNormalIconId, |
|
231 TInt aNormalMaskId, |
|
232 const TDesC& aTooltipText, |
|
233 const TAknsItemID& aSkinIconId ) const |
|
234 { |
|
235 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
236 "CPhoneTransferDialerController::CreateButtonLC()"); |
|
237 TFileName mifPath( KDriveZ ); |
255 TFileName mifPath( KDriveZ ); |
238 mifPath.Append( KDC_APP_BITMAP_DIR ); |
256 mifPath.Append( KDC_APP_BITMAP_DIR ); |
239 mifPath.Append( KPhoneMifFileName ); |
257 mifPath.Append( KPhoneMifFileName ); |
240 |
258 |
241 CAknButton* button = CAknButton::NewLC( |
259 TAknsItemID skinId = SkinId( aNormalIconId ); |
242 mifPath, |
260 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
243 aNormalIconId, |
261 CGulIcon* icon = AknsUtils::CreateGulIconL( skin, skinId, mifPath, |
244 aNormalMaskId, |
262 aNormalIconId, aNormalMaskId ); |
245 -1, -1, // dimmed |
263 CleanupStack::PushL( icon ); |
246 -1, -1, // pressed |
264 |
247 -1, -1, // hover |
265 CButtonData* btnData = new (ELeave) CButtonData( aCommandId, icon, tooltipText ); |
248 KNullDesC, |
266 CleanupStack::Pop( icon ); |
249 aTooltipText, // help |
267 CleanupStack::Pop( tooltipText ); |
250 0, // flags |
268 |
251 0, // state flags |
269 return btnData; |
252 aSkinIconId ); |
|
253 |
|
254 button->SetFocusing( EFalse ); |
|
255 button->SetBackground( iToolbar ); |
|
256 |
|
257 return button; |
|
258 } |
270 } |
259 |
271 |
260 // --------------------------------------------------------------------------- |
272 // --------------------------------------------------------------------------- |
261 // CPhoneTransferDialerController::GetTooltipText |
273 // CPhoneTransferDialerController::GetTooltipText |
262 // |
274 // |