diff -r d2c4c66342f3 -r d51193d814ea messagingfw/senduiservices/src/senduisingleton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/senduiservices/src/senduisingleton.cpp Wed Sep 01 12:27:27 2010 +0100 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2007 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: Singleton +* +*/ + + + +// INCLUDE FILES + +#include // CMsvSession +#include // CClientMtmRegistry +#include // CMtmUiRegistry +#include // CMtmUiDataRegistry + +#include + + +// CONSTANTS + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::CSendUiSingleton +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSendUiSingleton::CSendUiSingleton() + { + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSendUiSingleton::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSendUiSingleton* CSendUiSingleton::NewL() + { + CSendUiSingleton* self = new (ELeave) CSendUiSingleton; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::~CSendUiSingleton +// Destructor +// ----------------------------------------------------------------------------- +// +CSendUiSingleton::~CSendUiSingleton() + { + // Deletion order is significant. + delete iMtmUiDataRegistry; + delete iMtmUiRegistry; + delete iClientMtmRegistry; + delete iMsvSession; + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::MsvSessionL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMsvSession& CSendUiSingleton::MsvSessionL() + { + if ( !iMsvSession ) + { + iMsvSession = CMsvSession::OpenSyncL( *this ); + } + return *iMsvSession; + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::ClientMtmRegistryL +// ----------------------------------------------------------------------------- +// +EXPORT_C CClientMtmRegistry& CSendUiSingleton::ClientMtmRegistryL() + { + if ( !iClientMtmRegistry ) + { + iClientMtmRegistry = CClientMtmRegistry::NewL( MsvSessionL() ); + } + return *iClientMtmRegistry; + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::MtmUiRegistryL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMtmUiRegistry& CSendUiSingleton::MtmUiRegistryL() + { + if ( !iMtmUiRegistry ) + { + iMtmUiRegistry = CMtmUiRegistry::NewL( MsvSessionL() ); + } + return *iMtmUiRegistry; + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::MtmUiDataRegistryL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMtmUiDataRegistry& CSendUiSingleton::MtmUiDataRegistryL() + { + if ( !iMtmUiDataRegistry ) + { + iMtmUiDataRegistry = CMtmUiDataRegistry::NewL( MsvSessionL() ); + } + return *iMtmUiDataRegistry; + } + +// ----------------------------------------------------------------------------- +// CSendUiSingleton::MsvSessionL +// ----------------------------------------------------------------------------- +// +void CSendUiSingleton::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) + { + } + + +// End of File