src/hbcore/inputfw/hbinpututils.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 34 ed14f46c0e55
--- a/src/hbcore/inputfw/hbinpututils.cpp	Fri Jun 11 13:58:22 2010 +0300
+++ b/src/hbcore/inputfw/hbinpututils.cpp	Wed Jun 23 18:33:25 2010 +0300
@@ -22,6 +22,8 @@
 ** Nokia at developer.feedback@nokia.com.
 **
 ****************************************************************************/
+#include "hbinpututils.h"
+
 #include <QObject>
 #include <QLocale>
 #include <QDir>
@@ -40,7 +42,6 @@
 #include "hbinputlanguagedatabase.h"
 #include "hbinputmodecache_p.h"
 #include "hbinputlanguage.h"
-#include "hbinpututils.h"
 
 #define HB_DIGIT_ARABIC_INDIC_START_VALUE   0x0660
 #define HB_DIGIT_EASTERN_ARABIC_START_VALUE 0x06F0
@@ -50,7 +51,7 @@
 \class HbInputUtils
 \brief A collection input related utility methods.
 
-This class contains a collection of static input related utility methods that do not 
+This class contains a collection of static input related utility methods that do not
 naturally belong to any other scope. There are convenience methods for testing
 attributes of keyboard and input mode types, instantiating plugins etc.
 
@@ -60,17 +61,13 @@
 
 /*!
 Finds the fist number character bound to key using given mapping data.
-@param keyboardType Type of the keyboard
-@param key Key code where to look for number character
-@param keymapData Pointer to keymap data where to look
-@param digitType Type of digit if not latin
 */
-QChar HbInputUtils::findFirstNumberCharacterBoundToKey(const HbMappedKey* key,
-                                                       const HbInputLanguage language,
-                                                       const HbInputDigitType digitType)
+QChar HbInputUtils::findFirstNumberCharacterBoundToKey(const HbMappedKey *key,
+        const HbInputLanguage language,
+        const HbInputDigitType digitType)
 {
     Q_UNUSED(language);
-	
+
     if (key) {
         QString chars = key->characters(HbModifierNone);
         if (digitType == HbDigitTypeLatin) {
@@ -89,14 +86,14 @@
             for (int i = 0; i < chars.length(); i++) {
                 if (chars.at(i) >= '0' && chars.at(i) <= '9') {
                     return HB_DIGIT_ARABIC_INDIC_START_VALUE +
-						(chars.at(i).unicode() - '0');
+                           (chars.at(i).unicode() - '0');
                 }
             }
         } else if (digitType == HbDigitTypeEasternArabic) {
             for (int i = 0; i < chars.length(); i++) {
                 if (chars.at(i) >= '0' && chars.at(i) <= '9') {
                     return HB_DIGIT_EASTERN_ARABIC_START_VALUE +
-						(chars.at(i).unicode() - '0');
+                           (chars.at(i).unicode() - '0');
                 }
             }
         }
@@ -110,7 +107,7 @@
 For example Chinese and Japanese modes do not have text case.
 */
 bool HbInputUtils::isCaseSensitiveMode(HbInputModeType inputMode)
-{     
+{
     if (isChineseInputMode(inputMode)) {
         return false;
     }
@@ -125,7 +122,7 @@
 
 \sa languageDatabasePluginInstance
 */
-void HbInputUtils::listAvailableLanguageDatabasePlugins(QStringList& result, const QString& subfolder)
+void HbInputUtils::listAvailableLanguageDatabasePlugins(QStringList &result, const QString &subfolder)
 {
     QString path(HbInputSettingProxy::languageDatabasePath());
     path += QDir::separator();
@@ -143,14 +140,14 @@
 /*!
 Creates an instance of given language database plugin, if valid.
 */
-HbLanguageDatabaseInterface* HbInputUtils::languageDatabasePluginInstance(const QString& pluginFileName, const QString& subfolder)
+HbLanguageDatabaseInterface *HbInputUtils::languageDatabasePluginInstance(const QString &pluginFileName, const QString &subfolder)
 {
     if (!QLibrary::isLibrary(pluginFileName)) {
         qDebug("HbInputUtils::languageDatabasePluginInstance: Not a library!");
         return NULL;
     }
 
-    HbLanguageDatabaseInterface* res = NULL;
+    HbLanguageDatabaseInterface *res = NULL;
 
     QString fullName(HbInputSettingProxy::languageDatabasePath());
     fullName += QDir::separator();
@@ -161,10 +158,10 @@
     fullName += pluginFileName;
 
     QPluginLoader loader(fullName);
-    QObject* plugin = loader.instance();
+    QObject *plugin = loader.instance();
 
     if (plugin) {
-        res = qobject_cast<HbLanguageDatabaseInterface*>(plugin);
+        res = qobject_cast<HbLanguageDatabaseInterface *>(plugin);
     } else {
         qDebug("HbInputUtils::languageDatabasePluginInstance: Unable to instantiate plugin");
     }
@@ -185,7 +182,7 @@
 It creates QGraphicsScene, adds given widget there and creates a view to the scene
 inside returned QWidget. This is utility method is mainly for internal use.
 */
-QWidget* HbInputUtils::createWrapperWidget(QGraphicsWidget* graphicsWidget)
+QWidget *HbInputUtils::createWrapperWidget(QGraphicsWidget *graphicsWidget)
 {
     QWidget *ret = 0;
 
@@ -207,10 +204,10 @@
 }
 
 /*!
-A convinience method that wraps given widget inside QGraphicsProxyWidget
+A convenience method that wraps given widget inside QGraphicsProxyWidget
 and returns it. This is utility method is mainly for internal use.
 */
-QGraphicsWidget* HbInputUtils::createGraphicsProxyWidget(QWidget* widget)
+QGraphicsWidget *HbInputUtils::createGraphicsProxyWidget(QWidget *widget)
 {
 
     QGraphicsProxyWidget *proxy = 0;
@@ -232,19 +229,19 @@
     HbInputDigitType digitType = HbDigitTypeNone;
 
     switch (language.language()) {
-        case QLocale::Arabic:
-            digitType = HbDigitTypeArabicIndic;
-            break;
-        case QLocale::Persian:
-		case QLocale::Urdu:	
-            digitType = HbDigitTypeEasternArabic;
-            break;
-        case QLocale::Hindi:
-			digitType = HbDigitTypeDevanagari;
-			break;
-        default:
-            digitType = HbDigitTypeLatin;
-			break;		
+    case QLocale::Arabic:
+        digitType = HbDigitTypeArabicIndic;
+        break;
+    case QLocale::Persian:
+    case QLocale::Urdu:
+        digitType = HbDigitTypeEasternArabic;
+        break;
+    case QLocale::Hindi:
+        digitType = HbDigitTypeDevanagari;
+        break;
+    default:
+        digitType = HbDigitTypeLatin;
+        break;
     }
     return digitType;
 }
@@ -255,7 +252,7 @@
 if widget does not have the proxy widget then it returns the proxy widget of its window.
  otherwise returns 0.
 */
-QGraphicsProxyWidget* HbInputUtils::graphicsProxyWidget(const QWidget* w)
+QGraphicsProxyWidget *HbInputUtils::graphicsProxyWidget(const QWidget *w)
 {
     QGraphicsProxyWidget *pw = w ? w->graphicsProxyWidget() : 0;
     if (w && !pw) {