Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/inputmethod/inputmethod.pri

    r561 r769  
    2727    HEADERS += inputmethod/qcoefepinputcontext_p.h
    2828    SOURCES += inputmethod/qcoefepinputcontext_s60.cpp
    29     LIBS += -lfepbase
     29    LIBS += -lfepbase -lakninputlanguage
    3030}
    3131
  • trunk/src/gui/inputmethod/qcoefepinputcontext_p.h

    r651 r769  
    9797
    9898private:
    99     void commitCurrentString(bool triggeredBySymbian);
     99    void commitCurrentString(bool cancelFepTransaction);
    100100    void updateHints(bool mustUpdateInputCapabilities);
    101101    void applyHints(Qt::InputMethodHints hints);
     
    128128    void DoCommitFepInlineEditL();
    129129    MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue);
    130         void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType);
     130    void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType);
    131131
    132132    // From MCoeFepAwareTextEditor_Extension1
     
    152152    MFepInlineTextFormatRetriever *m_formatRetriever;
    153153    MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler;
    154     int m_longPress;
    155154    int m_cursorPos;
    156155    QBasicTimer m_tempPreeditStringTimeout;
  • trunk/src/gui/inputmethod/qcoefepinputcontext_s60.cpp

    r651 r769  
    5959#define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7)
    6060
     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
     65
    6166QT_BEGIN_NAMESPACE
    6267
     
    7277      m_formatRetriever(0),
    7378      m_pointerHandler(0),
    74       m_longPress(0),
    7579      m_cursorPos(0),
    7680      m_hasTempPreeditString(false)
    7781{
    7882    m_fepState->SetObjectProvider(this);
    79     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);
    8087    m_fepState->SetDefaultInputMode( EAknEditorTextInputMode );
    8188    m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
    8289    m_fepState->SetDefaultCase( EAknEditorLowerCase );
    83     m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase );
     90    m_fepState->SetPermittedCases( EAknEditorAllCaseModes );
    8491    m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
    8592    m_fepState->SetNumericKeymap( EAknEditorStandardNumberModeKeymap );
     
    102109void QCoeFepInputContext::reset()
    103110{
    104     commitCurrentString(false);
     111    commitCurrentString(true);
    105112}
    106113
     
    115122
    116123    // For pre-5.0 SDKs, we don't do text updates on S60 side.
    117     if (QSysInfo::s60Version() != QSysInfo::SV_S60_5_0) {
     124    if (QSysInfo::s60Version() < QSysInfo::SV_S60_5_0) {
    118125        return;
    119126    }
     
    127134void QCoeFepInputContext::setFocusWidget(QWidget *w)
    128135{
    129     commitCurrentString(false);
     136    commitCurrentString(true);
    130137
    131138    QInputContext::setFocusWidget(w);
     
    220227        case Qt::Key_Select:
    221228            if (!m_preeditString.isEmpty()) {
    222                 commitCurrentString(false);
     229                commitCurrentString(true);
    223230                return true;
    224231            }
     
    232239            && !keyEvent->text().isEmpty()) {
    233240            // Send some temporary preedit text in order to make text visible for a moment.
     241            m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
    234242            m_preeditString = keyEvent->text();
    235243            QList<QInputMethodEvent::Attribute> attributes;
    236244            QInputMethodEvent imEvent(m_preeditString, attributes);
    237             QApplication::sendEvent(focusWidget(), &imEvent);
     245            sendEvent(imEvent);
    238246            m_tempPreeditStringTimeout.start(1000, this);
    239247            m_hasTempPreeditString = true;
     
    294302
    295303    if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) {
    296         commitCurrentString(false);
     304        commitCurrentString(true);
    297305        int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
    298306
     
    433441    ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate);
    434442
    435     flags = 0;
     443    if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
     444        flags = QT_EAknEditorFlagSelectionVisible;
     445    else
     446        flags = 0;
    436447    if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly)
    437448            || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) {
     
    474485{
    475486    TCharFormat cFormat;
    476     QColor styleTextColor = QApplication::palette("QLineEdit").text().color();
    477     TLogicalRgb tontColor(TRgb(styleTextColor.red(), styleTextColor.green(), styleTextColor.blue(), styleTextColor.alpha()));
    478     cFormat.iFontPresentation.iTextColor = tontColor;
     487    const QColor styleTextColor = focusWidget() ? focusWidget()->palette().text().color() :
     488        QApplication::palette("QLineEdit").text().color();
     489    const TLogicalRgb fontColor(TRgb(styleTextColor.red(), styleTextColor.green(), styleTextColor.blue(), styleTextColor.alpha()));
     490    cFormat.iFontPresentation.iTextColor = fontColor;
    479491
    480492    TInt numChars = 0;
     
    551563    m_formatRetriever = &aInlineTextFormatRetriever;
    552564    m_pointerHandler = &aPointerEventHandlerDuringInlineEdit;
     565
     566    // With T9 aInitialInlineText is typically empty when StartFepInlineEditL is called,
     567    // but FEP requires that selected text is always removed at StartFepInlineEditL.
     568    // Let's remove the selected text if aInitialInlineText is empty and there is selected text
     569    if (m_preeditString.isEmpty()) {
     570        int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt();
     571        int replacementLength = qAbs(m_cursorPos-anchor);
     572        if (replacementLength > 0) {
     573            int replacementStart = m_cursorPos < anchor ? 0 : -replacementLength;
     574            QList<QInputMethodEvent::Attribute> clearSelectionAttributes;
     575            QInputMethodEvent clearSelectionEvent(QLatin1String(""), clearSelectionAttributes);
     576            clearSelectionEvent.setCommitString(QLatin1String(""), replacementStart, replacementLength);
     577            sendEvent(clearSelectionEvent);
     578        }
     579    }
    553580
    554581    applyFormat(&attributes);
     
    740767void QCoeFepInputContext::DoCommitFepInlineEditL()
    741768{
    742     commitCurrentString(true);
    743 }
    744 
    745 void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
    746 {
     769    commitCurrentString(false);
     770    if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
     771        ReportAknEdStateEvent(QT_EAknCursorPositionChanged);
     772
     773}
     774
     775void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction)
     776{
     777    int longPress = 0;
     778
    747779    if (m_preeditString.size() == 0) {
    748780        QWidget *w = focusWidget();
    749         if (triggeredBySymbian && w) {
     781        if (!cancelFepTransaction && w) {
    750782            // We must replace the last character only if the input box has already accepted one
    751783            if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos)
    752                 m_longPress = 1;
    753         }
    754         return;
     784                longPress = 1;
     785        }
    755786    }
    756787
    757788    QList<QInputMethodEvent::Attribute> attributes;
    758789    QInputMethodEvent event(QLatin1String(""), attributes);
    759     event.setCommitString(m_preeditString, 0-m_longPress, m_longPress);
     790    event.setCommitString(m_preeditString, 0-longPress, longPress);
    760791    m_preeditString.clear();
    761792    sendEvent(event);
    762793
    763794    m_hasTempPreeditString = false;
    764     m_longPress = 0;
    765 
    766     if (!triggeredBySymbian) {
     795    longPress = 0;
     796
     797    if (cancelFepTransaction) {
    767798        CCoeFep* fep = CCoeEnv::Static()->Fep();
    768799        if (fep)
  • trunk/src/gui/inputmethod/qinputcontextfactory.cpp

    r651 r769  
    7474#ifdef Q_WS_S60
    7575#include "qcoefepinputcontext_p.h"
     76#include "akninputlanguageinfo.h"
    7677#endif
    7778
     
    199200}
    200201
     202#if defined(Q_WS_S60)
     203/*!
     204    \internal
     205
     206    This function contains pure Symbian exception handling code for
     207    getting S60 language list.
     208    Returned object ownership is transfered to caller.
     209*/
     210static CAknInputLanguageList* s60LangListL()
     211{
     212    CAknInputLanguageInfo *langInfo = AknInputLanguageInfoFactory::CreateInputLanguageInfoL();
     213    CleanupStack::PushL(langInfo);
     214    // In rare phone there is more than 7 languages installed -> use 7 as an array granularity
     215    CAknInputLanguageList *langList = new (ELeave) CAknInputLanguageList(7);
     216    CleanupStack::PushL(langList);
     217    langInfo->AppendAvailableLanguagesL(langList);
     218    CleanupStack::Pop(langList);
     219    CleanupStack::PopAndDestroy(langInfo);
     220    return langList;
     221}
     222
     223/*!
     224    \internal
     225
     226    This function utility function return S60 language list.
     227    Returned object ownership is transfered to caller.
     228*/
     229static CAknInputLanguageList* s60LangList()
     230{
     231    CAknInputLanguageList *langList = NULL;
     232    TRAP_IGNORE(langList = s60LangListL());
     233    q_check_ptr(langList);
     234    return langList;
     235}
     236#endif
     237
    201238/*!
    202239    Returns the languages supported by the QInputContext object
     
    230267#if defined(Q_WS_S60)
    231268    if (key == QLatin1String("coefep"))
    232         return QStringList(QString());
     269        {
     270        CAknInputLanguageList *langList = s60LangList();
     271        int count = langList->Count();
     272        for (int i = 0; i < count; ++i)
     273            {
     274            result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode())));
     275            }
     276        delete langList;
     277        }
    233278#endif
    234279#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
Note: See TracChangeset for help on using the changeset viewer.