92 { |
92 { |
93 iServiceHandler->Reset(); |
93 iServiceHandler->Reset(); |
94 delete iServiceHandler; |
94 delete iServiceHandler; |
95 iServiceHandler = NULL; |
95 iServiceHandler = NULL; |
96 } |
96 } |
97 CEikEdwin* editor = iAdapter.Editor(); |
97 |
98 if( editor ) |
|
99 { |
|
100 editor->RemoveEdwinObserver( this ); |
|
101 } |
|
102 delete iNodeId; |
98 delete iNodeId; |
103 delete iTextBuffer; |
99 delete iTextBuffer; |
|
100 delete iTempBuffer; |
104 } |
101 } |
105 |
102 |
106 // ----------------------------------------------------------------------------- |
103 // ----------------------------------------------------------------------------- |
107 // C++ default constructor. Must not leave. |
104 // C++ default constructor. Must not leave. |
108 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
118 // |
115 // |
119 void CXnTextEditorPublisher::ConstructL( const TDesC8& aNodeId ) |
116 void CXnTextEditorPublisher::ConstructL( const TDesC8& aNodeId ) |
120 { |
117 { |
121 iNodeId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aNodeId ); |
118 iNodeId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aNodeId ); |
122 InitCpsInterfaceL(); |
119 InitCpsInterfaceL(); |
123 CEikEdwin* editor = iAdapter.Editor(); |
120 |
124 if( editor ) |
121 CEikEdwin* editor( iAdapter.Editor() ); |
125 { |
122 |
126 editor->SetEdwinObserver( this ); |
123 // Editor must be activated before setting observer |
127 TInt len = editor->MaxLength(); |
124 if( editor && editor->TextView() ) |
|
125 { |
|
126 TInt len( editor->MaxLength() ); |
|
127 |
128 iTextBuffer = HBufC::NewL( len ); |
128 iTextBuffer = HBufC::NewL( len ); |
|
129 iTempBuffer = HBufC::NewL( len ); |
|
130 |
|
131 editor->TextView()->SetObserver( this ); |
129 } |
132 } |
130 } |
133 } |
131 |
134 |
132 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
133 // Uses the CPS interface to add given data |
136 // Uses the CPS interface to add given data |
248 outParam.Reset(); |
251 outParam.Reset(); |
249 inParam.Reset(); |
252 inParam.Reset(); |
250 iCpsInterface = msgInterface; |
253 iCpsInterface = msgInterface; |
251 } |
254 } |
252 |
255 |
253 // ----------------------------------------------------------------------------- |
256 |
254 // CXnTextEditorPublisher::HandleEdwinEventL |
257 // ----------------------------------------------------------------------------- |
255 // ----------------------------------------------------------------------------- |
258 // CXnTextEditorPublisher::OnReformatL |
256 // |
259 // ----------------------------------------------------------------------------- |
257 void CXnTextEditorPublisher::HandleEdwinEventL(CEikEdwin* aEdwin, TEdwinEvent aEventType) |
260 // |
258 { |
261 void CXnTextEditorPublisher::OnReformatL( const CTextView* aTextView ) |
259 if( aEventType == MEikEdwinObserver::EEventTextUpdate) |
262 { |
260 { |
263 CEikEdwin* editor( iAdapter.Editor() ); |
261 TPtr bufferDes = iTextBuffer->Des(); |
264 |
262 bufferDes.Zero(); |
265 if ( editor ) |
263 aEdwin->GetText( bufferDes ); |
266 { |
264 PublishTextL( bufferDes ); |
267 editor->OnReformatL( aTextView ); |
265 } |
268 |
|
269 TPtr ptr( iTempBuffer->Des() ); |
|
270 |
|
271 ptr.Zero(); |
|
272 |
|
273 editor->GetText( ptr ); |
|
274 |
|
275 if ( *iTextBuffer != *iTempBuffer ) |
|
276 { |
|
277 *iTextBuffer = *iTempBuffer; |
|
278 |
|
279 if ( !iAdapter.IsSetText() ) |
|
280 { |
|
281 PublishTextL( *iTextBuffer ); |
|
282 } |
|
283 } |
|
284 } |
266 } |
285 } |
267 |
286 |
268 // ----------------------------------------------------------------------------- |
287 // ----------------------------------------------------------------------------- |
269 // CXnTextEditorPublisher::PublishTextL |
288 // CXnTextEditorPublisher::PublishTextL |
270 // ----------------------------------------------------------------------------- |
289 // ----------------------------------------------------------------------------- |