BB10: Clean up IMF session code

Be more rigorous about checking if we're in a session before invoking IMF functions.  In
particular the code would call initEvent if a key was received while no text field had focus
leading to a crash.

Also closeSession is now always called when a session is terminated rather than just
setting sInputSession to 0 and hasSession is always called to check for a valid session.

Change-Id: I22ce1c9bcdf8dd130f05ae319c4cc1e01afc4456
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Convert more QVector*D member functions to constexpr

constexpr requires inline functions. We convert more member functions
to inline functions while retaining a version of those functions
inside QtGui. This prevents any BC breakage.

Change-Id: I325b78da6b41611bda3994869f474c700b6fb306
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
remove finishEdit() call, fix double textChanged on delete

There is a known bug where duplicate textChanged signals are
triggered on backspace/delete. The bug has been seen on Windows,
Mac, and Linux. Gabi showed that this duplicate signal is caused by
two calls to finishEdit(), one direct and one nested,
in QTextCursorPrivate::remove().

To attempt a fix, I removed the direct call and do not change the
nested call. This change only affects text buffers when they
receive remove commands.

This seems to fix the problem, shown by the test project
uploaded to the bug tracker and also in countTextChangedOnRemove
in tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp.

Further analysis of finishEdit() and QTextCursorPrivate::remove():
finishEdit() calls signals contentsChanged() as long as a valid block
is being edited. Remove() calls finishEdit for all non-table edits,
so finishEdit will be called for most cases.

Methods in the public QTextCursor all seem to set adjusted_anchor
and anchor, none reading it directly, so I haven't found publicly
observable consequences to "adjusted_anchor = anchor = position;".

Task-number: QTBUG-15003
Change-Id: Ic35f25ee81c4007867b47cd8be03c146a673f86d
Reviewed-by: Graham Coleman <ravelite@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>