uifw/AvKon/src/AknTextSettingPage.cpp
branchRCL_3
changeset 55 aecbbf00d063
parent 38 c52421ed5f07
child 56 d48ab3b357f1
equal deleted inserted replaced
51:fcdfafb36fe7 55:aecbbf00d063
    32 #include <AknsControlContext.h>
    32 #include <AknsControlContext.h>
    33 #include <AknsFrameBackgroundControlContext.h>
    33 #include <AknsFrameBackgroundControlContext.h>
    34 #include <eikedwob.h>
    34 #include <eikedwob.h>
    35 
    35 
    36 #include <AknTasHook.h>
    36 #include <AknTasHook.h>
    37 #include <AknFepInternalPSKeys.h>
    37 
    38 #include <e32property.h>
       
    39 #include <AknDef.h>
       
    40 
       
    41 
       
    42 /*
       
    43  * this class is a fixing for bug ESLM-8395MP 
       
    44  * Settingpage will keep watch the RProperty(set by Fep) to hide it self 
       
    45  */
       
    46 NONSHARABLE_CLASS( CAknFepSettingDialogStatusWatcher ) : public CActive
       
    47     {
       
    48 public:
       
    49     static CAknFepSettingDialogStatusWatcher* NewL( CAknTextSettingPage* aControl )
       
    50         {
       
    51         CAknFepSettingDialogStatusWatcher* watcher = new (ELeave) CAknFepSettingDialogStatusWatcher( aControl );
       
    52         CleanupStack::PushL( watcher );
       
    53         watcher->ConstructL();
       
    54         CleanupStack::Pop(watcher);
       
    55         return watcher;
       
    56         }
       
    57 
       
    58     CAknFepSettingDialogStatusWatcher( CAknTextSettingPage* aControl )
       
    59         : CActive( EPriorityNormal )
       
    60         , iControl( aControl ) 
       
    61         , iAttachSucceed( EFalse )
       
    62         {
       
    63         CActiveScheduler::Add( this );
       
    64         }
       
    65 
       
    66     ~CAknFepSettingDialogStatusWatcher()
       
    67         {
       
    68         StopWatching();
       
    69         iFepSettingDialogStatusProperty.Close();
       
    70         }
       
    71 
       
    72     void StartWatching()
       
    73         {
       
    74         if ( !IsActive() && iAttachSucceed )
       
    75             {
       
    76             iFepSettingDialogStatusProperty.Subscribe( iStatus );
       
    77             SetActive();
       
    78             }
       
    79         }
       
    80 
       
    81     void StopWatching()
       
    82         {
       
    83         Cancel();
       
    84         }
       
    85 
       
    86 private:
       
    87 
       
    88     void ConstructL()
       
    89         {
       
    90         TInt ret = iFepSettingDialogStatusProperty.Attach( KPSUidAknFep
       
    91                                                          , KAknFepSettingDialogState
       
    92                                                          , EOwnerThread );
       
    93         iAttachSucceed = ( ret == KErrNone );
       
    94         }
       
    95 
       
    96     void HandleAknFepSettingDialogStatusChangeNotification()
       
    97         {
       
    98         TInt isOpen = 0;
       
    99         iFepSettingDialogStatusProperty.Get( isOpen );
       
   100         if ( !iControl )
       
   101             {
       
   102             return;
       
   103             }
       
   104 
       
   105         if ( isOpen )
       
   106             {
       
   107             iControl->MakeVisible( EFalse );
       
   108             }
       
   109         else
       
   110             {
       
   111             iControl->MakeVisible( ETrue );
       
   112             }
       
   113         }
       
   114 
       
   115 private: // from CActive
       
   116 
       
   117     void RunL()
       
   118         {
       
   119         if ( iStatus.Int() == KErrNone )
       
   120             {
       
   121             HandleAknFepSettingDialogStatusChangeNotification();
       
   122             StartWatching();
       
   123             }
       
   124         }
       
   125 
       
   126     void DoCancel()
       
   127         {
       
   128         iFepSettingDialogStatusProperty.Cancel();
       
   129         }
       
   130 
       
   131 private:
       
   132     //
       
   133     // not owned
       
   134     //
       
   135     CAknTextSettingPage* iControl;
       
   136 
       
   137     RProperty  iFepSettingDialogStatusProperty;
       
   138 
       
   139     //
       
   140     // If RProperty attach succeed 
       
   141     //
       
   142     TBool iAttachSucceed ;
       
   143     };
       
   144 
       
   145 
       
   146 // ============================================================================
       
   147 //  text settingpage private extented class 
       
   148 //
       
   149 // ============================================================================
       
   150 //
       
   151 class CAknTextSettingPageExtension : public CBase
    38 class CAknTextSettingPageExtension : public CBase
   152 								   , public MEikEdwinObserver
    39 								   , public MEikEdwinObserver
   153     {
    40     {
   154 public:
    41 public:
   155     static CAknTextSettingPageExtension* NewL(CAknTextSettingPage* aExtensionOwner )
    42     static CAknTextSettingPageExtension* NewL(CAknTextSettingPage* aExtensionOwner )
   162         }
    49         }
   163         
    50         
   164     ~CAknTextSettingPageExtension()
    51     ~CAknTextSettingPageExtension()
   165         {
    52         {
   166         iExtensionOwner = 0;
    53         iExtensionOwner = 0;
   167 		
       
   168 		if( iAknFepSettingDialogStatusWatcher )
       
   169 		    {
       
   170 		    iAknFepSettingDialogStatusWatcher->StopWatching();
       
   171             }			
       
   172 		delete iAknFepSettingDialogStatusWatcher;
       
   173         }
    54         }
   174         
    55         
   175     TInt PreviousCba()
    56     TInt PreviousCba()
   176         {
    57         {
   177         return iPreviousCba;
    58         return iPreviousCba;
   178         };
    59         };
   179 		
       
   180     void SetPreviousCba(TInt aCbaId)
    60     void SetPreviousCba(TInt aCbaId)
   181         {
    61         {
   182         iPreviousCba = aCbaId;
    62         iPreviousCba = aCbaId;
   183         }
    63         }
   184 		
       
   185 	TBool PopupState()
    64 	TBool PopupState()
   186 	 	{
    65 	 	{
   187 		return iPopupState;
    66 		return iPopupState;
   188 		}
    67 		}
   189 
    68 
   201 		}
    80 		}
   202     
    81     
   203 private:
    82 private:
   204     void ConstructL()
    83     void ConstructL()
   205         {
    84         {
   206 		iAknFepSettingDialogStatusWatcher = CAknFepSettingDialogStatusWatcher::NewL( iExtensionOwner );
       
   207 		iAknFepSettingDialogStatusWatcher->StartWatching();
       
   208         }
    85         }
   209         
    86         
   210     CAknTextSettingPageExtension(CAknTextSettingPage*  aExtensionOwner )
    87     CAknTextSettingPageExtension(CAknTextSettingPage*  aExtensionOwner )
   211         : iPreviousCba( 0 )
    88         : iPreviousCba( 0 ), iExtensionOwner( aExtensionOwner )
   212         , iExtensionOwner( aExtensionOwner )
       
   213         , iPopupState( EFalse )
    89         , iPopupState( EFalse )
   214         {
    90         {
   215         }
    91         }
   216         
    92         
   217 private:
    93 private:
   218     TInt iPreviousCba;
    94     TInt iPreviousCba;
   219     CAknTextSettingPage* iExtensionOwner;
    95     CAknTextSettingPage* iExtensionOwner;
   220     TBool iPopupState;  // when open the popup set popup state flag  to 1
    96     TBool iPopupState;  // when open the popup set popup state flag  to 1
   221 
       
   222 	//
       
   223 	// active object keep watching Fep's property (Owned)
       
   224 	//
       
   225 	CAknFepSettingDialogStatusWatcher* iAknFepSettingDialogStatusWatcher;
       
   226     };
    97     };
   227 
    98 
   228 /**
    99 /**
   229  * Exported in case others want to derive from this class
   100  * Exported in case others want to derive from this class
   230  *
   101  *
   354 	{
   225 	{
   355 	BaseConstructL();
   226 	BaseConstructL();
   356 	iBackupText = iText.AllocL();
   227 	iBackupText = iText.AllocL();
   357 	CEikEdwin* editor = TextControl();
   228 	CEikEdwin* editor = TextControl();
   358 
   229 
   359 	editor->EnableKineticScrollingL( ETrue );
       
   360 	// Inhibit predictive text entry unless allowed by API
   230 	// Inhibit predictive text entry unless allowed by API
   361 	if ( !(iTextSettingPageFlags & EPredictiveTextEntryPermitted) )
   231 	if ( !(iTextSettingPageFlags & EPredictiveTextEntryPermitted) )
   362 		editor->SetAknEditorFlags( EAknEditorFlagNoT9 | editor->AknEdwinFlags() );
   232 		editor->SetAknEditorFlags( EAknEditorFlagNoT9 | editor->AknEdwinFlags() );
   363 	
   233 	
   364 	if(!IsEditable())
   234 	if(!IsEditable())
   397 	UpdateCbaL();
   267 	UpdateCbaL();
   398 
   268 
   399 	// Construct an appropriate control context for the contained editor areas.
   269 	// Construct an appropriate control context for the contained editor areas.
   400 	// Context produced is owned by CAknSettingPage. 
   270 	// Context produced is owned by CAknSettingPage. 
   401     SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter );
   271     SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter );
   402     
   272 	TextControl()->ScrollBarFrame()->VerticalScrollBar()->SetMopParent(this);
   403     // ScrollBarFrame always exists in this phase
       
   404     CEikScrollBar* sb = editor->ScrollBarFrame()->VerticalScrollBar();
       
   405     if ( sb )
       
   406         {
       
   407         sb->SetMopParent( this );
       
   408         sb->MakeVisible( ETrue );
       
   409         }
       
   410 	}
   273 	}
   411 
   274 
   412 /**
   275 /**
   413  * Acts upon changes in the hosted control's state. 
   276  * Acts upon changes in the hosted control's state. 
   414  *
   277  *
   558     TAknTextComponentLayout layout;
   421     TAknTextComponentLayout layout;
   559     RArray<TAknTextComponentLayout> array;
   422     RArray<TAknTextComponentLayout> array;
   560     
   423     
   561     for ( TInt i = textLimits.FirstRow(); i <= textLimits.LastRow(); ++i )
   424     for ( TInt i = textLimits.FirstRow(); i <= textLimits.LastRow(); ++i )
   562         {
   425         {
   563 		TInt err = array.Append( AknLayoutScalable_Avkon::set_text_pane_t1_copy1( 0, 0, i ) );
   426         array.Append(
   564         if ( err != KErrNone)
   427             AknLayoutScalable_Avkon::set_text_pane_t1_copy1( 0, 0, i ) );
   565         	{
       
   566 			array.Close();
       
   567 			return;
       
   568         	}
       
   569         }
   428         }
   570     
   429     
   571     AknLayoutUtils::LayoutEdwin( TextControl(),
   430     AknLayoutUtils::LayoutEdwin( TextControl(),
   572                                  edwinRect,
   431                                  edwinRect,
   573                                  layout.Multiline( array ),
   432                                  layout.Multiline( array ),