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: Content info container
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef SPBCONTENT_H
|
|
19 |
#define SPBCONTENT_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <TPbk2IconId.h>
|
|
24 |
#include <MVPbkContactLink.h>
|
|
25 |
#include "spbcontentprovider.h"
|
|
26 |
|
|
27 |
class CVPbkContactManager;
|
|
28 |
class CSpbServiceIconProvider;
|
|
29 |
class CSpbStatusProvider;
|
|
30 |
class MSpbContentProviderObserver;
|
|
31 |
class CSpbPhoneNumberParser;
|
|
32 |
|
|
33 |
NONSHARABLE_CLASS( CSpbContent ) : public CBase
|
|
34 |
{
|
|
35 |
public:
|
|
36 |
struct TParameters
|
|
37 |
{
|
|
38 |
CVPbkContactManager* iContactManager;
|
|
39 |
TInt32 iFeatures;
|
|
40 |
RPointerArray<MSpbContentProviderObserver>* iObservers;
|
|
41 |
CSpbServiceIconProvider* iIconProvider; // can be NULL
|
|
42 |
CSpbStatusProvider* iStatusProvider; // can be NULL
|
|
43 |
};
|
|
44 |
|
|
45 |
static CSpbContent* NewLC(
|
|
46 |
const CSpbContent::TParameters& aParameters,
|
|
47 |
const MVPbkContactLink& aLink);
|
|
48 |
|
|
49 |
~CSpbContent();
|
|
50 |
|
|
51 |
public:
|
|
52 |
inline TBool IsReady() const;
|
|
53 |
inline TPtrC Text() const;
|
|
54 |
inline const TPbk2IconId& IconId() const;
|
|
55 |
inline TBool Match(const MVPbkContactLink& aLink) const;
|
|
56 |
inline TBool Match(const TDesC& aBuddyId) const;
|
|
57 |
inline MVPbkContactLink& Link() const;
|
|
58 |
inline void SetBuddyId( HBufC* aId );
|
|
59 |
inline CSpbContentProvider::TSpbContentType Type() const;
|
|
60 |
|
|
61 |
void StatusDataUpdatedL(
|
|
62 |
const TDesC& aStatusMessage,
|
|
63 |
const TDesC8& aBrandId,
|
|
64 |
const TDesC8& aIconEntry );
|
|
65 |
void PhoneNumberUpdatedL(
|
|
66 |
const TDesC& aPhoneNumber,
|
|
67 |
CSpbContentProvider::TSpbContentType aType );
|
|
68 |
/*
|
|
69 |
* Function reloads the phonenumber, if there is no status text provided
|
|
70 |
*/
|
|
71 |
void RefreshNumberL();
|
|
72 |
|
|
73 |
private:
|
|
74 |
inline CSpbContent(
|
|
75 |
const CSpbContent::TParameters& aParameters);
|
|
76 |
inline void ConstructL(
|
|
77 |
const MVPbkContactLink& aLink);
|
|
78 |
private:
|
|
79 |
static TInt StartFetchContentL(
|
|
80 |
TAny* aPtr );
|
|
81 |
void DoStartFetchContentL();
|
|
82 |
void NotifyObservers(
|
|
83 |
MSpbContentProviderObserver::TSpbContentEvent aEvent);
|
|
84 |
|
|
85 |
private:
|
|
86 |
|
|
87 |
TParameters iParameters;
|
|
88 |
/// Own
|
|
89 |
MVPbkContactLink* iLink;
|
|
90 |
// Own
|
|
91 |
CSpbPhoneNumberParser* iPhoneNumberParser;
|
|
92 |
///
|
|
93 |
CAsyncCallBack iAsyncCallBack;
|
|
94 |
/// Own
|
|
95 |
HBufC* iText;
|
|
96 |
/// Own
|
|
97 |
HBufC* iBuddyId;
|
|
98 |
TPbk2IconId iIconId;
|
|
99 |
TBool iReady;
|
|
100 |
/// Content type
|
|
101 |
CSpbContentProvider::TSpbContentType iType;
|
|
102 |
};
|
|
103 |
|
|
104 |
inline void CSpbContent::SetBuddyId( HBufC* aId )
|
|
105 |
{
|
|
106 |
delete iBuddyId;
|
|
107 |
iBuddyId = aId;
|
|
108 |
}
|
|
109 |
|
|
110 |
inline MVPbkContactLink& CSpbContent::Link() const
|
|
111 |
{
|
|
112 |
return *iLink;
|
|
113 |
}
|
|
114 |
|
|
115 |
inline TBool CSpbContent::Match(const MVPbkContactLink& aLink) const
|
|
116 |
{
|
|
117 |
return iLink->IsSame( aLink );
|
|
118 |
}
|
|
119 |
|
|
120 |
inline TBool CSpbContent::Match(const TDesC& aBuddyId) const
|
|
121 |
{
|
|
122 |
if(iBuddyId && iBuddyId->Compare(aBuddyId) == 0)
|
|
123 |
{
|
|
124 |
return ETrue;
|
|
125 |
}
|
|
126 |
return EFalse;
|
|
127 |
}
|
|
128 |
|
|
129 |
inline TBool CSpbContent::IsReady() const
|
|
130 |
{
|
|
131 |
return iReady;
|
|
132 |
}
|
|
133 |
|
|
134 |
inline TPtrC CSpbContent::Text() const
|
|
135 |
{
|
|
136 |
return iText ? *iText : KNullDesC();
|
|
137 |
}
|
|
138 |
|
|
139 |
inline const TPbk2IconId& CSpbContent::IconId() const
|
|
140 |
{
|
|
141 |
return iIconId;
|
|
142 |
}
|
|
143 |
|
|
144 |
inline CSpbContentProvider::TSpbContentType CSpbContent::Type() const
|
|
145 |
{
|
|
146 |
return iType;
|
|
147 |
}
|
|
148 |
|
|
149 |
#endif // SPBCONTENT_H
|