323 TRect rect( Rect() ); |
323 TRect rect( Rect() ); |
324 |
324 |
325 // Background skin |
325 // Background skin |
326 iBackground->SetRect( rect ); |
326 iBackground->SetRect( rect ); |
327 |
327 |
328 /** |
328 LayoutControls(); |
329 * Option0 (w button, prt) |
|
330 * Option2 (w/o button, prt) |
|
331 * Option1 (w button, lsc) |
|
332 * Option3 (w/o button, lsc) |
|
333 */ |
|
334 |
|
335 const TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
|
336 |
|
337 TInt option( isLandscape ? 3 : 2 ); // (w/o button) |
|
338 CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); |
|
339 if( statusControl && statusControl->IsVisible() ) |
|
340 { |
|
341 // (w button) |
|
342 if( isLandscape ) |
|
343 { |
|
344 option = 1; |
|
345 } |
|
346 else |
|
347 { |
|
348 option = 0; |
|
349 } |
|
350 } |
|
351 |
|
352 // contact card pane layout |
|
353 TAknWindowComponentLayout contactCardPaneLayout( |
|
354 TAknWindowComponentLayout::Compose( |
|
355 AknLayoutScalable_Apps::main_phob2_pane( 0 ), |
|
356 AknLayoutScalable_Apps::phob2_contact_card_pane( 1 ) ) ); |
|
357 |
|
358 // header layout |
|
359 TAknWindowComponentLayout headerPaneLayout( |
|
360 TAknWindowComponentLayout::Compose( |
|
361 contactCardPaneLayout, |
|
362 AknLayoutScalable_Apps::phob2_cc_data_pane( option ) ) ); |
|
363 |
|
364 TAknLayoutRect headerPaneLayoutRect; |
|
365 headerPaneLayoutRect.LayoutRect( Rect(), headerPaneLayout.LayoutLine() ); |
|
366 TRect headerPaneRect( headerPaneLayoutRect.Rect() ); |
|
367 iHeaderCtrl->SetRect( headerPaneRect ); |
|
368 |
|
369 // list layout |
|
370 TAknWindowComponentLayout listPaneLayout( |
|
371 TAknWindowComponentLayout::Compose( |
|
372 contactCardPaneLayout, |
|
373 AknLayoutScalable_Apps::phob2_cc_listscroll_pane( option ) ) ); |
|
374 |
|
375 TAknLayoutRect listPaneLayoutRect; |
|
376 listPaneLayoutRect.LayoutRect( Rect(), listPaneLayout.LayoutLine() ); |
|
377 TRect listPaneRect( listPaneLayoutRect.Rect() ); |
|
378 iListBox->SetRect( listPaneRect ); |
|
379 |
329 |
380 delete iImageSelectionPopup; |
330 delete iImageSelectionPopup; |
381 iImageSelectionPopup = NULL; |
331 iImageSelectionPopup = NULL; |
382 |
332 |
383 if( !iImageLoader ) |
333 if( !iImageLoader ) |
414 } |
364 } |
415 |
365 |
416 DrawDeferred(); |
366 DrawDeferred(); |
417 } |
367 } |
418 |
368 |
|
369 // --------------------------------------------------------------------------- |
|
370 // CCCAppMyCardContainer::LayoutControls |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 void CCCAppMyCardContainer::LayoutControls() |
|
374 { |
|
375 /** |
|
376 * Option0 (w button, prt) |
|
377 * Option2 (w/o button, prt) |
|
378 * Option1 (w button, lsc) |
|
379 * Option3 (w/o button, lsc) |
|
380 */ |
|
381 |
|
382 const TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
|
383 |
|
384 TInt option( isLandscape ? 3 : 2 ); // (w/o button) |
|
385 CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); |
|
386 if( statusControl && statusControl->IsVisible() ) |
|
387 { |
|
388 // (w button) |
|
389 if( isLandscape ) |
|
390 { |
|
391 option = 1; |
|
392 } |
|
393 else |
|
394 { |
|
395 option = 0; |
|
396 } |
|
397 } |
|
398 |
|
399 // contact card pane layout |
|
400 TAknWindowComponentLayout contactCardPaneLayout( |
|
401 TAknWindowComponentLayout::Compose( |
|
402 AknLayoutScalable_Apps::main_phob2_pane( 0 ), |
|
403 AknLayoutScalable_Apps::phob2_contact_card_pane( 1 ) ) ); |
|
404 |
|
405 // header layout |
|
406 TAknWindowComponentLayout headerPaneLayout( |
|
407 TAknWindowComponentLayout::Compose( |
|
408 contactCardPaneLayout, |
|
409 AknLayoutScalable_Apps::phob2_cc_data_pane( option ) ) ); |
|
410 |
|
411 TAknLayoutRect headerPaneLayoutRect; |
|
412 headerPaneLayoutRect.LayoutRect( Rect(), headerPaneLayout.LayoutLine() ); |
|
413 TRect headerPaneRect( headerPaneLayoutRect.Rect() ); |
|
414 iHeaderCtrl->SetRect( headerPaneRect ); |
|
415 |
|
416 // list layout |
|
417 TAknWindowComponentLayout listPaneLayout( |
|
418 TAknWindowComponentLayout::Compose( |
|
419 contactCardPaneLayout, |
|
420 AknLayoutScalable_Apps::phob2_cc_listscroll_pane( option ) ) ); |
|
421 |
|
422 TAknLayoutRect listPaneLayoutRect; |
|
423 listPaneLayoutRect.LayoutRect( Rect(), listPaneLayout.LayoutLine() ); |
|
424 TRect listPaneRect( listPaneLayoutRect.Rect() ); |
|
425 iListBox->SetRect( listPaneRect ); |
|
426 } |
|
427 |
|
428 |
419 // ---------------------------------------------------------------------------- |
429 // ---------------------------------------------------------------------------- |
420 // CCCAppMyCardContainer::CheckExtensionFactoryL() |
430 // CCCAppMyCardContainer::CheckExtensionFactoryL() |
421 // ---------------------------------------------------------------------------- |
431 // ---------------------------------------------------------------------------- |
422 // |
432 // |
423 TInt CCCAppMyCardContainer::CheckExtensionFactoryL(TAny* aPtr) |
433 TInt CCCAppMyCardContainer::CheckExtensionFactoryL(TAny* aPtr) |
432 // ---------------------------------------------------------------------------- |
442 // ---------------------------------------------------------------------------- |
433 // |
443 // |
434 void CCCAppMyCardContainer::DoCheckExtensionFactoryL() |
444 void CCCAppMyCardContainer::DoCheckExtensionFactoryL() |
435 { |
445 { |
436 CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); |
446 CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); |
437 // if extension is not null and view launcher supports mycard view then |
|
438 // show statuscontrol |
|
439 TBool visible = EFalse; |
447 TBool visible = EFalse; |
440 if( extension ) |
448 if( extension ) |
441 { |
449 { |
442 if ( !iViewLauncher ) |
450 if ( !iViewLauncher ) |
443 { |
451 { |
444 iViewLauncher = extension->CreateViewLauncherL(); |
452 iViewLauncher = extension->CreateViewLauncherL(); |
445 } |
453 } |
446 if( iViewLauncher && |
454 if ( iControlLink // my card link has been set |
447 iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) |
455 && iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) |
448 { |
456 { |
449 visible = ETrue; |
457 visible = ETrue; |
450 } |
458 } |
451 } |
459 } |
452 else |
460 else |
529 void CCCAppMyCardContainer::MyCardEventL( MMyCardObserver::TEvent aEvent ) |
539 void CCCAppMyCardContainer::MyCardEventL( MMyCardObserver::TEvent aEvent ) |
530 { |
540 { |
531 if( aEvent == MMyCardObserver::EEventContactChanged || |
541 if( aEvent == MMyCardObserver::EEventContactChanged || |
532 ( aEvent == MMyCardObserver::EEventContactLoaded && iModel.IsEmpty() ) ) |
542 ( aEvent == MMyCardObserver::EEventContactLoaded && iModel.IsEmpty() ) ) |
533 { |
543 { |
|
544 TInt itemCount_BeforeChange = iModel.ListBoxModel().MdcaCount(); |
|
545 TInt focusItem_BeforeChange = iListBox->CurrentItemIndex(); |
|
546 |
534 CCCAppMyCard& mycard = iPlugin.MyCard(); |
547 CCCAppMyCard& mycard = iPlugin.MyCard(); |
535 |
|
536 iModel.SetDataL( mycard.PresentationContactL(), iIconArray ); |
548 iModel.SetDataL( mycard.PresentationContactL(), iIconArray ); |
|
549 |
|
550 TInt itemCount_AfterChange = iModel.ListBoxModel().MdcaCount(); |
|
551 TInt focusItem_AfterChange = iListBox->CurrentItemIndex(); |
|
552 |
|
553 if( itemCount_BeforeChange > itemCount_AfterChange && |
|
554 focusItem_AfterChange == KErrNotFound ) |
|
555 { |
|
556 if( focusItem_BeforeChange >= itemCount_AfterChange ) |
|
557 { |
|
558 iListBox->SetCurrentItemIndex( itemCount_AfterChange-1 ); |
|
559 } |
|
560 else if( focusItem_BeforeChange >= 0 ) |
|
561 { |
|
562 iListBox->SetCurrentItemIndex( focusItem_BeforeChange ); |
|
563 } |
|
564 else |
|
565 { |
|
566 iListBox->SetCurrentItemIndex( 0 ); |
|
567 } |
|
568 } |
|
569 |
537 if( iListBox ) |
570 if( iListBox ) |
538 { |
571 { |
539 iListBox->HandleItemAdditionL(); |
572 iListBox->HandleItemAdditionL(); |
540 } |
573 } |
541 |
574 |
550 } |
583 } |
551 iImageLoader->LoadContactImageL( mycard.StoreContact(), |
584 iImageLoader->LoadContactImageL( mycard.StoreContact(), |
552 iHeaderCtrl->ThumbnailSize() ); |
585 iHeaderCtrl->ThumbnailSize() ); |
553 } |
586 } |
554 |
587 |
|
588 CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); |
|
589 |
555 if( iPlugin.MyCard().IsContactLinkReady() && !iControlLink ) |
590 if( iPlugin.MyCard().IsContactLinkReady() && !iControlLink ) |
556 { |
591 { |
557 CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); |
592 if( statusControl ) |
558 if(statusControl) |
|
559 { |
593 { |
560 statusControl->SetContactLinkL( iPlugin.MyCard().ContactLink() ); |
594 statusControl->SetContactLinkL( iPlugin.MyCard().ContactLink() ); |
|
595 iControlLink = ETrue; |
561 } |
596 } |
562 iControlLink = ETrue; |
|
563 } |
597 } |
|
598 |
|
599 if ( statusControl && !statusControl->IsVisible() && |
|
600 iControlLink && iViewLauncher && |
|
601 iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) |
|
602 { |
|
603 statusControl->MakeVisible( ETrue ); |
|
604 LayoutControls(); |
|
605 DrawDeferred(); |
|
606 } |
564 } |
607 } |
565 |
608 |
566 |
609 |
567 // ---------------------------------------------------------------------------- |
610 // ---------------------------------------------------------------------------- |
568 // CCCAppMyCardContainer::ThumbnailReady() |
611 // CCCAppMyCardContainer::ThumbnailReady() |