aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Fabio Bas2009-11-04 21:58:21 +0000
committerGravatar Fabio Bas2009-11-04 21:58:21 +0000
commitc8bf3fd657c4a6a536d47de7f750f7498ce38ab1 (patch)
tree4b664ad2adf76495e3e77484396f631a379076c0 /src
parentreworked nsis install script: fix for #604, removed unused readme, use revisi... (diff)
downloadKVIrc-c8bf3fd657c4a6a536d47de7f750f7498ce38ab1.tar.gz
KVIrc-c8bf3fd657c4a6a536d47de7f750f7498ce38ab1.tar.bz2
KVIrc-c8bf3fd657c4a6a536d47de7f750f7498ce38ab1.zip
fix for #444
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3588 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/kvirc/ui/kvi_input_editor.cpp64
1 files changed, 47 insertions, 17 deletions
diff --git a/src/kvirc/ui/kvi_input_editor.cpp b/src/kvirc/ui/kvi_input_editor.cpp
index ace74fc3e..a3436ebf2 100644
--- a/src/kvirc/ui/kvi_input_editor.cpp
+++ b/src/kvirc/ui/kvi_input_editor.cpp
@@ -54,6 +54,7 @@
#include <QFontMetrics>
#include <QKeyEvent>
#include <QDragEnterEvent>
+#include <QInputContext>
QFontMetrics * g_pLastFontMetrics = 0;
@@ -815,6 +816,14 @@ void KviInputEditor::mousePressEvent(QMouseEvent * e)
}
g_pInputPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_BIGGRIN)),__tr2qs("Insert Icon"),m_pIconMenu);
+
+ QInputContext *qic = g_pApp->inputContext();
+ if (qic) {
+ QList<QAction *> imActions = qic->actions();
+ for (int i = 0; i < imActions.size(); ++i)
+ g_pInputPopup->addAction(imActions.at(i));
+ }
+
g_pInputPopup->popup(mapToGlobal(e->pos()));
} else {
pasteSelectionWithConfirmation();
@@ -1219,30 +1228,51 @@ void KviInputEditor::inputMethodEvent(QInputMethodEvent * e)
return;
}
- removeSelected();
+ if(!m_bIMComposing)
+ {
+ removeSelected();
+ m_iIMStart = m_iIMSelectionBegin = m_iCursorPosition;
+ m_iIMLength = 0;
+ m_bIMComposing = true;
+ }
- int c = m_iCursorPosition;
- if (e->replacementStart() <= 0)
- c += e->commitString().length() + qMin(-e->replacementStart(), e->replacementLength());
+ m_bUpdatesEnabled = false;
- m_iCursorPosition += e->replacementStart();
+ m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->commitString());
- // insert commit string
- if (e->replacementLength()) {
- m_iIMSelectionBegin = m_iCursorPosition;
- m_iIMLength = e->replacementLength();
- removeSelected();
- }
- if (!e->commitString().isEmpty())
+ // update selection inside the pre-edit
+ m_iIMSelectionBegin = m_iIMStart + e->replacementStart();
+ m_iIMSelectionLength = e->replacementLength();
+ moveCursorTo(m_iIMSelectionBegin);
+
+ if (e->commitString().isEmpty())
{
- m_bIMComposing = false;
- insertText(e->commitString());
+ if(e->preeditString().isEmpty())
+ {
+ m_bIMComposing = false;
+ m_iIMStart = 0;
+ m_iIMLength = 0;
+ } else {
+ // replace the preedit area with the IM result text
+ m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->preeditString());
+ // move cursor to after the IM result text
+ moveCursorTo(m_iIMStart + m_iIMLength);
+ }
} else {
- m_bIMComposing = true;
+ // replace the preedit area with the IM result text
+ m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->commitString());
+ // move cursor to after the IM result text
+ moveCursorTo(m_iIMStart + m_iIMLength);
+ // reset data
+ m_bIMComposing = false;
+ m_iIMStart = 0;
+ m_iIMLength = 0;
}
- m_iCursorPosition = c;
- update();
+ // repaint
+ m_bUpdatesEnabled = true;
+
+ repaintWithCursorOn();
}
void KviInputEditor::keyPressEvent(QKeyEvent * e)