27 #include <ximpstatus.h> |
27 #include <ximpstatus.h> |
28 |
28 |
29 |
29 |
30 #include "cvimpstenginerequestmapper.h" |
30 #include "cvimpstenginerequestmapper.h" |
31 #include "cvimpstenginerequest.h" |
31 #include "cvimpstenginerequest.h" |
32 #include "vimpstdebugprint.h" |
|
33 |
32 |
34 #include "vimpstallerrors.h" |
33 #include "vimpstallerrors.h" |
35 #include "tvimpstconsts.h" |
34 #include "tvimpstconsts.h" |
36 |
35 |
37 #include <search.h> |
36 #include <search.h> |
42 #include <searchkeyinfo.h> |
41 #include <searchkeyinfo.h> |
43 #include <searchinfo.h> |
42 #include <searchinfo.h> |
44 #include <searchevent.h> |
43 #include <searchevent.h> |
45 |
44 |
46 #include "mvimpstenginesearchextentioneventobserver.h" |
45 #include "mvimpstenginesearchextentioneventobserver.h" |
47 #include "vimpstdebugtrace.h" |
46 #include "uiservicetabtracer.h" |
48 |
47 |
49 |
48 |
50 |
49 |
51 // ================= MEMBER FUNCTIONS ======================= |
50 // ================= MEMBER FUNCTIONS ======================= |
52 // --------------------------------------------------------- |
51 // --------------------------------------------------------- |
55 // --------------------------------------------------------- |
54 // --------------------------------------------------------- |
56 CVIMPSTEngineSearchMgrExtention* CVIMPSTEngineSearchMgrExtention::NewL( |
55 CVIMPSTEngineSearchMgrExtention* CVIMPSTEngineSearchMgrExtention::NewL( |
57 MXIMPContext& aPresenceCtx, |
56 MXIMPContext& aPresenceCtx, |
58 CVIMPSTEngineRequestMapper& aRequestMapper) |
57 CVIMPSTEngineRequestMapper& aRequestMapper) |
59 { |
58 { |
60 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::NewL start")); |
59 TRACER_AUTO; |
61 CVIMPSTEngineSearchMgrExtention* self = |
60 CVIMPSTEngineSearchMgrExtention* self = |
62 CVIMPSTEngineSearchMgrExtention::NewLC( |
61 CVIMPSTEngineSearchMgrExtention::NewLC( |
63 aPresenceCtx, |
62 aPresenceCtx, |
64 aRequestMapper |
63 aRequestMapper |
65 ); |
64 ); |
66 CleanupStack::Pop( self ); |
65 CleanupStack::Pop( self ); |
67 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::NewL end")); |
|
68 return self; |
66 return self; |
69 } |
67 } |
70 |
68 |
71 // --------------------------------------------------------- |
69 // --------------------------------------------------------- |
72 // CVIMPSTEngineSearchMgrExtention::NewLC |
70 // CVIMPSTEngineSearchMgrExtention::NewLC |
74 // --------------------------------------------------------- |
72 // --------------------------------------------------------- |
75 CVIMPSTEngineSearchMgrExtention* CVIMPSTEngineSearchMgrExtention::NewLC( |
73 CVIMPSTEngineSearchMgrExtention* CVIMPSTEngineSearchMgrExtention::NewLC( |
76 MXIMPContext& aPresenceCtx, |
74 MXIMPContext& aPresenceCtx, |
77 CVIMPSTEngineRequestMapper& aRequestMapper) |
75 CVIMPSTEngineRequestMapper& aRequestMapper) |
78 { |
76 { |
79 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::NewLC start")); |
77 TRACER_AUTO; |
80 CVIMPSTEngineSearchMgrExtention* self = new (ELeave) |
78 CVIMPSTEngineSearchMgrExtention* self = new (ELeave) |
81 CVIMPSTEngineSearchMgrExtention(aPresenceCtx, aRequestMapper); |
79 CVIMPSTEngineSearchMgrExtention(aPresenceCtx, aRequestMapper); |
82 CleanupStack::PushL( self ); |
80 CleanupStack::PushL( self ); |
83 self->ConstructL(); |
81 self->ConstructL(); |
84 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::NewLC end")); |
|
85 return self; |
82 return self; |
86 } |
83 } |
87 |
84 |
88 // --------------------------------------------------------- |
85 // --------------------------------------------------------- |
89 // CVIMPSTEngineSearchMgrExtention::ConstructL |
86 // CVIMPSTEngineSearchMgrExtention::ConstructL |
90 // --------------------------------------------------------- |
87 // --------------------------------------------------------- |
91 void CVIMPSTEngineSearchMgrExtention::ConstructL() |
88 void CVIMPSTEngineSearchMgrExtention::ConstructL() |
92 { |
89 { |
93 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ConstructL start")); |
90 TRACER_AUTO; |
94 |
91 |
95 // ximp search plugin |
92 // ximp search plugin |
96 iSearchFeature = MSearchFeature::NewL(&iPresenceCtx); |
93 iSearchFeature = MSearchFeature::NewL(&iPresenceCtx); |
97 |
94 |
98 iSearch = &iSearchFeature->Search(); |
95 iSearch = &iSearchFeature->Search(); |
99 |
96 |
100 iAlreadySubscibed = EFalse; |
97 iAlreadySubscibed = EFalse; |
101 |
98 |
102 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ConstructL end") ); |
|
103 |
99 |
104 } |
100 } |
105 |
101 |
106 // --------------------------------------------------------- |
102 // --------------------------------------------------------- |
107 // CVIMPSTEngineSearchMgrExtention::CVIMPSTEngineSearchMgrExtention |
103 // CVIMPSTEngineSearchMgrExtention::CVIMPSTEngineSearchMgrExtention |
118 // --------------------------------------------------------- |
114 // --------------------------------------------------------- |
119 // CVIMPSTEngineSearchMgrExtention::~CVIMPSTEngineSearchMgrExtention |
115 // CVIMPSTEngineSearchMgrExtention::~CVIMPSTEngineSearchMgrExtention |
120 // --------------------------------------------------------- |
116 // --------------------------------------------------------- |
121 CVIMPSTEngineSearchMgrExtention::~CVIMPSTEngineSearchMgrExtention() |
117 CVIMPSTEngineSearchMgrExtention::~CVIMPSTEngineSearchMgrExtention() |
122 { |
118 { |
123 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::~CVIMPSTEngineSearchMgrExtention start")); |
119 TRACER_AUTO; |
124 |
120 |
125 iSearchObservers.Reset(); |
121 iSearchObservers.Reset(); |
126 delete iSearchFeature; |
122 delete iSearchFeature; |
127 iSearchFeature = NULL; |
123 iSearchFeature = NULL; |
128 |
124 |
129 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::~CVIMPSTEngineSearchMgrExtention end")); |
|
130 } |
125 } |
131 |
126 |
132 |
127 |
133 // --------------------------------------------------------- |
128 // --------------------------------------------------------- |
134 // CVIMPSTEngineSearchMgrExtention::SearchContactsL |
129 // CVIMPSTEngineSearchMgrExtention::SearchContactsL |
135 // --------------------------------------------------------- |
130 // --------------------------------------------------------- |
136 TInt CVIMPSTEngineSearchMgrExtention::SearchContactsL( RArray<TVIMPSTSearchKeyData>& aKeyDataArray ) |
131 TInt CVIMPSTEngineSearchMgrExtention::SearchContactsL( RArray<TVIMPSTSearchKeyData>& aKeyDataArray ) |
137 { |
132 { |
138 TRACE( T_LIT( "CVIMPSTEngineSearchMgrExtention::SearchContactsL Start" ) ); |
133 TRACER_AUTO; |
139 |
134 |
140 TInt err = KErrNotSupported; |
135 TInt err = KErrNotSupported; |
141 if (iSearchSupported == TVIMPSTEnums::ESupported) |
136 if (iSearchSupported == TVIMPSTEnums::ESupported) |
142 { |
137 { |
143 |
138 |
198 // CVIMPSTEngineSearchMgrExtention::SubscribeForSearchKeysL() |
192 // CVIMPSTEngineSearchMgrExtention::SubscribeForSearchKeysL() |
199 // ----------------------------------------------------------------------------- |
193 // ----------------------------------------------------------------------------- |
200 // |
194 // |
201 TInt CVIMPSTEngineSearchMgrExtention::SubscribeForSearchKeysL() |
195 TInt CVIMPSTEngineSearchMgrExtention::SubscribeForSearchKeysL() |
202 { |
196 { |
203 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::SubscribeForSearchKeysL Start")); |
197 TRACER_AUTO; |
204 TRACE( T_LIT( "--> SubscribeForSearchKeysL:iSearchSupported: %d" ), iSearchSupported ); |
198 TRACE( "iSearchSupported: %d" , iSearchSupported ); |
205 TRACE( T_LIT( "--> SubscribeForSearchKeysL: iAlreadySubscibed: %d" ), iAlreadySubscibed ); |
199 TRACE( "iAlreadySubscibed: %d" , iAlreadySubscibed ); |
206 |
200 |
207 if ( (iSearchSupported == TVIMPSTEnums::ENotSupported) || iAlreadySubscibed ) |
201 if ( (iSearchSupported == TVIMPSTEnums::ENotSupported) || iAlreadySubscibed ) |
208 { |
202 { |
209 TRACE( T_LIT( "--> SubscribeForSearchKeysL: inside if " )); |
203 TRACE("inside if " ); |
210 return KErrNone; |
204 return KErrNone; |
211 } |
205 } |
212 |
206 |
213 if( iSearch ) |
207 if( iSearch ) |
214 { |
208 { |
215 TRACE( T_LIT( "--> SubscribeForSearchKeysL: inside if(iSearch) " )); |
209 TRACE("inside if(iSearch) " ); |
216 |
210 |
217 iAlreadySubscibed = ETrue; |
211 iAlreadySubscibed = ETrue; |
218 |
212 |
219 TXIMPRequestId reqId = iSearch->GetSearchKeysL(); |
213 TXIMPRequestId reqId = iSearch->GetSearchKeysL(); |
220 TRACE( T_LIT( "--> SubscribeForSearchKeysL: iSearch->GetSearchKeysL() " )); |
214 TRACE( "iSearch->GetSearchKeysL() " ); |
221 |
215 |
222 iRequestMapper.CreateRequestL(reqId, ETrue ,EVIMPSTXimpOperationSubscribeSearchKeys);// waite here |
216 iRequestMapper.CreateRequestL(reqId, ETrue ,EVIMPSTXimpOperationSubscribeSearchKeys);// waite here |
223 } |
217 } |
224 |
218 |
225 if( ( iReqResult != KPREQUESTERRSUCCESSFUL ) && ( iReqResult != KErrNone ) ) |
219 if( ( iReqResult != KPREQUESTERRSUCCESSFUL ) && ( iReqResult != KErrNone ) ) |
248 // CVIMPSTEngineSearchMgrExtention::ConverttoTSearchKey |
241 // CVIMPSTEngineSearchMgrExtention::ConverttoTSearchKey |
249 // |
242 // |
250 // ------------------------------------------------------------------------ |
243 // ------------------------------------------------------------------------ |
251 TSearchKey CVIMPSTEngineSearchMgrExtention::ConverttoTSearchKey(TVIMPSTEnums::TVIMPSTSearchKey aKey) |
244 TSearchKey CVIMPSTEngineSearchMgrExtention::ConverttoTSearchKey(TVIMPSTEnums::TVIMPSTSearchKey aKey) |
252 { |
245 { |
253 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ConverttoTSearchKey start")); |
246 TRACER_AUTO; |
254 |
247 |
255 TSearchKey ret = EUserFirstName; |
248 TSearchKey ret = EUserFirstName; |
256 switch( aKey ) |
249 switch( aKey ) |
257 { |
250 { |
258 case TVIMPSTEnums::EVIMPSTFirstName : |
251 case TVIMPSTEnums::EVIMPSTFirstName : |
348 // CVIMPSTEngineSearchMgrExtention::RegisterObserver |
340 // CVIMPSTEngineSearchMgrExtention::RegisterObserver |
349 // |
341 // |
350 // --------------------------------------------------------- |
342 // --------------------------------------------------------- |
351 void CVIMPSTEngineSearchMgrExtention::RegisterObserver(MVIMPSTEngineSearchExtentionEventObserver* aObserver) |
343 void CVIMPSTEngineSearchMgrExtention::RegisterObserver(MVIMPSTEngineSearchExtentionEventObserver* aObserver) |
352 { |
344 { |
353 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::RegisterObserver start")); |
345 TRACER_AUTO; |
354 |
346 |
355 TInt index = iSearchObservers.Find(aObserver); |
347 TInt index = iSearchObservers.Find(aObserver); |
356 if( index == KErrNotFound ) |
348 if( index == KErrNotFound ) |
357 { |
349 { |
358 iSearchObservers.Append( aObserver ); |
350 iSearchObservers.Append( aObserver ); |
359 } |
351 } |
360 |
352 |
361 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::RegisterObserver end")); |
|
362 } |
353 } |
363 |
354 |
364 // --------------------------------------------------------- |
355 // --------------------------------------------------------- |
365 // CVIMPSTEngineSearchMgrExtention::UnRegisterObserver |
356 // CVIMPSTEngineSearchMgrExtention::UnRegisterObserver |
366 // |
357 // |
367 // --------------------------------------------------------- |
358 // --------------------------------------------------------- |
368 void CVIMPSTEngineSearchMgrExtention::UnRegisterObserver(MVIMPSTEngineSearchExtentionEventObserver* aObserver) |
359 void CVIMPSTEngineSearchMgrExtention::UnRegisterObserver(MVIMPSTEngineSearchExtentionEventObserver* aObserver) |
369 { |
360 { |
370 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::UnRegisterObserver start")); |
361 TRACER_AUTO; |
371 |
362 |
372 TInt index = iSearchObservers.Find(aObserver); |
363 TInt index = iSearchObservers.Find(aObserver); |
373 |
364 |
374 if( index >=0 ) |
365 if( index >=0 ) |
375 { |
366 { |
376 iSearchObservers.Remove( index ); |
367 iSearchObservers.Remove( index ); |
377 iSearchObservers.Compress(); |
368 iSearchObservers.Compress(); |
378 } |
369 } |
379 |
370 |
380 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::UnRegisterObserver end")); |
|
381 } |
371 } |
382 |
372 |
383 |
373 |
384 |
374 |
385 // --------------------------------------------------------- |
375 // --------------------------------------------------------- |
387 // --------------------------------------------------------- |
377 // --------------------------------------------------------- |
388 void CVIMPSTEngineSearchMgrExtention::HandleSessionContextEventL(const MXIMPContext& /*aContext*/, |
378 void CVIMPSTEngineSearchMgrExtention::HandleSessionContextEventL(const MXIMPContext& /*aContext*/, |
389 const MXIMPBase& aEvent, |
379 const MXIMPBase& aEvent, |
390 TXimpOperation aXimpOperation/* = EVIMPSTXimpOperationNoOperation*/ ) |
380 TXimpOperation aXimpOperation/* = EVIMPSTXimpOperationNoOperation*/ ) |
391 { |
381 { |
392 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::HandleSessionContextEventL start")); |
382 TRACER_AUTO; |
393 |
383 |
394 switch( aEvent.GetInterfaceId() ) |
384 switch( aEvent.GetInterfaceId() ) |
395 { |
385 { |
396 |
386 |
397 case MXIMPRequestCompleteEvent::KInterfaceId: |
387 case MXIMPRequestCompleteEvent::KInterfaceId: |
398 { |
388 { |
399 TRACE( T_LIT("InsideCallbackswitch::MXIMPRequestCompleteEvent")); |
389 TRACE("InsideCallbackswitch::MXIMPRequestCompleteEvent"); |
400 if ( (EVIMPSTXimpOperationSearchContact == aXimpOperation) |
390 if ( (EVIMPSTXimpOperationSearchContact == aXimpOperation) |
401 || (EVIMPSTXimpOperationSubscribeSearchKeys == aXimpOperation) ) |
391 || (EVIMPSTXimpOperationSubscribeSearchKeys == aXimpOperation) ) |
402 { |
392 { |
403 const MXIMPRequestCompleteEvent* event = |
393 const MXIMPRequestCompleteEvent* event = |
404 TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( |
394 TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( |
464 default: |
454 default: |
465 { |
455 { |
466 break; |
456 break; |
467 } |
457 } |
468 } |
458 } |
469 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::HandleSessionContextEventL end")); |
|
470 } |
459 } |
471 |
460 |
472 |
461 |
473 // --------------------------------------------------------- |
462 // --------------------------------------------------------- |
474 // CVIMPSTEngineSearchMgrExtention::ProcessSearchKeysEventL |
463 // CVIMPSTEngineSearchMgrExtention::ProcessSearchKeysEventL |
475 // |
464 // |
476 // --------------------------------------------------------- |
465 // --------------------------------------------------------- |
477 void CVIMPSTEngineSearchMgrExtention::ProcessSearchKeysEventL(const MSearchKeysEvent* aSearchKeysEvent) |
466 void CVIMPSTEngineSearchMgrExtention::ProcessSearchKeysEventL(const MSearchKeysEvent* aSearchKeysEvent) |
478 { |
467 { |
479 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ProcessSearchKeysEventL start")); |
468 TRACER_AUTO; |
480 |
469 |
481 TInt searchKeysCount = aSearchKeysEvent->InfoCount(); |
470 TInt searchKeysCount = aSearchKeysEvent->InfoCount(); |
482 |
471 |
483 RArray<TInt> enumKeyArray; |
472 RArray<TInt> enumKeyArray; |
484 RPointerArray<HBufC> labelKeyArray; |
473 RPointerArray<HBufC> labelKeyArray; |
516 iSearchObservers[i]->HandleSearchKeysEventL(enumKeyArray, labelKeyArray ); |
505 iSearchObservers[i]->HandleSearchKeysEventL(enumKeyArray, labelKeyArray ); |
517 } |
506 } |
518 |
507 |
519 CleanupStack::PopAndDestroy(2); //enumKeyArray, labelKeyArray |
508 CleanupStack::PopAndDestroy(2); //enumKeyArray, labelKeyArray |
520 |
509 |
521 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ProcessSearchKeysEventL end")); |
|
522 } |
510 } |
523 |
511 |
524 // ------------------------------------------------------------------------ |
512 // ------------------------------------------------------------------------ |
525 // CVIMPSTEngineSearchMgrExtention::ConverttoTVIMPSTSearchKey |
513 // CVIMPSTEngineSearchMgrExtention::ConverttoTVIMPSTSearchKey |
526 // |
514 // |
527 // ------------------------------------------------------------------------ |
515 // ------------------------------------------------------------------------ |
528 TVIMPSTEnums::TVIMPSTSearchKey CVIMPSTEngineSearchMgrExtention::ConverttoTVIMPSTSearchKey( TSearchKey aKey) |
516 TVIMPSTEnums::TVIMPSTSearchKey CVIMPSTEngineSearchMgrExtention::ConverttoTVIMPSTSearchKey( TSearchKey aKey) |
529 { |
517 { |
530 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ConverttoTVIMPSTSearchKey start")); |
518 TRACER_AUTO; |
531 |
519 |
532 TVIMPSTEnums::TVIMPSTSearchKey retKey = TVIMPSTEnums::EVIMPSTFirstName ; |
520 TVIMPSTEnums::TVIMPSTSearchKey retKey = TVIMPSTEnums::EVIMPSTFirstName ; |
533 switch( aKey ) |
521 switch( aKey ) |
534 { |
522 { |
535 case EUserFirstName: |
523 case EUserFirstName: |
604 retKey = TVIMPSTEnums::EVIMPSTFirstName; |
592 retKey = TVIMPSTEnums::EVIMPSTFirstName; |
605 } |
593 } |
606 |
594 |
607 } |
595 } |
608 |
596 |
609 TRACE( T_LIT("CVIMPSTEngineSearchMgrExtention::ConverttoTVIMPSTSearchKey end")); |
|
610 return retKey; |
597 return retKey; |
611 } |
598 } |
612 //---------------------------------------------------------------------------- |
599 //---------------------------------------------------------------------------- |
613 // CVIMPSTEngineSearchMgrExtention::SetSupported() |
600 // CVIMPSTEngineSearchMgrExtention::SetSupported() |
614 // ----------------------------------------------------------------------------- |
601 // ----------------------------------------------------------------------------- |
615 // |
602 // |
616 void CVIMPSTEngineSearchMgrExtention::SetSupported(TVIMPSTEnums::FeatureSupport aSupported) |
603 void CVIMPSTEngineSearchMgrExtention::SetSupported(TVIMPSTEnums::FeatureSupport aSupported) |
617 { |
604 { |
|
605 TRACER_AUTO; |
618 if ( aSupported == TVIMPSTEnums::ESupportUnKnown) |
606 if ( aSupported == TVIMPSTEnums::ESupportUnKnown) |
619 { |
607 { |
620 // at the logout time this flag has to be set to EFalse |
608 // at the logout time this flag has to be set to EFalse |
621 iAlreadySubscibed = EFalse; |
609 iAlreadySubscibed = EFalse; |
622 } |
610 } |