63
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Contact model class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CSPBCONTACTDATAMODEL_H
|
|
19 |
#define CSPBCONTACTDATAMODEL_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <bamdesca.h>
|
|
24 |
|
|
25 |
// FORWARD DECLARATIONS
|
|
26 |
class CPbk2IconArray;
|
|
27 |
class CPbk2PresentationContact;
|
|
28 |
class CCoeEnv;
|
|
29 |
class MVPbkContactLink;
|
|
30 |
class MPbk2ClipListBoxText;
|
|
31 |
class CSpbContactDataModelPrivate;
|
|
32 |
class CVPbkContactManager;
|
|
33 |
class RWriteStream;
|
|
34 |
class RReadStream;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Contact data model class
|
|
38 |
*
|
|
39 |
* @lib pbk2spbcontentprovider.dll
|
|
40 |
* @since S60 9.2
|
|
41 |
*/
|
|
42 |
class CSpbContactDataModel : public CBase
|
|
43 |
{
|
|
44 |
public:
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Two-phased constructor.
|
|
48 |
*
|
|
49 |
* @param aCntManager Contact manager
|
|
50 |
* @param aCoeEnv UI control environment
|
|
51 |
* @param aFieldTypeSelectorRes field type selector.
|
|
52 |
* Used to determine fields that get clipped from the beginning.
|
|
53 |
* @param aClip listbox text clipper
|
|
54 |
* @param aIconArray Listbox's icon array
|
|
55 |
*/
|
|
56 |
IMPORT_C static CSpbContactDataModel* NewL(
|
|
57 |
CVPbkContactManager& aCntManager,
|
|
58 |
CCoeEnv& aCoeEnv,
|
|
59 |
TInt aFieldTypeSelectorRes,
|
|
60 |
MPbk2ClipListBoxText* aClip = NULL );
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Destructor.
|
|
64 |
*/
|
|
65 |
~CSpbContactDataModel();
|
|
66 |
|
|
67 |
|
|
68 |
public: // data types
|
|
69 |
|
|
70 |
/// Text types (16-bit)
|
|
71 |
enum TTextTypes
|
|
72 |
{
|
|
73 |
/// Contact's first name
|
|
74 |
ETextFirstName,
|
|
75 |
/// Contact's last name
|
|
76 |
ETextLastName,
|
|
77 |
/// Filename of contact's image
|
|
78 |
ETextImageFileName,
|
|
79 |
};
|
|
80 |
|
|
81 |
/// Data types (8-bit)
|
|
82 |
enum TBinaryTypes
|
|
83 |
{
|
|
84 |
/// Thumbnail data of contact
|
|
85 |
EDataImageContent
|
|
86 |
};
|
|
87 |
|
|
88 |
public: // New methods
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Get Presentation Field index for field at aIndex
|
|
92 |
*
|
|
93 |
* @param aListIndex Listbox row index
|
|
94 |
* @return Presentation field index shown at aListIndex
|
|
95 |
*/
|
|
96 |
IMPORT_C TInt PresentationFieldIndex( TInt aListIndex );
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Get List Box index for field at aIndex
|
|
100 |
*
|
|
101 |
* @param Presentation field index
|
|
102 |
* @return Listbox row index
|
|
103 |
*/
|
|
104 |
IMPORT_C TInt ListIndex( TInt aPresentationIndex );
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Externalize model into stream
|
|
108 |
*/
|
|
109 |
IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Internalize model from stream.
|
|
113 |
* Any previous data will be deleted.
|
|
114 |
*/
|
|
115 |
IMPORT_C void InternalizeL( RReadStream& aStream );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Sets the models content according to given contact.
|
|
119 |
* Any previous data will be deleted.
|
|
120 |
*
|
|
121 |
* @param aContact new contact
|
|
122 |
* @param aIconArray icon array that holds the field icons (can be NULL)
|
|
123 |
*/
|
|
124 |
IMPORT_C void SetDataL(
|
|
125 |
const CPbk2PresentationContact& aContact,
|
|
126 |
const CPbk2IconArray* aIconArray );
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Reset Model's content.
|
|
130 |
*/
|
|
131 |
IMPORT_C void Reset();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Getter for text elements
|
|
135 |
*
|
|
136 |
* @param aType text id
|
|
137 |
*/
|
|
138 |
IMPORT_C TPtrC Text( TTextTypes aType ) const;
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Getter for data (binary) elements
|
|
142 |
*
|
|
143 |
* @param aType element id
|
|
144 |
*/
|
|
145 |
IMPORT_C TPtrC8 Data( TBinaryTypes aType ) const;
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Update icon indexes according to aIconArray.
|
|
149 |
*
|
|
150 |
* @param aIconArray new icon array
|
|
151 |
*/
|
|
152 |
IMPORT_C void UpdateIconsL( const CPbk2IconArray& aIconArray );
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Set list box clipper for the model. Used to clip long list text.
|
|
156 |
*
|
|
157 |
* @param aClip text clipper
|
|
158 |
*/
|
|
159 |
IMPORT_C void SetClipListBoxText( MPbk2ClipListBoxText* aClip );
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Link of the active contact. Link refers to contact set with SetDataL().
|
|
163 |
*/
|
|
164 |
IMPORT_C MVPbkContactLink* ContactLink();
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Check if model is empty
|
|
168 |
*/
|
|
169 |
IMPORT_C TBool IsEmpty();
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Listbox model of the contact's details.
|
|
173 |
*/
|
|
174 |
IMPORT_C MDesCArray& ListBoxModel();
|
|
175 |
|
|
176 |
private: // data
|
|
177 |
|
|
178 |
/// Own. Private implementation
|
|
179 |
CSpbContactDataModelPrivate* iImpl;
|
|
180 |
};
|
|
181 |
|
|
182 |
#endif // CSPBCONTACTDATAMODEL_H
|
|
183 |
|
|
184 |
// End of File
|