mobilemessaging/smsui/viewersrc/MsgSmsViewerAppUi.cpp
branchRCL_3
changeset 28 fbb813aef148
parent 24 e00582ce7ecd
child 29 7e4e4bcc75b6
equal deleted inserted replaced
24:e00582ce7ecd 28:fbb813aef148
   963             }
   963             }
   964             break;
   964             break;
   965         case R_SMSV_OPTIONSMENUPANE_CLASS0:
   965         case R_SMSV_OPTIONSMENUPANE_CLASS0:
   966             {
   966             {
   967             TPtrC senderNumber = KNullDesC();
   967             TPtrC senderNumber = KNullDesC();
   968             if ( iFlags.iValidSenderNumber )
   968             
       
   969             TBool senderHighlighted = EFalse;
       
   970             if ( FocusedControlId( ) == EMsgComponentIdFrom )
       
   971                 {
       
   972                 CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
       
   973                     iView->ControlById( EMsgComponentIdFrom ) );
       
   974                            
       
   975                 if ( address && address->Editor().SelectionLength() )
       
   976                     {
       
   977                     senderHighlighted = ETrue;
       
   978                     }
       
   979                 }               
       
   980             if ( iFlags.iValidSenderNumber 
       
   981                  && senderHighlighted )
   969                 {
   982                 {
   970                 senderNumber.Set( iNumber );
   983                 senderNumber.Set( iNumber );
   971                 }
   984                 }
   972             //if autolock enabled, hide finditem-menu
   985             //if autolock enabled, hide finditem-menu
   973             if ( iFlags.iAutoLockEnabled )
   986             if ( iFlags.iAutoLockEnabled )
   976                 }
   989                 }
   977             // Coverty fix , Forward NULL http://ousrv057/cov.cgi?cid=35945
   990             // Coverty fix , Forward NULL http://ousrv057/cov.cgi?cid=35945
   978             else if(iFindItemMenu)
   991             else if(iFindItemMenu)
   979 	            {              
   992 	            {              
   980 	            iFindItemMenu->AddItemFindMenuL( 
   993 	            iFindItemMenu->AddItemFindMenuL( 
   981                 IsBodyFocused() ? iView->ItemFinder() : 0,
   994                 FindItemHighlighted() ? iView->ItemFinder() : 0,
   982                 aMenuPane, EFindItemMenuPlaceHolder,
   995                 aMenuPane, EFindItemMenuPlaceHolder,
   983                 senderNumber, 
   996                 senderNumber, 
   984                 iRecipientstring.Length() != 0 ? ETrue : EFalse,
   997                 iRecipientstring.Length() != 0 ? ETrue : EFalse,
   985                 EFalse );
   998                 EFalse );
   986                 }
   999                 }
  1076 			aMenuPane->SetItemDimmed( ESmsViewerReplyNoSubMenu, EFalse );
  1089 			aMenuPane->SetItemDimmed( ESmsViewerReplyNoSubMenu, EFalse );
  1077         	}        	
  1090         	}        	
  1078 
  1091 
  1079         // add automatic highlight menus
  1092         // add automatic highlight menus
  1080         TPtrC senderNumber = KNullDesC();
  1093         TPtrC senderNumber = KNullDesC();
       
  1094              
       
  1095         TBool senderHighlighted = EFalse;
       
  1096         if ( FocusedControlId( ) == EMsgComponentIdFrom )
       
  1097             {
       
  1098             CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
       
  1099                 iView->ControlById( EMsgComponentIdFrom ) );
       
  1100                        
       
  1101             if ( address && address->Editor().SelectionLength() )
       
  1102                 {
       
  1103                 senderHighlighted = ETrue;
       
  1104                 }
       
  1105             }          
       
  1106         
  1081         if ( iFlags.iIsEmailMessage ) // SMS originating address is email address 
  1107         if ( iFlags.iIsEmailMessage ) // SMS originating address is email address 
  1082             {  
  1108             {  
  1083             senderNumber.Set( iRecipientstring );
  1109             if ( senderHighlighted )
       
  1110                 {
       
  1111                 senderNumber.Set( iRecipientstring );
       
  1112                 }
  1084             iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress );
  1113             iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress );
  1085             }            
  1114             }            
  1086         else 
  1115         else 
  1087             {// SMS originating adddress is Phone number
  1116             {// SMS originating adddress is Phone number
  1088             if ( iFlags.iValidSenderNumber )
  1117             if ( iFlags.iValidSenderNumber
       
  1118                  && senderHighlighted )
  1089                 {
  1119                 {
  1090                 senderNumber.Set( iNumber );
  1120                 senderNumber.Set( iNumber );
  1091                 }
  1121                 }
  1092             }
  1122             }
  1093         //Added to remove Copy-option when sender number is not valid (for example it has alphabets)    
  1123         //Added to remove Copy-option when sender number is not valid (for example it has alphabets)    
  1097 	            {
  1127 	            {
  1098 	            iFindItemMenu->SetSenderHighlightStatus( 
  1128 	            iFindItemMenu->SetSenderHighlightStatus( 
  1099 	                iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() );
  1129 	                iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() );
  1100 	            iFindItemMenu->SetSenderDisplayText( senderNumber );
  1130 	            iFindItemMenu->SetSenderDisplayText( senderNumber );
  1101 	            iFindItemMenu->AddItemFindMenuL( 
  1131 	            iFindItemMenu->AddItemFindMenuL( 
  1102 	                IsBodyFocused() ? iView->ItemFinder() : 0,
  1132 	                FindItemHighlighted() ? iView->ItemFinder() : 0,
  1103 	                aMenuPane, EFindItemMenuPlaceHolder,
  1133 	                aMenuPane, EFindItemMenuPlaceHolder,
  1104 	                senderNumber, 
  1134 	                senderNumber, 
  1105 	                iFlags.iIsEmailMessage ? EFalse : ( iRecipientstring.Length() != 0 ) );
  1135 	                iFlags.iIsEmailMessage ? EFalse : ( iRecipientstring.Length() != 0 ) );
  1106 	            }
  1136 	            }
  1107 	        else
  1137 	        else
  1108 	            {
  1138 	            {
  1109 	            iFindItemMenu->SetSenderHighlightStatus( 
  1139 	            iFindItemMenu->SetSenderHighlightStatus( 
  1110 	                iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() );
  1140 	                iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() );
  1111 	            iFindItemMenu->SetSenderDisplayText( senderNumber );
  1141 	            iFindItemMenu->SetSenderDisplayText( senderNumber );
  1112 	            iFindItemMenu->AddItemFindMenuL( 
  1142 	            iFindItemMenu->AddItemFindMenuL( 
  1113 	                IsBodyFocused() ? iView->ItemFinder() : 0,
  1143 	                FindItemHighlighted() ? iView->ItemFinder() : 0,
  1114 	                aMenuPane, EFindItemMenuPlaceHolder,
  1144 	                aMenuPane, EFindItemMenuPlaceHolder,
  1115 	                senderNumber, 
  1145 	                senderNumber, 
  1116 	                ETrue );
  1146 	                ETrue );
  1117 	            }
  1147 	            }
  1118             }
  1148             }
  1578                 iView->OfferKeyEventL( aKeyEvent, aType );
  1608                 iView->OfferKeyEventL( aKeyEvent, aType );
  1579                 return EKeyWasConsumed;
  1609                 return EKeyWasConsumed;
  1580                 }
  1610                 }
  1581             case EKeyDevice3:
  1611             case EKeyDevice3:
  1582             case EKeyEnter:	
  1612             case EKeyEnter:	
  1583                 {// Selection-key checking (Context sensitive menu)
  1613                 {             
       
  1614                 if( iView->FocusedControl()->ControlType() == EMsgAddressControl )
       
  1615                     {
       
  1616                     CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
       
  1617                         iView->FocusedControl() );
       
  1618                     if ( address && !address->Editor().SelectionLength() )
       
  1619                         {
       
  1620                         // restore highlight to address field
       
  1621                         return address->Editor().OfferKeyEventL( aKeyEvent, aType );
       
  1622                         }               
       
  1623                     }
       
  1624                 else if ( iView->FocusedControl()->ControlType() == EMsgBodyControl )
       
  1625                     {       
       
  1626                     CItemFinder* itemFinder = iView->ItemFinder();
       
  1627                     if ( FocusedControlId() == EMsgComponentIdBody 
       
  1628                          && itemFinder )
       
  1629                         {                                                                          
       
  1630                         if ( !itemFinder->CurrentSelection().Length() )
       
  1631                             {
       
  1632                             CMsgBodyControl* body = static_cast<CMsgBodyControl*>(
       
  1633                                 iView->FocusedControl() );
       
  1634                             if ( body )
       
  1635                                 {                     
       
  1636                                  // restore highlight to current itemfinder item
       
  1637                                 return body->Editor().OfferKeyEventL( aKeyEvent, aType );
       
  1638                                 }
       
  1639                             }
       
  1640                         }
       
  1641                     }
       
  1642                 // fall through
       
  1643                 }
       
  1644             case EMsgFindItemKeyEvent:
       
  1645                 {
       
  1646                 // Selection-key checking (Context sensitive menu)
  1584                 // (with Class 0 just show the menu)
  1647                 // (with Class 0 just show the menu)
  1585                 if ( !iClass0CBA )
  1648                 if ( !iClass0CBA )
  1586                     {
  1649                     {
  1587                     MenuBar()->SetMenuTitleResourceId( R_SMSV_CONTEXTMENUBAR );
  1650                     MenuBar()->SetMenuTitleResourceId( R_SMSV_CONTEXTMENUBAR );
  1588                     MenuBar()->SetMenuType(CEikMenuBar::EMenuContext);
  1651                     MenuBar()->SetMenuType(CEikMenuBar::EMenuContext);
  3062         iFlags.iEmailSubjectControlPresent = EFalse;
  3125         iFlags.iEmailSubjectControlPresent = EFalse;
  3063         }
  3126         }
  3064     iTypeMsg = pduType; //for successful launch save the PDU Type.
  3127     iTypeMsg = pduType; //for successful launch save the PDU Type.
  3065     }
  3128     }
  3066 
  3129 
       
  3130 // ---------------------------------------------------------
       
  3131 // CMsgSmsViewerAppUi::FindItemHighlighted
       
  3132 // Checks wheter current find item is highlighted
       
  3133 // ---------------------------------------------------------
       
  3134 //
       
  3135 TBool CMsgSmsViewerAppUi::FindItemHighlighted()
       
  3136     {
       
  3137     if ( iView->ItemFinder() && 
       
  3138          iView->ItemFinder()->CurrentSelection().Length() )
       
  3139         {
       
  3140         return ETrue;
       
  3141         }
       
  3142     return EFalse;
       
  3143     }
       
  3144 
       
  3145 // ---------------------------------------------------------
       
  3146 // CMsgSmsViewerAppUi::FocusedControlId
       
  3147 // Returns id of focused control
       
  3148 // ---------------------------------------------------------
       
  3149 //
       
  3150 TInt CMsgSmsViewerAppUi::FocusedControlId( )
       
  3151     {
       
  3152     TInt controlType = EMsgComponentIdNull;
       
  3153     if ( iView && iView->FocusedControl( ) )
       
  3154         {
       
  3155         controlType = iView->FocusedControl( )->ControlId( );
       
  3156         }
       
  3157     return controlType;
       
  3158     }
       
  3159 
  3067 //  End of File  
  3160 //  End of File