diff -r 164170e6151a -r d5423fbb4f29 securitydialogs/simlockui/src/SimLockUIDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/simlockui/src/SimLockUIDocument.cpp Tue Feb 02 00:44:34 2010 +0200 @@ -0,0 +1,158 @@ +/* +* ============================================================================ +* Name : SimLockUIDocument.cpp +* Part of : Sim Lock UI Application +* Description : Implementation of Sim Lock UI Application +* Version : +* +* Copyright (c) 2005-2010 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: Build info file for Ado domain appinstall +* +* ============================================================================ +*/ + +// System Include Files +#include // RMmCustomAPI, RMobilePhone +#include // KMmTsyModuleName +#include + +// User Include Files +#include "SimLockDataHandlingDelegate.h" +#include "SimLockISAServerDefinitions.h" +#include "SimLockUIAppUi.h" +#include "SimLockUIDocument.h" + +// Local Constants +const TInt KTriesToConnectServer( 2 ); +const TInt KTimeBeforeRetryingServerConnection( 50000 ); +static const TInt KPhoneInfoIndex( 0 ); + + +// --------------------------------------------------------------------------- +// CSimLockUIDocument::NewL +// --------------------------------------------------------------------------- +CSimLockUIDocument* CSimLockUIDocument::NewL( CEikApplication& aApp ) + { + CSimLockUIDocument* self = NewLC( aApp ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSimLockUIDocument::NewLC +// --------------------------------------------------------------------------- +CSimLockUIDocument* CSimLockUIDocument::NewLC( CEikApplication& aApp ) + { + CSimLockUIDocument* self = new ( ELeave ) CSimLockUIDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CSimLockUIDocument::~CSimLockUIDocument +// --------------------------------------------------------------------------- +CSimLockUIDocument::~CSimLockUIDocument() + { + // Close phone + if ( iPhone.SubSessionHandle() ) + { + iPhone.Close(); + } + + // Close custom phone + if ( iCustomPhone.SubSessionHandle() ) + { + iCustomPhone.Close(); + } + + // Close ETel connection + if ( iServer.Handle() ) + { + iServer.UnloadPhoneModule( KMmTsyModuleName ); + iServer.Close(); + } + + // Delete simlock delegate + delete iSimLockDelegate; + } + +// --------------------------------------------------------------------------- +// CSimLockUIDocument::CreateAppUiL +// --------------------------------------------------------------------------- +CEikAppUi* CSimLockUIDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it, + // the framework takes ownership of this object + CEikAppUi* appUi = new(ELeave)CSimLockUIAppUi( *iSimLockDelegate ); + return appUi; + } + +// --------------------------------------------------------------------------- +// CSimLockUIDocument::ConstructL +// --------------------------------------------------------------------------- +void CSimLockUIDocument::ConstructL() + { + RTelServer::TPhoneInfo phoneInfo; + + TInt error( KErrGeneral ); + + // Connect to ETel server + // All server connections are tried to be made KTriesToConnectServer times because occasional + // fails on connections are possible, at least on some servers. + for ( TInt thisTry=0; thisTry