From 2da55509d4344ed56ad8243b496398779fc3c98a Mon Sep 17 00:00:00 2001 From: Marko Kenttala Date: Thu, 28 Jun 2012 10:43:35 +0300 Subject: Enable smiley support for Symbian editors Added enabling of CEikEdwin::EAvkonEnableSmileySupport flag for normal Symbian editors so that smiley/emoticon button or menu is enabled. Change-Id: I0b9f6205ca1521fc54d3b688ccd1225823263aac Reviewed-by: Juha Kukkonen Reviewed-by: Jaakko Helanti Reviewed-by: Kalle Lehtonen --- src/gui/inputmethod/qcoefepinputcontext_p.h | 3 +++ src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index f8e6fec..d799378 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -225,6 +225,9 @@ private: CAknExtendedInputCapabilities *m_extendedInputCapabilities; + QScopedPointer m_formAccessor; + QScopedPointer m_dummyEditor; + friend class tst_QInputContext; }; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 151d3cc..b6ca59a 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -434,7 +434,9 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_splitViewPreviousWindowStates(Qt::WindowNoState), m_splitViewPreviousFocusItem(0), m_ccpu(0), - m_extendedInputCapabilities(0) + m_extendedInputCapabilities(0), + m_formAccessor(0), + m_dummyEditor(0) { m_fepState->SetObjectProvider(this); int defaultFlags = EAknEditorFlagDefault; @@ -476,6 +478,14 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_pasteAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy())); connect(m_pasteAction, SIGNAL(triggered()), this, SLOT(paste())); + + // Use dummy editor to enable smiley support by default + m_dummyEditor.reset(new CEikEdwin()); + TRAPD(err, m_dummyEditor->ConstructL(CEikEdwin::EAvkonEnableSmileySupport)); + if (!err) { + m_formAccessor.reset(new CAknEdwinFormAccessor(m_dummyEditor.data())); + m_fepState->SetFormAccessor(m_formAccessor.data()); + } } QCoeFepInputContext::~QCoeFepInputContext() @@ -1328,6 +1338,8 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } m_fepState->SetNumericKeymap(static_cast(flags)); + bool enableSmileys = false; + if (hints & ImhUrlCharactersOnly) { // URL characters is everything except space, so a superset of the other restrictions m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG); @@ -1335,10 +1347,16 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); } else if (needsCharMap) { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); + enableSmileys = !(hints & ImhHiddenText); } else { m_fepState->SetSpecialCharacterTableResourceId(0); } + if (enableSmileys) + m_dummyEditor->AddFlagToUserFlags(CEikEdwin::EAvkonEnableSmileySupport); + else + m_dummyEditor->RemoveFlagFromUserFlags(CEikEdwin::EAvkonEnableSmileySupport); + if (hints & ImhHiddenText) { m_textCapabilities = TCoeInputCapabilities::EAllText | TCoeInputCapabilities::ESecretText; } else { -- cgit v0.12