src/hbinput/inputwidgets/hbinputmodeindicator.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 6 c3690ec91ef8
--- a/src/hbinput/inputwidgets/hbinputmodeindicator.cpp	Mon May 03 12:48:33 2010 +0300
+++ b/src/hbinput/inputwidgets/hbinputmodeindicator.cpp	Fri May 14 16:09:54 2010 +0300
@@ -36,19 +36,19 @@
 
 class HbInputModeIndicatorPrivate
 {
-public:
-    HbInputModeIndicatorPrivate(HbTouchKeypadButton& button);
+public:   
+    HbInputModeIndicatorPrivate(HbInputButton *button);
     ~HbInputModeIndicatorPrivate();
 
     void updatePrediction();
-public:
-    HbTouchKeypadButton& mButton;
+
+public:  
+    HbInputButton *mButtonItem;
     QPointer<HbInputFocusObject> mFocusObject;
 };
 
-HbInputModeIndicatorPrivate::HbInputModeIndicatorPrivate(HbTouchKeypadButton& button)
-        : mButton(button),
-        mFocusObject(0)
+HbInputModeIndicatorPrivate::HbInputModeIndicatorPrivate(HbInputButton *button)
+ : mButtonItem(button), mFocusObject(0)
 {
     if (HbInputMethod::activeInputMethod()) {
         mFocusObject = HbInputMethod::activeInputMethod()->focusObject();
@@ -64,13 +64,20 @@
     const QString predictionOnIcon("qtg_mono_predictive_text_on");
     const QString predictionOffIcon("qtg_mono_predictive_text_off");
 
-    //Do not update the indicator if prediction is not allowed in the editor  even though
-    //prediction is active.
-    if (HbInputSettingProxy::instance()->predictiveInputStatusForActiveKeyboard() &&  mFocusObject && 
-                                     mFocusObject->editorInterface().isPredictionAllowed()) {
-        mButton.setIcon(HbIcon(predictionOnIcon));
-    } else {
-        mButton.setIcon(HbIcon(predictionOffIcon));
+    QColor color;
+    if (mButtonItem && !mButtonItem->icon(HbInputButton::ButtonIconIndexPrimary).isNull()) {
+        color = mButtonItem->icon(HbInputButton::ButtonIconIndexPrimary).color();
+    }
+    HbIcon icon;
+    if (HbInputSettingProxy::instance()->predictiveInputStatusForActiveKeyboard() &&
+        mFocusObject && mFocusObject->editorInterface().isPredictionAllowed()) {
+        icon = HbIcon(predictionOnIcon);
+     } else {
+        icon = HbIcon(predictionOffIcon);
+    }
+    icon.setColor(color);
+    if (mButtonItem) {
+        mButtonItem->setIcon(icon, HbInputButton::ButtonIconIndexPrimary);
     }
 }
 
@@ -87,18 +94,15 @@
 \sa HbEditorInterface
 */
 
-/*!
-\deprecated HbInputModeIndicator::HbInputModeIndicator(HbTouchKeypadButton&, QGraphicsWidget*)
-    is deprecated. Use (upcoming) version without HbTouchKeypadButton parameter.
-*/
-HbInputModeIndicator::HbInputModeIndicator(HbTouchKeypadButton& button, QGraphicsWidget* parent)
+HbInputModeIndicator::HbInputModeIndicator(HbInputButton *button, QGraphicsWidget *parent)
     : QObject(parent)
 {
     mPrivate = new HbInputModeIndicatorPrivate(button);
     if (mPrivate->mFocusObject) {
-        connect( &mPrivate->mFocusObject->editorInterface(), SIGNAL(modified()), this, SLOT(updateIndicator()));
+        connect (&mPrivate->mFocusObject->editorInterface(), SIGNAL(modified()), this, SLOT(updateIndicator()));
     }
-    connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)), this, SLOT(updatePredictionStatus(HbKeyboardSettingFlags, bool)));
+    connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)),
+            this, SLOT(updatePredictionStatus(HbKeyboardSettingFlags, bool)));
     updateIndicator(); // check mode of current editor
 }
 
@@ -132,17 +136,6 @@
 }
 
 /*!
-\deprecated HbInputModeIndicator::udpdatePredictionStatus(int)
-    is deprecated. Use updatePredictionStatus(bool) instead.
-
-Updates prediction status.
-*/
-void HbInputModeIndicator::udpdatePredictionStatus(int newStatus)
-{
-    Q_UNUSED(newStatus);
-}
-
-/*!
 Updates prediction status.
 */
 void HbInputModeIndicator::updatePredictionStatus(HbKeyboardSettingFlags keyboardType, bool newStatus)