uifw/AvKon/src/AknTextSettingPage.cpp
branchRCL_3
changeset 38 c52421ed5f07
parent 29 a8834a2e9a96
child 55 aecbbf00d063
--- a/uifw/AvKon/src/AknTextSettingPage.cpp	Wed Jun 09 09:58:37 2010 +0300
+++ b/uifw/AvKon/src/AknTextSettingPage.cpp	Mon Jun 21 15:57:43 2010 +0300
@@ -38,17 +38,14 @@
 #include <e32property.h>
 #include <AknDef.h>
 
-static _LIT_SECURITY_POLICY_PASS( KAllowAllPolicy );
-static _LIT_SECURITY_POLICY_C1( KPowerMgmtPolicy, ECapabilityPowerMgmt );
 
 /*
  * this class is a fixing for bug ESLM-8395MP 
  * Settingpage will keep watch the RProperty(set by Fep) to hide it self 
  */
-class CAknFepSettingDialogStatusWatcher : public CActive
-	{
+NONSHARABLE_CLASS( CAknFepSettingDialogStatusWatcher ) : public CActive
+    {
 public:
-
     static CAknFepSettingDialogStatusWatcher* NewL( CAknTextSettingPage* aControl )
         {
         CAknFepSettingDialogStatusWatcher* watcher = new (ELeave) CAknFepSettingDialogStatusWatcher( aControl );
@@ -57,94 +54,80 @@
         CleanupStack::Pop(watcher);
         return watcher;
         }
-    
-	CAknFepSettingDialogStatusWatcher( CAknTextSettingPage* aControl )
-	    : CActive( EPriorityNormal )
-		, iControl( aControl ) 
-	    {
-	    CActiveScheduler::Add( this );
-	    }
-	
-	~CAknFepSettingDialogStatusWatcher()
+
+    CAknFepSettingDialogStatusWatcher( CAknTextSettingPage* aControl )
+        : CActive( EPriorityNormal )
+        , iControl( aControl ) 
+        , iAttachSucceed( EFalse )
+        {
+        CActiveScheduler::Add( this );
+        }
+
+    ~CAknFepSettingDialogStatusWatcher()
         {
         StopWatching();
         iFepSettingDialogStatusProperty.Close();
-	    }
-	
-	void StartWatchingL()
-	    {
-	    if ( !IsActive() )
+        }
+
+    void StartWatching()
+        {
+        if ( !IsActive() && iAttachSucceed )
             {
             iFepSettingDialogStatusProperty.Subscribe( iStatus );
             SetActive();
             }
-	    }
-		
+        }
+
     void StopWatching()
-	    {
-	    Cancel();
-	    }
-	
-private:    
-    
+        {
+        Cancel();
+        }
+
+private:
+
     void ConstructL()
         {
-        // Define PS Key
-        TInt err = RProperty::Define(
-            KPSUidAknFep, 
-            KAknFepSettingDialogState, 
-            RProperty::EInt, 
-            KAllowAllPolicy,  // None
-            KPowerMgmtPolicy ); 
-            
-        if (err != KErrAlreadyExists)
-            {
-            User::LeaveIfError( err );
-            }
-        User::LeaveIfError( iFepSettingDialogStatusProperty.Attach( KPSUidAknFep
-                                          , KAknFepSettingDialogState, EOwnerThread ) );
+        TInt ret = iFepSettingDialogStatusProperty.Attach( KPSUidAknFep
+                                                         , KAknFepSettingDialogState
+                                                         , EOwnerThread );
+        iAttachSucceed = ( ret == KErrNone );
         }
-	
-	void HandleAknFepSettingDialogStatusChangeNotificationL()
-	    {
-	    TInt isOpen = 0;
-	    TInt ret = iFepSettingDialogStatusProperty.Get( isOpen );
-        if ( ret!=KErrOverflow )
-            {
-            User::LeaveIfError( ret );
-            }
-	
+
+    void HandleAknFepSettingDialogStatusChangeNotification()
+        {
+        TInt isOpen = 0;
+        iFepSettingDialogStatusProperty.Get( isOpen );
         if ( !iControl )
             {
             return;
             }
 
-	    if ( isOpen )
-	        {
-	        iControl->MakeVisible( EFalse );
-	        }
-	    else
-	        {
-	        iControl->MakeVisible( ETrue );
-	        }
-	    }
-	
+        if ( isOpen )
+            {
+            iControl->MakeVisible( EFalse );
+            }
+        else
+            {
+            iControl->MakeVisible( ETrue );
+            }
+        }
+
 private: // from CActive
 
     void RunL()
-	    {
-	    if ( iStatus.Int() == KErrNone )
+        {
+        if ( iStatus.Int() == KErrNone )
             {
-            HandleAknFepSettingDialogStatusChangeNotificationL();
-            StartWatchingL();
+            HandleAknFepSettingDialogStatusChangeNotification();
+            StartWatching();
             }
-	    }
+        }
 
     void DoCancel()
-	    {
-	    iFepSettingDialogStatusProperty.Cancel();
-	    }
-	
+        {
+        iFepSettingDialogStatusProperty.Cancel();
+        }
+
 private:
     //
     // not owned
@@ -152,6 +135,11 @@
     CAknTextSettingPage* iControl;
 
     RProperty  iFepSettingDialogStatusProperty;
+
+    //
+    // If RProperty attach succeed 
+    //
+    TBool iAttachSucceed ;
     };
 
 
@@ -216,7 +204,7 @@
     void ConstructL()
         {
 		iAknFepSettingDialogStatusWatcher = CAknFepSettingDialogStatusWatcher::NewL( iExtensionOwner );
-		iAknFepSettingDialogStatusWatcher->StartWatchingL();
+		iAknFepSettingDialogStatusWatcher->StartWatching();
         }
         
     CAknTextSettingPageExtension(CAknTextSettingPage*  aExtensionOwner )
@@ -572,8 +560,12 @@
     
     for ( TInt i = textLimits.FirstRow(); i <= textLimits.LastRow(); ++i )
         {
-        array.Append(
-            AknLayoutScalable_Avkon::set_text_pane_t1_copy1( 0, 0, i ) );
+		TInt err = array.Append( AknLayoutScalable_Avkon::set_text_pane_t1_copy1( 0, 0, i ) );
+        if ( err != KErrNone)
+        	{
+			array.Close();
+			return;
+        	}
         }
     
     AknLayoutUtils::LayoutEdwin( TextControl(),