meetingrequest/mricalviewer/src/cesmricalvieweropenmrcmd.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 0 8466d47a6819
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    21 #include "cesmricalvieweropenmrcmd.h"
    21 #include "cesmricalvieweropenmrcmd.h"
    22 #include "cesmricalviewerloadmrdatacmd.h"
    22 #include "cesmricalviewerloadmrdatacmd.h"
    23 #include "cesmricalvieweremailasynccmd.h"
    23 #include "cesmricalvieweremailasynccmd.h"
    24 #include "cesmricalvieweremailsynccmd.h"
    24 #include "cesmricalvieweremailsynccmd.h"
    25 #include "cesmruilauncher.h"
    25 #include "cesmruilauncher.h"
    26 #include "cesmrattachmentinfo.h"
    26 #include "cmrattachmentinfofetcher.h"
    27 #include "esmricalviewerutils.h"
    27 #include "esmricalviewerutils.h"
    28 
    28 
    29 //<cmail>
    29 //<cmail>
    30 #include "esmricalvieweropcodes.hrh"
    30 #include "esmricalvieweropcodes.hrh"
    31 //</cmail>
    31 //</cmail>
    58     {
    58     {
    59     FUNC_LOG;
    59     FUNC_LOG;
    60     CancelCommand();
    60     CancelCommand();
    61     delete iLoadMRDataCmd;
    61     delete iLoadMRDataCmd;
    62     delete iUILauncher;
    62     delete iUILauncher;
    63     
    63     delete iAttachmentInfoFetcher;
    64     // <cmail>
    64 
    65     if( iEmailCommand )
    65     if( iEmailCommand )
    66         {
    66         {
    67         delete iEmailCommand;
    67         delete iEmailCommand;
    68         iEmailCommand = NULL;
    68         iEmailCommand = NULL;
    69         }
    69         }
    70     // </cmail>
       
    71     }
    70     }
    72 
    71 
    73 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    74 // CESMRIcalViewerOpenMRCmd::CESMRIcalViewerOpenMRCmd
    73 // CESMRIcalViewerOpenMRCmd::CESMRIcalViewerOpenMRCmd
    75 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
   214                 ESMRIcalViewerUtils::EmailOperation(aCommandId);
   213                 ESMRIcalViewerUtils::EmailOperation(aCommandId);
   215 
   214 
   216         TBool asyncCommand(
   215         TBool asyncCommand(
   217                 ESMRIcalViewerUtils::IsAsyncEmailCommand( iCurrentCbCommand ) );
   216                 ESMRIcalViewerUtils::IsAsyncEmailCommand( iCurrentCbCommand ) );
   218 
   217 
   219 // <cmail>
       
   220         if( iEmailCommand )
   218         if( iEmailCommand )
   221             {
   219             {
   222             delete iEmailCommand;
   220             delete iEmailCommand;
   223             iEmailCommand = NULL;
   221             iEmailCommand = NULL;
   224             }
   222             }
   225 // </cmail>
       
   226 
   223 
   227         if ( asyncCommand )
   224         if ( asyncCommand )
   228             {
   225             {
   229             iEmailCommand = CESMRIcalViewerEmailAsyncCmd::NewL(
   226             iEmailCommand = CESMRIcalViewerEmailAsyncCmd::NewL(
   230                     iCurrentCbCommand,
   227                     iCurrentCbCommand,
   285             iUILauncher = NULL;
   282             iUILauncher = NULL;
   286             }
   283             }
   287     else if ( aResult.iOpType == EESMRLoadMRData )
   284     else if ( aResult.iOpType == EESMRLoadMRData )
   288         {
   285         {
   289         // MR data is loaded
   286         // MR data is loaded
       
   287         FillAttachmentInfoL();
       
   288         }
       
   289     else if( aResult.iOpType == EESMRFetchAttachmentInfo )
       
   290         {
       
   291         // Attachment information is loaded
   290         iInputParameters.iMailClient = &iMailClient;
   292         iInputParameters.iMailClient = &iMailClient;
   291         iInputParameters.iMailMessage = Message();
   293         iInputParameters.iMailMessage = Message();
   292         iInputParameters.iCommand = EESMRCmdUndefined;
   294         iInputParameters.iCommand = EESMRCmdUndefined;
   293         iInputParameters.iSpare = 0;
   295         iInputParameters.iSpare = 0;
   294         LaunchUIL();
   296         LaunchUIL();
   299 
   301 
   300         switch ( aResult.iOpType )
   302         switch ( aResult.iOpType )
   301             {
   303             {
   302             case EESMRCmdOpenAttachment://fallthrough
   304             case EESMRCmdOpenAttachment://fallthrough
   303             case EESMRCmdOpenAttachmentView://fallthrough
   305             case EESMRCmdOpenAttachmentView://fallthrough
   304 // <cmail>
       
   305             case EESMRCmdDownloadAttachment://fallthrough
   306             case EESMRCmdDownloadAttachment://fallthrough
   306             case EESMRCmdDownloadAllAttachments://fallthrough
   307             case EESMRCmdDownloadAllAttachments://fallthrough
   307             case EESMRCmdSaveAttachment://fallthrough
   308             case EESMRCmdSaveAttachment://fallthrough
   308             case EESMRCmdSaveAllAttachments://fallthrough
   309             case EESMRCmdSaveAllAttachments://fallthrough
   309 // </cmail>
       
   310                 {
   310                 {
   311                 if ( ESMRIcalViewerUtils::ContainsAttachments(iInputParameters) &&
   311                 if ( ESMRIcalViewerUtils::ContainsAttachments(iInputParameters) &&
   312                      iMRViewerCommand != iCurrentCbCommand )
   312                      iMRViewerCommand != iCurrentCbCommand )
   313                     {
   313                     {
   314                     iInputParameters.iCommand =
   314                     iInputParameters.iCommand =
   315                             ESMRIcalViewerUtils::MRResponseCommandWithoutAttachmentCheck(
   315                             ESMRIcalViewerUtils::MRResponseCommandWithoutAttachmentCheck(
   316                                     iMRViewerCommand);
   316                                     iMRViewerCommand);
   317                     }
   317                     }
   318                 iCurrentCbCommand = EESMREmailCommand;
   318                 iCurrentCbCommand = EESMREmailCommand;
   319                 //LaunchUIL();
   319                 LaunchUIL();
   320                 }
   320                 }
   321                 break;
   321                 break;
   322 
   322 
   323             case EESMRCmdMailForwardAsMessage://fallthrough
   323             case EESMRCmdMailForwardAsMessage://fallthrough
   324             case EESMRCmdMailCopyMessage://fallthrough
   324             case EESMRCmdMailCopyMessage://fallthrough
   357                 break;
   357                 break;
   358             }
   358             }
   359         }
   359         }
   360 
   360 
   361     if ( !iUILauncher &&
   361     if ( !iUILauncher &&
   362          EESMREmailCommand == iCurrentCbCommand )
   362          EESMREmailCommand == iCurrentCbCommand &&
       
   363          aResult.iOpType != EESMRLoadMRData)
   363         {
   364         {
   364         iResult.iAttendeeStatus =
   365         iResult.iAttendeeStatus =
   365                 ESMRIcalViewerUtils::UserResponsedToMRL(
   366                 ESMRIcalViewerUtils::UserResponsedToMRL(
   366                         *iInputParameters.iCalEntry );
   367                         *iInputParameters.iCalEntry );
   367         Observer()->OperationCompleted( iResult );
   368         Observer()->OperationCompleted( iResult );
   398         }
   399         }
   399 
   400 
   400     iUILauncher->ExecuteCommandL( *Message(), *this );
   401     iUILauncher->ExecuteCommandL( *Message(), *this );
   401     }
   402     }
   402 
   403 
       
   404 // ---------------------------------------------------------------------------
       
   405 // CESMRIcalViewerOpenMRCmd::FillAttachmentInfoL
       
   406 // ---------------------------------------------------------------------------
       
   407 //
       
   408 void CESMRIcalViewerOpenMRCmd::FillAttachmentInfoL()
       
   409     {
       
   410     FUNC_LOG;
       
   411 
       
   412     if ( !iAttachmentInfoFetcher )
       
   413         {
       
   414         iAttachmentInfoFetcher =
       
   415                 CMRAttachmentInfoFetcher::NewL(
       
   416                         iMailClient,
       
   417                         CalSession(),
       
   418                         *(iInputParameters.iCalEntry) );
       
   419         }
       
   420 
       
   421     iAttachmentInfoFetcher->ExecuteCommandL( *Message(), *this );
       
   422     }
       
   423 
   403 // EOF
   424 // EOF
   404 
   425 
       
   426