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