diff -r 57a65a3a658c -r 06f47423ecee terminalsecurity/SCP/SCPTimestampPlugin/src/SCPUserInf.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPUserInf.cpp Fri Mar 12 15:46:48 2010 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CSCPUserInf implementation +* +*/ + +#include "SCPUserInf.h" +#include +#include +//#include +#include +#include "SCPDebug.h" + +#include +// For wipe +#include +#include +#include +#include "DMUtilClient.h" +CSCPUserInf::CSCPUserInf() : + CActive(EPriorityStandard) // Standard priority + { + } + +CSCPUserInf* CSCPUserInf::NewLC() + { + CSCPUserInf* self = new (ELeave) CSCPUserInf(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CSCPUserInf* CSCPUserInf::NewL() + { + CSCPUserInf* self = CSCPUserInf::NewLC(); + CleanupStack::Pop(); // self; + return self; + } + +void CSCPUserInf::ConstructL() + { + //User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer + Dprint( (_L("CSCPUserInf::ConstructL()") )); + CActiveScheduler::Add(this); // Add to scheduler + } + +CSCPUserInf::~CSCPUserInf() + { + Cancel(); // Cancel any request, if outstanding + //iTimer.Close(); // Destroy the RTimer object + // Delete instance variables if any + if (idispText) + delete idispText; + } + +void CSCPUserInf::DoCancel() + { + //iTimer.Cancel(); + } + +void CSCPUserInf::StartL(TDesC& aString) + { + idispText = HBufC16::NewL( aString.Length() ); + idispText->Des().Append(aString); + Cancel(); // Cancel any request, just to be sure + iState = EGlobalConf; + Dprint( (_L("CSCPUserInf::StartL()") )); + TRequestStatus* aStatus = &iStatus; + User::RequestComplete(aStatus, KErrNone); + SetActive(); // Tell scheduler a request is active + } + +void CSCPUserInf::DoRfsL() + { + Cancel(); // Cancel any request, just to be sure + iState = ERfs; + Dprint( (_L("CSCPUserInf::DoRfsL()") )); + TRequestStatus* aStatus = &iStatus; + User::RequestComplete(aStatus, KErrNone); + // This will give the control back to SecUi + SetActive(); // Tell scheduler a request is active + } + +void CSCPUserInf::RunL() + { + + Dprint( (_L("CSCPUserInf::RunL()") )); + if (iState == EGlobalConf) + { + Dprint( (_L("CSCPUserInf::EGlobalConf") )); + TRAP_IGNORE( + CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC(); + TPtr16 bufDes = idispText->Des(); + TRequestStatus status; + note->ShowConfirmationQueryL(status, + bufDes, + R_AVKON_SOFTKEYS_OK_EMPTY, + R_QGN_NOTE_WARNING_ANIM ); + Dprint( (_L("CSCPUserInf::WaitforReq") )); + User::WaitForRequest( status ); + Dprint( (_L("CSCPUserInf::WaitforReq done") )); + CleanupStack::PopAndDestroy( note ); + ); + } + else if (iState == ERfs) + { + Dprint( (_L("CSCPUserInf::ERfs") )); + // Mark MMC card to be formatted also in bootup + RDMUtil util; + if ( util.Connect() == KErrNone ) + { + TInt err = util.MarkMMCWipe(); + Dprint( (_L("CSCPUserInf::rfsClient.markmmc for wipe") )); + if( err != KErrNone ) + { + // even if not successfull we try to reset as much as possible -> continue + Dprint( ( _L( "CSCPUserInf::WipeDeviceL(): FAILED to mark MMC wipe: %d"), err ) ); + } + util.Close(); + } + + // In case of deep level RFS, set the default language code + // here, before RFS reboot. + + TInt language( 0 ); + Dprint( (_L("CSCPUserInf::Language") )); + // If default language is not found, we reset anyway + if ( SysLangUtil::GetDefaultLanguage( language ) == KErrNone ) + { + HAL::Set( HALData::ELanguageIndex, language ); + Dprint( (_L("CSCPUserInf::HAL,set") )); + } + + // Reboot with RFS reason + Dprint( (_L("CSCPUserInf::rfsClient.Reboot with RFS reason") )); + RStarterSession startersession; + if( startersession.Connect() == KErrNone ) + { + startersession.Reset( RStarterSession::EDeepRFSReset ); + Dprint( (_L("CSCPUserInf::rfsClient.starter reset") )); + startersession.Close(); + } + + TInt ret; + if ( ret != KErrNone ) + { + Dprint( ( _L( "CSCPUserInf::WipeDeviceL(): Rfs FAILED: %d"), ret ) ); + } + Dprint( (_L("CSCPUserInf::out of ERfs") )); + } + } + +TInt CSCPUserInf::RunError(TInt aError) + { + return aError; + }