|
1 /* |
|
2 * Copyright (c) 2002-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: Filtered landmarks list provider |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 #include <EPos_CPosLmPartialReadParameters.h> |
|
21 #include <EPos_CPosLandmark.h> |
|
22 #include <EPos_TPosLmSortPref.h> |
|
23 #include <EPos_CPosLandmarkDatabase.h> |
|
24 #include <EPos_CPosLmItemIterator.h> |
|
25 #include <EPos_CPosLmSearchCriteria.h> |
|
26 #include <EPos_CPosLandmarkSearch.h> |
|
27 #include <e32math.h> |
|
28 #include <EPos_CPosLmCompositeCriteria.h> |
|
29 #include <EPos_CPosLmCategoryCriteria.h> |
|
30 #include <EPos_CPosLmIdListCriteria.h> |
|
31 #include <EPos_CPosLmTextCriteria.h> |
|
32 #include <AknWaitDialog.h> |
|
33 #include <lmkui.rsg> |
|
34 |
|
35 // USER INCLUDES |
|
36 #include "CLmkSearchedLmListProvider.h" |
|
37 #include "CLmkLandmarkUiItem.h" |
|
38 #include "CLmkAOOperation.h" |
|
39 #include "MLmkSelectorIconMgr.h" |
|
40 #include <lmkerrors.h> |
|
41 |
|
42 // CONSTANTS |
|
43 _LIT(KSpaceTextCriteria,"* "); |
|
44 _LIT(KDefaultTextCriteria,"*"); |
|
45 |
|
46 #if defined(_DEBUG) |
|
47 // CONSTANTS |
|
48 /// Unnamed namespace for local definitions |
|
49 namespace { |
|
50 |
|
51 _LIT( KPanicMsg, "CLmkSearchedLmListProvider" ); |
|
52 |
|
53 void Panic( TPanicCode aReason ) |
|
54 { |
|
55 User::Panic( KPanicMsg, aReason ); |
|
56 } |
|
57 } // namespace |
|
58 #endif |
|
59 // ============================ MEMBER FUNCTIONS =============================== |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CLmkSearchedLmListProvider::CLmkSearchedLmListProvider |
|
63 // C++ constructor can NOT contain any code, that |
|
64 // might leave. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CLmkSearchedLmListProvider::CLmkSearchedLmListProvider( |
|
68 CPosLandmarkDatabase& aDb, |
|
69 CPosLmSearchCriteria& aCriteria ) |
|
70 : CLmkLmItemListProvider( aDb ), |
|
71 iCriteria( aCriteria ), |
|
72 iIsSecondSearchStarted(EFalse) |
|
73 { |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CLmkSearchedLmListProvider::ConstructL |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CLmkSearchedLmListProvider::ConstructL() |
|
82 { |
|
83 // base class 2nd phase constructor |
|
84 CLmkLmItemListProvider::BaseConstructL(); |
|
85 |
|
86 iReadParams = CPosLmPartialReadParameters::NewLC(); |
|
87 CleanupStack::Pop(); // iReadParams |
|
88 iReadParams->SetRequestedAttributes( CPosLandmark::ELandmarkName | |
|
89 CPosLandmark::EIcon | CPosLandmark::ECategoryInfo); |
|
90 |
|
91 iSearch = CPosLandmarkSearch::NewL( iDb ); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CLmkSearchedLmListProvider::NewL |
|
96 // Two-phased constructor. |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 CLmkSearchedLmListProvider* CLmkSearchedLmListProvider::NewL( |
|
100 CPosLandmarkDatabase& aDb, |
|
101 CPosLmSearchCriteria& aCriteria ) |
|
102 { |
|
103 CLmkSearchedLmListProvider* self = |
|
104 new ( ELeave ) CLmkSearchedLmListProvider( aDb, aCriteria ); |
|
105 |
|
106 CleanupStack::PushL( self ); |
|
107 self->ConstructL(); |
|
108 CleanupStack::Pop(); |
|
109 |
|
110 return self; |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------- |
|
114 // CLmkSearchedLmListProvider::~CLmkSearchedLmListProvider |
|
115 // --------------------------------------------------------- |
|
116 // |
|
117 CLmkSearchedLmListProvider::~CLmkSearchedLmListProvider() |
|
118 { |
|
119 delete iReadParams; |
|
120 delete iSearch; |
|
121 if (iSearchAO) |
|
122 { |
|
123 iSearchAO->StopOperation(); |
|
124 } |
|
125 delete iSearchAO; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------- |
|
129 // CLmkSearchedLmListProvider::ItemAtL |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 CLmkUiItemBase* CLmkSearchedLmListProvider::ItemAtL( TInt aIndex ) |
|
133 { |
|
134 __ASSERT_DEBUG( iIconMgr, Panic( KLmkPanicNullMember ) ); |
|
135 //landmark with updated icon, if associated with one cat. |
|
136 CPosLandmark* landmark = GetLandmarkLC(aIndex); |
|
137 TPtrC mbmFile; |
|
138 TInt iconFileIndex = -1; |
|
139 TInt iconListIndex = -1; |
|
140 TInt iconMasktIndex = -1; |
|
141 TInt result = landmark->GetIcon( mbmFile, iconFileIndex, iconMasktIndex ); |
|
142 if ( result == KErrNone ) |
|
143 { |
|
144 TRAPD(err, iconListIndex = |
|
145 iIconMgr->GetIconL( mbmFile, iconFileIndex ) ); |
|
146 if ( err == KErrNotFound ) // icon file not found -> fallback to default |
|
147 { |
|
148 iconListIndex = iIconMgr->GetDefaultIconL( |
|
149 MLmkSelectorIconMgr::ELandmarkDefaultIcon ); |
|
150 } |
|
151 } |
|
152 else |
|
153 { |
|
154 iconListIndex = iIconMgr->GetDefaultIconL( |
|
155 MLmkSelectorIconMgr::ELandmarkDefaultIcon ); |
|
156 } |
|
157 |
|
158 CLmkLandmarkUiItem* uiItem = |
|
159 CLmkLandmarkUiItem::NewL( landmark, iconListIndex ); |
|
160 CleanupStack::Pop(); // landmark, ownership transferred |
|
161 return uiItem; |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------- |
|
165 // CLmkSearchedLmListProvider::PrepareListL |
|
166 // --------------------------------------------------------- |
|
167 // |
|
168 void CLmkSearchedLmListProvider::PrepareListL() |
|
169 { |
|
170 iCount = 0; |
|
171 |
|
172 iDb.SetPartialReadParametersL( *iReadParams ); |
|
173 |
|
174 TPosLmSortPref sortOrder( CPosLandmark::ELandmarkName, |
|
175 TPosLmSortPref::EAscending ); |
|
176 CPosLmOperation* operation = |
|
177 iSearch->StartLandmarkSearchL( iCriteria, sortOrder ); |
|
178 CleanupStack::PushL( operation ); |
|
179 if (iSearchAO) |
|
180 { |
|
181 iSearchAO->StopOperation(); |
|
182 delete iSearchAO; // cancel possibly pending operation |
|
183 iSearchAO = NULL; |
|
184 } |
|
185 iSearchAO = CLmkAOOperation::NewL( operation, |
|
186 *this, |
|
187 MLmkAOOperationObserver::ESearch, |
|
188 iOperationNotInUse ); |
|
189 iOperationNotInUse = ETrue; |
|
190 CleanupStack::Pop( operation ); // ownership transferred |
|
191 iSearchAO->StartOperation(); |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CLmkSearchedLmListProvider::PrepareListL |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 TBool CLmkSearchedLmListProvider::PrepareListL(const TDesC& aSearchPattern, |
|
199 TBool aSearchOnlyInPreviousMatches) |
|
200 { |
|
201 iCount = 0; |
|
202 iRequestFromFindBox = ETrue; |
|
203 iOperationNotInUse = ETrue; |
|
204 iIsSecondSearchStarted = EFalse; |
|
205 |
|
206 if( aSearchPattern.Compare( KDefaultTextCriteria ) == 0 |
|
207 || aSearchPattern.Length() <= 0 ) |
|
208 { |
|
209 PrepareListL(); |
|
210 iRequestFromFindBox = EFalse; |
|
211 return ETrue; |
|
212 } |
|
213 |
|
214 // We need to cancel if we are searching/reading landmarks. |
|
215 if (iSearchAO) |
|
216 { |
|
217 iSearchAO->StopOperation(); |
|
218 delete iSearchAO; // cancel possibly pending operation |
|
219 iSearchAO = NULL; |
|
220 } |
|
221 |
|
222 // Create the composite criterion |
|
223 CPosLmCompositeCriteria* compCrit = CPosLmCompositeCriteria::NewLC( |
|
224 CPosLmCompositeCriteria::ECompositionOR ); |
|
225 |
|
226 // Create the text search criterion and add it to composite |
|
227 CPosLmTextCriteria* textCrit1 = CPosLmTextCriteria::NewLC(); |
|
228 |
|
229 const TInt KExtraChars = 3; // 2 chars wildcards |
|
230 HBufC* filterBuf = HBufC::NewLC(aSearchPattern.Length() + KExtraChars); |
|
231 TPtr filter = filterBuf->Des(); |
|
232 filter.Copy(KSpaceTextCriteria); |
|
233 filter.Append(aSearchPattern); |
|
234 |
|
235 textCrit1->SetTextL( filter ); |
|
236 textCrit1->SetAttributesToSearch(CPosLandmark::ELandmarkName); |
|
237 |
|
238 User::LeaveIfError( compCrit->AddArgument( textCrit1 ) ); |
|
239 // Ownership of the text criterion has been passed to the composite |
|
240 CleanupStack::PopAndDestroy( filterBuf ); |
|
241 CleanupStack::Pop( textCrit1 ); |
|
242 |
|
243 // Create the text search criterion and add it to composite |
|
244 CPosLmTextCriteria* textCrit2 = CPosLmTextCriteria::NewLC(); |
|
245 textCrit2->SetTextL( aSearchPattern ); |
|
246 textCrit2->SetAttributesToSearch(CPosLandmark::ELandmarkName); |
|
247 |
|
248 User::LeaveIfError( compCrit->AddArgument( textCrit2 ) ); |
|
249 // Ownership of the text criterion has been passed to the composite |
|
250 CleanupStack::Pop( textCrit2 ); |
|
251 |
|
252 iDb.SetPartialReadParametersL( *iReadParams ); |
|
253 |
|
254 TPosLmSortPref sortOrder( CPosLandmark::ELandmarkName, |
|
255 TPosLmSortPref::EAscending ); |
|
256 // Start the search |
|
257 // Create search operation |
|
258 CPosLmOperation* operation = iSearch->StartLandmarkSearchL( |
|
259 *compCrit, sortOrder, aSearchOnlyInPreviousMatches ); |
|
260 |
|
261 CleanupStack::PopAndDestroy( compCrit ); |
|
262 CleanupStack::PushL( operation ); |
|
263 |
|
264 iSearchAO = CLmkAOOperation::NewL( operation, |
|
265 *this, |
|
266 MLmkAOOperationObserver::ESearch, |
|
267 ETrue ); |
|
268 CleanupStack::Pop( operation ); // ownership transferred |
|
269 |
|
270 iSearchAO->StartOperation(); |
|
271 |
|
272 return ETrue; |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------- |
|
276 // CLmkSearchedLmListProvider::StartSecondSearchL |
|
277 // --------------------------------------------------------- |
|
278 // |
|
279 void CLmkSearchedLmListProvider::StartSecondSearchL() |
|
280 { |
|
281 // Create the composite criterion |
|
282 CPosLmCompositeCriteria* compCrit = CPosLmCompositeCriteria::NewLC( |
|
283 CPosLmCompositeCriteria::ECompositionAND ); |
|
284 |
|
285 // Create the category search criterion and add it to composite |
|
286 CPosLmCategoryCriteria* catCrit = CPosLmCategoryCriteria::NewLC(); |
|
287 catCrit->SetCategoryItemId( (static_cast<CPosLmCategoryCriteria&>(iCriteria)).CategoryItemId() ); |
|
288 |
|
289 User::LeaveIfError( compCrit->AddArgument( catCrit ) ); |
|
290 // Ownership of the category criterion has been passed to the composite |
|
291 CleanupStack::Pop( catCrit ); |
|
292 |
|
293 // Create the text search criterion and add it to composite |
|
294 CPosLmIdListCriteria* idListCrit = CPosLmIdListCriteria::NewLC(); |
|
295 idListCrit->SetLandmarkIdsL( iIdArray ); |
|
296 |
|
297 User::LeaveIfError( compCrit->AddArgument( idListCrit ) ); |
|
298 // Ownership of the text criterion has been passed to the composite |
|
299 CleanupStack::Pop( idListCrit ); |
|
300 |
|
301 iDb.SetPartialReadParametersL( *iReadParams ); |
|
302 |
|
303 TPosLmSortPref sortOrder( CPosLandmark::ELandmarkName, |
|
304 TPosLmSortPref::EAscending ); |
|
305 // Start the search |
|
306 // Create search operation |
|
307 CPosLmOperation* operation = iSearch->StartLandmarkSearchL( *compCrit, sortOrder ); |
|
308 |
|
309 CleanupStack::PopAndDestroy( compCrit ); |
|
310 CleanupStack::PushL( operation ); |
|
311 |
|
312 iSearchAO = CLmkAOOperation::NewL( operation, |
|
313 *this, |
|
314 MLmkAOOperationObserver::ESearch, |
|
315 ETrue ); |
|
316 CleanupStack::Pop( operation ); // ownership transferred |
|
317 |
|
318 iIsSecondSearchStarted = EFalse; |
|
319 iSearchAO->StartOperation(); |
|
320 |
|
321 } |
|
322 |
|
323 // --------------------------------------------------------- |
|
324 // CLmkSearchedLmListProvider::HandleOperationL |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 void CLmkSearchedLmListProvider::HandleOperationL( |
|
328 TOperationTypes aType, |
|
329 TReal32 aProgress, |
|
330 TInt aStatus ) |
|
331 { |
|
332 if ( aType == MLmkAOOperationObserver::EDeleteLandmarks ) |
|
333 { |
|
334 return; |
|
335 } |
|
336 if ( aType == MLmkAOOperationObserver::ERemoveCategory ) |
|
337 { |
|
338 return; |
|
339 } |
|
340 if ( aType == MLmkAOOperationObserver::ESearch ) |
|
341 { |
|
342 ReadItemsToArrayL(); |
|
343 if ( aStatus == KErrNone ) |
|
344 { |
|
345 if( iSearchAO ) |
|
346 { |
|
347 iSearchAO->StopOperation(); |
|
348 delete iSearchAO; |
|
349 iSearchAO = NULL; |
|
350 } |
|
351 |
|
352 // reset operation values |
|
353 iOperationCmd = ELmkCmdStopOperation;//temp default value |
|
354 iCount = 0; |
|
355 |
|
356 if( iIsSecondSearchStarted ) |
|
357 { |
|
358 StartSecondSearchL(); |
|
359 } |
|
360 |
|
361 if(iOperationNotInUse == EFalse ) |
|
362 { |
|
363 NotifyObservers( ELmkEventItemAdditionComplete ); |
|
364 } |
|
365 else |
|
366 { |
|
367 if (iRequestFromFindBox) |
|
368 { |
|
369 NotifyObservers( ELmkEventFindListReady ); |
|
370 } |
|
371 else |
|
372 { |
|
373 NotifyObservers( ELmkEventListReady ); |
|
374 } |
|
375 } |
|
376 |
|
377 iOperationNotInUse = ETrue; |
|
378 |
|
379 if ( iCatDelete ) |
|
380 { |
|
381 NotifyObservers( ELmkEventCategoryDeleted ); |
|
382 iCatDelete = EFalse; |
|
383 } |
|
384 else if(iCatUpdate) |
|
385 { |
|
386 NotifyObservers( ELmkEventCategoryUpdated ); |
|
387 iCatUpdate = EFalse; |
|
388 } |
|
389 |
|
390 if(iItemsDeleted < iItemsToDelete) |
|
391 { |
|
392 PrepareForDeleteL(); |
|
393 } |
|
394 else |
|
395 { |
|
396 if(iWaitNote) |
|
397 { |
|
398 iWaitNote->ProcessFinishedL(); |
|
399 iWaitNote = NULL; |
|
400 } |
|
401 } |
|
402 return; |
|
403 } // end of if ( aStatus == KErrNone ) |
|
404 |
|
405 if ( iCount == ELmkStepOne || iCount == ELmkStepTwo ) |
|
406 { |
|
407 if (iOperationNotInUse == EFalse ) |
|
408 { |
|
409 NotifyObservers( ELmkEventItemAdditionComplete ); |
|
410 } |
|
411 else |
|
412 { |
|
413 if (iRequestFromFindBox) |
|
414 { |
|
415 NotifyObservers( ELmkEventFindListReady ); |
|
416 } |
|
417 else |
|
418 { |
|
419 NotifyObservers( ELmkEventListReady ); |
|
420 } |
|
421 } |
|
422 iOperationNotInUse = EFalse; |
|
423 } |
|
424 } |
|
425 else |
|
426 { // This is not this classes' operation |
|
427 CLmkLmItemListProvider::HandleOperationL( aType, aProgress, aStatus); |
|
428 } |
|
429 } |
|
430 |
|
431 // --------------------------------------------------------- |
|
432 // CLmkSearchedLmListProvider::HandleDatabaseEvent |
|
433 // --------------------------------------------------------- |
|
434 // |
|
435 void CLmkSearchedLmListProvider::HandleDatabaseEvent( TPosLmEvent& aEvent ) |
|
436 { |
|
437 iCatDelete = EFalse; |
|
438 |
|
439 TBool needRefresh = ETrue; |
|
440 |
|
441 // check any items are selected to do operations like iconchanges or add to category. |
|
442 if( iSelectedItemsCount > 0 |
|
443 && iOperationCmd != ELmkCmdAddToCat |
|
444 && iOperationCmd != ERemoveFromCat ) |
|
445 { |
|
446 iCount++; |
|
447 if( iSelectedItemsCount == iCount ) |
|
448 { |
|
449 iSelectedItemsCount = 0; |
|
450 iCount = 0; |
|
451 } |
|
452 needRefresh = EFalse; |
|
453 } |
|
454 |
|
455 switch ( aEvent.iEventType ) |
|
456 { |
|
457 case EPosLmEventLandmarkUpdated: // lm icon changes, lm renaming |
|
458 case EPosLmEventLandmarkUnknownChanges: // lm multiple deletion, lm add to category |
|
459 case EPosLmEventUnknownChanges: |
|
460 case EPosLmEventLandmarkCreated: |
|
461 case EPosLmEventCategoryDeleted: |
|
462 case EPosLmEventCategoryUpdated: |
|
463 { |
|
464 iOperationNotInUse = EFalse; |
|
465 if (aEvent.iEventType == EPosLmEventCategoryDeleted ) |
|
466 { |
|
467 iCatDelete = ETrue; |
|
468 } |
|
469 if (aEvent.iEventType == EPosLmEventCategoryUpdated ) |
|
470 { |
|
471 iCatUpdate = ETrue; |
|
472 } |
|
473 |
|
474 if( needRefresh ) |
|
475 { |
|
476 if( iSearchAO ) |
|
477 { |
|
478 iSearchAO->StopOperation(); |
|
479 delete iSearchAO; |
|
480 iSearchAO = NULL; |
|
481 } |
|
482 iOperationNotInUse = EFalse; |
|
483 TInt err = KErrNone; |
|
484 do |
|
485 { |
|
486 TRAP( err, PrepareListL() ); |
|
487 }while(err == KErrLocked); |
|
488 if ( err ) |
|
489 { |
|
490 HandleError( err ); |
|
491 } |
|
492 } |
|
493 else |
|
494 { |
|
495 NotifyObservers( ELmkEventListReady ); |
|
496 } |
|
497 break; |
|
498 } |
|
499 case EPosLmEventLandmarkDeleted: |
|
500 { |
|
501 TInt index = iIdArray.Find( aEvent.iLandmarkItemId ); |
|
502 if( index != KErrNotFound && index < iIdArray.Count()) |
|
503 { |
|
504 iIdArray.Remove(index); |
|
505 NotifyObservers( ELmkEventListReady ); |
|
506 } |
|
507 break; |
|
508 } |
|
509 default: |
|
510 { // Not interesting event for this provider |
|
511 break; |
|
512 } |
|
513 } |
|
514 // Remember to call base class observer method too |
|
515 CLmkLmItemListProvider::HandleDatabaseEvent( aEvent ); |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------- |
|
519 // CLmkSearchedLmListProvider::ReadItemsToArrayL |
|
520 // --------------------------------------------------------- |
|
521 // |
|
522 void CLmkSearchedLmListProvider::ReadItemsToArrayL() |
|
523 { |
|
524 iIdArray.Reset(); |
|
525 CPosLmItemIterator* iterator = iSearch->MatchIteratorL(); |
|
526 CleanupStack::PushL( iterator ); |
|
527 iCount = iterator->NumOfItemsL(); |
|
528 if ( iCount > 0 ) |
|
529 { // can only be called if there are some items |
|
530 iterator->GetItemIdsL( iIdArray, 0, iCount ); // array is first reseted |
|
531 } |
|
532 CleanupStack::PopAndDestroy( iterator ); |
|
533 } |
|
534 |
|
535 // --------------------------------------------------------- |
|
536 // CLmkSearchedLmListProvider::RemoveLandmarksL |
|
537 // --------------------------------------------------------- |
|
538 // |
|
539 void CLmkSearchedLmListProvider::RemoveLandmarksL(const RArray<TPosLmItemId>& aSelectedItems ) |
|
540 { |
|
541 iItemsToDelete = aSelectedItems.Count(); |
|
542 iSelectedForDelete.Reset(); |
|
543 for(TInt i=0;i<iItemsToDelete;i++) |
|
544 iSelectedForDelete.Append(aSelectedItems[i]); |
|
545 iItemsDeleted = 0; |
|
546 iIsRemoveLandmarks = ETrue; |
|
547 |
|
548 if(iWaitNote) |
|
549 { |
|
550 delete iWaitNote; |
|
551 iWaitNote = NULL; |
|
552 } |
|
553 PrepareForDeleteL(); |
|
554 } |
|
555 |
|
556 // --------------------------------------------------------- |
|
557 // CLmkSearchedLmListProvider::PrepareForDelete |
|
558 // --------------------------------------------------------- |
|
559 // |
|
560 void CLmkSearchedLmListProvider::PrepareForDeleteL() |
|
561 { |
|
562 RArray<TPosLmItemId> lmItemsChunk; |
|
563 TInt count = iItemsDeleted; |
|
564 if(iItemsToDelete > (iItemsDeleted + 10)) |
|
565 { |
|
566 iItemsDeleted = iItemsDeleted + 10; |
|
567 } |
|
568 else |
|
569 { |
|
570 iItemsDeleted = iItemsDeleted + (iItemsToDelete - iItemsDeleted); |
|
571 } |
|
572 |
|
573 for(TInt i=count;i<iItemsDeleted;i++) |
|
574 { |
|
575 lmItemsChunk.Append(iSelectedForDelete[i]); |
|
576 } |
|
577 |
|
578 CPosLmOperation* operation = NULL; |
|
579 if(iType == MLmkAOOperationObserver::EDeleteLandmarks) |
|
580 { |
|
581 operation = iDb.RemoveLandmarksL( lmItemsChunk ); |
|
582 } |
|
583 if(iType == MLmkAOOperationObserver::ERemoveCategory) |
|
584 { |
|
585 CPosLmCategoryManager* mgr = CPosLmCategoryManager::NewL( iDb ); |
|
586 CleanupStack::PushL(mgr); |
|
587 operation = mgr->RemoveCategoryFromLandmarksL( iCategoryId, lmItemsChunk ); |
|
588 CleanupStack::PopAndDestroy();//mgr |
|
589 } |
|
590 User::LeaveIfNull( operation ); |
|
591 |
|
592 CleanupStack::PushL( operation ); |
|
593 iSearchAO = CLmkAOOperation::NewL( operation, |
|
594 *this, |
|
595 iType, |
|
596 EFalse ); |
|
597 CleanupStack::Pop( operation ); // ownership transferred |
|
598 |
|
599 if( iSearchAO ) |
|
600 { |
|
601 iSearchAO->StartOperation(); |
|
602 |
|
603 if(!iWaitNote) |
|
604 { |
|
605 iWaitNote = new (ELeave) CAknWaitDialog(NULL, ETrue); |
|
606 if(!iWaitNote->ExecuteLD(R_LMK_PROCESSING_WAIT_NOTE)) |
|
607 { |
|
608 iSearchAO->StopOperation(); |
|
609 delete iSearchAO; |
|
610 iSearchAO = NULL; |
|
611 iWaitNote = NULL; |
|
612 } |
|
613 } |
|
614 } |
|
615 |
|
616 lmItemsChunk.Close(); |
|
617 } |
|
618 |
|
619 // End of File |