View | Details | Raw Unified | Return to bug 398526
Collapse All | Expand All

(-)qt-x11-opensource-src-4.4.0/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp (-7 / +14 lines)
Lines 75-86 QMultiInputContext::QMultiInputContext() Link Here
75
        if (keys.at(i).contains(QLatin1String("imsw")))
75
        if (keys.at(i).contains(QLatin1String("imsw")))
76
            keys.removeAt(i);
76
            keys.removeAt(i);
77
77
78
	m_keys = keys;
79
78
    QString def = QLatin1String(getenv("QT_IM_MODULE"));
80
    QString def = QLatin1String(getenv("QT_IM_MODULE"));
79
    if (def.isEmpty()) {
81
    if (def.isEmpty()) {
80
	QSettings settings;
82
	QSettings settings;
81
        def = settings.value(QLatin1String("/qt/DefaultInputMethod"), QLatin1String("xim")).toString();
83
        def = settings.value(QLatin1String("/qt/DefaultInputMethod"), QLatin1String("xim")).toString();
82
    }
84
    }
83
    current = keys.indexOf(def);
85
    current = m_keys.indexOf(def);
84
    if (current < 0)
86
    if (current < 0)
85
        current = 0;
87
        current = 0;
86
88
Lines 89-101 QMultiInputContext::QMultiInputContext() Link Here
89
    separator->setSeparator(true);
91
    separator->setSeparator(true);
90
92
91
    QActionGroup *group = new QActionGroup(this);
93
    QActionGroup *group = new QActionGroup(this);
92
    for (int i = 0; i < keys.size(); ++i) {
94
    for (int i = 0; i < m_keys.size(); ++i) {
93
        slaves.append(QInputContextFactory::create(keys.at(i), this));
95
        //slaves.append(QInputContextFactory::create(keys.at(i), this));
94
        QAction *a = menu->addAction(slaves.at(i)->identifierName());
96
		slaves.append(NULL);
97
        QAction *a = menu->addAction(m_keys.at(i));
95
        a->setCheckable(true);
98
        a->setCheckable(true);
96
        group->addAction(a);
99
        group->addAction(a);
97
        if (i == current)
100
        if (i == current) {
101
			slaves.replace(current, QInputContextFactory::create(m_keys.at(i), this));
98
            a->setChecked(true);
102
            a->setChecked(true);
103
		}
99
    }
104
    }
100
    connect(group, SIGNAL(triggered(QAction*)), this, SLOT(changeSlave(QAction*)));
105
    connect(group, SIGNAL(triggered(QAction*)), this, SLOT(changeSlave(QAction*)));
101
106
Lines 187-194 QList<QAction *> QMultiInputContext::act Link Here
187
192
188
void QMultiInputContext::changeSlave(QAction *a)
193
void QMultiInputContext::changeSlave(QAction *a)
189
{
194
{
190
    for (int i = 0; i < slaves.size(); ++i) {
195
    for (int i = 0; i < m_keys.size(); ++i) {
191
        if (slaves.at(i)->identifierName() == a->text()) {
196
        if (m_keys.at(i) == a->text()) {
197
            if (NULL == slaves.at(i))
198
				slaves.replace(i, QInputContextFactory::create(m_keys.at(i), this));
192
            current = i;
199
            current = i;
193
            return;
200
            return;
194
        }
201
        }
(-)qt-x11-opensource-src-4.4.0/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h (+1 lines)
Lines 109-114 private: Link Here
109
    QList<QInputContext *> slaves;
109
    QList<QInputContext *> slaves;
110
    QMenu *menu;
110
    QMenu *menu;
111
    QAction *separator;
111
    QAction *separator;
112
	QStringList m_keys;
112
};
113
};
113
114
114
#endif // Q_NO_IM
115
#endif // Q_NO_IM

Return to bug 398526