PECengine/PresenceManager2/SrcContactList/CPEngContactListStore2Imp.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Store API to retrieve contact list models.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "CPEngContactListStore2Imp.h"
       
    20 #include "CPEngNWSessionSlotID2Imp.h"
       
    21 #include "CPEngSessionSlotId.h"
       
    22 #include "CPEngNWSessionSlotStorageProxy.h"
       
    23 #include "PEngListLibraryFactory.h"
       
    24 #include "MPEngContactListManager.h"
       
    25 #include "MPEngContactListAdvance.h"
       
    26 
       
    27 
       
    28 #include <CPEngNWSessionSlotID2.h>
       
    29 
       
    30 
       
    31 
       
    32 
       
    33 
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CPEngContactListStore2Imp::NewL()
       
    40 // Two-phased constructor.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CPEngContactListStore2Imp* CPEngContactListStore2Imp::NewL(
       
    44     const CPEngNWSessionSlotID2& aNWSessionSlotID,
       
    45     TInt aPriority )
       
    46     {
       
    47     CPEngContactListStore2Imp* self =
       
    48         new ( ELeave ) CPEngContactListStore2Imp( aPriority );
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL( aNWSessionSlotID );
       
    51     CleanupStack::Pop( self );
       
    52     return self;
       
    53     }
       
    54 
       
    55 
       
    56 
       
    57 // Destructor
       
    58 CPEngContactListStore2Imp::~CPEngContactListStore2Imp()
       
    59     {
       
    60     if ( iCntLstManager )
       
    61         {
       
    62         iCntLstManager->Close();
       
    63         }
       
    64 
       
    65     delete iUsedSlot;
       
    66     }
       
    67 
       
    68 
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CPEngContactListStore2Imp::CPEngContactListStore2Imp
       
    72 // C++ default constructor can NOT contain any code, that
       
    73 // might leave.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 CPEngContactListStore2Imp::CPEngContactListStore2Imp( TInt aPriority )
       
    77         : iCActivePriority( aPriority ),
       
    78         iDummy( KNullDesC )
       
    79     {
       
    80     }
       
    81 
       
    82 
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CPEngContactListStore2Imp::ConstructL()
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void CPEngContactListStore2Imp::ConstructL( const CPEngNWSessionSlotID2& aNWSessionSlotID )
       
    89     {
       
    90     iUsedSlot = CPEngNWSessionSlotStorageProxy::NewL( aNWSessionSlotID );
       
    91     iCntLstManager = PEngListLibraryFactory::ContactListManagerL( iUsedSlot->BaseId() );
       
    92     }
       
    93 
       
    94 
       
    95 
       
    96 
       
    97 
       
    98 
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CPEngContactListStore2Imp::AllContactListsL()
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 const MDesCArray& CPEngContactListStore2Imp::AllContactListsL() const
       
   105     {
       
   106     return iCntLstManager->AllContactListsL();
       
   107     }
       
   108 
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CPEngContactListStore2Imp::SynchronizedContactListsL()
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 const MDesCArray& CPEngContactListStore2Imp::SynchronizedContactListsL() const
       
   115     {
       
   116     return iCntLstManager->SynchronizedContactLists();
       
   117     }
       
   118 
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CPEngContactListStore2Imp::ContactListL()
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 MPEngContactList2& CPEngContactListStore2Imp::ContactListL(
       
   125     const TDesC& aContactList )
       
   126     {
       
   127     return iCntLstManager->ContactListL( aContactList );
       
   128     }
       
   129 
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CPEngContactListStore2Imp::CreateContactListL()
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 MPEngContactListProperties& CPEngContactListStore2Imp::CreateContactListL(
       
   136     const TDesC& aContactList,
       
   137     TPEngContactListBaseSettings& aBaseSettings )
       
   138     {
       
   139     return iCntLstManager->CreateContactListL( aContactList,
       
   140                                                aBaseSettings );
       
   141     }
       
   142 
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CPEngContactListStore2Imp::DeleteContactListL()
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 void CPEngContactListStore2Imp::DeleteContactListL( const TDesC& aContactList )
       
   149     {
       
   150     iCntLstManager->DeleteContactListL( aContactList );
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CPEngContactListStore2Imp::ChangeContactListTypeL()
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 void CPEngContactListStore2Imp::ChangeContactListTypeL(
       
   158     const TDesC& aContactList,
       
   159     TPEngContactListType aContactListType )
       
   160     {
       
   161     iCntLstManager->ChangeContactListTypeL( aContactList, aContactListType );
       
   162     }
       
   163 
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // CPEngContactListStore2Imp::ContactListPropertiesL()
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 MPEngContactListProperties& CPEngContactListStore2Imp::ContactListPropertiesL(
       
   170     const TDesC& aContactList )
       
   171     {
       
   172     return iCntLstManager->ContactListSettingsL( aContactList );
       
   173     }
       
   174 
       
   175 
       
   176 // -----------------------------------------------------------------------------
       
   177 // CPEngContactListStore2Imp::SetAsDefaultContactListL()
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void CPEngContactListStore2Imp::SetAsDefaultContactListL( const TDesC& aContactList )
       
   181     {
       
   182     iCntLstManager->SetAsDefaultCntListL( aContactList );
       
   183     }
       
   184 
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CPEngContactListStore2Imp::ReleaseContactList
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 TInt CPEngContactListStore2Imp::ReleaseContactList( const TDesC& aContactList )
       
   191     {
       
   192     iCntLstManager->ReleaseCntListModel( aContactList );
       
   193     return KErrNone;
       
   194     }
       
   195 
       
   196 
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 // CPEngContactListStore2Imp::DummyList()
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 const MDesCArray& CPEngContactListStore2Imp::DummyList() const
       
   203     {
       
   204     return iDummy;
       
   205     }
       
   206 
       
   207 
       
   208 // End of File
       
   209 
       
   210