1 /* |
|
2 * Copyright (c) 2008 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: Definition of the class CPbkxRclSearchResultDlg. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBKXRCLSEARCHRESULTDIALOG_H |
|
20 #define CPBKXRCLSEARCHRESULTDIALOG_H |
|
21 |
|
22 #include <coemain.h> |
|
23 #include <eiklbo.h> // MEikListBoxObserver |
|
24 #include "cpbkxrclbasedlg.h" |
|
25 #include "pbkxrclengineconstants.h" |
|
26 #include "fsccontactactionmenudefines.h" //"pbkxcontactactionmenudefines.h" |
|
27 |
|
28 |
|
29 class CAknNavigationControlContainer; |
|
30 class CAknNavigationDecorator; |
|
31 class CContactCard; |
|
32 class CPbkContactEngine; |
|
33 class CPbkxRclActionServiceWrapper; |
|
34 class CPbkxContactActionMenu; |
|
35 class CGulIcon; |
|
36 class CFscContactActionMenu; |
|
37 |
|
38 /** |
|
39 * Dialog for showing remote contact lookup search results. |
|
40 * |
|
41 * Offers menu options and acion menu to initiate actions for contacts. |
|
42 */ |
|
43 class CPbkxRclSearchResultDlg : |
|
44 public CPbkxRclBaseDlg, |
|
45 public MEikListBoxObserver, |
|
46 public MCoeForegroundObserver |
|
47 { |
|
48 public: // constructor and destructor |
|
49 |
|
50 /** |
|
51 * Creates new object and returns pointer to it. |
|
52 * |
|
53 * @param aIndex Index which user selected from the list (probably not used?) |
|
54 * @param aArray Array of items. |
|
55 * @param aCommand Command observer for observing menu commands. |
|
56 * @param aContactItems Contact items to be shown on the dialog. |
|
57 * @param aContactEngine Contact engine for creating pbk contact items. |
|
58 * @param aActionService Action service wrapper. |
|
59 * @param aNaviText Navi text to be displayed. |
|
60 * @param aContactSelectorEnabled Flag indicating whether RCL is in contact |
|
61 * selector mode or not. |
|
62 * @return Created object. |
|
63 */ |
|
64 static CPbkxRclSearchResultDlg* NewL( |
|
65 TInt &aIndex, |
|
66 CDesCArray* aArray, |
|
67 MEikCommandObserver* aCommand, |
|
68 RPointerArray<CContactCard>& aContactItems, |
|
69 CPbkContactEngine& aContactEngine, |
|
70 CPbkxRclActionServiceWrapper& aActionService, |
|
71 TBool aContactSelectorEnabled ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 virtual ~CPbkxRclSearchResultDlg(); |
|
77 |
|
78 public: // methods from base classes |
|
79 |
|
80 /** |
|
81 * Hides menu items that are not usable. |
|
82 * |
|
83 * @param aResourceId Menu resource id. |
|
84 * @param aMenu Menu pane. |
|
85 */ |
|
86 virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane ); |
|
87 |
|
88 /** |
|
89 * Gets help context for this view. |
|
90 * |
|
91 * @param aContext On return, contains help context information |
|
92 */ |
|
93 virtual void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
94 |
|
95 /** |
|
96 * Dialog is popped on foreground. |
|
97 */ |
|
98 virtual void HandleGainingForeground(); |
|
99 |
|
100 /** |
|
101 * Dialog is popped background. |
|
102 */ |
|
103 virtual void HandleLosingForeground(); |
|
104 |
|
105 public: // new methods |
|
106 |
|
107 /** |
|
108 * Executes dialog and destroys it after dialog is closed. |
|
109 */ |
|
110 void ExecuteLD(); |
|
111 |
|
112 /** |
|
113 * Returns index of the currently selected item. |
|
114 * |
|
115 * @return Index of the currently selected item. |
|
116 */ |
|
117 TInt CurrentItemIndex() const; |
|
118 |
|
119 /** |
|
120 * Sets index of the currently selected item. |
|
121 * |
|
122 * @param aIndex Index to be set. |
|
123 */ |
|
124 void SetCurrentItemIndexL( TInt aIndex ); |
|
125 |
|
126 /** |
|
127 * Sets current contact to action service. |
|
128 * |
|
129 * This affect menu item visibility. |
|
130 */ |
|
131 void SetCurrentContactToActionServiceL(); |
|
132 |
|
133 /** |
|
134 * Closes dialog. |
|
135 */ |
|
136 void Close(); |
|
137 |
|
138 /** |
|
139 * Updates search result dialog. |
|
140 * |
|
141 * @param aNaviText New navi text. |
|
142 */ |
|
143 void UpdateDialogL(); |
|
144 |
|
145 /** |
|
146 * Sends business card of the currently selected contact. |
|
147 */ |
|
148 void SendBusinessCardL(); |
|
149 |
|
150 //Fix for: PKAO-7NNCJ2 |
|
151 /** |
|
152 * Informs dialog that info dialog is visible. |
|
153 */ |
|
154 void InfoDlgVisible( TBool aVisible ); |
|
155 |
|
156 |
|
157 protected: // redefinition of functions of the base class |
|
158 |
|
159 /** |
|
160 * From CAknSelectionListDialog. |
|
161 * |
|
162 * Handles key events. |
|
163 * |
|
164 * @param aKeyEvent Key event. |
|
165 * @param aType Type of the key event. |
|
166 * @return Key response (handled/not handled). |
|
167 */ |
|
168 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
169 |
|
170 // MEikListBoxObserver |
|
171 |
|
172 /** |
|
173 * Listbox event handler. |
|
174 * |
|
175 * @param aListBox that invoked the event. |
|
176 * @param aEventType Type of the event. |
|
177 */ |
|
178 virtual void HandleListBoxEventL( |
|
179 CEikListBox* aListBox, |
|
180 TListBoxEvent aEventType ); |
|
181 |
|
182 |
|
183 TBool OkToExitL( TInt aButtonId ); |
|
184 |
|
185 private: // methods used internally |
|
186 |
|
187 /** |
|
188 * Sets up status pane. |
|
189 */ |
|
190 void SetupStatusPaneL(); |
|
191 |
|
192 /** |
|
193 * Updates status pane. |
|
194 */ |
|
195 void UpdateStatusPaneL(); |
|
196 |
|
197 /** |
|
198 * Resets status pane. |
|
199 */ |
|
200 void ResetStatusPane(); |
|
201 |
|
202 /** |
|
203 * Creates list box entries. |
|
204 */ |
|
205 void CreateListBoxEntriesL(); |
|
206 |
|
207 /** |
|
208 * Creates list box icons. |
|
209 */ |
|
210 void CreateListBoxIconsL(); |
|
211 |
|
212 /** |
|
213 * Creates given list box entry. |
|
214 * |
|
215 * @param aIndex Index of the list box entry. |
|
216 */ |
|
217 void CreateListBoxEntryL( TInt aIndex ); |
|
218 |
|
219 /** |
|
220 * Updates given list box entry. |
|
221 * |
|
222 * @param aIndex List box entry index. |
|
223 */ |
|
224 void UpdateListBoxEntryL( TInt aIndex ); |
|
225 |
|
226 /** |
|
227 * Loads navi text from resources. |
|
228 * |
|
229 * @return Navi text. |
|
230 */ |
|
231 void LoadNaviTextL(); |
|
232 |
|
233 /** |
|
234 * Returns ETrue if there is at least one call action available. |
|
235 * |
|
236 * @return ETrue if there is at least one call action available. |
|
237 */ |
|
238 TBool CallActionsAvailable() const; |
|
239 |
|
240 /** |
|
241 * Creates and initializes action menu. |
|
242 */ |
|
243 void InitializeActionMenuL(); |
|
244 |
|
245 /** |
|
246 * Shows action menu and handles possible custom command. |
|
247 */ |
|
248 void ShowActionMenuL(); |
|
249 |
|
250 /** |
|
251 * Calculates action menu position based on currently selected |
|
252 * item. |
|
253 * |
|
254 * @return Action menu position. |
|
255 */ |
|
256 TFscContactActionMenuPosition GetActionMenuPosition(); |
|
257 |
|
258 /** |
|
259 * Returns ETrue if action menu is available. |
|
260 * |
|
261 * @return ETrue if action menu is available. |
|
262 */ |
|
263 TBool ActionMenuAvailable() const; |
|
264 |
|
265 /** |
|
266 * Creates and adds save as contact action to action menu. |
|
267 */ |
|
268 void CreateAndAddSaveAsContactActionL(); |
|
269 |
|
270 /** |
|
271 * Returns ETrue if scrolling is in progress. |
|
272 * |
|
273 * Scrolling means that user is pressing up or down arrow so that |
|
274 * it creates multiple key presses. |
|
275 * |
|
276 * @return ETrue if scrolling is enabled. |
|
277 */ |
|
278 TBool ScrollingInProgress() const; |
|
279 |
|
280 /** |
|
281 * This method is called when scrolling has stopped. |
|
282 */ |
|
283 void ScrollingStoppedL(); |
|
284 |
|
285 private: // constructors |
|
286 |
|
287 /** |
|
288 * Constructor. |
|
289 * |
|
290 * @param aIndex Index which user selected from the list (probably not used?) |
|
291 * @param aArray Array of items. |
|
292 * @param aCommand Command observer for observing menu commands. |
|
293 * @param aContactItems Contact items to be shown on the dialog. |
|
294 * @param aContactEngine Contact engine for creating pbk contact items. |
|
295 * @param aActionService For executing menu commands. |
|
296 * @param aContactSelectorEnabled Flag indicating whether RCL is in contact |
|
297 * selector mode or not. |
|
298 */ |
|
299 CPbkxRclSearchResultDlg( |
|
300 TInt& aIndex, |
|
301 CDesCArray* aArray, |
|
302 MEikCommandObserver* aCommand, |
|
303 RPointerArray<CContactCard>& aContactItems, |
|
304 CPbkContactEngine& aContactEngine, |
|
305 CPbkxRclActionServiceWrapper& aActionService, |
|
306 TBool aContactSelectorEnabled ); |
|
307 |
|
308 |
|
309 /** |
|
310 * Second-phase constructor. |
|
311 * |
|
312 * @param aNaviText Navi text to be displayed. |
|
313 */ |
|
314 void ConstructL(); |
|
315 |
|
316 /** |
|
317 * Constructs menu bar. |
|
318 * |
|
319 * @param aResourceId - menubar resource id |
|
320 */ |
|
321 void ConstructMenuBarL( TInt aResourceId ); |
|
322 |
|
323 private: // data |
|
324 |
|
325 // Indexes of icon array. |
|
326 enum TIconIndex |
|
327 { |
|
328 EActionMenuEnabled = 0 // Action menu enabled icon |
|
329 }; |
|
330 |
|
331 // Contact engine. |
|
332 CPbkContactEngine& iContactEngine; |
|
333 |
|
334 // Contact action service wrapper. Used to execute menu commands. |
|
335 CPbkxRclActionServiceWrapper& iContactActionService; |
|
336 |
|
337 // Contact action menu for executing commands. Owned. |
|
338 CFscContactActionMenu* iActionMenu; |
|
339 |
|
340 // Items. Not owned. |
|
341 CDesCArray* iItems; |
|
342 |
|
343 // Navi pane of the current UI application. Not owned. |
|
344 CAknNavigationControlContainer* iNaviPane; |
|
345 |
|
346 // Navigation label to be shown while result dialog is shown. Owned. |
|
347 CAknNavigationDecorator* iNaviDecorator; |
|
348 |
|
349 // Contact items. Not owned. |
|
350 RPointerArray<CContactCard>& iContactItems; |
|
351 |
|
352 // Flag indicating if contact selector is enabled. |
|
353 TBool iContactSelectorEnabled; |
|
354 |
|
355 // Flag indicating whether dialog should be closed after processing user command. |
|
356 TBool iClose; |
|
357 |
|
358 // Selected item index. |
|
359 TInt& iSelectedItemIndex; |
|
360 |
|
361 // Navigation label text. Owned. |
|
362 RBuf iNaviText; |
|
363 |
|
364 // Icon for add recipient action menu item. Owned. |
|
365 CGulIcon* iAddRecipientIcon; |
|
366 |
|
367 // Flag indicating whether save as contact action menu item is |
|
368 // already added. |
|
369 TBool iSaveAsAdded; |
|
370 |
|
371 // Set when dialog is exiting. After that no key presses are handled. |
|
372 TBool iExit; |
|
373 |
|
374 // Flag indicating that up or down arrow is held down. |
|
375 TBool iKeyDown; |
|
376 |
|
377 // Counter how many keypresses has occurred since key has been pressed |
|
378 // down. |
|
379 TInt iKeyCounter; |
|
380 |
|
381 //Fix for: PWAN-7MC7WA |
|
382 //Flag indicating that CAS query was performed |
|
383 TBool iIsScrollLaunched; |
|
384 |
|
385 //Fix for: PKAO-7NNCJ2 |
|
386 //Flag indicating that info dialog is visible. Owned. |
|
387 TBool iIsInfoDlgVisible; |
|
388 }; |
|
389 |
|
390 #endif |
|