equal
deleted
inserted
replaced
22 #include <HbPushButton> |
22 #include <HbPushButton> |
23 #include <HbTextItem> |
23 #include <HbTextItem> |
24 #include <qgraphicsscene.h> |
24 #include <qgraphicsscene.h> |
25 #include <HbFrameDrawer> |
25 #include <HbFrameDrawer> |
26 #include <HbFrameItem> |
26 #include <HbFrameItem> |
|
27 #include <HbAction> |
27 #include <csmsaccount.h> |
28 #include <csmsaccount.h> |
28 #include <smutset.h> |
29 #include <smutset.h> |
29 #include <hbmessagebox.h> |
30 #include <hbmessagebox.h> |
30 #include <QTimer> |
31 #include <QTimer> |
31 #include "unieditorpluginloader.h" |
32 #include "unieditorpluginloader.h" |
33 #include "unisendingsettings.h" |
34 #include "unisendingsettings.h" |
34 #include "unieditorgenutils.h" |
35 #include "unieditorgenutils.h" |
35 #include "debugtraces.h" |
36 #include "debugtraces.h" |
36 |
37 |
37 // LOCAL CONSTANTS |
38 // LOCAL CONSTANTS |
38 const QString PLUGINPATH("conversationviewplugin.dll"); |
|
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_bg"); |
42 const QString BACKGROUND_FRAME("qtg_fr_btn_normal"); |
42 const QString BACKGROUND_FRAME("qtg_fr_btn_normal"); |
43 |
43 |
59 //--------------------------------------------------------------- |
59 //--------------------------------------------------------------- |
60 MsgEditorWidget::MsgEditorWidget(QGraphicsItem *parent) : |
60 MsgEditorWidget::MsgEditorWidget(QGraphicsItem *parent) : |
61 HbWidget(parent), mMsgEditor(NULL), |
61 HbWidget(parent), mMsgEditor(NULL), |
62 mSendButton(NULL),mPluginLoader(NULL) |
62 mSendButton(NULL),mPluginLoader(NULL) |
63 { |
63 { |
64 int baseId = style()->registerPlugin(PLUGINPATH); |
|
65 |
|
66 #ifdef _DEBUG_TRACES_ |
|
67 qDebug() << "MsgEditorWidget BASE ID --->" << baseId; |
|
68 #endif |
|
69 |
|
70 setPluginBaseId(baseId); |
|
71 |
|
72 //setting background. |
64 //setting background. |
73 HbFrameItem* backGround = new HbFrameItem(this); |
65 HbFrameItem* backGround = new HbFrameItem(this); |
74 backGround->frameDrawer().setFrameGraphicsName(BACKGROUND); |
66 backGround->frameDrawer().setFrameGraphicsName(BACKGROUND); |
75 backGround->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
67 backGround->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
76 backGround->frameDrawer().setFillWholeRect(true); |
68 backGround->frameDrawer().setFillWholeRect(true); |
131 // MsgEditorWidget::~MsgEditorWidget |
123 // MsgEditorWidget::~MsgEditorWidget |
132 // @see header |
124 // @see header |
133 //--------------------------------------------------------------- |
125 //--------------------------------------------------------------- |
134 MsgEditorWidget::~MsgEditorWidget() |
126 MsgEditorWidget::~MsgEditorWidget() |
135 { |
127 { |
136 style()->unregisterPlugin(PLUGINPATH); |
|
137 delete mEditorUtils; |
128 delete mEditorUtils; |
138 } |
129 } |
139 |
130 |
140 //--------------------------------------------------------------- |
131 //--------------------------------------------------------------- |
141 // MsgEditorWidget::content |
132 // MsgEditorWidget::content |
227 } |
218 } |
228 |
219 |
229 //Check if sms segment limit has been reached |
220 //Check if sms segment limit has been reached |
230 bool unicode = (unicodeMode) ? true : false; |
221 bool unicode = (unicodeMode) ? true : false; |
231 int contentSize = mEditorUtils->UTF8Size(string); |
222 int contentSize = mEditorUtils->UTF8Size(string); |
232 int maxSmsSize = mEditorUtils->MaxSmsMsgSizeL(unicode); |
223 int maxSmsSize = 0; |
|
224 TRAP_IGNORE(maxSmsSize = mEditorUtils->MaxSmsMsgSizeL(unicode)); |
233 |
225 |
234 if(contentSize > maxSmsSize) |
226 if(contentSize > maxSmsSize) |
235 { |
227 { |
236 //Give breathing time for ITUT to complete its processing |
228 //Give breathing time for ITUT to complete its processing |
237 //without this there is a crash as ITUT cant complete its processing |
229 //without this there is a crash as ITUT cant complete its processing |
257 //--------------------------------------------------------------- |
249 //--------------------------------------------------------------- |
258 void MsgEditorWidget::handleSmsCharLimitReached() |
250 void MsgEditorWidget::handleSmsCharLimitReached() |
259 { |
251 { |
260 mSmsCharLimitReached = false; |
252 mSmsCharLimitReached = false; |
261 |
253 |
262 if(HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED, |
254 HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED, |
|
255 this,SLOT(onSmsCharLimitReached(HbAction*)), |
263 LOC_DIALOG_OK, |
256 LOC_DIALOG_OK, |
264 LOC_BUTTON_CANCEL)) |
257 LOC_BUTTON_CANCEL); |
265 { |
258 |
266 //Launch UniEditor |
|
267 emit smsCharLimitReached(); |
|
268 return; |
|
269 } |
|
270 else |
|
271 { |
|
272 //Set the previous content |
|
273 setContent(QString(mPrevBuffer)); |
|
274 return; |
|
275 } |
|
276 |
259 |
277 } |
260 } |
278 |
261 |
279 //--------------------------------------------------------------- |
262 //--------------------------------------------------------------- |
280 // MsgEditor::onClicked |
263 // MsgEditor::onClicked |
325 { |
308 { |
326 updateButtonBackground(SEND_BUTTON_NORMAL); |
309 updateButtonBackground(SEND_BUTTON_NORMAL); |
327 } |
310 } |
328 |
311 |
329 //--------------------------------------------------------------- |
312 //--------------------------------------------------------------- |
330 // MsgEditor::setEncodingSettings |
313 // MsgEditor::setEncodingSettingsL |
331 // @see header |
314 // @see header |
332 //--------------------------------------------------------------- |
315 //--------------------------------------------------------------- |
333 void MsgEditorWidget::setEncodingSettings() |
316 void MsgEditorWidget::setEncodingSettingsL() |
334 { |
317 { |
335 if( mPluginLoader ) |
318 if( mPluginLoader ) |
336 { |
319 { |
337 delete mPluginLoader; |
320 delete mPluginLoader; |
338 } |
321 } |
404 FOCUSITEM->setFocusProxy(0); |
387 FOCUSITEM->setFocusProxy(0); |
405 setCursorVisibility(Hb::TextCursorHidden); |
388 setCursorVisibility(Hb::TextCursorHidden); |
406 HbLineEdit::focusOutEvent(event); |
389 HbLineEdit::focusOutEvent(event); |
407 } |
390 } |
408 |
391 |
|
392 //--------------------------------------------------------------- |
|
393 // MsgEditor::onSmsCharLimitReached |
|
394 // @see header |
|
395 //--------------------------------------------------------------- |
|
396 void MsgEditorWidget::onSmsCharLimitReached(HbAction* action) |
|
397 { |
|
398 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
|
399 if (action == dlg->actions().at(0)) { |
|
400 |
|
401 //Launch UniEditor |
|
402 emit smsCharLimitReached(); |
|
403 } |
|
404 else { |
|
405 //Set the previous content |
|
406 setContent( QString(mPrevBuffer)); |
|
407 } |
|
408 } |
409 |
409 |
410 // EOF |
410 // EOF |