meetingrequest/mrbcplugin/src/cmrbcpluginentryloader.cpp
branchRCL_3
changeset 33 da5135c61bad
equal deleted inserted replaced
32:a3a1ae9acec6 33:da5135c61bad
       
     1 /*
       
     2 * Copyright (c) 2008 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:  MBUtils ECOM implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cmrbcpluginentryloader.h"
       
    19 
       
    20 #include <calenservices.h>
       
    21 #include <calencontext.h>
       
    22 #include <calentryview.h>
       
    23 #include <caleninstanceid.h>
       
    24 
       
    25 #include "emailtrace.h"
       
    26 
       
    27 namespace { //codescanner::namespace
       
    28 
       
    29 #ifdef _DEBUG
       
    30 
       
    31 _LIT( KMRBCPluginEntryLoader, "MRBCPluginEntryLoader" );
       
    32 
       
    33 enum TMRBCPluginEntryLoaderPanic
       
    34     {
       
    35     EEntryNotFetched
       
    36     };
       
    37 
       
    38 void Panic( TMRBCPluginEntryLoaderPanic aPanic )
       
    39     {
       
    40     User::Panic( KMRBCPluginEntryLoader, aPanic );
       
    41     }
       
    42 
       
    43 #endif // _DEBUG
       
    44 
       
    45 } // namespace
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CMRBCPluginEntryLoader::CMRBCPluginEntryLoader
       
    49 // Static constructor for this class
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CMRBCPluginEntryLoader::CMRBCPluginEntryLoader( MCalenServices& aServices )
       
    53 :   iServices( aServices )
       
    54     {
       
    55     FUNC_LOG;
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CMRBCPluginEntryLoader::~CMRBCPluginEntryLoader
       
    60 // Static constructor for this class
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CMRBCPluginEntryLoader::~CMRBCPluginEntryLoader()
       
    64     {
       
    65     FUNC_LOG;
       
    66     delete iEntry;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CMRBCPluginEntryLoader::ConstructL
       
    71 // Static constructor for this class
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CMRBCPluginEntryLoader::ConstructL()
       
    75     {
       
    76     FUNC_LOG;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CMRBCPluginEntryLoader::NewL
       
    81 // Static constructor for this class
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 CMRBCPluginEntryLoader* CMRBCPluginEntryLoader::NewL( 
       
    85         MCalenServices& aServices )
       
    86     {
       
    87     FUNC_LOG;
       
    88     
       
    89     CMRBCPluginEntryLoader* self = new (ELeave) CMRBCPluginEntryLoader( aServices );
       
    90     CleanupStack::PushL( self );
       
    91     self->ConstructL();
       
    92     CleanupStack::Pop( self );
       
    93     return self;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CMRBCPluginEntryLoader::UpdateEntryFromDatabaseL
       
    98 // Static constructor for this class
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CMRBCPluginEntryLoader::UpdateEntryFromDatabaseL()
       
   102     {
       
   103     FUNC_LOG;
       
   104     
       
   105     if ( iEntry )
       
   106         {        
       
   107         delete iEntry;
       
   108         iEntry = NULL;
       
   109         }
       
   110     
       
   111     MCalenContext& context = iServices.Context();
       
   112     TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid;
       
   113        
       
   114     iEntry = iServices.EntryViewL( 
       
   115             context.InstanceId().iColId )->FetchL( instanceId );   
       
   116     }
       
   117     
       
   118 CCalEntry& CMRBCPluginEntryLoader::Entry()
       
   119     {
       
   120     FUNC_LOG;
       
   121     
       
   122     __ASSERT_DEBUG( iEntry, Panic(EEntryNotFetched) );
       
   123     
       
   124     return *iEntry;
       
   125     }
       
   126     
       
   127 // EOF