|
1 /* |
|
2 * Copyright (c) 2009 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 #include "spbcontentprovider.h" |
|
20 #include "spbcontentproviderprivate.h" |
|
21 #include <featmgr.h> |
|
22 #include <MVPbkContactStore.h> |
|
23 |
|
24 // LOCAL METHODS AND CONSTANTS |
|
25 namespace { |
|
26 |
|
27 inline void RemoveFlag( TInt32& aFlags, TInt aFlag ) |
|
28 { |
|
29 aFlags &= ~aFlag; |
|
30 } |
|
31 } |
|
32 |
|
33 // ---------------------------------------------------------------------------- |
|
34 // CSpbContentProvider::NewL |
|
35 // ---------------------------------------------------------------------------- |
|
36 // |
|
37 EXPORT_C CSpbContentProvider* CSpbContentProvider::NewL( |
|
38 CVPbkContactManager& aContactManager, |
|
39 CPbk2StoreManager& aStoreManager, |
|
40 TInt32 aFeatures) |
|
41 { |
|
42 CSpbContentProvider* self = new (ELeave) CSpbContentProvider; |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL( aContactManager, aStoreManager, aFeatures ); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 // ---------------------------------------------------------------------------- |
|
50 // CSpbContentProvider::CSpbContentProvider |
|
51 // ---------------------------------------------------------------------------- |
|
52 // |
|
53 inline CSpbContentProvider::CSpbContentProvider() |
|
54 { |
|
55 } |
|
56 |
|
57 // ---------------------------------------------------------------------------- |
|
58 // CSpbContentProvider::ConstructL |
|
59 // ---------------------------------------------------------------------------- |
|
60 // |
|
61 inline void CSpbContentProvider::ConstructL( |
|
62 CVPbkContactManager& aContactManager, |
|
63 CPbk2StoreManager& aStoreManager, |
|
64 TInt32 aFeatures ) |
|
65 { |
|
66 FeatureManager::InitializeLibL(); |
|
67 if( !FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) |
|
68 { |
|
69 // Status message and service icon is not fetched if FF_CONTACTS_SOCIAL |
|
70 // feature flag is not defined |
|
71 RemoveFlag( aFeatures, EStatusMessage ); |
|
72 RemoveFlag( aFeatures, EServiceIcon ); |
|
73 } |
|
74 FeatureManager::UnInitializeLib(); |
|
75 iImpl = CSpbContentProviderPrivate::NewL(aContactManager, aStoreManager, aFeatures); |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CSpbContentProvider::~CSpbContentProvider |
|
80 // ---------------------------------------------------------------------------- |
|
81 // |
|
82 CSpbContentProvider::~CSpbContentProvider() |
|
83 { |
|
84 delete iImpl; |
|
85 } |
|
86 |
|
87 // ---------------------------------------------------------------------------- |
|
88 // CSpbContentProvider::AddObserverL |
|
89 // ---------------------------------------------------------------------------- |
|
90 // |
|
91 EXPORT_C void CSpbContentProvider::AddObserverL( |
|
92 MSpbContentProviderObserver& aObserver ) |
|
93 { |
|
94 iImpl->AddObserverL( aObserver ); |
|
95 } |
|
96 |
|
97 // ---------------------------------------------------------------------------- |
|
98 // CSpbContentProvider::RemoveObserver |
|
99 // ---------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C void CSpbContentProvider::RemoveObserver( |
|
102 MSpbContentProviderObserver& aObserver ) |
|
103 { |
|
104 iImpl->RemoveObserver( aObserver ); |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // CSpbContentProvider::GetContentL |
|
109 // ---------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C void CSpbContentProvider::GetContentL( |
|
112 MVPbkContactLink& aLink, |
|
113 HBufC*& aText, |
|
114 TPbk2IconId& aIconId, |
|
115 TSpbContentType& aType ) |
|
116 { |
|
117 iImpl->GetContentL( aLink, aText, aIconId, aType ); |
|
118 } |
|
119 |
|
120 // ---------------------------------------------------------------------------- |
|
121 // CSpbContentProvider::CreateServiceIconLC |
|
122 // ---------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C CGulIcon* CSpbContentProvider::CreateServiceIconLC( |
|
125 const TPbk2IconId& aIconId ) |
|
126 { |
|
127 return iImpl->CreateServiceIconLC( aIconId ); |
|
128 } |
|
129 |
|
130 // ---------------------------------------------------------------------------- |
|
131 // CSpbContentProvider::CleanContentL |
|
132 // ---------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void CSpbContentProvider::CleanContentL( MVPbkContactStore& aStore ) |
|
135 { |
|
136 return iImpl->CleanContentL( aStore ); |
|
137 } |
|
138 |
|
139 // end of file |