summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@nokia.com>2011-08-31 09:38:52 +0200
committerSergio Ahumada <sergio.ahumada@nokia.com>2011-08-31 09:39:36 +0200
commit0e10b8dbb7d84694cbdeb57bf42df52b12d79f47 (patch)
treee0968185c3afce109537977c9eb0df4cfd8f6cb7 /src/gui/inputmethod
parentac51ebee5bcc975829cf59012dfe9bb198016ed1 (diff)
parent5a9000c3aca05e28c4fc537f82d85d6ec4395dc5 (diff)
Merge branch 4.7 into qt-4.8-from-4.7
Conflicts: doc/src/index.qdoc
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h1
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp50
2 files changed, 40 insertions, 11 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 98570153b1..8c30838071 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 5ddd53fd89..75ce9e006e 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.
@@ -354,10 +360,6 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
if (sControl) {
sControl->setIgnoreFocusChanged(false);
}
- //If m_pointerHandler has already been set, it means that fep inline editing is in progress.
- //When this is happening, do not filter out pointer events.
- if (!m_pointerHandler)
- return true;
}
}
@@ -474,7 +476,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 +582,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()));
@@ -1062,15 +1064,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
@@ -1080,7 +1091,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
@@ -1163,6 +1185,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)));
}