author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 68 | 9da50d567e3c |
parent 63 | f4a778e096c2 |
child 85 | 38bb213f60ba |
permissions | -rw-r--r-- |
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: Phonebook 2 contact editor dialog implementation. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CPBK2ADAPTIVESEARCHGRIDFILLER_H |
|
20 |
#define CPBK2ADAPTIVESEARCHGRIDFILLER_H |
|
21 |
||
22 |
// INCLUDES |
|
23 |
#include <e32base.h> |
|
24 |
#include <aknsfld.h> |
|
25 |
#include <MPsResultsObserver.h> |
|
26 |
#include "MVPbkViewContact.h" |
|
27 |
||
28 |
// FORWARD DECLARATIONS |
|
29 |
class CAknSearchField; |
|
30 |
class CFindUtil; |
|
31 |
class CPbk2AdaptiveGrid; |
|
32 |
class MVPbkContactViewBase; |
|
33 |
class MPbk2ContactNameFormatter; |
|
34 |
class CPSRequestHandler; |
|
35 |
||
36 |
// CLASS DECLARATION |
|
37 |
||
38 |
/** |
|
39 |
* Phonebook 2 adaptive search grid filler. |
|
40 |
* |
|
41 |
* This class used to create adaptive search grid used to |
|
42 |
* search contacts from Phonebook 2. |
|
43 |
*/ |
|
44 |
NONSHARABLE_CLASS(CPbk2AdaptiveSearchGridFiller) : public CActive, |
|
45 |
public MPsResultsObserver |
|
46 |
{ |
|
47 |
public: // Constructors and destructor |
|
48 |
||
49 |
/** |
|
50 |
* Creates a new instance of this class. |
|
51 |
* |
|
52 |
* @param aField Search field where adaptive search grid is updated. |
|
53 |
*/ |
|
54 |
static CPbk2AdaptiveSearchGridFiller* NewL( CAknSearchField& aField, MPbk2ContactNameFormatter& aNameFormatter ); |
|
55 |
||
56 |
/** |
|
57 |
* Destructor. |
|
58 |
*/ |
|
59 |
virtual ~CPbk2AdaptiveSearchGridFiller(); |
|
60 |
||
61 |
public: // Interface |
|
62 |
||
63 |
/** |
|
64 |
* Start creating adaptive search grid |
|
65 |
* |
|
66 |
* Grid will be created asynchronously. When the grid is updated, it is |
|
67 |
* automatically updated to the CAknSearchField object provided in the |
|
68 |
* construction of this object. Client will not be notified when constructing |
|
69 |
* of the grid is ready. |
|
70 |
* |
|
71 |
* @param aModel contains contacts shown in the list box, this is used |
|
72 |
* to create adaptive search grid |
|
73 |
* @param aFindText is text user has entered in the find pane. |
|
74 |
*/ |
|
75 |
void StartFillingL( const MVPbkContactViewBase& aView, const TDesC& aSearchString, TBool aClearCache ); |
|
76 |
||
77 |
||
78 |
/** |
|
79 |
* Stop creating adaptive search grid |
|
80 |
*/ |
|
81 |
void StopFilling(); |
|
82 |
||
83 |
/** |
|
84 |
* Clear adaptive search grid cache. |
|
85 |
* |
|
86 |
* Data set (contacts shown in the list box) has changed, e.g. contact is removed or added. |
|
87 |
* This means that adaptive search grids used before, cannot be reused. |
|
88 |
*/ |
|
89 |
void ClearCache(); |
|
90 |
||
91 |
||
92 |
/** |
|
93 |
* Invalidate Adaptive Search Grid |
|
94 |
* |
|
95 |
* This means that even if the adaptive search grid doesn't set, it is still given again to the |
|
96 |
* Avkon component. If this is not called, then the grid is given to Avkon components only when |
|
97 |
* it changes. |
|
98 |
*/ |
|
99 |
void InvalidateAdaptiveSearchGrid(); |
|
100 |
||
101 |
||
102 |
/** |
|
103 |
* Change focus back to Adaptive Search Grid |
|
104 |
* |
|
105 |
* This means that even if the "C" key is pressed,the focus will be change to parent control. |
|
106 |
* But actually this operation is done to Adaptive Search Grid. So set the focus back to it. |
|
107 |
*/ |
|
108 |
void SetFocusToAdaptiveSearchGrid(); |
|
109 |
||
110 |
private: // from CActive |
|
111 |
||
112 |
void RunL(); |
|
113 |
void DoCancel(); |
|
114 |
TInt RunError( TInt aError ); |
|
115 |
||
116 |
private: // from MPsResultsObserver |
|
117 |
||
118 |
void HandlePsResultsUpdate( |
|
119 |
RPointerArray<CPsClientData>& searchResults, |
|
120 |
RPointerArray<CPsPattern>& searchSeqs); |
|
121 |
||
122 |
void HandlePsError(TInt aErrorCode); |
|
123 |
||
124 |
void CachingStatus(TCachingStatus& aStatus, TInt& aError); |
|
125 |
||
126 |
private: // Implementation |
|
127 |
||
128 |
CPbk2AdaptiveSearchGridFiller( CAknSearchField& aField, MPbk2ContactNameFormatter& aNameFormatter ); |
|
129 |
void ConstructL(); |
|
130 |
||
131 |
CPbk2AdaptiveGrid* KeyMapFromCache( const TDesC& aFindText ); |
|
132 |
void AddKeyMapToCacheL( const TDesC& aFindText, const TDesC& aKeyMap ); |
|
133 |
void SetAdaptiveGridCharsL( const TInt aMaxSpacesNumber, const TInt aSearchStringSpacesNumber ); |
|
134 |
CDesC16Array* SplitContactFieldTextIntoArrayLC( const TDesC& aText ); |
|
135 |
CDesC16Array* SplitSearchFieldTextIntoArrayLC( const TDesC& aText ); |
|
136 |
void BuildGridL( const TDesC& aContactString, const CDesC16Array* aSearchWords, HBufC*& aKeyMap ); |
|
137 |
TInt NumberOfSpacesInString( const TDesC& aSearchString ); |
|
138 |
// Used to judge if this contact's title include drgraphs |
|
139 |
TBool IsDigraphContactsTitleL(const TDesC& aContactTitle); |
|
140 |
TBool GridFromPsEngineL( const MVPbkContactViewBase& aView ); |
|
141 |
// Check whether the title is empty or not. |
|
142 |
TBool IsActualTitleEmpty( const MVPbkViewContact& aContact ); |
|
68
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
143 |
// Sort the Adaptive Search Grid. |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
144 |
void SortGridL( TBool aAddSpace ); |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
145 |
|
63 | 146 |
private: // Data |
147 |
||
148 |
/// Own: Containts adaptive search grid. |
|
149 |
HBufC* iKeyMap; |
|
150 |
||
151 |
/// Own: Contacts in the model are processed in a steps, this variable is |
|
152 |
/// used to hold the next step. |
|
153 |
TInt iCounter; |
|
154 |
||
155 |
/// Ref: Search field where use enters the text. Responsible to show adaptive search grid. |
|
156 |
CAknSearchField& iSearchField; |
|
157 |
||
158 |
/// Own: Cache adaptive grid keymaps |
|
159 |
RPointerArray<CPbk2AdaptiveGrid> iAdaptiveGridCache; |
|
160 |
||
161 |
/// Ref: View containing contacts. |
|
162 |
const MVPbkContactViewBase* iView; |
|
163 |
||
164 |
/// Ref: Used to format contact name |
|
165 |
MPbk2ContactNameFormatter& iNameFormatter; |
|
166 |
||
167 |
/// Own: Search string used to match contacts |
|
168 |
HBufC* iSearchString; |
|
169 |
||
170 |
/// Own: Find util used to match contacts and construct character grid |
|
171 |
CFindUtil* iFindUtil; |
|
172 |
||
173 |
/// Own: Current adaptive search grid. Used to prevent setting same grid multiple times. |
|
174 |
HBufC* iCurrentGrid; |
|
175 |
||
176 |
/// Used to invalidate grid, even if the grid remains same, it is anyway set if this is set to |
|
177 |
/// ETrue |
|
178 |
TBool iInvalidateAdaptiveSearchGrid; |
|
179 |
||
180 |
/// Used to get the focus for the search pane,when it is true, the search pane will be drawn and get |
|
181 |
/// the focus |
|
182 |
TBool iSetFocusToSearchGrid; |
|
183 |
||
184 |
/// Used to save the contacts' title which include drgraphs |
|
185 |
RPointerArray<HBufC> iDigraphContactsTitleArray; |
|
68
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
186 |
|
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
187 |
/// Used to get the status of feature manager |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
188 |
TBool iFeatureManagerInitialized; |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
189 |
|
63 | 190 |
/// Own: Number of contacts in view |
191 |
TInt iViewItemCount; |
|
192 |
||
193 |
/// Own: Predictive search handler |
|
194 |
CPSRequestHandler* iPsHandler; |
|
195 |
}; |
|
196 |
||
197 |
#endif // CPBK2ADAPTIVESEARCHGRIDFILLER_H |
|
198 |
||
199 |
// End of File |