messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp
changeset 51 3507212d340e
parent 48 4f501b74aeb1
equal deleted inserted replaced
49:2a272ef608c4 51:3507212d340e
    88 {
    88 {
    89     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert start");
    89     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert start");
    90     HBufC* filePath = XQConversions::qStringToS60Desc(file);
    90     HBufC* filePath = XQConversions::qStringToS60Desc(file);
    91     if (filePath)
    91     if (filePath)
    92     {
    92     {
       
    93         TMsgMediaType mediaType = EMsgMediaUnknown;
       
    94         TUint32 mediaProtection = EFileProtNoProtection;
       
    95             
    93         QT_TRAP_THROWING(CleanupStack::PushL(filePath);
    96         QT_TRAP_THROWING(CleanupStack::PushL(filePath);
    94 
    97 
    95         CMmsConformance* mmsConformance = CMmsConformance::NewL();
    98         CMmsConformance* mmsConformance = CMmsConformance::NewL();
    96         mmsConformance->CheckCharacterSet(EFalse);
    99         mmsConformance->CheckCharacterSet(EFalse);
    97 
   100 
   109         mediaResolver->ParseInfoDetailsL(info,fileHandle);
   112         mediaResolver->ParseInfoDetailsL(info,fileHandle);
   110 
   113 
   111         TMmsConformance conformance = mmsConformance->MediaConformance(*info);
   114         TMmsConformance conformance = mmsConformance->MediaConformance(*info);
   112         iConfStatus = conformance.iConfStatus;
   115         iConfStatus = conformance.iConfStatus;
   113 
   116 
   114         CleanupStack::PopAndDestroy(4);
   117         mediaType = info->MediaType();
       
   118         mediaProtection = info->Protection();
       
   119         delete info;
       
   120         
       
   121         CleanupStack::PopAndDestroy(4));
   115 
   122 
   116         // TODO: Remove this check once Video support is provided in UniEditor.
   123         // TODO: Remove this check once Video support is provided in UniEditor.
   117         if (info->MediaType() == EMsgMediaVideo)
   124         if (mediaType == EMsgMediaVideo)
   118         {
   125         {
   119             return EInsertNotSupported;
   126             return EInsertNotSupported;
   120         }
   127         }
   121 
   128 
   122         // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
   129         // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
   128                     | EMmsConfNokTooBig);
   135                     | EMmsConfNokTooBig);
   129 
   136 
   130             // If user answers yes to Guided mode confirmation query he/she moves to free mode
   137             // If user answers yes to Guided mode confirmation query he/she moves to free mode
   131             if ( (iConfStatus & i) && ! (iConfStatus & j))
   138             if ( (iConfStatus & i) && ! (iConfStatus & j))
   132             {
   139             {
   133                 if (iCreationMode == EMmsCreationModeFree || info->Protection()
   140                 if (iCreationMode == EMmsCreationModeFree || 
   134                         & EFileProtSuperDistributable)
   141                         mediaProtection & EFileProtSuperDistributable)
   135                 {
   142                 {
   136                     // SuperDistribution not checked here
   143                     // SuperDistribution not checked here
   137                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
   144                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
   138                     iConfStatus &= ~EMmsConfNokFreeModeOnly;
   145                     iConfStatus &= ~EMmsConfNokFreeModeOnly;
   139                     iConfStatus &= ~EMmsConfNokScalingNeeded;
   146                     iConfStatus &= ~EMmsConfNokScalingNeeded;
   159             // Sanity check
   166             // Sanity check
   160             // "Not conformant" assumed if check fails.
   167             // "Not conformant" assumed if check fails.
   161             if(showNote)
   168             if(showNote)
   162             {
   169             {
   163                 // For protected objects.
   170                 // For protected objects.
   164                 if (EFileProtNoProtection != info->Protection())
   171                 if (EFileProtNoProtection != mediaProtection)
   165                 {
   172                 {
   166                     showPopup(INSERT_PROTECTED_ERROR);
   173                     showPopup(INSERT_PROTECTED_ERROR);
   167                 }
   174                 }
   168                 else
   175                 else
   169                 {
   176                 {
   170                     showPopup(INSERT_ERROR);
   177                     showPopup(INSERT_ERROR);
   171                 }
   178                 }
   172             }
   179             }
   173 
       
   174             return EInsertNotSupported;
   180             return EInsertNotSupported;
   175         }
   181         }        
   176         delete info);
       
   177     }
   182     }
   178     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
   183     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
   179     return EInsertSuccess;
   184     return EInsertSuccess;    
   180 }
   185 }
   181 
   186 
   182 // ---------------------------------------------------------
   187 // ---------------------------------------------------------
   183 // MmsConformanceCheck::validateMsgForForward
   188 // MmsConformanceCheck::validateMsgForForward
   184 // ---------------------------------------------------------
   189 // ---------------------------------------------------------