|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Declares view for application. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <bldvariant.hrh> |
|
25 #include <aknViewAppUi.h> |
|
26 #include <avkon.hrh> |
|
27 #include <akntitle.h> |
|
28 #include <aknlists.h> |
|
29 #include <eikmenub.h> |
|
30 |
|
31 #include <SpeedDial.rsg> |
|
32 #include <featmgr.h> |
|
33 #include <AiwCommon.hrh> //KAiwCmdCall |
|
34 #include <aiwdialdataext.h> |
|
35 #include <StringLoader.h> |
|
36 #include <aknnotedialog.h> |
|
37 #include "speeddial.hrh" |
|
38 #include "SpdiaControl.hrh" |
|
39 #include "speeddialprivate.h" |
|
40 |
|
41 #include "SpdiaView.h" |
|
42 #include "SpdiaContainer.h" |
|
43 #include "SpdiaAppUi.h" |
|
44 #include <aknlayoutscalable_apps.cdl.h> |
|
45 #include <layoutmetadata.cdl.h> |
|
46 #include <vmnumber.h> |
|
47 #include <voicemailboxdomaincrkeys.h> |
|
48 #include <MVPbkContactLink.h> |
|
49 #include <telvmbxsettingscrkeys.h> |
|
50 |
|
51 #include <settingsinternalcrkeys.h> |
|
52 #include <SpeeddialPrivateCRKeys.h> |
|
53 #include "SpdCtrl.rsg" |
|
54 |
|
55 |
|
56 #include <CMessageData.h> |
|
57 #include <txtrich.h> |
|
58 #include <SendUiConsts.h> |
|
59 #include <Sendnorm.rsg> |
|
60 #include <MVPbkContactFieldTextData.h> |
|
61 |
|
62 _LIT( KSpace, " " ); |
|
63 |
|
64 // ================= MEMBER FUNCTIONS ======================= |
|
65 |
|
66 // --------------------------------------------------------- |
|
67 // CSpdiaView::NewLC |
|
68 // |
|
69 // --------------------------------------------------------- |
|
70 CSpdiaView* CSpdiaView::NewLC(CSpeedDialPrivate* aSpeedPrivate) |
|
71 { |
|
72 CSpdiaView* self = new( ELeave ) CSpdiaView; |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL(aSpeedPrivate); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // CSpdiaView::ConstructL |
|
80 // Symbian two-phased constructor |
|
81 // --------------------------------------------------------- |
|
82 void CSpdiaView::ConstructL(CSpeedDialPrivate* aSpeedPrivate) |
|
83 { |
|
84 BaseConstructL( R_SPDIA_VIEW ); |
|
85 CSpdiaBaseView::ConstructL(); |
|
86 |
|
87 iSpeedPrivate = aSpeedPrivate; |
|
88 |
|
89 iCbaID = R_SPDIA_MENUBAR_VIEW_VOICE; |
|
90 |
|
91 // Attach the AIW CallUI menus with to speeddial menus. |
|
92 // This is used for CallUI menus that we want attach |
|
93 // into our owm menus. |
|
94 |
|
95 iServiceHandler = CAiwServiceHandler::NewL(); |
|
96 iServiceHandler->AttachMenuL( R_SPDIA_VIEW_MENU, R_SPDIAL_APP_INTEREST ); |
|
97 iServiceHandler->AttachMenuL( R_SPDIA_VIEW_MENU_OK_CALL, R_SPDIAL_APP_INTEREST ); |
|
98 iServiceHandler->AttachMenuL( R_SPDIA_VIEW_MENU_OK_CALL_VIDEO, R_SPDIAL_APP_INTEREST ); |
|
99 |
|
100 // Attach the AIW CallUI query menus to speeddial . |
|
101 // This is used for CallUI list query menu (i.e menu that |
|
102 // is not attached to any of speeddial own menus). |
|
103 |
|
104 iServiceHandler->AttachL( R_SPDIAL_APP_INTEREST ); |
|
105 iReleasenumberFlag = EFalse; |
|
106 iClientRectChanged = EFalse; |
|
107 //CEikonEnv::Static()->AppUiFactory()->StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY ); |
|
108 |
|
109 iSendUi = CSendUi::NewL(); |
|
110 iAIWRunFlag = EFalse; |
|
111 iAssignCompletedFlag = ETrue; |
|
112 iIsShowVmbxDlg = EFalse; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------- |
|
116 // CSpdiaView::~CSpdiaView |
|
117 // ?implementation_description |
|
118 // --------------------------------------------------------- |
|
119 CSpdiaView::~CSpdiaView() |
|
120 { |
|
121 delete iContainer; |
|
122 delete iServiceHandler; |
|
123 delete iSendUi; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CSpdiaView::LoadCbaL |
|
128 // Loads relevant CBA key |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 void CSpdiaView::LoadCba(TInt aResourceID) |
|
132 { |
|
133 if ( iCbaID != aResourceID ) |
|
134 { |
|
135 MenuBar()->SetMenuTitleResourceId( aResourceID ); |
|
136 iCbaID = aResourceID; |
|
137 } |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // CSpdiaView::Id |
|
142 // --------------------------------------------------------- |
|
143 TUid CSpdiaView::Id() const |
|
144 { |
|
145 return KViewId; |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CSpdiaView::NumberCallL |
|
150 // Call Phone client |
|
151 // Function used when send key is pressed. |
|
152 // --------------------------------------------------------------------------- |
|
153 void CSpdiaView::NumberCallL( const TDesC& aNumber, |
|
154 TInt& aNumberType, TBool aVmbx ) |
|
155 { |
|
156 // Set type to EAIWForcedCS if calltype is Vmbx. |
|
157 CAiwDialData::TCallType callType |
|
158 = aVmbx ? CAiwDialData::EAIWForcedCS : CAiwDialData::EAIWVoice; |
|
159 |
|
160 |
|
161 switch( aNumberType ) |
|
162 { |
|
163 case ESpDialPbkFieldIdPhoneNumberVideo: |
|
164 callType = CAiwDialData::EAIWForcedVideo; |
|
165 break; |
|
166 |
|
167 case ESpDialPbkFieldIdVOIP: |
|
168 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
|
169 { |
|
170 callType = CAiwDialData::EAIWVoiP; |
|
171 } |
|
172 break; |
|
173 default: |
|
174 break; |
|
175 |
|
176 } |
|
177 CmdNumberCallL( KAiwCmdCall, ETrue, aNumber, callType ); |
|
178 |
|
179 |
|
180 #ifdef COMMENTED //Start of Comment -Existing Code |
|
181 |
|
182 if ( aNumberType == ESpDialPbkFieldIdPhoneNumberVideo ) // change |
|
183 { |
|
184 callType = EAiwForcedVideo; |
|
185 CmdNumberCallL( KAiwCmdCall, ETrue, aNumber, callType ); |
|
186 } |
|
187 // If field Id is ESpDialPbkFieldIdVOIP, set call type to VoIP. |
|
188 else if ( aNumberType == ESpDialPbkFieldIdVOIP ) |
|
189 && FeatureManager::FeatureSupported(KFeatureIdCommonVoip)) |
|
190 { |
|
191 callType = EAiwVoIPCall; |
|
192 CmdNumberCallL(KAiwCmdCall, ETrue, aNumber, callType ); |
|
193 } |
|
194 else |
|
195 { |
|
196 CmdNumberCallL( KAiwCmdCall, ETrue, aNumber, callType ); |
|
197 } |
|
198 #endif //End of Comment - Existing code |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------- |
|
202 // CSpdiaView::HandleCommandL |
|
203 // ?implementation_description |
|
204 // --------------------------------------------------------- |
|
205 void CSpdiaView::HandleCommandL(TInt aCommand) |
|
206 { |
|
207 if(iSpeedPrivate->GetWait()->IsStarted()) |
|
208 return; |
|
209 |
|
210 if ( !iAssignCompletedFlag ) |
|
211 { |
|
212 return; |
|
213 } |
|
214 |
|
215 switch ( aCommand ) |
|
216 { |
|
217 case ESpdiaCmdNumberCall: |
|
218 { |
|
219 CmdNumberCallL(KAiwCmdCall, ETrue ); //KAiwCmdCall: CallUI shows list query if necessary |
|
220 break; |
|
221 } |
|
222 case EAknSoftkeyExit: |
|
223 { |
|
224 AppUi()->Exit(); |
|
225 break; |
|
226 } |
|
227 case EAknCmdExit: |
|
228 { |
|
229 AppUi()->ProcessCommandL( EAknCmdExit ); |
|
230 break; |
|
231 } |
|
232 case ESpdiaCmdChange: |
|
233 case ESpdiaCmdAssign: |
|
234 { |
|
235 CmdAssignNumberL(); |
|
236 break; |
|
237 } |
|
238 case ESpdiaCmdClear: |
|
239 { |
|
240 CmdReleaseNumberL(); |
|
241 break; |
|
242 } |
|
243 case ESpdiaCmdView: |
|
244 { |
|
245 CmdViewNumberL(); |
|
246 break; |
|
247 } |
|
248 |
|
249 case ESpdiaCmdMessage: |
|
250 { |
|
251 CmdSendMessageL(); |
|
252 break; |
|
253 } |
|
254 |
|
255 //for help |
|
256 case EAknCmdHelp: |
|
257 { |
|
258 AppUi()->HandleCommandL(aCommand); |
|
259 break; |
|
260 } |
|
261 case EAknCmdTaskSwapper: |
|
262 { |
|
263 //do nothing |
|
264 break; |
|
265 } |
|
266 default: |
|
267 { |
|
268 CmdNumberCallL( aCommand, EFalse ); |
|
269 break; |
|
270 } |
|
271 } |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------- |
|
275 // CSpdiaView::HandleClientRectChange |
|
276 // |
|
277 // --------------------------------------------------------- |
|
278 void CSpdiaView::HandleClientRectChange() |
|
279 { |
|
280 if ( iContainer && !iClientRectChanged ) |
|
281 { |
|
282 iClientRectChanged = ETrue; |
|
283 iContainer->SetRect( ClientRect() ); |
|
284 iClientRectChanged = EFalse; |
|
285 } |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------- |
|
289 // CSpdiaView::HandleStatusPaneSizeChange |
|
290 // |
|
291 // --------------------------------------------------------- |
|
292 void CSpdiaView::HandleStatusPaneSizeChange() |
|
293 { |
|
294 HandleClientRectChange(); |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------- |
|
298 // CSpdiaView::CmdAssignNumberL |
|
299 // Command handle : Assign |
|
300 // --------------------------------------------------------- |
|
301 TBool CSpdiaView::CmdAssignNumberL() |
|
302 { |
|
303 if ( ( iContainer->IsVoiceMailBox() ) || ( iContainer->IsVdoMailBox() ) ) |
|
304 { |
|
305 return EFalse; |
|
306 } |
|
307 // Return EFalse if speeddial does not finish assigning. |
|
308 if ( CSpeedDialPrivate::STATE_IDLE != iSpeedPrivate->State() ) |
|
309 { |
|
310 return EFalse; |
|
311 } |
|
312 TInt error( KErrNone ); |
|
313 TInt result( KErrNone ); |
|
314 CSpeedDialPrivate& control = iContainer->Control(); |
|
315 |
|
316 // A display state will be restored supposing it is an error. |
|
317 TInt index( iContainer->CurGridPosition() ); |
|
318 result = control.CheckingIfPopUpNeededL(); |
|
319 control.MakeVisible( EFalse ); |
|
320 |
|
321 if ( result ) |
|
322 { |
|
323 result = PopUpEnableSpDiaDlgL(); |
|
324 if ( result != ESpdCmdEnableYes && |
|
325 result != ESpdCmdEnableNo && |
|
326 result != EEikBidOk ) |
|
327 { |
|
328 return EFalse; |
|
329 } |
|
330 } |
|
331 |
|
332 MVPbkContactLink *assignContact = NULL; |
|
333 |
|
334 // set the update flag |
|
335 iAssignNumberFlag = EFalse; |
|
336 index = index + 1; |
|
337 |
|
338 // launches the ContactFetchView of the Phonebook |
|
339 iAssignCompletedFlag = EFalse; |
|
340 result = control.ShowAssign( index, assignContact ); |
|
341 iAssignCompletedFlag = ETrue; |
|
342 index = index - 1; |
|
343 delete assignContact; |
|
344 |
|
345 if ( result == KErrNone ) |
|
346 { |
|
347 // If contact is selected sucessfully |
|
348 iAssignNumberFlag = EFalse; |
|
349 } |
|
350 else |
|
351 { |
|
352 // If ConatactFetchView is canceled |
|
353 iAssignNumberFlag = ETrue; |
|
354 } |
|
355 |
|
356 control.MakeVisible( ETrue ); |
|
357 UndoLayoutAndLeaveL( error ); |
|
358 // Control pane is not updated quickly after canceling "Change" from options menu |
|
359 iContainer->MiddleSoftKeyL(); |
|
360 |
|
361 TRect mainPaneRect ; |
|
362 TRect statusPaneRect; |
|
363 TPoint oldPosition; |
|
364 oldPosition.iX = 0; |
|
365 oldPosition.iY = 0; |
|
366 |
|
367 // Set the layout after assingning the contact |
|
368 iContainer->SetStatusPaneL(); |
|
369 |
|
370 // Update the whole grid |
|
371 TRAP( error, iContainer->UpdatePhoneNumberL( -1 ) ); |
|
372 |
|
373 UndoLayoutAndLeaveL( error ); |
|
374 |
|
375 // After assigning the contact,set the state as STATE_IDLE |
|
376 iSpeedPrivate->SetState( CSpeedDialPrivate::STATE_IDLE ); |
|
377 |
|
378 // Handle Msk |
|
379 iContainer->MiddleSoftKeyL(); |
|
380 |
|
381 // To exit from FSW |
|
382 if ( result == KLeaveExit ) |
|
383 { |
|
384 AppUi()->Exit(); |
|
385 } |
|
386 |
|
387 // return ETrue if assignment operation success, else return EFalse. |
|
388 if ( KErrNone == result ) |
|
389 { |
|
390 return ETrue; |
|
391 } |
|
392 return EFalse; |
|
393 } |
|
394 |
|
395 // --------------------------------------------------------- |
|
396 // CSpdiaView::DoActivateL |
|
397 // ?implementation_description |
|
398 // --------------------------------------------------------- |
|
399 void CSpdiaView::DoActivateL( |
|
400 const TVwsViewId& /*aPrevViewId*/, |
|
401 TUid /*aCustomMessageId*/, |
|
402 const TDesC8& /*aCustomMessage*/) |
|
403 { |
|
404 if ( !iContainer ) |
|
405 { |
|
406 iContainer = new(ELeave) CSpdiaContainer( iSpeedPrivate ); |
|
407 iContainer->SetMopParent( this ); |
|
408 iContainer->ConstructL( this ); |
|
409 } |
|
410 else |
|
411 { |
|
412 iContainer->ActivateL(); |
|
413 } |
|
414 AppUi()->AddToStackL( *this, iContainer ); |
|
415 iContainer->MiddleSoftKeyL(); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------- |
|
419 // CSpdiaView::DoDeactivate |
|
420 // ?implementation_description |
|
421 // --------------------------------------------------------- |
|
422 void CSpdiaView::DoDeactivate() |
|
423 { |
|
424 if ( iContainer ) |
|
425 { |
|
426 AppUi()->RemoveFromStack( iContainer ); |
|
427 delete iContainer; |
|
428 iContainer=NULL; |
|
429 } |
|
430 } |
|
431 |
|
432 // --------------------------------------------------------- |
|
433 // CSpdiaView::HandleForegroundEventL(...) |
|
434 // Foreground and background events. |
|
435 // @param aForeGround ETrue : come to the foreground |
|
436 // EFalse: removed to the foreground |
|
437 // --------------------------------------------------------- |
|
438 void CSpdiaView::HandleForegroundEventL(TBool aForeground) |
|
439 { |
|
440 if ( iSpeedPrivate == NULL ) |
|
441 { |
|
442 return; |
|
443 } |
|
444 |
|
445 if ( aForeground ) |
|
446 { |
|
447 // We had gone to idle mode using active application.. |
|
448 // We are coming back..Restore the GridStatus.. |
|
449 if ( iSpeedPrivate->State() == CSpeedDialPrivate::STATE_IDLE && |
|
450 iSpeedPrivate->GridStatus() == CSpeedDialPrivate::EGridNoUse ) |
|
451 { |
|
452 iSpeedPrivate->SetGridStatus( CSpeedDialPrivate::EGridUse ); |
|
453 } |
|
454 |
|
455 // The cba resource should be updated when go back to speeddial. |
|
456 iContainer->MiddleSoftKeyL(); |
|
457 LoadCba( iContainer->MenuResourceID() ); |
|
458 |
|
459 iAIWRunFlag = EFalse; |
|
460 |
|
461 // If the view note displays when switching speeddial to background. |
|
462 // Making the note pops up again. |
|
463 if ( iSpeedPrivate->UpdateFlag() && iContainer->GetViewDialogStatus() ) |
|
464 { |
|
465 CmdViewNumberL(); |
|
466 iSpeedPrivate->SetUpdateFlag( EFalse ); |
|
467 } |
|
468 } |
|
469 else |
|
470 { |
|
471 // We are going out of use by active application.. |
|
472 // We are no longer using the Grid..Update GridStatus.. |
|
473 if ( iSpeedPrivate->State() == CSpeedDialPrivate::STATE_IDLE && |
|
474 iSpeedPrivate->GridStatus() == CSpeedDialPrivate::EGridUse ) |
|
475 { |
|
476 iSpeedPrivate->SetGridStatus( CSpeedDialPrivate::EGridNoUse ); |
|
477 } |
|
478 } |
|
479 |
|
480 // For updation of the grid view while coming from the Phonebook view |
|
481 if ( iReleasenumberFlag || iAssignNumberFlag ) |
|
482 { |
|
483 // Refresh and draw the grid |
|
484 iAssignNumberFlag = EFalse; |
|
485 } |
|
486 |
|
487 // On skin change create the speeddial grid and draw the new icons. |
|
488 if ( ( aForeground && ( STATIC_CAST( CSpdiaAppUi*, AppUi() )->IsSkinChanged() ) ) ) |
|
489 { |
|
490 iContainer->HandleResourceChange( KAknsMessageSkinChange ); |
|
491 iContainer->DrawNow(); |
|
492 } |
|
493 } |
|
494 |
|
495 // --------------------------------------------------------- |
|
496 // CSpdiaView::CmdNumberCallL |
|
497 // Command handle : Call |
|
498 // --------------------------------------------------------- |
|
499 void CSpdiaView::CmdNumberCallL ( TInt aCommand, |
|
500 TBool aShowQuery //True: Let CallUI to show query to user |
|
501 //False:Speed Dial menu already shown to user |
|
502 ) |
|
503 { |
|
504 CSpeedDialPrivate& control = iContainer->Control();/////////////////need 2 change |
|
505 TPhCltTelephoneNumber number; |
|
506 TBool call( EFalse ); |
|
507 TInt index( iContainer->CurGridPosition() ); |
|
508 |
|
509 number = control.PhoneNumber( index ); |
|
510 TBuf<1>space( KSpace ); |
|
511 while( number.Length() > 0 && number.Find( space ) != KErrNotFound ) |
|
512 { |
|
513 number.Delete( number.Find( space ), 1 ); |
|
514 } |
|
515 |
|
516 int type = control.NumberType( index ); |
|
517 if ( ( iContainer->IsVoiceMailBox()) || ( iContainer->IsVdoMailBox() ) ) |
|
518 { |
|
519 TInt numberType( ESpDialPbkFieldIdNone ); |
|
520 CRepository* vmbxkey2 = CRepository::NewL( KCRUidTelVideoMailbox ); |
|
521 vmbxkey2->Get( KTelVideoMbxKey, vmbxsupported ); |
|
522 delete vmbxkey2; |
|
523 vmbxkey2 = NULL; |
|
524 iAIWRunFlag = ETrue; |
|
525 if ( vmbxsupported == 2 ) |
|
526 { |
|
527 if ( iContainer->IsVoiceMailBox() ) |
|
528 { |
|
529 call = control.ExVoiceMailL( number ); |
|
530 } |
|
531 else if ( iContainer->IsVdoMailBox() ) |
|
532 { |
|
533 call = control.ExVideoMailL( number ); |
|
534 } |
|
535 } |
|
536 else |
|
537 { |
|
538 iStatusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
539 iStatusPane->MakeVisible( ETrue ); |
|
540 iStatusPane->DrawNow(); |
|
541 // When Vmbx dialog need to showing, set the flag to ETrue. |
|
542 iIsShowVmbxDlg = ETrue; |
|
543 if ( iContainer->IsVoiceMailBox() || iContainer->IsVdoMailBox() ) |
|
544 { |
|
545 call = control.VoiceMailL( number ); |
|
546 } |
|
547 iIsShowVmbxDlg = EFalse; |
|
548 iContainer->VoiceMailDialogLaunched( EFalse ); |
|
549 iContainer->SetStatusPaneL(); |
|
550 } |
|
551 iAIWRunFlag = EFalse; |
|
552 if ( call ) |
|
553 { |
|
554 TInt vmbxType = control.VoiceMailType(); |
|
555 if( vmbxType == EVmbxIP ) |
|
556 { |
|
557 numberType = ESpDialPbkFieldIdVOIP; |
|
558 } |
|
559 else if( vmbxType == EVmbxVideo ) |
|
560 { |
|
561 numberType = ESpDialPbkFieldIdPhoneNumberVideo; |
|
562 } |
|
563 // Vmbx call, set ETrue to set EAIWForcedCS type. |
|
564 NumberCallL( number, numberType, ETrue ); |
|
565 } |
|
566 } |
|
567 else if ( control.Contact(index ) != NULL ) |
|
568 { |
|
569 //Set default call type (however this may be changed by CallUI).If event or |
|
570 //call type is video number type, we provie video call option as default |
|
571 CAiwDialData::TCallType callType = CAiwDialData::EAIWVoice; |
|
572 |
|
573 if ( type == ESpDialPbkFieldIdPhoneNumberVideo ) |
|
574 { |
|
575 callType = CAiwDialData::EAIWForcedVideo; |
|
576 } |
|
577 // If field Id is ESpDialPbkFieldIdVOIP, set call type to VoIP. |
|
578 else if ( type == ESpDialPbkFieldIdVOIP && FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
|
579 { |
|
580 callType = CAiwDialData::EAIWVoiP; |
|
581 } |
|
582 CmdNumberCallL( aCommand, aShowQuery, number, callType ); |
|
583 } |
|
584 } |
|
585 |
|
586 |
|
587 // --------------------------------------------------------- |
|
588 // CSpdiaView::CmdNumberCallL |
|
589 // Command handle : Call |
|
590 // --------------------------------------------------------- |
|
591 |
|
592 void CSpdiaView::CmdNumberCallL ( TInt aCommandId, |
|
593 TBool aShowQuery, |
|
594 TPtrC aNumber, |
|
595 CAiwDialData::TCallType aCallType ) |
|
596 { |
|
597 if( !aNumber.Length() ) |
|
598 { |
|
599 return; |
|
600 } |
|
601 |
|
602 // We have phone number, so let's set the dial data |
|
603 CAiwDialDataExt* dialData = CAiwDialDataExt::NewLC(); |
|
604 dialData->SetCallType( aCallType ); |
|
605 |
|
606 MVPbkStoreContact* contact = iSpeedPrivate->Contact( iContainer->CurGridPosition() ); |
|
607 if ( contact ) |
|
608 { |
|
609 HBufC* nameBuffer( NULL ); |
|
610 nameBuffer = iSpeedPrivate->ContactTitleL( contact, ETrue ); |
|
611 CleanupStack::PushL( nameBuffer ); |
|
612 if ( nameBuffer->Length() > AIWDialDataExt::KMaximumNameLength ) |
|
613 { |
|
614 TPtrC namePtr = nameBuffer->Left( AIWDialDataExt::KMaximumNameLength ); |
|
615 dialData->SetNameL( namePtr ); |
|
616 } |
|
617 else |
|
618 { |
|
619 dialData->SetNameL( *nameBuffer ); |
|
620 } |
|
621 CleanupStack::PopAndDestroy( nameBuffer ); |
|
622 } |
|
623 |
|
624 dialData->SetPhoneNumberL( aNumber ); |
|
625 dialData->SetWindowGroup( AIWDialData::KAiwGoToIdle ); |
|
626 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
627 dialData->FillInParamListL( paramList ); |
|
628 CleanupStack::PopAndDestroy( dialData ); |
|
629 |
|
630 // Set the flag to ETrue, it means the aiw will be called in a fast time. |
|
631 iAIWRunFlag = ETrue; |
|
632 if ( aShowQuery ) |
|
633 { |
|
634 // Execute direct command (we use CallUI's list query) |
|
635 iServiceHandler->ExecuteServiceCmdL( aCommandId, |
|
636 paramList, |
|
637 iServiceHandler->OutParamListL(), |
|
638 0, |
|
639 this ); //Callback is NULL as no dial results wanted. |
|
640 } |
|
641 else |
|
642 { |
|
643 // Execute Menu based command (we have already shown speeddial-AIW menu to user) |
|
644 iServiceHandler->ExecuteMenuCmdL( aCommandId, |
|
645 paramList, |
|
646 iServiceHandler->OutParamListL(), |
|
647 0, |
|
648 this ); //Callback is NULL as no dial results wanted. |
|
649 } |
|
650 } |
|
651 |
|
652 // --------------------------------------------------------- |
|
653 // CSpdiaView::CmdReleaseNumberL |
|
654 // Command handle: Release |
|
655 // --------------------------------------------------------- |
|
656 void CSpdiaView::CmdReleaseNumberL() |
|
657 { |
|
658 TInt index(iContainer->CurGridPosition()); |
|
659 |
|
660 iReleasenumberFlag = ETrue; |
|
661 if ( iContainer->Control().ShowRemove( index ) ) |
|
662 { |
|
663 iContainer->UpdatePhoneNumberL( index ); |
|
664 iContainer->Grid()->DrawDeferred(); |
|
665 } |
|
666 iReleasenumberFlag = EFalse; |
|
667 iContainer->MiddleSoftKeyL(); |
|
668 |
|
669 iSpeedPrivate->SetState(CSpeedDialPrivate::STATE_IDLE); |
|
670 } |
|
671 |
|
672 // --------------------------------------------------------- |
|
673 // CSpdiaView::CmdViewNumberL |
|
674 // Command handle: ViewNumber |
|
675 // --------------------------------------------------------- |
|
676 void CSpdiaView::CmdViewNumberL() |
|
677 { |
|
678 iContainer->ShowViewNumberL(); |
|
679 } |
|
680 |
|
681 // --------------------------------------------------------- |
|
682 // CSpdiaView::UndoLayoutAndLeaveL |
|
683 // ?implementation_description |
|
684 // --------------------------------------------------------- |
|
685 void CSpdiaView::UndoLayoutAndLeaveL(TInt aError, TBool aUpdateSp) |
|
686 { |
|
687 if ( aError != KErrNone ) |
|
688 { |
|
689 iContainer->MakeVisible( ETrue ); |
|
690 if (aUpdateSp) |
|
691 { |
|
692 iStatusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY ); |
|
693 } |
|
694 User::Leave( aError ); |
|
695 } |
|
696 } |
|
697 |
|
698 // --------------------------------------------------------- |
|
699 // CSpdiaView::MakeInvisibleCallBack |
|
700 // --------------------------------------------------------- |
|
701 TInt CSpdiaView::MakeInvisibleCallBack(TAny* aContainer) |
|
702 { |
|
703 STATIC_CAST( CSpdiaContainer*, aContainer )->MakeVisible( EFalse ); |
|
704 return FALSE; |
|
705 } |
|
706 |
|
707 // --------------------------------------------------------- |
|
708 // CSpdiaView::DynInitMenuPaneL |
|
709 // Remove menu item for help application |
|
710 // when feature is not supported. |
|
711 // --------------------------------------------------------- |
|
712 void CSpdiaView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
713 { |
|
714 |
|
715 //AIW knows its own submenu hooks, so we can return from here if AIW handled this. |
|
716 if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) ) |
|
717 { |
|
718 return; |
|
719 } |
|
720 |
|
721 TInt index; |
|
722 |
|
723 switch( aResourceId ) |
|
724 { |
|
725 case R_SENDUI_MENU: |
|
726 index = 2; |
|
727 iSendUi->AddSendMenuItemL( *aMenuPane, index, ESpdiaCmdMessage, KCapabilitiesForAllServices ); |
|
728 break; |
|
729 |
|
730 case R_SPDIA_VIEW_MENU: |
|
731 case R_SPDIA_VIEW_MENU_VOICE: |
|
732 case R_SPDIA_VIEW_MENU_ASSIGN: |
|
733 case R_SPDIA_VIEW_MENU_OK_CALL: |
|
734 case R_SPDIA_VIEW_MENU_OK_CALL_VIDEO: |
|
735 { |
|
736 // Check if help feature is available |
|
737 if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
738 { |
|
739 if ( ( aResourceId != R_SPDIA_VIEW_MENU_OK_CALL ) && |
|
740 ( aResourceId != R_SPDIA_VIEW_MENU_OK_CALL_VIDEO ) ) |
|
741 { |
|
742 aMenuPane->DeleteMenuItem( EAknCmdHelp ); |
|
743 } |
|
744 } |
|
745 DynInitAiwMenuPaneL( aResourceId, aMenuPane, ETrue ); |
|
746 break; |
|
747 } |
|
748 default: |
|
749 { |
|
750 break; |
|
751 } |
|
752 } |
|
753 } |
|
754 |
|
755 void CSpdiaView::DynInitAiwMenuPaneL( TInt aResourceId, |
|
756 CEikMenuPane* aMenuPane, |
|
757 TBool aVideo ) |
|
758 { |
|
759 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
760 |
|
761 // Get number type for commands. |
|
762 TInt numberType = 0; |
|
763 |
|
764 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
|
765 { |
|
766 numberType = iContainer->Control().NumberType( iContainer->CurGridPosition() );//////need2 change |
|
767 if ( numberType == ESpDialPbkFieldIdVOIP ) |
|
768 { |
|
769 TAiwVariant variant; |
|
770 TAiwGenericParam param( EGenericParamSIPAddress, variant ); |
|
771 paramList.AppendL( param ); |
|
772 } |
|
773 } |
|
774 else if ( !aVideo ) |
|
775 { |
|
776 TAiwVariant variant; |
|
777 TAiwGenericParam param( EGenericParamPhoneNumber, variant ); |
|
778 paramList.AppendL( param ); |
|
779 } |
|
780 |
|
781 iServiceHandler->InitializeMenuPaneL( *aMenuPane, |
|
782 aResourceId, |
|
783 ESpdiaCmdLast, |
|
784 paramList, |
|
785 EFalse, |
|
786 ETrue ); |
|
787 if ( aMenuPane->NumberOfItemsInPane() == KErrNone ) |
|
788 { |
|
789 User::Leave( KErrNotFound ); |
|
790 } |
|
791 } |
|
792 |
|
793 |
|
794 // --------------------------------------------------------- |
|
795 // CSpdiaView::SetCba |
|
796 // Only in 5.0, used for changing cba buttons dynamically |
|
797 // --------------------------------------------------------- |
|
798 void CSpdiaView::SetCba( TInt aResourceId ) |
|
799 { |
|
800 if ( Cba() ) |
|
801 { |
|
802 TRAP_IGNORE(Cba()->SetCommandSetL(aResourceId)); |
|
803 } |
|
804 Cba()->DrawDeferred(); |
|
805 } |
|
806 |
|
807 // --------------------------------------------------------- |
|
808 // CSpdiaView::CmdSendMessageL |
|
809 // Command handle: Send Message |
|
810 // --------------------------------------------------------- |
|
811 void CSpdiaView::CmdSendMessageL() |
|
812 { |
|
813 CArrayFixFlat<TUid>* servicesToDim = new(ELeave) CArrayFixFlat<TUid>(1); |
|
814 CleanupStack::PushL( servicesToDim ); |
|
815 |
|
816 servicesToDim->AppendL( KSenduiMtmBtUid ); |
|
817 servicesToDim->AppendL( KSenduiMtmIrUid ); |
|
818 servicesToDim->AppendL( KSenduiMtmPostcardUid ); |
|
819 |
|
820 |
|
821 TUid serviceUid = iSendUi->ShowTypedQueryL(CSendUi::EWriteMenu,NULL ,KCapabilitiesForAllServices,servicesToDim,KNullDesC); |
|
822 CleanupStack::PopAndDestroy(); //servicesToDim |
|
823 |
|
824 if ( serviceUid.iUid == 0 ) |
|
825 return; |
|
826 |
|
827 TSendingCapabilities capabilities; |
|
828 iSendUi->ServiceCapabilitiesL( serviceUid, capabilities ); |
|
829 |
|
830 CMessageData *messageData = CMessageData::NewL(); |
|
831 CleanupStack::PushL( messageData ); |
|
832 |
|
833 // Gets current tile pane and saves it to operatorName |
|
834 TBuf<20> operatorName; |
|
835 CAknTitlePane* title = NULL; |
|
836 CEikStatusPane *sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
837 title = STATIC_CAST( CAknTitlePane*, |
|
838 sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
839 operatorName.Copy( *title->Text() ); |
|
840 |
|
841 // send as body |
|
842 CRichText* text = CRichText::NewL( |
|
843 iEikonEnv->SystemParaFormatLayerL(), |
|
844 iEikonEnv->SystemCharFormatLayerL(), CEditableText::EFlatStorage); |
|
845 CleanupStack::PushL( text ); |
|
846 text->InsertL( 0, KNullDesC ); |
|
847 messageData->SetBodyTextL( text ); |
|
848 |
|
849 MVPbkStoreContact* contact( iSpeedPrivate->Contact(iContainer->CurGridPosition()) ); |
|
850 if ( NULL == contact ) |
|
851 { |
|
852 return; |
|
853 } |
|
854 |
|
855 // get the phone number |
|
856 const TDesC& phoneNumber = iSpeedPrivate->PhoneNumber( iContainer->CurGridPosition() ); |
|
857 TBool unnamedContact( EFalse ); |
|
858 // get the contact title |
|
859 HBufC* nameBuffer = iSpeedPrivate->ContactTitleL( contact, EFalse ); |
|
860 if ( nameBuffer == NULL ) |
|
861 { |
|
862 // For unnamed contact, use phonenumber |
|
863 unnamedContact = ETrue; |
|
864 nameBuffer = HBufC::NewL( phoneNumber.Length() ); |
|
865 nameBuffer->Des() = phoneNumber; |
|
866 } |
|
867 CleanupStack::PushL( nameBuffer ); |
|
868 |
|
869 TUid techTypeUid = iSendUi->TechnologyType( serviceUid ); |
|
870 |
|
871 if ( KSenduiMtmSmtpUid == serviceUid || KSenduiTechnologyMailUid == techTypeUid ) |
|
872 { |
|
873 HBufC* email = NULL; |
|
874 email = iSpeedPrivate->EMail( contact ); |
|
875 CleanupStack::PushL( email ); |
|
876 |
|
877 if ( NULL == email ) |
|
878 { |
|
879 CleanupStack::PopAndDestroy( email ); //email |
|
880 CleanupStack::PopAndDestroy( nameBuffer ); // nameBuffer |
|
881 CleanupStack::PopAndDestroy( 2 ); // text and messageData |
|
882 return; |
|
883 } |
|
884 |
|
885 // append the to address |
|
886 if ( !unnamedContact ) |
|
887 { |
|
888 // not unnamed contact, use name |
|
889 messageData->AppendToAddressL( email->Des(), *nameBuffer ); |
|
890 } |
|
891 else |
|
892 { |
|
893 // unnamed contact, use email |
|
894 messageData->AppendToAddressL( email->Des(), *email ); |
|
895 } |
|
896 |
|
897 // Create and Send Message |
|
898 iSendUi->CreateAndSendMessageL( serviceUid /*KSenduiMtmUniMessageUid*/, messageData ); |
|
899 CleanupStack::PopAndDestroy( email ); //email |
|
900 } |
|
901 else |
|
902 { |
|
903 // append the to address |
|
904 messageData->AppendToAddressL( phoneNumber, *nameBuffer ); |
|
905 |
|
906 // Create and Send Message |
|
907 iIsShowMsgDlg = ETrue; |
|
908 iSendUi->CreateAndSendMessageL(serviceUid /*KSenduiMtmUniMessageUid*/, messageData ); |
|
909 iIsShowMsgDlg = EFalse; |
|
910 } |
|
911 |
|
912 title->SetTextL( operatorName ); //Sets title pane for operatorName which was save |
|
913 CleanupStack::PopAndDestroy( nameBuffer ); //nameBuffer |
|
914 CleanupStack::PopAndDestroy( text ); //text |
|
915 CleanupStack::PopAndDestroy( messageData ); //messageData |
|
916 iContainer->SetStatusPaneL(); |
|
917 } |
|
918 |
|
919 |
|
920 // --------------------------------------------------------- |
|
921 // CSpdiaView::IsSettingType |
|
922 // --------------------------------------------------------- |
|
923 TBool CSpdiaView::IsSettingType( ) |
|
924 { |
|
925 return ( ( CSpdiaAppUi* )AppUi() )->IsSettingType(); |
|
926 } |
|
927 |
|
928 // --------------------------------------------------------- |
|
929 // CSpdiaView::SetSpeedPrivate |
|
930 // Only invoked by CSpdiaAppUi::~CSpdiaAppUi() |
|
931 // --------------------------------------------------------- |
|
932 void CSpdiaView::SetSpeedPrivate( CSpeedDialPrivate* aSpeedPrivate ) |
|
933 { |
|
934 iSpeedPrivate = aSpeedPrivate; |
|
935 } |
|
936 |
|
937 // --------------------------------------------------------- |
|
938 // CSpdiaView::PopUpEnableSpDiaDlgL() |
|
939 // --------------------------------------------------------- |
|
940 TInt CSpdiaView::PopUpEnableSpDiaDlgL() |
|
941 { |
|
942 TInt result( EKeyPhoneEnd ); |
|
943 CRepository* repository = CRepository::NewL( KCRUidTelephonySettings ); |
|
944 |
|
945 result = ESpdCmdEnableYes; |
|
946 if ( result == ESpdCmdEnableYes || result == EEikBidOk ) |
|
947 { |
|
948 repository->Set( KSettingsOneKeyDialling, 1 ); |
|
949 } |
|
950 |
|
951 delete repository; |
|
952 return result; |
|
953 } |
|
954 |
|
955 // --------------------------------------------------------- |
|
956 // CSpdiaView::IsShowMsgDlg |
|
957 // if msg dialog is showng. |
|
958 // --------------------------------------------------------- |
|
959 TBool CSpdiaView::IsShowMsgDlg() |
|
960 { |
|
961 return iIsShowMsgDlg; |
|
962 } |
|
963 |
|
964 // --------------------------------------------------------- |
|
965 // CSpdiaView::IsShowVmbxDlg |
|
966 // if voice mail box dialog is showng. |
|
967 // --------------------------------------------------------- |
|
968 TBool CSpdiaView::IsShowVmbxDlg() |
|
969 { |
|
970 return iIsShowVmbxDlg; |
|
971 } |
|
972 |
|
973 // --------------------------------------------------------- |
|
974 // CSpdiaView::ProcessCommandL |
|
975 // from CAknView::ProcessCommandL . |
|
976 // --------------------------------------------------------- |
|
977 void CSpdiaView::ProcessCommandL(TInt aCommand) |
|
978 { |
|
979 if ( !iAssignCompletedFlag ) |
|
980 { |
|
981 return; |
|
982 } |
|
983 switch( aCommand ) |
|
984 { |
|
985 case EAknSoftkeyOptions: |
|
986 { |
|
987 if ( iAIWRunFlag || iSpeedPrivate->State() != CSpeedDialPrivate::STATE_IDLE ) |
|
988 { |
|
989 } |
|
990 else |
|
991 { |
|
992 CAknView::ProcessCommandL(aCommand); |
|
993 } |
|
994 break; |
|
995 } |
|
996 default: |
|
997 { |
|
998 CAknView::ProcessCommandL(aCommand); |
|
999 } |
|
1000 } |
|
1001 } |
|
1002 |
|
1003 // --------------------------------------------------------- |
|
1004 // CSpdiaView::HandleNotifyL |
|
1005 // call back funtion of aiw. |
|
1006 // --------------------------------------------------------- |
|
1007 TInt CSpdiaView::HandleNotifyL( |
|
1008 TInt /*aCmdId*/, |
|
1009 TInt aEventId, |
|
1010 CAiwGenericParamList& /*aEventParamList*/, |
|
1011 const CAiwGenericParamList& /*aInParamList*/) |
|
1012 { |
|
1013 TInt result = 0; |
|
1014 // when the aiw is started, it means the service has been used at this moment. |
|
1015 if ( aEventId == KAiwEventStarted ) |
|
1016 { |
|
1017 iAIWRunFlag = EFalse; |
|
1018 } |
|
1019 return result; |
|
1020 } |
|
1021 |
|
1022 // --------------------------------------------------------- |
|
1023 // CSpdiaView::IsAssignCompleted |
|
1024 // return the iAssignCompletedFlag. |
|
1025 // --------------------------------------------------------- |
|
1026 TBool CSpdiaView::IsAssignCompleted() |
|
1027 { |
|
1028 return iAssignCompletedFlag; |
|
1029 } |
|
1030 |
|
1031 // --------------------------------------------------------- |
|
1032 // Check whether there has been a focus when clicking MSK |
|
1033 // @return ETrue for focus exists, or EFalse |
|
1034 // --------------------------------------------------------- |
|
1035 TBool CSpdiaView::IsFocused() |
|
1036 { |
|
1037 return MenuBar()->ItemSpecificCommandsEnabled(); |
|
1038 } |
|
1039 // End of File |