phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp
branchRCL_3
changeset 9 0d28c1c5b6dd
parent 8 5586b4d2ec3e
child 12 4ae315f230bc
equal deleted inserted replaced
8:5586b4d2ec3e 9:0d28c1c5b6dd
   118     delete iListBox;
   118     delete iListBox;
   119     delete iImageLoader;
   119     delete iImageLoader;
   120     delete iFactoryExtensionNotifier;
   120     delete iFactoryExtensionNotifier;
   121     delete iViewLauncher;
   121     delete iViewLauncher;
   122     delete iImageSelectionPopup;
   122     delete iImageSelectionPopup;
   123     delete iLongTapDetector; 
       
   124     delete iDetailsPopup;
       
   125     }
   123     }
   126 
   124 
   127 // ----------------------------------------------------------------------------
   125 // ----------------------------------------------------------------------------
   128 // CCCAppMyCardContainer::ConstructL()
   126 // CCCAppMyCardContainer::ConstructL()
   129 // ----------------------------------------------------------------------------
   127 // ----------------------------------------------------------------------------
   229     iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL();
   227     iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL();
   230 
   228 
   231     TCallBack callBack( CCCAppMyCardContainer::CheckExtensionFactoryL, this );
   229     TCallBack callBack( CCCAppMyCardContainer::CheckExtensionFactoryL, this );
   232     iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack );
   230     iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack );
   233     
   231     
   234     iLongTapDetector = CAknLongTapDetector::NewL( this );
       
   235     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardContainer::ConstructL()"));
   232     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardContainer::ConstructL()"));
   236     }
   233     }
   237 
   234 
   238 /**
   235 /**
   239  * Gets a digit from a descriptor.
   236  * Gets a digit from a descriptor.
   380     TRect listPaneRect( listPaneLayoutRect.Rect() );
   377     TRect listPaneRect( listPaneLayoutRect.Rect() );
   381     iListBox->SetRect( listPaneRect );
   378     iListBox->SetRect( listPaneRect );
   382     
   379     
   383 	delete iImageSelectionPopup;
   380 	delete iImageSelectionPopup;
   384 	iImageSelectionPopup = NULL;
   381 	iImageSelectionPopup = NULL;
   385 	
   382 
   386 	delete iDetailsPopup;
       
   387 	iDetailsPopup = NULL;
       
   388 	
       
   389 	if( !iImageLoader )
   383 	if( !iImageLoader )
   390 	    {
   384 	    {
   391         if( !iModel.IsEmpty() )
   385         if( !iModel.IsEmpty() )
   392             {
   386             {
   393             TPtrC8 data( iModel.Data( CSpbContactDataModel::EDataImageContent ) );
   387             TPtrC8 data( iModel.Data( CSpbContactDataModel::EDataImageContent ) );
   618         {
   612         {
   619         case EEventEnterKeyPressed:
   613         case EEventEnterKeyPressed:
   620         case EEventItemDoubleClicked:
   614         case EEventItemDoubleClicked:
   621         case EEventItemSingleClicked:
   615         case EEventItemSingleClicked:
   622             {
   616             {
   623             // Don't open the editor if stylusMenu opened using longTap 
       
   624             if( iLongTapHandled ) 
       
   625                 {
       
   626                 iLongTapHandled = EFalse;
       
   627                 return;
       
   628                 }
       
   629             
       
   630             // start the editor and pass tapped field index
   617             // start the editor and pass tapped field index
   631             iPlugin.EditL( FocusedFieldIndex() );
   618             iPlugin.EditL( FocusedFieldIndex() );
   632             break;
   619             break;
   633             }
   620             }
   634         default:
   621         default:
  1085 // void CCCAppMyCardContainer::MyCardHeaderControlClickL()
  1072 // void CCCAppMyCardContainer::MyCardHeaderControlClickL()
  1086 //------------------------------------------------------------------------------
  1073 //------------------------------------------------------------------------------
  1087 //
  1074 //
  1088 void CCCAppMyCardContainer::MyCardHeaderControlClickL( TPoint aPos )
  1075 void CCCAppMyCardContainer::MyCardHeaderControlClickL( TPoint aPos )
  1089 {
  1076 {
       
  1077     if( iPlugin.MyCard().HeaderControlBlocked() )
       
  1078         {
       
  1079         return;
       
  1080         }
       
  1081             
  1090     if ( !iImageSelectionPopup )
  1082     if ( !iImageSelectionPopup )
  1091         {
  1083         {
  1092         iImageSelectionPopup = CAknStylusPopUpMenu::NewL( &iPlugin, aPos );
  1084         iImageSelectionPopup = CAknStylusPopUpMenu::NewL( &iPlugin, aPos );
  1093         TInt resourceReaderId = R_MYCARD_CONTACT_IMAGE_STYLUS_MENU; 
  1085         TInt resourceReaderId = R_MYCARD_CONTACT_IMAGE_STYLUS_MENU; 
  1094         TResourceReader reader;
  1086         TResourceReader reader;
  1124     iImageSelectionPopup->SetPosition( aPos );
  1116     iImageSelectionPopup->SetPosition( aPos );
  1125     iImageSelectionPopup->ShowMenu();   
  1117     iImageSelectionPopup->ShowMenu();   
  1126 }
  1118 }
  1127  
  1119  
  1128 // ----------------------------------------------------------------------------
  1120 // ----------------------------------------------------------------------------
  1129 // CCCAppMyCardContainer::HandleLongTapEventL()
       
  1130 // ----------------------------------------------------------------------------
       
  1131 //
       
  1132 void CCCAppMyCardContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, 
       
  1133                                     const TPoint& /*aPenEventScreenLocation*/ )
       
  1134     {       
       
  1135     if( iDetailsPopup )
       
  1136         {
       
  1137         iLongTapHandled = ETrue;
       
  1138         iDetailsPopup->ShowMenu();
       
  1139         }
       
  1140     }
       
  1141  
       
  1142 // ----------------------------------------------------------------------------
       
  1143 // CCCAppCommLauncherContainer::HandlePointerEventL()
  1121 // CCCAppCommLauncherContainer::HandlePointerEventL()
  1144 // ----------------------------------------------------------------------------
  1122 // ----------------------------------------------------------------------------
  1145 //
  1123 //
  1146 void CCCAppMyCardContainer::HandlePointerEventL(
  1124 void CCCAppMyCardContainer::HandlePointerEventL(
  1147     const TPointerEvent& aPointerEvent )
  1125     const TPointerEvent& aPointerEvent )
  1148     {               
  1126     {               
  1149     TInt index;
       
  1150     TPoint pos = aPointerEvent.iPosition;
       
  1151     
       
  1152     if ( iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) )
       
  1153        {
       
  1154        iLongTapDetector->PointerEventL( aPointerEvent );
       
  1155          
       
  1156        if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
  1157            {
       
  1158            // Pressed Down Effect
       
  1159            iListBox->View()->ItemDrawer()->SetFlags(
       
  1160                    CListItemDrawer::EPressedDownState );
       
  1161            }
       
  1162        }
       
  1163 
       
  1164    if ( !iDetailsPopup )
       
  1165       {
       
  1166       iDetailsPopup = CAknStylusPopUpMenu::NewL( &iPlugin, aPointerEvent.iPosition ); 
       
  1167       TInt resourceReaderId = R_MYCARD_CONTACT_COPY_DETAIL_STYLUS_MENU; 
       
  1168       TResourceReader reader;
       
  1169       iCoeEnv->CreateResourceReaderLC( reader , resourceReaderId );
       
  1170       iDetailsPopup->ConstructFromResourceL( reader );
       
  1171       CleanupStack::PopAndDestroy(); // reader
       
  1172       }
       
  1173       
       
  1174     PosToScreenCoordinates( this, pos );    
       
  1175     iDetailsPopup->SetPosition( pos, CAknStylusPopUpMenu::EPositionTypeRightBottom );      
       
  1176    
       
  1177     CCoeControl::HandlePointerEventL( aPointerEvent );              
  1127     CCoeControl::HandlePointerEventL( aPointerEvent );              
  1178     }
  1128     }
  1179 
  1129 
  1180 // --------------------------------------------------------------------------
  1130 // --------------------------------------------------------------------------
  1181 // CCCAppMyCardContainer::ClipFromBeginning
  1131 // CCCAppMyCardContainer::ClipFromBeginning