63
|
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 |
#ifndef SPBCONTENTPROVIDERPRIVATE_H_
|
|
20 |
#define SPBCONTENTPROVIDERPRIVATE_H_
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include "spbcontentprovider.h"
|
|
25 |
#include "spbserviceiconprovider.h"
|
|
26 |
|
|
27 |
class MSpbContentProviderObserver;
|
|
28 |
class CSpbServiceIconProvider;
|
|
29 |
class CSpbStatusProvider;
|
|
30 |
class CSpbContent;
|
|
31 |
class CVPbkContactManager;
|
|
32 |
class CSpbContactStoreListener;
|
|
33 |
class CPbk2StoreManager;
|
|
34 |
class MVPbkContactStore;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Private implementation of the content provider
|
|
38 |
*/
|
|
39 |
NONSHARABLE_CLASS( CSpbContentProviderPrivate ) : public CBase
|
|
40 |
{
|
|
41 |
|
|
42 |
public: // Construction & destruction
|
|
43 |
|
|
44 |
/// Constructor (see CSpbContentProvider for params)
|
|
45 |
static CSpbContentProviderPrivate* NewL(
|
|
46 |
CVPbkContactManager& aContactManager,
|
|
47 |
CPbk2StoreManager& aStoreManager,
|
|
48 |
TInt32 aFeatures );
|
|
49 |
|
|
50 |
/// Destructor
|
|
51 |
~CSpbContentProviderPrivate();
|
|
52 |
|
|
53 |
public: // From CSpbContentProvider
|
|
54 |
|
|
55 |
/// From CSpbContentProvider
|
|
56 |
inline void AddObserverL(
|
|
57 |
MSpbContentProviderObserver& aObserver );
|
|
58 |
|
|
59 |
/// From CSpbContentProvider
|
|
60 |
inline void RemoveObserver(
|
|
61 |
MSpbContentProviderObserver& aObserver );
|
|
62 |
|
|
63 |
/// From CSpbContentProvider
|
|
64 |
void GetContentL(
|
|
65 |
MVPbkContactLink& aLink,
|
|
66 |
HBufC*& aText,
|
|
67 |
TPbk2IconId& aIconId,
|
|
68 |
CSpbContentProvider::TSpbContentType& aType );
|
|
69 |
|
|
70 |
/// From CSpbContentProvider
|
|
71 |
inline CGulIcon* CreateServiceIconLC(
|
|
72 |
const TPbk2IconId& aIconId );
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Clean the content in the cache if it belongs to the specified store
|
|
76 |
*/
|
|
77 |
void CleanContentL( MVPbkContactStore& aStore );
|
|
78 |
|
|
79 |
private: // constructors
|
|
80 |
|
|
81 |
/// Constructor
|
|
82 |
inline CSpbContentProviderPrivate(
|
|
83 |
CVPbkContactManager& aContactManager,
|
|
84 |
CPbk2StoreManager& aStoreManager,
|
|
85 |
TInt32 aFeatures);
|
|
86 |
|
|
87 |
/// Constructor
|
|
88 |
inline void ConstructL();
|
|
89 |
|
|
90 |
private: // new methods
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Find content for aLink or NULL
|
|
94 |
*/
|
|
95 |
CSpbContent* ContentByLinkL( const MVPbkContactLink& aLink );
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Check if feature is enabled
|
|
99 |
*/
|
|
100 |
TBool IsFeature( TInt aFeature ) const;
|
|
101 |
|
|
102 |
private: // data
|
|
103 |
|
|
104 |
/// Contact manager
|
|
105 |
CVPbkContactManager& iContactManager;
|
|
106 |
|
|
107 |
/// Store manager
|
|
108 |
CPbk2StoreManager& iStoreManager;
|
|
109 |
|
|
110 |
/// Required features / content
|
|
111 |
const TInt32 iFeatures;
|
|
112 |
|
|
113 |
/// Content not own. Observers
|
|
114 |
RPointerArray<MSpbContentProviderObserver> iObservers;
|
|
115 |
|
|
116 |
/// Content Own. Cached content
|
|
117 |
RPointerArray<CSpbContent> iContentCache;
|
|
118 |
|
|
119 |
/// Own. Icon provider
|
|
120 |
CSpbServiceIconProvider* iIconProvider;
|
|
121 |
|
|
122 |
/// Own. Status provider
|
|
123 |
CSpbStatusProvider* iStatusProvider;
|
|
124 |
|
|
125 |
// Own. contact store listener for detecting contact changes (phonenumber)
|
|
126 |
CSpbContactStoreListener* iStoreListener;
|
|
127 |
};
|
|
128 |
|
|
129 |
//------------------------------------------------------------------------------
|
|
130 |
// INLINE METHODS
|
|
131 |
//------------------------------------------------------------------------------
|
|
132 |
|
|
133 |
inline void CSpbContentProviderPrivate::AddObserverL(
|
|
134 |
MSpbContentProviderObserver& aObserver )
|
|
135 |
{
|
|
136 |
iObservers.AppendL( &aObserver );
|
|
137 |
}
|
|
138 |
|
|
139 |
inline void CSpbContentProviderPrivate::RemoveObserver(
|
|
140 |
MSpbContentProviderObserver& aObserver )
|
|
141 |
{
|
|
142 |
const TInt index = iObservers.Find( &aObserver );
|
|
143 |
if( index >= 0 )
|
|
144 |
{
|
|
145 |
iObservers.Remove( index );
|
|
146 |
}
|
|
147 |
}
|
|
148 |
|
|
149 |
inline CGulIcon* CSpbContentProviderPrivate::CreateServiceIconLC(
|
|
150 |
const TPbk2IconId& aIconId )
|
|
151 |
{
|
|
152 |
if( iIconProvider )
|
|
153 |
{
|
|
154 |
return iIconProvider->CreateIconLC( aIconId );
|
|
155 |
}
|
|
156 |
CGulIcon* icon = NULL;
|
|
157 |
CleanupStack::PushL( icon );
|
|
158 |
return icon;
|
|
159 |
}
|
|
160 |
|
|
161 |
inline TBool CSpbContentProviderPrivate::IsFeature( TInt aFeature ) const
|
|
162 |
{
|
|
163 |
return iFeatures & aFeature;
|
|
164 |
}
|
|
165 |
|
|
166 |
|
|
167 |
#endif /*SPBCONTENTPROVIDERPRIVATE_H_*/
|