webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp
changeset 38 6297cdf66332
parent 37 cb62a4f66ebe
child 58 220a17280356
child 65 5bfc169077b2
equal deleted inserted replaced
37:cb62a4f66ebe 38:6297cdf66332
    73 //
    73 //
    74 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    75 CWebFepTextEditor::CWebFepTextEditor(WebView* aView)
    75 CWebFepTextEditor::CWebFepTextEditor(WebView* aView)
    76     : m_webView(aView),
    76     : m_webView(aView),
    77       m_textFormatMask(NULL),
    77       m_textFormatMask(NULL),
    78       m_inlineEditText(NULL)
    78       m_inlineEditText(NULL),
       
    79       m_longKeyPress(EFalse)
    79 {
    80 {
    80     // Set up the extended capabilities
    81     // Set up the extended capabilities
    81     TRAP_IGNORE(
    82     TRAP_IGNORE(
    82         m_ExtendedInputCapabilities = CAknExtendedInputCapabilities::NewL();
    83         m_ExtendedInputCapabilities = CAknExtendedInputCapabilities::NewL();
    83         );
    84         );
   193     delete m_textFormatMask;
   194     delete m_textFormatMask;
   194     m_textFormatMask = NULL;
   195     m_textFormatMask = NULL;
   195 
   196 
   196     delete m_inlineEditText;
   197     delete m_inlineEditText;
   197     m_inlineEditText = NULL;
   198     m_inlineEditText = NULL;
       
   199     
       
   200     m_longKeyPress = EFalse ;
   198 
   201 
   199     UpdateInputModeState(EAknEditorNullInputMode, EAknEditorAllInputModes,EAknEditorStandardNumberModeKeymap);
   202     UpdateInputModeState(EAknEditorNullInputMode, EAknEditorAllInputModes,EAknEditorStandardNumberModeKeymap);
   200     UpdateFlagsState(EAknEditorFlagDefault);        
   203     UpdateFlagsState(EAknEditorFlagDefault);        
   201     UpdateCaseState(EAknEditorLowerCase, EAknEditorAllCaseModes);
   204     UpdateCaseState(EAknEditorLowerCase, EAknEditorAllCaseModes);
   202 
   205 
   407 
   410 
   408 	// Override the length if a text format mask is set
   411 	// Override the length if a text format mask is set
   409 	if ( m_textFormatMask && m_textFormatMask->getMultitude() > 0 )
   412 	if ( m_textFormatMask && m_textFormatMask->getMultitude() > 0 )
   410         length = m_textFormatMask->getMultitude();
   413         length = m_textFormatMask->getMultitude();
   411 
   414 
       
   415     if (IsLongKeyPress() && 
       
   416         (KMaxTInt != length))
       
   417         length += 1 ;
   412     // TextArea node has no member function maxLength(), so return KMaxTInt
   418     // TextArea node has no member function maxLength(), so return KMaxTInt
   413     return length;
   419     return length;
   414 }
   420 }
   415 
   421 
   416 // -----------------------------------------------------------------------------
   422 // -----------------------------------------------------------------------------
   583         }
   589         }
   584     }
   590     }
   585     //delete the m_inlineEditText since text is commited
   591     //delete the m_inlineEditText since text is commited
   586     delete m_inlineEditText;
   592     delete m_inlineEditText;
   587     m_inlineEditText = NULL;
   593     m_inlineEditText = NULL;
       
   594     
       
   595     m_longKeyPress = EFalse;
   588 
   596 
   589     HandleUpdateCursor();
   597     HandleUpdateCursor();
   590     UpdateEditingMode();
   598     UpdateEditingMode();
   591 }
   599 }
   592 
   600 
   654         MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
   662         MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
   655         MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit)
   663         MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit)
   656 {
   664 {
   657     aSetToTrue=ETrue;
   665     aSetToTrue=ETrue;
   658     SetCursorSelectionForFepL(aCursorSelection);
   666     SetCursorSelectionForFepL(aCursorSelection);
       
   667     m_longKeyPress = ETrue ;
   659     StartFepInlineEditL(aInitialInlineText, aPositionOfInsertionPointInInlineText, aCursorVisibility, aCustomDraw, aInlineTextFormatRetriever, aPointerEventHandlerDuringInlineEdit);
   668     StartFepInlineEditL(aInitialInlineText, aPositionOfInsertionPointInInlineText, aCursorVisibility, aCustomDraw, aInlineTextFormatRetriever, aPointerEventHandlerDuringInlineEdit);
   660 }
   669 }
   661 
   670 
   662 // -----------------------------------------------------------------------------
   671 // -----------------------------------------------------------------------------
   663 // SetCursorType
   672 // SetCursorType
   932 
   941 
   933         if (!m_textFormatMask->checkText(input->value(), eb)) {
   942         if (!m_textFormatMask->checkText(input->value(), eb)) {
   934             style->setProperty(CSS_PROP_COLOR, "red", false, ec);
   943             style->setProperty(CSS_PROP_COLOR, "red", false, ec);
   935             return false;
   944             return false;
   936         }
   945         }
       
   946         else if ( m_textFormatMask->acceptAll() )
       
   947         {
       
   948             return true;
       
   949         }
   937         else
   950         else
   938         {
   951         {
   939             style->setProperty(CSS_PROP_COLOR, m_inputTextColor, false, ec);
   952             style->setProperty(CSS_PROP_COLOR, m_inputTextColor, false, ec);
   940             CancelEditingMode();
   953             CancelEditingMode();
   941             return true;
   954             return true;
  1468     }
  1481     }
  1469     CommitFepInlineEditL(*CEikonEnv::Static());
  1482     CommitFepInlineEditL(*CEikonEnv::Static());
  1470     CancelEditingMode();    
  1483     CancelEditingMode();    
  1471     } 
  1484     } 
  1472 
  1485 
  1473 
  1486 // -----------------------------------------------------------------------------
       
  1487 // IsLongKeyPress
       
  1488 //
       
  1489 // Called to know the status of the key pressed 
       
  1490 // -----------------------------------------------------------------------------
       
  1491 TBool CWebFepTextEditor::IsLongKeyPress() const
       
  1492     {
       
  1493     return m_longKeyPress ;	
       
  1494     }
       
  1495