messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
--- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp	Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp	Wed Aug 18 09:45:25 2010 +0300
@@ -90,7 +90,10 @@
     HBufC* filePath = XQConversions::qStringToS60Desc(file);
     if (filePath)
     {
-        CleanupStack::PushL(filePath);
+        TMsgMediaType mediaType = EMsgMediaUnknown;
+        TUint32 mediaProtection = EFileProtNoProtection;
+            
+        QT_TRAP_THROWING(CleanupStack::PushL(filePath);
 
         CMmsConformance* mmsConformance = CMmsConformance::NewL();
         mmsConformance->CheckCharacterSet(EFalse);
@@ -111,8 +114,17 @@
         TMmsConformance conformance = mmsConformance->MediaConformance(*info);
         iConfStatus = conformance.iConfStatus;
 
-        CleanupStack::PopAndDestroy(4);
+        mediaType = info->MediaType();
+        mediaProtection = info->Protection();
+        delete info;
+        
+        CleanupStack::PopAndDestroy(4));
 
+        // TODO: Remove this check once Video support is provided in UniEditor.
+        if (mediaType == EMsgMediaVideo)
+        {
+            return EInsertNotSupported;
+        }
 
         // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
         if (iCreationMode != EMmsCreationModeRestricted)
@@ -125,8 +137,8 @@
             // If user answers yes to Guided mode confirmation query he/she moves to free mode
             if ( (iConfStatus & i) && ! (iConfStatus & j))
             {
-                if (iCreationMode == EMmsCreationModeFree || info->Protection()
-                        & EFileProtSuperDistributable)
+                if (iCreationMode == EMmsCreationModeFree || 
+                        mediaProtection & EFileProtSuperDistributable)
                 {
                     // SuperDistribution not checked here
                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
@@ -156,7 +168,7 @@
             if(showNote)
             {
                 // For protected objects.
-                if (EFileProtNoProtection != info->Protection())
+                if (EFileProtNoProtection != mediaProtection)
                 {
                     showPopup(INSERT_PROTECTED_ERROR);
                 }
@@ -165,13 +177,11 @@
                     showPopup(INSERT_ERROR);
                 }
             }
-
             return EInsertNotSupported;
-        }
-        delete info;
+        }        
     }
     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
-    return EInsertSuccess;
+    return EInsertSuccess;    
 }
 
 // ---------------------------------------------------------
@@ -267,10 +277,6 @@
 //
 void MmsConformanceCheck::showPopup(const QString& text)
 {
-    HbNotificationDialog* dlg = new HbNotificationDialog();
-    dlg->setFocusPolicy(Qt::NoFocus);
-    dlg->setAttribute(Qt::WA_DeleteOnClose, true);
-    dlg->setText(text);
-    dlg->show();
+    HbMessageBox::information(text, 0, 0, HbMessageBox::Ok);
 }