uifw/AvKon/src/AknTextSettingPage.cpp
branchRCL_3
changeset 38 c52421ed5f07
parent 29 a8834a2e9a96
child 55 aecbbf00d063
equal deleted inserted replaced
29:a8834a2e9a96 38:c52421ed5f07
    36 #include <AknTasHook.h>
    36 #include <AknTasHook.h>
    37 #include <AknFepInternalPSKeys.h>
    37 #include <AknFepInternalPSKeys.h>
    38 #include <e32property.h>
    38 #include <e32property.h>
    39 #include <AknDef.h>
    39 #include <AknDef.h>
    40 
    40 
    41 static _LIT_SECURITY_POLICY_PASS( KAllowAllPolicy );
       
    42 static _LIT_SECURITY_POLICY_C1( KPowerMgmtPolicy, ECapabilityPowerMgmt );
       
    43 
    41 
    44 /*
    42 /*
    45  * this class is a fixing for bug ESLM-8395MP 
    43  * this class is a fixing for bug ESLM-8395MP 
    46  * Settingpage will keep watch the RProperty(set by Fep) to hide it self 
    44  * Settingpage will keep watch the RProperty(set by Fep) to hide it self 
    47  */
    45  */
    48 class CAknFepSettingDialogStatusWatcher : public CActive
    46 NONSHARABLE_CLASS( CAknFepSettingDialogStatusWatcher ) : public CActive
    49 	{
    47     {
    50 public:
    48 public:
    51 
       
    52     static CAknFepSettingDialogStatusWatcher* NewL( CAknTextSettingPage* aControl )
    49     static CAknFepSettingDialogStatusWatcher* NewL( CAknTextSettingPage* aControl )
    53         {
    50         {
    54         CAknFepSettingDialogStatusWatcher* watcher = new (ELeave) CAknFepSettingDialogStatusWatcher( aControl );
    51         CAknFepSettingDialogStatusWatcher* watcher = new (ELeave) CAknFepSettingDialogStatusWatcher( aControl );
    55         CleanupStack::PushL( watcher );
    52         CleanupStack::PushL( watcher );
    56         watcher->ConstructL();
    53         watcher->ConstructL();
    57         CleanupStack::Pop(watcher);
    54         CleanupStack::Pop(watcher);
    58         return watcher;
    55         return watcher;
    59         }
    56         }
    60     
    57 
    61 	CAknFepSettingDialogStatusWatcher( CAknTextSettingPage* aControl )
    58     CAknFepSettingDialogStatusWatcher( CAknTextSettingPage* aControl )
    62 	    : CActive( EPriorityNormal )
    59         : CActive( EPriorityNormal )
    63 		, iControl( aControl ) 
    60         , iControl( aControl ) 
    64 	    {
    61         , iAttachSucceed( EFalse )
    65 	    CActiveScheduler::Add( this );
    62         {
    66 	    }
    63         CActiveScheduler::Add( this );
    67 	
    64         }
    68 	~CAknFepSettingDialogStatusWatcher()
    65 
       
    66     ~CAknFepSettingDialogStatusWatcher()
    69         {
    67         {
    70         StopWatching();
    68         StopWatching();
    71         iFepSettingDialogStatusProperty.Close();
    69         iFepSettingDialogStatusProperty.Close();
    72 	    }
    70         }
    73 	
    71 
    74 	void StartWatchingL()
    72     void StartWatching()
    75 	    {
    73         {
    76 	    if ( !IsActive() )
    74         if ( !IsActive() && iAttachSucceed )
    77             {
    75             {
    78             iFepSettingDialogStatusProperty.Subscribe( iStatus );
    76             iFepSettingDialogStatusProperty.Subscribe( iStatus );
    79             SetActive();
    77             SetActive();
    80             }
    78             }
    81 	    }
    79         }
    82 		
    80 
    83     void StopWatching()
    81     void StopWatching()
    84 	    {
    82         {
    85 	    Cancel();
    83         Cancel();
    86 	    }
    84         }
    87 	
    85 
    88 private:    
    86 private:
    89     
    87 
    90     void ConstructL()
    88     void ConstructL()
    91         {
    89         {
    92         // Define PS Key
    90         TInt ret = iFepSettingDialogStatusProperty.Attach( KPSUidAknFep
    93         TInt err = RProperty::Define(
    91                                                          , KAknFepSettingDialogState
    94             KPSUidAknFep, 
    92                                                          , EOwnerThread );
    95             KAknFepSettingDialogState, 
    93         iAttachSucceed = ( ret == KErrNone );
    96             RProperty::EInt, 
    94         }
    97             KAllowAllPolicy,  // None
    95 
    98             KPowerMgmtPolicy ); 
    96     void HandleAknFepSettingDialogStatusChangeNotification()
    99             
    97         {
   100         if (err != KErrAlreadyExists)
    98         TInt isOpen = 0;
   101             {
    99         iFepSettingDialogStatusProperty.Get( isOpen );
   102             User::LeaveIfError( err );
       
   103             }
       
   104         User::LeaveIfError( iFepSettingDialogStatusProperty.Attach( KPSUidAknFep
       
   105                                           , KAknFepSettingDialogState, EOwnerThread ) );
       
   106         }
       
   107 	
       
   108 	void HandleAknFepSettingDialogStatusChangeNotificationL()
       
   109 	    {
       
   110 	    TInt isOpen = 0;
       
   111 	    TInt ret = iFepSettingDialogStatusProperty.Get( isOpen );
       
   112         if ( ret!=KErrOverflow )
       
   113             {
       
   114             User::LeaveIfError( ret );
       
   115             }
       
   116 	
       
   117         if ( !iControl )
   100         if ( !iControl )
   118             {
   101             {
   119             return;
   102             return;
   120             }
   103             }
   121 
   104 
   122 	    if ( isOpen )
   105         if ( isOpen )
   123 	        {
   106             {
   124 	        iControl->MakeVisible( EFalse );
   107             iControl->MakeVisible( EFalse );
   125 	        }
   108             }
   126 	    else
   109         else
   127 	        {
   110             {
   128 	        iControl->MakeVisible( ETrue );
   111             iControl->MakeVisible( ETrue );
   129 	        }
   112             }
   130 	    }
   113         }
   131 	
   114 
   132 private: // from CActive
   115 private: // from CActive
   133 
   116 
   134     void RunL()
   117     void RunL()
   135 	    {
   118         {
   136 	    if ( iStatus.Int() == KErrNone )
   119         if ( iStatus.Int() == KErrNone )
   137             {
   120             {
   138             HandleAknFepSettingDialogStatusChangeNotificationL();
   121             HandleAknFepSettingDialogStatusChangeNotification();
   139             StartWatchingL();
   122             StartWatching();
   140             }
   123             }
   141 	    }
   124         }
   142 
   125 
   143     void DoCancel()
   126     void DoCancel()
   144 	    {
   127         {
   145 	    iFepSettingDialogStatusProperty.Cancel();
   128         iFepSettingDialogStatusProperty.Cancel();
   146 	    }
   129         }
   147 	
   130 
   148 private:
   131 private:
   149     //
   132     //
   150     // not owned
   133     // not owned
   151     //
   134     //
   152     CAknTextSettingPage* iControl;
   135     CAknTextSettingPage* iControl;
   153 
   136 
   154     RProperty  iFepSettingDialogStatusProperty;
   137     RProperty  iFepSettingDialogStatusProperty;
       
   138 
       
   139     //
       
   140     // If RProperty attach succeed 
       
   141     //
       
   142     TBool iAttachSucceed ;
   155     };
   143     };
   156 
   144 
   157 
   145 
   158 // ============================================================================
   146 // ============================================================================
   159 //  text settingpage private extented class 
   147 //  text settingpage private extented class 
   214     
   202     
   215 private:
   203 private:
   216     void ConstructL()
   204     void ConstructL()
   217         {
   205         {
   218 		iAknFepSettingDialogStatusWatcher = CAknFepSettingDialogStatusWatcher::NewL( iExtensionOwner );
   206 		iAknFepSettingDialogStatusWatcher = CAknFepSettingDialogStatusWatcher::NewL( iExtensionOwner );
   219 		iAknFepSettingDialogStatusWatcher->StartWatchingL();
   207 		iAknFepSettingDialogStatusWatcher->StartWatching();
   220         }
   208         }
   221         
   209         
   222     CAknTextSettingPageExtension(CAknTextSettingPage*  aExtensionOwner )
   210     CAknTextSettingPageExtension(CAknTextSettingPage*  aExtensionOwner )
   223         : iPreviousCba( 0 )
   211         : iPreviousCba( 0 )
   224         , iExtensionOwner( aExtensionOwner )
   212         , iExtensionOwner( aExtensionOwner )
   570     TAknTextComponentLayout layout;
   558     TAknTextComponentLayout layout;
   571     RArray<TAknTextComponentLayout> array;
   559     RArray<TAknTextComponentLayout> array;
   572     
   560     
   573     for ( TInt i = textLimits.FirstRow(); i <= textLimits.LastRow(); ++i )
   561     for ( TInt i = textLimits.FirstRow(); i <= textLimits.LastRow(); ++i )
   574         {
   562         {
   575         array.Append(
   563 		TInt err = array.Append( AknLayoutScalable_Avkon::set_text_pane_t1_copy1( 0, 0, i ) );
   576             AknLayoutScalable_Avkon::set_text_pane_t1_copy1( 0, 0, i ) );
   564         if ( err != KErrNone)
       
   565         	{
       
   566 			array.Close();
       
   567 			return;
       
   568         	}
   577         }
   569         }
   578     
   570     
   579     AknLayoutUtils::LayoutEdwin( TextControl(),
   571     AknLayoutUtils::LayoutEdwin( TextControl(),
   580                                  edwinRect,
   572                                  edwinRect,
   581                                  layout.Multiline( array ),
   573                                  layout.Multiline( array ),