diff -r 84c6623982f6 -r ed07dcc72692 apengine/apsettingshandlerui/src/apsettingsdeleteoperation.cpp --- a/apengine/apsettingshandlerui/src/apsettingsdeleteoperation.cpp Fri Sep 17 08:32:43 2010 +0300 +++ b/apengine/apsettingshandlerui/src/apsettingsdeleteoperation.cpp Mon Oct 04 00:43:42 2010 +0300 @@ -62,20 +62,7 @@ const TDesC& aNoteText ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::NewL") - - CApSettingsDeleteOperation* db = - new ( ELeave ) CApSettingsDeleteOperation( - aNoteControlId, - aResourceID, - aUid - ); - CleanupStack::PushL( db ); - db->ConstructL( aNoteText ); - CleanupStack::Pop(); - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::NewL") - return db; + return NULL; } @@ -85,12 +72,6 @@ // void CApSettingsDeleteOperation::ConstructL( const TDesC& aNoteText ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::ConstructL") - - iErrorUi = CErrorUI::NewL( *CCoeEnv::Static() ); - iNoteText = aNoteText.AllocL(); - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::ConstructL") } @@ -108,8 +89,6 @@ iResourceID( aResourceID ), iUid( aUid ) { - CActiveScheduler::Add(this); - APSETUILOGGER_WRITE( EModel,"Thread added to scheduler"); } @@ -119,26 +98,6 @@ // CApSettingsDeleteOperation::~CApSettingsDeleteOperation() { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::~CApSettingsDeleteOperation") - - if(iDeleteOperation.Handle() != 0) - { - // wait for deletion to finish - TRequestStatus status; - iDeleteOperation.Logon(status); - User::WaitForRequest(status); - - iDeleteOperation.Close(); - } - - Cancel(); - - delete iWaitDialog; - - delete iNoteText; - delete iErrorUi; - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::~CApSettingsDeleteOperation") } @@ -150,67 +109,6 @@ // void CApSettingsDeleteOperation::RunL() { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RunL") - - switch ( iState ) - { - case EProcOnDialogOn: - { // two chances : - // 1. Process finished normally - // 2. Process leaved with error - iState = EProcOffDialogOn; - if ( iWaitDialog ) - { - iWaitDialog->ProcessFinishedL(); - } - if ( iStatus.Int() != KErrNone ) - { - // some error has occured - iErr = iStatus.Int(); - } - Next(); - break; - } - case EProcOffDialogOn: - { - // now we wait for the dialog to be dismissed - // just to be able to delete it - // stays in this state as long as DialogDismissedL() - // is not called, it will move it out into - // EProcOffDialogOff and it also deletes - Next(); - break; - } - case EProcOnDialogOff: - { // this can't be, as dialog MUST stay as long as operation... - iState = EProcOffDialogOff; - Next(); - break; - } - case EProcOffDialogOff: - { // now we can safely delete the dialog - if ( iWaitDialog ) - { - delete iWaitDialog; - } - if ( iErr != KErrNone ) - { - // some error has occured - iErrorUi->ShowGlobalErrorNoteL( iErr ); - } - iDeleteOperation.Kill( iErr ); - iDeleteOperation.Close(); -// delete this; - break; - } - default: - { - __ASSERT_DEBUG( EFalse, Panic( EInvalidState ) ); - break; - } - } - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RunL") } @@ -220,14 +118,6 @@ // void CApSettingsDeleteOperation::DoCancel() { // must be here as it is pure virtual in base... - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DoCancel") - - if (iDeleteOperation.Handle() != 0 && iStatus == KRequestPending) - { - iDeleteOperation.LogonCancel(iStatus); - } - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DoCancel") } @@ -238,43 +128,6 @@ // void CApSettingsDeleteOperation::DialogDismissedL( TInt /*aButtonId*/ ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DialogDismissedL") - - switch ( iState ) - { - case EProcOnDialogOn: - { // can't be, it means that dialog is dismissed by user - // but process is still runing... - iState = EProcOnDialogOff; - break; - } - case EProcOffDialogOn: - { - // set dialog off - iState = EProcOffDialogOff; - // as proc is already off, it circles in RunL, - break; - } - case EProcOnDialogOff: - { // can't be, it is already off... - iState = EProcOnDialogOff; - Next(); - break; - } - case EProcOffDialogOff: - {// can't be, it is already off... - iState = EProcOffDialogOff; - Next(); - break; - } - default: - { - __ASSERT_DEBUG( EFalse, Panic( EInvalidState ) ); - break; - } - } - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DialogDismissedL") } @@ -284,58 +137,6 @@ // void CApSettingsDeleteOperation::StartL() { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartL") - - iStatus = KRequestPending; - // set the internal state as both is running - iState = EProcOnDialogOn; - - // now we can start wait note... - StartWaitNoteL(); - - // now start new thread with operation - StartDeleteOperationThreadL(); - - SetActive(); - // now we can wait on it... - // wait until the started thread completes (delete operation completes) - // and it will enter RunL. RunL will notify the wait dialog about the - // completion of the process. - // As the dialog shall wait ~0.5 sec till display AND must be visible - // for ~1.5 sec. as a minimum, but must stay up as long as the 'process' - // on it is waiting for does not completes, we have the following chances: - // if the process is shorter than 0.5, - // after operation completes, state moves to EProcOffDialogOn, - // dialog will be notified about completion by RunL, and RunL starts - // circle and wait for the dialog to finish, multiply re-entering - // and leaving RunL, as long as the state is EProcOffDialogOn. - // As time was shorter than 0.5, thus dialog will not show itself - // and will call DialogDismissedL, which will change the - // state to EProcOffDialogOff, which, on entering - // RunL again, will delete the dialog and kill the thread. - // if the process was longer than 0.5 but shorter than 0.5+1.5sec, - // after operation completes, state moves to EProcOffDialogOn, - // dialog will be notified about completion by RunL, and RunL starts - // circle and wait for the dialog to finish, multiply re-entering - // and leaving RunL, as long as the state is EProcOffDialogOn. - // As time was longer than 0.5, thus dialog will show itself - // and will stay up for 1.5 sec, as process ended between - // 0.5 and (0.5+1.5). After it dialog will call DialogDismissedL, - // which will change the state to EProcOffDialogOff, which, on - // entering RunL again, will delete the dialog and kill the thread. - // if the process was longer than 0.5+1.5 - // after operation completes, state moves to EProcOffDialogOn, - // dialog will be notified about completion by RunL, and RunL starts - // circle and wait for the dialog to finish, multiply re-entering - // and leaving RunL, as long as the state is EProcOffDialogOn. - // As time was longer than 0.5+1.5, thus dialog will show itself - // and will stay up for as long as 'process/operation' is not finished. - // As thread completes, notifies dialog, after it dialog will - // call back DialogDismissedL, which will change the state - // to EProcOffDialogOff, which, on entering RunL again, - // will delete the dialog and kill the thread. - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartL") } @@ -346,14 +147,6 @@ // void CApSettingsDeleteOperation::Next() { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::Next") - - iStatus = KRequestPending; - SetActive(); - TRequestStatus *status = &iStatus; - User::RequestComplete( status, KErrNone ); // Invoke RunL() - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::Next") } @@ -365,22 +158,7 @@ // TInt CApSettingsDeleteOperation::RunDeleteThread( TAny* aPtr ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RunDeleteThread") - - CApSettingsDeleteOperation* aop = - STATIC_CAST( CApSettingsDeleteOperation*, aPtr ); - - - CTrapCleanup* TheTrapCleanup = CTrapCleanup::New(); // get cleanup stack - - TRAPD(r, aop->DoRunDeleteThreadL( aop ) ); - - delete TheTrapCleanup; // destroy cleanup stack - - aop->iErr = r; - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RunDeleteThread") - return ( r ); + return ( 0 ); } @@ -392,62 +170,7 @@ TInt CApSettingsDeleteOperation::DoRunDeleteThreadL( CApSettingsDeleteOperation* aop ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DoRunDeleteThreadL") - - CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP ); - CleanupStack::PushL( db ); - - APSETUILOGGER_WRITE( EDelete,"Commsdb created"); - - CApDataHandler* handler = CApDataHandler::NewLC( *db ); - - APSETUILOGGER_WRITE( EDelete,"CApDataHandler created"); - - CVpnApEngine* vpnengine = CVpnApEngine::NewLC( db ); - - APSETUILOGGER_WRITE( EDelete,"CVpnApEngine created"); - - TBool ownTransaction = StartTransactionLC( db, - /*aWrite*/ETrue, - /*aRetry*/ETrue ); - - APSETUILOGGER_WRITE( EDelete,"Tr.started"); - -// NORMAL OPERATION STARTS - TBool isvpn = vpnengine->IsVpnApL( aop->iUid ); - - APSETUILOGGER_WRITE( EDelete,"IsVpnApL returned"); - - // if linked to a VPN, the VPN also must be deleted - // deleting the VPN part is the delete operation's responsibility... - if ( isvpn ) - { - vpnengine->DeleteVpnL( aop->iUid ); - } - else - { - handler->RemoveAPL( aop->iUid ); - } - - APSETUILOGGER_WRITE( EDelete,"RemoveAPL returned"); - - - if ( ownTransaction ) - { - TInt err = db->CommitTransaction(); - User::LeaveIfError( err ); - CleanupStack::Pop(); // RollbackTransactionOnLeave - } - - APSETUILOGGER_WRITE( EDelete," delete finished"); - - CleanupStack::PopAndDestroy( 3, db ); //db,handler,vpnengine - -// NORMAL OPERATION ENDS - - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DoRunDeleteThreadL") - return KErrNone; + return KErrNotSupported; } @@ -458,23 +181,6 @@ // void CApSettingsDeleteOperation::StartWaitNoteL() { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartWaitNoteL") - - if ( iWaitDialog ) - { - delete iWaitDialog; - iWaitDialog = NULL; - } - iWaitDialog = - new ( ELeave ) CAknWaitDialog - ( REINTERPRET_CAST(CEikDialog**,&iWaitDialog) ); - iWaitDialog->PrepareLC( iResourceID ); - iWaitDialog->SetTone( CAknNoteDialog::ENoTone ); - iWaitDialog->SetTextL( *iNoteText ); - iWaitDialog->SetCallback( this ); - iWaitDialog->RunLD(); - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartWaitNoteL") } @@ -485,27 +191,6 @@ // void CApSettingsDeleteOperation::StartDeleteOperationThreadL() { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartDeleteOperationThreadL") - - TInt err = iDeleteOperation.Create - ( - KDeleteThreadName, // aName - RunDeleteThread, // aFunction - KDeleteThreadStackSize, // aStackSize - NULL, // Use this heap. - this // aPtr - ); - APSETUILOGGER_WRITE_FORMAT( EDelete, "iDeleteOperation create returned, code:%d", err); - - User::LeaveIfError( err ); - // on termination/death of this thread, it will call RunL - iDeleteOperation.Logon( iStatus ); - // let's start the thread - iDeleteOperation.Resume(); - // set the internal state as both is running - iState = EProcOnDialogOn; - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartDeleteOperationThreadL") } @@ -520,37 +205,7 @@ TBool aWrite, TBool aRetry /*ETrue*/ ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartTransactionLC") - - TBool retval( EFalse ); - if ( !aDb->InTransaction() ) - { - TInt retriesLeft( aRetry ? KRetryCount : 1 ); - TInt err = aDb->BeginTransaction(); - while ( ( err == KErrLocked ) && --retriesLeft ) - { - User::After( KRetryWait ); - err = aDb->BeginTransaction(); - if (aWrite ) - { - TRAP_IGNORE( GetWriteLockL( aDb ) ); - } - } - if ( err ) - { - ShowNoteL( R_APUI_VIEW_TEXT_CANNOT_ACCESS_DB ); - } - User::LeaveIfError( err ); - CleanupStack::PushL( TCleanupItem( RollbackTransactionOnLeave, aDb ) ); - retval = ETrue; - } - else - { - retval = EFalse; - } - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartTransactionLC") - return retval; + return EFalse; } @@ -560,17 +215,6 @@ // void CApSettingsDeleteOperation::GetWriteLockL( CCommsDatabase* aDb ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::GetWriteLockL") - - CCommsDbTableView* v = aDb->OpenTableLC( TPtrC(WAP_ACCESS_POINT ) ); - TUint32 aDummyUid( KApNoneUID ); - TInt err = v->InsertRecord( aDummyUid ); - User::LeaveIfError( err ); - v->CancelRecordChanges(); - User::LeaveIfError( err ); - CleanupStack::PopAndDestroy(); // v - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::GetWriteLockL") } // --------------------------------------------------------- @@ -579,12 +223,6 @@ // void CApSettingsDeleteOperation::RollbackTransactionOnLeave( TAny* aDb ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RollbackTransactionOnLeave") - - CCommsDatabase* db = STATIC_CAST( CCommsDatabase*, aDb ); - db->RollbackTransaction(); - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RollbackTransactionOnLeave") } @@ -596,18 +234,7 @@ const TDesC& aColumn, TUint32& aValue ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::ReadUintL") - - __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ; - TRAPD( err, atable->ReadUintL( aColumn, aValue ) ); - if ( err != KErrNone ) - { // do not leave if readed value is not present in table... - if ( err != KErrUnknown ) - User::Leave( err ); - } - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::ReadUintL") - return err; + return KErrNotSupported; } @@ -617,12 +244,5 @@ // void CApSettingsDeleteOperation::SetNoteTextL( const TDesC& aNoteText ) { - APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::SetNoteTextL") - - delete iNoteText; - iNoteText = NULL; // must NULL it to satisfy CodeScanner... - iNoteText = aNoteText.AllocL(); - - APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::SetNoteTextL") } // End of File