summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tqtinterface/qt4/tools/qtconfig/mainwindow.cpp')
-rw-r--r--tqtinterface/qt4/tools/qtconfig/mainwindow.cpp70
1 files changed, 69 insertions, 1 deletions
diff --git a/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp b/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp
index 754f139..7aaf211 100644
--- a/tqtinterface/qt4/tools/qtconfig/mainwindow.cpp
+++ b/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;