20
|
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: Phonebook 2 presentation level contact field collection.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CPBK2PRESENTATIONCONTACTFIELDCOLLECTION_H
|
|
21 |
#define CPBK2PRESENTATIONCONTACTFIELDCOLLECTION_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <MVPbkStoreContactFieldCollection.h>
|
|
26 |
|
|
27 |
// FORWARD DECLARATIONS
|
|
28 |
class CPbk2PresentationContactField;
|
|
29 |
class MPbk2FieldPropertyArray;
|
|
30 |
class MPbk2FieldProperty;
|
|
31 |
class CPbk2FieldPropertyGroup;
|
|
32 |
class MVPbkStoreContactField;
|
|
33 |
|
|
34 |
// CLASS DECLARATION
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Phonebook 2 presentation level contact field collection.
|
|
38 |
*/
|
|
39 |
class CPbk2PresentationContactFieldCollection : public CBase,
|
|
40 |
public MVPbkStoreContactFieldCollection
|
|
41 |
{
|
|
42 |
public: // Constructors and destructor
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Creates a new instance of this class.
|
|
46 |
*
|
|
47 |
* @param aFieldProperties An array of field properties.
|
|
48 |
* @param aFieldCollection A collection of store fields.
|
|
49 |
* @param aParentContact The contact that owns this collection.
|
|
50 |
* @return A new instance of this class.
|
|
51 |
*/
|
|
52 |
IMPORT_C static CPbk2PresentationContactFieldCollection* NewL(
|
|
53 |
const MPbk2FieldPropertyArray& aFieldProperties,
|
|
54 |
MVPbkStoreContactFieldCollection& aFieldCollection,
|
|
55 |
MVPbkStoreContact& aParentContact );
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Destructor.
|
|
59 |
*/
|
|
60 |
virtual ~CPbk2PresentationContactFieldCollection();
|
|
61 |
|
|
62 |
public: // Interface
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Returns the presentation level field.
|
|
66 |
*
|
|
67 |
* @param aIndex The index of the field in the array.
|
|
68 |
* @return Presentation level field.
|
|
69 |
*/
|
|
70 |
IMPORT_C CPbk2PresentationContactField& At(
|
|
71 |
TInt aIndex ) const;
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Checks if there is a field with given property in the collection.
|
|
75 |
*
|
|
76 |
* @param aProperty The property to search for.
|
|
77 |
* @return The index of the field or KErrNotFound.
|
|
78 |
*/
|
|
79 |
IMPORT_C TInt ContainsField(
|
|
80 |
const MPbk2FieldProperty& aProperty ) const;
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Checks if the collection contains a field from the group of
|
|
84 |
* properties.
|
|
85 |
*
|
|
86 |
* @param aPropertyGroup A group of field properties.
|
|
87 |
* @return ETrue if the collection has at least one field
|
|
88 |
* with the property in the group.
|
|
89 |
*/
|
|
90 |
IMPORT_C TBool ContainsFieldFromGroup(
|
|
91 |
const CPbk2FieldPropertyGroup& aPropertyGroup ) const;
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Returns the index of the given field or
|
|
95 |
* KErrNotFound if not found.
|
|
96 |
*
|
|
97 |
* @param aField The field that is searched for.
|
|
98 |
* @return The index of the field in this collection.
|
|
99 |
*/
|
|
100 |
IMPORT_C TInt FindFieldIndex(
|
|
101 |
const MVPbkStoreContactField& aField ) const;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Gets the index of the field in the store contact.
|
|
105 |
*
|
|
106 |
* @param aFieldIndex The index of the field in this collection.
|
|
107 |
* @return The index of the field in the
|
|
108 |
* store contact field collection.
|
|
109 |
*/
|
|
110 |
IMPORT_C TInt StoreIndexOfField(
|
|
111 |
TInt aFieldIndex ) const;
|
|
112 |
|
|
113 |
/**
|
|
114 |
* get index if field by store field index
|
|
115 |
*
|
|
116 |
* @param aStoreFieldIndex, a store field's index
|
|
117 |
* @return the index of the field.
|
|
118 |
*/
|
|
119 |
IMPORT_C TInt FieldIndexOfStoreField( TInt aStoreFieldIndex ) const;
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Returns the field properties.
|
|
123 |
*
|
|
124 |
* @return Field properties.
|
|
125 |
*/
|
|
126 |
inline const MPbk2FieldPropertyArray& FieldProperties() const;
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Adds a new field mapping. The field must belong to
|
|
130 |
* the same contact as this field collection.
|
|
131 |
*
|
|
132 |
* @param aField A new store contact field for the mapping.
|
|
133 |
* @param aName A new store contact field property name for the mapping.
|
|
134 |
*/
|
|
135 |
void AddFieldMappingL(const MVPbkStoreContactField& aField,
|
|
136 |
const TDesC& aName);
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Deletes the field mapping from the given index.
|
|
140 |
*
|
|
141 |
* @param aIndex The index from where to remove mapping.
|
|
142 |
*/
|
|
143 |
void RemoveFieldMapping(
|
|
144 |
TInt aIndex );
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Destroys all the field mappings.
|
|
148 |
*/
|
|
149 |
void ResetFieldMappings();
|
|
150 |
|
|
151 |
public: // From MVPbkStoreContactFieldCollection
|
|
152 |
MVPbkBaseContact& ParentContact() const;
|
|
153 |
TInt FieldCount() const;
|
|
154 |
const MVPbkStoreContactField& FieldAt(
|
|
155 |
TInt aIndex ) const;
|
|
156 |
MVPbkStoreContactField& FieldAt(
|
|
157 |
TInt aIndex );
|
|
158 |
MVPbkStoreContactField* FieldAtLC(
|
|
159 |
TInt aIndex ) const;
|
|
160 |
MVPbkStoreContact& ParentStoreContact() const;
|
|
161 |
MVPbkStoreContactField* RetrieveField(
|
|
162 |
const MVPbkContactLink& aContactLink ) const;
|
|
163 |
|
|
164 |
private: // Implementation
|
|
165 |
CPbk2PresentationContactFieldCollection(
|
|
166 |
const MPbk2FieldPropertyArray& aFieldProperties,
|
|
167 |
MVPbkStoreContactFieldCollection& aFieldCollection,
|
|
168 |
MVPbkStoreContact& aParentContact );
|
|
169 |
void ConstructL();
|
|
170 |
|
|
171 |
private: // Data
|
|
172 |
/// Ref: An array of field properties
|
|
173 |
const MPbk2FieldPropertyArray& iFieldProperties;
|
|
174 |
/// Ref: A collection of store fields
|
|
175 |
MVPbkStoreContactFieldCollection& iFieldCollection;
|
|
176 |
/// Ref: The parent contact of the collection
|
|
177 |
MVPbkStoreContact& iParentContact;
|
|
178 |
/// Own: Phonebook 2 presentation contact fields
|
|
179 |
RPointerArray<CPbk2PresentationContactField> iFields;
|
|
180 |
};
|
|
181 |
|
|
182 |
// INLINE IMPLEMENTATION
|
|
183 |
|
|
184 |
// --------------------------------------------------------------------------
|
|
185 |
// CPbk2PresentationContactFieldCollection::FieldProperties
|
|
186 |
// --------------------------------------------------------------------------
|
|
187 |
//
|
|
188 |
inline const MPbk2FieldPropertyArray&
|
|
189 |
CPbk2PresentationContactFieldCollection::FieldProperties() const
|
|
190 |
{
|
|
191 |
return iFieldProperties;
|
|
192 |
}
|
|
193 |
|
|
194 |
#endif // CPBK2PRESENTATIONCONTACTFIELDCOLLECTION_H
|
|
195 |
|
|
196 |
// End of File
|