src/gui/inputmethod/qcoefepinputcontext_s60.cpp
changeset 22 79de32ba3296
parent 19 fcece45ef507
child 25 e24348a560a6
equal deleted inserted replaced
19:fcece45ef507 22:79de32ba3296
    55 
    55 
    56 // MAknEdStateObserver::EAknCursorPositionChanged
    56 // MAknEdStateObserver::EAknCursorPositionChanged
    57 #define QT_EAknCursorPositionChanged MAknEdStateObserver::EAknEdwinStateEvent(6)
    57 #define QT_EAknCursorPositionChanged MAknEdStateObserver::EAknEdwinStateEvent(6)
    58 // MAknEdStateObserver::EAknActivatePenInputRequest
    58 // MAknEdStateObserver::EAknActivatePenInputRequest
    59 #define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7)
    59 #define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7)
       
    60 
       
    61 // EAknEditorFlagSelectionVisible is only valid from 3.2 onwards.
       
    62 // Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors
       
    63 // that support text selection.
       
    64 #define QT_EAknEditorFlagSelectionVisible 0x100000
    60 
    65 
    61 QT_BEGIN_NAMESPACE
    66 QT_BEGIN_NAMESPACE
    62 
    67 
    63 QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
    68 QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
    64     : QInputContext(parent),
    69     : QInputContext(parent),
    73       m_pointerHandler(0),
    78       m_pointerHandler(0),
    74       m_cursorPos(0),
    79       m_cursorPos(0),
    75       m_hasTempPreeditString(false)
    80       m_hasTempPreeditString(false)
    76 {
    81 {
    77     m_fepState->SetObjectProvider(this);
    82     m_fepState->SetObjectProvider(this);
    78     m_fepState->SetFlags(EAknEditorFlagDefault);
    83     if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
       
    84         m_fepState->SetFlags(EAknEditorFlagDefault | QT_EAknEditorFlagSelectionVisible);
       
    85     else
       
    86         m_fepState->SetFlags(EAknEditorFlagDefault);
    79     m_fepState->SetDefaultInputMode( EAknEditorTextInputMode );
    87     m_fepState->SetDefaultInputMode( EAknEditorTextInputMode );
    80     m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
    88     m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
    81     m_fepState->SetDefaultCase( EAknEditorLowerCase );
    89     m_fepState->SetDefaultCase( EAknEditorLowerCase );
    82     m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase );
    90     m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase );
    83     m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
    91     m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
   430         }
   438         }
   431     }
   439     }
   432     m_fepState->SetPermittedCases(flags);
   440     m_fepState->SetPermittedCases(flags);
   433     ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate);
   441     ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate);
   434 
   442 
   435     flags = 0;
   443     if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
       
   444         flags = QT_EAknEditorFlagSelectionVisible;
       
   445     else 
       
   446         flags = 0;
   436     if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly)
   447     if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly)
   437             || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) {
   448             || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) {
   438         flags |= EAknEditorFlagFixedCase;
   449         flags |= EAknEditorFlagFixedCase;
   439     }
   450     }
   440     // Using T9 and hidden text together may actually crash the FEP, so check for hidden text too.
   451     // Using T9 and hidden text together may actually crash the FEP, so check for hidden text too.
   769         if (!cancelFepTransaction && w) {
   780         if (!cancelFepTransaction && w) {
   770             // We must replace the last character only if the input box has already accepted one 
   781             // We must replace the last character only if the input box has already accepted one 
   771             if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos)
   782             if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos)
   772                 longPress = 1;
   783                 longPress = 1;
   773         }
   784         }
   774         return;
       
   775     }
   785     }
   776 
   786 
   777     QList<QInputMethodEvent::Attribute> attributes;
   787     QList<QInputMethodEvent::Attribute> attributes;
   778     QInputMethodEvent event(QLatin1String(""), attributes);
   788     QInputMethodEvent event(QLatin1String(""), attributes);
   779     event.setCommitString(m_preeditString, 0-longPress, longPress);
   789     event.setCommitString(m_preeditString, 0-longPress, longPress);