apengine/apsettingshandlerui/src/apsettingsdeleteoperation.cpp
changeset 61 8b0c979bbe8c
parent 59 2709c04a4af5
child 70 ac5daea24fb0
equal deleted inserted replaced
59:2709c04a4af5 61:8b0c979bbe8c
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation of class CApSettingsDeleteOperation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <ApDataHandler.h>
       
    21 #include <ApUtils.h>
       
    22 #include <ActiveApDb.h>
       
    23 #include <ApSettingsHandlerCommons.h>
       
    24 #include <VpnApEngine.h>
       
    25 #include <AknWaitDialog.h>
       
    26 #include <AknProgressDialog.h>
       
    27 #include <cdbcols.h>
       
    28 #include <ErrorUI.h>
       
    29 #include "Apsettingsdeleteoperation.h"
       
    30 
       
    31 #include <ApAccessPointItem.h>
       
    32 
       
    33 // Following includes are needed only for the test
       
    34 // when ALL APs are deleted (checking delays, etc.)
       
    35 // For testing purpose only, to make process time longer.
       
    36 //  TEST STARTS
       
    37 #include <ActiveApDb.h>
       
    38 #include <ApSelect.h>
       
    39 #include <ApListItem.h>
       
    40 #include "ApSelectorListBoxModel.h"
       
    41 #include "ApSettingsHandlerLogger.h"
       
    42 
       
    43 #include <apsetui.rsg>
       
    44 //  TEST ENDS
       
    45 
       
    46 
       
    47 // Stack size of the receiver thread.
       
    48 LOCAL_C const TInt KDeleteThreadStackSize = 40960;
       
    49 
       
    50 // Name of the receiver thread.
       
    51 _LIT( KDeleteThreadName, "Access Point Settings UI Delete Operation" );
       
    52 
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // CApSettingsDeleteOperation::NewL
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 CApSettingsDeleteOperation* CApSettingsDeleteOperation::NewL(
       
    59                                 TInt aNoteControlId,
       
    60                                 TInt aResourceID,
       
    61                                 TUint32 aUid,
       
    62                                 const TDesC& aNoteText
       
    63                                 )
       
    64     {
       
    65     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::NewL")
       
    66     
       
    67     CApSettingsDeleteOperation* db =
       
    68             new ( ELeave ) CApSettingsDeleteOperation(
       
    69                             aNoteControlId,
       
    70                             aResourceID,
       
    71                             aUid
       
    72                             );
       
    73     CleanupStack::PushL( db );
       
    74     db->ConstructL( aNoteText );
       
    75     CleanupStack::Pop();
       
    76     
       
    77     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::NewL")
       
    78     return db;
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CApSettingsDeleteOperation::ConstructL
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 void CApSettingsDeleteOperation::ConstructL( const TDesC& aNoteText )
       
    87     {
       
    88     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::ConstructL")
       
    89     
       
    90     iErrorUi = CErrorUI::NewL( *CCoeEnv::Static() );
       
    91     iNoteText = aNoteText.AllocL();
       
    92     
       
    93     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::ConstructL")
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CApSettingsDeleteOperation::CApSettingsDeleteOperation
       
    99 // ---------------------------------------------------------
       
   100 //
       
   101 CApSettingsDeleteOperation::CApSettingsDeleteOperation(
       
   102                                  TInt aNoteControlId,
       
   103                                  TInt aResourceID,
       
   104                                  TUint32 aUid
       
   105                                  )
       
   106 : CActive( EPriorityLow ),
       
   107   iNoteControlId( aNoteControlId ),
       
   108   iResourceID( aResourceID ),
       
   109   iUid( aUid )
       
   110     {
       
   111     CActiveScheduler::Add(this);
       
   112     APSETUILOGGER_WRITE( EModel,"Thread added to scheduler");
       
   113     }
       
   114 
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // CApSettingsDeleteOperation::~CApSettingsDeleteOperation
       
   118 // ---------------------------------------------------------
       
   119 //
       
   120 CApSettingsDeleteOperation::~CApSettingsDeleteOperation()
       
   121     {
       
   122     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::~CApSettingsDeleteOperation")
       
   123     
       
   124     if(iDeleteOperation.Handle() != 0)
       
   125         {
       
   126         // wait for deletion to finish
       
   127         TRequestStatus status;          
       
   128         iDeleteOperation.Logon(status);
       
   129         User::WaitForRequest(status);
       
   130         
       
   131         iDeleteOperation.Close();
       
   132         }
       
   133         
       
   134     Cancel();                        
       
   135     
       
   136     delete iWaitDialog;
       
   137 
       
   138     delete iNoteText;
       
   139     delete iErrorUi;
       
   140     
       
   141     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::~CApSettingsDeleteOperation")
       
   142     }
       
   143 
       
   144 
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------
       
   148 // CApSettingsDeleteOperation::RunL
       
   149 // ---------------------------------------------------------
       
   150 //
       
   151 void CApSettingsDeleteOperation::RunL()
       
   152     {
       
   153     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RunL")
       
   154     
       
   155     switch ( iState )
       
   156         {
       
   157         case EProcOnDialogOn:
       
   158             { // two chances :
       
   159             // 1. Process finished normally
       
   160             // 2. Process leaved with error
       
   161             iState = EProcOffDialogOn;
       
   162             if ( iWaitDialog )
       
   163                 {
       
   164                 iWaitDialog->ProcessFinishedL();
       
   165                 }
       
   166             if ( iStatus.Int() != KErrNone )
       
   167                 {
       
   168                 // some error has occured
       
   169                 iErr = iStatus.Int();
       
   170                 }
       
   171             Next();
       
   172             break;
       
   173             }
       
   174         case EProcOffDialogOn:
       
   175             {
       
   176             // now we wait for the dialog to be dismissed
       
   177             // just to be able to delete it
       
   178             // stays in this state as long as DialogDismissedL()
       
   179             // is not called, it will move it out into
       
   180             // EProcOffDialogOff and it also deletes
       
   181             Next();
       
   182             break;
       
   183             }
       
   184         case EProcOnDialogOff:
       
   185             { // this can't be, as dialog MUST stay as long as operation...
       
   186             iState = EProcOffDialogOff;
       
   187             Next();
       
   188             break;
       
   189             }
       
   190         case EProcOffDialogOff:
       
   191             { // now we can safely delete the dialog
       
   192             if ( iWaitDialog )
       
   193                 {
       
   194                 delete iWaitDialog;
       
   195                 }
       
   196             if ( iErr != KErrNone )
       
   197                 {
       
   198                 // some error has occured
       
   199                 iErrorUi->ShowGlobalErrorNoteL( iErr );
       
   200                 }
       
   201             iDeleteOperation.Kill( iErr );
       
   202             iDeleteOperation.Close();            
       
   203 //            delete this;
       
   204             break;
       
   205             }
       
   206         default:
       
   207             {
       
   208             __ASSERT_DEBUG( EFalse, Panic( EInvalidState ) );
       
   209             break;
       
   210             }
       
   211         }
       
   212     
       
   213     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RunL")
       
   214     }
       
   215 
       
   216 
       
   217 // ---------------------------------------------------------
       
   218 // CApSettingsDeleteOperation::DoCancel
       
   219 // ---------------------------------------------------------
       
   220 //
       
   221 void CApSettingsDeleteOperation::DoCancel()
       
   222     { // must be here as it is pure virtual in base...    
       
   223     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DoCancel")
       
   224     
       
   225     if (iDeleteOperation.Handle() != 0 && iStatus == KRequestPending)
       
   226         {
       
   227         iDeleteOperation.LogonCancel(iStatus);
       
   228         } 
       
   229     
       
   230     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DoCancel")
       
   231     }
       
   232 
       
   233 
       
   234 
       
   235 // ---------------------------------------------------------
       
   236 // CApSettingsDeleteOperation::DialogDismissedL
       
   237 // ---------------------------------------------------------
       
   238 //
       
   239 void CApSettingsDeleteOperation::DialogDismissedL( TInt /*aButtonId*/ )
       
   240     {
       
   241     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DialogDismissedL")
       
   242     
       
   243     switch ( iState )
       
   244         {
       
   245         case EProcOnDialogOn:
       
   246             { // can't be, it means that dialog is dismissed by user
       
   247             // but process is still runing...
       
   248             iState = EProcOnDialogOff;
       
   249             break;
       
   250             }
       
   251         case EProcOffDialogOn:
       
   252             {
       
   253             // set dialog off
       
   254             iState = EProcOffDialogOff;
       
   255             // as proc is already off, it circles in RunL,
       
   256             break;
       
   257             }
       
   258         case EProcOnDialogOff:
       
   259             { // can't be, it is already off...
       
   260             iState = EProcOnDialogOff;
       
   261             Next();
       
   262             break;
       
   263             }
       
   264         case EProcOffDialogOff:
       
   265             {// can't be, it is already off...
       
   266             iState = EProcOffDialogOff;
       
   267             Next();
       
   268             break;
       
   269             }
       
   270         default:
       
   271             {
       
   272             __ASSERT_DEBUG( EFalse, Panic( EInvalidState ) );
       
   273             break;
       
   274             }
       
   275         }
       
   276     
       
   277     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DialogDismissedL")
       
   278     }
       
   279 
       
   280 
       
   281 // ---------------------------------------------------------
       
   282 // CApSettingsDeleteOperation::StartL
       
   283 // ---------------------------------------------------------
       
   284 //
       
   285 void CApSettingsDeleteOperation::StartL()
       
   286     {
       
   287     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartL")
       
   288     
       
   289     iStatus = KRequestPending;
       
   290     // set the internal state as both is running
       
   291     iState = EProcOnDialogOn;
       
   292 
       
   293     // now we can start wait note...
       
   294     StartWaitNoteL();
       
   295 
       
   296     // now start new thread with operation
       
   297     StartDeleteOperationThreadL();
       
   298 
       
   299     SetActive();
       
   300     // now we can wait on it...
       
   301     // wait until the started thread completes (delete operation completes)
       
   302     // and it will enter RunL. RunL will notify the wait dialog about the
       
   303     // completion of the process.
       
   304     // As the dialog shall wait ~0.5 sec till display AND must be visible
       
   305     // for ~1.5 sec. as a minimum, but must stay up as long as the 'process'
       
   306     // on it is waiting for does not completes, we have the following chances:
       
   307     // if the process is shorter than 0.5,
       
   308         // after operation completes, state moves to EProcOffDialogOn,
       
   309         // dialog will be notified about completion by RunL, and RunL starts
       
   310         // circle and wait for the dialog to finish, multiply re-entering
       
   311         // and leaving RunL, as long as the state is EProcOffDialogOn.
       
   312         // As time was shorter than 0.5, thus dialog will not show itself
       
   313         // and will call DialogDismissedL, which will change the
       
   314         // state to EProcOffDialogOff, which, on entering
       
   315         // RunL again, will delete the dialog and kill the thread.
       
   316     // if the process was longer than 0.5 but shorter than 0.5+1.5sec,
       
   317         // after operation completes, state moves to EProcOffDialogOn,
       
   318         // dialog will be notified about completion by RunL, and RunL starts
       
   319         // circle and wait for the dialog to finish, multiply re-entering
       
   320         // and leaving RunL, as long as the state is EProcOffDialogOn.
       
   321         // As time was longer than 0.5, thus dialog will show itself
       
   322         // and will stay up for 1.5 sec, as process ended between
       
   323         // 0.5 and (0.5+1.5). After it dialog will call DialogDismissedL,
       
   324         // which will change the state to EProcOffDialogOff, which, on
       
   325         // entering RunL again, will delete the dialog and kill the thread.
       
   326     // if the process was longer than 0.5+1.5
       
   327         // after operation completes, state moves to EProcOffDialogOn,
       
   328         // dialog will be notified about completion by RunL, and RunL starts
       
   329         // circle and wait for the dialog to finish, multiply re-entering
       
   330         // and leaving RunL, as long as the state is EProcOffDialogOn.
       
   331         // As time was longer than 0.5+1.5, thus dialog will show itself
       
   332         // and will stay up for as long as 'process/operation' is not finished.
       
   333         // As thread completes, notifies dialog, after it dialog will
       
   334         // call back DialogDismissedL, which will change the state
       
   335         // to EProcOffDialogOff, which, on entering RunL again,
       
   336         // will delete the dialog and kill the thread.
       
   337     
       
   338     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartL")
       
   339     }
       
   340 
       
   341 
       
   342 
       
   343 // ---------------------------------------------------------
       
   344 // CApSettingsDeleteOperation::Next
       
   345 // ---------------------------------------------------------
       
   346 //
       
   347 void CApSettingsDeleteOperation::Next()
       
   348     {
       
   349     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::Next")
       
   350     
       
   351     iStatus = KRequestPending;
       
   352     SetActive();
       
   353     TRequestStatus *status = &iStatus;
       
   354     User::RequestComplete( status, KErrNone );  // Invoke RunL()
       
   355     
       
   356     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::Next")
       
   357     }
       
   358 
       
   359 
       
   360 
       
   361 
       
   362 // ---------------------------------------------------------
       
   363 // CApSettingsDeleteOperation::RunDeleteThread
       
   364 // ---------------------------------------------------------
       
   365 //
       
   366 TInt CApSettingsDeleteOperation::RunDeleteThread( TAny* aPtr )
       
   367     {
       
   368     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RunDeleteThread")
       
   369     
       
   370     CApSettingsDeleteOperation* aop = 
       
   371             STATIC_CAST( CApSettingsDeleteOperation*, aPtr );
       
   372 
       
   373 
       
   374     CTrapCleanup* TheTrapCleanup = CTrapCleanup::New(); // get cleanup stack
       
   375 
       
   376     TRAPD(r, aop->DoRunDeleteThreadL( aop ) );
       
   377 
       
   378     delete TheTrapCleanup; // destroy cleanup stack
       
   379 
       
   380     aop->iErr = r;
       
   381     
       
   382     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RunDeleteThread")
       
   383     return ( r );
       
   384     }
       
   385 
       
   386 
       
   387 
       
   388 // ---------------------------------------------------------
       
   389 // CApSettingsDeleteOperation::DoRunDeleteThreadL
       
   390 // ---------------------------------------------------------
       
   391 //
       
   392 TInt CApSettingsDeleteOperation::DoRunDeleteThreadL( 
       
   393                                     CApSettingsDeleteOperation* aop )
       
   394     {
       
   395     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DoRunDeleteThreadL")
       
   396     
       
   397     CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP );
       
   398     CleanupStack::PushL( db );
       
   399     
       
   400     APSETUILOGGER_WRITE( EDelete,"Commsdb created");
       
   401 
       
   402     CApDataHandler* handler = CApDataHandler::NewLC( *db );
       
   403     
       
   404     APSETUILOGGER_WRITE( EDelete,"CApDataHandler created");
       
   405     
       
   406     CVpnApEngine* vpnengine = CVpnApEngine::NewLC( db );
       
   407 
       
   408     APSETUILOGGER_WRITE( EDelete,"CVpnApEngine created");
       
   409 
       
   410     TBool ownTransaction = StartTransactionLC( db, 
       
   411                                                /*aWrite*/ETrue, 
       
   412                                                /*aRetry*/ETrue );
       
   413 
       
   414     APSETUILOGGER_WRITE( EDelete,"Tr.started");
       
   415 
       
   416 //  NORMAL OPERATION STARTS
       
   417     TBool isvpn = vpnengine->IsVpnApL( aop->iUid );
       
   418 
       
   419     APSETUILOGGER_WRITE( EDelete,"IsVpnApL returned");
       
   420     
       
   421     // if linked to a VPN, the VPN also must be deleted
       
   422     // deleting the VPN part is the delete operation's responsibility...
       
   423     if ( isvpn )
       
   424         {
       
   425         vpnengine->DeleteVpnL( aop->iUid );
       
   426         }
       
   427     else
       
   428         {
       
   429         handler->RemoveAPL( aop->iUid );
       
   430         }
       
   431     
       
   432     APSETUILOGGER_WRITE( EDelete,"RemoveAPL returned");
       
   433 
       
   434 
       
   435     if ( ownTransaction )
       
   436         {
       
   437         TInt err = db->CommitTransaction();
       
   438         User::LeaveIfError( err );
       
   439         CleanupStack::Pop(); // RollbackTransactionOnLeave
       
   440         }
       
   441 
       
   442     APSETUILOGGER_WRITE( EDelete," delete finished");
       
   443 
       
   444     CleanupStack::PopAndDestroy( 3, db ); //db,handler,vpnengine
       
   445 
       
   446 //  NORMAL OPERATION ENDS
       
   447 
       
   448 
       
   449     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DoRunDeleteThreadL")
       
   450     return KErrNone;
       
   451     }
       
   452 
       
   453 
       
   454 
       
   455 // ---------------------------------------------------------
       
   456 // CApSettingsDeleteOperation::StartWaitNoteL
       
   457 // ---------------------------------------------------------
       
   458 //
       
   459 void CApSettingsDeleteOperation::StartWaitNoteL()
       
   460     {
       
   461     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartWaitNoteL")
       
   462     
       
   463     if ( iWaitDialog )
       
   464         {
       
   465         delete iWaitDialog;
       
   466         iWaitDialog = NULL;
       
   467         }
       
   468     iWaitDialog =
       
   469         new ( ELeave ) CAknWaitDialog
       
   470                 ( REINTERPRET_CAST(CEikDialog**,&iWaitDialog) );
       
   471     iWaitDialog->PrepareLC( iResourceID );
       
   472     iWaitDialog->SetTone( CAknNoteDialog::ENoTone );
       
   473     iWaitDialog->SetTextL( *iNoteText );
       
   474     iWaitDialog->SetCallback( this );
       
   475     iWaitDialog->RunLD();
       
   476     
       
   477     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartWaitNoteL")
       
   478     }
       
   479 
       
   480 
       
   481 
       
   482 // ---------------------------------------------------------
       
   483 // CApSettingsDeleteOperation::StartDeleteOperationThreadL
       
   484 // ---------------------------------------------------------
       
   485 //
       
   486 void CApSettingsDeleteOperation::StartDeleteOperationThreadL()
       
   487     {
       
   488     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartDeleteOperationThreadL")
       
   489     
       
   490     TInt err = iDeleteOperation.Create
       
   491             (
       
   492             KDeleteThreadName, // aName
       
   493             RunDeleteThread, // aFunction
       
   494             KDeleteThreadStackSize, // aStackSize
       
   495             NULL,         // Use this heap.
       
   496             this // aPtr
       
   497             );
       
   498     APSETUILOGGER_WRITE_FORMAT( EDelete, "iDeleteOperation create returned, code:%d", err);    
       
   499     
       
   500     User::LeaveIfError( err );
       
   501     // on termination/death of this thread, it will call RunL
       
   502     iDeleteOperation.Logon( iStatus );
       
   503     // let's start the thread
       
   504     iDeleteOperation.Resume();
       
   505     // set the internal state as both is running
       
   506     iState = EProcOnDialogOn;
       
   507     
       
   508     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartDeleteOperationThreadL")
       
   509     }
       
   510 
       
   511 
       
   512 
       
   513 
       
   514 
       
   515 // ---------------------------------------------------------
       
   516 // CApSettingsDeleteOperation::StarTransactionLC
       
   517 // ---------------------------------------------------------
       
   518 //
       
   519 TBool CApSettingsDeleteOperation::StartTransactionLC( CCommsDatabase* aDb,
       
   520                                                       TBool aWrite, 
       
   521                                                       TBool aRetry /*ETrue*/ )
       
   522     {
       
   523     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartTransactionLC")
       
   524     
       
   525     TBool retval( EFalse );
       
   526     if ( !aDb->InTransaction() )
       
   527         {
       
   528         TInt retriesLeft( aRetry ? KRetryCount : 1 );
       
   529         TInt err = aDb->BeginTransaction();
       
   530         while ( ( err == KErrLocked ) && --retriesLeft )
       
   531             {
       
   532             User::After( KRetryWait );
       
   533             err = aDb->BeginTransaction();
       
   534             if (aWrite )
       
   535                 {
       
   536                 TRAP_IGNORE( GetWriteLockL( aDb ) );
       
   537                 }
       
   538             }
       
   539         if ( err )
       
   540             {
       
   541             ShowNoteL( R_APUI_VIEW_TEXT_CANNOT_ACCESS_DB );
       
   542             }
       
   543         User::LeaveIfError( err );
       
   544         CleanupStack::PushL( TCleanupItem( RollbackTransactionOnLeave, aDb ) );
       
   545         retval = ETrue;
       
   546         }
       
   547     else
       
   548         {
       
   549         retval = EFalse;
       
   550         }
       
   551         
       
   552     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartTransactionLC")
       
   553     return retval;
       
   554     }
       
   555 
       
   556 
       
   557 // ---------------------------------------------------------
       
   558 // CApSettingsDeleteOperation::GetWriteLockL
       
   559 // ---------------------------------------------------------
       
   560 //
       
   561 void CApSettingsDeleteOperation::GetWriteLockL( CCommsDatabase* aDb )
       
   562     {
       
   563     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::GetWriteLockL")
       
   564     
       
   565     CCommsDbTableView* v = aDb->OpenTableLC( TPtrC(WAP_ACCESS_POINT ) );
       
   566     TUint32 aDummyUid( KApNoneUID );
       
   567     TInt err = v->InsertRecord( aDummyUid );
       
   568     User::LeaveIfError( err );
       
   569     v->CancelRecordChanges();
       
   570     User::LeaveIfError( err );
       
   571     CleanupStack::PopAndDestroy(); // v
       
   572     
       
   573     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::GetWriteLockL")
       
   574     }
       
   575 
       
   576 // ---------------------------------------------------------
       
   577 // CApSettingsDeleteOperation::RollbackTransactionOnLeave
       
   578 // ---------------------------------------------------------
       
   579 //
       
   580 void CApSettingsDeleteOperation::RollbackTransactionOnLeave( TAny* aDb )
       
   581     {
       
   582     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RollbackTransactionOnLeave")
       
   583     
       
   584     CCommsDatabase* db = STATIC_CAST( CCommsDatabase*, aDb );
       
   585     db->RollbackTransaction();
       
   586     
       
   587     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RollbackTransactionOnLeave")
       
   588     }
       
   589 
       
   590 
       
   591 // ---------------------------------------------------------
       
   592 // CApSettingsDeleteOperation::ReadUintL
       
   593 // ---------------------------------------------------------
       
   594 //
       
   595 TInt CApSettingsDeleteOperation::ReadUintL( CCommsDbTableView* atable,
       
   596                                             const TDesC& aColumn,
       
   597                                             TUint32& aValue )
       
   598     {
       
   599     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::ReadUintL")
       
   600     
       
   601     __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
       
   602     TRAPD( err, atable->ReadUintL( aColumn, aValue ) );
       
   603     if ( err != KErrNone )
       
   604         { // do not leave if readed value is not present in table...
       
   605         if ( err != KErrUnknown )
       
   606             User::Leave( err );
       
   607         }
       
   608     
       
   609     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::ReadUintL")
       
   610     return err;
       
   611     }
       
   612 
       
   613 
       
   614 // ---------------------------------------------------------
       
   615 // CApSettingsDeleteOperation::SetNoteTextL
       
   616 // ---------------------------------------------------------
       
   617 //
       
   618 void CApSettingsDeleteOperation::SetNoteTextL( const TDesC& aNoteText )
       
   619     {
       
   620     APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::SetNoteTextL")
       
   621     
       
   622     delete iNoteText;
       
   623     iNoteText = NULL; // must NULL it to satisfy CodeScanner...
       
   624     iNoteText = aNoteText.AllocL();
       
   625     
       
   626     APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::SetNoteTextL")
       
   627     }
       
   628 // End of File