--- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Thu Jun 17 09:57:06 2010 +0100
+++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Thu Jul 22 16:32:06 2010 +0100
@@ -21,25 +21,26 @@
#include <MmsConformance.h>
#include <centralrepository.h>
#include <mmsconst.h>
-#include <msgmediainfo.h>
+#include <MsgMediaInfo.h>
#include <fileprotectionresolver.h>
#include <MsgMediaResolver.h>
#include <DRMHelper.h>
#include <MmsEngineInternalCRKeys.h>
#include <hbmessagebox.h>
-#include <hbnotificationdialog>
+#include <HbNotificationDialog>
#include <hbaction.h>
#include "unidatamodelloader.h"
#include "unidatamodelplugininterface.h"
-#include "unieditorgenutils.h" // This is needed for KDefaultMaxSize
-#include "s60qconversions.h"
+#include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize
+#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)
{
@@ -134,7 +135,9 @@
}
else if (showNote)
{
- HbMessageBox::question(INSERT_QUERY_CONFRM, this, SLOT(onDialogInsertMedia(HbAction*)));
+ HbMessageBox::question(INSERT_QUERY_CONFRM, this,
+ SLOT(onDialogInsertMedia(HbAction*)),
+ HbMessageBox::Yes | HbMessageBox::No);
}
else
{
@@ -152,7 +155,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;
@@ -172,18 +183,19 @@
UniDataModelLoader* pluginLoader = new UniDataModelLoader();
UniDataModelPluginInterface* pluginInterface =
pluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
- pluginInterface->setMessageId(messageId);
+ int error = pluginInterface->setMessageId(messageId);
- //Check if slide count is greater than 1
- if (pluginInterface->slideCount() > 1)
+ //Check if invalid id and slide count is greater than 1
+ if ( (error != KErrNone) || pluginInterface->slideCount() > 1)
{
delete pluginLoader;
return false;
}
- //Check if message size is inside max mms composition limits
+ //Check if message size is inside max mms composition limits
if (pluginInterface->messageSize() > iMaxMmsSize)
{
+ delete pluginLoader;
return false;
}
@@ -209,7 +221,6 @@
if (!retValue)
{
delete pluginLoader;
-
return false;
}
@@ -231,7 +242,6 @@
}
delete pluginLoader;
-
return retValue;
}