diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-23 17:13:36 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-23 17:13:36 -0500 |
commit | d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5 (patch) | |
tree | baeeba639393f46abab749f4700a250091c3cc16 /tqtinterface/qt4/tools/qtconfig/mainwindow.cpp | |
parent | d7be1694839bacae31e500ea9e36b3c13257ce28 (diff) | |
download | experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.tar.gz experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.zip |
Apply all Qt3.3.8d patches
NOTE: This will *likely* break compilation of TQt4
Please wait a few days for fixes to be committed as needed!
Diffstat (limited to 'tqtinterface/qt4/tools/qtconfig/mainwindow.cpp')
-rw-r--r-- | tqtinterface/qt4/tools/qtconfig/mainwindow.cpp | 70 |
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; |