messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
    27 #include <MsgMediaResolver.h>
    27 #include <MsgMediaResolver.h>
    28 #include <DRMHelper.h>
    28 #include <DRMHelper.h>
    29 #include <MmsEngineInternalCRKeys.h>
    29 #include <MmsEngineInternalCRKeys.h>
    30 #include <hbmessagebox.h>
    30 #include <hbmessagebox.h>
    31 #include <hbnotificationdialog>
    31 #include <hbnotificationdialog>
       
    32 #include <hbaction.h>
    32 
    33 
    33 #include "unidatamodelloader.h"
    34 #include "unidatamodelloader.h"
    34 #include "unidatamodelplugininterface.h"
    35 #include "unidatamodelplugininterface.h"
    35 #include "unieditorgenutils.h" // This is needed for KDefaultMaxSize
    36 #include "unieditorgenutils.h" // This is needed for KDefaultMaxSize
    36 #include "s60qconversions.h"
    37 #include "s60qconversions.h"
   105 
   106 
   106         CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(fileHandle);
   107         CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(fileHandle);
   107         mediaResolver->ParseInfoDetailsL(info,fileHandle);
   108         mediaResolver->ParseInfoDetailsL(info,fileHandle);
   108         
   109         
   109         TMmsConformance conformance = mmsConformance->MediaConformance(*info);
   110         TMmsConformance conformance = mmsConformance->MediaConformance(*info);
   110         TUint32 confStatus = conformance.iConfStatus;
   111         iConfStatus = conformance.iConfStatus;
   111 
   112 
   112         CleanupStack::PopAndDestroy(4);
   113         CleanupStack::PopAndDestroy(4);
   113 
   114 
   114         
   115         
   115         // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
   116         // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
   119                     | EMmsConfNokTooBig;
   120                     | EMmsConfNokTooBig;
   120             TInt j = ~ (EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded
   121             TInt j = ~ (EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded
   121                     | EMmsConfNokTooBig);
   122                     | EMmsConfNokTooBig);
   122 
   123 
   123             // If user answers yes to Guided mode confirmation query he/she moves to free mode
   124             // If user answers yes to Guided mode confirmation query he/she moves to free mode
   124             if ( (confStatus & i) && ! (confStatus & j))
   125             if ( (iConfStatus & i) && ! (iConfStatus & j))
   125             {
   126             {
   126                 if (iCreationMode == EMmsCreationModeFree || info->Protection()
   127                 if (iCreationMode == EMmsCreationModeFree || info->Protection()
   127                         & EFileProtSuperDistributable)
   128                         & EFileProtSuperDistributable)
   128                 {
   129                 {
   129                     // SuperDistribution not checked here
   130                     // SuperDistribution not checked here
   130                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
   131                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
   131                     confStatus &= ~EMmsConfNokFreeModeOnly;
   132                     iConfStatus &= ~EMmsConfNokFreeModeOnly;
   132                     confStatus &= ~EMmsConfNokScalingNeeded;
   133                     iConfStatus &= ~EMmsConfNokScalingNeeded;
   133                 }
   134                 }
   134                 else if (showNote && launchEditorQuery())
   135                 else if (showNote)
   135                 {
   136                 {
   136                     // Query accepted.
   137                     HbMessageBox::question(INSERT_QUERY_CONFRM, this, SLOT(onDialogInsertMedia(HbAction*)));
   137                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
       
   138                     confStatus &= ~EMmsConfNokFreeModeOnly;
       
   139                     confStatus &= ~EMmsConfNokScalingNeeded;
       
   140                 }
   138                 }
   141                 else
   139                 else
   142                 {
   140                 {
   143                     //query not accepted. Stop insertion.
   141                     //query not accepted. Stop insertion.
   144                     return EInsertQueryAbort;
   142                     return EInsertQueryAbort;
   145                 }
   143                 }
   146             }
   144             }
   147         }
   145         }
   148         else if (confStatus & EMmsConfNokDRM || confStatus
   146         else if (iConfStatus & EMmsConfNokDRM || iConfStatus
   149                 & EMmsConfNokNotEnoughInfo || confStatus
   147                 & EMmsConfNokNotEnoughInfo || iConfStatus
   150                 & EMmsConfNokNotSupported || confStatus
   148                 & EMmsConfNokNotSupported || iConfStatus
   151                 & EMmsConfNokFreeModeOnly || confStatus & EMmsConfNokCorrupt)
   149                 & EMmsConfNokFreeModeOnly || iConfStatus & EMmsConfNokCorrupt)
   152         {
   150         {
   153             // Sanity check
   151             // Sanity check
   154             // "Not conformant" assumed if check fails.
   152             // "Not conformant" assumed if check fails.
   155             if(showNote)
   153             if(showNote)
   156             {
   154             {
   235     delete pluginLoader;
   233     delete pluginLoader;
   236 
   234 
   237     return retValue;
   235     return retValue;
   238 }
   236 }
   239 
   237 
   240 // ---------------------------------------------------------
   238 // -----------------------------------------------------------------------------
   241 // MmsConformanceCheck::launchEditorQuery
   239 // MmsConformanceCheck::onDialogInsertMedia
   242 // ---------------------------------------------------------
   240 // -----------------------------------------------------------------------------
   243 //
   241 //
   244 bool MmsConformanceCheck::launchEditorQuery()
   242 void MmsConformanceCheck::onDialogInsertMedia(HbAction* action)
   245 {
   243 {
   246     return HbMessageBox::question(INSERT_QUERY_CONFRM);
   244     HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
       
   245     if (action == dlg->actions().at(0)) {
       
   246         // Query accepted.
       
   247         // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
       
   248         iConfStatus &= ~EMmsConfNokFreeModeOnly;
       
   249         iConfStatus &= ~EMmsConfNokScalingNeeded;
       
   250     }
       
   251 
   247 }
   252 }
   248 
   253 
   249 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   250 // MmsConformanceCheck::showPopup
   255 // MmsConformanceCheck::showPopup
   251 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------