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