summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMrudul Pendharkar <mrudul.v.pendharkar@nokia.com>2011-08-22 13:36:49 (GMT)
committerMrudul Pendharkar <mrudul.v.pendharkar@nokia.com>2011-08-22 13:36:49 (GMT)
commit7954766416e29cdfcd4f2915ed66b5b3d124fded (patch)
tree9cd6b6d02b4be857ff9f9a08e430237686a3050d /src
parent13e7d402c438fd2c527dbc302cf1103d5c835a2f (diff)
parentb186288cbf796be662f86ae4d5c70e39ba6afb67 (diff)
downloadQt-7954766416e29cdfcd4f2915ed66b5b3d124fded.zip
Qt-7954766416e29cdfcd4f2915ed66b5b3d124fded.tar.gz
Qt-7954766416e29cdfcd4f2915ed66b5b3d124fded.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h1
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp46
2 files changed, 40 insertions, 7 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 9857015..8c30838 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -154,6 +154,7 @@ private:
TUint m_textCapabilities;
bool m_inDestruction;
bool m_pendingInputCapabilitiesChanged;
+ bool m_pendingTransactionCancel;
int m_cursorVisibility;
int m_inlinePosition;
MFepInlineTextFormatRetriever *m_formatRetriever;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index c3d293b..9cf4212 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -64,6 +64,8 @@
#define QT_EAknCursorPositionChanged MAknEdStateObserver::EAknEdwinStateEvent(6)
// MAknEdStateObserver::EAknActivatePenInputRequest
#define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7)
+// MAknEdStateObserver::EAknClosePenInputRequest
+#define QT_EAknClosePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(10)
// EAknEditorFlagSelectionVisible is only valid from 3.2 onwards.
// Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors
@@ -107,6 +109,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_textCapabilities(TCoeInputCapabilities::EAllText),
m_inDestruction(false),
m_pendingInputCapabilitiesChanged(false),
+ m_pendingTransactionCancel(false),
m_cursorVisibility(1),
m_inlinePosition(0),
m_formatRetriever(0),
@@ -252,9 +255,6 @@ bool QCoeFepInputContext::needsInputPanel()
bool QCoeFepInputContext::filterEvent(const QEvent *event)
{
- // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically
- // close when it discovers that the underlying widget does not have input capabilities.
-
if (!focusWidget())
return false;
@@ -318,6 +318,12 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
if (!needsInputPanel())
return false;
+ if ((event->type() == QEvent::CloseSoftwareInputPanel)
+ && (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)) {
+ m_fepState->ReportAknEdStateEventL(QT_EAknClosePenInputRequest);
+ return false;
+ }
+
if (event->type() == QEvent::RequestSoftwareInputPanel) {
// Only request virtual keyboard if it is not yet active or if this is the first time
// panel is requested for this application.
@@ -474,7 +480,7 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
if (!alwaysResize) {
if (gv->scene()) {
- if (gv->scene()->focusItem()) {
+ if (gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) {
// Check if the widget contains cursorPositionChanged signal and disconnect from it.
QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
@@ -580,7 +586,7 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget)
if (!moveWithinVisibleArea) {
// Check if the widget contains cursorPositionChanged signal and connect to it.
QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
- if (gv->scene() && gv->scene()->focusItem()) {
+ if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) {
int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
if (index != -1)
connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
@@ -1069,15 +1075,24 @@ void QCoeFepInputContext::CancelFepInlineEdit()
// We are not supposed to ever have a tempPreeditString and a real preedit string
// from S60 at the same time, so it should be safe to rely on this test to determine
// whether we should honor S60's request to clear the text or not.
- if (m_hasTempPreeditString)
+ if (m_hasTempPreeditString || m_pendingTransactionCancel)
return;
+ m_pendingTransactionCancel = true;
+
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event(QLatin1String(""), attributes);
event.setCommitString(QLatin1String(""), 0, 0);
m_preeditString.clear();
m_inlinePosition = 0;
sendEvent(event);
+
+ // Sync with native side editor state. Native side can then do various operations
+ // based on editor state, such as removing 'exact word bubble'.
+ if (!m_pendingInputCapabilitiesChanged)
+ ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState);
+
+ m_pendingTransactionCancel = false;
}
TInt QCoeFepInputContext::DocumentLengthForFep() const
@@ -1087,7 +1102,18 @@ TInt QCoeFepInputContext::DocumentLengthForFep() const
return 0;
QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText);
- return variant.value<QString>().size() + m_preeditString.size();
+
+ 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;
+
+ return size;
}
TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const
@@ -1170,6 +1196,12 @@ void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDoc
// FEP expects the preedit string to be part of the editor content, so let's mix it in.
int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
text.insert(cursor, m_preeditString);
+
+ // Add additional space to empty non-password text to compensate
+ // for the fake length we specified in DocumentLengthForFep().
+ if (text.size() == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText))
+ text += QChar(0x20);
+
aEditorContent.Copy(qt_QString2TPtrC(text.mid(aDocumentPosition, aLengthToRetrieve)));
}