messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 43 35b64624a9e7
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
    19 #include "mmsconformancecheck.h"
    19 #include "mmsconformancecheck.h"
    20 
    20 
    21 #include <MmsConformance.h>
    21 #include <MmsConformance.h>
    22 #include <centralrepository.h>
    22 #include <centralrepository.h>
    23 #include <mmsconst.h>
    23 #include <mmsconst.h>
    24 #include <msgmediainfo.h>
    24 #include <MsgMediaInfo.h>
    25 #include <fileprotectionresolver.h>
    25 #include <fileprotectionresolver.h>
    26 
    26 
    27 #include <MsgMediaResolver.h>
    27 #include <MsgMediaResolver.h>
    28 #include <DRMHelper.h>
    28 #include <DRMHelper.h>
    29 #include <MmsEngineInternalCRKeys.h>
    29 #include <MmsEngineInternalCRKeys.h>
    30 #include <hbmessagebox.h>
    30 #include <hbmessagebox.h>
    31 #include <hbnotificationdialog>
    31 #include <HbNotificationDialog>
    32 #include <hbaction.h>
    32 #include <hbaction.h>
    33 
    33 
    34 #include "unidatamodelloader.h"
    34 #include "unidatamodelloader.h"
    35 #include "unidatamodelplugininterface.h"
    35 #include "unidatamodelplugininterface.h"
    36 #include "unieditorgenutils.h" // This is needed for KDefaultMaxSize
    36 #include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize
    37 #include "s60qconversions.h"
    37 #include "s60qconversions.h"
    38 #include "debugtraces.h"
    38 #include "debugtraces.h"
    39 
    39 
    40 //DEFINES
    40 //DEFINES
    41 #define RMODE_INSERT_ERROR hbTrId("Unable to insert. Object format not supported in restricted creation mode.")
    41 #define RMODE_INSERT_ERROR hbTrId("Unable to insert. Object format not supported in restricted creation mode.")
   161     }
   161     }
   162     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
   162     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
   163     return EInsertSuccess;
   163     return EInsertSuccess;
   164 }
   164 }
   165 
   165 
   166 // ---------------------------------------------------------
       
   167 // MmsConformanceCheck::validateMsgForForward
       
   168 // ---------------------------------------------------------
       
   169 //
       
   170 bool MmsConformanceCheck::validateMsgForForward(int messageId)
       
   171 {
       
   172     UniDataModelLoader* pluginLoader = new UniDataModelLoader();
       
   173     UniDataModelPluginInterface* pluginInterface =
       
   174             pluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
       
   175     pluginInterface->setMessageId(messageId);
       
   176 
       
   177     //Check if slide count is greater than 1
       
   178     if (pluginInterface->slideCount() > 1)
       
   179     {
       
   180         delete pluginLoader;
       
   181         return false;
       
   182     }
       
   183 
       
   184     //Check if message size is inside max mms composition limits 
       
   185     if (pluginInterface->messageSize() > iMaxMmsSize)
       
   186     {
       
   187         return false;
       
   188     }
       
   189 
       
   190     //If there is restricted content then return false
       
   191     UniMessageInfoList slideContentList = pluginInterface->slideContent(0);
       
   192     bool retValue = true;
       
   193 
       
   194     for (int i = 0; i < slideContentList.size(); ++i)
       
   195     {
       
   196         if (checkModeForInsert(slideContentList.at(i)->path(), false)
       
   197                 != EInsertSuccess)
       
   198         {
       
   199             retValue = false;
       
   200             break;
       
   201         }
       
   202     }
       
   203 
       
   204     foreach(UniMessageInfo *slide,slideContentList)
       
   205         {
       
   206             delete slide;
       
   207         }
       
   208 
       
   209     if (!retValue)
       
   210     {
       
   211         delete pluginLoader;
       
   212 
       
   213         return false;
       
   214     }
       
   215 
       
   216     UniMessageInfoList modelAttachmentList = pluginInterface->attachmentList();
       
   217 
       
   218     for (int i = 0; i < modelAttachmentList.count(); ++i)
       
   219     {
       
   220         if (checkModeForInsert(modelAttachmentList.at(i)->path(), false)
       
   221                 != EInsertSuccess)
       
   222         {
       
   223             retValue = false;
       
   224             break;
       
   225         }
       
   226     }
       
   227 
       
   228     foreach(UniMessageInfo *attachment,modelAttachmentList)
       
   229         {
       
   230             delete attachment;
       
   231         }
       
   232 
       
   233     delete pluginLoader;
       
   234 
       
   235     return retValue;
       
   236 }
       
   237 
       
   238 // -----------------------------------------------------------------------------
   166 // -----------------------------------------------------------------------------
   239 // MmsConformanceCheck::onDialogInsertMedia
   167 // MmsConformanceCheck::onDialogInsertMedia
   240 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   241 //
   169 //
   242 void MmsConformanceCheck::onDialogInsertMedia(HbAction* action)
   170 void MmsConformanceCheck::onDialogInsertMedia(HbAction* action)