uifw/AvKon/src/AknPhoneNumberEditor.cpp
branchRCL_3
changeset 20 d48ab3b357f1
parent 19 aecbbf00d063
child 21 978afdc0236f
equal deleted inserted replaced
19:aecbbf00d063 20:d48ab3b357f1
   373         {
   373         {
   374         iExtension->iCcpuSupport->HandleSelectionChangeL();
   374         iExtension->iCcpuSupport->HandleSelectionChangeL();
   375         }
   375         }
   376     if ( cousorChanged )
   376     if ( cousorChanged )
   377     	{
   377     	{
   378         ReportAknEdStateEventL( MAknEdStateObserver::EAknCursorPositionChanged );
   378         ReportAknEdStateEvent( MAknEdStateObserver::EAknCursorPositionChanged );
   379     	}
   379     	}
   380     // see if we want to remember the old cursor X position
   380     // see if we want to remember the old cursor X position
   381     if ( targetPosUsed )
   381     if ( targetPosUsed )
   382         {
   382         {
   383         if ( iTargetCursorPos == CAknPhedView::KNoPos )
   383         if ( iTargetCursorPos == CAknPhedView::KNoPos )
   419         {
   419         {
   420         TRAP_IGNORE( iExtension->iCcpuSupport->HandleFocusChangeL() );        
   420         TRAP_IGNORE( iExtension->iCcpuSupport->HandleFocusChangeL() );        
   421         }    
   421         }    
   422     if ( ! IsFocused() )
   422     if ( ! IsFocused() )
   423         {
   423         {
   424         TRAP_IGNORE( ReportAknEdStateEventL( MAknEdStateObserver::EAknSyncEdwinState ) );
   424         ReportAknEdStateEvent( MAknEdStateObserver::EAknSyncEdwinState );
   425         }
   425         }
   426     if ( aDrawNow )
   426     if ( aDrawNow )
   427         DrawNow();
   427         DrawNow();
   428     }
   428     }
   429 
   429 
   498 
   498 
   499 EXPORT_C void CAknPhoneNumberEditor::SetSelectionL( TInt aCursorPos,TInt aAnchorPos )
   499 EXPORT_C void CAknPhoneNumberEditor::SetSelectionL( TInt aCursorPos,TInt aAnchorPos )
   500     {
   500     {
   501     iModel->SetRealCursorPosition(aCursorPos);
   501     iModel->SetRealCursorPosition(aCursorPos);
   502     iModel->SetAnchorPosition( aAnchorPos );
   502     iModel->SetAnchorPosition( aAnchorPos );
   503     ReportAknEdStateEventL( 
   503     ReportAknEdStateEvent( 
   504             MAknEdStateObserver::EAknCursorPositionChanged );
   504             MAknEdStateObserver::EAknCursorPositionChanged );
   505     }
   505     }
   506 
   506 
   507 EXPORT_C void CAknPhoneNumberEditor::SetCursorPosL( TInt aCursorPos,TBool aSelect )
   507 EXPORT_C void CAknPhoneNumberEditor::SetCursorPosL( TInt aCursorPos,TBool aSelect )
   508     {
   508     {
   509     TInt anchor = iModel->AnchorPosition();
   509     TInt anchor = iModel->AnchorPosition();
   510     iModel->SetRealCursorPosition( aCursorPos );
   510     iModel->SetRealCursorPosition( aCursorPos );
   511     if ( aSelect )
   511     if ( aSelect )
   512         iModel->SetAnchorPosition( anchor );
   512         iModel->SetAnchorPosition( anchor );
   513     ReportAknEdStateEventL( 
   513     ReportAknEdStateEvent( 
   514         MAknEdStateObserver::EAknCursorPositionChanged );
   514         MAknEdStateObserver::EAknCursorPositionChanged );
   515     }
   515     }
   516 
   516 
   517 EXPORT_C void CAknPhoneNumberEditor::SelectAllL()
   517 EXPORT_C void CAknPhoneNumberEditor::SelectAllL()
   518     {
   518     {
   642 void CAknPhoneNumberEditor::SetCursorSelectionForFepL( const TCursorSelection& aCursorSelection )
   642 void CAknPhoneNumberEditor::SetCursorSelectionForFepL( const TCursorSelection& aCursorSelection )
   643     {
   643     {
   644     iModel->SetRealCursorPosition( iModel->Uncompensate( aCursorSelection.iCursorPos ) );
   644     iModel->SetRealCursorPosition( iModel->Uncompensate( aCursorSelection.iCursorPos ) );
   645     iModel->SetAnchorPosition( iModel->Uncompensate( aCursorSelection.iAnchorPos  ) );
   645     iModel->SetAnchorPosition( iModel->Uncompensate( aCursorSelection.iAnchorPos  ) );
   646     
   646     
   647     ReportAknEdStateEventL( 
   647     ReportAknEdStateEvent( 
   648             MAknEdStateObserver::EAknCursorPositionChanged );
   648             MAknEdStateObserver::EAknCursorPositionChanged );
   649     DrawNow();
   649     DrawNow();
   650     }
   650     }
   651 
   651 
   652 void CAknPhoneNumberEditor::GetCursorSelectionForFep( TCursorSelection& aCursorSelection ) const
   652 void CAknPhoneNumberEditor::GetCursorSelectionForFep( TCursorSelection& aCursorSelection ) const
   906             {
   906             {
   907             MTouchFeedback* feedback = MTouchFeedback::Instance();
   907             MTouchFeedback* feedback = MTouchFeedback::Instance();
   908             
   908             
   909             if ( feedback )
   909             if ( feedback )
   910                 {
   910                 {
   911                 feedback->InstantFeedback( this, ETouchFeedbackEditor );
   911                 feedback->InstantFeedback( this, ETouchFeedbackEdit );
   912                 }
   912                 }
   913             }
   913             }
   914             //cancel previous selection
   914             //cancel previous selection
   915             if ( iExtension->iPointPos != cursor )
   915             if ( iExtension->iPointPos != cursor )
   916                 {                
   916                 {                
  1079     HBufC* allowChars = iEikonEnv->AllocReadResourceLC( 
  1079     HBufC* allowChars = iEikonEnv->AllocReadResourceLC( 
  1080         R_EIK_ALLOWED_STANDARDNUMBERMODEKEYMAP );   
  1080         R_EIK_ALLOWED_STANDARDNUMBERMODEKEYMAP );   
  1081     
  1081     
  1082     // check if the characters are allowed, if one character is not allowed, 
  1082     // check if the characters are allowed, if one character is not allowed, 
  1083     // it will not be pasted into phone number editor
  1083     // it will not be pasted into phone number editor
  1084 	if ( fepState->CurrentInputMode() != EAknEditorTextInputMode )
  1084     CAknExtendedInputCapabilities * pCapabilities(iExtension->iExtendedInputCapabilities);
       
  1085 	if ( fepState->CurrentInputMode() != EAknEditorTextInputMode && pCapabilities
       
  1086 		&& pCapabilities->EditorType() != CAknExtendedInputCapabilities::EHybridAlphaNumericEditor )
  1085 		{
  1087 		{
  1086 		TInt pos = 0;
  1088 		TInt pos = 0;
  1087 		TInt index = 0;
  1089 		TInt index = 0;
  1088 		while ( index < buf.Length() )
  1090 		while ( index < buf.Length() )
  1089 			{
  1091 			{
  1122 // CAknPhoneNumberEditor::CcpuPasteL
  1124 // CAknPhoneNumberEditor::CcpuPasteL
  1123 // --------------------------------------------------------------------------
  1125 // --------------------------------------------------------------------------
  1124 //
  1126 //
  1125 EXPORT_C void CAknPhoneNumberEditor::CcpuPasteL()
  1127 EXPORT_C void CAknPhoneNumberEditor::CcpuPasteL()
  1126     {
  1128     {
       
  1129     // When we paste the buffer to phone number editor, we must get the buffer from clipboard first 
       
  1130     // and then insert buffer to phone number editor. As the main job of CcpuCanPaste() is getting and 
       
  1131     // checking the buffer in clipboard, so we must call CcpuCanPaste() first.
       
  1132     // If iExtension->iPasteText is not NULL, it means CcpuCanPaste() has been called before and the 
       
  1133     // buffer in clipboard is valid. No need to call it once again. 
       
  1134     if ( !iExtension->iPasteText )
       
  1135         {
       
  1136         // If the return value of CcpuCanPaste is EFalse, iExtension->iPasteText must be NULL,
       
  1137         // else if the return value of CcpuCanPaste is ETure, iExtension->iPasteText must not be NULL.
       
  1138         // So we don't need to check if the return value is ETure or EFalse, 
       
  1139         // we will check iExtension->iPasteText instead of that.
       
  1140         CcpuCanPaste();
       
  1141         }
  1127     if ( iExtension->iPasteText )
  1142     if ( iExtension->iPasteText )
  1128         {
  1143         {
  1129         iModel->Paste( iExtension->iPasteText->Des() );
  1144         iModel->Paste( iExtension->iPasteText->Des() );
  1130         DrawNow();
  1145         DrawNow();
  1131         }
  1146         }
  1249 EXPORT_C void CAknPhoneNumberEditor::OpenVKB( )
  1264 EXPORT_C void CAknPhoneNumberEditor::OpenVKB( )
  1250     {
  1265     {
  1251     TUint cap = iExtension->iExtendedInputCapabilities->Capabilities();
  1266     TUint cap = iExtension->iExtendedInputCapabilities->Capabilities();
  1252     cap &= ~CAknExtendedInputCapabilities::EInputEditorDisableVKB;
  1267     cap &= ~CAknExtendedInputCapabilities::EInputEditorDisableVKB;
  1253     iExtension->iExtendedInputCapabilities->SetCapabilities( cap );
  1268     iExtension->iExtendedInputCapabilities->SetCapabilities( cap );
  1254     TRAP_IGNORE( ReportAknEdStateEventL( 
  1269     ReportAknEdStateEvent( 
  1255     		     MAknEdStateObserver::EAknActivatePenInputRequest ) );
  1270     		     MAknEdStateObserver::EAknActivatePenInputRequest );
  1256     }
  1271     }
  1257 
  1272 
  1258 // --------------------------------------------------------------------------
  1273 // --------------------------------------------------------------------------
  1259 // CAknPhoneNumberEditor::CloseVKB
  1274 // CAknPhoneNumberEditor::CloseVKB
  1260 // --------------------------------------------------------------------------
  1275 // --------------------------------------------------------------------------
  1262 void CAknPhoneNumberEditor::CloseVKB( )
  1277 void CAknPhoneNumberEditor::CloseVKB( )
  1263     {
  1278     {
  1264     TUint cap = iExtension->iExtendedInputCapabilities->Capabilities();
  1279     TUint cap = iExtension->iExtendedInputCapabilities->Capabilities();
  1265     cap |= CAknExtendedInputCapabilities::EInputEditorDisableVKB;
  1280     cap |= CAknExtendedInputCapabilities::EInputEditorDisableVKB;
  1266     iExtension->iExtendedInputCapabilities->SetCapabilities( cap );
  1281     iExtension->iExtendedInputCapabilities->SetCapabilities( cap );
  1267     ReportAknEdStateEventL( MAknEdStateObserver::EAknClosePenInputRequest );
  1282     ReportAknEdStateEvent( MAknEdStateObserver::EAknClosePenInputRequest );
  1268     }
  1283     }
  1269 
  1284 
  1270 // --------------------------------------------------------------------------
  1285 // --------------------------------------------------------------------------
  1271 // CAknPhoneNumberEditor::ReportAknEdStateEventL
  1286 // CAknPhoneNumberEditor::ReportAknEdStateEventL
  1272 // --------------------------------------------------------------------------
  1287 // --------------------------------------------------------------------------
  1273 //
  1288 //
  1274 void CAknPhoneNumberEditor::ReportAknEdStateEventL( 
  1289 void CAknPhoneNumberEditor::ReportAknEdStateEvent( 
  1275          MAknEdStateObserver::EAknEdwinStateEvent aStateEvent )
  1290          MAknEdStateObserver::EAknEdwinStateEvent aStateEvent )
  1276     {
  1291     {
  1277     CAknEdwinState* edwinState = STATIC_CAST( CAknEdwinState*,State(KNullUid) );
  1292     CAknEdwinState* edwinState = STATIC_CAST( CAknEdwinState*,State(KNullUid) );
  1278     if ( edwinState )
  1293     if ( edwinState )
  1279         {                   
  1294         {                   
  1292     	return 0;
  1307     	return 0;
  1293     	}
  1308     	}
  1294 	return edwinState->Flags();	
  1309 	return edwinState->Flags();	
  1295 	}
  1310 	}
  1296 
  1311 
       
  1312 // --------------------------------------------------------------------------
       
  1313 // CAknPhoneNumberEditor::MakeVisible
       
  1314 // --------------------------------------------------------------------------
       
  1315 //
       
  1316 void CAknPhoneNumberEditor::MakeVisible(TBool aVisible)
       
  1317 	{
       
  1318 	CCoeControl::MakeVisible(aVisible);
       
  1319 	if ( !aVisible )
       
  1320 		{
       
  1321 	    CloseVKB();
       
  1322 		}
       
  1323 	}
  1297 
  1324 
  1298 // End of file
  1325 // End of file