meetingui/attendeeview/UiInc/CAttendeeView.inl
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2004-2006 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:   Implements interface for CAttendeeView
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cattendeeview.h"
       
    22 
       
    23 //implementation uid
       
    24 const TUid KAttendeeViewImplUid = {0x101F87AC};
       
    25 //interface uid
       
    26 const TUid KAttendeeVIewInterfaceUid = {0x101F87AB};
       
    27 
       
    28 namespace {
       
    29 // simple wrapper class with array deletion on close
       
    30 class RImplInfoPtrArrayOwn : public RImplInfoPtrArray
       
    31     {
       
    32     public:
       
    33         void Close()
       
    34             {
       
    35             ResetAndDestroy();
       
    36             RImplInfoPtrArray::Close();
       
    37             }
       
    38     };
       
    39 }
       
    40 // ============================ MEMBER FUNCTIONS ==============================
       
    41 // ----------------------------------------------------------------------------
       
    42 // CAttendeeView::NewL
       
    43 // Two-phased constructor.
       
    44 // ----------------------------------------------------------------------------
       
    45 //
       
    46 inline CAttendeeView* CAttendeeView::NewL( const CCalUser* /*aPhoneOwner*/ )
       
    47     {
       
    48     CAttendeeView* attendeeView = NULL;
       
    49 
       
    50     //List all implementations which match resolverParams
       
    51     RImplInfoPtrArrayOwn implArray;
       
    52     CleanupClosePushL( implArray );
       
    53     REComSession::ListImplementationsL( KAttendeeVIewInterfaceUid,
       
    54                                         implArray );
       
    55 
       
    56     const TInt count( implArray.Count() );
       
    57     for ( TInt i(0); i < count; ++i )
       
    58         {
       
    59         TUid implUid = implArray[i]->ImplementationUid();
       
    60         if ( implUid != KAttendeeViewImplUid )
       
    61             {
       
    62             attendeeView = reinterpret_cast<CAttendeeView*>(
       
    63                                     REComSession::CreateImplementationL(
       
    64                                     implUid,
       
    65                                     _FOFF( CAttendeeView, iDtor_ID_Key  ) /*,
       
    66                                     aPhoneOwner*/ ) );
       
    67             break;
       
    68             }
       
    69         }
       
    70 
       
    71     CleanupStack::PopAndDestroy(); // implArray
       
    72 
       
    73     if ( !attendeeView )
       
    74         {
       
    75         //Use default implementation
       
    76         attendeeView = reinterpret_cast<CAttendeeView*>(
       
    77                                     REComSession::CreateImplementationL(
       
    78                                     KAttendeeViewImplUid,
       
    79                                     _FOFF( CAttendeeView, iDtor_ID_Key  )/*,
       
    80                                     aPhoneOwner*/ ) );
       
    81         }
       
    82 
       
    83     return attendeeView;
       
    84     }
       
    85 
       
    86 inline CAttendeeView* CAttendeeView::NewL( const CCalUser* aPhoneOwner,
       
    87                                            const TDesC8& aMtmUid )
       
    88     {
       
    89     //Initial resolver parameters
       
    90     TEComResolverParams resolverParams;
       
    91     resolverParams.SetDataType( aMtmUid  );
       
    92 
       
    93     CAttendeeView* attendeeView = NULL;
       
    94 
       
    95     //List all implementations which match resolverParams
       
    96     RImplInfoPtrArrayOwn implArray;
       
    97     CleanupClosePushL( implArray );
       
    98     REComSession::ListImplementationsL( KAttendeeVIewInterfaceUid,
       
    99                                         resolverParams,
       
   100                                         implArray );
       
   101 
       
   102     if ( implArray.Count() )
       
   103         {
       
   104         // Construct MTM-specific implementation, pick first from the array
       
   105         TUid implUid = implArray[0]->ImplementationUid();
       
   106 
       
   107         attendeeView = reinterpret_cast<CAttendeeView*>(
       
   108                            REComSession::CreateImplementationL(
       
   109                            implUid,
       
   110                            _FOFF( CAttendeeView, iDtor_ID_Key  )/*,
       
   111                            aPhoneOwner*/ ) );
       
   112         }
       
   113     else
       
   114         {
       
   115         //Default implementation
       
   116         attendeeView = CAttendeeView::NewL( aPhoneOwner );
       
   117         }
       
   118 
       
   119     CleanupStack::PopAndDestroy(); // implArray
       
   120 
       
   121     return attendeeView;
       
   122     }
       
   123     
       
   124 // ----------------------------------------------------------------------------
       
   125 // CAttendeeView::CAttendeeView
       
   126 // C++ default constructor can NOT contain any code, that
       
   127 // might leave.
       
   128 // ----------------------------------------------------------------------------
       
   129 //
       
   130 inline CAttendeeView::CAttendeeView()
       
   131     {
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------
       
   135 // CAttendeeView::~CAttendeeView
       
   136 // ---------------------------------------------------------
       
   137 //
       
   138 inline CAttendeeView::~CAttendeeView()
       
   139     {
       
   140     REComSession::DestroyedImplementation( iDtor_ID_Key );
       
   141     }
       
   142 
       
   143 
       
   144 // End of File