|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Execute Maps application. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPMAPCMD_H |
|
19 #define CPMAPCMD_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <MPbk2Command.h> |
|
24 #include <lbsfieldids.h> |
|
25 #include <mngeocoder.h> |
|
26 #include <VPbkFieldType.hrh> |
|
27 #include <Pbk2UIFieldProperty.hrh> |
|
28 #include <MVPbkContactObserver.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MPbk2CommandObserver; |
|
32 class MPbk2ContactUiControl; |
|
33 class MVPbkStoreContact; |
|
34 class CPosLandmark; |
|
35 class MPbk2ContactEditorControl; |
|
36 class MPbk2ContactEditorControlExtension; |
|
37 class MVPbkStoreContactField; |
|
38 class TLocality; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Phonebook 2 show on map command object. |
|
44 */ |
|
45 class CPmapCmd : public CBase, |
|
46 public MPbk2Command, |
|
47 public MVPbkContactObserver |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Creates a new instance of this class. |
|
53 * @param iEditorControl Editor control. |
|
54 * @param aContact Contact store. |
|
55 * @param aCommandId Command. |
|
56 * @return A new instance of this class. |
|
57 */ |
|
58 static CPmapCmd* NewL( |
|
59 MPbk2ContactEditorControl& iEditorControl, |
|
60 MVPbkStoreContact& aContact, |
|
61 TInt aCommandId ); |
|
62 |
|
63 /** |
|
64 * Creates a new instance of this class. |
|
65 * |
|
66 * @param aUiControl UI control. |
|
67 * @param aCommandId Command. |
|
68 * @return A new instance of this class. |
|
69 */ |
|
70 static CPmapCmd* NewL( |
|
71 MPbk2ContactUiControl& aUiControl, |
|
72 TInt aCommandId ); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 ~CPmapCmd(); |
|
78 |
|
79 public: //From MVPbkContactObserver |
|
80 void ContactOperationCompleted( TContactOpResult aResult ); |
|
81 void ContactOperationFailed( |
|
82 TContactOp aOpCode, |
|
83 TInt aErrorCode, |
|
84 TBool aErrorNotified); |
|
85 |
|
86 public: // From MPbk2Command |
|
87 void ExecuteLD(); |
|
88 void AddObserver( |
|
89 MPbk2CommandObserver& aObserver ); |
|
90 void ResetUiControl( |
|
91 MPbk2ContactUiControl& aUiControl ); |
|
92 |
|
93 public: // Implementation |
|
94 /** |
|
95 * Check if exist Maps Api provider. |
|
96 * |
|
97 * @return True if provider exist. |
|
98 */ |
|
99 static TBool CheckViewProviderL(); |
|
100 |
|
101 private: // Members |
|
102 CPmapCmd( |
|
103 MPbk2ContactUiControl& aUiControl, |
|
104 TInt aCommandId ); |
|
105 CPmapCmd( |
|
106 MPbk2ContactEditorControl& iEditorControl, |
|
107 MVPbkStoreContact& aContact, |
|
108 TInt aCommandId ); |
|
109 |
|
110 void ConstructL(); |
|
111 void FinishProcess(); |
|
112 |
|
113 /** |
|
114 * Try to get address from contact editor |
|
115 * |
|
116 * @return Address group ID or EPbk2FieldGroupIdNone. |
|
117 */ |
|
118 TPbk2FieldGroupId GetAddressFromEditorView(); |
|
119 |
|
120 /** |
|
121 * Try to get address from UI control |
|
122 * |
|
123 * @return Address group ID or EPbk2FieldGroupIdNone. |
|
124 */ |
|
125 TPbk2FieldGroupId GetAddressFromUiControl(); |
|
126 |
|
127 /** |
|
128 * Try to get address if there is only one address in contact. |
|
129 * |
|
130 * @return Address group ID or EPbk2FieldGroupIdNone. |
|
131 */ |
|
132 TPbk2FieldGroupId GetAddressIfIsAlone(); |
|
133 |
|
134 /** |
|
135 * Run show on Maps API. |
|
136 * |
|
137 * @param aAddressType Address to show. |
|
138 */ |
|
139 void EditorShowOnMapsL( TVPbkFieldTypeParameter aAddressType ); |
|
140 |
|
141 /** |
|
142 * Run assign on Maps API. |
|
143 * |
|
144 * @param aAddressType Address to assign. |
|
145 */ |
|
146 void EditorAssignFromMapsL( TVPbkFieldTypeParameter aAddressType ); |
|
147 |
|
148 /** |
|
149 * Updates Contact address fields. |
|
150 * |
|
151 * @param aLandmark fields returned from Maps API. |
|
152 * @param aPositionField Type of CPosLandmark field. |
|
153 * @param aVersitSubField Type of Contact field. |
|
154 * @param aAddressType Address type. |
|
155 */ |
|
156 void UpdateFieldL( |
|
157 const CPosLandmark& aLandmark, |
|
158 _TPositionFieldId aPositionField, |
|
159 TVPbkSubFieldType aVersitSubField, |
|
160 TVPbkFieldTypeParameter aAddressType ); |
|
161 |
|
162 /** |
|
163 * Updates Contact geocoordinates. |
|
164 * |
|
165 * @param aLocality object have geocoordinates. |
|
166 * @param aAddressType Address type. |
|
167 */ |
|
168 void UpdateCoordsL( |
|
169 TLocality& aLocality, |
|
170 TVPbkFieldTypeParameter aAddressType ); |
|
171 |
|
172 /** |
|
173 * Fills CPosLandmark object with Contact address fields. |
|
174 * |
|
175 * @param aLandmark object have geocoordinates. |
|
176 * @param aAddressType Address type. |
|
177 */ |
|
178 void FillLandmarkL( |
|
179 CPosLandmark& aLandmark, |
|
180 TVPbkFieldTypeParameter aAddressType ); |
|
181 |
|
182 /** |
|
183 * Fills CPosLandmark object with Contact geocoordinates. |
|
184 * |
|
185 * @param aLandmark object have geocoordinates. |
|
186 * @param aAddressType Address type. |
|
187 */ |
|
188 TBool FillGeoLandmarkL( |
|
189 CPosLandmark& aLandmark, |
|
190 TVPbkFieldTypeParameter aAddressType ); |
|
191 |
|
192 /** |
|
193 * Fills CPosLandmark object with geocoordinates. |
|
194 * |
|
195 * @param aLandmark object have geocoordinates. |
|
196 * @param aDataText text with geocoordinates. |
|
197 */ |
|
198 TBool DoFillGeoLandmarkL( |
|
199 CPosLandmark& aLandmark, |
|
200 const TDesC& aDataText ); |
|
201 |
|
202 /** |
|
203 * Get Control extension. |
|
204 * |
|
205 * @return Contact Editor Extension or NULL. |
|
206 */ |
|
207 MPbk2ContactEditorControlExtension* ControlExtension(); |
|
208 |
|
209 /** |
|
210 * Shows querry for selecting address. |
|
211 * |
|
212 * @return Address group ID or EPbk2FieldGroupIdNone. |
|
213 */ |
|
214 TPbk2FieldGroupId SelectAddressL(); |
|
215 |
|
216 /** |
|
217 * Check if exist address in Contact. |
|
218 * |
|
219 * @return True if any address exist in Contact. |
|
220 */ |
|
221 TBool IsAddressInContact(); |
|
222 |
|
223 /** |
|
224 * Gets group id from Store Field. |
|
225 * |
|
226 * @param aField Store field. |
|
227 * @return Address group ID or EPbk2FieldGroupIdNone. |
|
228 */ |
|
229 TPbk2FieldGroupId GetFieldGroupL( MVPbkStoreContactField& aField ); |
|
230 |
|
231 private: // Data |
|
232 /// Ref: Contact editor control |
|
233 MPbk2ContactEditorControl* iEditorControl; |
|
234 /// Ref: Contact UI control |
|
235 MPbk2ContactUiControl* iUiControl; |
|
236 /// Ref: The edited contact |
|
237 MVPbkStoreContact* iContact; |
|
238 /// Ref: Command observer |
|
239 MPbk2CommandObserver* iObserver; |
|
240 /// Own: Map View Provider |
|
241 CMnProvider* iMapViewProvider; |
|
242 /// Own: Is in editor address view? |
|
243 TBool iAddressView; |
|
244 /// Own: command id |
|
245 TInt iCommandId; |
|
246 /// Own: Is in editor address view? |
|
247 TBool iAddressUpdatePrompt; |
|
248 }; |
|
249 |
|
250 #endif // CPMAPCMD_H |
|
251 |
|
252 // End of File |