|
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: Mail viewer contact matcher. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CMSGMAILVIEWERCONTACTMATCHER_H |
|
19 #define C_CMSGMAILVIEWERCONTACTMATCHER_H |
|
20 |
|
21 #include <e32base.h> // CBase |
|
22 #include <AiwCommon.h> // MAiwNotifyCallback |
|
23 |
|
24 class CContactMatcher; |
|
25 class CVPbkContactLinkArray; |
|
26 class MVPbkStoreContact; |
|
27 class TAiwSingleItemSelectionDataV3; |
|
28 class CAiwServiceHandler; |
|
29 class CVPbkFieldTypeSelector; |
|
30 class CAknWaitDialog; |
|
31 |
|
32 /** |
|
33 * Mail Viewer contact matcher. |
|
34 * Finds possible phonenumber for mail address from phonebook |
|
35 * |
|
36 * @lib none |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 NONSHARABLE_CLASS(CMsgMailViewerContactMatcher) |
|
40 : public CActive, MAiwNotifyCallback |
|
41 { |
|
42 |
|
43 public: |
|
44 enum TPurpose |
|
45 { |
|
46 EPurposeNone, // uninitialized |
|
47 ECallToContact, |
|
48 EMsgToContact |
|
49 }; |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * NewL |
|
55 * @since S60 v3.2 |
|
56 * @param aServiceHandler for attaching AIW interest |
|
57 * @return self |
|
58 */ |
|
59 static CMsgMailViewerContactMatcher* NewL( |
|
60 CAiwServiceHandler& aServiceHandler ); |
|
61 |
|
62 |
|
63 ~CMsgMailViewerContactMatcher(); |
|
64 |
|
65 /** |
|
66 * Search contacts that have specified email address. |
|
67 * @param aMailAddress searched email address. |
|
68 * @param aPurpose determines which fields are used in matching |
|
69 * @param aCallBack call-back function to call when match is ready |
|
70 * @since S60 v3.2 |
|
71 */ |
|
72 void FindContactL( const TDesC& aMailAddress, |
|
73 TPurpose aPurpose, |
|
74 TCallBack aCallBack ); |
|
75 |
|
76 /** |
|
77 * Method to read match result, may be called after clients callback method |
|
78 * is called. Returns NULL if no match is found. |
|
79 * @return match result, ownership is transferred to caller |
|
80 */ |
|
81 HBufC* GetDataL() const; |
|
82 |
|
83 |
|
84 /** |
|
85 * Method to read name of match result, may be called after clients callback method |
|
86 * is called. Returns NULL if no name is found. |
|
87 * @return match name, ownership is transferred to caller |
|
88 */ |
|
89 HBufC* GetNameL() const; |
|
90 |
|
91 private: // From CActive |
|
92 void DoCancel(); |
|
93 void RunL(); |
|
94 TInt RunError( TInt aError ); |
|
95 |
|
96 // From MAiwNotifyCallback |
|
97 TInt HandleNotifyL( TInt aCmdId, |
|
98 TInt aEventId, |
|
99 CAiwGenericParamList& aEventParamList, |
|
100 const CAiwGenericParamList& aInParamList ); |
|
101 |
|
102 private: // implementation |
|
103 |
|
104 void DeleteExcessMatches( CVPbkContactLinkArray& aLinks ) const; |
|
105 |
|
106 CVPbkFieldTypeSelector* CreateFilterLC( TPurpose aPurpose ) const; |
|
107 |
|
108 TAiwSingleItemSelectionDataV3 SelectionData( |
|
109 TPurpose aPurpose, |
|
110 CVPbkFieldTypeSelector& aFilter ) const; |
|
111 |
|
112 void ExecuteSingleItemFetchL( TAiwSingleItemSelectionDataV3 aData, |
|
113 const CVPbkContactLinkArray& aLinks ); |
|
114 |
|
115 private: |
|
116 |
|
117 CMsgMailViewerContactMatcher( CAiwServiceHandler& aServiceHandler ); |
|
118 void ConstructL(); |
|
119 |
|
120 private: // data |
|
121 |
|
122 /// AIW service handler reference |
|
123 CAiwServiceHandler& iServiceHandler; |
|
124 |
|
125 TPurpose iPurpose; |
|
126 |
|
127 TCallBack iCallBack; |
|
128 |
|
129 /// Own: contact matcher |
|
130 CContactMatcher* iContactMatcher; |
|
131 |
|
132 /// Own: contact link array |
|
133 CVPbkContactLinkArray* iContactLinks; |
|
134 |
|
135 /// Own: |
|
136 CVPbkContactLinkArray* iChangedLinks; |
|
137 |
|
138 /// Own, but self-destructing |
|
139 CAknWaitDialog* iWaitDialog; |
|
140 |
|
141 CIdle* iIdle; |
|
142 }; |
|
143 |
|
144 #endif // C_CMSGMAILVIEWERCONTACTMATCHER_H |