uiservicetab/vimpststorage/src/cvimpststoragemanagerfactory.cpp
changeset 0 5e5d6b214f4f
child 9 9fdee5e1da30
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     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:  Implementation of CVIMPSTStorageManagerFactory
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <e32std.h>
       
    20 
       
    21 #include "cvimpststoragemanagerfactory.h"
       
    22 #include "cvimpststoragemanager.h"
       
    23 #include "cvimpststorageserviceview.h"
       
    24 
       
    25 //debug prints
       
    26 #include "vimpstdebugtrace.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CVIMPSTStorageManagerFactory::InitialiseLibraryL
       
    32 // Factory method that initialises the vimpststorage library
       
    33 // used by CVIMPSTViewIdFactory
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C void CVIMPSTStorageManagerFactory::InitialiseLibraryL()
       
    37     {
       
    38     TRACE( T_LIT("CVIMPSTStorageManagerFactory::InitialiseLibraryL() begin") );
       
    39     CVIMPSTStorageManager::InitialiseLibraryL();
       
    40     TRACE( T_LIT("CVIMPSTStorageManagerFactory::InitialiseLibraryL() end") );
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CVIMPSTStorageManagerFactory::Release
       
    45 // Factory method to release the resource owned by the vimpststorage library
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C TInt CVIMPSTStorageManagerFactory::Release()
       
    49     {
       
    50     TRACE( T_LIT("CVIMPSTStorageManagerFactory::Release()") );
       
    51     return CVIMPSTStorageManager::Release();  
       
    52     }
       
    53 
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CVIMPSTStorageManager::InitialiseViewL()
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C void CVIMPSTStorageManagerFactory::InitialiseViewL(
       
    60 												TUint32 aServiceId,
       
    61 												const TDesC& aStoreName,
       
    62 												const TDesC& aServiceName)
       
    63     {
       
    64     TRACE( T_LIT("CVIMPSTStorageManagerFactory::InitialiseViewL() begin") );
       
    65     //get the stroage manager instance
       
    66     CVIMPSTStorageManager& storagemanager = CVIMPSTStorageManager::Instance( );
       
    67     
       
    68     //create the storageview based on the service id
       
    69     CVIMPSTStorageServiceView* contactlistInterface = 
       
    70     				storagemanager.CreateServiceViewL( aServiceId, aStoreName, aServiceName );
       
    71     
       
    72     TRACE( T_LIT("CVIMPSTStorageManagerFactory::InitialiseViewL() end") );
       
    73     }    
       
    74     
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CVIMPSTStorageManager::ContactListInterfaceL()
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C MVIMPSTStorageServiceView* CVIMPSTStorageManagerFactory::ContactListInterfaceL(TUint32 aServiceId)
       
    81     {
       
    82     TRACE( T_LIT("CVIMPSTStorageManagerFactory::ContactListInterfaceL() begin") );
       
    83     //get the stroage manager instance
       
    84     CVIMPSTStorageManager& storagemanager = CVIMPSTStorageManager::Instance( );
       
    85     
       
    86     //create the storageview based on the service id
       
    87     CVIMPSTStorageServiceView* contactlistInterface = 
       
    88     				storagemanager.CreateServiceViewL( aServiceId, KNullDesC, KNullDesC );
       
    89     
       
    90     //cast to the base class and return the MVIMPSTStorageServiceView base ptr
       
    91     TRACE( T_LIT("CVIMPSTStorageManagerFactory::ContactListInterfaceL() begin") );
       
    92     return dynamic_cast<MVIMPSTStorageServiceView*>(contactlistInterface);    
       
    93     
       
    94     }    
       
    95  
       
    96 // -----------------------------------------------------------------------------
       
    97 // CVIMPSTStorageManagerFactory::ItemModelInterfaceL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C MVIMPSTStorageItemModel* CVIMPSTStorageManagerFactory::ItemModelInterfaceL( TUint32 aServiceId )
       
   101 	{	
       
   102 	TRACE( T_LIT("CVIMPSTStorageManagerFactory::ItemModelInterfaceL() begin") );
       
   103     //get the stroage manager instance
       
   104     CVIMPSTStorageManager& storagemanager = CVIMPSTStorageManager::Instance( );    
       
   105     
       
   106     //create the storageview based on the service id
       
   107     CVIMPSTStorageServiceView* itemModel = 
       
   108     				storagemanager.CreateServiceViewL( aServiceId, KNullDesC, KNullDesC );
       
   109     
       
   110     //cast to the base class and return the MVIMPSTStorageItemModel base ptr
       
   111     TRACE( T_LIT("CVIMPSTStorageManagerFactory::ItemModelInterfaceL() end") );
       
   112     return dynamic_cast<MVIMPSTStorageItemModel*>(itemModel);
       
   113    
       
   114     }      
       
   115 
       
   116 //  End of File