|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Definition of class CESMRContactMenuHandler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CESMRCONTACTMENUHANDLER_H |
|
20 #define CESMRCONTACTMENUHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "cesmrcontactmanagerhandler.h" |
|
25 #include <MVPbkContactFindObserver.h> |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 //<cmail> |
|
28 #include "mfsccontactactionserviceobserver.h" |
|
29 #include "fsccontactactionservicedefines.h" |
|
30 //</cmail> |
|
31 #include <eikcmobs.h> |
|
32 |
|
33 class MVPbkContactOperationBase; |
|
34 class MVPbkContactStore; |
|
35 class MVPbkContactLinkArray; |
|
36 class CFscContactActionService; |
|
37 class CFscContactActionMenu; |
|
38 class CEikMenuPane; |
|
39 class CESMRContactMenuUrlHandler; |
|
40 class MMRContactMenuObserver; |
|
41 |
|
42 NONSHARABLE_CLASS( CESMRContactMenuHandler ) : |
|
43 public CBase, |
|
44 public MVPbkContactFindObserver, |
|
45 public MVPbkSingleContactOperationObserver, |
|
46 public MFscContactActionServiceObserver, |
|
47 public MESMRContactManagerObserver |
|
48 { |
|
49 public: |
|
50 /* |
|
51 * Enumeration for value types. |
|
52 */ |
|
53 enum TValueType |
|
54 { |
|
55 EValueTypeNone, |
|
56 EValueTypeURL, |
|
57 EValueTypeEmail, |
|
58 EValueTypePhoneNumber |
|
59 }; |
|
60 |
|
61 public: |
|
62 /** |
|
63 * Two-phase constructor |
|
64 * |
|
65 * @param aContactManagerHandler Handler to contact manager |
|
66 * @return new instance of the class |
|
67 */ |
|
68 static CESMRContactMenuHandler* NewL( |
|
69 CESMRContactManagerHandler& aContactManagerHandler ); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 ~CESMRContactMenuHandler( ); |
|
75 |
|
76 /** |
|
77 * Options menu available |
|
78 * @return ETrue if options menu / actions is available. |
|
79 */ |
|
80 IMPORT_C TBool OptionsMenuAvailable( ); |
|
81 |
|
82 /** |
|
83 * Initialises actions menu pane. |
|
84 * |
|
85 * @param aActionMenuPane actions menu pane |
|
86 */ |
|
87 void InitOptionsMenuL( CEikMenuPane* aActionMenuPane ); |
|
88 |
|
89 /** |
|
90 * Executes options menu / actions command. |
|
91 * |
|
92 * @param aCommand command id |
|
93 */ |
|
94 void ExecuteOptionsMenuL( TInt aCommand ); |
|
95 |
|
96 /** |
|
97 * Resets/disables contact menu handler. |
|
98 */ |
|
99 IMPORT_C void Reset( ); |
|
100 |
|
101 /** |
|
102 * Sets new value for contact action menu. It might be of |
|
103 * type URL, Email or phone number. |
|
104 * |
|
105 * @param aValue descriptor which contains value |
|
106 * @param aValueType type of given value |
|
107 */ |
|
108 IMPORT_C void SetValueL( const TDesC& aValue, TValueType aValueType ); |
|
109 |
|
110 /** |
|
111 * Shows/executes contact action menu. |
|
112 */ |
|
113 IMPORT_C void ShowActionMenuL( ); |
|
114 |
|
115 /** |
|
116 * Sets command observer for field. Field can use command |
|
117 * observer for triggering commands. |
|
118 * @param aCommandObserver Reference to command observer |
|
119 */ |
|
120 IMPORT_C void SetCommandObserver( |
|
121 MEikCommandObserver* aCommandObserver ); |
|
122 |
|
123 /** |
|
124 * Sets contact menu observer. Only one observer is supported at any time. |
|
125 * The observer will be notified when asynchronous contact action query |
|
126 * has been completed. |
|
127 */ |
|
128 IMPORT_C void SetContactMenuObserver( MMRContactMenuObserver* aObserver ); |
|
129 |
|
130 private: |
|
131 /** |
|
132 * Private constructor. |
|
133 */ |
|
134 CESMRContactMenuHandler( |
|
135 CESMRContactManagerHandler& aContactManagerHandler ); |
|
136 |
|
137 /** |
|
138 * Second phase constructor. |
|
139 */ |
|
140 void ConstructL( ); |
|
141 |
|
142 void VerifyContactDetailsL(); |
|
143 |
|
144 private: // from MESMRContactManagerHandler |
|
145 void ContactManagerReady( ); |
|
146 |
|
147 private: // from MVPbkSingleContactOperationObserver |
|
148 void VPbkSingleContactOperationComplete( |
|
149 MVPbkContactOperationBase& aOperation, |
|
150 MVPbkStoreContact* aContact ); |
|
151 void VPbkSingleContactOperationFailed( |
|
152 MVPbkContactOperationBase& aOperation, |
|
153 TInt aError ); |
|
154 |
|
155 private: // from MVPbkContactFindObserver |
|
156 void FindCompleteL( MVPbkContactLinkArray* aResults ); |
|
157 void FindFailed( TInt aError ); |
|
158 |
|
159 // from MFscContactActionServiceObserver |
|
160 void QueryActionsComplete( ); |
|
161 void QueryActionsFailed( TInt aError ); |
|
162 void ExecuteComplete( ); |
|
163 void ExecuteFailed( TInt aError ); |
|
164 |
|
165 private: |
|
166 /** |
|
167 * Searches selected richtext link from contact stores. |
|
168 */ |
|
169 void SearchContactL( ); |
|
170 |
|
171 /** |
|
172 * Creates new temporary contact for richtext link. |
|
173 */ |
|
174 void CreateContactL( ); |
|
175 |
|
176 /** |
|
177 * Searches for local contact store for temporary |
|
178 * contact creation. Leaves if none is found. |
|
179 * |
|
180 * @return local contact store |
|
181 */ |
|
182 MVPbkContactStore& LocalContactStoreL( ); |
|
183 |
|
184 private: // Data |
|
185 /// Ref: Contact manager handler |
|
186 CESMRContactManagerHandler& iContactManagerHandler; |
|
187 /// Own: Url contact menu handler. |
|
188 CESMRContactMenuUrlHandler* iContactMenuUrlHandler; |
|
189 /// Own: Contact search results. |
|
190 MVPbkContactLinkArray* iFindResultsArray; |
|
191 /// Own: Index for verifying search results. |
|
192 TInt iFindResultsArrayIndex; |
|
193 /// Own: Contact action service. |
|
194 CFscContactActionService* iContactActionService; |
|
195 /// Own: Contact action menu. |
|
196 CFscContactActionMenu* iContactActionMenu; |
|
197 /// Own: Contact operation base. |
|
198 MVPbkContactOperationBase* iContactOperationBase; |
|
199 /// Own: Current value for actions menu. |
|
200 HBufC* iValue; |
|
201 /// Own: Current value type. |
|
202 TValueType iValueType; |
|
203 /// Own: Contact list for temporary contact. |
|
204 RFscStoreContactList iStoreContactList; |
|
205 /// Own: Contact action list for selected richtext link. |
|
206 CFscContactActionList iContactActionList; |
|
207 /// Own: ETrue if contact manager is initialized. |
|
208 TBool iContactManagerReady; |
|
209 /// Own: ETrue if action menu is initialized. |
|
210 TBool iActionMenuReady; |
|
211 /// Own: ETrue if options menu is initialized. |
|
212 TBool iOptionsMenuReady; |
|
213 /// Ref: Pointer to command observer |
|
214 MEikCommandObserver* iCommandObserver; |
|
215 /// Ref: Contact menu observer |
|
216 MMRContactMenuObserver* iContactMenuObserver; |
|
217 }; |
|
218 |
|
219 #endif |