--- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Fri Jun 11 13:35:48 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Wed Jun 23 18:09:17 2010 +0300
@@ -34,12 +34,13 @@
#include "unidatamodelloader.h"
#include "unidatamodelplugininterface.h"
#include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize
-#include "s60qconversions.h"
+#include <xqconversions.h>
#include "debugtraces.h"
//DEFINES
#define RMODE_INSERT_ERROR hbTrId("Unable to insert. Object format not supported in restricted creation mode.")
#define INSERT_ERROR hbTrId("txt_messaging_dpopinfo_unable_to_attach_item_file")
+#define INSERT_PROTECTED_ERROR hbTrId("txt_messaging_dpopinfo_unable_to_attach_protected")
#define INSERT_QUERY_CONFRM hbTrId("The receiving phone may not support this object. Continue?")
// -----------------------------------------------------------------------------
// MmsConformanceCheck::MmsConformanceCheck
@@ -49,7 +50,7 @@
{
QDEBUG_WRITE("MmsConformanceCheck::MmsConformanceCheck start");
- TRAP_IGNORE(
+ TRAP_IGNORE(
CRepository* repository = CRepository::NewL(KCRUidMmsEngine);
CleanupStack::PushL(repository);
@@ -63,7 +64,7 @@
repository->Get( KMmsEngineMaximumSendSize, maxSize );
iMaxMmsSize = maxSize;
- CleanupStack::PopAndDestroy(repository);
+ CleanupStack::PopAndDestroy(repository);
);
QDEBUG_WRITE("MmsConformanceCheck::MmsConformanceCheck end");
@@ -86,33 +87,33 @@
bool showNote)
{
QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert start");
- HBufC* filePath = S60QConversions::qStringToS60Desc(file);
+ HBufC* filePath = XQConversions::qStringToS60Desc(file);
if (filePath)
{
CleanupStack::PushL(filePath);
CMmsConformance* mmsConformance = CMmsConformance::NewL();
mmsConformance->CheckCharacterSet(EFalse);
-
+
CleanupStack::PushL(mmsConformance);
-
- CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL();
+
+ CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL();
mediaResolver->SetCharacterSetRecognition(EFalse);
-
+
CleanupStack::PushL(mediaResolver);
-
+
RFile fileHandle = mediaResolver->FileHandleL(*filePath);
CleanupClosePushL(fileHandle);
CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(fileHandle);
mediaResolver->ParseInfoDetailsL(info,fileHandle);
-
+
TMmsConformance conformance = mmsConformance->MediaConformance(*info);
iConfStatus = conformance.iConfStatus;
CleanupStack::PopAndDestroy(4);
-
+
// In "free" mode user can insert images that are larger by dimensions than allowed by conformance
if (iCreationMode != EMmsCreationModeRestricted)
{
@@ -152,7 +153,15 @@
// "Not conformant" assumed if check fails.
if(showNote)
{
- showPopup(INSERT_ERROR);
+ // For protected objects.
+ if (EFileProtNoProtection != info->Protection())
+ {
+ showPopup(INSERT_PROTECTED_ERROR);
+ }
+ else
+ {
+ showPopup(INSERT_ERROR);
+ }
}
return EInsertNotSupported;
@@ -163,6 +172,78 @@
return EInsertSuccess;
}
+// ---------------------------------------------------------
+// MmsConformanceCheck::validateMsgForForward
+// ---------------------------------------------------------
+//
+bool MmsConformanceCheck::validateMsgForForward(int messageId)
+{
+ UniDataModelLoader* pluginLoader = new UniDataModelLoader();
+ UniDataModelPluginInterface* pluginInterface =
+ pluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
+ pluginInterface->setMessageId(messageId);
+
+ //Check if slide count is greater than 1
+ if (pluginInterface->slideCount() > 1)
+ {
+ delete pluginLoader;
+ return false;
+ }
+
+ //Check if message size is inside max mms composition limits
+ if (pluginInterface->messageSize() > iMaxMmsSize)
+ {
+ return false;
+ }
+
+ //If there is restricted content then return false
+ UniMessageInfoList slideContentList = pluginInterface->slideContent(0);
+ bool retValue = true;
+
+ for (int i = 0; i < slideContentList.size(); ++i)
+ {
+ if (checkModeForInsert(slideContentList.at(i)->path(), false)
+ != EInsertSuccess)
+ {
+ retValue = false;
+ break;
+ }
+ }
+
+ foreach(UniMessageInfo *slide,slideContentList)
+ {
+ delete slide;
+ }
+
+ if (!retValue)
+ {
+ delete pluginLoader;
+
+ return false;
+ }
+
+ UniMessageInfoList modelAttachmentList = pluginInterface->attachmentList();
+
+ for (int i = 0; i < modelAttachmentList.count(); ++i)
+ {
+ if (checkModeForInsert(modelAttachmentList.at(i)->path(), false)
+ != EInsertSuccess)
+ {
+ retValue = false;
+ break;
+ }
+ }
+
+ foreach(UniMessageInfo *attachment,modelAttachmentList)
+ {
+ delete attachment;
+ }
+
+ delete pluginLoader;
+
+ return retValue;
+}
+
// -----------------------------------------------------------------------------
// MmsConformanceCheck::onDialogInsertMedia
// -----------------------------------------------------------------------------