|
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: Implementation for CVIMPSTUiSearchView. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "cvimpstuisearchview.h" |
|
22 #include "cvimpstuisearchviewcontrol.h" |
|
23 |
|
24 #include "cvimpstuisearchfieldaray.h" |
|
25 #include "cvimpstuisearchquerydialog.h" |
|
26 |
|
27 #include "cvimpstcmdhandler.h" |
|
28 #include "vimpstcmd.hrh" |
|
29 |
|
30 #include "mvimpstengine.h" |
|
31 #include "vimpstextentionuiuid.h" |
|
32 #include "tvimpstconsts.h" |
|
33 #include "cvimpstuiextensionservice.h" |
|
34 #include "vimpstutilsdialog.h" |
|
35 #include "vimpstcmd.hrh" |
|
36 #include "mvimpstcmd.h" |
|
37 #include "vimpstutilswaitnote.h" |
|
38 #include "vimpstui.hrh" |
|
39 #include "tvimpstconsts.h" |
|
40 |
|
41 #include "mvimpstengineextentionfeatures.h" |
|
42 #include "mvimpstenginesearchmgrextention.h" |
|
43 |
|
44 #include "cvimpstuistatuspanehandler.h" |
|
45 // System includes |
|
46 #include <eikmenup.h> |
|
47 #include <eikbtgpc.h> |
|
48 #include <avkon.rsg> |
|
49 #include <aknnotewrappers.h> |
|
50 #include <StringLoader.h> |
|
51 #include <eikenv.h> |
|
52 |
|
53 // Pbk2 |
|
54 #include <MPbk2AppUi.h> |
|
55 #include <CPbk2UIExtensionView.h> |
|
56 #include <MPbk2ViewActivationTransaction.h> |
|
57 #include <MPbk2ViewExplorer.h> |
|
58 #include <CPbk2ViewState.h> |
|
59 #include <MPbk2StartupMonitor.h> |
|
60 #include <Pbk2Commands.hrh> |
|
61 |
|
62 // xSP extension manager |
|
63 #include "MxSPViewMapper.h" |
|
64 #include "MxSPContactManager.h" |
|
65 |
|
66 //resource |
|
67 #include <extensionmanagerres.rsg> |
|
68 #include <vimpstuires.rsg> |
|
69 |
|
70 // System includes |
|
71 #include <AknGlobalNote.h> |
|
72 #include <aknnavi.h> |
|
73 #include <aknnavide.h> |
|
74 #include <StringLoader.h> |
|
75 #include <avkon.rsg> |
|
76 #include <eikbtgpc.h> |
|
77 #include <eikmenup.h> |
|
78 #include <avkon.hrh> |
|
79 #include <eikspane.h> |
|
80 #include <StringLoader.h> |
|
81 #include "uiservicetabtracer.h" |
|
82 |
|
83 // help launch |
|
84 #include <hlplch.h> |
|
85 #include <coehelp.h> |
|
86 #include "meco.hlp.hrh" |
|
87 using namespace Phonebook2; |
|
88 |
|
89 // ================= MEMBER FUNCTIONS ======================= |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CVIMPSTUiSearchView::CVIMPSTUiSearchView |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
|
95 CVIMPSTUiSearchView::CVIMPSTUiSearchView( |
|
96 MxSPViewMapper& aMapper, |
|
97 MxSPContactManager& aContactManager, |
|
98 TUint aSearchViewId, |
|
99 TUint aServiceId, |
|
100 CPbk2UIExtensionView& aView, |
|
101 TUid /*aId*/, |
|
102 CVIMPSTUIExtensionService& aServiceData, |
|
103 MVIMPSTEngine& aEngine, |
|
104 MVIMPSTCmdHandler& aCommandHandler ) : |
|
105 CxSPBaseView( aMapper, aContactManager, aView ), |
|
106 iSearchViewId( aSearchViewId ), |
|
107 iServiceId(aServiceId), |
|
108 iEngine(aEngine), |
|
109 iExtensionService( aServiceData ), |
|
110 iCommandHandler( aCommandHandler ) |
|
111 |
|
112 { |
|
113 |
|
114 } |
|
115 |
|
116 // -------------------------------------------------------------------------- |
|
117 // CVIMPSTUiSearchView::ConstructL |
|
118 // -------------------------------------------------------------------------- |
|
119 // |
|
120 void CVIMPSTUiSearchView::ConstructL() |
|
121 { |
|
122 TRACER_AUTO; |
|
123 ViewBaseConstructL( KIMCONTACTSEXTNIMPLEMENTATIONUID, iSearchViewId ); |
|
124 |
|
125 //Get SearchMgr |
|
126 MVIMPSTEngineExtentionFeatures* feature = iEngine.ExtentionFeatures(TVIMPSTEnums::ESearch); |
|
127 if (feature) |
|
128 { |
|
129 MVIMPSTEngineSearchMgrExtention& searchMgr = |
|
130 MVIMPSTEngineSearchMgrExtention::Cast |
|
131 (*feature); |
|
132 |
|
133 searchMgr.RegisterObserver(this); |
|
134 } |
|
135 iCallBack = new ( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ); |
|
136 } |
|
137 |
|
138 |
|
139 // -------------------------------------------------------------------------- |
|
140 // CVIMPSTUiSearchView::NewL |
|
141 // -------------------------------------------------------------------------- |
|
142 // |
|
143 CVIMPSTUiSearchView* CVIMPSTUiSearchView::NewL( MxSPViewMapper& aMapper, |
|
144 MxSPContactManager& aContactManager, |
|
145 TUint aSearchViewId, |
|
146 TUint aServiceId, |
|
147 CPbk2UIExtensionView& aView, |
|
148 TUid aId, |
|
149 CVIMPSTUIExtensionService& aServiceData, |
|
150 MVIMPSTEngine& aEngine, |
|
151 MVIMPSTCmdHandler& aCommandHandler ) |
|
152 { |
|
153 CVIMPSTUiSearchView* self = new(ELeave) CVIMPSTUiSearchView( aMapper, |
|
154 aContactManager, |
|
155 aSearchViewId, |
|
156 aServiceId, |
|
157 aView, |
|
158 aId, |
|
159 aServiceData, |
|
160 aEngine, |
|
161 aCommandHandler); |
|
162 CleanupStack::PushL(self); |
|
163 self->ConstructL(); |
|
164 CleanupStack::Pop(self); |
|
165 return self; |
|
166 } |
|
167 |
|
168 |
|
169 |
|
170 // --------------------------------------------------------- |
|
171 // CVIMPSTUiSearchView::~CVIMPSTUiSearchView() |
|
172 // C++ Destructor |
|
173 // --------------------------------------------------------- |
|
174 // |
|
175 CVIMPSTUiSearchView::~CVIMPSTUiSearchView() |
|
176 { |
|
177 |
|
178 //Get SearchMgr |
|
179 MVIMPSTEngineExtentionFeatures* feature = iEngine.ExtentionFeatures(TVIMPSTEnums::ESearch); |
|
180 if (feature) |
|
181 { |
|
182 MVIMPSTEngineSearchMgrExtention& searchMgr = |
|
183 MVIMPSTEngineSearchMgrExtention::Cast |
|
184 (*feature); |
|
185 |
|
186 searchMgr.UnRegisterObserver(this); |
|
187 } |
|
188 |
|
189 delete iNaviDecorator; |
|
190 if (iContainer) |
|
191 { |
|
192 CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer); |
|
193 delete iContainer; |
|
194 } |
|
195 delete iCallBack; |
|
196 } |
|
197 |
|
198 |
|
199 // --------------------------------------------------------- |
|
200 // CVIMPSTUiSearchView::HandleCommandL( TInt aCommand ) |
|
201 // This class handles all commands from menu |
|
202 // --------------------------------------------------------- |
|
203 // |
|
204 void CVIMPSTUiSearchView::HandleCommandL( TInt aCommand ) |
|
205 { |
|
206 TRACER_AUTO; |
|
207 switch ( aCommand ) |
|
208 { |
|
209 //Next two commands have same function |
|
210 case EAknSoftkeyBack: |
|
211 { |
|
212 |
|
213 // this might get called when the view is not active |
|
214 // back key pressed, activate tabbed view. |
|
215 // CPbk2ViewState is not utilized here, but here the |
|
216 // focused contact info could be delivered to next view, if required later |
|
217 CPbk2ViewState* state = NULL; |
|
218 |
|
219 TInt tabViewId; |
|
220 TInt err = iMapper.GetNewView( KIMCONTACTSEXTNIMPLEMENTATIONUID, |
|
221 iExtensionService.TabbedViewId(), |
|
222 tabViewId ); |
|
223 User::LeaveIfError( err ); |
|
224 Pbk2AppUi()->Pbk2ViewExplorer()->ActivatePhonebook2ViewL( |
|
225 TUid::Uid(tabViewId), |
|
226 state ); |
|
227 |
|
228 break; |
|
229 } |
|
230 |
|
231 case ESearchNew: |
|
232 { |
|
233 SearchContactsL(); |
|
234 break; |
|
235 } |
|
236 case ESearchPrev: |
|
237 { |
|
238 CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; |
|
239 informationNote->ExecuteLD(KNotSupportedMessage); |
|
240 break; |
|
241 } |
|
242 case ESearchMore: |
|
243 { |
|
244 CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; |
|
245 informationNote->ExecuteLD(KNotSupportedMessage); |
|
246 break; |
|
247 } |
|
248 case ESearchAddFriends: |
|
249 { |
|
250 |
|
251 HBufC* userId = iContainer->GetFocusedContactLC() ; |
|
252 if ( userId->Length() ) |
|
253 { |
|
254 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_SERVTAB_SAVING_CONTACT,ETrue ); |
|
255 iCommandHandler.HandleCommandL(EAddContact,this,userId); |
|
256 CleanupStack::PopAndDestroy( note ); |
|
257 CleanupStack::PopAndDestroy( userId ); |
|
258 } |
|
259 |
|
260 break; |
|
261 } |
|
262 |
|
263 case ESearchOpenConversation: |
|
264 { |
|
265 HBufC* userId = iContainer->GetFocusedContactLC() ; |
|
266 if ( userId->Length() ) |
|
267 { |
|
268 iContainer->OpenConversationL( *userId ); |
|
269 } |
|
270 CleanupStack::PopAndDestroy( userId ); |
|
271 break; |
|
272 } |
|
273 case EAknCmdHelp: |
|
274 { |
|
275 LaunchHelpL( KSERVTAB_HLP_SEARCH ); |
|
276 break; |
|
277 } |
|
278 case EAknSoftkeyExit: |
|
279 case ECmdExit: |
|
280 { |
|
281 Pbk2AppUi()->HandleCommandL( EAknSoftkeyExit ); |
|
282 break; |
|
283 } |
|
284 |
|
285 default: |
|
286 { |
|
287 Pbk2AppUi()->HandleCommandL( aCommand ); |
|
288 break; |
|
289 } |
|
290 |
|
291 } |
|
292 } |
|
293 |
|
294 // --------------------------------------------------------- |
|
295 // CVIMPSTUiSearchView::DynInitMenuPaneL() |
|
296 // Initialises menu pane when needed |
|
297 // (other items were commented in a header). |
|
298 // --------------------------------------------------------- |
|
299 // |
|
300 void CVIMPSTUiSearchView::DynInitMenuPaneL( TInt aResourceId, |
|
301 CEikMenuPane* aMenuPane ) |
|
302 { |
|
303 TRACER_AUTO; |
|
304 if( aResourceId == R_EXTENSION_MANAGER_MENU) |
|
305 { |
|
306 //add search view menu items |
|
307 aMenuPane->AddMenuItemsL( R_SERVTAB_SEARCH_VIEW_MENU ); |
|
308 //add general menu items - help and exit |
|
309 aMenuPane->AddMenuItemsL( R_TABBED_VIEW_GENERAL_MENU ); |
|
310 |
|
311 aMenuPane->SetItemDimmed(ECmdChangeConnectioninWaitingState,ETrue); |
|
312 aMenuPane->SetItemDimmed(ECmdChangeConnectioninOnlineState,ETrue); |
|
313 |
|
314 aMenuPane->SetItemDimmed(ECmdLogin,ETrue); |
|
315 aMenuPane->SetItemDimmed(ECmdLogout,ETrue); |
|
316 aMenuPane->SetItemDimmed(ECmdCancelLogin,ETrue); |
|
317 aMenuPane->SetItemDimmed(ECmdSettings,ETrue); |
|
318 |
|
319 aMenuPane->SetItemDimmed(ESearchPrev, ETrue); |
|
320 aMenuPane->SetItemDimmed(ESearchMore, ETrue); |
|
321 aMenuPane->SetItemDimmed(ECmdGetBlockedList, ETrue); |
|
322 TInt index = KErrNotFound; |
|
323 if(iContainer) |
|
324 { |
|
325 index = iContainer->ListBox()->CurrentItemIndex(); |
|
326 } |
|
327 if( index == KErrNotFound ) |
|
328 { |
|
329 aMenuPane->SetItemDimmed( ESearchAddFriends, ETrue ); |
|
330 aMenuPane->SetItemDimmed( ESearchOpenConversation, ETrue ); |
|
331 } |
|
332 else if( HideAddToContactsL()) //contact is there in his contact list |
|
333 { |
|
334 HBufC* contactId = iContainer->GetFocusedContactLC() ; |
|
335 TVIMPSTEnums::TOnlineStatus onlinestatus = TVIMPSTEnums::EUnknown; |
|
336 if ( contactId->Length() ) |
|
337 { |
|
338 TInt index = iCommandHandler.GetProcessInterface().FindContactIndexL(*contactId); |
|
339 onlinestatus = iCommandHandler.GetProcessInterface().GetOnlineStatusL(index); |
|
340 CleanupStack::PopAndDestroy(contactId); |
|
341 } |
|
342 if( TVIMPSTEnums::EPending == onlinestatus )//contacts pr status is pending hide open convrsation |
|
343 { |
|
344 aMenuPane->SetItemDimmed( ESearchOpenConversation, ETrue ); |
|
345 } |
|
346 aMenuPane->SetItemDimmed( ESearchAddFriends, ETrue ); |
|
347 |
|
348 } |
|
349 |
|
350 else //contact is not there in his contactlist |
|
351 { |
|
352 aMenuPane->SetItemDimmed( ESearchOpenConversation, ETrue ); |
|
353 } |
|
354 |
|
355 } |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------- |
|
359 // CVIMPSTUiSearchView::DoActivateViewL() |
|
360 // Activates view |
|
361 // (other items were commented in a header). |
|
362 // --------------------------------------------------------- |
|
363 // |
|
364 void CVIMPSTUiSearchView::DoActivateViewL( const TVwsViewId& aPrevViewId, |
|
365 TUid /*aCustomMessageId*/, |
|
366 const TDesC8& /*aCustomMessage*/ ) |
|
367 { |
|
368 TRACER_AUTO; |
|
369 // the title pane is set to " Basic Search" |
|
370 // which is same as Search Form s title pane text |
|
371 |
|
372 HBufC* titleText = StringLoader::LoadLC( R_QTN_SERVTAB_SEARCH_BASIC ); |
|
373 |
|
374 //to set the icon ( context pane image) as in tabbed view |
|
375 MPbk2ViewActivationTransaction* viewActivationTransaction = |
|
376 Pbk2AppUi()->Pbk2ViewExplorer()->HandleViewActivationLC( |
|
377 iView.Id(), |
|
378 aPrevViewId, |
|
379 titleText, |
|
380 NULL, |
|
381 EUpdateAll ); |
|
382 |
|
383 |
|
384 // Notifies startup monitor of view activation |
|
385 if( Pbk2AppUi()->Pbk2StartupMonitor() ) |
|
386 { |
|
387 Pbk2AppUi()->Pbk2StartupMonitor()-> |
|
388 NotifyViewActivationL( iView.Id() ); |
|
389 } |
|
390 |
|
391 if (!iContainer) |
|
392 { |
|
393 iContainer = CVIMPSTUiSearchViewControl::NewL( |
|
394 &iView, iServiceId, |
|
395 iEngine, iCommandHandler, *this ); |
|
396 CCoeEnv::Static()->AppUi()->AddToStackL( iView, iContainer ); |
|
397 iContainer->SetMopParent( &iView ); |
|
398 iContainer->SetSearchingTextToListboxL(); |
|
399 iContainer->SetRect( iView.ClientRect() ); |
|
400 iContainer->ActivateL(); |
|
401 } |
|
402 |
|
403 // Commit application-wide state changes |
|
404 viewActivationTransaction->Commit(); |
|
405 CleanupStack::PopAndDestroy(2); //viewActivationTransaction ,titleText |
|
406 |
|
407 // Change the navigation pane from tabs to text label |
|
408 UpdateNaviPaneTextL(); |
|
409 |
|
410 // this is initiated from tabbed view ; hence call search functionality |
|
411 if (!iSearchInitiated) |
|
412 { |
|
413 // search is called using CAsynCallBack |
|
414 iCallBack->Set(TCallBack( SearchCallbackL , this)); |
|
415 iCallBack->CallBack(); |
|
416 } |
|
417 |
|
418 |
|
419 } |
|
420 |
|
421 // --------------------------------------------------------- |
|
422 // CVIMPSTUiSearchView::DoDeactivate() |
|
423 // Deactivates the view |
|
424 // (other items were commented in a header). |
|
425 // --------------------------------------------------------- |
|
426 // |
|
427 void CVIMPSTUiSearchView::DoDeactivate() |
|
428 { |
|
429 TRACER_AUTO; |
|
430 // set this flag to Efalse because user cant initiate a search from search view |
|
431 iSearchInitiated = EFalse; |
|
432 if (iContainer) |
|
433 { |
|
434 CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer ); |
|
435 delete iContainer; |
|
436 iContainer = NULL; |
|
437 } |
|
438 } |
|
439 |
|
440 // -------------------------------------------------------------------------- |
|
441 // CVIMPSTUiSearchView::HandleCommandKeyL |
|
442 // -------------------------------------------------------------------------- |
|
443 // |
|
444 TBool CVIMPSTUiSearchView::HandleCommandKeyL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/) |
|
445 { |
|
446 TBool result = EFalse; |
|
447 switch (aKeyEvent.iCode) |
|
448 { |
|
449 default: |
|
450 { |
|
451 break; |
|
452 } |
|
453 } |
|
454 return result; |
|
455 } |
|
456 |
|
457 // -------------------------------------------------------------------------- |
|
458 // CVIMPSTUiSearchView::HandleStatusPaneSizeChange |
|
459 // -------------------------------------------------------------------------- |
|
460 // |
|
461 void CVIMPSTUiSearchView::HandleStatusPaneSizeChange() |
|
462 { |
|
463 // Resize the container to fill the client rectangle |
|
464 if (iContainer) |
|
465 { |
|
466 iContainer->SetRect( iView.ClientRect() ); |
|
467 } |
|
468 } |
|
469 |
|
470 |
|
471 // -------------------------------------------------------------------------- |
|
472 // CVIMPSTUiSearchView::CommandFinishedL |
|
473 // -------------------------------------------------------------------------- |
|
474 // |
|
475 |
|
476 void CVIMPSTUiSearchView::CommandFinishedL( |
|
477 const MVIMPSTCmd& aCommand ) |
|
478 { |
|
479 TRACER_AUTO; |
|
480 //handle the observer for commands issues through HandleCommandL() |
|
481 |
|
482 switch (aCommand.CommandId()) |
|
483 { |
|
484 |
|
485 case ESearch: |
|
486 { |
|
487 // Search command is complete |
|
488 //use aCommand.Result() to get the data |
|
489 //Ownership is not given to the caller |
|
490 //some error occured. |
|
491 if(iWaitNote) |
|
492 { |
|
493 delete iWaitNote; |
|
494 iWaitNote = NULL; |
|
495 } |
|
496 if(aCommand.Result() != KErrNone) |
|
497 { |
|
498 HBufC* prompt = NULL; |
|
499 prompt = StringLoader::LoadLC(R_IM_ERROR_SERVICE_ERR ); |
|
500 TInt ret( VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ); |
|
501 CleanupStack::PopAndDestroy(prompt); |
|
502 } |
|
503 break; |
|
504 } |
|
505 case EAddContact: |
|
506 { |
|
507 //addcontact command is complete |
|
508 //use aCommand.Result() to get the data |
|
509 //Ownership is not given to the caller |
|
510 //some error occured. |
|
511 if(aCommand.Result() != KErrNone) |
|
512 { |
|
513 HBufC* prompt = StringLoader::LoadLC( R_QTN_SERVTAB_SAVING_CONTACT_FAILED ); |
|
514 VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ; |
|
515 CleanupStack::PopAndDestroy(prompt); |
|
516 } |
|
517 |
|
518 break; |
|
519 } |
|
520 default: |
|
521 { |
|
522 //should never be here. |
|
523 break; |
|
524 } |
|
525 } |
|
526 } |
|
527 |
|
528 // -------------------------------------------------------------------------- |
|
529 // CVIMPSTUiSearchView::HandleCommandEventL |
|
530 // -------------------------------------------------------------------------- |
|
531 // |
|
532 void CVIMPSTUiSearchView::HandleCommandEventL(TVIMPSTEnums::TVIMPSTRegistrationState /*aState*/, TInt /*aServiceError*/) |
|
533 { |
|
534 |
|
535 } |
|
536 // --------------------------------------------------------- |
|
537 // CVIMPSTUiSearchView::ShowAddToContactsL() |
|
538 // (other items were commented in a header). |
|
539 // --------------------------------------------------------- |
|
540 // |
|
541 TBool CVIMPSTUiSearchView::HideAddToContactsL() const |
|
542 { |
|
543 TRACER_AUTO; |
|
544 TBool hide(ETrue); |
|
545 TInt curIndex = iContainer->ListBox()->CurrentItemIndex(); |
|
546 if( curIndex >=0) |
|
547 { |
|
548 HBufC* contactId = iContainer->GetFocusedContactLC() ; |
|
549 if ( contactId->Length() ) |
|
550 { |
|
551 hide = iCommandHandler.GetProcessInterface().FindAnyContact( *contactId ); |
|
552 CleanupStack::PopAndDestroy( contactId ); |
|
553 } |
|
554 |
|
555 } |
|
556 return hide; |
|
557 } |
|
558 |
|
559 // -------------------------------------------------------------------------- |
|
560 // CVIMPSTUiSearchView::SearchContactsL |
|
561 // -------------------------------------------------------------------------- |
|
562 // |
|
563 void CVIMPSTUiSearchView:: SearchContactsL() |
|
564 { |
|
565 TRACER_AUTO; |
|
566 if( iContainer ) |
|
567 { |
|
568 iContainer->UpdateCbaL( ETrue ); |
|
569 } |
|
570 |
|
571 CVIMPSTUiSearchFieldArray& fieldArray = iExtensionService.GetSearchFieldArray(); |
|
572 |
|
573 if( !fieldArray.Count() ) |
|
574 { |
|
575 return; |
|
576 } |
|
577 |
|
578 CVIMPSTUiSearchQueryDialog* querydialog = CVIMPSTUiSearchQueryDialog::NewL( fieldArray ); |
|
579 |
|
580 |
|
581 |
|
582 if (querydialog) |
|
583 { |
|
584 querydialog->ExecuteLD(); |
|
585 iEndKeyPressed = querydialog->IsEndKeyPressed(); |
|
586 } |
|
587 |
|
588 // we have to set the title pane with " Search results " string |
|
589 CCVIMPSTUiStatusPaneHandler* StatusPaneHandler = CCVIMPSTUiStatusPaneHandler::NewL(); |
|
590 CleanupStack::PushL( StatusPaneHandler); |
|
591 HBufC* titleText = StringLoader::LoadLC( R_QTN_SERVTAB_SEARCH_RESULTS ); |
|
592 StatusPaneHandler->SetTextL(*titleText); |
|
593 CleanupStack::PopAndDestroy( 2 ); // |
|
594 |
|
595 |
|
596 if( !fieldArray.AreAllUiFieldsEmpty() ) |
|
597 { |
|
598 // make this flag as True |
|
599 // from now search is initiated from search view |
|
600 iSearchInitiated = ETrue; |
|
601 |
|
602 // if any field is entered |
|
603 // launch the search view |
|
604 HBufC* firstDataBuf = fieldArray.GetFirstEnteredFieldDataL().AllocLC(); |
|
605 TPtr searchStrPtr( firstDataBuf->Des() ); |
|
606 |
|
607 iExtensionService.SetSearchStringL( searchStrPtr ); |
|
608 UpdateNaviPaneTextL(); |
|
609 if ( iContainer) |
|
610 { |
|
611 if ( iContainer->ListBox()->Model()->NumberOfItems() > 0 ) |
|
612 { |
|
613 iContainer->ClearListBoxContents(); |
|
614 } |
|
615 // set the empty string blank |
|
616 iContainer->SetSearchingTextToListboxL(); |
|
617 } |
|
618 HBufC* searchWaitNoteText = StringLoader::LoadLC( R_QTN_SERVTAB_SEARCHING , searchStrPtr, CCoeEnv::Static() ); |
|
619 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( *searchWaitNoteText, EFalse , ETrue ); |
|
620 CleanupStack::PopAndDestroy(searchWaitNoteText); |
|
621 //searchWaitNoteText |
|
622 RArray<TVIMPSTSearchKeyData> keyDataArray; |
|
623 fieldArray.GetSearchKeyDataL( keyDataArray ); |
|
624 |
|
625 iCommandHandler.HandleCommandL(ESearch, this, &keyDataArray ); |
|
626 CleanupStack::PopAndDestroy(); // firstDataBuf |
|
627 |
|
628 } |
|
629 |
|
630 // if the serach is initiated from tabbed view and User cancels the search |
|
631 // return to Tabbed view |
|
632 if ( !iSearchInitiated && !iEndKeyPressed) |
|
633 { |
|
634 // return to tabbed view |
|
635 CPbk2ViewState* state = NULL; |
|
636 |
|
637 TInt tabViewId; |
|
638 TInt err = iMapper.GetNewView( KIMCONTACTSEXTNIMPLEMENTATIONUID, |
|
639 iExtensionService.TabbedViewId(), |
|
640 tabViewId ); |
|
641 User::LeaveIfError( err ); |
|
642 Pbk2AppUi()->Pbk2ViewExplorer()->ActivatePhonebook2ViewL( |
|
643 TUid::Uid(tabViewId), |
|
644 state ); |
|
645 } |
|
646 } |
|
647 |
|
648 |
|
649 // --------------------------------------------------------- |
|
650 // CVIMPSTUiSearchView::UpdateNaviPaneTextL() |
|
651 // --------------------------------------------------------- |
|
652 // |
|
653 void CVIMPSTUiSearchView::UpdateNaviPaneTextL( ) |
|
654 { |
|
655 TRACER_AUTO; |
|
656 // Change the navigation pane from tabs to text label |
|
657 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
658 CAknNavigationControlContainer* np = |
|
659 static_cast<CAknNavigationControlContainer*>( |
|
660 sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
661 delete iNaviDecorator; |
|
662 iNaviDecorator = NULL; |
|
663 //fix for disableing navigation search string text, makeing it null |
|
664 iNaviDecorator = np->CreateNavigationLabelL( _L(" ") ); |
|
665 //previous code commented for reference |
|
666 //iNaviDecorator = np->CreateNavigationLabelL( iExtensionService.SearchString() ); |
|
667 |
|
668 np->PushL( *iNaviDecorator ); |
|
669 sp->DrawNow(); |
|
670 } |
|
671 |
|
672 // --------------------------------------------------------- |
|
673 // CVIMPSTUiSearchView::HandleSearchResultL() |
|
674 // --------------------------------------------------------- |
|
675 // |
|
676 void CVIMPSTUiSearchView::HandleSearchResultL(RArray<TVIMPSTSearchData> aSearchData ) |
|
677 { |
|
678 if( iContainer ) |
|
679 { |
|
680 iContainer->SearchResultL( aSearchData ); |
|
681 } |
|
682 } |
|
683 |
|
684 |
|
685 // --------------------------------------------------------- |
|
686 // CVIMPSTUiSearchView::HandleSearchFinishedL() |
|
687 // --------------------------------------------------------- |
|
688 // |
|
689 void CVIMPSTUiSearchView::HandleSearchFinishedL(TInt aError) |
|
690 { |
|
691 // if any error show error note |
|
692 if( iContainer ) |
|
693 { |
|
694 iContainer->SearchFinishedL(aError); |
|
695 } |
|
696 } |
|
697 |
|
698 // --------------------------------------------------------- |
|
699 // CVIMPSTUiSearchView::HandleSearchKeysEventL() |
|
700 // --------------------------------------------------------- |
|
701 // |
|
702 void CVIMPSTUiSearchView::HandleSearchKeysEventL( RArray<TInt>& /*aEnumKeysArray*/, RPointerArray<HBufC>& /*aLebelKeysArray*/ ) |
|
703 { |
|
704 // do nothing here |
|
705 } |
|
706 // --------------------------------------------------------- |
|
707 // CVIMPSTUiSearchView::LaunchHelpL() |
|
708 // Function launches help application using the HlpLauncher. |
|
709 // @params: Reference to a descriptor, serves as context. |
|
710 // --------------------------------------------------------- |
|
711 // |
|
712 void CVIMPSTUiSearchView::LaunchHelpL( const TDesC& aContext ) |
|
713 { |
|
714 TRACER_AUTO; |
|
715 CArrayFix< TCoeHelpContext >* cntx = new( ELeave ) CArrayFixFlat< TCoeHelpContext >( KHelpContextSize ); |
|
716 CleanupStack::PushL( cntx ); |
|
717 |
|
718 TUid KHelpUid = { KHELPUID }; |
|
719 cntx->AppendL( TCoeHelpContext( KHelpUid, aContext ) ); |
|
720 CleanupStack::Pop( cntx ); |
|
721 |
|
722 //and launch help - takes ownership of context array |
|
723 HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), cntx ); |
|
724 } |
|
725 |
|
726 // --------------------------------------------------------- |
|
727 // CVIMPSTUiSearchView::SearchCallbackL() |
|
728 // --------------------------------------------------------- |
|
729 // |
|
730 TInt CVIMPSTUiSearchView::SearchCallbackL(TAny* aInstance) |
|
731 { |
|
732 TRACER_AUTO; |
|
733 static_cast<CVIMPSTUiSearchView*> (aInstance)->SearchContactsL(); |
|
734 return 0; // ignored by CAsychCallBack |
|
735 } |
|
736 |
|
737 // End of File |