|
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: Applications interface class to map and navigation use cases |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "glxcommandhandleraiwshowonmaphardkey.h" |
|
23 |
|
24 #include <data_caging_path_literals.hrh> |
|
25 #include <epos_poslandmarkserialization.h> |
|
26 #include <EPos_CPosLandmark.h> |
|
27 #include <StringLoader.h> |
|
28 #include <glxuiutilities.rsg> |
|
29 #include <glxgeneraluiutilities.h> |
|
30 #include <glxcommandhandlers.hrh> |
|
31 #include <mnaiwservices.h> |
|
32 #include <mnmapview.h> |
|
33 #include <glxtracer.h> |
|
34 #include <mglxmedialist.h> // for accessing the media items |
|
35 |
|
36 |
|
37 |
|
38 // ============================ MEMBER FUNCTIONS =============================== |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CGlxCommandHandlerAiwShowMapHardKey() |
|
42 // ----------------------------------------------------------------------------- |
|
43 CGlxCommandHandlerAiwShowMapHardKey::CGlxCommandHandlerAiwShowMapHardKey(MGlxMediaListProvider* |
|
44 aMediaListProvider, TBool aHasToolbarItem) |
|
45 :CGlxMediaListCommandHandler(aMediaListProvider,aHasToolbarItem) |
|
46 { |
|
47 TRACER("CGlxCommandHandlerAiwShowMapHardKey::CGlxCommandHandlerAiwShowMapHardKey()"); |
|
48 // No Implementation |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CGlxCommandHandlerAiwShowMapHardKey::ConstructL |
|
53 // ----------------------------------------------------------------------------- |
|
54 void CGlxCommandHandlerAiwShowMapHardKey::ConstructL() |
|
55 { |
|
56 TRACER("CGlxCommandHandlerAiwShowMapHardKey::ConstructL()"); |
|
57 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
58 iAiwServiceHandler->AttachL( R_GLX_AIW_SHOWMAP_INTEREST_HARDKEY ); |
|
59 |
|
60 iInList = CAiwGenericParamList::NewL(); |
|
61 iOutList = CAiwGenericParamList::NewL(); |
|
62 |
|
63 // Add the upload command |
|
64 TCommandInfo info(KGlxCmdMnShowMap); |
|
65 AddCommandL(info); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CGlxCommandHandlerAiwShowMapHardKey::NewL |
|
70 // ----------------------------------------------------------------------------- |
|
71 EXPORT_C CGlxCommandHandlerAiwShowMapHardKey* CGlxCommandHandlerAiwShowMapHardKey:: |
|
72 NewL(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) |
|
73 { |
|
74 TRACER("CGlxCommandHandlerAiwShowMapHardKey::NewL()"); |
|
75 CGlxCommandHandlerAiwShowMapHardKey* self = new (ELeave) CGlxCommandHandlerAiwShowMapHardKey( |
|
76 aMediaListProvider,aHasToolbarItem); |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop(self); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // ~CGlxCommandHandlerAiwShowMapHardKey |
|
85 // C++ Destructor |
|
86 // ----------------------------------------------------------------------------- |
|
87 CGlxCommandHandlerAiwShowMapHardKey::~CGlxCommandHandlerAiwShowMapHardKey() |
|
88 { |
|
89 TRACER("CGlxCommandHandlerAiwShowMapHardKey::~CGlxCommandHandlerAiwShowMapHardKey"); |
|
90 if (iAiwServiceHandler) |
|
91 { |
|
92 delete iAiwServiceHandler; |
|
93 iAiwServiceHandler = NULL; |
|
94 } |
|
95 if (iInList) |
|
96 { |
|
97 delete iInList; |
|
98 iInList = NULL; |
|
99 } |
|
100 if (iOutList) |
|
101 { |
|
102 delete iOutList; |
|
103 iOutList = NULL; |
|
104 } |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // DoExecuteL |
|
109 // ---------------------------------------------------------------------------- |
|
110 TBool CGlxCommandHandlerAiwShowMapHardKey::DoExecuteL (TInt /*aCommandId*/, MGlxMediaList& aList) |
|
111 { |
|
112 TRACER("CGlxCommandHandlerAiwShowMapHardKey::DoExecuteL"); |
|
113 TBool handled = EFalse; |
|
114 TCoordinate coordinate; |
|
115 TInt focusIndex = aList.FocusIndex(); |
|
116 const TGlxMedia& item = aList.Item(focusIndex); |
|
117 |
|
118 if(item.GetCoordinate(coordinate)) |
|
119 { |
|
120 CPosLandmark* lmk = CPosLandmark::NewLC(); |
|
121 TLocality locality; |
|
122 HBufC8* lmBuf; |
|
123 |
|
124 //set location |
|
125 locality.SetCoordinate( coordinate.Latitude(), coordinate.Longitude(), |
|
126 coordinate.Altitude() ); |
|
127 |
|
128 lmk->SetPositionL(locality); |
|
129 |
|
130 //set in parameters |
|
131 iInList->Reset(); |
|
132 lmBuf =PosLandmarkSerialization::PackL( *lmk ); |
|
133 CleanupStack::PushL( lmBuf ); |
|
134 TAiwGenericParam param( EGenericParamLandmark, TAiwVariant( *lmBuf ) ); |
|
135 iInList->AppendL( param ); |
|
136 TMnAiwCommonOptionsParam options; |
|
137 options.iRunChained = EFalse; |
|
138 TPckg<TMnAiwCommonOptionsParam> optionsPack( options ); |
|
139 TAiwGenericParam optParam( EGenericParamMnCommonOptions, TAiwVariant( optionsPack ) ); |
|
140 iInList->AppendL( optParam ); |
|
141 |
|
142 iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdMnShowMap, *iInList, *iOutList, 0); |
|
143 |
|
144 CleanupStack::PopAndDestroy( lmBuf); |
|
145 CleanupStack::PopAndDestroy( lmk); |
|
146 handled = ETrue; |
|
147 } |
|
148 else |
|
149 { |
|
150 // if location info not present then display note to put on camera settings |
|
151 HBufC* popupText = StringLoader::LoadLC( |
|
152 R_GLX_POPUP_NO_LOCATION_INFO); |
|
153 GlxGeneralUiUtilities::ShowInfoNoteL( popupText->Des(), EFalse ); |
|
154 CleanupStack::PopAndDestroy( popupText ); |
|
155 } |
|
156 return handled; |
|
157 } |
|
158 |
|
159 // ---------------------------------------------------------------------------- |
|
160 // DoActivateL |
|
161 // ---------------------------------------------------------------------------- |
|
162 void CGlxCommandHandlerAiwShowMapHardKey::DoActivateL(TInt aViewId) |
|
163 { |
|
164 TRACER("CGlxCommandHandlerAiwShowMapHardKey::DoActivateL"); |
|
165 iViewId = aViewId; |
|
166 |
|
167 } |
|
168 |
|
169 // ---------------------------------------------------------------------------- |
|
170 // Deactivate |
|
171 // ---------------------------------------------------------------------------- |
|
172 void CGlxCommandHandlerAiwShowMapHardKey::Deactivate() |
|
173 { |
|
174 TRACER("CGlxCommandHandlerAiwShowMapHardKey::Deactivate"); |
|
175 |
|
176 } |
|
177 |
|
178 // The below code is commented out as this implementation is for Future commandhandler |
|
179 // To check map service providers |
|
180 // To navigate to the location |
|
181 |
|
182 /* |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CGlxCommandHandlerAiwShowMapHardKey::NavigateToPlaceL |
|
185 // It will navigate to location |
|
186 // ----------------------------------------------------------------------------- |
|
187 void CGlxCommandHandlerAiwShowMapHardKey::NavigateToPlaceL( const TCoordinate& aCoordinate ) |
|
188 { |
|
189 CPosLandmark* lmk = CPosLandmark::NewLC(); |
|
190 TLocality locality; |
|
191 HBufC8* lmBuf; |
|
192 |
|
193 //set location |
|
194 locality.SetCoordinate( aCoordinate.Latitude(), aCoordinate.Longitude(), aCoordinate.Altitude() ); |
|
195 lmk->SetPositionL(locality); |
|
196 |
|
197 //set in parameters |
|
198 iInList->Reset(); |
|
199 lmBuf =PosLandmarkSerialization::PackL( *lmk ); |
|
200 CleanupStack::PushL( lmBuf ); |
|
201 TAiwGenericParam param( EGenericParamLandmark, TAiwVariant( *lmBuf ) ); |
|
202 iInList->AppendL( param ); |
|
203 TMnAiwCommonOptionsParam options; |
|
204 options.iRunChained = EFalse; |
|
205 TPckg<TMnAiwCommonOptionsParam> optionsPack( options ); |
|
206 TAiwGenericParam optParam( EGenericParamMnCommonOptions, TAiwVariant( optionsPack ) ); |
|
207 iInList->AppendL( optParam ); |
|
208 |
|
209 //navigate to location |
|
210 // iAiwServiceHandler->AttachL( R_EVTMGMTUI_AIW_INTEREST_NAVIGATETO ); |
|
211 iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdMnNavigateTo, *iInList, *iOutList, 0, this ); |
|
212 |
|
213 CleanupStack::PopAndDestroy( 2 ); //lmbuf, lmk |
|
214 } |
|
215 |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CGlxCommandHandlerAiwShowMapHardKey::MapServiceProvidersL |
|
219 // It will return total map service providers. |
|
220 // @ret total number of map service providers |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 TInt CGlxCommandHandlerAiwShowMapHardKey::MapServiceProvidersL() |
|
224 { |
|
225 #if 0 |
|
226 RPointerArray<CMnProvider> providers; |
|
227 // get all providers |
|
228 MnProviderFinder::FindProvidersL( providers ); |
|
229 TInt total = providers.Count(); |
|
230 providers.ResetAndDestroy(); |
|
231 providers.Close(); |
|
232 // Debug(_L("Total map service providers = %d"), total); |
|
233 return total; |
|
234 #endif |
|
235 return 0; |
|
236 } |
|
237 */ |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CGlxCommandHandlerAiwShowMapHardKey::HandleNotifyL |
|
240 // Derived from MAiwNotifyCallback |
|
241 // ----------------------------------------------------------------------------- |
|
242 //TInt CGlxCommandHandlerAiwShowMapHardKey::HandleNotifyL( TInt aCmdId, |
|
243 // TInt aEventId, |
|
244 // CAiwGenericParamList& aEventParamList, |
|
245 // const CAiwGenericParamList& aInParamList ) |
|
246 // { |
|
247 // if ( iOutList->Count() ) //if location is selected on map |
|
248 // { |
|
249 // const TAiwGenericParam& param = ( *iOutList )[0]; |
|
250 // if ( EGenericParamLandmark == param.SemanticId() ) |
|
251 // { |
|
252 // TPtrC8 landmarkData( param.Value().AsData() ); |
|
253 // CPosLandmark* lm = PosLandmarkSerialization::UnpackL( landmarkData ); |
|
254 // CleanupStack::PushL( lm ); |
|
255 // |
|
256 // SetPlaceFromLandmarkL( *lm ); |
|
257 // CleanupStack::PopAndDestroy( lm ); |
|
258 // iOutList->Reset(); |
|
259 // iObserver->HandleMapAndNavigationResponseL( KErrNone, *iPlace, iTriggerLocation ); |
|
260 // } |
|
261 // else |
|
262 // { |
|
263 // iOutList->Reset(); |
|
264 // iObserver->HandleMapAndNavigationResponseL( KErrCancel, *iPlace, iTriggerLocation ); |
|
265 // } |
|
266 // } |
|
267 // else //if map application is cancelled |
|
268 // iObserver->HandleMapAndNavigationResponseL( KErrCancel, *iPlace, iTriggerLocation ); |
|
269 // return KErrNone; |
|
270 // } |
|
271 |
|
272 // End of file |
|
273 |