messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    36 #include "convergedmessageaddress.h"
    36 #include "convergedmessageaddress.h"
    37 #include "conversationsenginedefines.h"
    37 #include "conversationsenginedefines.h"
    38 #include "conversationsengine.h"
    38 #include "conversationsengine.h"
    39 #include "debugtraces.h"
    39 #include "debugtraces.h"
    40 #include "nativemessageconsts.h"
    40 #include "nativemessageconsts.h"
    41 #include "mmsconformancecheck.h"
       
    42 #include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize
       
    43 
    41 
    44 // LOCAL CONSTANTS
    42 // LOCAL CONSTANTS
    45 const QString REPLY_ICON("qtg_mono_reply");
    43 const QString REPLY_ICON("qtg_mono_reply");
    46 const QString REPLY_ALL_ICON("qtg_mono_reply_all");
    44 const QString REPLY_ALL_ICON("qtg_mono_reply_all");
    47 const QString FORWARD_ICON("qtg_mono_forward_msg");
    45 const QString FORWARD_ICON("qtg_mono_forward_msg");
    48 const QString SEND_ICON("qtg_mono_send");
    46 const QString SEND_ICON("qtg_mono_send");
    49 const QString DELETE_ICON("qtg_mono_delete");
    47 const QString DELETE_ICON("qtg_mono_delete");
    50 
    48 
    51 //LOCALIZED CONSTANTS
    49 //LOCALIZED CONSTANTS
    52 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    50 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    53 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
       
    54 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
       
    55 
    51 
    56 //----------------------------------------------------------------------------
    52 //----------------------------------------------------------------------------
    57 // UnifiedViewer::UnifiedViewer
    53 // UnifiedViewer::UnifiedViewer
    58 // constructor
    54 // constructor
    59 //----------------------------------------------------------------------------
    55 //----------------------------------------------------------------------------
    60 UnifiedViewer::UnifiedViewer(const qint32 messageId, QGraphicsItem *parent) :
    56 UnifiedViewer::UnifiedViewer(const qint32 messageId, 
    61     MsgBaseView(parent)
    57                              int canForwardMessage,
       
    58                              QGraphicsItem *parent) :
       
    59     MsgBaseView(parent), mForwardMessage(false)
    62 {
    60 {
    63     QDEBUG_WRITE("UnifiedViewer contruction start");
    61     QDEBUG_WRITE("UnifiedViewer contruction start");
    64 
    62 
    65     if (!HbStyleLoader::registerFilePath(":/layouts"))
    63     if (!HbStyleLoader::registerFilePath(":/layouts"))
    66     {
    64     {
    68     }
    66     }
    69 
    67 
    70     mMessageId = messageId;
    68     mMessageId = messageId;
    71     mViewFeeder = new UniViewerFeeder(mMessageId, this);
    69     mViewFeeder = new UniViewerFeeder(mMessageId, this);
    72 
    70 
       
    71     if (canForwardMessage > 0) mForwardMessage = true;
       
    72     
    73     mScrollArea = new UniScrollArea(this);
    73     mScrollArea = new UniScrollArea(this);
    74     this->setWidget(mScrollArea);
    74     this->setWidget(mScrollArea);
    75 
    75 
    76     mContentsWidget = new UniContentsWidget(mViewFeeder,this);
    76     mContentsWidget = new UniContentsWidget(mViewFeeder,this);
    77 
    77 
   113         toolbar->addAction(HbIcon(SEND_ICON), "");
   113         toolbar->addAction(HbIcon(SEND_ICON), "");
   114     }
   114     }
   115     else
   115     else
   116     {
   116     {
   117         toolbar->addAction(HbIcon(REPLY_ICON), "");
   117         toolbar->addAction(HbIcon(REPLY_ICON), "");
   118         toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
   118 
   119     }
   119         if (mViewFeeder->recipientCount() > 1)
   120 
   120         {
   121     if (validateMsgForForward())
   121             toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
       
   122         }
       
   123     }
       
   124 
       
   125     if (mForwardMessage)    
   122     {
   126     {
   123         toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
   127         toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
   124     }
   128     }
   125 
   129 
   126     toolbar->addAction(HbIcon(DELETE_ICON), "", this, SLOT(handleDeleteAction()));
   130     toolbar->addAction(HbIcon(DELETE_ICON), "", this, SLOT(handleDeleteAction()));
   230 // UnifiedViewer::handleDeleteAction
   234 // UnifiedViewer::handleDeleteAction
   231 // @see header file
   235 // @see header file
   232 //---------------------------------------------------------------
   236 //---------------------------------------------------------------
   233 void UnifiedViewer::handleDeleteAction()
   237 void UnifiedViewer::handleDeleteAction()
   234 {
   238 {
   235     HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogDeleteMsg(HbAction*)),
   239     HbMessageBox::question(LOC_DELETE_MESSAGE,this,
   236                                          LOC_BUTTON_DELETE, 
   240                            SLOT(onDialogDeleteMsg(HbAction*)),
   237                                          LOC_BUTTON_CANCEL);
   241                            HbMessageBox::Delete | HbMessageBox::Cancel);
   238 }
   242 }
   239 
   243 
   240 //---------------------------------------------------------------
   244 //---------------------------------------------------------------
   241 // UnifiedViewer::sendMessage
   245 // UnifiedViewer::sendMessage
   242 // @see header file
   246 // @see header file
   261     params << MsgBaseView::UNIVIEWER;
   265     params << MsgBaseView::UNIVIEWER;
   262     params << dataArray;
   266     params << dataArray;
   263 
   267 
   264     emit switchView(params);
   268     emit switchView(params);
   265     }
   269     }
   266 
       
   267 //---------------------------------------------------------------
       
   268 // UnifiedViewer::validateMsgForForward
       
   269 // @see header file
       
   270 //---------------------------------------------------------------
       
   271 bool UnifiedViewer::validateMsgForForward()
       
   272 {
       
   273     if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue)
       
   274     {
       
   275         bool retValue = false;
       
   276 
       
   277         //Validate if the mms msg can be forwarded or not
       
   278         MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck;        
       
   279         retValue = mmsConformanceCheck->validateMsgForForward(mMessageId);
       
   280 
       
   281         delete mmsConformanceCheck;        
       
   282         return retValue;
       
   283     }
       
   284 
       
   285     return true;
       
   286 }
       
   287 
   270 
   288 //---------------------------------------------------------------
   271 //---------------------------------------------------------------
   289 // UnifiedViewer::onDialogDeleteMsg
   272 // UnifiedViewer::onDialogDeleteMsg
   290 // @see header file
   273 // @see header file
   291 //---------------------------------------------------------------
   274 //---------------------------------------------------------------