Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/inputmethod/qcoefepinputcontext_s60.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    7373      m_pointerHandler(0),
    7474      m_longPress(0),
    75       m_cursorPos(0)
     75      m_cursorPos(0),
     76      m_hasTempPreeditString(false)
    7677{
    7778    m_fepState->SetObjectProvider(this);
     
    101102void QCoeFepInputContext::reset()
    102103{
    103     CCoeFep* fep = CCoeEnv::Static()->Fep();
    104     if (fep)
    105         fep->CancelTransaction();
     104    commitCurrentString(false);
    106105}
    107106
     
    201200        return false;
    202201
    203     if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
     202    switch (event->type()) {
     203    case QEvent::KeyPress:
     204        commitTemporaryPreeditString();
     205        // fall through intended
     206    case QEvent::KeyRelease:
    204207        const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
    205208        switch (keyEvent->key()) {
     
    224227            break;
    225228        }
     229
     230        if (keyEvent->type() == QEvent::KeyPress
     231            && focusWidget()->inputMethodHints() & Qt::ImhHiddenText
     232            && !keyEvent->text().isEmpty()) {
     233            // Send some temporary preedit text in order to make text visible for a moment.
     234            m_preeditString = keyEvent->text();
     235            QList<QInputMethodEvent::Attribute> attributes;
     236            QInputMethodEvent imEvent(m_preeditString, attributes);
     237            QApplication::sendEvent(focusWidget(), &imEvent);
     238            m_tempPreeditStringTimeout.start(1000, this);
     239            m_hasTempPreeditString = true;
     240            update();
     241            return true;
     242        }
     243        break;
    226244    }
    227245
     
    252270
    253271    return false;
     272}
     273
     274void QCoeFepInputContext::timerEvent(QTimerEvent *timerEvent)
     275{
     276    if (timerEvent->timerId() == m_tempPreeditStringTimeout.timerId())
     277        commitTemporaryPreeditString();
     278}
     279
     280void QCoeFepInputContext::commitTemporaryPreeditString()
     281{
     282    if (m_tempPreeditStringTimeout.isActive())
     283        m_tempPreeditStringTimeout.stop();
     284
     285    if (!m_hasTempPreeditString)
     286        return;
     287
     288    commitCurrentString(false);
    254289}
    255290
     
    310345{
    311346    using namespace Qt;
     347
     348    commitTemporaryPreeditString();
    312349
    313350    bool numbersOnly = hints & ImhDigitsOnly || hints & ImhFormattedNumbersOnly
     
    502539        return;
    503540
     541    commitTemporaryPreeditString();
     542
    504543    m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
    505544   
     
    600639    if (!w)
    601640        return;
     641
     642    commitTemporaryPreeditString();
    602643
    603644    int pos = aCursorSelection.iAnchorPos;
     
    720761    sendEvent(event);
    721762
     763    m_hasTempPreeditString = false;
    722764    m_longPress = 0;
    723765
Note: See TracChangeset for help on using the changeset viewer.