equal
deleted
inserted
replaced
383 const TInt count( aKeys.Count() ); |
383 const TInt count( aKeys.Count() ); |
384 for (TInt i(0); i < count; i++) |
384 for (TInt i(0); i < count; i++) |
385 { |
385 { |
386 User::LeaveIfError(iSavedDeleteKeys.Append(aKeys[i])); |
386 User::LeaveIfError(iSavedDeleteKeys.Append(aKeys[i])); |
387 } |
387 } |
|
388 iProgressCount = 0; |
388 ExecuteDeleteStepL(); |
389 ExecuteDeleteStepL(); |
389 iRetval = iFileSession.ReleaseReserveAccess( KDefaultDrive ); |
390 iRetval = iFileSession.ReleaseReserveAccess( KDefaultDrive ); |
390 iFileSession.Close(); |
391 iFileSession.Close(); |
391 CleanupStack::PopAndDestroy(); |
392 CleanupStack::PopAndDestroy(); |
392 } |
393 } |
395 // CNotepadModel::ExecuteDeleteStepL |
396 // CNotepadModel::ExecuteDeleteStepL |
396 // ----------------------------------------------------------------------------- |
397 // ----------------------------------------------------------------------------- |
397 // |
398 // |
398 void CNotepadModel::ExecuteDeleteStepL() |
399 void CNotepadModel::ExecuteDeleteStepL() |
399 { |
400 { |
400 iProgressCount = 0; |
401 |
401 iStepCount = iSavedDeleteKeys.Count(); |
402 iStepCount = iSavedDeleteKeys.Count(); |
402 if ( iStepCount > KNotepadMaxDeleteCountInStep ) |
403 if ( iStepCount > KNotepadMaxDeleteCountInStep ) |
403 { |
404 { |
404 iStepCount = KNotepadMaxDeleteCountInStep; |
405 iStepCount = KNotepadMaxDeleteCountInStep; |
405 } |
406 } |
409 sql.Append(KNotepadSqlDeleteHead); |
410 sql.Append(KNotepadSqlDeleteHead); |
410 sql.AppendNum(iSavedDeleteKeys[0]); |
411 sql.AppendNum(iSavedDeleteKeys[0]); |
411 if ( IsTemplates() ) |
412 if ( IsTemplates() ) |
412 { |
413 { |
413 iSavedDeleteKeys.Remove(0); |
414 iSavedDeleteKeys.Remove(0); |
414 for (TInt i(0); i < iStepCount - 1; i++) |
|
415 { |
|
416 sql.Append(KNotepadSqlDeleteByKeysAppend); |
|
417 sql.AppendNum(iSavedDeleteKeys[0]); |
|
418 iSavedDeleteKeys.Remove(0); |
|
419 } |
|
420 } |
415 } |
421 else // If Notepad, Remove is postponed until remove link phase |
416 else // If Notepad, Remove is postponed until remove link phase |
422 { |
417 { |
423 for (TInt i(1); i < iStepCount; i++) |
418 for (TInt i(1); i < iStepCount; i++) |
424 { |
419 { |
510 deleteFinished = ETrue; |
505 deleteFinished = ETrue; |
511 } |
506 } |
512 else // do next step |
507 else // do next step |
513 { |
508 { |
514 increment = iStepCount - iProgressCount; |
509 increment = iStepCount - iProgressCount; |
|
510 |
|
511 iProgressCount += increment; |
|
512 if ( iModelObserver ) |
|
513 { |
|
514 iModelObserver->HandleNotepadModelEventL( |
|
515 MNotepadModelObserver::EProgressDeletion, |
|
516 1 ); |
|
517 } |
|
518 |
515 ExecuteDeleteStepL(); |
519 ExecuteDeleteStepL(); |
516 } |
520 } |
517 } |
521 } |
518 else |
522 else |
519 { |
523 { |
528 } |
532 } |
529 if ( stat > 0 ) |
533 if ( stat > 0 ) |
530 { |
534 { |
531 increment = iDbUpdate.RowCount() - iProgressCount; |
535 increment = iDbUpdate.RowCount() - iProgressCount; |
532 } |
536 } |
533 if ( increment > 0 ) |
537 |
534 { |
|
535 iProgressCount += increment; |
|
536 if ( iModelObserver ) |
|
537 { |
|
538 iModelObserver->HandleNotepadModelEventL( |
|
539 MNotepadModelObserver::EProgressDeletion, increment); |
|
540 } |
|
541 } |
|
542 if ( deleteFinished || ( stat == 0 && |
538 if ( deleteFinished || ( stat == 0 && |
543 SysUtil::FFSSpaceBelowCriticalLevelL(&(iEnv->FsSession())) ) ) |
539 SysUtil::FFSSpaceBelowCriticalLevelL(&(iEnv->FsSession())) ) ) |
544 { |
540 { |
545 User::LeaveIfError(iDatabase.Compact()); |
541 User::LeaveIfError(iDatabase.Compact()); |
546 } |
542 } |