|
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 application view. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2NAMESLISTEXVIEW_H |
|
20 #define CPBK2NAMESLISTEXVIEW_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <coecobs.h> |
|
25 #include <MPbk2UIExtensionView.h> |
|
26 #include <MPbk2ControlObserver.h> |
|
27 #include <MPbk2StoreConfigurationObserver.h> |
|
28 #include <MPbk2MenuCommandObserver.h> |
|
29 #include <akntoolbarobserver.h> |
|
30 #include <eiklbo.h> |
|
31 #include <coemain.h> |
|
32 |
|
33 #include <Pbk2Commands.hrh> |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 template<class ControlType> class CPbk2ControlContainer; |
|
37 class CPbk2UIExtensionView; |
|
38 class MPbk2ContactUiControl; |
|
39 class CPbk2NamesListControl; |
|
40 class MVPbkContactViewBase; |
|
41 class MPbk2ContactNameFormatter; |
|
42 class MPbk2CommandHandler; |
|
43 class CPbk2ViewState; |
|
44 class MPbk2PointerEventInspector; |
|
45 class CPbk2IconInfoContainer; |
|
46 class CVPbkContactManager; |
|
47 class CPbk2StoreConfiguration; |
|
48 class MCCAParameter; |
|
49 class MCCAConnection; |
|
50 class CPbk2ContactUiControlProxy; |
|
51 class CAknStylusPopUpMenu; |
|
52 class CPbk2MyCard; |
|
53 class CPbk2ThumbnailManager; |
|
54 class CSpbContentProvider; |
|
55 class CPbk2ContextLaunch; |
|
56 |
|
57 // CLASS DECLARATION |
|
58 |
|
59 /** |
|
60 * Phonebook 2 names list application view. |
|
61 * Responsible for implementing Phonebook application view |
|
62 * interface for names list view. |
|
63 */ |
|
64 class CPbk2NamesListExView : public CBase, |
|
65 public MPbk2UIExtensionView, |
|
66 public MPbk2ControlObserver, |
|
67 public MPbk2StoreConfigurationObserver, |
|
68 public MPbk2MenuCommandObserver, |
|
69 public MAknToolbarObserver, |
|
70 public MCoeControlObserver, |
|
71 public MEikListBoxObserver, |
|
72 private MCoeForegroundObserver |
|
73 { |
|
74 public: // Construction and destruction |
|
75 |
|
76 /** |
|
77 * Creates a new instance of this class. |
|
78 * |
|
79 * @param |
|
80 * @return A new instance of this class. |
|
81 */ |
|
82 static CPbk2NamesListExView* NewL( |
|
83 CPbk2UIExtensionView& aView, |
|
84 CSpbContentProvider& aStatusProvider, |
|
85 MCCAConnection*& aCCAConnection ); |
|
86 |
|
87 /** |
|
88 * Destructor. |
|
89 */ |
|
90 ~CPbk2NamesListExView(); |
|
91 |
|
92 private: // From MPbk2UIExtensionView |
|
93 void HandleCommandL( |
|
94 TInt aCommand ); |
|
95 TUid Id() const; |
|
96 void HandleStatusPaneSizeChange(); |
|
97 void DoActivateL( |
|
98 const TVwsViewId& aPrevViewId, |
|
99 TUid aCustomMessageId, |
|
100 const TDesC8& aCustomMessage ); |
|
101 void DoDeactivate(); |
|
102 void DynInitMenuPaneL( |
|
103 TInt aResourceId, |
|
104 CEikMenuPane* aMenuPane ); |
|
105 void HandleForegroundEventL( |
|
106 TBool aForeground ); |
|
107 CPbk2ViewState* ViewStateLC() const; |
|
108 TBool HandleCommandKeyL( |
|
109 const TKeyEvent& aKeyEvent, |
|
110 TEventCode aType ); |
|
111 void HandlePointerEventL( |
|
112 const TPointerEvent& aPointerEvent ); |
|
113 TInt GetViewSpecificMenuFilteringFlagsL() const; |
|
114 void HandleLongTapEventL( |
|
115 const TPoint& aPenEventLocation, |
|
116 const TPoint& aPenEventScreenLocation); |
|
117 |
|
118 protected: |
|
119 // from MEikListBoxObserver |
|
120 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 private: // From MPbk2ControlObserver |
|
126 void HandleControlEventL( |
|
127 MPbk2ContactUiControl& aControl, |
|
128 const TPbk2ControlEvent& aEvent ); |
|
129 |
|
130 public: // From MPbk2StoreConfigurationObserver |
|
131 void ConfigurationChanged(); |
|
132 void ConfigurationChangedComplete(); |
|
133 |
|
134 public: // From MPbk2MenuCommandObserver |
|
135 void PreCommandExecutionL( |
|
136 const MPbk2Command& aCommand ); |
|
137 void PostCommandExecutionL( |
|
138 const MPbk2Command& aCommand ); |
|
139 |
|
140 public: |
|
141 TBool IsRclOnL(); |
|
142 |
|
143 /** |
|
144 * Getter for MyCard instance which can be NULL. |
|
145 * Ownership NOT transferred to callee. |
|
146 * |
|
147 * @return Mycard object |
|
148 */ |
|
149 CPbk2MyCard* MyCard() const; |
|
150 |
|
151 private: // From MAknToolbarObserver |
|
152 void DynInitToolbarL( |
|
153 TInt aResourceId, |
|
154 CAknToolbar* aToolbar ); |
|
155 void OfferToolbarEventL( |
|
156 TInt aCommand ); |
|
157 |
|
158 private: // From MCoeControlObserver |
|
159 void HandleControlEventL( |
|
160 CCoeControl* aControl, |
|
161 TCoeEvent aEventType ); |
|
162 |
|
163 private: // Implementation |
|
164 CPbk2NamesListExView( |
|
165 CPbk2UIExtensionView& aView, |
|
166 CSpbContentProvider& aStatusProvider, |
|
167 MCCAConnection*& aCCAConnection ); |
|
168 void ConstructL(); |
|
169 void ConstructToolbarL(); |
|
170 void CreateControlsL(); |
|
171 void StoreStateL(); |
|
172 void RestoreStateL(); |
|
173 void UpdateCbasL(); |
|
174 static TInt IdleSaveToolbarStateL( |
|
175 TAny* aSelf ); |
|
176 void AttachAIWProvidersL(); |
|
177 void UpdateListEmptyTextL( |
|
178 TInt aListState ); |
|
179 void Reset(); |
|
180 void ShowToolbarOnViewActivation(TBool aShown); |
|
181 static TInt IdleSetEmptyTextL( |
|
182 TAny* aSelf ); |
|
183 void DimItem( CEikMenuPane* aMenuPane, TInt aCmd ); |
|
184 void ShowContextMenuL(); |
|
185 void AddCommandItemsToContainerL(); |
|
186 TBool NeedToHideToolbar(TInt aCurrentCommand); |
|
187 TBool IsPhoneMemoryUsedL() const; |
|
188 |
|
189 private: // From MCoeForegroundObserver |
|
190 void HandleGainingForeground(); |
|
191 void HandleLosingForeground(); |
|
192 |
|
193 private: // Data |
|
194 CPbk2UIExtensionView& iView; |
|
195 /// This view's control container type |
|
196 typedef CPbk2ControlContainer<CPbk2NamesListControl> CContainer; |
|
197 /// Own: This view's control container |
|
198 CContainer* iContainer; |
|
199 /// Ref: This view's control |
|
200 CPbk2NamesListControl* iControl; |
|
201 /// Ref: Pointer event inspector |
|
202 MPbk2PointerEventInspector* iPointerEventInspector; |
|
203 /// Ref: Virtual Phonebook contact manager |
|
204 CVPbkContactManager* iContactManager; |
|
205 /// Ref: Reference to the name formatter |
|
206 MPbk2ContactNameFormatter* iNameFormatter; |
|
207 /// Ref: Command handler |
|
208 MPbk2CommandHandler* iCommandHandler; |
|
209 /// Own: Stored control state |
|
210 CPbk2ViewState* iControlState; |
|
211 /// Own: Control state passed as parameter |
|
212 CPbk2ViewState* iParamState; |
|
213 /// Ref: Toolbar |
|
214 CAknToolbar* iToolbar; |
|
215 /// Own: Toolbar state indicator |
|
216 TBool iToolbarVisible; |
|
217 /// Own: Toolbar state is saved with the help of an idle object |
|
218 CIdle* iIdleToolbarWarden; |
|
219 /// Own: Stylus popup menu state indicator |
|
220 TBool iStylusPopupMenuLaunched; |
|
221 /// Own: Toolbar icon container |
|
222 CPbk2IconInfoContainer* iToolbarIcons; |
|
223 /// Own: ETrue, if any selection modifier key is depressed |
|
224 TBool iSelectionModifierUsed; |
|
225 /// Ref: Phonebook store configuration |
|
226 CPbk2StoreConfiguration* iStoreConfiguration; |
|
227 /// Own: Idle empty text setter |
|
228 CIdle* iIdleTexter; |
|
229 /// Own: List state |
|
230 TInt iListState; |
|
231 /// Own: Command state, indicates one command is alerady in execution. |
|
232 TBool iCommandState; |
|
233 /// Own: Proxy between commands and contact ui control |
|
234 CPbk2ContactUiControlProxy* iControlProxy; |
|
235 /// Own: contains current command id, if under execution. |
|
236 /// Value is -1 if no command is executing |
|
237 TInt iCurrentCommandId; |
|
238 /// Own: control visible state, indicates if the control is visible before |
|
239 /// hide in background. |
|
240 TBool iCtrlVisibleStateBeforeLosingForground; |
|
241 /// Own: indicates whether the names list view is first time activated |
|
242 TBool iFirstTimeActivated; |
|
243 /// Ref: Popup menu |
|
244 CAknStylusPopUpMenu* iPopupMenu; |
|
245 |
|
246 /// Own: |
|
247 CPbk2MyCard* iMyCard; |
|
248 // If the application is brought to the foreground too fast after being set to the |
|
249 // backgroung the find box is not initialized properly by Avkon. |
|
250 // In practise this means tapping the appshell icon for this application BEFORE |
|
251 // the application has completed losing foreground actions. What happens in the |
|
252 // background is that the find box setfocus is called when the phonebook appui is |
|
253 // still in the background. |
|
254 // This flag is used to force the find box focus to be re-initialized when the |
|
255 // application is back in the foreground. |
|
256 TBool iNeedSetFocus; |
|
257 |
|
258 // Own: thumnail manager for social phonebook |
|
259 CPbk2ThumbnailManager* iThumbManager; |
|
260 // REF: content provider |
|
261 CSpbContentProvider& iContentProvider; |
|
262 // Not own. CCA launcher connection |
|
263 MCCAConnection*& iCCAConnection; |
|
264 /// Own: Context launcher |
|
265 CPbk2ContextLaunch* iContextLauncher; |
|
266 }; |
|
267 |
|
268 #endif // CPBK2NAMESLISTEXVIEW_H |
|
269 |
|
270 // End of File |