|
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: Searches contact using email address as search filter from address books. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUIUCONTACTADDRESSMATCHER_H |
|
20 #define MUIUCONTACTADDRESSMATCHER_H |
|
21 |
|
22 #include <e32base.h> // CBase |
|
23 #include <AiwCommon.h> // MAiwNotifyCallback |
|
24 |
|
25 class CContactMatcher; |
|
26 class CVPbkContactLinkArray; |
|
27 class MVPbkStoreContact; |
|
28 class TAiwSingleItemSelectionDataV3; |
|
29 class CAiwServiceHandler; |
|
30 class CVPbkFieldTypeSelector; |
|
31 class CAknWaitDialog; |
|
32 class CEikonEnv; |
|
33 |
|
34 /** |
|
35 * Find outs contact by using email address as search filter. |
|
36 * The API searches for first contact mathing the address. |
|
37 * Other contacts are ignored. If contact has several addresses (phone numbers), |
|
38 * AIW is used to let user select address, which will be used. |
|
39 * |
|
40 * @lib muiu_internal.lib |
|
41 * @since S60 v3.2 |
|
42 */ |
|
43 class CMuiuContactAddressMatcher |
|
44 : public CActive, MAiwNotifyCallback |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * NewL |
|
51 * @since S60 v3.2 |
|
52 * @param aServiceHandler for attaching AIW interest |
|
53 * @return self |
|
54 */ |
|
55 static CMuiuContactAddressMatcher* NewL( |
|
56 CEikonEnv& aEikonEnv); |
|
57 |
|
58 virtual ~CMuiuContactAddressMatcher(); |
|
59 |
|
60 /** |
|
61 * Search contact that have specified email address. |
|
62 * @param aMailAddress searched email address. |
|
63 * @param aCallBack call-back function to call when match is ready |
|
64 * @return ETrue, address was email address: search begins. |
|
65 * aCallBack will be called. |
|
66 * EFalse, address was either phone number of empty. |
|
67 * aCallback will not called |
|
68 * @since S60 v3.2 |
|
69 */ |
|
70 TBool FindContactL( const TDesC& aMailAddress, |
|
71 TCallBack aCallBack ); |
|
72 |
|
73 /** |
|
74 * Method to read phone number of matched contact, may be called |
|
75 * after clients callback method is called. Returns NULL if address was not found. |
|
76 * @return match result, ownership is transferred to caller |
|
77 * @since S60 v3.2 |
|
78 */ |
|
79 HBufC* GetAddressL() const; |
|
80 |
|
81 /** |
|
82 * Method to read contact name of matched contact, may be called |
|
83 * after clients callback method is called. Returns NULL if address was not found. |
|
84 * @return match name, ownership is transferred to caller |
|
85 * @since S60 v3.2 |
|
86 */ |
|
87 HBufC* GetNameL() const; |
|
88 |
|
89 private: // From CActive |
|
90 void DoCancel(); |
|
91 void RunL(); |
|
92 TInt RunError( TInt aError ); |
|
93 |
|
94 // From MAiwNotifyCallback |
|
95 TInt HandleNotifyL( TInt aCmdId, |
|
96 TInt aEventId, |
|
97 CAiwGenericParamList& aEventParamList, |
|
98 const CAiwGenericParamList& aInParamList ); |
|
99 |
|
100 private: // implementation |
|
101 |
|
102 void DeleteExcessMatchesL( CVPbkContactLinkArray& aLinks ) const; |
|
103 |
|
104 CVPbkFieldTypeSelector* CreateFilterLC( ) const; |
|
105 |
|
106 TAiwSingleItemSelectionDataV3 SelectionData( |
|
107 CVPbkFieldTypeSelector& aFilter ) const; |
|
108 |
|
109 void ExecuteSingleItemFetchL( TAiwSingleItemSelectionDataV3 aData, |
|
110 const CVPbkContactLinkArray& aLinks ); |
|
111 |
|
112 private: |
|
113 |
|
114 CMuiuContactAddressMatcher( CEikonEnv& aEikonEnv ); |
|
115 void ConstructL(); |
|
116 |
|
117 private: // data |
|
118 |
|
119 /// AIW service handler reference |
|
120 CAiwServiceHandler* iServiceHandler; |
|
121 |
|
122 TCallBack iCallBack; |
|
123 |
|
124 /// Own: contact matcher |
|
125 CContactMatcher* iContactMatcher; |
|
126 |
|
127 /// Own: contact link array |
|
128 CVPbkContactLinkArray* iContactLinks; |
|
129 |
|
130 /// Own: |
|
131 CVPbkContactLinkArray* iChangedLinks; |
|
132 |
|
133 /// Own, but self-destructing |
|
134 CAknWaitDialog* iWaitDialog; |
|
135 |
|
136 CIdle* iIdle; |
|
137 |
|
138 CEikonEnv& iEikEnv; |
|
139 // 'handle' to muiu_internal.rsc esourse file |
|
140 TInt iResourceOffset; |
|
141 }; |
|
142 |
|
143 #endif // MUIUCONTACTADDRESSMATCHER_H |