meetingrequest/mrviewercalplugin/src/cesmrviewersimpl.cpp
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of CMRViewers ECom API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // ----------------------------------------------------------------------------
       
    20 // INCLUDE FILES
       
    21 // ----------------------------------------------------------------------------
       
    22 //
       
    23 #include "emailtrace.h"
       
    24 #include "cesmrviewersimpl.h"
       
    25 
       
    26 // From ESMRVIEWER
       
    27 #include "cesmrviewerctrl.h"
       
    28 #include "caleneditorsplugin.h"
       
    29 
       
    30 // From MR Mailbox Utils
       
    31 #include <cmrmailboxutils.h>
       
    32 #include <CMRUtils.h>
       
    33 
       
    34 // From System
       
    35 #include <coemain.h>
       
    36 #include <bautils.h>
       
    37 #include <f32file.h>
       
    38 #include <data_caging_path_literals.hrh>
       
    39 
       
    40 // Logging utilities
       
    41 // <cmail> Removed profiling. </cmail>
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // MEMBER FUNCTIONS
       
    45 // ----------------------------------------------------------------------------
       
    46 //
       
    47 
       
    48 // ----------------------------------------------------------------------------
       
    49 // CESMRViewersImpl::CESMRViewersImpl
       
    50 // ----------------------------------------------------------------------------
       
    51 //
       
    52 CESMRViewersImpl::CESMRViewersImpl()
       
    53     {
       
    54     FUNC_LOG;
       
    55     }
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CESMRViewersImpl::~CESMRViewersImpl
       
    59 // ----------------------------------------------------------------------------
       
    60 //
       
    61 CESMRViewersImpl::~CESMRViewersImpl()
       
    62     {
       
    63     FUNC_LOG;
       
    64     delete iMtmUid;
       
    65     delete iController;
       
    66     }
       
    67 
       
    68 // ----------------------------------------------------------------------------
       
    69 // CESMRViewersImpl::NewL
       
    70 // ----------------------------------------------------------------------------
       
    71 //
       
    72 CESMRViewersImpl* CESMRViewersImpl::NewL( TAny* aMtmUid )
       
    73     {
       
    74     FUNC_LOG;
       
    75     CESMRViewersImpl* self = new (ELeave) CESMRViewersImpl;
       
    76     CleanupStack::PushL( self );
       
    77     self->ConstructL(aMtmUid);
       
    78     CleanupStack::Pop( self );
       
    79     return self;
       
    80     }
       
    81 
       
    82 // ----------------------------------------------------------------------------
       
    83 // CESMRViewersImpl::ConstructL
       
    84 // ----------------------------------------------------------------------------
       
    85 //
       
    86 void CESMRViewersImpl::ConstructL( TAny* aMtmUid ) // codescanner::LFunctionCantLeave
       
    87     {
       
    88     FUNC_LOG;
       
    89     iMtmUid = reinterpret_cast<HBufC8*>( aMtmUid );
       
    90     }
       
    91 
       
    92 // ----------------------------------------------------------------------------
       
    93 // CESMRViewersImpl::ExecuteViewL
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 TInt CESMRViewersImpl::ExecuteViewL( // codescanner::intleaves
       
    97     RPointerArray<CCalEntry>& aEntries,
       
    98     const TAgnEntryUiInParams& aInParams,
       
    99     TAgnEntryUiOutParams& aOutParams,
       
   100     MAgnEntryUiCallback& aCallback)
       
   101     {
       
   102     FUNC_LOG;
       
   103     TRAPD( err, ExecuteViewInternalL(
       
   104 					aEntries,
       
   105 					aInParams,
       
   106 					aOutParams,
       
   107 					aCallback ) );
       
   108     
       
   109     if ( KErrArgument == err )
       
   110     	{
       
   111     	// ES MR VIEWER controller was unable to show the
       
   112     	// passed meeting request. Let's launc normal meeting viewer
       
   113     	// for showing the entry
       
   114     	
       
   115     	CCalenEditorsPlugin* editorsPlugin =  CCalenEditorsPlugin::NewL();
       
   116 		CleanupStack::PushL( editorsPlugin );
       
   117 
       
   118         err = editorsPlugin->ExecuteViewL( aEntries,
       
   119                                            aInParams,
       
   120                                            aOutParams,
       
   121                                            aCallback );
       
   122     	
       
   123         CleanupStack::PopAndDestroy( editorsPlugin );
       
   124     	}
       
   125     
       
   126     return err;
       
   127     }
       
   128 
       
   129 // ----------------------------------------------------------------------------
       
   130 // CESMRViewersImpl::SetHelpContext
       
   131 // ----------------------------------------------------------------------------
       
   132 //
       
   133 void CESMRViewersImpl::SetHelpContext( const TCoeHelpContext& /*aContext*/ )
       
   134     {
       
   135     FUNC_LOG;
       
   136     }
       
   137 
       
   138 // ----------------------------------------------------------------------------
       
   139 // CESMRViewersImpl::ExecuteViewInternalL
       
   140 // ----------------------------------------------------------------------------
       
   141 //
       
   142 TInt CESMRViewersImpl::ExecuteViewInternalL( // codescanner::intleaves
       
   143 		RPointerArray<CCalEntry>& aEntries,
       
   144 		const MAgnEntryUi::TAgnEntryUiInParams& aInParams,
       
   145 		MAgnEntryUi::TAgnEntryUiOutParams& aOutParams,
       
   146 		MAgnEntryUiCallback& aCallback)
       
   147 	{
       
   148     FUNC_LOG;
       
   149     // ES MR VIEWER controller is created. Controller will handle the
       
   150     // MR UTILS creation and showing the UI to user. Controller will also
       
   151     // receive the callback information from user and handles the BLC.
       
   152     delete iController; 
       
   153     iController = NULL;
       
   154     iController =
       
   155         CESMRViewerController::NewL( *iMtmUid,
       
   156                                      aEntries,
       
   157                                      aInParams,
       
   158                                      aOutParams,
       
   159                                      aCallback );
       
   160 
       
   161     iController->ExecuteL();
       
   162 
       
   163     return KErrNone;	
       
   164 	}
       
   165 // End of file
       
   166