meetingui/agnentryui/src/CAgnEntryUiImpl.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ----------------------------------------------------------------------------
       
    21 // INCLUDE FILES
       
    22 // ----------------------------------------------------------------------------
       
    23 //
       
    24 #include "CAgnEntryUiImpl.h"
       
    25 #include <CMRViewers.h>
       
    26 #include <calentry.h>
       
    27 #include <CalenEditorsPlugin.h>
       
    28 #include <CalenInterimUtils2.h>
       
    29 
       
    30 // CONSTANTS
       
    31 /// Unnamed namespace for local definitions
       
    32 namespace {
       
    33 
       
    34 }  // namespace
       
    35 
       
    36 // ----------------------------------------------------------------------------
       
    37 // MEMBER FUNCTIONS
       
    38 // ----------------------------------------------------------------------------
       
    39 //
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // CAgnEntryUiImpl::NewL
       
    43 // ----------------------------------------------------------------------------
       
    44 //
       
    45 CAgnEntryUiImpl* CAgnEntryUiImpl::NewL( TAny* aMtmUid )
       
    46 	{
       
    47 	CAgnEntryUiImpl* self = new( ELeave ) CAgnEntryUiImpl( aMtmUid );
       
    48 	CleanupStack::PushL( self );
       
    49 	self->ConstructL();
       
    50 	CleanupStack::Pop();
       
    51 	return self;
       
    52 	}
       
    53 
       
    54 // ----------------------------------------------------------------------------
       
    55 // CAgnEntryUiImpl::CAgnEntryUiImpl
       
    56 //
       
    57 // Constructor.
       
    58 // ----------------------------------------------------------------------------
       
    59 //
       
    60 CAgnEntryUiImpl::CAgnEntryUiImpl( TAny* aMtmUid )
       
    61     {
       
    62     iMtmUid = reinterpret_cast<HBufC8*>( aMtmUid ); // ownership transferred
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // CAgnEntryUiImpl::~CAgnEntryUiImpl
       
    67 //
       
    68 // Destructor.
       
    69 // ----------------------------------------------------------------------------
       
    70 //
       
    71 CAgnEntryUiImpl::~CAgnEntryUiImpl()
       
    72     {
       
    73     delete iMtmUid;
       
    74     delete iCalEditor;
       
    75     delete iMRViewer;
       
    76     }
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // CAgnEntryUiImpl::ConstructL
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 void CAgnEntryUiImpl::ConstructL()
       
    83     {
       
    84     }
       
    85 
       
    86 // ----------------------------------------------------------------------------
       
    87 // CAgnEntryUiImpl::ExecuteViewL
       
    88 // Client (at least Calendar) may call this method repeatedly, therefore we
       
    89 // maintain iMRViewer and iCalEditor
       
    90 // ----------------------------------------------------------------------------
       
    91 //
       
    92 TInt CAgnEntryUiImpl::ExecuteViewL(
       
    93     RPointerArray<CCalEntry>& aEntries,
       
    94     const TAgnEntryUiInParams& aInParams,
       
    95     TAgnEntryUiOutParams& aOutParams,
       
    96     MAgnEntryUiCallback& aCallback)
       
    97     {
       
    98     MAgnEntryUi* viewer = NULL;
       
    99     TInt retVal( KErrNone );
       
   100 
       
   101 	CCalEntry& entry = *( aEntries[0] );
       
   102     if ( CCalenInterimUtils2::IsMeetingRequestL( entry ) )
       
   103         {
       
   104         if ( !iMRViewer )
       
   105             {            
       
   106             TRAPD( viewerErr, iMRViewer = CMRViewers::NewL( *iMtmUid ) );
       
   107             
       
   108             // If CMRViewers plugin is not found try to create
       
   109             // CCalenEditorsPlugin default implemetation
       
   110             if ( viewerErr != KErrNone )
       
   111                 {
       
   112                 iMRViewer = CCalenEditorsPlugin::NewL();
       
   113                 }
       
   114             }
       
   115         viewer = iMRViewer;
       
   116         }
       
   117     else // vTodo etc.
       
   118         {
       
   119         if ( !iCalEditor )
       
   120             {            
       
   121             iCalEditor = CCalenEditorsPlugin::NewL();
       
   122             }
       
   123         viewer = iCalEditor;
       
   124         }
       
   125 
       
   126     if ( !iHelpContext.IsNull() )
       
   127         {        
       
   128         viewer->SetHelpContext( iHelpContext );
       
   129         }
       
   130         
       
   131     retVal = viewer->ExecuteViewL( aEntries, aInParams, aOutParams, aCallback );
       
   132     return retVal;
       
   133     }
       
   134 
       
   135 // ----------------------------------------------------------------------------
       
   136 // CAgnEntryUiImpl::SetHelpContext
       
   137 // ----------------------------------------------------------------------------
       
   138 //
       
   139 void CAgnEntryUiImpl::SetHelpContext(
       
   140     const TCoeHelpContext& aContext )
       
   141     {
       
   142     iHelpContext.iContext = aContext.iContext;
       
   143     iHelpContext.iMajor = aContext.iMajor;
       
   144     }
       
   145 
       
   146 // End of file