summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-10-22 00:44:38 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-10-22 00:44:38 +1000
commit6937461976682546f6d8b0f3bfddb034a6d226cf (patch)
treef5732c160b16c959ccd943a49e3c44b79f829efc
parent2cf3c7e47f9f4963989f5270b7930fc9382670a6 (diff)
parente2b892c48c986c38f431b1af98023d16af53bc96 (diff)
downloadqt4-tools-6937461976682546f6d8b0f3bfddb034a6d226cf.tar.gz
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt-doc-team
* '4.7' of git://scm.dev.nokia.troll.no/qt/qt-doc-team: Fix security problem on webpage due to bad JS Accepting predicted text using hardware keyboard replaces unwanted part
-rwxr-xr-xdoc/src/template/scripts/functions.js13
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h1
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp37
-rwxr-xr-xtools/qdoc3/doc/config/scripts/functions.js13
-rw-r--r--tools/qdoc3/test/qt-html-templates-online.qdocconf13
-rw-r--r--tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf11
-rw-r--r--tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf11
7 files changed, 37 insertions, 62 deletions
diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js
index 3ab4a082a7..af204d8d06 100755
--- a/doc/src/template/scripts/functions.js
+++ b/doc/src/template/scripts/functions.js
@@ -183,17 +183,6 @@ var blankRE=/^\s*$/;
function CheckEmptyAndLoadList()
{
- /* Start Extracting information for feedback and adding this to the feedback form */
- var pageUrl = window.location.pathname;
- var pageVal = $('title').html();
- $('#pageType').removeClass('red');
- $('#feedUrl').remove();
- $('#pageVal').remove();
- $('.menuAlert').remove();
- $('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">');
- $('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">');
- /* End Extracting information for feedback and adding this to the feedback form */
-
/* extracts search query */
var value = document.getElementById('pageType').value;
/* if the search is less than three chars long remove class names and remove elements from old search*/
@@ -255,4 +244,4 @@ function CheckEmptyAndLoadList()
});
}, 500); /* timer set to 500 ms */
});
- }); \ No newline at end of file
+ });
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 8c30838071..cefae5e519 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -162,6 +162,7 @@ private:
QBasicTimer m_tempPreeditStringTimeout;
bool m_hasTempPreeditString;
QString m_cachedPreeditString;
+ int m_cachedCursorAndAnchorPosition;
int m_splitViewResizeBy;
Qt::WindowStates m_splitViewPreviousWindowStates;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 79005ce88a..66ab4c886d 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -115,6 +115,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_formatRetriever(0),
m_pointerHandler(0),
m_hasTempPreeditString(false),
+ m_cachedCursorAndAnchorPosition(-1),
m_splitViewResizeBy(0),
m_splitViewPreviousWindowStates(Qt::WindowNoState)
{
@@ -158,9 +159,18 @@ void QCoeFepInputContext::reset()
}
// Store a copy of preedit text, if prediction is active and input context is reseted.
// This is to ensure that we can replace preedit string after losing focus to FEP manager's
- // internal sub-windows.
- if (m_cachedPreeditString.isEmpty() && !(currentHints & Qt::ImhNoPredictiveText))
+ // internal sub-windows. Additionally, store the cursor position if there is no selected text.
+ // This allows input context to replace preedit strings if they are not at the end of current
+ // text.
+ if (m_cachedPreeditString.isEmpty() && !(currentHints & Qt::ImhNoPredictiveText)) {
m_cachedPreeditString = m_preeditString;
+ if (focusWidget()) {
+ int cursor = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
+ int anchor = focusWidget()->inputMethodQuery(Qt::ImAnchorPosition).toInt();
+ if (cursor == anchor)
+ m_cachedCursorAndAnchorPosition = cursor;
+ }
+ }
commitCurrentString(true);
}
@@ -196,6 +206,7 @@ void QCoeFepInputContext::setFocusWidget(QWidget *w)
void QCoeFepInputContext::widgetDestroyed(QWidget *w)
{
m_cachedPreeditString.clear();
+ m_cachedCursorAndAnchorPosition = -1;
// Make sure that the input capabilities of whatever new widget got focused are queried.
CCoeControl *ctrl = w->effectiveWinId();
@@ -981,6 +992,7 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText,
return;
m_cachedPreeditString.clear();
+ m_cachedCursorAndAnchorPosition = -1;
commitTemporaryPreeditString();
@@ -1039,8 +1051,16 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText,
QString newPreeditString = qt_TDesC2QString(aNewInlineText);
QInputMethodEvent event(newPreeditString, attributes);
if (!m_cachedPreeditString.isEmpty()) {
- event.setCommitString(QLatin1String(""), -m_cachedPreeditString.length(), m_cachedPreeditString.length());
+ int cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
+ // Predicted word is either replaced from the end of the word (normal case),
+ // or from stored location, if the predicted word is either in the beginning of,
+ // or in the middle of already committed word.
+ int diff = cursorPos - m_cachedCursorAndAnchorPosition;
+ int replaceLocation = (diff != m_cachedPreeditString.length()) ? diff : m_cachedPreeditString.length();
+
+ event.setCommitString(QLatin1String(""), -replaceLocation, m_cachedPreeditString.length());
m_cachedPreeditString.clear();
+ m_cachedCursorAndAnchorPosition = -1;
} else if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) {
// In Symbian world this means "erase last character".
event.setCommitString(QLatin1String(""), -1, 1);
@@ -1138,6 +1158,10 @@ void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCur
int pos = aCursorSelection.iAnchorPos;
int length = aCursorSelection.iCursorPos - pos;
+ if (m_cachedCursorAndAnchorPosition != -1) {
+ pos = m_cachedCursorAndAnchorPosition;
+ length = 0;
+ }
QList<QInputMethodEvent::Attribute> attributes;
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, length, QVariant());
@@ -1155,6 +1179,13 @@ void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSele
int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size();
int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size();
+
+ // If the position is stored, use that value, so that word replacement from proposed word
+ // lists are added to the correct position.
+ if (m_cachedCursorAndAnchorPosition != -1) {
+ cursor = m_cachedCursorAndAnchorPosition;
+ anchor = m_cachedCursorAndAnchorPosition;
+ }
QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>();
int combinedSize = text.size() + m_preeditString.size();
if (combinedSize < anchor || combinedSize < cursor) {
diff --git a/tools/qdoc3/doc/config/scripts/functions.js b/tools/qdoc3/doc/config/scripts/functions.js
index 62bc53508e..af204d8d06 100755
--- a/tools/qdoc3/doc/config/scripts/functions.js
+++ b/tools/qdoc3/doc/config/scripts/functions.js
@@ -183,17 +183,6 @@ var blankRE=/^\s*$/;
function CheckEmptyAndLoadList()
{
- /* Start Extracting information for feedback and adding this to the feedback form */
- var pageUrl = window.location.href;
- var pageVal = $('title').html();
- $('#pageType').removeClass('red');
- $('#feedUrl').remove();
- $('#pageVal').remove();
- $('.menuAlert').remove();
- $('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">');
- $('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">');
- /* End Extracting information for feedback and adding this to the feedback form */
-
/* extracts search query */
var value = document.getElementById('pageType').value;
/* if the search is less than three chars long remove class names and remove elements from old search*/
@@ -255,4 +244,4 @@ function CheckEmptyAndLoadList()
});
}, 500); /* timer set to 500 ms */
});
- }); \ No newline at end of file
+ });
diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf
index 77ab3c5e8a..af78088967 100644
--- a/tools/qdoc3/test/qt-html-templates-online.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf
@@ -142,8 +142,6 @@ HTML.postpostheader = \
" <div class=\"content mainContent\">\n"
HTML.footer = \
- " <div class=\"feedback t_button\">\n" \
- " [+] Documentation Feedback</div>\n" \
" </div>\n" \
" </div>\n" \
" </div> \n" \
@@ -169,17 +167,6 @@ HTML.footer = \
" Free Documentation License version 1.3</a>\n" \
" as published by the Free Software Foundation.</p>\n" \
" </div>\n" \
- " <div id=\"feedbackBox\">\n" \
- " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
- " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
- " <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \
- " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \
- " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \
- " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
- " </form>\n" \
- " </div>\n" \
- " <div id=\"blurpage\">\n" \
- " </div>\n" \
"\n" \
" <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \
" <script type=\"text/javascript\">\n" \
diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf
index fa15d90c60..80d6dd70dd 100644
--- a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf
@@ -139,8 +139,6 @@ HTML.postpostheader = \
HTML.footer = \
" <!-- /div -->\n" \
- " <div class=\"feedback t_button\">\n" \
- " [+] Documentation Feedback</div>\n" \
" </div>\n" \
" </div>\n" \
" <div class=\"ft\">\n" \
@@ -164,13 +162,4 @@ HTML.footer = \
" Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
" Free Documentation License version 1.3</a>\n" \
" as published by the Free Software Foundation.</p>\n" \
- " </div>\n" \
- " <div id=\"feedbackBox\">\n" \
- " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
- " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
- " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \
- " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
- " </form>\n" \
- " </div>\n" \
- " <div id=\"blurpage\">\n" \
" </div>\n"
diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf
index 285ec27af3..02f444d12d 100644
--- a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf
@@ -139,8 +139,6 @@ HTML.postpostheader = \
HTML.footer = \
" <!-- /div -->\n" \
- " <div class=\"feedback t_button\">\n" \
- " [+] Documentation Feedback</div>\n" \
" </div>\n" \
" </div>\n" \
" <div class=\"ft\">\n" \
@@ -164,13 +162,4 @@ HTML.footer = \
" Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
" Free Documentation License version 1.3</a>\n" \
" as published by the Free Software Foundation.</p>\n" \
- " </div>\n" \
- " <div id=\"feedbackBox\">\n" \
- " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
- " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
- " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \
- " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
- " </form>\n" \
- " </div>\n" \
- " <div id=\"blurpage\">\n" \
" </div>\n"