63
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: An icon array for Phonebook 2 icons.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPBK2ICONARRAY_H
|
|
20 |
#define CPBK2ICONARRAY_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <Pbk2IconArrayId.hrh>
|
|
25 |
|
|
26 |
// FORWARD DECLARATIONS
|
|
27 |
class CGulIcon;
|
|
28 |
class TResourceReader;
|
|
29 |
class CPbk2IconInfoContainer;
|
|
30 |
class MPbk2FieldPropertyArray;
|
|
31 |
class CPbk2IconFactory;
|
|
32 |
class TPbk2IconId;
|
|
33 |
class CPbk2IconInfo;
|
|
34 |
|
|
35 |
// CLASS DECLARATION
|
|
36 |
|
|
37 |
/**
|
|
38 |
* An icon array for Phonebook 2 icons.
|
|
39 |
* Responsible for:
|
|
40 |
* - specializing icon array for Phonebook
|
|
41 |
*/
|
|
42 |
class CPbk2IconArray : public CArrayPtrFlat<CGulIcon>
|
|
43 |
{
|
|
44 |
public: // Constructors and destructor
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Constructs an array of core Phonebook 2 icons
|
|
48 |
* specified in the resource.
|
|
49 |
*
|
|
50 |
* @param aReader A resource reader pointed
|
|
51 |
* to PBK2_ICON_ARRAY resource.
|
|
52 |
* @return A new instance of this class.
|
|
53 |
*/
|
|
54 |
IMPORT_C static CPbk2IconArray* NewL(
|
|
55 |
TResourceReader& aReader);
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Constructs a core Phonebook 2 field type icon array.
|
|
59 |
* Adds qgn_indi_marked_add into first position as the
|
|
60 |
* Avkon needs that. Adds also en empty icon qgn_prop_nrtyp_empty
|
|
61 |
* to make it always available.
|
|
62 |
* The id of this array is EPbk2FieldTypeIconArrayId
|
|
63 |
* after the construction.
|
|
64 |
*
|
|
65 |
* @param aFieldProperties Phonebook 2 field properties. Reference
|
|
66 |
* is not saved but used in construction
|
|
67 |
* only.
|
|
68 |
* @return A new instance of this class.
|
|
69 |
*/
|
|
70 |
IMPORT_C static CPbk2IconArray* NewL(
|
|
71 |
const MPbk2FieldPropertyArray& aFieldProperties );
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Constructs an icon array using a given icon info container.
|
|
75 |
*
|
|
76 |
* @param aReader A resource reader pointed
|
|
77 |
* to PBK2_ICON_ARRAY resource.
|
|
78 |
* @param aIconInfoContainer Icon infos that are needed in
|
|
79 |
* icon creation.
|
|
80 |
* @return A new instance of this class.
|
|
81 |
*/
|
|
82 |
IMPORT_C static CPbk2IconArray* NewL(
|
|
83 |
TResourceReader& aReader,
|
|
84 |
const CPbk2IconInfoContainer& aIconInfoContainer );
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Destructor. Calls ResetAndDestroy.
|
|
88 |
*/
|
|
89 |
~CPbk2IconArray();
|
|
90 |
|
|
91 |
public: // Interface
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Returns the Phonebook 2 icon array id.
|
|
95 |
*
|
|
96 |
* @return ID of the icon array.
|
|
97 |
*/
|
|
98 |
IMPORT_C TPbk2IconArrayId Id() const;
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns the index of the icon with aIconId in this array.
|
|
102 |
*
|
|
103 |
* @param aIconId Icon id to search for.
|
|
104 |
* @return Index of the icon or KErrNotFound if not found.
|
|
105 |
*/
|
|
106 |
IMPORT_C TInt FindIcon(
|
|
107 |
const TPbk2IconId& aIconId ) const;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* This function first calls FindIcon, and if it doesn't find
|
|
111 |
* the icon it creates it by using core Phonebook 2 icons.
|
|
112 |
* The created icon is then appended to this array.
|
|
113 |
* If the icon id is defined in Phonebook UI extension then
|
|
114 |
* it is not possible to create it by using this function.
|
|
115 |
*
|
|
116 |
* @param aIconId Icon id to search for.
|
|
117 |
* @return Index of the icon or KErrNotFound if not found.
|
|
118 |
*/
|
|
119 |
IMPORT_C TInt FindAndCreateIconL(
|
|
120 |
const TPbk2IconId& aIconId );
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Appends new icons from given resource to this array.
|
|
124 |
* Doesn't change the if of this array.
|
|
125 |
*
|
|
126 |
* @param aReader Resource reader pointed to
|
|
127 |
* PBK2_ICON_ARRAY resource.
|
|
128 |
* @param aIconInfoContainer Icon infos that are needed in
|
|
129 |
* icon creation.
|
|
130 |
*/
|
|
131 |
IMPORT_C void AppendIconsFromResourceL(
|
|
132 |
TResourceReader& aReader,
|
|
133 |
const CPbk2IconInfoContainer& aIconInfoContainer );
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Refreshes core Phonebook 2 icons.
|
|
137 |
*/
|
|
138 |
IMPORT_C void RefreshL();
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Refreshes the icons from the given container.
|
|
142 |
*
|
|
143 |
* @param aIconInfoContainer The container of icons to refresh.
|
|
144 |
*/
|
|
145 |
IMPORT_C void RefreshL(
|
|
146 |
const CPbk2IconInfoContainer& aIconInfoContainer );
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Appends a new icon to this array. Takes ownership of the icon.
|
|
150 |
* Doesn't change the if of this array.
|
|
151 |
*
|
|
152 |
* @param aIcon Icon to appended. Ownership of the icon
|
|
153 |
* is taken.
|
|
154 |
*/
|
|
155 |
IMPORT_C void AppendIconL(
|
|
156 |
CGulIcon* aIcon,
|
|
157 |
const TPbk2IconId& aIconId );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Appends a new icon to this array.
|
|
161 |
*
|
|
162 |
* @param aIconInfo Icon to be appended. Ownership of the
|
|
163 |
* iconInfo is taken.
|
|
164 |
*/
|
|
165 |
IMPORT_C void AppendIconL(
|
|
166 |
CPbk2IconInfo* aIconInfo );
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Removes icon from the CArrayPtrFlat - array and the TPbk2IconId from the iIdMap - array
|
|
170 |
*
|
|
171 |
* @param aIconId Icon id to be removed
|
|
172 |
* @return KErrNone if success, KErrNotfound if icon is not found
|
|
173 |
*/
|
|
174 |
IMPORT_C TInt RemoveIcon(
|
|
175 |
const TPbk2IconId& aIconId );
|
|
176 |
|
|
177 |
private: // Implementation
|
|
178 |
CPbk2IconArray();
|
|
179 |
void BaseConstructL();
|
|
180 |
void ConstructL();
|
|
181 |
void ConstructL(
|
|
182 |
TResourceReader& aReader );
|
|
183 |
void ConstructL(
|
|
184 |
const MPbk2FieldPropertyArray& aFieldProperties );
|
|
185 |
void ConstructL(
|
|
186 |
TResourceReader& aReader,
|
|
187 |
const CPbk2IconInfoContainer& aIconInfoContainer );
|
|
188 |
void AppendDefaultIconsL(
|
|
189 |
const CPbk2IconFactory& aIconFactory );
|
|
190 |
void DoAppendIconsFromResourceL(
|
|
191 |
TResourceReader& aReader,
|
|
192 |
const CPbk2IconFactory& aIconFactory,
|
|
193 |
TBool aUpdateId );
|
|
194 |
void AppendIconWithMappingL(
|
|
195 |
const CPbk2IconFactory& aIconFactory,
|
|
196 |
const TPbk2IconId& aIconId );
|
|
197 |
void ReserveMemoryL(
|
|
198 |
TInt aAmount );
|
|
199 |
void DoRefreshL(
|
|
200 |
const CPbk2IconFactory& aFactory );
|
|
201 |
|
|
202 |
private: // Data
|
|
203 |
/// Own: The ID of this icon array
|
|
204 |
TPbk2IconArrayId iArrayId;
|
|
205 |
/// Own: An array which maps icon Ids to indexes in this array
|
|
206 |
class CIdArray;
|
|
207 |
CIdArray* iIdMap;
|
|
208 |
/// Own: Factory for creating icons
|
|
209 |
CPbk2IconFactory* iIconFactory;
|
|
210 |
};
|
|
211 |
|
|
212 |
#endif // CPBK2ICONARRAY_H
|
|
213 |
|
|
214 |
// End of File
|