qt/qt-x11-opensource-src-4.4.3-im.patch
Than Ngo 8be7a045cc - bz#468814, immodule selection behavior is unpredictable without
QT_IM_MODULE, patch from Peng Wu
- backport fix from 4.5
2008-11-06 13:36:05 +00:00

68 lines
3.1 KiB
Diff

diff -up qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp.orig qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp
--- qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp.orig 2008-11-06 14:19:08.000000000 +0100
+++ qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp 2008-11-06 14:18:34.000000000 +0100
@@ -69,12 +69,15 @@ QMultiInputContext::QMultiInputContext()
if (keys.at(i).contains(QLatin1String("imsw")))
keys.removeAt(i);
+ m_keys = keys;
+
QString def = QLatin1String(getenv("QT_IM_MODULE"));
if (def.isEmpty()) {
- QSettings settings;
- def = settings.value(QLatin1String("/qt/DefaultInputMethod"), QLatin1String("xim")).toString();
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("Qt"));
+ def = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString();
}
- current = keys.indexOf(def);
+ current = m_keys.indexOf(def);
if (current < 0)
current = 0;
@@ -83,13 +86,16 @@ QMultiInputContext::QMultiInputContext()
separator->setSeparator(true);
QActionGroup *group = new QActionGroup(this);
- for (int i = 0; i < keys.size(); ++i) {
- slaves.append(QInputContextFactory::create(keys.at(i), this));
- QAction *a = menu->addAction(slaves.at(i)->identifierName());
+ for (int i = 0; i < m_keys.size(); ++i) {
+ //slaves.append(QInputContextFactory::create(keys.at(i), this));
+ slaves.append(NULL);
+ QAction *a = menu->addAction(m_keys.at(i));
a->setCheckable(true);
group->addAction(a);
- if (i == current)
+ if (i == current) {
+ slaves.replace(current, QInputContextFactory::create(m_keys.at(i), this));
a->setChecked(true);
+ }
}
connect(group, SIGNAL(triggered(QAction*)), this, SLOT(changeSlave(QAction*)));
@@ -181,8 +187,10 @@ QList<QAction *> QMultiInputContext::act
void QMultiInputContext::changeSlave(QAction *a)
{
- for (int i = 0; i < slaves.size(); ++i) {
- if (slaves.at(i)->identifierName() == a->text()) {
+ for (int i = 0; i < m_keys.size(); ++i) {
+ if (m_keys.at(i) == a->text()) {
+ if (NULL == slaves.at(i))
+ slaves.replace(i, QInputContextFactory::create(m_keys.at(i), this));
current = i;
return;
}
diff -up qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h.orig qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h
--- qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h.orig 2008-09-27 10:58:48.000000000 +0200
+++ qt-x11-opensource-src-4.4.3/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h 2008-11-06 14:19:53.000000000 +0100
@@ -103,6 +103,7 @@ private:
QList<QInputContext *> slaves;
QMenu *menu;
QAction *separator;
+ QStringList m_keys;
};
#endif // Q_NO_IM