messagingfw/senduiservices/src/SendUiImpl.cpp
branchRCL_3
changeset 39 e5b3a2155e1a
parent 16 8147bfb6c710
equal deleted inserted replaced
38:e4175d61d967 39:e5b3a2155e1a
    54 #include "SendUiPrivateCRKeys.h"
    54 #include "SendUiPrivateCRKeys.h"
    55 #include "senduiproperty.h"
    55 #include "senduiproperty.h"
    56 #include "propertyobserver.h"
    56 #include "propertyobserver.h"
    57 #include "senduilauncher.h"
    57 #include "senduilauncher.h"
    58 #include "SendUiInternalConsts.h"
    58 #include "SendUiInternalConsts.h"
    59 #include "SendUiFileRightsEngine.h"
    59 
    60 #include "CSendUiAttachment.h"
       
    61 
    60 
    62 const TInt KArrayGranularity = 2;
    61 const TInt KArrayGranularity = 2;
    63 const TInt KSendUiServiceOrderArrayGranularity = 6;
    62 const TInt KSendUiServiceOrderArrayGranularity = 6;
    64 const TInt KTitleBufLength = 64;
    63 const TInt KTitleBufLength = 64;
    65 //Mail Tech Uid
    64 //Mail Tech Uid
   206     const CMessageData*         aMessageData,
   205     const CMessageData*         aMessageData,
   207     TSendingCapabilities        aRequiredCapabilities,
   206     TSendingCapabilities        aRequiredCapabilities,
   208     CArrayFix<TUid>*            aServicesToDim,
   207     CArrayFix<TUid>*            aServicesToDim,
   209     const TDesC&                aTitleText )
   208     const TDesC&                aTitleText )
   210     {
   209     {
   211         if(aMessageData)
   210 	//validation of attachments is costly operation and hence better be done after showing services popup.
   212         {
       
   213         TBool continueSending = ValidateAttachmentsL(aMessageData);
       
   214         if(!continueSending)
       
   215             {
       
   216                return  KNullUid;
       
   217             }
       
   218         }
       
   219     // Implemented for CR # 401-1806 >>    
   211     // Implemented for CR # 401-1806 >>    
   220     // This section to enable/disable features (supported by feature manager) at run time, is to be revised,
   212     // This section to enable/disable features (supported by feature manager) at run time, is to be revised,
   221     // once an observer class is available from feature manager side to intimate about feature state
   213     // once an observer class is available from feature manager side to intimate about feature state
   222 		
   214 		
   223     CRepository* repository = CRepository::NewLC( KCRUidSendUi );
   215     CRepository* repository = CRepository::NewLC( KCRUidSendUi );
  1372             }
  1364             }
  1373         }
  1365         }
  1374     return appendEmail;
  1366     return appendEmail;
  1375     }
  1367     }
  1376 // -----------------------------------------------------------------------------
  1368 // -----------------------------------------------------------------------------
  1377 // ValidateAttachmentsL
  1369 // AddTypedMenuItemToMenuPaneL
  1378 // Validates if all the attachments are DRM protected 
  1370 //
  1379 // -----------------------------------------------------------------------------
  1371 // No menu item is added, if services are not found. This can happen if 
  1380 //
  1372 // asyncronous sending service update is not yet finished.
  1381 TBool CSendUiImpl::ValidateAttachmentsL(const CMessageData*  aMessageData)
  1373 // To inform caller about the API result, aResult param is added.
  1382     {
  1374 // so that caller application will know that its request is not succesfully 
  1383     CArrayPtrFlat<CSendUiAttachment>* attachments = NULL;
  1375 // completed due to above reason.
  1384     TInt cleanupItems(0);
  1376 // -----------------------------------------------------------------------------
  1385     TBool okToSend = EFalse;
  1377 //
  1386     CSendUiFileRightsEngine* fileRightsEngine = CSendUiFileRightsEngine::NewLC( iCoeEnv->FsSession() );
  1378 void CSendUiImpl::AddTypedMenuItemToMenuPaneL(
  1387     cleanupItems++;
  1379     TBool&                      aResult,
  1388     // Get attachments
  1380     CSendUi::TSendUiMenuType    aMenuType,
  1389         attachments = CSendUiAttachment::InitAttachmentArrayLCC( 
  1381     CEikMenuPane&               aMenuPane,
  1390             aMessageData->AttachmentArray(), 
  1382     TInt                        aIndex,
  1391             aMessageData->AttachmentHandleArray(),
  1383     TInt                        aCommandId,
  1392             iCoeEnv->FsSession() );
  1384     TSendingCapabilities        aRequiredCapabilities)
  1393         cleanupItems += 2;
  1385     {
  1394         
  1386     TInt i(0);
  1395         if ( attachments->Count() == 0 )
  1387     TBuf<KTitleBufLength> menuItemName;
  1396 		     {
  1388     aResult=EFalse;
  1397 		     //there are no attachments, so no point in checking the file rights at all.
  1389     
  1398 		     CleanupStack::PopAndDestroy( cleanupItems );
  1390      // Read the resources
  1399 		     return ETrue;    
  1391     aMenuType == CSendUi::ESendMenu ? 
  1400 		     }  
  1392         i = R_SENDUI_MENUITEM_SEND : 
  1401     fileRightsEngine->ConfirmDrmFileRightsL( attachments );
  1393         i = R_SENDUI_MENUITEM_WRITE; // CSendUi::EWriteMenu
  1402     if ( attachments->Count() <= 0 )
  1394         
  1403         {
  1395     iCoeEnv->ReadResourceL( menuItemName, i );
  1404         fileRightsEngine->ShowDrmAndMmsInfoL();
  1396   
  1405         }
  1397     for ( i = 0; i < iSendingServices.Count(); i++ )
  1406     else
  1398     {
  1407         {
  1399     TUid serviceUid = iSendingServices[i]->ServiceId();
  1408 		// there are one or more files that can be sent, so dont shown error note now.
  1400     if ( QueryCapabilities( i, aRequiredCapabilities ) )
  1409         okToSend = ETrue;
  1401         {
  1410         }
  1402         CEikMenuPaneItem::SData data;
  1411     CleanupStack::PopAndDestroy( cleanupItems );
  1403         data.iCascadeId = NULL;
  1412     
  1404         data.iText = menuItemName;
  1413     return okToSend;
  1405         data.iCommandId = aCommandId;
       
  1406         data.iFlags = 0;
       
  1407 
       
  1408         if ( aIndex == aMenuPane.NumberOfItemsInPane() )
       
  1409             {
       
  1410             aMenuPane.AddMenuItemL( data );
       
  1411             }
       
  1412         else
       
  1413             {
       
  1414             aMenuPane.InsertMenuItemL( data, aIndex );
       
  1415             }
       
  1416             
       
  1417         aResult = ETrue;
       
  1418         break;
       
  1419         }
       
  1420     }
       
  1421     // Hide menu item if sending is already in progress.
       
  1422     if ( aResult )
       
  1423         {
       
  1424         aMenuPane.SetItemDimmed( aCommandId, iIsSending);
       
  1425         }    
  1414     }
  1426     }
  1415 // end of file
  1427 // end of file
  1416 
  1428