39 #include <xqaiwrequest.h> |
39 #include <xqaiwrequest.h> |
40 #include <xqrequestinfo.h> |
40 #include <xqrequestinfo.h> |
41 #include <xqsharablefile.h> |
41 #include <xqsharablefile.h> |
42 #include <xqappmgr.h> |
42 #include <xqappmgr.h> |
43 #include <xqconversions.h> |
43 #include <xqconversions.h> |
|
44 #include <hbmessagebox.h> |
|
45 #include <hbcolorscheme.h> |
|
46 #include <QColor> |
44 // USER INCLUDES |
47 // USER INCLUDES |
45 #include "msgunieditorbody.h" |
48 #include "msgunieditorbody.h" |
46 #include "UniEditorGenUtils.h" |
49 #include "UniEditorGenUtils.h" |
47 #include "UniSendingSettings.h" |
50 #include "UniSendingSettings.h" |
48 #include "msgunieditormonitor.h" |
51 #include "msgunieditormonitor.h" |
54 #include "msgmediautil.h" |
57 #include "msgmediautil.h" |
55 #include "msgunieditorpixmapwidget.h" |
58 #include "msgunieditorpixmapwidget.h" |
56 #include "msgunieditoraudiowidget.h" |
59 #include "msgunieditoraudiowidget.h" |
57 |
60 |
58 // Constants |
61 // Constants |
59 const QString BACKGROUND_FRAME("qtg_fr_btn_normal"); |
62 const QString BACKGROUND_FRAME("qtg_fr_messaging_char_count"); |
|
63 const QString CHAR_COUNTER_COLOR("qtc_messaging_char_count"); |
60 |
64 |
61 const int KShowCounterLimit = 10; |
65 const int KShowCounterLimit = 10; |
62 const int BYTES_TO_KBYTES_FACTOR = 1024; |
66 const int BYTES_TO_KBYTES_FACTOR = 1024; |
63 |
67 |
64 //Localized Constants for item specific menu |
68 //Localized Constants for item specific menu |
81 int availableSize = |
85 int availableSize = |
82 (MsgUnifiedEditorMonitor::maxMmsSize() - MsgUnifiedEditorMonitor::messageSize()) |
86 (MsgUnifiedEditorMonitor::maxMmsSize() - MsgUnifiedEditorMonitor::messageSize()) |
83 /BYTES_TO_KBYTES_FACTOR; |
87 /BYTES_TO_KBYTES_FACTOR; |
84 QString displayStr = QString(LOC_UNABLE_TO_ATTACH_ITEM) |
88 QString displayStr = QString(LOC_UNABLE_TO_ATTACH_ITEM) |
85 .arg(availableSize); |
89 .arg(availableSize); |
86 HbNotificationDialog* dlg = new HbNotificationDialog(); |
90 |
87 dlg->setFocusPolicy(Qt::NoFocus); |
91 HbMessageBox::information(displayStr, 0, 0, HbMessageBox::Ok); |
88 dlg->setDismissPolicy(HbPopup::TapAnywhere); |
|
89 dlg->setAttribute(Qt::WA_DeleteOnClose, true); |
|
90 dlg->setText(displayStr); |
|
91 dlg->show(); |
|
92 } |
92 } |
93 |
93 |
94 |
94 |
95 MsgUnifiedEditorBody::MsgUnifiedEditorBody( QGraphicsItem *parent ) : |
95 MsgUnifiedEditorBody::MsgUnifiedEditorBody( QGraphicsItem *parent ) : |
96 MsgUnifiedEditorBaseWidget(parent), |
96 MsgUnifiedEditorBaseWidget(parent), |
117 mMmsConformanceCheck = new MmsConformanceCheck; |
117 mMmsConformanceCheck = new MmsConformanceCheck; |
118 |
118 |
119 mCharCounter = new HbTextItem(this); |
119 mCharCounter = new HbTextItem(this); |
120 HbStyle::setItemName(mCharCounter, "charCounter"); |
120 HbStyle::setItemName(mCharCounter, "charCounter"); |
121 mCharCounter->setZValue(1.5); |
121 mCharCounter->setZValue(1.5); |
122 mCharCounter->setText("160(1)"); |
122 |
123 |
123 QColor color = HbColorScheme::color(CHAR_COUNTER_COLOR); |
|
124 mCharCounter->setTextColor(color); |
|
125 |
124 mBackgroundItem = new HbFrameItem(this); |
126 mBackgroundItem = new HbFrameItem(this); |
125 HbStyle::setItemName(mBackgroundItem, "charCounterFrame"); |
127 HbStyle::setItemName(mBackgroundItem, "charCounterFrame"); |
126 |
128 |
127 mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
129 mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
128 mBackgroundItem->frameDrawer().setFillWholeRect(true); |
130 mBackgroundItem->frameDrawer().setFillWholeRect(true); |
129 |
131 |
130 mBackgroundItem->frameDrawer().setFrameGraphicsName( |
132 mBackgroundItem->frameDrawer().setFrameGraphicsName(BACKGROUND_FRAME); |
131 BACKGROUND_FRAME); |
|
132 |
133 |
133 mPluginLoader = new UniEditorPluginLoader(this); |
134 mPluginLoader = new UniEditorPluginLoader(this); |
134 |
135 |
135 mPluginInterface = |
136 mPluginInterface = |
136 mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms); |
137 mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms); |
576 int futureSize = bodySize() + |
577 int futureSize = bodySize() + |
577 MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::subjectSize(); |
578 MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::subjectSize(); |
578 if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize()) |
579 if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize()) |
579 { |
580 { |
580 mTextEdit->setPlainText(mPrevBuffer); |
581 mTextEdit->setPlainText(mPrevBuffer); |
581 HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT); |
582 HbMessageBox::information(LOC_UNABLE_TO_ADD_CONTENT, 0, 0, HbMessageBox::Ok); |
582 mTextEdit->setCursorPosition(mPrevBuffer.length()); |
583 mTextEdit->setCursorPosition(mPrevBuffer.length()); |
583 return; |
584 return; |
584 } |
585 } |
585 else if(!mPrevBuffer.isEmpty()) |
586 else if(!mPrevBuffer.isEmpty()) |
586 { |
587 { |
717 { |
718 { |
718 mCharCounter->setVisible(false); |
719 mCharCounter->setVisible(false); |
719 mBackgroundItem->setVisible(false); |
720 mBackgroundItem->setVisible(false); |
720 } |
721 } |
721 |
722 |
|
723 // --------------------------------------------------------- |
|
724 // MsgUnifiedEditorBody::enableCharCounter |
|
725 // --------------------------------------------------------- |
|
726 // |
|
727 void MsgUnifiedEditorBody::enableCharCounter() |
|
728 { |
|
729 mPluginInterface->setEncodingSettings(EFalse, ESmsEncodingNone, |
|
730 mCharSupportType); |
|
731 |
|
732 TInt numOfRemainingChars; |
|
733 TInt numOfPDUs; |
|
734 TBool unicodeMode; |
|
735 TSmsEncoding alternativeEncodingType; |
|
736 QString string = mTextEdit->toPlainText(); |
|
737 mPluginInterface->getNumPDUs(string, |
|
738 numOfRemainingChars, numOfPDUs, unicodeMode, |
|
739 alternativeEncodingType); |
|
740 |
|
741 //Save the unicode value returned |
|
742 mUnicode = unicodeMode; |
|
743 |
|
744 //Set char counter value |
|
745 QString display = QString("%1(%2)").arg(numOfRemainingChars).arg( |
|
746 numOfPDUs); |
|
747 mCharCounter->setText(display); |
|
748 |
|
749 if (numOfPDUs > 1 || numOfRemainingChars <= KShowCounterLimit) |
|
750 { |
|
751 mCharCounter->setVisible(true); |
|
752 mBackgroundItem->setVisible(true); |
|
753 } |
|
754 else |
|
755 { |
|
756 mCharCounter->setVisible(false); |
|
757 mBackgroundItem->setVisible(false); |
|
758 } |
|
759 |
|
760 } |
|
761 |
722 //--------------------------------------------------------------- |
762 //--------------------------------------------------------------- |
723 // MsgUnifiedEditorBody :: setFocus |
763 // MsgUnifiedEditorBody :: setFocus |
724 // @see header file |
764 // @see header file |
725 //--------------------------------------------------------------- |
765 //--------------------------------------------------------------- |
726 void MsgUnifiedEditorBody::setFocus() |
766 void MsgUnifiedEditorBody::setFocus() |