messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
    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         CleanupStack::PushL(filePath);
    93         TMsgMediaType mediaType = EMsgMediaUnknown;
       
    94         TUint32 mediaProtection = EFileProtNoProtection;
       
    95             
       
    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 
    98         CleanupStack::PushL(mmsConformance);
   101         CleanupStack::PushL(mmsConformance);
   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();
   115 
   118         mediaProtection = info->Protection();
       
   119         delete info;
       
   120         
       
   121         CleanupStack::PopAndDestroy(4));
       
   122 
       
   123         // TODO: Remove this check once Video support is provided in UniEditor.
       
   124         if (mediaType == EMsgMediaVideo)
       
   125         {
       
   126             return EInsertNotSupported;
       
   127         }
   116 
   128 
   117         // 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
   118         if (iCreationMode != EMmsCreationModeRestricted)
   130         if (iCreationMode != EMmsCreationModeRestricted)
   119         {
   131         {
   120             TInt i = EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded
   132             TInt i = EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded
   123                     | EMmsConfNokTooBig);
   135                     | EMmsConfNokTooBig);
   124 
   136 
   125             // 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
   126             if ( (iConfStatus & i) && ! (iConfStatus & j))
   138             if ( (iConfStatus & i) && ! (iConfStatus & j))
   127             {
   139             {
   128                 if (iCreationMode == EMmsCreationModeFree || info->Protection()
   140                 if (iCreationMode == EMmsCreationModeFree || 
   129                         & EFileProtSuperDistributable)
   141                         mediaProtection & EFileProtSuperDistributable)
   130                 {
   142                 {
   131                     // SuperDistribution not checked here
   143                     // SuperDistribution not checked here
   132                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
   144                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
   133                     iConfStatus &= ~EMmsConfNokFreeModeOnly;
   145                     iConfStatus &= ~EMmsConfNokFreeModeOnly;
   134                     iConfStatus &= ~EMmsConfNokScalingNeeded;
   146                     iConfStatus &= ~EMmsConfNokScalingNeeded;
   154             // Sanity check
   166             // Sanity check
   155             // "Not conformant" assumed if check fails.
   167             // "Not conformant" assumed if check fails.
   156             if(showNote)
   168             if(showNote)
   157             {
   169             {
   158                 // For protected objects.
   170                 // For protected objects.
   159                 if (EFileProtNoProtection != info->Protection())
   171                 if (EFileProtNoProtection != mediaProtection)
   160                 {
   172                 {
   161                     showPopup(INSERT_PROTECTED_ERROR);
   173                     showPopup(INSERT_PROTECTED_ERROR);
   162                 }
   174                 }
   163                 else
   175                 else
   164                 {
   176                 {
   165                     showPopup(INSERT_ERROR);
   177                     showPopup(INSERT_ERROR);
   166                 }
   178                 }
   167             }
   179             }
   168 
       
   169             return EInsertNotSupported;
   180             return EInsertNotSupported;
   170         }
   181         }        
   171         delete info;
       
   172     }
   182     }
   173     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
   183     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
   174     return EInsertSuccess;
   184     return EInsertSuccess;    
   175 }
   185 }
   176 
   186 
   177 // ---------------------------------------------------------
   187 // ---------------------------------------------------------
   178 // MmsConformanceCheck::validateMsgForForward
   188 // MmsConformanceCheck::validateMsgForForward
   179 // ---------------------------------------------------------
   189 // ---------------------------------------------------------
   265 // MmsConformanceCheck::showPopup
   275 // MmsConformanceCheck::showPopup
   266 // -----------------------------------------------------------------------------
   276 // -----------------------------------------------------------------------------
   267 //
   277 //
   268 void MmsConformanceCheck::showPopup(const QString& text)
   278 void MmsConformanceCheck::showPopup(const QString& text)
   269 {
   279 {
   270     HbNotificationDialog* dlg = new HbNotificationDialog();
   280     HbMessageBox::information(text, 0, 0, HbMessageBox::Ok);
   271     dlg->setFocusPolicy(Qt::NoFocus);
   281 }
   272     dlg->setAttribute(Qt::WA_DeleteOnClose, true);
   282 
   273     dlg->setText(text);
       
   274     dlg->show();
       
   275 }
       
   276