phoneengine/PhoneCntFinder/src/Misc/CPhCntProfileEngineImpl.cpp
changeset 0 5f000ab63145
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneengine/PhoneCntFinder/src/Misc/CPhCntProfileEngineImpl.cpp	Mon Jan 18 20:18:27 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2002 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:  Implementation of Profile information retrieval.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CPhCntProfileEngineImpl.h"
+#include    <MProfile.h>
+
+// CONSTANTS
+_LIT( KPhCntProfilePanic, "PhCntProfile" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::NewL
+// -----------------------------------------------------------------------------
+//
+CPhCntProfileEngineImpl* CPhCntProfileEngineImpl::NewL()
+    {
+    CPhCntProfileEngineImpl* self = 
+        new ( ELeave ) CPhCntProfileEngineImpl;
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::~CPhCntProfileEngineImpl
+// -----------------------------------------------------------------------------
+//      
+CPhCntProfileEngineImpl::~CPhCntProfileEngineImpl()
+    {
+    if ( iProfile )
+        {
+        iProfile->Release();
+        iProfile = NULL;
+        }
+
+    if ( iEngine )
+        {
+        iEngine->Release();
+        iEngine = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::RefreshL
+// -----------------------------------------------------------------------------
+//
+void CPhCntProfileEngineImpl::RefreshL()
+    {
+    if ( !iEngine )
+        {
+        iEngine = CreateProfileEngineL();
+        }
+
+    MProfile* profile = iEngine->ActiveProfileL();
+
+    if ( iProfile )
+        {
+        iProfile->Release();
+        iProfile = NULL;
+        }
+    iProfile = profile;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::HasProfile
+// -----------------------------------------------------------------------------
+//
+TBool CPhCntProfileEngineImpl::HasProfile() const
+    {
+    return iProfile != NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::Profile
+// -----------------------------------------------------------------------------
+//
+MProfile& CPhCntProfileEngineImpl::Profile()
+    {
+    __ASSERT_ALWAYS( iProfile, User::Panic( KPhCntProfilePanic, 0 ) );
+    return *iProfile;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::SetActiveProfileL
+// -----------------------------------------------------------------------------
+//
+void CPhCntProfileEngineImpl::SetActiveProfileL( const TInt aProfileId )
+    {
+    if ( !iEngine )
+        {
+        iEngine = CreateProfileEngineL();
+        }
+
+    iEngine->SetActiveProfileL( aProfileId );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCntProfileEngineImpl::IsFeatureSupported
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CPhCntProfileEngineImpl::IsFeatureSupported(
+        TProfileFeatureId aFeatureId ) const
+    {
+    return iEngine->IsFeatureSupported( aFeatureId );
+    }
+
+//  End of File