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 contact view list box model.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPBK2CONTACTVIEWLISTBOXMODEL_H
|
|
20 |
#define CPBK2CONTACTVIEWLISTBOXMODEL_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include "MPbk2ContactViewListBoxModel.h"
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <TPbk2IconId.h>
|
|
26 |
#include <AknUtils.h>
|
|
27 |
#include <CPcsDefs.h>
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class MVPbkContactViewBase;
|
|
31 |
class MVPbkViewContact;
|
|
32 |
class CPbk2IconArray;
|
|
33 |
class MPbk2ContactNameFormatter;
|
|
34 |
class CVPbkContactManager;
|
|
35 |
class CPbk2StorePropertyArray;
|
|
36 |
class MVPbkBaseContactFieldCollection;
|
|
37 |
class MPbk2ClipListBoxText;
|
|
38 |
class MPbk2ContactUiControlExtension;
|
|
39 |
class CPbk2ContactIconsUtils;
|
|
40 |
class CPsQuery;
|
|
41 |
class CPSRequestHandler;
|
|
42 |
|
|
43 |
// CLASS DECLARATION
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Phonebook 2 contact view list box model.
|
|
47 |
* Responsible for:
|
|
48 |
* - formatting lines to a list box used in a contact view
|
|
49 |
*/
|
|
50 |
NONSHARABLE_CLASS(CPbk2ContactViewListBoxModel) :
|
|
51 |
public CBase,
|
|
52 |
public MPbk2ContactViewListBoxModel
|
|
53 |
{
|
|
54 |
public: // Types
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Model initialization parameters class.
|
|
58 |
*/
|
|
59 |
class TParams
|
|
60 |
{
|
|
61 |
public: // Constructor
|
|
62 |
/**
|
|
63 |
* C++ Constructor.
|
|
64 |
*/
|
|
65 |
TParams(){}
|
|
66 |
|
|
67 |
public: // Input parameters
|
|
68 |
|
|
69 |
/// MANDATORY: Contact manager
|
|
70 |
const CVPbkContactManager* iContactManager;
|
|
71 |
// MANDATORY: Contact view
|
|
72 |
MVPbkContactViewBase* iView;
|
|
73 |
/// MANDATORY: Store properties
|
|
74 |
CPbk2StorePropertyArray* iStoreProperties;
|
|
75 |
/// MANDATORY: Name formatter
|
|
76 |
MPbk2ContactNameFormatter* iNameFormatter;
|
|
77 |
/// MANDATORY: Icon array to use
|
|
78 |
CPbk2IconArray* iIconArray;
|
|
79 |
/// OPTIONAL: Id of the empty icon in iIconArray
|
|
80 |
TPbk2IconId iEmptyId;
|
|
81 |
/// OPTIONAL: Id of the default icon to use for all list
|
|
82 |
TPbk2IconId iDefaultId;
|
|
83 |
/// OPTIONAL: For clipping list box rows from beginning
|
|
84 |
MPbk2ClipListBoxText* iClipListBoxText;
|
|
85 |
/// OPTIONAL: Extension point to UI control
|
|
86 |
MPbk2ContactUiControlExtension* iUiExtension;
|
|
87 |
/// MANDATORY: Use Multiselection-specific icons layout
|
|
88 |
/// Place icon after the text
|
|
89 |
TBool iMultiselection;
|
|
90 |
};
|
|
91 |
|
|
92 |
public: // Constructors and destructor
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Creates a new instance of this class.
|
|
96 |
*
|
|
97 |
* @param aParams Parameters for the model.
|
|
98 |
* @return A new instance of this class.
|
|
99 |
*/
|
|
100 |
static CPbk2ContactViewListBoxModel* NewL(
|
|
101 |
CPbk2ContactViewListBoxModel::TParams& aParams );
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Destructor.
|
|
105 |
*/
|
|
106 |
~CPbk2ContactViewListBoxModel();
|
|
107 |
|
|
108 |
|
|
109 |
public: // From MPbk2ContactViewListBoxModel
|
|
110 |
TInt MdcaCount() const;
|
|
111 |
TPtrC MdcaPoint(
|
|
112 |
TInt aIndex ) const;
|
|
113 |
void SetUnnamedText(
|
|
114 |
const TDesC* aText );
|
|
115 |
HBufC* GetContactTitleLC( TInt aIndex ) const;
|
|
116 |
|
|
117 |
protected: // Implementation
|
|
118 |
CPbk2ContactViewListBoxModel(
|
|
119 |
CPbk2ContactViewListBoxModel::TParams& aParams );
|
|
120 |
void ConstructL(CPbk2StorePropertyArray* aStoreProperties,
|
|
121 |
MPbk2ContactUiControlExtension* aUiExtension);
|
|
122 |
virtual void FormatBufferL(
|
|
123 |
const TInt aIndex ) const;
|
|
124 |
void FormatEmptyBuffer() const;
|
|
125 |
virtual void FormatBufferForContactL(
|
|
126 |
const MVPbkViewContact& aViewContact,
|
|
127 |
TInt aIndex ) const;
|
|
128 |
void AppendName(
|
|
129 |
const TDesC& aName ) const;
|
|
130 |
void AppendIconIndex(
|
|
131 |
const TPbk2IconId& aIconId) const;
|
|
132 |
void AppendTrailingIcons(
|
|
133 |
const TArray<TPbk2IconId>& aIds,
|
|
134 |
TInt aStartIndex ) const;
|
|
135 |
void AppendTrailingIcon(
|
|
136 |
const TPbk2IconId& aIconId) const;
|
|
137 |
|
|
138 |
void HandleError(
|
|
139 |
TInt aError ) const;
|
|
140 |
TBool CutFromBeginningFieldL(
|
|
141 |
const MVPbkBaseContactFieldCollection& aContactFields ) const;
|
|
142 |
|
|
143 |
public:
|
|
144 |
/**
|
|
145 |
* Return last Predictive Search query.
|
|
146 |
* This object is used in underlying and bookmark restoring.
|
|
147 |
* All Predictive Search result is valid only for one query.
|
|
148 |
* @return pointer to the last PCS query object.
|
|
149 |
*/
|
|
150 |
const CPsQuery* LastPCSQuery() const;
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Get mathes part from data model object.
|
|
154 |
* Data model uses mathes patterns returned from Predictive Search server.
|
|
155 |
* This method is added for bidirectional languages.
|
|
156 |
|
|
157 |
* @param aSearchData The input data to be searched.
|
|
158 |
* @param aMatchLocation The list matched index and length of match
|
|
159 |
*/
|
|
160 |
void GetMatchingPartsL( const TDesC& aSearchData,
|
|
161 |
RArray<TPsMatchLocation>& aMatchLocation);
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Returns the instance of the request handler object for the Predicitve Search application
|
|
165 |
*
|
|
166 |
* @return pointer to the CPSRequestHandler.
|
|
167 |
*/
|
|
168 |
CPSRequestHandler* PSHandler() const;
|
|
169 |
|
|
170 |
private: // Definitions
|
|
171 |
|
|
172 |
enum
|
|
173 |
{
|
|
174 |
/// Maximum length of a formatted list box item text
|
|
175 |
EMaxListBoxText = 256
|
|
176 |
};
|
|
177 |
|
|
178 |
protected: // Data
|
|
179 |
/// Ref: Virtual Phonebook contact manager
|
|
180 |
const CVPbkContactManager& iContactManager;
|
|
181 |
/// Ref: Contact view this list box model is attached to
|
|
182 |
const MVPbkContactViewBase* iView;
|
|
183 |
/// Ref: Contact name formatter
|
|
184 |
MPbk2ContactNameFormatter& iNameFormatter;
|
|
185 |
/// Ref: Buffer where to format list box texts
|
|
186 |
TDes& iBuffer;
|
|
187 |
/// Own: Buffer for formatted list box item text
|
|
188 |
TBuf<EMaxListBoxText> iFormattingBuffer;
|
|
189 |
/// Ref: Text to use for unnamed items
|
|
190 |
const TDesC* iUnnamedText;
|
|
191 |
/// Ref: Icon index mapping array
|
|
192 |
const CPbk2IconArray* iIconArray;
|
|
193 |
/// Own: Empty icon id
|
|
194 |
TPbk2IconId iEmptyIconId;
|
|
195 |
/// Own: Default icon id to use for all rows if EPbk2NullIconId
|
|
196 |
TPbk2IconId iDefaultIconId;
|
|
197 |
/// Own: Previous view cont
|
|
198 |
mutable TInt iPreviousCount;
|
|
199 |
/// Ref: Clip listbox row text
|
|
200 |
MPbk2ClipListBoxText* iClipListBoxText;
|
|
201 |
// Own: get icons for a contact
|
|
202 |
CPbk2ContactIconsUtils* iContactIcons;
|
|
203 |
/// indicates whether to place the first icon at the A-column
|
|
204 |
const TBool iIconsStartAtZero;
|
|
205 |
/// indicates whether to show one icon or all
|
|
206 |
const TBool iIconsOnlyOne;
|
|
207 |
//Flag to indicate Feature manager initilization
|
|
208 |
TBool iFeatureManagerInitilized ;
|
|
209 |
};
|
|
210 |
|
|
211 |
#endif // CPBK2CONTACTVIEWLISTBOXMODEL_H
|
|
212 |
|
|
213 |
// End of File
|