src/gui/inputmethod/qcoefepinputcontext_s60.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 22 79de32ba3296
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
   549     m_preeditString = qt_TDesC2QString(aInitialInlineText);
   549     m_preeditString = qt_TDesC2QString(aInitialInlineText);
   550 
   550 
   551     m_formatRetriever = &aInlineTextFormatRetriever;
   551     m_formatRetriever = &aInlineTextFormatRetriever;
   552     m_pointerHandler = &aPointerEventHandlerDuringInlineEdit;
   552     m_pointerHandler = &aPointerEventHandlerDuringInlineEdit;
   553 
   553 
       
   554     // With T9 aInitialInlineText is typically empty when StartFepInlineEditL is called,
       
   555     // but FEP requires that selected text is always removed at StartFepInlineEditL.
       
   556     // Let's remove the selected text if aInitialInlineText is empty and there is selected text
       
   557     if (m_preeditString.isEmpty()) {
       
   558         int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt();
       
   559         int replacementLength = qAbs(m_cursorPos-anchor);
       
   560         if (replacementLength > 0) {
       
   561             int replacementStart = m_cursorPos < anchor ? 0 : -replacementLength;
       
   562             QList<QInputMethodEvent::Attribute> clearSelectionAttributes;
       
   563             QInputMethodEvent clearSelectionEvent(QLatin1String(""), clearSelectionAttributes);
       
   564             clearSelectionEvent.setCommitString(QLatin1String(""), replacementStart, replacementLength);
       
   565             sendEvent(clearSelectionEvent);
       
   566         }
       
   567     }
       
   568 
   554     applyFormat(&attributes);
   569     applyFormat(&attributes);
   555 
   570 
   556     attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
   571     attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
   557                                                    m_inlinePosition,
   572                                                    m_inlinePosition,
   558                                                    m_cursorVisibility,
   573                                                    m_cursorVisibility,