|
1 /* |
|
2 * Copyright (c) 2005-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: CMnMapViewServiceBase class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <s32mem.h> |
|
21 #include <e32math.h> |
|
22 #include <lbsposition.h> |
|
23 |
|
24 #include <EPos_CPosLandmark.h> |
|
25 #include <epos_poslandmarkserialization.h> |
|
26 |
|
27 #include "mndebug.h" |
|
28 #include "mnerrors.h" |
|
29 #include "mninternal.h" |
|
30 #include "mninternal.inl" |
|
31 #include "mnmapselectionresultinfo.inl" |
|
32 |
|
33 #include "mnmapviewservicebase.h" |
|
34 |
|
35 // ======== LOCAL FUNCTIONS ======== |
|
36 |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 EXPORT_C CMnMapViewServiceBase::CMnMapViewServiceBase() |
|
43 { |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CMnMapViewServiceBase::~CMnMapViewServiceBase() |
|
50 { |
|
51 LOG("~CMnMapViewServiceBase in"); |
|
52 ResetLandmarks(); |
|
53 iLandmarks.Close(); |
|
54 iLinkedLandmarksLists.Close(); |
|
55 iTempDatabaseList.Close(); |
|
56 |
|
57 CleanSelectionResult(); |
|
58 delete iSelectionRequestText; |
|
59 LOG("~CMnMapViewServiceBase out"); |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C void CMnMapViewServiceBase::BaseConstructL() |
|
66 { |
|
67 LOG("CMnMapViewServiceBase::BaseConstructL"); |
|
68 CMnServiceBase::BaseConstructL(); |
|
69 iSelectionRequestText = HBufC::NewL( 0 ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C CMnMapView::TOptions CMnMapViewServiceBase::Options() |
|
76 { |
|
77 LOG("CMnMapViewServiceBase::Options"); |
|
78 return iOptions; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C CMnMapView::TCurrentLocationOption CMnMapViewServiceBase::CurrentLocationOption() |
|
85 { |
|
86 LOG("CMnMapViewServiceBase::CurrentLocationOption"); |
|
87 return iCurrentLocationOption; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C TArray<const CPosLandmark*> CMnMapViewServiceBase::LandmarksToShow() |
|
94 { |
|
95 LOG("CMnMapViewServiceBase::LandmarksToShow"); |
|
96 return iLandmarks.Array(); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 EXPORT_C TArray<TPosLmItemId> CMnMapViewServiceBase::LinkedLandmarksToShow( TInt aDbIndex ) |
|
103 { |
|
104 LOG1("CMnMapViewServiceBase::LinkedLandmarksToShow, db index %d", aDbIndex); |
|
105 if ( aDbIndex < 0 || aDbIndex >= iLinkedLandmarksLists.Count() ) |
|
106 { |
|
107 PanicServer( KMnPanicArrayIndexOutOfBounds ); |
|
108 } |
|
109 return iLinkedLandmarksLists[aDbIndex]->iLandmarkIds.Array(); |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C TArray<const HBufC*> CMnMapViewServiceBase::LandmarksToShowDatabases() |
|
116 { |
|
117 LOG("CMnMapViewServiceBase::LandmarksToShowDatabases"); |
|
118 if ( iTempDatabaseList.Count() != iLinkedLandmarksLists.Count() ) |
|
119 { |
|
120 // update database list |
|
121 iTempDatabaseList.Reset(); |
|
122 for ( TInt i = 0; i < iLinkedLandmarksLists.Count(); i++ ) |
|
123 { |
|
124 iTempDatabaseList.Append( iLinkedLandmarksLists[i]->iDatabaseUri ); |
|
125 } |
|
126 } |
|
127 return iTempDatabaseList.Array(); |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C TPtrC CMnMapViewServiceBase::SelectionRequestText() |
|
134 { |
|
135 LOG("CMnMapViewServiceBase::SelectionRequestText"); |
|
136 return iSelectionRequestText->Des(); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C TBool CMnMapViewServiceBase::IsAreaCentralPointSet() |
|
143 { |
|
144 LOG("CMnMapViewServiceBase::IsAreaCentralPointSet"); |
|
145 return !( Math::IsNaN( iCentralPoint.Latitude() ) && |
|
146 Math::IsNaN( iCentralPoint.Longitude() ) ); |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 EXPORT_C void CMnMapViewServiceBase::GetAreaCentralPoint( TCoordinate& aCentralPoint ) |
|
153 { |
|
154 LOG("CMnMapViewServiceBase::GetAreaCentralPoint"); |
|
155 aCentralPoint = iCentralPoint; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 EXPORT_C TReal CMnMapViewServiceBase::AreaRadius() |
|
162 { |
|
163 LOG("CMnMapViewServiceBase::AreaRadius"); |
|
164 return iRadius; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C void CMnMapViewServiceBase::CompleteSelectionRequestL( const CPosLandmark& aLandmark ) |
|
171 { |
|
172 LOG("CMnMapViewServiceBase::CompleteSelectionRequestL(free) in"); |
|
173 |
|
174 if ( !IsAsyncRequestActive() ) |
|
175 { |
|
176 PanicServer( KMnPanicAttemptToCompleteNoRequest ); |
|
177 } |
|
178 |
|
179 if ( iOptions & CMnMapView::EOptionRestrictSelection ) |
|
180 { |
|
181 User::Leave( KErrArgument ); |
|
182 } |
|
183 |
|
184 CleanSelectionResult(); |
|
185 |
|
186 iResultLandmark = PosLandmarkSerialization::PackL( aLandmark ); |
|
187 |
|
188 TMnMapSelectionResultInfo info( *iResultLandmark ); |
|
189 TPckgC<TMnMapSelectionResultInfo> resultInfoPack( info ); |
|
190 |
|
191 TInt err = iMessage.Write( EMnIpcMapSelectionResultInfoParamIndex, resultInfoPack ); |
|
192 |
|
193 CompleteRequest( err ); |
|
194 |
|
195 LOG("CMnMapViewServiceBase::CompleteSelectionRequestL(free) out"); |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C void CMnMapViewServiceBase::CompleteSelectionRequest( TInt aLandmarkIndex ) |
|
202 { |
|
203 LOG1("CMnMapViewServiceBase::CompleteSelectionRequest(index) in, index=%d", aLandmarkIndex); |
|
204 |
|
205 if ( !IsAsyncRequestActive() ) |
|
206 { |
|
207 PanicServer( KMnPanicAttemptToCompleteNoRequest ); |
|
208 } |
|
209 |
|
210 if ( aLandmarkIndex < 0 || aLandmarkIndex >= iLandmarks.Count() ) |
|
211 { |
|
212 PanicServer( KMnPanicArrayIndexOutOfBounds ); |
|
213 } |
|
214 |
|
215 CleanSelectionResult(); |
|
216 |
|
217 TMnMapSelectionResultInfo info( aLandmarkIndex ); |
|
218 TPckgC<TMnMapSelectionResultInfo> resultInfoPack( info ); |
|
219 |
|
220 TInt err = iMessage.Write( EMnIpcMapSelectionResultInfoParamIndex, resultInfoPack ); |
|
221 |
|
222 CompleteRequest( err ); |
|
223 |
|
224 LOG("CMnMapViewServiceBase::CompleteSelectionRequest(index) out"); |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C void CMnMapViewServiceBase::CompleteSelectionRequest( |
|
231 TPosLmItemId aLandmarkId, |
|
232 TInt aDbIndex) |
|
233 { |
|
234 LOG2("CMnMapViewServiceBase::CompleteSelectionRequest(id,db) in, dbIndex %d, lmId %d", |
|
235 aDbIndex, aLandmarkId); |
|
236 |
|
237 if ( !IsAsyncRequestActive() ) |
|
238 { |
|
239 PanicServer( KMnPanicAttemptToCompleteNoRequest ); |
|
240 } |
|
241 |
|
242 if ( aDbIndex < 0 || aDbIndex >= iLinkedLandmarksLists.Count() ) |
|
243 { |
|
244 LOG1("CMnMapViewServiceBase::CompleteSelectionRequest(id,db) dbIndex invalid, max %d", |
|
245 iLinkedLandmarksLists.Count()); |
|
246 PanicServer( KMnPanicArrayIndexOutOfBounds ); |
|
247 } |
|
248 |
|
249 if ( KErrNotFound == iLinkedLandmarksLists[aDbIndex]->iLandmarkIds.Find( aLandmarkId ) ) |
|
250 { |
|
251 LOG("CMnMapViewServiceBase::CompleteSelectionRequest(id,db) lmId not found"); |
|
252 PanicServer( KMnPanicArrayIndexOutOfBounds ); |
|
253 } |
|
254 |
|
255 CleanSelectionResult(); |
|
256 |
|
257 TMnMapSelectionResultInfo info( |
|
258 aLandmarkId, |
|
259 *(iLinkedLandmarksLists[aDbIndex]->iDatabaseUri) ); |
|
260 |
|
261 TPckgC<TMnMapSelectionResultInfo> resultInfoPack( info ); |
|
262 TInt err = iMessage.Write( EMnIpcMapSelectionResultInfoParamIndex, resultInfoPack ); |
|
263 |
|
264 CompleteRequest( err ); |
|
265 |
|
266 LOG("CMnMapViewServiceBase::CompleteSelectionRequest(id,db) out"); |
|
267 } |
|
268 |
|
269 // --------------------------------------------------------------------------- |
|
270 // --------------------------------------------------------------------------- |
|
271 // |
|
272 EXPORT_C void CMnMapViewServiceBase::ServiceL( const RMessage2& aMessage ) |
|
273 { |
|
274 LOG1("CMnMapViewServiceBase::ServiceL in, function %d", aMessage.Function()); |
|
275 |
|
276 switch ( aMessage.Function() ) |
|
277 { |
|
278 case EMnIpcAddLmIdsToShow: |
|
279 HandleAddLandmarkIdsToShowL( aMessage ); |
|
280 break; |
|
281 |
|
282 case EMnIpcAddLandmarksToShow: |
|
283 HandleAddLandmarksToShowL( aMessage ); |
|
284 break; |
|
285 |
|
286 case EMnIpcResetLandmarksToShow: // blind request |
|
287 ResetLandmarks(); |
|
288 break; |
|
289 |
|
290 case EMnIpcCancel: |
|
291 HandleCancelRequestL( aMessage ); |
|
292 break; |
|
293 |
|
294 case EMnIpcShowMap: |
|
295 UnpackOptionsL( aMessage ); |
|
296 LOG("CMnMapViewServiceBase::ServiceL, calling HandleShowMapL"); |
|
297 HandleShowMapL(); |
|
298 Complete( aMessage, KErrNone ); |
|
299 break; |
|
300 |
|
301 case EMnIpcShowCurrentLocation: |
|
302 UnpackOptionsL( aMessage ); |
|
303 LOG("CMnMapViewServiceBase::ServiceL, calling HandleShowCurrentLocationL"); |
|
304 HandleShowCurrentLocationL(); |
|
305 Complete( aMessage, KErrNone ); |
|
306 break; |
|
307 |
|
308 case EMnIpcInitRequestText: |
|
309 UnpackSelectionRequestTextL( aMessage ); |
|
310 Complete( aMessage, KErrNone ); |
|
311 break; |
|
312 |
|
313 case EMnIpcSelectFromMap: |
|
314 PrepareAsyncRequestL( aMessage ); |
|
315 UnpackOptionsL( aMessage ); |
|
316 UnpackSelectionRequestTextL( aMessage ); |
|
317 VerifySelectionRequestL(); |
|
318 LOG("CMnMapViewServiceBase::ServiceL, calling HandleSelectFromMapL"); |
|
319 HandleSelectFromMapL(); |
|
320 break; |
|
321 |
|
322 case EMnIpcGetSelectionResultLandmark: |
|
323 HandleGetSelectionResultLandmarkL( aMessage ); |
|
324 break; |
|
325 |
|
326 case EMnIpcGetSelectionResultDbUri: |
|
327 HandleGetSelectionResultDbUriL( aMessage ); |
|
328 break; |
|
329 |
|
330 default: |
|
331 CMnServiceBase::ServiceL( aMessage ); |
|
332 } |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // --------------------------------------------------------------------------- |
|
337 // |
|
338 void CMnMapViewServiceBase::CleanSelectionResult() |
|
339 { |
|
340 delete iResultLandmark; |
|
341 iResultLandmark = NULL; |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // --------------------------------------------------------------------------- |
|
346 // |
|
347 void CMnMapViewServiceBase::HandleAddLandmarkIdsToShowL( const RMessage2& aMessage ) |
|
348 { |
|
349 LOG("CMnMapViewServiceBase::HandleAddLandmarkIdsToShowL in"); |
|
350 |
|
351 if ( IsAsyncRequestActive() ) |
|
352 { |
|
353 User::Leave( KErrLocked ); |
|
354 } |
|
355 |
|
356 // Read client's data |
|
357 HBufC* uri = CopyClientBufferLC( aMessage, EMnIpcMapDbUriParamIndex ); |
|
358 HBufC8* buf = CopyClientBuffer8LC( aMessage, EMnIpcMapLmIdsParamIndex ); |
|
359 |
|
360 if ( buf->Size() % ( sizeof( TPosLmItemId ) ) != 0 ) |
|
361 { |
|
362 User::Leave( KErrArgument ); |
|
363 } |
|
364 |
|
365 TInt lmCount = buf->Size() / ( sizeof( TPosLmItemId ) ); |
|
366 const TPosLmItemId* ids = reinterpret_cast<const TPosLmItemId*>( buf->Ptr() ); |
|
367 |
|
368 // Save data to internal structs |
|
369 iTempDatabaseList.Reset(); |
|
370 CLinkedLandmarksList* linked = NULL; |
|
371 |
|
372 // check if this database is already listed |
|
373 TInt dbIndex = FindDatabase( *uri ); |
|
374 if ( dbIndex == KErrNotFound ) |
|
375 { |
|
376 linked = new (ELeave) CLinkedLandmarksList; |
|
377 CleanupStack::PushL( linked ); |
|
378 linked->iDatabaseUri = uri; |
|
379 iLinkedLandmarksLists.AppendL( linked ); |
|
380 CleanupStack::Pop( linked ); |
|
381 } |
|
382 else |
|
383 { |
|
384 linked = iLinkedLandmarksLists[dbIndex]; |
|
385 } |
|
386 |
|
387 for ( TInt i = 0; i < lmCount; i++ ) |
|
388 { |
|
389 linked->iLandmarkIds.AppendL( ids[i] ); |
|
390 } |
|
391 |
|
392 // Finalize |
|
393 Complete( aMessage, KErrNone ); |
|
394 |
|
395 CleanupStack::PopAndDestroy( buf ); |
|
396 CleanupStack::Pop( uri ); |
|
397 |
|
398 LOG("CMnMapViewServiceBase::HandleAddLandmarkIdsToShowL out"); |
|
399 } |
|
400 |
|
401 // --------------------------------------------------------------------------- |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 void CMnMapViewServiceBase::HandleAddLandmarksToShowL( const RMessage2& aMessage ) |
|
405 { |
|
406 LOG("CMnMapViewServiceBase::HandleAddLandmarksToShowL in"); |
|
407 |
|
408 if ( IsAsyncRequestActive() ) |
|
409 { |
|
410 User::Leave( KErrLocked ); |
|
411 } |
|
412 |
|
413 HBufC8* buf = CopyClientBuffer8LC( aMessage, EMnIpcMapLandmarksParamIndex ); |
|
414 RDesReadStream readStream( *buf ); |
|
415 |
|
416 LOG1("CMnMapViewServiceBase::HandleAddLandmarksToShowL buffersize %d", buf->Size()); |
|
417 |
|
418 TInt lmCount = readStream.ReadInt32L(); |
|
419 |
|
420 LOG1("CMnMapViewServiceBase::HandleAddLandmarksToShowL lmCount %d", lmCount); |
|
421 |
|
422 for ( TInt i = 0; i < lmCount; i++ ) |
|
423 { |
|
424 TInt lmSize = readStream.ReadInt32L(); |
|
425 |
|
426 HBufC8* lmBuf = HBufC8::NewLC( lmSize ); |
|
427 |
|
428 TPtr8 lmData( lmBuf->Des() ); |
|
429 readStream.ReadL( lmData, lmSize ); |
|
430 |
|
431 CPosLandmark* lm = PosLandmarkSerialization::UnpackL( *lmBuf ); |
|
432 CleanupStack::PushL( lm ); |
|
433 |
|
434 iLandmarks.AppendL( lm ); |
|
435 |
|
436 CleanupStack::Pop( lm ); |
|
437 CleanupStack::PopAndDestroy( lmBuf ); |
|
438 } |
|
439 |
|
440 readStream.Close(); |
|
441 CleanupStack::PopAndDestroy( buf ); |
|
442 |
|
443 Complete( aMessage, KErrNone ); |
|
444 LOG("CMnMapViewServiceBase::HandleAddLandmarksToShowL out"); |
|
445 } |
|
446 |
|
447 // --------------------------------------------------------------------------- |
|
448 // --------------------------------------------------------------------------- |
|
449 // |
|
450 void CMnMapViewServiceBase::HandleGetSelectionResultLandmarkL( const RMessage2& aMessage ) |
|
451 { |
|
452 LOG("CMnMapViewServiceBase::HandleGetSelectionResultLandmarkL in"); |
|
453 |
|
454 if ( iResultLandmark ) |
|
455 { |
|
456 aMessage.WriteL( EMnIpcMapSelResultBufferParamIndex, *iResultLandmark ); |
|
457 Complete( aMessage, KErrNone ); |
|
458 } |
|
459 else |
|
460 { |
|
461 User::Leave( KErrNotFound ); |
|
462 } |
|
463 |
|
464 LOG("CMnMapViewServiceBase::HandleGetSelectionResultLandmarkL out"); |
|
465 } |
|
466 |
|
467 // --------------------------------------------------------------------------- |
|
468 // --------------------------------------------------------------------------- |
|
469 // |
|
470 void CMnMapViewServiceBase::HandleGetSelectionResultDbUriL( const RMessage2& aMessage ) |
|
471 { |
|
472 LOG("CMnMapViewServiceBase::HandleGetSelectionResultDbUriL in"); |
|
473 |
|
474 __ASSERT_DEBUG( |
|
475 iResultDbIndex >= 0 && iResultDbIndex < iLinkedLandmarksLists.Count() , |
|
476 Panic( KErrGeneral ) ); |
|
477 |
|
478 if ( iResultDbIndex != KErrNotFound ) |
|
479 { |
|
480 __ASSERT_DEBUG( |
|
481 iLinkedLandmarksLists[iResultDbIndex]->iDatabaseUri , |
|
482 Panic( KErrGeneral ) ); |
|
483 |
|
484 aMessage.WriteL( |
|
485 EMnIpcMapSelResultBufferParamIndex, |
|
486 *(iLinkedLandmarksLists[iResultDbIndex]->iDatabaseUri) ); |
|
487 |
|
488 Complete( aMessage, KErrNone ); |
|
489 } |
|
490 else |
|
491 { |
|
492 User::Leave( KErrNotFound ); |
|
493 } |
|
494 |
|
495 LOG("CMnMapViewServiceBase::HandleGetSelectionResultDbUriL out"); |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------------------------- |
|
499 // --------------------------------------------------------------------------- |
|
500 // |
|
501 void CMnMapViewServiceBase::ResetLandmarks() |
|
502 { |
|
503 if ( !IsAsyncRequestActive() ) |
|
504 { |
|
505 iLandmarks.ResetAndDestroy(); |
|
506 iLinkedLandmarksLists.ResetAndDestroy(); |
|
507 } |
|
508 } |
|
509 |
|
510 // --------------------------------------------------------------------------- |
|
511 // --------------------------------------------------------------------------- |
|
512 // |
|
513 TInt CMnMapViewServiceBase::FindDatabase( const TDesC& aUri ) |
|
514 { |
|
515 for ( TInt i = 0; i < iLinkedLandmarksLists.Count(); i++ ) |
|
516 { |
|
517 CLinkedLandmarksList* list = iLinkedLandmarksLists[i]; |
|
518 if ( list->iDatabaseUri->Compare( aUri ) == 0 ) |
|
519 { |
|
520 return i; |
|
521 } |
|
522 } |
|
523 return KErrNotFound; |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------------------------- |
|
527 // --------------------------------------------------------------------------- |
|
528 // |
|
529 void CMnMapViewServiceBase::UnpackOptionsL( const RMessage2& aMsg ) |
|
530 { |
|
531 HBufC8* buf = CopyClientBuffer8LC( aMsg, EMnIpcMapOptionsParamIndex ); |
|
532 const TMnMapOptions& options = *( |
|
533 reinterpret_cast<const TMnMapOptions*>( buf->Ptr() ) ); |
|
534 |
|
535 iOptions = options.iOptions; |
|
536 iCurrentLocationOption = options.iCurrentLocationOption; |
|
537 iCentralPoint = options.iCentralPoint; |
|
538 iRadius = options.iRadius; |
|
539 |
|
540 CleanupStack::PopAndDestroy( buf ); |
|
541 } |
|
542 |
|
543 // --------------------------------------------------------------------------- |
|
544 // --------------------------------------------------------------------------- |
|
545 // |
|
546 void CMnMapViewServiceBase::UnpackSelectionRequestTextL( const RMessage2& aMsg ) |
|
547 { |
|
548 HBufC* buf = CopyClientBufferLC( aMsg, EMnIpcMapSelectionTextParamIndex ); |
|
549 |
|
550 delete iSelectionRequestText; |
|
551 iSelectionRequestText = NULL; |
|
552 iSelectionRequestText = buf; |
|
553 |
|
554 CleanupStack::Pop( buf ); |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // --------------------------------------------------------------------------- |
|
559 // |
|
560 void CMnMapViewServiceBase::VerifySelectionRequestL() |
|
561 { |
|
562 if ( iOptions & CMnMapView::EOptionRestrictSelection ) |
|
563 { |
|
564 // find out how many landmarks are given |
|
565 TInt num = iLandmarks.Count(); |
|
566 for ( TInt i = 0; i < iLinkedLandmarksLists.Count(); i++ ) |
|
567 { |
|
568 CLinkedLandmarksList* linked = iLinkedLandmarksLists[i]; |
|
569 num += linked->iLandmarkIds.Count(); |
|
570 } |
|
571 LOG1("CMnMapViewServiceBase::VerifySelectionRequestL, restricted with %d landmarks", num); |
|
572 if ( num < 1 ) |
|
573 { |
|
574 User::Leave( KErrArgument ); |
|
575 } |
|
576 } |
|
577 } |
|
578 |
|
579 // --------------------------------------------------------------------------- |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 CMnMapViewServiceBase::CLinkedLandmarksList::~CLinkedLandmarksList() |
|
583 { |
|
584 delete iDatabaseUri; |
|
585 iLandmarkIds.Close(); |
|
586 } |
|
587 |
|
588 |