src/hbinput/inputwidgets/hbinputcommondialogs.cpp
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 6 c3690ec91ef8
child 28 b7da29130b0e
child 34 ed14f46c0e55
--- a/src/hbinput/inputwidgets/hbinputcommondialogs.cpp	Thu Jul 15 14:03:49 2010 +0100
+++ b/src/hbinput/inputwidgets/hbinputcommondialogs.cpp	Thu Jul 22 16:36:53 2010 +0100
@@ -22,6 +22,8 @@
 ** Nokia at developer.feedback@nokia.com.
 **
 ****************************************************************************/
+#include "hbinputcommondialogs.h"
+
 #include <QDir>
 #include <QtAlgorithms>
 
@@ -31,8 +33,7 @@
 #include <hbinpututils.h>
 #include <hbinputsettingproxy.h>
 #include <hbinputmethod.h>
-
-#include "hbinputcommondialogs.h"
+#include <hbinputregioncollector_p.h>
 
 /// @cond
 
@@ -51,35 +52,33 @@
 */
 HbInputLanguage HbInputCommonDialogs::showLanguageSelectionDialog(QLocale::Language selectedLanguage, const QList<HbInputLanguage> languageList)
 {
-    HbSelectionDialog* langDialog = new HbSelectionDialog();
+    HbSelectionDialog *langDialog = new HbSelectionDialog();
     langDialog->setObjectName("Language dialog");
 
-#if QT_VERSION >= 0x040600
     // Make sure the language dialog never steals focus.
     langDialog->setFlag(QGraphicsItem::ItemIsPanel, true);
     langDialog->setActive(false);
-#endif
 
-    HbInputSettingProxy* settings = HbInputSettingProxy::instance();
+    HbInputSettingProxy *settings = HbInputSettingProxy::instance();
     HbInputLanguage currentLang = settings->globalInputLanguage();
     QList<HbInputLanguage> languages;
     if (languageList.count() == 0) {
         HbInputUtils::listSupportedInputLanguages(languages);
     } else {
-        languages=languageList;
+        languages = languageList;
     }
-	
-	qStableSort(languages.begin(), languages.end(), caseInsensitiveLessThanForHbInputLanguage);
-    QList<HbListWidgetItem*> listItems;
-    HbListWidgetItem* item = 0;
-    foreach( HbInputLanguage language, languages ) {
-                QString langName = language.localisedName();
+
+    qStableSort(languages.begin(), languages.end(), caseInsensitiveLessThanForHbInputLanguage);
+    QList<HbListWidgetItem *> listItems;
+    HbListWidgetItem *item = 0;
+    foreach(HbInputLanguage language, languages) {
+        QString langName = language.localisedName();
         if (langName.length() == 0) {
             langName = QString("Unknown");
         }
         item = new HbListWidgetItem();
         item->setText(langName);
-        if (language == currentLang ) {
+        if (language == currentLang) {
             QList<QVariant> selected;
             selected.append(listItems.count());
             langDialog->setSelectedItems(selected);
@@ -97,12 +96,13 @@
     langDialog->setDismissPolicy(HbPopup::NoDismiss);
     langDialog->setModal(true);
     //langDialog->exec(); TODO
+    HbInputRegionCollector::instance()->attach(langDialog);
     //TODO: needed to check from action which button was pressed (ok, cancel)
     //HbAction* action = langDialog->exec();
     if (langDialog->selectedItems().count()) {
         int selection = langDialog->selectedItems().at(0).toInt();
         HbInputLanguage result;
-        if(languages.at(selection).language() == QLocale::Chinese) {
+        if (languages.at(selection).language() == QLocale::Chinese) {
             result = languages.at(selection);
         } else {
             result = languages.at(selection).language();
@@ -122,26 +122,24 @@
 {
     Q_UNUSED(language);
 
-    HbSelectionDialog* methodDialog = new HbSelectionDialog();
+    HbSelectionDialog *methodDialog = new HbSelectionDialog();
     methodDialog->setObjectName("Input method dialog");
 
-#if QT_VERSION >= 0x040600
     // Make sure the language dialog never steals focus.
     methodDialog->setFlag(QGraphicsItem::ItemIsPanel, true);
     methodDialog->setActive(false);
-#endif
 
     QList<HbInputMethodDescriptor> customList = HbInputMethod::listCustomInputMethods();
 
-    QList<HbListWidgetItem*> listItems;
-    HbListWidgetItem* item = new HbListWidgetItem();
+    QList<HbListWidgetItem *> listItems;
+    HbListWidgetItem *item = new HbListWidgetItem();
     QString methodName("Default");
     item->setText(methodName);
     listItems.append(item);
 
     //for (int i=0; i<customList.dllName.count() ; i++) {
-    foreach (HbInputMethodDescriptor descriptor, customList) {
-    QString displayName = descriptor.displayName();
+    foreach(const HbInputMethodDescriptor &descriptor, customList) {
+        QString displayName = descriptor.displayName();
         if (displayName.length() == 0) {
             displayName = QString("Unknown");
         }
@@ -154,6 +152,7 @@
     methodDialog->setDismissPolicy(HbPopup::NoDismiss);
     methodDialog->setModal(true);
     //methodDialog->exec(); TODO
+    HbInputRegionCollector::instance()->attach(methodDialog);
     //TODO: needed to check from action which button was pressed (ok, cancel)
     //HbAction* action = langDialog->exec();
 
@@ -161,9 +160,9 @@
     if (methodDialog->selectedItems().count()) {
         int selection = methodDialog->selectedItems().first().toInt();
         if (selection == 0) {
-           result.setDefault();
+            result.setDefault();
         } else {
-           result = customList[selection-1];
+            result = customList[selection-1];
         }
     }