|
1 /* |
|
2 * Copyright (c) 2006 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: Container class for search view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCASEARCHVIEWCONTAINER_H |
|
21 #define CCASEARCHVIEWCONTAINER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "MCASearchObserverInterfacePC.h" |
|
25 #include "MCALayoutChangeObserver.h" |
|
26 #include "MCAServiceStateObserver.h" |
|
27 #include "TEnumsPC.h" |
|
28 |
|
29 |
|
30 #include <bldvariant.hrh> |
|
31 #include <eiklbo.h> |
|
32 #include <coecntrl.h> |
|
33 |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CAknDoubleStyleListBox; |
|
37 class MCAViewSwitcher; |
|
38 class MCARecipientObserver; |
|
39 class CCABlockingUI; |
|
40 class CAknTitlePane; |
|
41 class MCASearchInterfacePC; |
|
42 class MCASearchDataPC; |
|
43 class CCACommandManager; |
|
44 class CCAAppUi; |
|
45 |
|
46 |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * Container class for search view |
|
52 * |
|
53 * @lib chatng.app |
|
54 * @since 3.2 |
|
55 */ |
|
56 class CCASearchViewContainer : public CCoeControl, |
|
57 public MEikListBoxObserver, |
|
58 public MCASearchObserverInterfacePC, |
|
59 public MCALayoutChangeObserver, |
|
60 public MCAServiceStateObserver |
|
61 { |
|
62 public: |
|
63 |
|
64 // Type of search |
|
65 enum TSearchType |
|
66 { |
|
67 ESearchGroups = 0, |
|
68 ESearchUsers |
|
69 }; |
|
70 |
|
71 |
|
72 public: // Constructors and destructor |
|
73 |
|
74 /* |
|
75 * Static constructor |
|
76 * @param aSearchInterfacePC ,search Interface |
|
77 * @param aRect ref. to Parent rect |
|
78 * @param aViewSwitcher ref. to View switcher |
|
79 * @param aMenuObserver ref. to recipient observer |
|
80 * @param aSearchUsers is true if Search is of type ESearchUsers |
|
81 * @param aGroupSyncDone is true if Search is of type ESearchGroups |
|
82 * @param aListId ref. to ListId of the contact to be added |
|
83 */ |
|
84 static CCASearchViewContainer* NewL( |
|
85 MCASearchInterfacePC* aSearchInterfacePC, |
|
86 const TRect& aRect, MCAViewSwitcher& aViewSwitcher, |
|
87 MCARecipientObserver& aMenuObserver, |
|
88 TBool aSearchUsers, |
|
89 TBool aGroupSyncDone, |
|
90 const TDesC& aListId ); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 virtual ~CCASearchViewContainer(); |
|
96 |
|
97 /** |
|
98 * From CCoeControl |
|
99 */ |
|
100 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
101 |
|
102 protected: |
|
103 |
|
104 /** |
|
105 * Default Symbian OS constructor. |
|
106 * @param aRect Parent rect |
|
107 * @param aListId ref. to ListId of the contact to be added |
|
108 */ |
|
109 void ConstructL( const TRect& aRect, const TDesC& aListId ); |
|
110 |
|
111 /* |
|
112 * Constructor |
|
113 * @param aSearchInterfacePC ,search Interface process component |
|
114 * @param aViewSwitcher ref. to View switcher |
|
115 * @param aMenuObserver ref. to recipient observer |
|
116 * @param aSearchUsers is true if Search is of type ESearchUsers |
|
117 * @param aGroupSyncDone is true if Search is of type ESearchGroups |
|
118 */ |
|
119 CCASearchViewContainer( MCASearchInterfacePC* aSearchInterfacePC, |
|
120 MCAViewSwitcher& aViewSwitcher, |
|
121 MCARecipientObserver& aMenuObserver, |
|
122 TBool aSearchUsers, |
|
123 TBool aGroupSyncDone ); |
|
124 |
|
125 public: // New functions |
|
126 |
|
127 /** |
|
128 * This method shows search type dialog |
|
129 */ |
|
130 TBool DisplaySearchTypeDlgL(); |
|
131 |
|
132 /** |
|
133 * This method shows search criteria dialog |
|
134 * @param aSearchType Type of search ESearchGroups|ESearchUsers |
|
135 */ |
|
136 static TBool DisplaySearchCriteriaDlgL( const TSearchType aSearchType ); |
|
137 |
|
138 /** |
|
139 * This method shows search string data query |
|
140 * @param aSearchCriteria specifies Search Criteria eg ESearchUserName etc. |
|
141 */ |
|
142 static TBool DisplaySearchStringQueryL( |
|
143 TEnumsPC::TSearchCriteria aSearchCriteria ); |
|
144 |
|
145 /** |
|
146 * This method is called when users' search criteria is ESearchUserName |
|
147 */ |
|
148 static TBool DisplayMultiLineDataQueryL( ); |
|
149 |
|
150 /** |
|
151 * This method returns current search type |
|
152 * @return ESearchGroups or ESearchUser |
|
153 */ |
|
154 TSearchType SearchType() const; |
|
155 |
|
156 /** |
|
157 * Searches more results. |
|
158 */ |
|
159 void SearchMoreL(); |
|
160 |
|
161 /** |
|
162 * Searches previous results. |
|
163 */ |
|
164 void SearchPreviousL(); |
|
165 |
|
166 /** |
|
167 * Sets the observer to NULL so we cannot receive notifications anymore. |
|
168 */ |
|
169 void SetObserverToNull(); |
|
170 |
|
171 /** |
|
172 * Saves focused group to favourite. |
|
173 */ |
|
174 void SaveAsFavouriteL(); |
|
175 |
|
176 /** |
|
177 * Adds contact to friends |
|
178 */ |
|
179 void AddToFriendsL(); |
|
180 |
|
181 /** |
|
182 * Starts conversation with contact |
|
183 */ |
|
184 void StartConversationL(); |
|
185 |
|
186 /** |
|
187 * Invites contact |
|
188 */ |
|
189 void InviteL(); |
|
190 |
|
191 /** |
|
192 * Ends search. Called when left search view |
|
193 */ |
|
194 void EndSearchL(); |
|
195 |
|
196 /** |
|
197 * Starts new search |
|
198 */ |
|
199 void NewSearchL(); |
|
200 |
|
201 /** |
|
202 * Joins to selected group |
|
203 */ |
|
204 void JoinToGroupL(); |
|
205 |
|
206 /** |
|
207 * Blocks selected person |
|
208 */ |
|
209 void BlockUserL(); |
|
210 |
|
211 /** |
|
212 * Checks if user is blocked |
|
213 * @return ETrue if blocked |
|
214 */ |
|
215 TBool IsBlocked() const; |
|
216 |
|
217 /** |
|
218 * this method returns handle to listbox |
|
219 * @return handle to listbox |
|
220 */ |
|
221 CEikListBox* ListBox() const; |
|
222 |
|
223 /** |
|
224 * this method returns search data |
|
225 * @return searchdata |
|
226 */ |
|
227 TPtrC SearchData() const; |
|
228 |
|
229 /** |
|
230 * This method returns the onlinestatus of currently selected contact |
|
231 * returns EFalse if the contact is offline or |
|
232 * if the selected item is group |
|
233 * @return ETrue if online contact |
|
234 */ |
|
235 TBool IsOnline() const; |
|
236 |
|
237 /** |
|
238 * Displays text query for blocking users |
|
239 */ |
|
240 void BlockUserWVIdL(); |
|
241 |
|
242 /** |
|
243 * Displays unblock query |
|
244 */ |
|
245 void UnBlockL(); |
|
246 |
|
247 /** |
|
248 * Displays blocked list |
|
249 */ |
|
250 void DisplayBlockedListL(); |
|
251 |
|
252 /** |
|
253 * This method checks if there is more results available |
|
254 * @return EFalse if the search cannot be continued and |
|
255 * ETrue if the search can be continued. |
|
256 */ |
|
257 TBool MoreResultsAvailable() const; |
|
258 |
|
259 /** |
|
260 * This method checks if there is previous results available |
|
261 * @return EFalse if the search hasn't any previous results |
|
262 * ETrue if there is any previous results |
|
263 */ |
|
264 TBool PrevResultsAvailable() const; |
|
265 |
|
266 /* |
|
267 * Get the storage type of this group and check if it is a persistent grp. |
|
268 * If the group is marked as favourite, then it will be persistent |
|
269 * @return ETrue if favourite else EFalse |
|
270 */ |
|
271 TBool IsFavouriteChatGroup() const; |
|
272 |
|
273 /** |
|
274 * After search we must update "the view" list box. |
|
275 * @param aGroup specifies whether this is group or not. |
|
276 */ |
|
277 void UpdateListBoxL( TBool aGroup ); |
|
278 |
|
279 /** |
|
280 * Group synchronization has been done |
|
281 */ |
|
282 void SetGroupSyncDone(); |
|
283 |
|
284 /** |
|
285 * List id of list where possible new contact is added. |
|
286 */ |
|
287 const TDesC& ListId() const; |
|
288 |
|
289 /** |
|
290 * Make this object responsible for destroying itself. |
|
291 * Destroying happens after the asynchronous task is complete. |
|
292 * Deletion is asynchronous so the object might not be destroyed |
|
293 * before this method returns. |
|
294 * @return None |
|
295 */ |
|
296 void DeleteSelfD(); |
|
297 |
|
298 /** |
|
299 * sets the primary and secondary text of this view |
|
300 * |
|
301 * |
|
302 */ |
|
303 void SetEmptyTextsToListboxL(); |
|
304 |
|
305 private: // Functions from MCASearchObserverInterfacePC |
|
306 |
|
307 /** |
|
308 * @see MCASearchObserverInterfacePC |
|
309 */ |
|
310 void HandleSearchError( TInt aErrorCode ); |
|
311 |
|
312 /** |
|
313 * @see MCASearchObserverInterfacePC |
|
314 */ |
|
315 void HandleSearchFinished( ); |
|
316 |
|
317 private: // From MCALayoutChangeObserver |
|
318 |
|
319 /** |
|
320 * Called when layout/skins change |
|
321 * @since 3.2 |
|
322 */ |
|
323 void LayoutChangedL( TInt aType ); |
|
324 |
|
325 private: // MCAServiceStateObserver |
|
326 |
|
327 /** |
|
328 * @see MCAServiceStateObserver |
|
329 */ |
|
330 void HandleServiceStateChangeL( TServiceState aState ); |
|
331 |
|
332 private: // New functions |
|
333 |
|
334 /** |
|
335 * Starts search procedure |
|
336 * @param aSearchPairs CSearchPairs |
|
337 */ |
|
338 void StartSearchL( ); |
|
339 |
|
340 /** |
|
341 * CIdle-kind of function for background task implementation |
|
342 * @param aInstance Instance of this class |
|
343 * @return Need for recall |
|
344 */ |
|
345 static TInt BackgroundTasks( TAny *aInstance ); |
|
346 |
|
347 /** |
|
348 * Real implementation of background tasks |
|
349 * @return Need for recall |
|
350 */ |
|
351 TInt DoBackgroundTasks(); |
|
352 |
|
353 /** |
|
354 * Startup container. |
|
355 * Show wait note or the search type dialog |
|
356 * @return ETrue if call this again, EFalse if not (for CIdle) |
|
357 */ |
|
358 TBool ContainerStartL(); |
|
359 |
|
360 private: // Functions from base classes |
|
361 |
|
362 /** |
|
363 * From MEikListBoxObserver, Handles event's generated by listbox |
|
364 * @param aListBox Pointer to listbox from where this event originated |
|
365 * @param aEventType Type of event received. |
|
366 */ |
|
367 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
368 |
|
369 /** |
|
370 * From CoeControl, Handles "size changed"-events.. |
|
371 */ |
|
372 void SizeChanged(); |
|
373 |
|
374 /** |
|
375 * From CoeControl, Returns the number of control contained by this class. |
|
376 * @return Number of controls contained |
|
377 */ |
|
378 TInt CountComponentControls() const; |
|
379 |
|
380 /** |
|
381 * From CCoeControl, Returns handle to control pointed by aIndex |
|
382 * @param aIndex Wanted control's index [0..n] |
|
383 * @return Handle to wanted control |
|
384 */ |
|
385 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
386 |
|
387 /** |
|
388 * From CCoeControl, Handles key-events |
|
389 * @param aEvent Event that occured |
|
390 * @param aType Type of key-event (EEventKey, EEventKeyUp or EEventKeyDown) |
|
391 * @return Containers response to event (EKeyWasNotConsumed/ EKeyWasConsumed) |
|
392 */ |
|
393 TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aType ); |
|
394 |
|
395 /** |
|
396 * Gets help context |
|
397 */ |
|
398 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
399 |
|
400 /** |
|
401 * Fetches presence information of the contacts. |
|
402 * @param aLowIndex is the lowest index whose presence we can get. |
|
403 * @param aHighIndex is the highest. |
|
404 */ |
|
405 void FetchPresenceL( const TInt aLowIndex, const TInt aHighIndex ); |
|
406 |
|
407 /** |
|
408 * From CCoeControl. |
|
409 * Handle focus event change. |
|
410 * @see CCoeControl |
|
411 */ |
|
412 void FocusChanged( TDrawNow aDrawNow ); |
|
413 |
|
414 |
|
415 |
|
416 private: //New functions |
|
417 |
|
418 /** |
|
419 * This function updates text to navi pane |
|
420 * @param aEndSearch specifies if this happens in end search |
|
421 * or elsewhere. |
|
422 */ |
|
423 void UpdateNaviPaneTextL( TBool aEndSearch ); |
|
424 |
|
425 /** |
|
426 * Clears list box contents. I.e. item array. |
|
427 */ |
|
428 void ClearListBoxContents(); |
|
429 |
|
430 private: // Data |
|
431 |
|
432 //Owns |
|
433 CAknDoubleStyleListBox* iListBox; |
|
434 |
|
435 //Pointer to SearchInterfacePC,doesnt own |
|
436 MCASearchInterfacePC* iSearchInterfacePC; |
|
437 |
|
438 //Pointer to SearchDataPC,doesnt own |
|
439 MCASearchDataPC* iSearchDataPC; |
|
440 |
|
441 //View switching interface |
|
442 MCAViewSwitcher& iViewSwitcher; |
|
443 |
|
444 //Owns. Blocking UI side |
|
445 CCABlockingUI* iBlockingUI; |
|
446 |
|
447 // Search type |
|
448 TSearchType iSearchType; |
|
449 |
|
450 // Previously used search type |
|
451 TSearchType iPreviousSearchType; |
|
452 |
|
453 // Current page number |
|
454 TInt iCurrentResultPage; |
|
455 |
|
456 // How many pages of results we have |
|
457 TInt iTotalResultPages; |
|
458 |
|
459 |
|
460 // Information indexes to the search data |
|
461 TInt iLowIndex; |
|
462 TInt iHighIndex; |
|
463 TInt iNextSearchIndex; |
|
464 |
|
465 // Owns: This array describes online users. |
|
466 // These users are users that are online in one search. |
|
467 CDesCArrayFlat* iOnlinePresenceList; |
|
468 //Owns |
|
469 CDesCArray* iItemArray; |
|
470 //Online friends |
|
471 RArray<TBool> iOnlineArray; |
|
472 |
|
473 MCARecipientObserver& iMenuObserver; |
|
474 |
|
475 // Are there previous results |
|
476 TBool iPreviousResultsShowing; |
|
477 |
|
478 // Owns. |
|
479 CIdle* iIdle; |
|
480 |
|
481 // Is this container responsible to destroy itself |
|
482 // when the async task is complete. |
|
483 TBool iDeleteFlag; |
|
484 |
|
485 // Is async task complete (ETrue) or not |
|
486 TBool iTaskComplete; |
|
487 |
|
488 // are we searching users (ETrue) or groups (EFalse) |
|
489 TBool iSearchUsers; |
|
490 |
|
491 // group synchronization done (ETrue) or not |
|
492 TBool iGroupSyncDone; |
|
493 |
|
494 // wait note visible (ETrue) |
|
495 TBool iWaitVisible; |
|
496 |
|
497 /// List id of added contact, if needed. |
|
498 HBufC* iListId; |
|
499 |
|
500 //Doesn't own, pointer to CCAAppUi |
|
501 CCAAppUi* iAppUi; |
|
502 |
|
503 //Doesn't own, Pointer to CCACommandManager |
|
504 CCACommandManager* iCommandManager; |
|
505 |
|
506 }; |
|
507 |
|
508 #endif // CCASEARCHVIEWCONTAINER_H |
|
509 |
|
510 // End of File |