diff -r 36f374c67aa8 -r 12db4185673b messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Tue Jul 06 14:12:40 2010 +0300 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Wed Aug 18 09:45:25 2010 +0300 @@ -41,6 +41,9 @@ #include #include #include +#include +#include +#include // USER INCLUDES #include "msgunieditorbody.h" #include "UniEditorGenUtils.h" @@ -56,7 +59,8 @@ #include "msgunieditoraudiowidget.h" // Constants -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 int KShowCounterLimit = 10; const int BYTES_TO_KBYTES_FACTOR = 1024; @@ -67,6 +71,7 @@ #define LOC_UNABLE_TO_ATTACH_ITEM hbTrId("txt_messaging_dpopinfo_unable_to_attach_item_avai") #define LOC_PROCESSING hbTrId("txt_messaging_formlabel_loading") #define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here") +#define LOC_ATTACHED_PHOTO_SIZE hbTrId("txt_messaging_dpopinfo_attached_photo_size_is_l1") const QString ANIMATION_ICON("qtg_anim_loading"); const QString ANIMATION_FILE(":/qtg_anim_loading.axml"); @@ -83,12 +88,8 @@ /BYTES_TO_KBYTES_FACTOR; QString displayStr = QString(LOC_UNABLE_TO_ATTACH_ITEM) .arg(availableSize); - HbNotificationDialog* dlg = new HbNotificationDialog(); - dlg->setFocusPolicy(Qt::NoFocus); - dlg->setDismissPolicy(HbPopup::TapAnywhere); - dlg->setAttribute(Qt::WA_DeleteOnClose, true); - dlg->setText(displayStr); - dlg->show(); + + HbMessageBox::information(displayStr, 0, 0, HbMessageBox::Ok); } @@ -111,6 +112,7 @@ { mTextEdit = new HbTextEdit(this); mTextEdit->setPlaceholderText(LOC_HINT_TEXT); + mTextEdit->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); HbStyle::setItemName(mTextEdit,"textEdit"); connect(mTextEdit, SIGNAL(contentsChanged()), this, SLOT(onTextChanged())); @@ -119,16 +121,17 @@ mCharCounter = new HbTextItem(this); HbStyle::setItemName(mCharCounter, "charCounter"); mCharCounter->setZValue(1.5); - mCharCounter->setText("160(1)"); - + + 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); + mBackgroundItem->frameDrawer().setFrameGraphicsName(BACKGROUND_FRAME); mPluginLoader = new UniEditorPluginLoader(this); @@ -544,11 +547,13 @@ if( mImageSize || mTextEdit->toPlainText().size() || mAudioSize || mVideoSize ) { - UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils; + + UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils); + bodysize += mImageSize + mAudioSize + mVideoSize + - uniEditorGenUtils->UTF8Size(mTextEdit->toPlainText()) + + genUtils->UTF8Size(mTextEdit->toPlainText()) + KEstimatedMimeHeaderSize + KEstimatedMmsSmilHeaderSize; - delete uniEditorGenUtils; + delete genUtils; } return bodysize; } @@ -578,7 +583,7 @@ if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize()) { mTextEdit->setPlainText(mPrevBuffer); - HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT); + HbMessageBox::information(LOC_UNABLE_TO_ADD_CONTENT, 0, 0, HbMessageBox::Ok); mTextEdit->setCursorPosition(mPrevBuffer.length()); return; } @@ -645,6 +650,10 @@ aFileName.Length() > 0) { mImageFile = XQConversions::s60DescToQString(aFileName); + + QSize modifiedSize(QImageReader(mImageFile).size()); + QString information = LOC_ATTACHED_PHOTO_SIZE.arg(modifiedSize.width()).arg(modifiedSize.height()); + HbNotificationDialog::launchDialog(information); } else { @@ -674,6 +683,7 @@ mProcessingWidget->setLayout(processingLayout); HbTextItem* processingText = new HbTextItem(LOC_PROCESSING,mProcessingWidget); + processingText->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); processingText->setAlignment(Qt::AlignCenter); processingLayout->addItem(processingText); @@ -719,6 +729,45 @@ mBackgroundItem->setVisible(false); } +// --------------------------------------------------------- +// MsgUnifiedEditorBody::enableCharCounter +// --------------------------------------------------------- +// +void MsgUnifiedEditorBody::enableCharCounter() + { + mPluginInterface->setEncodingSettings(EFalse, ESmsEncodingNone, + mCharSupportType); + + TInt numOfRemainingChars; + TInt numOfPDUs; + TBool unicodeMode; + TSmsEncoding alternativeEncodingType; + QString string = mTextEdit->toPlainText(); + mPluginInterface->getNumPDUs(string, + numOfRemainingChars, numOfPDUs, unicodeMode, + alternativeEncodingType); + + //Save the unicode value returned + mUnicode = unicodeMode; + + //Set char counter value + QString display = QString("%1(%2)").arg(numOfRemainingChars).arg( + numOfPDUs); + mCharCounter->setText(display); + + if (numOfPDUs > 1 || numOfRemainingChars <= KShowCounterLimit) + { + mCharCounter->setVisible(true); + mBackgroundItem->setVisible(true); + } + else + { + mCharCounter->setVisible(false); + mBackgroundItem->setVisible(false); + } + + } + //--------------------------------------------------------------- // MsgUnifiedEditorBody :: setFocus // @see header file