lafagnosticuifoundation/cone/src/COECNTRL.CPP
branchRCL_3
changeset 10 9f56a4e1b8ab
parent 0 2f259fa3e83a
--- a/lafagnosticuifoundation/cone/src/COECNTRL.CPP	Fri Mar 12 15:43:43 2010 +0200
+++ b/lafagnosticuifoundation/cone/src/COECNTRL.CPP	Mon Mar 15 12:41:34 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-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"
@@ -69,12 +69,12 @@
 	inline CCoeControlStorage();
 	inline RCoeDynamicDataStorage& DynamicDataStorage();
 	inline const RCoeDynamicDataStorage& DynamicDataStorage() const;
-	inline void Open();
+	inline TInt Open();
 	inline void Close();
 	inline void AttemptCompress();
 	void SetPointerGrab(TUint aSet, TUint aClear);
 	TUint8& PointerGrab();
-	
+
 private:
 	RCoeDynamicDataStorage iDynamicDataStorage;
 	TUint8 iPointerGrabFlags; // The grab-status of each of the supported pointers
@@ -103,8 +103,8 @@
 inline const RCoeDynamicDataStorage& CCoeControlStorage::DynamicDataStorage() const
 	{ return iDynamicDataStorage; }
 
-inline void CCoeControlStorage::Open()
-	{ iDynamicDataStorage.Open(); }
+inline TInt CCoeControlStorage::Open()
+	{ return iDynamicDataStorage.Open(); }
 
 inline void CCoeControlStorage::Close()
 	{ iDynamicDataStorage.Close(); }
@@ -121,19 +121,7 @@
 control classes are derived. However, it can also be instantiated as a concrete 
 class. */
 	{
-	iCoeEnv = TheCoe();
-	
-	iData = new CCoeControlStorage;		// Non-leaving allocation
-	if (iData)
-		{
-		iData->Open();
-		}
-	else 
-		{
-		iFlags |= EMemoryAllocationFailed;	// Handle OOM later
-		}
-	
-	SetFocusing(CCoeControlStaticSettings::FocusedByDefault(iCoeEnv));	
+	Constructor(TheCoe());
 	}
 
 EXPORT_C CCoeControl::CCoeControl(CCoeEnv* aCoeEnv)
@@ -147,14 +135,17 @@
 
 @param aCoeEnv The control environment.*/
 	{
+	Constructor(aCoeEnv);
+	}
+
+void CCoeControl::Constructor(CCoeEnv* aCoeEnv)
+	{
 	iCoeEnv = aCoeEnv;
-	
+
 	iData = new CCoeControlStorage;		// Non-leaving allocation
-	if(iData)
-		iData->Open();
-	else 
+	if (!iData || iData->Open()!=KErrNone)
 		iFlags |= EMemoryAllocationFailed;	// Handle OOM later
-	
+
 	SetFocusing(CCoeControlStaticSettings::FocusedByDefault(iCoeEnv));
 	}