summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod
diff options
context:
space:
mode:
authorSatyam Bandarapu <ext-satyam.bandarapu@nokia.com>2012-02-08 09:25:10 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-09 11:45:36 (GMT)
commit0ffd7fcc78e27f9184a6f1ee5a8a9cc5e6266998 (patch)
tree028b87a9e392d05d896af3bd044d5baef74e5e27 /src/gui/inputmethod
parent60666017530dc981b3908e3e572269cb5a3019ed (diff)
downloadQt-0ffd7fcc78e27f9184a6f1ee5a8a9cc5e6266998.zip
Qt-0ffd7fcc78e27f9184a6f1ee5a8a9cc5e6266998.tar.gz
Qt-0ffd7fcc78e27f9184a6f1ee5a8a9cc5e6266998.tar.bz2
Symbian: Fix for blank window after taping Editing options.
This happens in FlightInfo app when menu is opened, editor lost focus and Fep manager looks for focused editor to do ccpu related tasks. It also has some partially regression from fix a2709ef3f4410a1d1755e00353e6f969f8bb5613. The regression is fixed in QCoeFepInputContext::DocumentLengthForFep by returning size to 1 only for multiline editors with no text and multiple lines presented. And also set focused editor to last focused editor when Menu is opened. Opening EditOptions shows blank window if virtual keyboard is never open before. This is because 'm_lastFocusedEditor' is null and it will set to last focused editor only when virtual keyboard open. Fixed in QCoeFepInputContext::setFocusWidget by setting 'm_lastFocusedEditor' to current editor. Above fixes causes other issue, Qt application 'actions' are never added to optionsMenu. This happens because Qt Symbian implementation assumes that default menu items are less than or equal to one, but in Qt 4.8.0 CCPU adds one more default menu item (EditOptoins) to OptionsMenu in addition to 'Writing language' menu item. Fixed by setting NumberOfItemsInPane<=2 in QS60MainAppUi::DynInitMenuPaneL. Change-Id: Idd35cbc746f06f1c64d003c0a32ef1b8f8bc3c89 Reviewed-by: Sami Merilä <sami.merila@nokia.com> Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index a73f570..bb2d173 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -501,6 +501,14 @@ void QCoeFepInputContext::setFocusWidget(QWidget *w)
QInputContext::setFocusWidget(w);
updateHints(true);
+ if (w) {
+ // Store last focused widget and object. Needed when Menu is Opened
+ QObject *focusObject = 0;
+ m_lastFocusedEditor = getQWidgetFromQGraphicsView(focusWidget(),
+ &focusObject);
+ m_lastFocusedObject = focusObject; // Can be null
+ Q_ASSERT(m_lastFocusedEditor);
+ }
}
void QCoeFepInputContext::widgetDestroyed(QWidget *w)
@@ -1509,21 +1517,49 @@ TInt QCoeFepInputContext::DocumentLengthForFep() const
{
QT_TRY {
QWidget *w = focusWidget();
+ QObject *focusObject = 0;
+ if (!w) {
+ //when Menu is opened editor lost the focus, but fep manager wants focused editor
+ w = m_lastFocusedEditor;
+ focusObject = m_lastFocusedObject;
+ } else {
+ w = getQWidgetFromQGraphicsView(w, &focusObject);
+ }
if (!w)
return 0;
QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText);
-
int size = variant.value<QString>().size() + m_preeditString.size();
// To fix an issue with backspaces not being generated if document size is zero,
// fake document length to be at least one always, except when dealing with
- // hidden text widgets, where this faking would generate extra asterisk. Since the
- // primary use of hidden text widgets is password fields, they are unlikely to
- // support multiple lines anyway.
- if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText))
- size = 1;
-
+ // hidden text widgets, all singleline text widgets and
+ // also multiline text widget with single line.
+ if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)
+ && !(qobject_cast< QLineEdit *> (w))) {
+ int lineCount = 0;
+ if (QTextEdit* tedit = qobject_cast<QTextEdit *>(w)) {
+ lineCount = tedit->document()->lineCount();
+ } else if (QPlainTextEdit* ptedit = qobject_cast<QPlainTextEdit *>(w)) {
+ lineCount = ptedit->document()->lineCount();
+ } else {
+ // Unknown editor (probably a QML one); Request the "lineCount" property.
+ QObject *invokeTarget = w;
+ if (focusObject)
+ invokeTarget = focusObject;
+ QVariant lineVariant = invokeTarget->property("lineCount");
+ if (lineVariant.isValid()) {
+ lineCount = lineVariant.toInt();
+ } else {
+ lineCount = 1;
+ }
+ }
+ // To fix an issue with backspaces not being generated if document size is zero,
+ // return size to 1 only for multiline editors with
+ // no text and multiple lines presented.
+ if (lineCount > 1)
+ size = 1;
+ }
return size;
} QT_CATCH(const std::exception&) {
return 0;