summaryrefslogtreecommitdiffstats
path: root/experimental/tqtinterface/qt4/tools/qtconfig
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/tqtinterface/qt4/tools/qtconfig')
-rw-r--r--experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp70
-rw-r--r--experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.h1
-rw-r--r--experimental/tqtinterface/qt4/tools/qtconfig/mainwindowbase.ui21
3 files changed, 90 insertions, 2 deletions
diff --git a/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp b/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp
index 754f1398b..7aaf21130 100644
--- a/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp
+++ b/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp
@@ -40,6 +40,7 @@
#include <tqapplication.h>
#include <tqcombobox.h>
#include <tqstylefactory.h>
+#include <tqinputcontextfactory.h>
#include <tqobjectlist.h>
#include <tqfontdatabase.h>
#include <tqlineedit.h>
@@ -374,13 +375,73 @@ MainWindow::MainWindow()
rtlExtensions->setChecked( settings.readBoolEntry( "/qt/useRtlExtensions", FALSE ) );
-#ifdef TQ_WS_X11
+#if defined(TQ_WS_X11)
inputStyle->setCurrentText( settings.readEntry( "/qt/XIMInputStyle", trUtf8( "On The Spot" ) ) );
#else
inputStyle->hide();
inputStyleLabel->hide();
#endif
+#if defined(TQ_WS_X11) && !defined(TQT_NO_IM_EXTENSIONS)
+ /*
+ This code makes it possible to set up default input method.
+
+ The list of identifier names of input method which can be used
+ is acquired using TQInputContextFactory::keys(). And it is
+ translated to display name and set to inputMethodCombo which
+ displays the list of input method.
+ */
+ inputMethodIdentifiers = TQInputContextFactory::keys();
+ TQStringList imDispNames;
+ {
+ // input method switcher should named with "imsw-" prefix to
+ // prevent to be listed in ordinary input method list.
+ TQStringList::Iterator imIt = inputMethodIdentifiers.begin();
+ while (imIt != inputMethodIdentifiers.end()) {
+ if ((*imIt).tqfind("imsw-") == 0)
+ imIt = inputMethodIdentifiers.remove(imIt);
+ else
+ imIt++;
+ }
+ // we should not sort the list
+ //inputMethodIdentifiers.sort();
+ for (imIt = inputMethodIdentifiers.begin();
+ imIt != inputMethodIdentifiers.end();
+ imIt++) {
+ TQString dispName = TQInputContextFactory::displayName(*imIt);
+ if (dispName.isNull() || dispName.isEmpty())
+ dispName = *imIt;
+ imDispNames << dispName;
+ }
+ }
+ //inputMethodCombo->insertStringList(inputMethodIdentifiers);
+ inputMethodCombo->insertStringList(imDispNames);
+
+ /*
+ input method set up as a default in the past is chosen.
+ If nothing is set up, default input method in the platform is chosen.
+ */
+ // default input method is XIM in X11.
+ TQString currentIM = settings.readEntry("/qt/DefaultInputMethod", "xim");
+ {
+ int index = inputMethodIdentifiers.findIndex(currentIM);
+ // set up Selected input method.
+ if (0 <= index && index < inputMethodIdentifiers.count()) {
+ inputMethodCombo->setCurrentItem(index);
+ } else {
+ // Give up. this part is executed when specified IM is not
+ // installed.
+ TQString dispName = tr("Unknown Input Method") + " (" + currentIM + ")";
+ inputMethodCombo->insertItem(dispName);
+ inputMethodCombo->setCurrentItem(inputMethodCombo->count() - 1);
+ inputMethodIdentifiers << currentIM;
+ }
+ }
+#else
+ inputMethodCombo->hide();
+ inputMethodLabel->hide();
+#endif
+
fontembeddingcheckbox->setChecked( settings.readBoolEntry("/qt/embedFonts", TRUE) );
fontpaths = settings.readListEntry("/qt/fontPath", ':');
fontpathlistbox->insertStringList(fontpaths);
@@ -457,6 +518,13 @@ void MainWindow::fileSave()
else if ( style == trUtf8( "Root" ) )
str = "Root";
settings.writeEntry( "/qt/XIMInputStyle", inputStyle->currentText() );
+
+#if !defined(TQT_NO_IM_EXTENSIONS)
+ TQString imSwitcher = settings.readEntry("/qt/DefaultInputMethodSwitcher", "imsw-multi");
+ settings.writeEntry("/qt/DefaultInputMethodSwitcher", imSwitcher);
+ int imIndex = inputMethodCombo->currentItem();
+ settings.writeEntry("/qt/DefaultInputMethod", inputMethodIdentifiers[imIndex]);
+#endif
#endif
TQStringList effects;
diff --git a/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.h b/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.h
index 6f22c0675..66acb8cd1 100644
--- a/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.h
+++ b/experimental/tqtinterface/qt4/tools/qtconfig/mainwindow.h
@@ -97,6 +97,7 @@ private:
TQPalette editPalette, previewPalette;
TQStyle *previewstyle;
TQStringList fontpaths;
+ TQStringList inputMethodIdentifiers;
bool modified;
};
diff --git a/experimental/tqtinterface/qt4/tools/qtconfig/mainwindowbase.ui b/experimental/tqtinterface/qt4/tools/qtconfig/mainwindowbase.ui
index fb56464af..fc770b06a 100644
--- a/experimental/tqtinterface/qt4/tools/qtconfig/mainwindowbase.ui
+++ b/experimental/tqtinterface/qt4/tools/qtconfig/mainwindowbase.ui
@@ -1029,6 +1029,19 @@
<number>0</number>
</property>
</widget>
+ <widget class=TQLABEL_OBJECT_NAME_STRING>
+ <property name="name">
+ <cstring>inputMethodLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Default Input Method:</string>
+ </property>
+ </widget>
+ <widget class=TQCOMBOBOX_OBJECT_NAME_STRING>
+ <property name="name">
+ <cstring>inputMethodCombo</cstring>
+ </property>
+ </widget>
<spacer>
<property name="name">
<cstring>spacer5</cstring>
@@ -1042,7 +1055,7 @@
<property name="tqsizeHint">
<size>
<width>20</width>
- <height>40</height>
+ <height>30</height>
</size>
</property>
</spacer>
@@ -1718,6 +1731,12 @@
<slot>somethingModified()</slot>
</connection>
<connection>
+ <sender>inputMethodCombo</sender>
+ <signal>activated(int)</signal>
+ <receiver>MainWindowBase</receiver>
+ <slot>somethingModified()</slot>
+ </connection>
+ <connection>
<sender>gstylecombo</sender>
<signal>activated(const TQString&amp;)</signal>
<receiver>MainWindowBase</receiver>