messagingapp/msgui/conversationview/src/msgeditorwidget.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
child 70 a15d9966050f
--- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp	Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp	Wed Aug 18 09:45:25 2010 +0300
@@ -28,6 +28,8 @@
 #include <csmsaccount.h>
 #include <smutset.h>
 #include <hbmessagebox.h>
+#include <hbcolorscheme.h>
+#include <QColor>
 #include <QTimer>
 #include "unieditorpluginloader.h"
 #include "unieditorplugininterface.h"
@@ -39,11 +41,16 @@
 
 const QString SEND_ICON("qtg_mono_send");
 const QString BACKGROUND("qtg_fr_input_v_bg");
-const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
+const QString BACKGROUND_FRAME("qtg_fr_messaging_char_count");
+const QString CHAR_COUNTER_COLOR("qtc_messaging_char_count");
 
-const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal");
-const QString SEND_BUTTON_PRESSED("qtg_fr_input_btn_function_pressed");
-const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled");
+const QString SEND_BUTTON_NORMAL("qtg_fr_btn_green_normal");
+const QString SEND_BUTTON_PRESSED("qtg_fr_btn_green_pressed");
+const QString SEND_BUTTON_DISABLED("qtg_fr_btn_disabled");
+
+const QString SEND_BUTTON_NORMAL_COLOR("qtc_callhandling_answer_normal");
+const QString SEND_BUTTON_PRESSED_COLOR("qtc_callhandling_answer_pressed");
+const QString SEND_BUTTON_DISABLED_COLOR("qtc_button_disabled");
 
 #define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded")
 #define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here")
@@ -90,25 +97,28 @@
     HbFrameItem* backGround = new HbFrameItem(this); 
     backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); 
     mSendButton->setBackgroundItem(backGround); 
-    updateButtonBackground(SEND_BUTTON_DISABLED); 
+    updateButtonBackgroundAndColor(SEND_BUTTON_DISABLED,SEND_BUTTON_DISABLED_COLOR); 
     mSendButton->setIcon(HbIcon(SEND_ICON));
     
     mCharCounter = new HbTextItem(this);
     HbStyle::setItemName(mCharCounter, "charCounter");
     mCharCounter->setZValue(1.5);
     
+    QColor color = HbColorScheme::color(CHAR_COUNTER_COLOR);
+    mCharCounter->setTextColor(color);
+    
     mBackgroundItem = new HbFrameItem(this);
     HbStyle::setItemName(mBackgroundItem, "charCounterFrame");
 
-    mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+    mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
     mBackgroundItem->frameDrawer().setFillWholeRect(true);
     
     mBackgroundItem->frameDrawer().setFrameGraphicsName(
         BACKGROUND_FRAME);    
     
     //Create editor utils object
-    mEditorUtils = new UniEditorGenUtils();
-           
+    mEditorUtils = q_check_ptr(new UniEditorGenUtils());
+
     FOCUSITEM = mSendButton;
 
 
@@ -175,7 +185,7 @@
             {
             mSendButton->setFocusProxy(mMsgEditor);
             mSendButton->setEnabled(true);
-            updateButtonBackground(SEND_BUTTON_NORMAL);
+            updateButtonBackgroundAndColor(SEND_BUTTON_NORMAL,SEND_BUTTON_NORMAL_COLOR);
             }
         }
     else
@@ -184,7 +194,7 @@
             {
             mSendButton->setFocusProxy(0);
             mSendButton->setEnabled(false);
-            updateButtonBackground(SEND_BUTTON_DISABLED);
+            updateButtonBackgroundAndColor(SEND_BUTTON_DISABLED,SEND_BUTTON_DISABLED_COLOR);
             }
         }
     
@@ -279,16 +289,22 @@
     }
 
 //---------------------------------------------------------------
-// MsgEditor::updateButtonBackground
+// MsgEditor::updateButtonBackgroundAndColor
 // @see header
 //---------------------------------------------------------------
-void MsgEditorWidget::updateButtonBackground(const QString& bg) 
+void MsgEditorWidget::updateButtonBackgroundAndColor(const QString& bg,const QString& iconColor) 
     { 
     HbFrameItem* drawer = static_cast<HbFrameItem*>(mSendButton->backgroundItem()); 
     if(drawer) 
         { 
         drawer->frameDrawer().setFrameGraphicsName(bg);   
         } 
+    QColor color = HbColorScheme::color(iconColor);
+    
+    if(color.isValid())
+    	 {
+    	 mSendButton->icon().setColor(color);
+    	 }	    
     } 
     
 
@@ -298,7 +314,7 @@
 //---------------------------------------------------------------
 void MsgEditorWidget::onPressed()
     {
-    updateButtonBackground(SEND_BUTTON_PRESSED);
+    updateButtonBackgroundAndColor(SEND_BUTTON_PRESSED,SEND_BUTTON_PRESSED_COLOR);
     }
 
 //---------------------------------------------------------------
@@ -307,7 +323,7 @@
 //---------------------------------------------------------------
 void MsgEditorWidget::onReleased()
     {
-    updateButtonBackground(SEND_BUTTON_NORMAL);
+    updateButtonBackgroundAndColor(SEND_BUTTON_NORMAL,SEND_BUTTON_NORMAL_COLOR);
     }
 	
 //---------------------------------------------------------------
@@ -325,21 +341,21 @@
     mPluginInterface =
                         mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms);    
 
-    CSmsSettings* settings = CSmsSettings::NewLC();
-    CSmsAccount* account = CSmsAccount::NewLC();
-    account->LoadSettingsL( *settings );
+    QT_TRAP_THROWING( CSmsSettings* settings = CSmsSettings::NewLC();
+        CSmsAccount* account = CSmsAccount::NewLC();
+        account->LoadSettingsL( *settings );
 
-    if( settings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
-    {
-    mCharSupportType = TUniSendingSettings::EUniCharSupportFull;
-    }
-    else
-    {
-    mCharSupportType = TUniSendingSettings::EUniCharSupportReduced;
-    }
+        if( settings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
+        {
+            mCharSupportType = TUniSendingSettings::EUniCharSupportFull;
+        }
+        else
+        {
+            mCharSupportType = TUniSendingSettings::EUniCharSupportReduced;
+        }
 
-    CleanupStack::PopAndDestroy( account );
-    CleanupStack::PopAndDestroy( settings );                
+        CleanupStack::PopAndDestroy( account );
+        CleanupStack::PopAndDestroy( settings ));
 
     //Set the mPrevBuffer to NULL initially
     mPrevBuffer = QString();
@@ -357,6 +373,7 @@
 MsgEditor::MsgEditor(QGraphicsItem *parent)
 :HbLineEdit(parent)
     {
+     this->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
      this->setPlaceholderText(LOC_HINT_TEXT);
     }