|
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 names list filtered state. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPBK2NAMESLISTFILTEREDSTATE_H |
|
19 #define CPBK2NAMESLISTFILTEREDSTATE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include "MPbk2NamesListState.h" |
|
24 #include <MPbk2CmdItemVisibilityObserver.h> |
|
25 #include <coecobs.h> |
|
26 #include <badesca.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CPbk2ContactViewListBox; |
|
30 class MPbk2FilteredViewStack; |
|
31 class CAknSearchField; |
|
32 class MPbk2UiControlEventSender; |
|
33 class MPbk2Command; |
|
34 class MPbk2ContactNameFormatter; |
|
35 class CPbk2FindStringSplitter; |
|
36 class CPbk2AdaptiveSearchGridFiller; |
|
37 class CPbk2PredictiveSearchFilter; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Phonebook 2 names list filtered state. |
|
43 */ |
|
44 NONSHARABLE_CLASS(CPbk2NamesListFilteredState) : |
|
45 public CBase, |
|
46 public MPbk2NamesListState, |
|
47 public MPbk2CmdItemVisibilityObserver |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 /** |
|
51 * Creates a new instance of this class. |
|
52 * |
|
53 * @param aParent Parent control. |
|
54 * @param aListBox Reference to the list box. |
|
55 * @param aViewStack A view stack for find box input. |
|
56 * @param aFindBox FindPane Control |
|
57 * @param aEventSender UI control event sender. |
|
58 * @param aNameFormatter Phonebook 2 contact name formatter interface |
|
59 * @param aSearchFilter PBk2 Search Filter |
|
60 * @param aCommandItems Command items possibly shown as nameslist content |
|
61 * @return A new instance of this class. |
|
62 */ |
|
63 static CPbk2NamesListFilteredState* NewLC( |
|
64 const CCoeControl* aParent, |
|
65 CPbk2ContactViewListBox& aListBox, |
|
66 MPbk2FilteredViewStack& aViewStack, |
|
67 CAknSearchField* aFindBox, |
|
68 MPbk2UiControlEventSender& aEventSender, |
|
69 MPbk2ContactNameFormatter& aNameFormatter, |
|
70 CPbk2PredictiveSearchFilter& aSearchFilter, |
|
71 RPointerArray<MPbk2UiControlCmdItem>& aCommandItems ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 ~CPbk2NamesListFilteredState(); |
|
77 |
|
78 public: // From MPbk2NamesListState |
|
79 void ActivateStateL(); |
|
80 void DeactivateState(); |
|
81 TInt CountComponentControls() const; |
|
82 CCoeControl* ComponentControl( |
|
83 TInt aIndex ) const; |
|
84 void SizeChanged(); |
|
85 void MakeComponentsVisible( |
|
86 TBool aVisible ); |
|
87 void ActivateL(); |
|
88 void Draw( |
|
89 const TRect& aRect, |
|
90 CWindowGc& aGc ) const; |
|
91 TKeyResponse OfferKeyEventL( |
|
92 const TKeyEvent& aKeyEvent, |
|
93 TEventCode aType ); |
|
94 void HandlePointerEventL( |
|
95 const TPointerEvent& aPointerEvent ); |
|
96 TInt NamesListState() const; |
|
97 void HandleContactViewEventL( |
|
98 TInt aEvent, |
|
99 TInt aIndex ); |
|
100 void HandleCommandEventL(TInt aEvent, TInt aListboxIndex); |
|
101 CCoeControl& CoeControl(); |
|
102 void HandleControlEventL( |
|
103 CCoeControl* aControl, |
|
104 MCoeControlObserver::TCoeEvent aEventType, TInt aParam ); |
|
105 const MVPbkViewContact* TopContactL(); |
|
106 |
|
107 public: // From MPbk2ContactUiControl |
|
108 MPbk2ContactUiControl* ParentControl() const; |
|
109 TInt NumberOfContacts() const; |
|
110 const MVPbkBaseContact* FocusedContactL() const; |
|
111 const MVPbkViewContact* FocusedViewContactL() const; |
|
112 const MVPbkStoreContact* FocusedStoreContact() const; |
|
113 void SetFocusedContactL( |
|
114 const MVPbkBaseContact& aContact ); |
|
115 void SetFocusedContactL( |
|
116 const MVPbkContactBookmark& aContactBookmark ); |
|
117 void SetFocusedContactL( |
|
118 const MVPbkContactLink& aContactLink ); |
|
119 TInt FocusedContactIndex() const; |
|
120 void SetFocusedContactIndexL( |
|
121 TInt aIndex ); |
|
122 TInt NumberOfContactFields() const; |
|
123 const MVPbkBaseContactField* FocusedField() const; |
|
124 TInt FocusedFieldIndex() const; |
|
125 void SetFocusedFieldIndex( TInt aIndex ); |
|
126 TBool ContactsMarked() const; |
|
127 MVPbkContactLinkArray* SelectedContactsL() const; |
|
128 MVPbkContactLinkArray* SelectedContactsOrFocusedContactL() const; |
|
129 MPbk2ContactLinkIterator* SelectedContactsIteratorL() const; |
|
130 CArrayPtr<MVPbkContactStore>* SelectedContactStoresL() const; |
|
131 void ClearMarks(); |
|
132 void SetSelectedContactL( |
|
133 TInt aIndex, |
|
134 TBool aSelected ); |
|
135 void SetSelectedContactL( |
|
136 const MVPbkContactBookmark& aContactBookmark, |
|
137 TBool aSelected ); |
|
138 void SetSelectedContactL( |
|
139 const MVPbkContactLink& aContactLink, |
|
140 TBool aSelected ); |
|
141 |
|
142 void DynInitMenuPaneL( |
|
143 TInt aResourceId, |
|
144 CEikMenuPane* aMenuPane ) const; |
|
145 void ProcessCommandL( |
|
146 TInt aCommandId ) const; |
|
147 void UpdateAfterCommandExecution(); |
|
148 TInt GetMenuFilteringFlagsL() const; |
|
149 CPbk2ViewState* ControlStateL() const; |
|
150 void RestoreControlStateL( |
|
151 CPbk2ViewState* aState ); |
|
152 const TDesC& FindTextL(); |
|
153 void ResetFindL(); |
|
154 void HideThumbnail(); |
|
155 void ShowThumbnail(); |
|
156 void SetBlank( TBool aBlank ); |
|
157 void RegisterCommand( |
|
158 MPbk2Command* aCommand ); |
|
159 void SetTextL( |
|
160 const TDesC& aText ); |
|
161 TAny* ContactUiControlExtension(TUid aExtensionUid ); |
|
162 |
|
163 public: // From MPbk2ContactUiControl2 |
|
164 TInt CommandItemCount() const; |
|
165 const MPbk2UiControlCmdItem& CommandItemAt( TInt aIndex ) const; |
|
166 const MPbk2UiControlCmdItem* FocusedCommandItem() const; |
|
167 void DeleteCommandItemL( TInt aIndex ); |
|
168 void AddCommandItemL(MPbk2UiControlCmdItem* aCommand, TInt aIndex); |
|
169 |
|
170 public: // From MPbk2PointerEventInspector |
|
171 TBool FocusedItemPointed(); |
|
172 TBool FocusableItemPointed(); |
|
173 TBool SearchFieldPointed(); |
|
174 |
|
175 public: // From MPbk2FilteredViewStackObserver |
|
176 void TopViewChangedL( MVPbkContactViewBase& aOldView ); |
|
177 void TopViewUpdatedL(); |
|
178 void BaseViewChangedL(); |
|
179 void ViewStackError( TInt aError ); |
|
180 void ContactAddedToBaseView( |
|
181 MVPbkContactViewBase& aBaseView, TInt aIndex, |
|
182 const MVPbkContactLink& aContactLink ); |
|
183 |
|
184 |
|
185 private: // From MPbk2CmdItemVisibilityObserver |
|
186 void CmdItemVisibilityChanged( TInt aCmdItemId, TBool aVisible ); |
|
187 |
|
188 private: // Implementation |
|
189 CPbk2NamesListFilteredState( |
|
190 const CCoeControl* aParent, |
|
191 CPbk2ContactViewListBox& aListBox, |
|
192 MPbk2FilteredViewStack& aViewStack, |
|
193 CAknSearchField* aFindBox, |
|
194 MPbk2UiControlEventSender& aEventSender, |
|
195 MPbk2ContactNameFormatter& aNameFormatter, |
|
196 CPbk2PredictiveSearchFilter& aSearchFilter, |
|
197 RPointerArray<MPbk2UiControlCmdItem>& aCommandItems ); |
|
198 void ConstructL(); |
|
199 void HandleFocusChangeL(); |
|
200 void UpdateFindResultL(); |
|
201 void UpdateAdaptiveSearchGridL(); |
|
202 TBool IsContactAtListboxIndex( TInt aListboxIndex ) const; |
|
203 void AllowCommandsToShowThemselves( TBool aVisible ); |
|
204 void UpdateCommandEnabled(TInt aCommandId, TBool aEnabled); |
|
205 void UnmarkCommands() const; |
|
206 TBool IsCommandEnabled( TInt aCommandId) const; |
|
207 TInt FindCommand(TInt aCommandId) const; |
|
208 TInt CalculateListboxIndex(TInt aCommandIndex) const; |
|
209 void UnsubscribeCmdItemsVisibility() const; |
|
210 void SubscribeCmdItemsVisibility(); |
|
211 void HandleListboxEventL(TInt aEvent, TInt aListboxIndex, TBool aMantainFocus); |
|
212 TInt EnabledCommandCount() const; |
|
213 |
|
214 private: // Data |
|
215 /// Ref: Parent coecontrol |
|
216 const CCoeControl& iParent; |
|
217 /// Ref: The list box |
|
218 CPbk2ContactViewListBox& iListBox; |
|
219 /// Own: Buffer for text retrieved from iFindBox |
|
220 HBufC* iFindTextBuf; |
|
221 /// Ref: A stack of control's VPbk views. |
|
222 MPbk2FilteredViewStack& iViewStack; |
|
223 /// Ref: Find box control |
|
224 CAknSearchField* iFindBox; |
|
225 /// Ref: UI control event sender |
|
226 MPbk2UiControlEventSender& iEventSender; |
|
227 /// Ref: Search field indicator |
|
228 TBool iSearchFieldPointed; |
|
229 /// Ref: command in execution |
|
230 MPbk2Command* iCommand; |
|
231 /// Ref: Name formatter |
|
232 MPbk2ContactNameFormatter& iNameFormatter; |
|
233 /// Own: Array of search strings |
|
234 MDesCArray* iStringArray; |
|
235 /// Own: String splitter |
|
236 CPbk2FindStringSplitter* iStringSplitter; |
|
237 /// Own: User to create keymaps for adaptive search grid. |
|
238 CPbk2AdaptiveSearchGridFiller *iAdaptiveSearchGridFiller; |
|
239 ///Ref : Search Pane Filter |
|
240 CPbk2PredictiveSearchFilter& iSearchFilter; |
|
241 /// Ref: Command items |
|
242 RPointerArray<MPbk2UiControlCmdItem>& iCommandItems; |
|
243 }; |
|
244 |
|
245 #endif // CPBK2NAMESLISTFILTEREDSTATE_H |
|
246 |
|
247 // End of File |