| |   |
| 100 | 100 | |
| 101 | 101 | void QCoeFepInputContext::reset() |
| 102 | 102 | { |
| commitCurrentString(false); |
| commitCurrentString(true); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) |
| … | … | |
| 125 | 125 | |
| 126 | 126 | void QCoeFepInputContext::setFocusWidget(QWidget *w) |
| 127 | 127 | { |
| commitCurrentString(false); |
| commitCurrentString(true); |
| 129 | 129 | |
| 130 | 130 | QInputContext::setFocusWidget(w); |
| 131 | 131 | |
| … | … | |
| 218 | 218 | break; |
| 219 | 219 | case Qt::Key_Select: |
| 220 | 220 | if (!m_preeditString.isEmpty()) { |
| commitCurrentString(false); |
| commitCurrentString(true); |
| 222 | 222 | return true; |
| 223 | 223 | } |
| 224 | 224 | break; |
| … | … | |
| 230 | 230 | && focusWidget()->inputMethodHints() & Qt::ImhHiddenText |
| 231 | 231 | && !keyEvent->text().isEmpty()) { |
| 232 | 232 | // Send some temporary preedit text in order to make text visible for a moment. |
| m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); |
| 233 | 234 | m_preeditString = keyEvent->text(); |
| 234 | 235 | QList<QInputMethodEvent::Attribute> attributes; |
| 235 | 236 | QInputMethodEvent imEvent(m_preeditString, attributes); |
| … | … | |
| 293 | 293 | Q_ASSERT(focusWidget()); |
| 294 | 294 | |
| 295 | 295 | if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) { |
| commitCurrentString(false); |
| commitCurrentString(true); |
| 297 | 297 | int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); |
| 298 | 298 | |
| 299 | 299 | QList<QInputMethodEvent::Attribute> attributes; |
| … | … | |
| 739 | 739 | |
| 740 | 740 | void QCoeFepInputContext::DoCommitFepInlineEditL() |
| 741 | 741 | { |
| commitCurrentString(true); |
| commitCurrentString(false); |
| 743 | 743 | } |
| 744 | 744 | |
| void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) |
| void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) |
| 746 | 746 | { |
| 747 | 747 | int longPress = 0; |
| 748 | 748 | |
| 749 | 749 | if (m_preeditString.size() == 0) { |
| 750 | 750 | QWidget *w = focusWidget(); |
| if (triggeredBySymbian && w) { |
| if (!cancelFepTransaction && w) { |
| 752 | 752 | // We must replace the last character only if the input box has already accepted one |
| 753 | 753 | if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) |
| 754 | 754 | longPress = 1; |
| … | … | |
| 765 | 765 | m_hasTempPreeditString = false; |
| 766 | 766 | longPress = 0; |
| 767 | 767 | |
| if (!triggeredBySymbian) { |
| if (cancelFepTransaction) { |
| 769 | 769 | CCoeFep* fep = CCoeEnv::Static()->Fep(); |
| 770 | 770 | if (fep) |
| 771 | 771 | fep->CancelTransaction(); |