commonuis/CommonUi/src/FindItemMenu.cpp
branchRCL_3
changeset 72 a5e7a4f63858
parent 64 85902f042028
equal deleted inserted replaced
64:85902f042028 72:a5e7a4f63858
   621                     ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ),
   621                     ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ),
   622                     0,
   622                     0,
   623                     tempBuf);
   623                     tempBuf);
   624                 index = EFindItemCmdGoToUrl;
   624                 index = EFindItemCmdGoToUrl;
   625 
   625 
       
   626 
   626                 // Add bookmark
   627                 // Add bookmark
   627                 iCoeEnv->ReadResourceL(
   628                 iCoeEnv->ReadResourceL(
   628                     tempBuf, R_FINDITEMMENU_ADD_BOOKMARK );
   629                     tempBuf, R_FINDITEMMENU_ADD_BOOKMARK );
   629                 AddMenuItemL(
   630                 AddMenuItemL(
   630                     *iMenuPane,
   631                     *iMenuPane,
   631                     EFindItemCmdAddToBookmark,
   632                     EFindItemCmdAddToBookmark,
   632                     index,
   633                     index,
   633                     0,
   634                     0,
   634                     tempBuf );
   635                     tempBuf );
   635                 index = EFindItemCmdAddToBookmark;
   636                 index = EFindItemCmdAddToBookmark;
   636                    
   637  
   637                 }
   638                 }
   638             else
   639             else
   639                 {
   640                 {
   640                 AddMenuItemL(
   641                 AddMenuItemL(
   641                     *iMenuPane,
   642                     *iMenuPane,
   643                     ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ),
   644                     ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ),
   644                     0,
   645                     0,
   645                     tempBuf );
   646                     tempBuf );
   646                 index = EFindItemCmdGoToRstp;
   647                 index = EFindItemCmdGoToRstp;
   647 
   648 
       
   649            
   648                 iCoeEnv->ReadResourceL(
   650                 iCoeEnv->ReadResourceL(
   649                     tempBuf, R_FINDITEMMENU_ADD_TO_GALLERY );
   651                     tempBuf, R_FINDITEMMENU_ADD_TO_GALLERY );
   650                 AddMenuItemL(
   652                 AddMenuItemL(
   651                     *iMenuPane,
   653                     *iMenuPane,
   652                     EFindItemCmdAddToGallery,
   654                     EFindItemCmdAddToGallery,
   653                     index,
   655                     index,
   654                     0,
   656                     0,
   655                     tempBuf );
   657                     tempBuf );
   656                 index = EFindItemCmdAddToGallery;
   658                 index = EFindItemCmdAddToGallery;
   657                   
   659                  
   658                 }
   660                 }
   659             break;
   661             break;
   660             }
   662             }
   661         case CItemFinder::EEmailAddress:
   663         case CItemFinder::EEmailAddress:
   662             {
   664             {
   880             }
   882             }
   881         }
   883         }
   882     // Replace cmd call with AIW menu if more than one option available in AIW
   884     // Replace cmd call with AIW menu if more than one option available in AIW
   883     // menu
   885     // menu
   884     // Note: count of VoIP profiles is not static. If phone contains VoIP
   886     // Note: count of VoIP profiles is not static. If phone contains VoIP
   885     // profiles there must be Internet call command in call submenu.   
   887     // profiles there must be Internet call command in call submenu.
   886     // No context sensitive menu now. And new requirement is to show 
       
   887     // call menu for normal item and voip menu for sip address if voip is enabled.
       
   888     TInt dummy = 0;
   888     TInt dummy = 0;
   889     if ( itemType == CItemFinder::EEmailAddress &&
   889     if ( ( !iHideCallMenu ||
   890         iFindItemVoIPExtension->IsVoIPSupported() &&
   890         ( iFindItemVoIPExtension->IsVoIPSupported() &&
   891         iFindItemVoIPExtension->VoIPProfilesExistL() &&
   891         iFindItemVoIPExtension->VoIPProfilesExistL() ) ) &&
   892         iMenuPane->MenuItemExists( EFindItemCmdCall, dummy ) &&
   892         iMenuPane->MenuItemExists( EFindItemCmdCall, dummy ) )
   893         !( iMenuItemFlags & CFindItemMenu::ECallItem ) 
   893         {
   894         )         
       
   895         { 
       
   896         // CMyMenuPane is used only to get the aiw menu item 
       
   897         // for sip address, as it is an argument of the InitializeMenuPaneL
       
   898         CMyMenuPane* aiwVoipMenu =
       
   899             new ( ELeave ) CMyMenuPane( ( MEikMenuObserver* )this ); // not used really
       
   900         CleanupStack::PushL( aiwVoipMenu );
       
   901         TResourceReader callUiReader;
       
   902         iCoeEnv->CreateResourceReaderLC(
       
   903             callUiReader, R_FINDMENU_CALLUI_AIW_SUBMENU );
       
   904         aiwVoipMenu->ConstructFromResourceL( callUiReader );
       
   905         CleanupStack::PopAndDestroy(); //  callUiReader 
       
   906 
       
   907         CAiwGenericParamList* inList = CAiwGenericParamList::NewLC();
       
   908 
       
   909         // For SIP Address, use sip parameters
       
   910         TAiwGenericParam param( EGenericParamSIPAddress );
       
   911         
       
   912         // get the aiw menu item for sip address
       
   913         inList->AppendL( param );
       
   914         iServiceHandler->InitializeMenuPaneL(
       
   915                 *( CEikMenuPane* )aiwVoipMenu,
       
   916                 R_FINDMENU_CALLUI_AIW_SUBMENU,
       
   917                 EFindMenuPlaceHolderCallUI,
       
   918                 *inList );
       
   919         
       
   920         // Add all the menus for aiw to context main menu now.
       
   921         for ( TInt i = 0; i < aiwVoipMenu->NumberOfItemsInPane(); i++ )
       
   922             {
       
   923             iMenuPane->AddMenuItemL( aiwVoipMenu->ItemDataByIndexL( i ), EFindItemCmdCall );
       
   924             }
       
   925         
       
   926         // Now options of VOIP call and voice call are exclusive.
       
   927         // For email( sip ) address, voip is used. So set the call
       
   928         // menu to dimmed.
       
   929         iMenuPane->SetItemDimmed( EFindItemCmdCall, ETrue );
   894         iMenuPane->SetItemDimmed( EFindItemCmdCall, ETrue );
   930             
   895         iMenuPane->AddMenuItemsL(
   931         CleanupStack::PopAndDestroy( inList );
   896             R_FINDMENU_CALLUI_AIW_ITEM,
   932         CleanupStack::PopAndDestroy( aiwVoipMenu );
   897             EFindItemCmdCall );
   933         }
   898         }
   934     }
   899     }
   935 
       
   936 
       
   937 // -----------------------------------------------------------------------------
       
   938 // CFindItemMenu::SetCallSubMenuVisibility
       
   939 // Sets AIW submenu visibility
       
   940 // -----------------------------------------------------------------------------
       
   941 //
       
   942 EXPORT_C void CFindItemMenu::SetCallSubMenuVisibility( TBool aVisible )
       
   943     {
       
   944     iHideCallSubMenu = !aVisible;
       
   945     }
       
   946 
       
   947 
   900 
   948 EXPORT_C void CFindItemMenu::HandleItemFinderCommandL( TInt aCommand )
   901 EXPORT_C void CFindItemMenu::HandleItemFinderCommandL( TInt aCommand )
   949     {
   902     {
   950     switch ( aCommand )
   903     switch ( aCommand )
   951         {
   904         {
   966            // Hide SMS if not supported
   919            // Hide SMS if not supported
   967            
   920            
   968            #ifndef RD_UNIFIED_EDITOR
   921            #ifndef RD_UNIFIED_EDITOR
   969            if ( !iEmailOverSmsFeatureSupported )
   922            if ( !iEmailOverSmsFeatureSupported )
   970                {
   923                {
   971                mtmFilter->AppendL(KSenduiMtmSmsUid);
   924            	   mtmFilter->AppendL(KSenduiMtmSmsUid);
   972                }
   925                }
   973            // Hide MMS if not supported
   926            // Hide MMS if not supported
   974            if (!iMMSFeatureSupported)
   927            if (!iMMSFeatureSupported)
   975                {
   928                {
   976                mtmFilter->AppendL(KSenduiMtmMmsUid);
   929                mtmFilter->AppendL(KSenduiMtmMmsUid);
   978            #endif
   931            #endif
   979            
   932            
   980            // Hide E-Mail if nosupported or phonenumber 
   933            // Hide E-Mail if nosupported or phonenumber 
   981            if ( !iEmailUiFeatureSupported || itemType == CItemFinder::EPhoneNumber )
   934            if ( !iEmailUiFeatureSupported || itemType == CItemFinder::EPhoneNumber )
   982                {
   935                {
   983                mtmFilter->AppendL(KSenduiMtmSmtpUid);
   936        	       mtmFilter->AppendL(KSenduiMtmSmtpUid);
   984                mtmFilter->AppendL(KSenduiMtmImap4Uid);
   937                mtmFilter->AppendL(KSenduiMtmImap4Uid);
   985                mtmFilter->AppendL(KSenduiMtmPop3Uid);
   938                mtmFilter->AppendL(KSenduiMtmPop3Uid);
   986                mtmFilter->AppendL(KSenduiMtmSyncMLEmailUid);
   939                mtmFilter->AppendL(KSenduiMtmSyncMLEmailUid);
   987                }
   940                }
   988            // Hide Audio if not supported or E-mail address
   941            // Hide Audio if not supported or E-mail address
   989            if( !iAudioMessagingFeatureSupported || itemType == CItemFinder::EEmailAddress)
   942            if( !iAudioMessagingFeatureSupported || itemType == CItemFinder::EEmailAddress)
   990                {
   943                {
   991                mtmFilter->AppendL(KSenduiMtmAudioMessageUid);
   944            	   mtmFilter->AppendL(KSenduiMtmAudioMessageUid);
   992                }
   945                }
   993            TUid uid = iSendUi->ShowTypedQueryL( CSendUi::EWriteMenu, NULL, sendingCapabilities, mtmFilter );
   946            TUid uid = iSendUi->ShowTypedQueryL( CSendUi::EWriteMenu, NULL, sendingCapabilities, mtmFilter );
   994            
   947            
   995            CleanupStack::PopAndDestroy();
   948            CleanupStack::PopAndDestroy();
   996            if ( uid == KNullUid )
   949            if ( uid == KNullUid )
  1336             fieldArray->AppendL( fieldInfo );
  1289             fieldArray->AppendL( fieldInfo );
  1337             }
  1290             }
  1338         else if ( itemType == CItemFinder::EEmailAddress &&
  1291         else if ( itemType == CItemFinder::EEmailAddress &&
  1339             ( fieldInfo->FieldId() == EPbkFieldIdEmailAddress ||
  1292             ( fieldInfo->FieldId() == EPbkFieldIdEmailAddress ||
  1340 #ifdef __VOIP 
  1293 #ifdef __VOIP 
  1341             iFindItemVoIPExtension->IsVoIPSupported() && 
  1294 			iFindItemVoIPExtension->IsVoIPSupported() && 
  1342 #else
  1295 #else
  1343             iVoIPFeatureSupported &&
  1296             iVoIPFeatureSupported &&
  1344 #endif 
  1297 #endif 
  1345             fieldInfo->FieldId() == EPbkFieldIdVOIP ) )
  1298             fieldInfo->FieldId() == EPbkFieldIdVOIP ) )
  1346             {
  1299             {
  1595         if ( aFormatVoIPDialData )
  1548         if ( aFormatVoIPDialData )
  1596             {
  1549             {
  1597             // sets call type for VoIP
  1550             // sets call type for VoIP
  1598             iDialData->SetCallType( CAiwDialData::EAIWVoiP );
  1551             iDialData->SetCallType( CAiwDialData::EAIWVoiP );
  1599             }
  1552             }
  1600         else
       
  1601             {
       
  1602             // sets call type for call, as now only voice call
       
  1603             // exists in menu now.
       
  1604             iDialData->SetCallType( CAiwDialData::EAIWVoice );
       
  1605             }
       
  1606         }
       
  1607     else
       
  1608         {
       
  1609         // sets call type for call, as now only voice call
       
  1610         // exists in menu now.
       
  1611         iDialData->SetCallType( CAiwDialData::EAIWVoice );
       
  1612         }
  1553         }
  1613 #endif // RD_VOIP_REL_2_2
  1554 #endif // RD_VOIP_REL_2_2
  1614     iDialData->SetPhoneNumberL( numberPtr );
  1555     iDialData->SetPhoneNumberL( numberPtr );
  1615 
  1556 
  1616     CleanupStack::PopAndDestroy(); // number;
  1557     CleanupStack::PopAndDestroy(); // number;