|
1 /* |
|
2 * Copyright (c) 2005 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: Action class for handling location related commands |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __LOCATIONUI_H__ |
|
21 #define __LOCATIONUI_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <AknLaunchAppService.h> |
|
26 #include <AknServerApp.h> // MAknServerAppExitObserver |
|
27 #include <mnprovider.h> |
|
28 #include <calencommandhandler.h> |
|
29 #include <calennotificationhandler.h> // MCalenNotificationHandler |
|
30 |
|
31 #include "calenselectionobserver.h" |
|
32 #include "calencurrentlocationobserver.h" |
|
33 #include "calencurrentlocationacquisition.h" |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CCalenController; |
|
37 class CMnMapView; |
|
38 class CCalenLocationActiveSelector; |
|
39 class CCalenGlobalData; |
|
40 class CPosLandmark; |
|
41 class TPosition; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * CCalenLocationUi encapsulates location/Map related behavior in Calendar application. |
|
47 * |
|
48 */ |
|
49 NONSHARABLE_CLASS( CCalenLocationUi ) : public CBase, |
|
50 public MCalenNotificationHandler, |
|
51 public MCalenCommandHandler, |
|
52 public MAknServerAppExitObserver, |
|
53 public MCalenSelectionObserver, |
|
54 public MCalenCurrentLocationObserver |
|
55 { |
|
56 public: // public API |
|
57 /** |
|
58 * Symbian 1st phase construction |
|
59 * @param aController Reference of the controller that owns the editui |
|
60 */ |
|
61 IMPORT_C static CCalenLocationUi* NewL( CCalenController& aController ); |
|
62 |
|
63 /** |
|
64 * Destructor |
|
65 */ |
|
66 virtual ~CCalenLocationUi(); |
|
67 |
|
68 void MapClosed(); |
|
69 |
|
70 public: // MCalenCommandHandler |
|
71 |
|
72 /** |
|
73 * From MCalenCommandHandler. |
|
74 * Handles key presses. |
|
75 * |
|
76 * @param aCommand The command Id of the key. |
|
77 */ |
|
78 TBool HandleCommandL( const TCalenCommand& aCommand ); |
|
79 |
|
80 /** |
|
81 * From MCalenCommandHandler. |
|
82 * Allows extending this API without breaking BC. |
|
83 * |
|
84 * @param aExtensionUid specifies |
|
85 * @return extension of the requested type |
|
86 */ |
|
87 TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid ); |
|
88 |
|
89 public: // from MCalenNotificationHandler |
|
90 /** |
|
91 * Handle notifications |
|
92 * @param aNotification Nofication to be handled |
|
93 */ |
|
94 void HandleNotification(const TCalenNotification aNotification ); |
|
95 |
|
96 public: // from MAknServerAppExitObserver |
|
97 /** |
|
98 * Handle the exit of a connected server app. |
|
99 * @param aReason The reason that the server application exited. |
|
100 * This will either be an error code, or the command id that caused |
|
101 * the server app to exit. |
|
102 */ |
|
103 void HandleServerAppExit(TInt aReason); |
|
104 |
|
105 public: // From MCalenSelectionObserver |
|
106 /** |
|
107 * Handles user selection for a location on the map. |
|
108 * @param aMapView Map View object through which map is launched |
|
109 * aError Error code if any generated from the maps |
|
110 */ |
|
111 void HandleSelectionCompletedL( CMnMapView& aMapView, TInt aError ); |
|
112 |
|
113 public: // From MCalenCurrentLocationObserver |
|
114 /** |
|
115 * Callback function that gets called when current locaiton |
|
116 * async request to get current location is complete |
|
117 */ |
|
118 void NotifyCurrentLocationL( ); |
|
119 |
|
120 /** |
|
121 * Callback function that gets called if there is any error |
|
122 * while fetching coordinates for current location |
|
123 * @param errorCode Error code |
|
124 */ |
|
125 void NotifyErrorL(const TInt errorCode); |
|
126 |
|
127 private: // own methods |
|
128 /** |
|
129 * C++ constructor |
|
130 * @param aController Reference to the controller that owns the caleneditui |
|
131 */ |
|
132 CCalenLocationUi( CCalenController& aController ); |
|
133 |
|
134 /** |
|
135 * Symbian 2nd phase constructor |
|
136 */ |
|
137 void ConstructL(); |
|
138 |
|
139 /** |
|
140 * Function to make request for current locaiton coordinates |
|
141 */ |
|
142 void RequestCurrenLocationL(); |
|
143 |
|
144 /** |
|
145 * Issues asynchronous request to launch the map with coords of current location |
|
146 * for user selection. It uses LocationSelector active object to listen to the |
|
147 * user selection. |
|
148 * @param aPosition Current position |
|
149 */ |
|
150 void LaunchMapL(TPosition& aPosition); |
|
151 |
|
152 /** |
|
153 * Issues asynchronous request to launch the map with default coords for user selection |
|
154 * It uses LocationSelector active object to listen to the user selection |
|
155 */ |
|
156 void LaunchMapL(); |
|
157 |
|
158 /** |
|
159 * Issues synchronous request to show a particular location on the map |
|
160 */ |
|
161 void ShowLocationOnMapL(); |
|
162 |
|
163 /** |
|
164 * Returns the currently available map providers in the system |
|
165 * @param aServicesNeeded List of services needed from the Map provider |
|
166 * @return Map Provider object |
|
167 */ |
|
168 CMnProvider* GetFirstProviderL( CMnProvider::TServices aServicesNeeded ); |
|
169 |
|
170 /** |
|
171 * Function to query user whether to replace or keep existing location |
|
172 * @param aLocaitonName Location name to be prompted to the user |
|
173 */ |
|
174 TInt ShowLocationReplaceNoticeL(TPtrC aLocaitonName); |
|
175 |
|
176 /** |
|
177 * Stores the locaiton details of currently focusses entry in Day/Event Viewer |
|
178 * into Agenda Server |
|
179 * @param landmark LandMark object |
|
180 */ |
|
181 void StoreLocationInfoL(CPosLandmark* landmark); |
|
182 |
|
183 /** |
|
184 * Function to query user whether to append or replace the exisitng location details |
|
185 * @return User response |
|
186 */ |
|
187 TInt ShowLocationAppendOrReplaceL(); |
|
188 |
|
189 /** |
|
190 * Displays "Address Updated" transient notice to the user |
|
191 * @return None |
|
192 **/ |
|
193 void ShowAddressUpdatedNoticeL(); |
|
194 |
|
195 /** |
|
196 * Function to query user to define a location as location field is empty when "Show locaiton" |
|
197 * hard key is pressed. |
|
198 * @return User response |
|
199 **/ |
|
200 TInt ShowDefineLocationQuery(); |
|
201 |
|
202 |
|
203 private: // data |
|
204 CCalenController& iController; |
|
205 CCalenGlobalData* iGlobalData; |
|
206 CMnProvider* iProvider; |
|
207 CMnMapView* iMapView; |
|
208 CCalenLocationActiveSelector* iLocationSelector; |
|
209 CCalenCurrentLocationAcquisition* iCurrLocAcquisition; |
|
210 TBool isRequestPending; |
|
211 TBool isGetLocationAndSave; // When requested from Views |
|
212 TBool isReplaceLocation; // When requested from Views |
|
213 TPosition iCurrPosition; |
|
214 TBool isCurrLocAvailable; |
|
215 HBufC* iLocationText; |
|
216 }; |
|
217 |
|
218 #endif /* __LOCATIONUI_H__ */ |