messagingapp/msgui/conversationview/src/msgeditorwidget.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    29 #include <smutset.h>
    29 #include <smutset.h>
    30 #include <hbmessagebox.h>
    30 #include <hbmessagebox.h>
    31 #include <QTimer>
    31 #include <QTimer>
    32 #include "unieditorpluginloader.h"
    32 #include "unieditorpluginloader.h"
    33 #include "unieditorplugininterface.h"
    33 #include "unieditorplugininterface.h"
    34 #include "unisendingsettings.h"
    34 #include "UniSendingSettings.h"
    35 #include "unieditorgenutils.h"
    35 #include "UniEditorGenUtils.h"
    36 #include "debugtraces.h"
    36 #include "debugtraces.h"
    37 
    37 
    38 // LOCAL CONSTANTS
    38 // LOCAL CONSTANTS
    39 
    39 
    40 const QString SEND_ICON("qtg_mono_send");
    40 const QString SEND_ICON("qtg_mono_send");
    41 const QString BACKGROUND("qtg_fr_input_bg");
    41 const QString BACKGROUND("qtg_fr_input_v_bg");
    42 const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
    42 const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
    43 
    43 
    44 const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal");
    44 const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal");
    45 const QString SEND_BUTTON_PRESSED("qtg_fr_input_btn_function_pressed");
    45 const QString SEND_BUTTON_PRESSED("qtg_fr_input_btn_function_pressed");
    46 const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled");
    46 const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled");
    47 
    47 
    48 #define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded")
    48 #define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded")
    49 #define LOC_DIALOG_OK hbTrId("txt_common_button_ok")
    49 #define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here")
    50 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    50 
    51   
    51   
    52 const TInt KShowCounterLimit = 10;
    52 const TInt KShowCounterLimit = 10;
    53 
    53 
    54 QGraphicsItem* FOCUSITEM = 0;
    54 QGraphicsItem* FOCUSITEM = 0;
    55 
    55 
    81     // Create mandatory element of mesh layout.
    81     // Create mandatory element of mesh layout.
    82     mMsgEditor = new MsgEditor(this);
    82     mMsgEditor = new MsgEditor(this);
    83     mMsgEditor->setMaxRows(3); // NOTE: Don't remove this line.
    83     mMsgEditor->setMaxRows(3); // NOTE: Don't remove this line.
    84     HbStyle::setItemName(mMsgEditor, "msgEditor");
    84     HbStyle::setItemName(mMsgEditor, "msgEditor");
    85 
    85 
    86     mSendButton = new HbPushButton(this);
    86 	mSendButton = new HbPushButton(this); 
    87     HbStyle::setItemName(mSendButton, "sendButton");
    87     HbStyle::setItemName(mSendButton, "sendButton"); 
       
    88     mSendButton->setEnabled(false); 
       
    89     
       
    90     HbFrameItem* backGround = new HbFrameItem(this); 
       
    91     backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); 
       
    92     mSendButton->setBackgroundItem(backGround); 
       
    93     updateButtonBackground(SEND_BUTTON_DISABLED); 
    88     mSendButton->setIcon(HbIcon(SEND_ICON));
    94     mSendButton->setIcon(HbIcon(SEND_ICON));
    89     mSendButton->setEnabled(false);
       
    90     HbFrameDrawer* drawer = new HbFrameDrawer(this);
       
    91     drawer->setFrameType(HbFrameDrawer::NinePieces);
       
    92     mSendButton->setFrameBackground(drawer);
       
    93     updateButtonBackground(SEND_BUTTON_DISABLED);
       
    94     
    95     
    95     mCharCounter = new HbTextItem(this);
    96     mCharCounter = new HbTextItem(this);
    96     HbStyle::setItemName(mCharCounter, "charCounter");
    97     HbStyle::setItemName(mCharCounter, "charCounter");
    97     mCharCounter->setZValue(1.5);
    98     mCharCounter->setZValue(1.5);
    98     
    99     
   250 void MsgEditorWidget::handleSmsCharLimitReached()
   251 void MsgEditorWidget::handleSmsCharLimitReached()
   251 {
   252 {
   252     mSmsCharLimitReached = false;
   253     mSmsCharLimitReached = false;
   253     
   254     
   254     HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED,
   255     HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED,
   255         this,SLOT(onSmsCharLimitReached(HbAction*)),
   256                            this,SLOT(onSmsCharLimitReached(HbAction*)),
   256         LOC_DIALOG_OK,
   257                            HbMessageBox::Ok | HbMessageBox::Cancel);
   257         LOC_BUTTON_CANCEL);
       
   258 
   258 
   259 
   259 
   260 }
   260 }
   261 
   261 
   262 //---------------------------------------------------------------
   262 //---------------------------------------------------------------
   280 
   280 
   281 //---------------------------------------------------------------
   281 //---------------------------------------------------------------
   282 // MsgEditor::updateButtonBackground
   282 // MsgEditor::updateButtonBackground
   283 // @see header
   283 // @see header
   284 //---------------------------------------------------------------
   284 //---------------------------------------------------------------
   285 void MsgEditorWidget::updateButtonBackground(const QString& bg)
   285 void MsgEditorWidget::updateButtonBackground(const QString& bg) 
   286     {
   286     { 
   287     HbFrameDrawer* drawer = mSendButton->frameBackground();
   287     HbFrameItem* drawer = static_cast<HbFrameItem*>(mSendButton->backgroundItem()); 
   288     if(drawer)
   288     if(drawer) 
   289         {
   289         { 
   290         drawer->setFrameGraphicsName(bg);        
   290         drawer->frameDrawer().setFrameGraphicsName(bg);   
   291         }
   291         } 
   292     }
   292     } 
       
   293     
   293 
   294 
   294 //---------------------------------------------------------------
   295 //---------------------------------------------------------------
   295 // MsgEditor::onPressed
   296 // MsgEditor::onPressed
   296 // @see header
   297 // @see header
   297 //---------------------------------------------------------------
   298 //---------------------------------------------------------------
   354 // @see header
   355 // @see header
   355 //---------------------------------------------------------------
   356 //---------------------------------------------------------------
   356 MsgEditor::MsgEditor(QGraphicsItem *parent)
   357 MsgEditor::MsgEditor(QGraphicsItem *parent)
   357 :HbLineEdit(parent)
   358 :HbLineEdit(parent)
   358     {
   359     {
   359     
   360      this->setPlaceholderText(LOC_HINT_TEXT);
   360     }
   361     }
   361 
   362 
   362 //---------------------------------------------------------------
   363 //---------------------------------------------------------------
   363 // MsgEditor::focusInEvent
   364 // MsgEditor::focusInEvent
   364 // @see header
   365 // @see header