diff -r 84d9eb65b26f -r 518b245aa84c messagingapp/msgui/conversationview/src/msgeditorwidget.cpp --- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Mon May 03 12:29:07 2010 +0300 +++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Fri Jun 25 15:47:40 2010 +0530 @@ -24,21 +24,21 @@ #include #include #include +#include #include #include #include #include #include "unieditorpluginloader.h" #include "unieditorplugininterface.h" -#include "unisendingsettings.h" -#include "unieditorgenutils.h" +#include "UniSendingSettings.h" +#include "UniEditorGenUtils.h" #include "debugtraces.h" // LOCAL CONSTANTS -const QString PLUGINPATH("conversationviewplugin.dll"); const QString SEND_ICON("qtg_mono_send"); -const QString BACKGROUND("qtg_fr_input_bg"); +const QString BACKGROUND("qtg_fr_input_v_bg"); const QString BACKGROUND_FRAME("qtg_fr_btn_normal"); const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal"); @@ -46,8 +46,8 @@ const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled"); #define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded") -#define LOC_DIALOG_OK hbTrId("txt_common_button_ok") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") +#define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here") + const TInt KShowCounterLimit = 10; @@ -61,14 +61,6 @@ HbWidget(parent), mMsgEditor(NULL), mSendButton(NULL),mPluginLoader(NULL) { - int baseId = style()->registerPlugin(PLUGINPATH); - - #ifdef _DEBUG_TRACES_ - qDebug() << "MsgEditorWidget BASE ID --->" << baseId; - #endif - - setPluginBaseId(baseId); - //setting background. HbFrameItem* backGround = new HbFrameItem(this); backGround->frameDrawer().setFrameGraphicsName(BACKGROUND); @@ -91,14 +83,15 @@ mMsgEditor->setMaxRows(3); // NOTE: Don't remove this line. HbStyle::setItemName(mMsgEditor, "msgEditor"); - mSendButton = new HbPushButton(this); - HbStyle::setItemName(mSendButton, "sendButton"); + mSendButton = new HbPushButton(this); + HbStyle::setItemName(mSendButton, "sendButton"); + mSendButton->setEnabled(false); + + HbFrameItem* backGround = new HbFrameItem(this); + backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); + mSendButton->setBackgroundItem(backGround); + updateButtonBackground(SEND_BUTTON_DISABLED); mSendButton->setIcon(HbIcon(SEND_ICON)); - mSendButton->setEnabled(false); - HbFrameDrawer* drawer = new HbFrameDrawer(this); - drawer->setFrameType(HbFrameDrawer::NinePieces); - mSendButton->setFrameBackground(drawer); - updateButtonBackground(SEND_BUTTON_DISABLED); mCharCounter = new HbTextItem(this); HbStyle::setItemName(mCharCounter, "charCounter"); @@ -133,7 +126,6 @@ //--------------------------------------------------------------- MsgEditorWidget::~MsgEditorWidget() { - style()->unregisterPlugin(PLUGINPATH); delete mEditorUtils; } @@ -229,7 +221,8 @@ //Check if sms segment limit has been reached bool unicode = (unicodeMode) ? true : false; int contentSize = mEditorUtils->UTF8Size(string); - int maxSmsSize = mEditorUtils->MaxSmsMsgSizeL(unicode); + int maxSmsSize = 0; + TRAP_IGNORE(maxSmsSize = mEditorUtils->MaxSmsMsgSizeL(unicode)); if(contentSize > maxSmsSize) { @@ -259,20 +252,10 @@ { mSmsCharLimitReached = false; - if(HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED, - LOC_DIALOG_OK, - LOC_BUTTON_CANCEL)) - { - //Launch UniEditor - emit smsCharLimitReached(); - return; - } - else - { - //Set the previous content - setContent(QString(mPrevBuffer)); - return; - } + HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED, + this,SLOT(onSmsCharLimitReached(HbAction*)), + HbMessageBox::Ok | HbMessageBox::Cancel); + } @@ -299,14 +282,15 @@ // MsgEditor::updateButtonBackground // @see header //--------------------------------------------------------------- -void MsgEditorWidget::updateButtonBackground(const QString& bg) - { - HbFrameDrawer* drawer = mSendButton->frameBackground(); - if(drawer) - { - drawer->setFrameGraphicsName(bg); - } - } +void MsgEditorWidget::updateButtonBackground(const QString& bg) + { + HbFrameItem* drawer = static_cast(mSendButton->backgroundItem()); + if(drawer) + { + drawer->frameDrawer().setFrameGraphicsName(bg); + } + } + //--------------------------------------------------------------- // MsgEditor::onPressed @@ -327,10 +311,10 @@ } //--------------------------------------------------------------- -// MsgEditor::setEncodingSettings +// MsgEditor::setEncodingSettingsL // @see header //--------------------------------------------------------------- -void MsgEditorWidget::setEncodingSettings() +void MsgEditorWidget::setEncodingSettingsL() { if( mPluginLoader ) { @@ -373,7 +357,7 @@ MsgEditor::MsgEditor(QGraphicsItem *parent) :HbLineEdit(parent) { - + this->setPlaceholderText(LOC_HINT_TEXT); } //--------------------------------------------------------------- @@ -406,5 +390,22 @@ HbLineEdit::focusOutEvent(event); } +//--------------------------------------------------------------- +// MsgEditor::onSmsCharLimitReached +// @see header +//--------------------------------------------------------------- +void MsgEditorWidget::onSmsCharLimitReached(HbAction* action) +{ + HbMessageBox *dlg = qobject_cast (sender()); + if (action == dlg->actions().at(0)) { + + //Launch UniEditor + emit smsCharLimitReached(); + } + else { + //Set the previous content + setContent( QString(mPrevBuffer)); + } +} // EOF