mobilemessaging/audiomsg/src/audiomessageappui.cpp
branchRCL_3
changeset 53 696bfeff199e
parent 29 7e4e4bcc75b6
child 54 fa1df4b99609
equal deleted inserted replaced
42:1367103c24e2 53:696bfeff199e
   996                    	NextMessageL( ETrue );
   996                    	NextMessageL( ETrue );
   997                 	}
   997                 	}
   998 #endif                	
   998 #endif                	
   999                 break;
   999                 break;
  1000            	case EKeyOK: // Selection key: Show context menus OR play/record clip
  1000            	case EKeyOK: // Selection key: Show context menus OR play/record clip
  1001                 {
  1001                 {    
       
  1002                 // Check if find item highlight needs to be enabled
       
  1003                 if ( CheckFindItemHighlightL( aKeyEvent, aType ) )
       
  1004                     {
       
  1005                     return EKeyWasConsumed;
       
  1006                     }
       
  1007                 
  1002                 if ( Document()->GetAppMode() == EAmsEditor )
  1008                 if ( Document()->GetAppMode() == EAmsEditor )
  1003                   	{
  1009                   	{
  1004                   	HandleCommandL( EAmsSoftkeyAdd );
  1010                   	HandleCommandL( EAmsSoftkeyAdd );
  1005                   	return EKeyWasConsumed;
  1011                   	return EKeyWasConsumed;
  1006                   	}
  1012                   	}
  1080                  	}
  1086                  	}
  1081                 }
  1087                 }
  1082             	break;
  1088             	break;
  1083             case EKeyEnter:
  1089             case EKeyEnter:
  1084             	{
  1090             	{
       
  1091             	// Check if find item highlight needs to be enabled
       
  1092                 if ( CheckFindItemHighlightL( aKeyEvent, aType ) )
       
  1093                     {
       
  1094                     return EKeyWasConsumed;
       
  1095                     }
  1085               	if (DoEnterKeyL() )
  1096               	if (DoEnterKeyL() )
  1086                 	{
  1097                 	{
  1087                   	return EKeyWasConsumed;
  1098                   	return EKeyWasConsumed;
  1088                   	}
  1099                   	}
  1089               	break;
  1100               	break;
  1256               	}
  1267               	}
  1257             else // viewer 
  1268             else // viewer 
  1258               	{
  1269               	{
  1259             	const TPtrC details = iMtm->Entry().Entry().iDetails;
  1270             	const TPtrC details = iMtm->Entry().Entry().iDetails;
  1260 
  1271 
  1261                 if( (FocusedControlId( ) == EMsgComponentIdFrom) && ( ( iMtm->Sender( ) ).Length() ) )
  1272                 TInt focusedControl = FocusedControlId();                         
       
  1273                 TBool senderHighlighted = EFalse;
       
  1274                 
       
  1275                 if ( focusedControl == EMsgComponentIdFrom )
       
  1276                     {
       
  1277                     CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
       
  1278                         iView->ControlById( EMsgComponentIdFrom ) );
       
  1279                     
       
  1280                     if ( address && address->Editor().SelectionLength() 
       
  1281                             == address->Editor().TextLength() )
       
  1282                         {
       
  1283                         senderHighlighted = ETrue;
       
  1284                         }
       
  1285                     }
       
  1286             	   	
       
  1287                 if( ( focusedControl == EMsgComponentIdFrom ) && ( ( iMtm->Sender( ) ).Length() )
       
  1288                       && senderHighlighted )
  1262                     {
  1289                     {
  1263                     iFindItemMenu->SetSenderHighlightStatus( ETrue );
  1290                     iFindItemMenu->SetSenderHighlightStatus( ETrue );
  1264                     iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) );
  1291                     iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) );
  1265                     }
  1292                     }
  1266 	            else
  1293 	            else
  1269 		            }
  1296 		            }
  1270               	iFindItemMenu->AddItemFindMenuL (
  1297               	iFindItemMenu->AddItemFindMenuL (
  1271                   	0,
  1298                   	0,
  1272                   	aMenuPane,
  1299                   	aMenuPane,
  1273                   	EFindItemMenuPlaceHolder,
  1300                   	EFindItemMenuPlaceHolder,
  1274                   	TMmsGenUtils::PureAddress( iMtm->Sender() ),
  1301                   	senderHighlighted ? 
       
  1302                   	TMmsGenUtils::PureAddress( iMtm->Sender( ) ) : KNullDesC(),
  1275           			( details.Length() == 0 ),
  1303           			( details.Length() == 0 ),
  1276                   	EFalse );
  1304                   	EFalse );
  1277           		//in sent folder reply is dimmed
  1305           		//in sent folder reply is dimmed
  1278                	if ( iMtm->Entry().Entry().Parent() == KMsvSentEntryIdValue )
  1306                	if ( iMtm->Entry().Entry().Parent() == KMsvSentEntryIdValue )
  1279                 	{
  1307                 	{
  1318           	iFindItemMenu->AddItemFindMenuL (
  1346           	iFindItemMenu->AddItemFindMenuL (
  1319             	0,
  1347             	0,
  1320         		aMenuPane,
  1348         		aMenuPane,
  1321               	EFindItemContextMenuPlaceHolder,
  1349               	EFindItemContextMenuPlaceHolder,
  1322               	TMmsGenUtils::PureAddress( iMtm->Sender() ),
  1350               	TMmsGenUtils::PureAddress( iMtm->Sender() ),
  1323         		( details.Length() != 0 ), //"Is sender known"
  1351         		( details.Length() == 0 ), //"Is sender known"
  1324             	ETrue );
  1352             	ETrue );
  1325             // no items dimmed for now
  1353             // no items dimmed for now
  1326           	if ( iMtm->Sender().Length() <= 0 )
  1354           	if ( iMtm->Sender().Length() <= 0 )
  1327           		{
  1355           		{
  1328               	aMenuPane->SetItemDimmed( EAmsViewerCmdSubmenuReply, ETrue );
  1356               	aMenuPane->SetItemDimmed( EAmsViewerCmdSubmenuReply, ETrue );
  4688             }
  4716             }
  4689         }
  4717         }
  4690     
  4718     
  4691     return result;
  4719     return result;
  4692     }
  4720     }
       
  4721 
       
  4722 // ---------------------------------------------------------
       
  4723 // CAudioMessageAppUi::CheckFindItemHighlightL
       
  4724 // ---------------------------------------------------------
       
  4725 //
       
  4726 TBool CAudioMessageAppUi::CheckFindItemHighlightL( 
       
  4727     const TKeyEvent& aKeyEvent, TEventCode aType )
       
  4728     {   
       
  4729     TKeyResponse keyResp = EKeyWasNotConsumed;
       
  4730     CMsgExpandableControl* ctrl = NULL;
       
  4731     TBool checkHighlight = EFalse;
       
  4732     
       
  4733     if( iView->FocusedControl() )
       
  4734         {
       
  4735         ctrl = static_cast<CMsgExpandableControl*>( iView->FocusedControl() );
       
  4736         if ( ctrl )
       
  4737         	{	
       
  4738         	if ( ctrl->ControlType() == EMsgAddressControl
       
  4739                 && !ctrl->Editor().SelectionLength()  ) 
       
  4740             {
       
  4741             checkHighlight = ETrue;
       
  4742             }
       
  4743         	else if ( ctrl->ControlType() == EMsgBodyControl )
       
  4744             {       
       
  4745             CItemFinder* itemFinder = iView->ItemFinder();
       
  4746             if ( FocusedControlId() == EMsgComponentIdBody && itemFinder
       
  4747                     && !itemFinder->CurrentSelection().Length() )
       
  4748                 {                                                              
       
  4749                 checkHighlight = ETrue;
       
  4750                 }
       
  4751             }
       
  4752           }
       
  4753         }
       
  4754     
       
  4755     if ( ctrl && checkHighlight )
       
  4756         {
       
  4757         // Check if highlight needs to be restored to editor,
       
  4758         // address/body editor offerkeyevent will handle it
       
  4759         keyResp = ctrl->Editor().OfferKeyEventL( aKeyEvent, aType );
       
  4760         }    
       
  4761 
       
  4762     return ( keyResp == EKeyWasConsumed ? ETrue : EFalse );  
       
  4763     }