messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 44 36f374c67aa8
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
    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");
    55 
    53 
    56 //----------------------------------------------------------------------------
    54 //----------------------------------------------------------------------------
    57 // UnifiedViewer::UnifiedViewer
    55 // UnifiedViewer::UnifiedViewer
    58 // constructor
    56 // constructor
    59 //----------------------------------------------------------------------------
    57 //----------------------------------------------------------------------------
    60 UnifiedViewer::UnifiedViewer(const qint32 messageId, QGraphicsItem *parent) :
    58 UnifiedViewer::UnifiedViewer(const qint32 messageId, 
    61     MsgBaseView(parent)
    59                              int canForwardMessage,
       
    60                              QGraphicsItem *parent) :
       
    61     MsgBaseView(parent), mForwardMessage(false)
    62 {
    62 {
    63     QDEBUG_WRITE("UnifiedViewer contruction start");
    63     QDEBUG_WRITE("UnifiedViewer contruction start");
    64 
    64 
    65     if (!HbStyleLoader::registerFilePath(":/layouts"))
    65     if (!HbStyleLoader::registerFilePath(":/layouts"))
    66     {
    66     {
    68     }
    68     }
    69 
    69 
    70     mMessageId = messageId;
    70     mMessageId = messageId;
    71     mViewFeeder = new UniViewerFeeder(mMessageId, this);
    71     mViewFeeder = new UniViewerFeeder(mMessageId, this);
    72 
    72 
       
    73     if (canForwardMessage > 0) mForwardMessage = true;
       
    74     
    73     mScrollArea = new UniScrollArea(this);
    75     mScrollArea = new UniScrollArea(this);
    74     this->setWidget(mScrollArea);
    76     this->setWidget(mScrollArea);
    75 
    77 
    76     mContentsWidget = new UniContentsWidget(mViewFeeder,this);
    78     mContentsWidget = new UniContentsWidget(mViewFeeder,this);
    77 
    79 
   113         toolbar->addAction(HbIcon(SEND_ICON), "");
   115         toolbar->addAction(HbIcon(SEND_ICON), "");
   114     }
   116     }
   115     else
   117     else
   116     {
   118     {
   117         toolbar->addAction(HbIcon(REPLY_ICON), "");
   119         toolbar->addAction(HbIcon(REPLY_ICON), "");
   118         toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
   120 
   119     }
   121         if (mViewFeeder->recipientCount() > 1)
   120 
   122         {
   121     if (validateMsgForForward())
   123             toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
       
   124         }
       
   125     }
       
   126 
       
   127     if (mForwardMessage)    
   122     {
   128     {
   123         toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
   129         toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
   124     }
   130     }
   125 
   131 
   126     toolbar->addAction(HbIcon(DELETE_ICON), "", this, SLOT(handleDeleteAction()));
   132     toolbar->addAction(HbIcon(DELETE_ICON), "", this, SLOT(handleDeleteAction()));
   261     params << MsgBaseView::UNIVIEWER;
   267     params << MsgBaseView::UNIVIEWER;
   262     params << dataArray;
   268     params << dataArray;
   263 
   269 
   264     emit switchView(params);
   270     emit switchView(params);
   265     }
   271     }
   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 
   272 
   288 //---------------------------------------------------------------
   273 //---------------------------------------------------------------
   289 // UnifiedViewer::onDialogDeleteMsg
   274 // UnifiedViewer::onDialogDeleteMsg
   290 // @see header file
   275 // @see header file
   291 //---------------------------------------------------------------
   276 //---------------------------------------------------------------