messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    21 #include <HbNotificationDialog>
    21 #include <HbNotificationDialog>
    22 
    22 
    23 // USER INCLUDES
    23 // USER INCLUDES
    24 #include "msgunieditorsubject.h"
    24 #include "msgunieditorsubject.h"
    25 #include "UniEditorGenUtils.h"
    25 #include "UniEditorGenUtils.h"
    26 #include "msgunifiededitorlineedit.h"
    26 #include "msgunieditorlineedit.h"
    27 #include "msgmonitor.h"
    27 #include "msgunieditormonitor.h"
    28 
    28 
    29 // Localized Constants
    29 // Localized Constants
    30 #define LOC_SUBJECT hbTrId("txt_messaging_formlabel_subject")
    30 #define LOC_SUBJECT hbTrId("txt_messaging_formlabel_subject")
    31 #define LOC_UNABLE_TO_ADD_CONTENT hbTrId("txt_messaging_dpopinfo_unable_to_add_more_content")
    31 #define LOC_UNABLE_TO_ADD_CONTENT hbTrId("txt_messaging_dpopinfo_unable_to_add_more_content")
    32 
    32 
   113 
   113 
   114 void MsgUnifiedEditorSubject::onContentsChanged(const QString& text)
   114 void MsgUnifiedEditorSubject::onContentsChanged(const QString& text)
   115 {
   115 {
   116     // reject any text input if mms size limit is reached
   116     // reject any text input if mms size limit is reached
   117     int futureSize = subjectSize() +
   117     int futureSize = subjectSize() +
   118             MsgMonitor::containerSize() + MsgMonitor::bodySize();
   118             MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::bodySize();
   119     if(futureSize > MsgMonitor::maxMmsSize())
   119     if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize())
   120     {
   120     {
   121         // atomic operation
   121         // atomic operation
   122         disconnect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
   122         disconnect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
   123                     this, SLOT(onContentsChanged(const QString&)));
   123                     this, SLOT(onContentsChanged(const QString&)));
   124         mSubjectEdit->clearContent();
   124         mSubjectEdit->clearContent();
   149     return mGenUtils->UTF8Size(mSubjectEdit->content());
   149     return mGenUtils->UTF8Size(mSubjectEdit->content());
   150 }
   150 }
   151 
   151 
   152 void MsgUnifiedEditorSubject::setText(const QString& text)
   152 void MsgUnifiedEditorSubject::setText(const QString& text)
   153 {
   153 {
   154     mSubjectEdit->setText(text);
   154     if(!text.isEmpty())
       
   155     {
       
   156         mSubjectEdit->setText(text);
       
   157     }
   155 }
   158 }
   156 
   159 
   157 void MsgUnifiedEditorSubject::setFocus()
   160 void MsgUnifiedEditorSubject::setFocus()
   158 {
   161 {
   159     mSubjectEdit->setFocus(Qt::MouseFocusReason);
   162     mSubjectEdit->setFocus(Qt::MouseFocusReason);