|
1 /* |
|
2 * Copyright (c) 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: Implementation of the class CPbkxRclResultInfoDlg. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "emailtrace.h" |
|
20 #include <pbkxrclengine.rsg> |
|
21 #include <cntitem.h> |
|
22 #include <aknnavi.h> |
|
23 #include <aknnavide.h> |
|
24 #include <aknappui.h> |
|
25 #include <akntabgrp.h> |
|
26 #include <akntitle.h> |
|
27 #include <StringLoader.h> |
|
28 #include <CPbkContactEngine.h> |
|
29 #include <CPbkContactItem.h> |
|
30 #include <CPbkFieldInfo.h> |
|
31 #include <eikfrlb.h> |
|
32 #include <eikfrlbd.h> |
|
33 #include <eiklbo.h> // MEikListBoxObserver |
|
34 |
|
35 //<cmail> |
|
36 #include <csxhelp/cmail.hlp.hrh> |
|
37 |
|
38 #include "cpbkxrclresultinfodlg.h" |
|
39 #include "cpbkxrclcbrsender.h" |
|
40 #include "cpbkxrclvcardsender.h" |
|
41 #include "cpbkxrclactionservicewrapper.h" |
|
42 #include "mpbkxrclcontactretrieval.h" |
|
43 #include "cpbkxrclcontactupdater.h" |
|
44 #include "pbkxrclutils.h" |
|
45 #include "pbkxrclengineconstants.h" |
|
46 #include "engine.hrh" |
|
47 |
|
48 #include "fsccontactactionservicedefines.h" |
|
49 //</cmail> |
|
50 |
|
51 // <cmail> S60 UID update |
|
52 const TInt KPbkxRemoteContactLookupServiceImplImpUid = 0x2001FE0D; |
|
53 // </cmail> S60 UID update |
|
54 |
|
55 // list box field format |
|
56 _LIT( KFieldFormat, "\t%S\t%S" ); |
|
57 |
|
58 // ======== MEMBER FUNCTIONS ======== |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CPbkxRclResultInfoDlg::CPbkxRclResultInfoDlg |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CPbkxRclResultInfoDlg::CPbkxRclResultInfoDlg( |
|
65 TInt& aIndex, |
|
66 CDesCArray* aArray, |
|
67 MEikCommandObserver* aCommand, |
|
68 MPbkxRclContactRetrieval* aContactRetrieval, |
|
69 CPbkContactEngine& aContactEngine, |
|
70 CPbkxRclActionServiceWrapper& aActionService, |
|
71 TBool aContactSelectorEnabled, |
|
72 TInt aActiveItemIndex ) : |
|
73 CPbkxRclBaseDlg( aIndex, aArray, aCommand, EFalse ), iItems( aArray ), |
|
74 iActiveTabIndex( aActiveItemIndex ), |
|
75 iContactSelectorEnabled( aContactSelectorEnabled ), |
|
76 iContactRetrieval( aContactRetrieval ), iContactEngine( aContactEngine ), |
|
77 iContactActionService( aActionService ) |
|
78 { |
|
79 FUNC_LOG; |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CPbkxRclResultInfoDlg::ConstructL |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CPbkxRclResultInfoDlg::ConstructL() |
|
87 { |
|
88 FUNC_LOG; |
|
89 |
|
90 CPbkxRclBaseDlg::ConstructL( R_RCL_RESULT_INFO_DIALOG_MENU_BAR ); |
|
91 |
|
92 HBufC* text = StringLoader::LoadLC( R_QTN_RCL_OPENING_WAIT_NOTE ); |
|
93 iWaitNoteText.CreateL( *text ); |
|
94 CleanupStack::PopAndDestroy( text ); |
|
95 |
|
96 iCallbackReqSender = CPbkxRclCbRSender::NewL(); |
|
97 |
|
98 iVisibleFields = new ( ELeave ) CPbkFieldArray; |
|
99 |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CPbkxRclResultInfoDlg::NewL |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 CPbkxRclResultInfoDlg* CPbkxRclResultInfoDlg::NewL( |
|
107 TInt& aIndex, |
|
108 CDesCArray* aArray, |
|
109 MEikCommandObserver* aCommand, |
|
110 MPbkxRclContactRetrieval* aContactRetrieval, |
|
111 CPbkContactEngine& aContactEngine, |
|
112 CPbkxRclActionServiceWrapper& aActionService, |
|
113 TBool aContactSelectorEnabled, |
|
114 TInt aActiveItemIndex ) |
|
115 { |
|
116 FUNC_LOG; |
|
117 |
|
118 CPbkxRclResultInfoDlg* self = new( ELeave ) CPbkxRclResultInfoDlg( |
|
119 aIndex, |
|
120 aArray, |
|
121 aCommand, |
|
122 aContactRetrieval, |
|
123 aContactEngine, |
|
124 aActionService, |
|
125 aContactSelectorEnabled, |
|
126 aActiveItemIndex ); |
|
127 |
|
128 CleanupStack::PushL( self ); |
|
129 self->ConstructL(); |
|
130 CleanupStack::Pop( self ); |
|
131 return self; |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // CPbkxRclResultInfoDlg::~CPbkxRclResultInfoDlg |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 CPbkxRclResultInfoDlg::~CPbkxRclResultInfoDlg() |
|
139 { |
|
140 FUNC_LOG; |
|
141 ResetStatusPane(); |
|
142 delete iCurrentContact; |
|
143 iWaitNoteText.Close(); |
|
144 delete iTitlePaneText; |
|
145 delete iCallbackReqSender; |
|
146 delete iVisibleFields; |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CPbkxRclResultInfoDlg::DynInitMenuPaneL |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CPbkxRclResultInfoDlg::DynInitMenuPaneL( |
|
154 TInt aResourceId, |
|
155 CEikMenuPane* aMenuPane ) |
|
156 { |
|
157 FUNC_LOG; |
|
158 |
|
159 if ( aResourceId == R_RCL_RESULT_INFO_DIALOG_MENU_PANE ) |
|
160 { |
|
161 |
|
162 if ( !iContactSelectorEnabled ) |
|
163 { |
|
164 aMenuPane->SetItemDimmed( ERclCmdAddAsRecipient, ETrue ); |
|
165 |
|
166 aMenuPane->SetItemDimmed( |
|
167 ERclCmdCall, |
|
168 !CallActionsAvailable() ); |
|
169 |
|
170 // send menu is always available, since business card can |
|
171 // always be sent |
|
172 } |
|
173 else |
|
174 { |
|
175 aMenuPane->SetItemDimmed( ERclCmdCall, ETrue ); |
|
176 aMenuPane->SetItemDimmed( ERclCmdSend, ETrue ); |
|
177 } |
|
178 |
|
179 // talk menu is shown if we have PTT enabled |
|
180 aMenuPane->SetItemDimmed( |
|
181 ERclCmdTalk, |
|
182 !iContactActionService.IsActionEnabled( KFscAtComCallPoc ) ); |
|
183 |
|
184 } |
|
185 else if ( aResourceId == R_RCL_ADD_TO_CONTACTS_MENU_PANE ) |
|
186 { |
|
187 |
|
188 aMenuPane->SetItemDimmed( |
|
189 ERclCmdCreateNew, |
|
190 !iContactActionService.IsActionEnabled( KFscAtManSaveAs ) ); |
|
191 |
|
192 } |
|
193 else if ( aResourceId == R_RCL_CALL_MENU_PANE ) |
|
194 { |
|
195 |
|
196 aMenuPane->SetItemDimmed( |
|
197 ERclCmdVoiceCall, |
|
198 !iContactActionService.IsActionEnabled( KFscAtComCallGSM ) ); |
|
199 |
|
200 aMenuPane->SetItemDimmed( |
|
201 ERclCmdVideoCall, |
|
202 !iContactActionService.IsActionEnabled( KFscAtComCallVideo ) ); |
|
203 |
|
204 aMenuPane->SetItemDimmed( |
|
205 ERclCmdVoip, |
|
206 !iContactActionService.IsActionEnabled( KFscAtComCallVoip ) ); |
|
207 |
|
208 } |
|
209 else if ( aResourceId == R_RCL_TALK_MENU_PANE ) |
|
210 { |
|
211 // PTT settings available, no need to hide items |
|
212 } |
|
213 else if ( aResourceId == R_RCL_SEND_MENU_PANE ) |
|
214 { |
|
215 aMenuPane->SetItemDimmed( |
|
216 ERclCmdSendMsg, |
|
217 !iContactActionService.IsActionEnabled( KFscAtComSendMsg ) ); |
|
218 |
|
219 aMenuPane->SetItemDimmed( |
|
220 ERclCmdSendEmail, |
|
221 !iContactActionService.IsActionEnabled( KFscAtComSendEmail ) ); |
|
222 |
|
223 aMenuPane->SetItemDimmed( |
|
224 ERclCmdSendMeetingReq, |
|
225 !iContactActionService.IsActionEnabled( KFscAtComSendCalReq ) ); |
|
226 |
|
227 aMenuPane->SetItemDimmed( |
|
228 ERclCmdSendAudioMsg, |
|
229 !iContactActionService.IsActionEnabled( KFscAtComSendAudio ) ); |
|
230 |
|
231 } |
|
232 else if ( aResourceId == R_RCL_CONTEXT_SEND_MENU_PANE ) |
|
233 { |
|
234 aMenuPane->SetItemDimmed( |
|
235 ERclCmdSendMsg, |
|
236 ( !( FocusOnPhoneNumberField() || FocusOnEmailAddressField() ) || |
|
237 !iContactActionService.IsActionEnabled( KFscAtComSendMsg ) ) ); |
|
238 |
|
239 aMenuPane->SetItemDimmed( |
|
240 ERclCmdSendEmail, |
|
241 ( !FocusOnEmailAddressField() || |
|
242 !iContactActionService.IsActionEnabled( KFscAtComSendEmail ) ) ); |
|
243 |
|
244 aMenuPane->SetItemDimmed( |
|
245 ERclCmdSendMeetingReq, |
|
246 ( !FocusOnEmailAddressField() || |
|
247 !iContactActionService.IsActionEnabled( KFscAtComSendCalReq ) ) ); |
|
248 |
|
249 aMenuPane->SetItemDimmed( |
|
250 ERclCmdSendAudioMsg, |
|
251 ( !( FocusOnPhoneNumberField() || FocusOnEmailAddressField() ) || |
|
252 !iContactActionService.IsActionEnabled(KFscAtComSendAudio ) ) ); |
|
253 |
|
254 } |
|
255 else if ( aResourceId == R_RCL_RESULT_INFO_DIALOG_CONTEXT_MENU_PANE ) |
|
256 { |
|
257 if ( !iContactSelectorEnabled ) |
|
258 { |
|
259 aMenuPane->SetItemDimmed( ERclCmdAddAsRecipient, ETrue ); |
|
260 |
|
261 aMenuPane->SetItemDimmed( |
|
262 ERclCmdCall, |
|
263 !( FocusOnPhoneNumberField() || FocusOnVoipField() ) ); |
|
264 |
|
265 // send menu is always visible, because business card can always |
|
266 // be sent |
|
267 } |
|
268 else |
|
269 { |
|
270 aMenuPane->SetItemDimmed( ERclCmdCall, ETrue ); |
|
271 aMenuPane->SetItemDimmed( ERclCmdSend, ETrue ); |
|
272 } |
|
273 } |
|
274 } |
|
275 |
|
276 // --------------------------------------------------------------------------- |
|
277 // CPbkxRclResultInfoDlg::GetHelpContext |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 void CPbkxRclResultInfoDlg::GetHelpContext( TCoeHelpContext& aContext ) const |
|
281 { |
|
282 FUNC_LOG; |
|
283 aContext.iMajor = TUid::Uid( KPbkxRemoteContactLookupServiceImplImpUid ); |
|
284 aContext.iContext = KRLOOK_HLP_INFO_VIEW; |
|
285 } |
|
286 |
|
287 // ---------------------------------------------------------------------------- |
|
288 // CPbkxRclResultInfoDlg::HandleListBoxEventL() |
|
289 // ---------------------------------------------------------------------------- |
|
290 // |
|
291 void CPbkxRclResultInfoDlg::HandleListBoxEventL( |
|
292 CEikListBox* /* aListBox */, |
|
293 TListBoxEvent aEventType ) |
|
294 { |
|
295 FUNC_LOG; |
|
296 switch ( aEventType ) |
|
297 { |
|
298 case EEventEnterKeyPressed: |
|
299 case EEventItemClicked: |
|
300 case EEventItemActioned: |
|
301 { |
|
302 break; |
|
303 } |
|
304 |
|
305 case EEventItemDoubleClicked: |
|
306 { |
|
307 // open context sensitive menu |
|
308 iMenuBar->TryDisplayContextMenuBarL(); |
|
309 break; |
|
310 } |
|
311 |
|
312 default: |
|
313 { |
|
314 break; |
|
315 } |
|
316 } |
|
317 } |
|
318 |
|
319 // --------------------------------------------------------------------------- |
|
320 // CPbkxRclResultInfoDlg::OfferKeyEventL |
|
321 // --------------------------------------------------------------------------- |
|
322 // |
|
323 TKeyResponse CPbkxRclResultInfoDlg::OfferKeyEventL( |
|
324 const TKeyEvent& aKeyEvent, |
|
325 TEventCode aType ) |
|
326 { |
|
327 FUNC_LOG; |
|
328 |
|
329 if ( iExit || aType != EEventKey ) |
|
330 { |
|
331 return EKeyWasConsumed; |
|
332 } |
|
333 |
|
334 switch ( aKeyEvent.iCode ) |
|
335 { |
|
336 case EKeyOK: |
|
337 { |
|
338 // open context sensitive menu |
|
339 iMenuBar->TryDisplayContextMenuBarL(); |
|
340 } |
|
341 break; |
|
342 case EKeyUpArrow: // fall through, same functionality |
|
343 case EKeyDownArrow: |
|
344 { |
|
345 CAknSelectionListDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
346 } |
|
347 break; |
|
348 case EKeyRightArrow: |
|
349 { |
|
350 TInt oldIndex = iActiveTabIndex; |
|
351 iActiveTabIndex = ( iActiveTabIndex + 1 ) % iTabGroup->TabCount(); |
|
352 |
|
353 if ( FetchCurrentContactL() ) |
|
354 { |
|
355 UpdateDialogL(); |
|
356 } |
|
357 else |
|
358 { |
|
359 iActiveTabIndex = oldIndex; |
|
360 } |
|
361 } |
|
362 break; |
|
363 case EKeyLeftArrow: |
|
364 { |
|
365 TInt oldIndex = iActiveTabIndex; |
|
366 if ( iActiveTabIndex > 0 ) |
|
367 { |
|
368 iActiveTabIndex--; |
|
369 } |
|
370 else |
|
371 { |
|
372 iActiveTabIndex = iTabGroup->TabCount() - 1; |
|
373 } |
|
374 |
|
375 if ( FetchCurrentContactL() ) |
|
376 { |
|
377 UpdateDialogL(); |
|
378 } |
|
379 else |
|
380 { |
|
381 iActiveTabIndex = oldIndex; |
|
382 } |
|
383 } |
|
384 break; |
|
385 case EKeyEscape: |
|
386 { |
|
387 // exit application |
|
388 iExit = ETrue; |
|
389 ProcessCommandL( EAknCmdExit ); |
|
390 } |
|
391 break; |
|
392 default: |
|
393 break; |
|
394 } |
|
395 return EKeyWasConsumed; |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------------------------- |
|
399 // CPbkxRclResultInfoDlg::OkToExitL |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 TBool CPbkxRclResultInfoDlg::OkToExitL( TInt aButtonId ) |
|
403 { |
|
404 FUNC_LOG; |
|
405 if( aButtonId == EAknSoftkeyContextOptions ) |
|
406 { |
|
407 iMenuBar->TryDisplayContextMenuBarL(); |
|
408 return EFalse; |
|
409 } |
|
410 else |
|
411 { |
|
412 return CAknDialog::OkToExitL( aButtonId ); |
|
413 } |
|
414 } |
|
415 |
|
416 // --------------------------------------------------------------------------- |
|
417 // CPbkxRclResultInfoDlg::ExecuteLD |
|
418 // --------------------------------------------------------------------------- |
|
419 // |
|
420 void CPbkxRclResultInfoDlg::ExecuteLD() |
|
421 { |
|
422 FUNC_LOG; |
|
423 |
|
424 // if current contact cannot be fetched, result info dialog is not opened |
|
425 if ( !FetchCurrentContactL() ) |
|
426 { |
|
427 delete this; |
|
428 return; |
|
429 } |
|
430 |
|
431 PrepareLC( R_RCL_RESULT_INFO_DIALOG ); |
|
432 |
|
433 UpdateGraphics(); |
|
434 UpdateColors(); |
|
435 |
|
436 iMenuBar->SetContextMenuTitleResourceId( |
|
437 R_RCL_RESULT_INFO_DIALOG_CONTEXT_MENU_BAR ); |
|
438 |
|
439 SetupStatusPaneL(); |
|
440 |
|
441 CreateListBoxEntriesL(); |
|
442 CAknSelectionListDialog::RunLD(); |
|
443 } |
|
444 |
|
445 // --------------------------------------------------------------------------- |
|
446 // CPbkxRclResultInfoDlg::Close |
|
447 // --------------------------------------------------------------------------- |
|
448 // |
|
449 void CPbkxRclResultInfoDlg::Close() |
|
450 { |
|
451 FUNC_LOG; |
|
452 // this will not leave, because TryExitL doesn't call leaving methods |
|
453 // when EAknSoftkeyCancel is used |
|
454 iExit = ETrue; |
|
455 TRAP_IGNORE( TryExitL( EAknSoftkeyCancel ) ); // <cmail> |
|
456 } |
|
457 |
|
458 // --------------------------------------------------------------------------- |
|
459 // CPbkxRclResultInfoDlg::SendCallbackRequestL |
|
460 // --------------------------------------------------------------------------- |
|
461 // |
|
462 void CPbkxRclResultInfoDlg::SendCallbackRequestL() |
|
463 { |
|
464 FUNC_LOG; |
|
465 iCallbackReqSender->SendCallbackRequestL( *iCurrentContact ); |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------------------------- |
|
469 // CPbkxRclResultInfoDlg::SendBusinessCardL |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 void CPbkxRclResultInfoDlg::SendBusinessCardL() |
|
473 { |
|
474 FUNC_LOG; |
|
475 CPbkxRclvCardSender* sender = CPbkxRclvCardSender::NewLC( iContactEngine ); |
|
476 sender->SendvCardL( *iCurrentContact, *(iContactActionService.ContactConverter()) ); |
|
477 CleanupStack::PopAndDestroy( sender ); |
|
478 } |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // CPbkxRclResultInfoDlg::UpdateExistingContactL |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 HBufC* CPbkxRclResultInfoDlg::UpdateExistingContactL() |
|
485 { |
|
486 FUNC_LOG; |
|
487 CPbkxRclContactUpdater* updater = CPbkxRclContactUpdater::NewLC( |
|
488 iContactEngine ); |
|
489 TPbkContactItemField& field = CurrentField(); |
|
490 |
|
491 HBufC* resultText = updater->UpdateContactL( field ); |
|
492 CleanupStack::PopAndDestroy( updater ); |
|
493 return resultText; |
|
494 } |
|
495 |
|
496 // --------------------------------------------------------------------------- |
|
497 // CPbkxRclResultInfoDlg::SetupStatusPaneL |
|
498 // --------------------------------------------------------------------------- |
|
499 // |
|
500 void CPbkxRclResultInfoDlg::SetupStatusPaneL() |
|
501 { |
|
502 FUNC_LOG; |
|
503 CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
504 CEikStatusPane* statusPane = appUi->StatusPane(); |
|
505 iNaviPane = reinterpret_cast<CAknNavigationControlContainer*>( |
|
506 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
507 iTitlePane = reinterpret_cast<CAknTitlePane*>( |
|
508 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
509 |
|
510 const TDesC* titleText = iTitlePane->Text(); |
|
511 iTitlePaneText = titleText->AllocL(); |
|
512 |
|
513 SetTitlePaneTextL(); |
|
514 |
|
515 SetupTabGroupL(); |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------------------------- |
|
519 // CPbkxRclResultInfoDlg::ResetStatusPane |
|
520 // --------------------------------------------------------------------------- |
|
521 // |
|
522 void CPbkxRclResultInfoDlg::ResetStatusPane() |
|
523 { |
|
524 FUNC_LOG; |
|
525 // title pane may be null if dialog constructing failed |
|
526 if ( iTitlePane != NULL ) |
|
527 { |
|
528 // ownership of iTitlePaneText is transferred to title pane |
|
529 iTitlePane->SetText( iTitlePaneText ); |
|
530 iTitlePaneText = NULL; |
|
531 } |
|
532 ResetTabGroup(); |
|
533 } |
|
534 |
|
535 // --------------------------------------------------------------------------- |
|
536 // CPbkxRclResultInfoDlg::SetupTabGroupL |
|
537 // --------------------------------------------------------------------------- |
|
538 // |
|
539 void CPbkxRclResultInfoDlg::SetupTabGroupL() |
|
540 { |
|
541 FUNC_LOG; |
|
542 TInt contactCount = iContactRetrieval->ContactCount(); |
|
543 iNaviDecorator = iNaviPane->CreateTabGroupL(); |
|
544 iTabGroup = reinterpret_cast<CAknTabGroup*>( |
|
545 iNaviDecorator->DecoratedControl() ); |
|
546 |
|
547 |
|
548 CArrayFixFlat<TInt>* array = |
|
549 new ( ELeave ) CArrayFixFlat<TInt>( KArrayGranularity ); |
|
550 CleanupStack::PushL( array ); |
|
551 |
|
552 // add initial values |
|
553 array->AppendL( 0 ); |
|
554 array->AppendL( contactCount ); |
|
555 |
|
556 iTabGroup->SetTabFixedWidthL( KTabWidthWithOneTab ); |
|
557 for ( TInt i = 0; i < contactCount; i++ ) |
|
558 { |
|
559 ( *array )[0] = i + 1; |
|
560 HBufC* text = StringLoader::LoadLC( R_QTN_RCL_INFO_NAVI, *array ); |
|
561 iTabGroup->AddTabL( i, *text ); |
|
562 CleanupStack::PopAndDestroy( text ); |
|
563 } |
|
564 |
|
565 CleanupStack::PopAndDestroy( array ); |
|
566 iTabGroup->SetActiveTabById( iActiveTabIndex ); |
|
567 |
|
568 SetNaviIndicatorsL(); |
|
569 |
|
570 iNaviPane->PushL( *iNaviDecorator ); |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------------------------- |
|
574 // CPbkxRclResultInfoDlg::SetNaviIndicatorsL |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 void CPbkxRclResultInfoDlg::SetNaviIndicatorsL() |
|
578 { |
|
579 FUNC_LOG; |
|
580 if ( iNaviPane != NULL && iNaviDecorator != NULL && iTabGroup != NULL ) |
|
581 { |
|
582 TInt contactCount = iTabGroup->TabCount(); |
|
583 if ( contactCount > 1 ) |
|
584 { |
|
585 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
|
586 |
|
587 iNaviDecorator->SetScrollButtonDimmed( |
|
588 CAknNavigationDecorator::ERightButton, |
|
589 EFalse); |
|
590 |
|
591 iNaviDecorator->SetScrollButtonDimmed( |
|
592 CAknNavigationDecorator::ELeftButton, |
|
593 EFalse); |
|
594 |
|
595 iNaviPane->PushL( *iNaviDecorator ); |
|
596 } |
|
597 } |
|
598 } |
|
599 |
|
600 // --------------------------------------------------------------------------- |
|
601 // CPbkxRclResultInfoDlg::SetTitlePaneTextL |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 void CPbkxRclResultInfoDlg::SetTitlePaneTextL() |
|
605 { |
|
606 FUNC_LOG; |
|
607 |
|
608 HBufC* firstName = PbkxRclUtils::FieldTextL( |
|
609 iCurrentContact, |
|
610 EPbkFieldIdFirstName ); |
|
611 CleanupStack::PushL( firstName ); |
|
612 |
|
613 HBufC* lastName = PbkxRclUtils::FieldTextL( |
|
614 iCurrentContact, |
|
615 EPbkFieldIdLastName ); |
|
616 CleanupStack::PushL( lastName ); |
|
617 |
|
618 RBuf name; |
|
619 CleanupClosePushL( name ); |
|
620 name.CreateL( firstName->Length() + lastName->Length() + 1 ); |
|
621 name.Format( KNameFormat, firstName, lastName ); |
|
622 |
|
623 iTitlePane->SetTextL( name ); |
|
624 |
|
625 CleanupStack::PopAndDestroy( &name ); |
|
626 CleanupStack::PopAndDestroy( lastName ); |
|
627 CleanupStack::PopAndDestroy( firstName ); |
|
628 |
|
629 } |
|
630 |
|
631 // --------------------------------------------------------------------------- |
|
632 // CPbkxRclResultInfoDlg::ResetTabGroup |
|
633 // --------------------------------------------------------------------------- |
|
634 // |
|
635 void CPbkxRclResultInfoDlg::ResetTabGroup() |
|
636 { |
|
637 FUNC_LOG; |
|
638 // navi pane and navi decorator may be null if dialog construction failed |
|
639 if ( iNaviPane != NULL && iNaviDecorator != NULL ) |
|
640 { |
|
641 iNaviPane->Pop( iNaviDecorator ); |
|
642 delete iNaviDecorator; |
|
643 iNaviDecorator = NULL; |
|
644 } |
|
645 } |
|
646 |
|
647 // --------------------------------------------------------------------------- |
|
648 // CPbkxRclResultInfoDlg::CreateListBoxEntriesL |
|
649 // --------------------------------------------------------------------------- |
|
650 // |
|
651 void CPbkxRclResultInfoDlg::CreateListBoxEntriesL() |
|
652 { |
|
653 FUNC_LOG; |
|
654 |
|
655 iItems->Reset(); |
|
656 iVisibleFields->Reset(); |
|
657 |
|
658 CPbkFieldArray& fieldArray = iCurrentContact->CardFields(); |
|
659 TInt count = fieldArray.Count(); |
|
660 |
|
661 for ( TInt i = 0; i < count; i++ ) |
|
662 { |
|
663 |
|
664 TPbkContactItemField field = fieldArray[i]; |
|
665 |
|
666 HBufC* text = PbkxRclUtils::FieldTextL( field ); |
|
667 CleanupStack::PushL( text ); |
|
668 |
|
669 if ( text->Length() > 0 ) |
|
670 { |
|
671 iVisibleFields->AppendL( field ); |
|
672 const TDesC& header = field.FieldInfo().FieldName(); |
|
673 |
|
674 RBuf entry; |
|
675 CleanupClosePushL( entry ); |
|
676 entry.CreateL( |
|
677 header.Length() + text->Length() + |
|
678 KExtraSpaceInListboxEntry ); |
|
679 |
|
680 entry.Format( KFieldFormat, &header, text ); |
|
681 iItems->AppendL( entry ); |
|
682 CleanupStack::PopAndDestroy( &entry ); |
|
683 } |
|
684 CleanupStack::PopAndDestroy( text ); |
|
685 } |
|
686 |
|
687 CEikListBox* listBox = ListBox(); |
|
688 |
|
689 if ( count > 0 ) |
|
690 { |
|
691 // if there are items, set top item as selected |
|
692 listBox->SetTopItemIndex( 0 ); |
|
693 listBox->SetCurrentItemIndex( 0 ); |
|
694 } |
|
695 |
|
696 listBox->HandleItemAdditionL(); |
|
697 |
|
698 // update contact action service |
|
699 iContactActionService.SetCurrentContactL( |
|
700 iCurrentContact ); |
|
701 |
|
702 } |
|
703 |
|
704 // --------------------------------------------------------------------------- |
|
705 // CPbkxRclResultInfoDlg::FetchCurrentContactL |
|
706 // --------------------------------------------------------------------------- |
|
707 // |
|
708 TBool CPbkxRclResultInfoDlg::FetchCurrentContactL() |
|
709 { |
|
710 FUNC_LOG; |
|
711 CContactCard* currentCard = iContactRetrieval->RetrieveDetailsL( |
|
712 iActiveTabIndex, |
|
713 iWaitNoteText ); |
|
714 |
|
715 if ( currentCard != NULL ) |
|
716 { |
|
717 |
|
718 delete iCurrentContact; |
|
719 iCurrentContact = NULL; |
|
720 |
|
721 iCurrentContact = PbkxRclUtils::CreateContactItemL( |
|
722 currentCard, |
|
723 iContactEngine ); |
|
724 |
|
725 return ETrue; |
|
726 } |
|
727 else |
|
728 { |
|
729 return EFalse; |
|
730 } |
|
731 } |
|
732 |
|
733 // --------------------------------------------------------------------------- |
|
734 // CPbkxRclResultInfoDlg::UpdateDialogL |
|
735 // --------------------------------------------------------------------------- |
|
736 // |
|
737 void CPbkxRclResultInfoDlg::UpdateDialogL() |
|
738 { |
|
739 FUNC_LOG; |
|
740 iContactRetrieval->SetSelectedContactL( iActiveTabIndex ); |
|
741 CreateListBoxEntriesL(); |
|
742 SetTitlePaneTextL(); |
|
743 iTabGroup->SetActiveTabById( iActiveTabIndex ); |
|
744 |
|
745 // set navi indicators if needed |
|
746 if ( iActiveTabIndex == 0 || iActiveTabIndex == iTabGroup->TabCount() - 1 ) |
|
747 { |
|
748 SetNaviIndicatorsL(); |
|
749 } |
|
750 |
|
751 } |
|
752 |
|
753 // --------------------------------------------------------------------------- |
|
754 // CPbkxRclResultInfoDlg::CallActionsAvailable |
|
755 // --------------------------------------------------------------------------- |
|
756 // |
|
757 TBool CPbkxRclResultInfoDlg::CallActionsAvailable() const |
|
758 { |
|
759 FUNC_LOG; |
|
760 return iContactActionService.IsActionEnabled( KFscAtComCallGSM ) || |
|
761 iContactActionService.IsActionEnabled( KFscAtComCallVideo ) || |
|
762 iContactActionService.IsActionEnabled( KFscAtComCallVoip ); |
|
763 } |
|
764 |
|
765 // --------------------------------------------------------------------------- |
|
766 // CPbkxRclResultInfoDlg::FocusOnPhoneNumberField |
|
767 // --------------------------------------------------------------------------- |
|
768 // |
|
769 TBool CPbkxRclResultInfoDlg::FocusOnPhoneNumberField() const |
|
770 { |
|
771 FUNC_LOG; |
|
772 TPbkContactItemField& field = CurrentField(); |
|
773 return field.FieldInfo().IsPhoneNumberField(); |
|
774 } |
|
775 |
|
776 // --------------------------------------------------------------------------- |
|
777 // CPbkxRclResultInfoDlg::FocusOnEmailAddressField |
|
778 // --------------------------------------------------------------------------- |
|
779 // |
|
780 TBool CPbkxRclResultInfoDlg::FocusOnEmailAddressField() const |
|
781 { |
|
782 FUNC_LOG; |
|
783 TPbkContactItemField& field = CurrentField(); |
|
784 return field.FieldInfo().IsEmailField(); |
|
785 } |
|
786 |
|
787 // --------------------------------------------------------------------------- |
|
788 // CPbkxRclResultInfoDlg::FocusOnVoipField |
|
789 // --------------------------------------------------------------------------- |
|
790 // |
|
791 TBool CPbkxRclResultInfoDlg::FocusOnVoipField() const |
|
792 { |
|
793 FUNC_LOG; |
|
794 TPbkContactItemField& field = CurrentField(); |
|
795 return field.FieldInfo().FieldId() == EPbkFieldIdVOIP; |
|
796 } |
|
797 |
|
798 // --------------------------------------------------------------------------- |
|
799 // CPbkxRclResultInfoDlg::CurrentField |
|
800 // --------------------------------------------------------------------------- |
|
801 // |
|
802 TPbkContactItemField& CPbkxRclResultInfoDlg::CurrentField() const |
|
803 { |
|
804 FUNC_LOG; |
|
805 TInt curIndex = ListBox()->CurrentItemIndex(); |
|
806 return ( *iVisibleFields )[curIndex]; |
|
807 } |
|
808 |