idlehomescreen/xmluirendering/renderingplugins/xntexteditorfactory/src/xntexteditorpublisher.cpp
--- a/idlehomescreen/xmluirendering/renderingplugins/xntexteditorfactory/src/xntexteditorpublisher.cpp Wed Sep 01 12:32:46 2010 +0100
+++ b/idlehomescreen/xmluirendering/renderingplugins/xntexteditorfactory/src/xntexteditorpublisher.cpp Tue Sep 14 20:58:58 2010 +0300
@@ -94,13 +94,10 @@
delete iServiceHandler;
iServiceHandler = NULL;
}
- CEikEdwin* editor = iAdapter.Editor();
- if( editor )
- {
- editor->RemoveEdwinObserver( this );
- }
+
delete iNodeId;
delete iTextBuffer;
+ delete iTempBuffer;
}
// -----------------------------------------------------------------------------
@@ -120,12 +117,18 @@
{
iNodeId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aNodeId );
InitCpsInterfaceL();
- CEikEdwin* editor = iAdapter.Editor();
- if( editor )
- {
- editor->SetEdwinObserver( this );
- TInt len = editor->MaxLength();
+
+ CEikEdwin* editor( iAdapter.Editor() );
+
+ // Editor must be activated before setting observer
+ if( editor && editor->TextView() )
+ {
+ TInt len( editor->MaxLength() );
+
iTextBuffer = HBufC::NewL( len );
+ iTempBuffer = HBufC::NewL( len );
+
+ editor->TextView()->SetObserver( this );
}
}
@@ -250,19 +253,35 @@
iCpsInterface = msgInterface;
}
+
// -----------------------------------------------------------------------------
-// CXnTextEditorPublisher::HandleEdwinEventL
+// CXnTextEditorPublisher::OnReformatL
// -----------------------------------------------------------------------------
//
-void CXnTextEditorPublisher::HandleEdwinEventL(CEikEdwin* aEdwin, TEdwinEvent aEventType)
+void CXnTextEditorPublisher::OnReformatL( const CTextView* aTextView )
{
- if( aEventType == MEikEdwinObserver::EEventTextUpdate)
+ CEikEdwin* editor( iAdapter.Editor() );
+
+ if ( editor )
{
- TPtr bufferDes = iTextBuffer->Des();
- bufferDes.Zero();
- aEdwin->GetText( bufferDes );
- PublishTextL( bufferDes );
- }
+ editor->OnReformatL( aTextView );
+
+ TPtr ptr( iTempBuffer->Des() );
+
+ ptr.Zero();
+
+ editor->GetText( ptr );
+
+ if ( *iTextBuffer != *iTempBuffer )
+ {
+ *iTextBuffer = *iTempBuffer;
+
+ if ( !iAdapter.IsSetText() )
+ {
+ PublishTextL( *iTextBuffer );
+ }
+ }
+ }
}
// -----------------------------------------------------------------------------