161 ChangeMiddleSoftKeyL(EESMRCmdSaveMR,R_QTN_MSK_SAVE); |
173 ChangeMiddleSoftKeyL(EESMRCmdSaveMR,R_QTN_MSK_SAVE); |
162 } |
174 } |
163 } |
175 } |
164 |
176 |
165 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
166 // CESMRDescriptionField::ExpandedHeight |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 TInt CESMRDescriptionField::ExpandedHeight( ) const |
|
170 { |
|
171 FUNC_LOG; |
|
172 return iSize.iHeight; |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CESMRDescriptionField::OfferKeyEventL |
178 // CESMRDescriptionField::OfferKeyEventL |
177 // --------------------------------------------------------------------------- |
179 // --------------------------------------------------------------------------- |
178 // |
180 // |
179 TKeyResponse CESMRDescriptionField::OfferKeyEventL(const TKeyEvent& aEvent, |
181 TKeyResponse CESMRDescriptionField::OfferKeyEventL(const TKeyEvent& aEvent, |
180 TEventCode aType ) |
182 TEventCode aType ) |
181 { |
183 { |
182 FUNC_LOG; |
184 FUNC_LOG; |
183 return iDescription->OfferKeyEventL( aEvent, aType ); |
185 TKeyResponse response( EKeyWasNotConsumed); |
|
186 response = iDescription->OfferKeyEventL( aEvent, aType ); |
|
187 |
|
188 if ( aType == EEventKey && |
|
189 ( aEvent.iScanCode != EStdKeyUpArrow && |
|
190 aEvent.iScanCode != EStdKeyDownArrow )) |
|
191 { |
|
192 iDescription->DrawDeferred(); |
|
193 } |
|
194 |
|
195 return response; |
184 } |
196 } |
185 |
197 |
186 // --------------------------------------------------------------------------- |
198 // --------------------------------------------------------------------------- |
187 // CESMRDescriptionField::HandleEdwinSizeEventL |
199 // CESMRDescriptionField::HandleEdwinSizeEventL |
188 // --------------------------------------------------------------------------- |
200 // --------------------------------------------------------------------------- |
189 // |
201 // |
190 TBool CESMRDescriptionField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
202 TBool CESMRDescriptionField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
191 TEdwinSizeEvent /*aType*/, TSize aSize ) |
203 TEdwinSizeEvent /*aType*/, TSize aSize ) |
192 { |
204 { |
193 FUNC_LOG; |
205 FUNC_LOG; |
194 iSize = aSize; |
206 if ( aSize != iSize ) |
195 iSize.iHeight -= KEditorDifference; |
207 { |
196 |
208 iSize = aSize; |
197 if (iLayout->CurrentFontZoom() == EAknUiZoomSmall || |
209 |
198 iLayout->CurrentFontZoom() == EAknUiZoomVerySmall) |
210 if ( iObserver ) |
199 { |
211 { |
200 iSize.iHeight -= KEditorDifference; |
212 iObserver->ControlSizeChanged ( this ); |
201 } |
213 } |
202 |
214 |
203 if ( iObserver ) |
215 if( iDescription->LineCount() != iLineCount ) |
204 { |
216 { |
205 iObserver->ControlSizeChanged ( this ); |
217 // Line count has changed, the whole component needs |
206 } |
218 // to be redrawn |
207 |
219 DrawDeferred(); |
208 if( iFrameBgContext ) |
220 |
209 { |
221 // Also if new line count is less than previous one, we |
210 TRect visibleRect = CalculateVisibleRect( iDescription->Rect() ); |
222 // need to redraw the parent also (this is the last field). |
211 iFrameBgContext->SetFrameRects( visibleRect, visibleRect ); |
223 // Otherwise the removed line will remain on the screen |
|
224 // until parent is redrawn. |
|
225 if( iDescription->LineCount() < iLineCount ) |
|
226 { |
|
227 Parent()->DrawDeferred(); |
|
228 } |
|
229 iLineCount = iDescription->LineCount(); |
|
230 } |
212 } |
231 } |
213 |
232 |
214 return ETrue; |
233 return ETrue; |
215 } |
234 } |
216 |
235 |
217 // --------------------------------------------------------------------------- |
236 // --------------------------------------------------------------------------- |
218 // CESMRDescriptionField::HandleEdwinEventL |
237 // CESMRDescriptionField::HandleEdwinEventL |
219 // --------------------------------------------------------------------------- |
238 // --------------------------------------------------------------------------- |
220 // |
239 // |
221 void CESMRDescriptionField::HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType) |
240 void CESMRDescriptionField::HandleEdwinEventL( |
222 { |
241 CEikEdwin* aEdwin,TEdwinEvent aEventType) |
|
242 { |
223 FUNC_LOG; |
243 FUNC_LOG; |
224 if ( aEdwin == iDescription |
244 if ( aEdwin == iDescription |
225 && aEventType == EEventTextUpdate ) |
245 && aEventType == EEventTextUpdate ) |
226 { |
246 { |
227 HBufC* text = iDescription->GetTextInHBufL(); |
247 HBufC* text = iDescription->GetTextInHBufL(); |
228 if ( text ) |
248 if ( text ) |
229 { |
249 { |
230 CleanupStack::PushL( text ); |
250 CleanupStack::PushL( text ); |
231 TInt textLength( text->Length() ); |
251 TInt textLength( text->Length() ); |
232 if ( iDescription->GetLimitLength() <= textLength ) |
252 if ( iDescription->GetLimitLength() <= textLength ) |
233 { |
253 { |
234 NotifyEventAsyncL( EESMRCmdSizeExceeded ); |
254 NotifyEventAsyncL( EESMRCmdSizeExceeded ); |
235 } |
255 } |
236 CleanupStack::PopAndDestroy( text ); |
256 CleanupStack::PopAndDestroy( text ); |
237 } |
257 } |
238 } |
258 } |
239 } |
259 } |
240 |
260 |
241 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
242 // CESMRDescriptionField::CESMRDescriptionField |
262 // CESMRDescriptionField::CESMRDescriptionField |
243 // --------------------------------------------------------------------------- |
263 // --------------------------------------------------------------------------- |
244 // |
264 // |
245 CESMRDescriptionField::CESMRDescriptionField() : |
265 CESMRDescriptionField::CESMRDescriptionField() |
246 iSize( TSize( 0, 0 )) |
266 { |
247 { |
267 FUNC_LOG; |
248 FUNC_LOG; |
268 SetFieldId( EESMRFieldDescription ); |
249 } |
269 SetFocusType( EESMRHighlightFocus ); |
250 |
|
251 // --------------------------------------------------------------------------- |
|
252 // CESMRDescriptionField::ActivateL |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 void CESMRDescriptionField::ActivateL() |
|
256 { |
|
257 FUNC_LOG; |
|
258 CCoeControl::ActivateL(); |
|
259 TRect rect(TPoint(iDescription->Position()), iDescription->Size()); |
|
260 TRect inner(rect); |
|
261 inner.Shrink( KFieldInnerShrink, KFieldInnerShrink ); |
|
262 TRect outer(rect); |
|
263 |
|
264 delete iFrameBgContext; |
|
265 iFrameBgContext = NULL; |
|
266 iFrameBgContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrInput, |
|
267 outer, |
|
268 inner, |
|
269 EFalse ); |
|
270 |
|
271 iFrameBgContext->SetParentContext( iBackground ); |
|
272 iDescription->SetSkinBackgroundControlContextL( iFrameBgContext ); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // CESMRDescriptionField::PositionChanged() |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 void CESMRDescriptionField::PositionChanged() |
|
280 { |
|
281 FUNC_LOG; |
|
282 CCoeControl::PositionChanged(); |
|
283 if( iFrameBgContext ) |
|
284 { |
|
285 TRect visibleRect = CalculateVisibleRect( iDescription->Rect() ); |
|
286 iFrameBgContext->SetFrameRects( visibleRect, visibleRect ); |
|
287 } |
|
288 } |
270 } |
289 |
271 |
290 // --------------------------------------------------------------------------- |
272 // --------------------------------------------------------------------------- |
291 // CESMRDescriptionField::ConstructL |
273 // CESMRDescriptionField::ConstructL |
292 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
293 // |
275 // |
294 void CESMRDescriptionField::ConstructL() |
276 void CESMRDescriptionField::ConstructL() |
295 { |
277 { |
296 FUNC_LOG; |
278 FUNC_LOG; |
297 SetFieldId( EESMRFieldDescription ); |
|
298 SetExpandable( ); |
|
299 iDescription = CESMREditor::NewL( this, 1, KTextLimit, |
279 iDescription = CESMREditor::NewL( this, 1, KTextLimit, |
300 CEikEdwin::EResizable | |
280 CEikEdwin::EResizable | |
301 CEikEdwin::EAvkonEditor ); |
281 CEikEdwin::EAvkonEditor ); |
302 iDescription->SetEdwinSizeObserver( this ); |
282 iDescription->SetEdwinSizeObserver( this ); |
303 iDescription->SetEdwinObserver( this ); |
283 iDescription->SetEdwinObserver( this ); |
|
284 CESMRField::ConstructL( iDescription ); |
304 |
285 |
305 HBufC* buf = StringLoader::LoadLC( R_QTN_MEET_REQ_DETAILS_FIELD ); |
286 HBufC* buf = StringLoader::LoadLC( R_QTN_MEET_REQ_DETAILS_FIELD ); |
306 iDescription->SetDefaultTextL( buf ); // ownership transferred |
287 iDescription->SetDefaultTextL( buf ); // ownership transferred |
307 CleanupStack::Pop( buf ); |
288 CleanupStack::Pop( buf ); |
308 |
289 |
309 iBackground = AknsDrawUtils::ControlContext( this ); |
290 // Setting background instead of theme skin |
310 |
291 NMRBitmapManager::TMRBitmapStruct bitmapStruct; |
311 CESMRField::ConstructL( iDescription ); |
292 bitmapStruct = NMRBitmapManager::GetBitmapStruct( NMRBitmapManager::EMRBitmapInputCenter ); |
312 } |
293 |
313 |
294 TRect initialisationRect( 0, 0, 0, 0 ); |
314 // --------------------------------------------------------------------------- |
295 iBgControlContext = CAknsBasicBackgroundControlContext::NewL( |
315 // CESMRDescriptionField::GetMinimumVisibleVerticalArea |
296 bitmapStruct.iItemId, |
316 // --------------------------------------------------------------------------- |
297 initialisationRect, |
317 // |
298 EFalse ); |
318 void CESMRDescriptionField::GetMinimumVisibleVerticalArea(TInt& aUpper, TInt& aLower) |
299 |
319 { |
300 iDescription->SetSkinBackgroundControlContextL( iBgControlContext ); |
320 FUNC_LOG; |
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // CESMRDescriptionField::ListObserverSet |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 void CESMRDescriptionField::ListObserverSet() |
|
308 { |
|
309 FUNC_LOG; |
|
310 iDescription->SetListObserver( iObserver ); |
|
311 } |
|
312 |
|
313 // --------------------------------------------------------------------------- |
|
314 // CESMRDescriptionField::GetCursorLineVerticalPos |
|
315 // --------------------------------------------------------------------------- |
|
316 // |
|
317 void CESMRDescriptionField::GetCursorLineVerticalPos(TInt& aUpper, TInt& aLower) |
|
318 { |
321 aLower = iDescription->CurrentLineNumber() * iDescription->RowHeight(); |
319 aLower = iDescription->CurrentLineNumber() * iDescription->RowHeight(); |
322 aUpper = aLower - iDescription->RowHeight(); |
320 aUpper = aLower - iDescription->RowHeight(); |
323 } |
321 } |
324 |
322 |
325 // --------------------------------------------------------------------------- |
323 // --------------------------------------------------------------------------- |
326 // CESMRDescriptionField::ListObserverSet |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 void CESMRDescriptionField::ListObserverSet() |
|
330 { |
|
331 FUNC_LOG; |
|
332 iDescription->SetListObserver( iObserver ); |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CESMRDescriptionField::StoreLinkL |
324 // CESMRDescriptionField::StoreLinkL |
337 // --------------------------------------------------------------------------- |
325 // --------------------------------------------------------------------------- |
338 // |
326 // |
339 void CESMRDescriptionField::StoreLinkL( MESMRCalEntry& aEntry ) |
327 void CESMRDescriptionField::StoreLinkL( MESMRCalEntry& aEntry ) |
340 { |
328 { |
341 FUNC_LOG; |
329 FUNC_LOG; |
342 TInt command( EESMRCmdDisableWaypointIcon ); |
|
343 CESMRUrlParserPlugin* urlParser = CESMRUrlParserPlugin::NewL(); |
|
344 CleanupStack::PushL( urlParser ); |
|
345 TPtrC urlPointer; |
330 TPtrC urlPointer; |
346 TInt position; |
331 TInt position; |
347 position = urlParser->FindLocationUrl( aEntry.Entry().DescriptionL(), |
332 position = UrlParserL().FindLocationUrl( aEntry.Entry().DescriptionL(), |
348 urlPointer ); |
333 urlPointer ); |
349 CleanupStack::PopAndDestroy( urlParser ); |
334 |
350 if ( position >= KErrNone ) |
335 if ( position >= KErrNone ) |
351 { |
336 { |
352 command = EESMRCmdEnableWaypointIcon; |
|
353 HBufC* description = |
337 HBufC* description = |
354 HBufC::NewL( aEntry.Entry().DescriptionL().Length() ); |
338 HBufC::NewL( aEntry.Entry().DescriptionL().Length() ); |
355 CleanupStack::PushL( description ); |
339 CleanupStack::PushL( description ); |
356 TPtr descriptionPointer( description->Des() ); |
340 TPtr descriptionPointer( description->Des() ); |
357 descriptionPointer.Append( aEntry.Entry().DescriptionL() ); |
341 descriptionPointer.Append( aEntry.Entry().DescriptionL() ); |
420 FUNC_LOG; |
406 FUNC_LOG; |
421 if ( !iFeatures ) |
407 if ( !iFeatures ) |
422 { |
408 { |
423 iFeatures = CESMRFeatureSettings::NewL(); |
409 iFeatures = CESMRFeatureSettings::NewL(); |
424 } |
410 } |
|
411 |
|
412 return *iFeatures; |
|
413 } |
|
414 |
|
415 // --------------------------------------------------------------------------- |
|
416 // CESMRDescriptionField::ExecuteGenericCommandL |
|
417 // --------------------------------------------------------------------------- |
|
418 // |
|
419 TBool CESMRDescriptionField::ExecuteGenericCommandL( |
|
420 TInt aCommand ) |
|
421 { |
|
422 FUNC_LOG; |
|
423 TBool isUsed( EFalse ); |
|
424 if ( EESMRCmdSizeExceeded == aCommand ) |
|
425 { |
|
426 CESMRGlobalNote::ExecuteL( |
|
427 CESMRGlobalNote::EESMRCannotDisplayMuchMore ); |
|
428 |
|
429 HBufC* text = iDescription->GetTextInHBufL(); |
|
430 CleanupDeletePushL( text ); |
|
431 if ( text ) |
|
432 { |
|
433 TInt curPos = iDescription->CursorPos(); |
|
434 if( curPos > iDescription->GetLimitLength() - 1 ) |
|
435 curPos = iDescription->GetLimitLength() - 1; |
|
436 HBufC* newText = |
|
437 text->Des().Mid( 0, |
|
438 iDescription->GetLimitLength() - 1 ).AllocLC(); |
|
439 |
|
440 iDescription->SetTextL ( newText ); |
|
441 CleanupStack::PopAndDestroy( newText ); |
|
442 newText = NULL; |
|
443 |
|
444 iDescription->SetCursorPosL (curPos, EFalse ); |
|
445 iDescription->HandleTextChangedL(); |
|
446 iDescription->UpdateScrollBarsL(); |
|
447 SetFocus(ETrue); |
|
448 } |
|
449 CleanupStack::PopAndDestroy( text ); |
|
450 isUsed = ETrue; |
|
451 } |
|
452 else if ( EESMRCmdDisableWaypointIcon == aCommand ) |
|
453 { |
|
454 isUsed = ETrue; |
|
455 |
|
456 // Clear location link |
|
457 delete iLocationLink; |
|
458 iLocationLink = NULL; |
|
459 } |
425 |
460 |
426 return *iFeatures; |
461 return isUsed; |
427 } |
462 } |
428 |
463 |
429 // --------------------------------------------------------------------------- |
464 // --------------------------------------------------------------------------- |
430 // CESMRDescriptionField::ExecuteGenericCommandL |
465 // CESMRDescriptionField::CountComponentControls |
431 // --------------------------------------------------------------------------- |
466 // --------------------------------------------------------------------------- |
432 // |
467 // |
433 void CESMRDescriptionField::ExecuteGenericCommandL( |
468 TInt CESMRDescriptionField::CountComponentControls() const |
434 TInt aCommand ) |
469 { |
435 { |
470 return KComponentCount; |
436 FUNC_LOG; |
471 } |
437 if ( EESMRCmdSizeExceeded == aCommand ) |
472 |
438 { |
473 // --------------------------------------------------------------------------- |
439 CESMRGlobalNote::ExecuteL ( |
474 // CESMRDescriptionField::ComponentControl |
440 CESMRGlobalNote::EESMRCannotDisplayMuchMore ); |
475 // --------------------------------------------------------------------------- |
441 |
476 // |
442 HBufC* text = iDescription->GetTextInHBufL(); |
477 CCoeControl* CESMRDescriptionField::ComponentControl( TInt aInd ) const |
443 CleanupDeletePushL( text ); |
478 { |
444 if ( text ) |
479 if( aInd == 0 ) |
445 { |
480 { |
446 TInt curPos = iDescription->CursorPos(); |
481 return iDescription; |
447 if( curPos > iDescription->GetLimitLength() - 1 ) |
482 } |
448 curPos = iDescription->GetLimitLength() - 1; |
483 return NULL; |
449 HBufC* newText = |
484 } |
450 text->Des().Mid( 0, iDescription->GetLimitLength() - 1 ).AllocLC(); |
485 |
451 |
486 // --------------------------------------------------------------------------- |
452 iDescription->SetTextL ( newText ); |
487 // CESMRDescriptionField::SizeChanged |
453 CleanupStack::PopAndDestroy( newText ); |
488 // --------------------------------------------------------------------------- |
454 newText = NULL; |
489 // |
455 |
490 void CESMRDescriptionField::SizeChanged() |
456 iDescription->SetCursorPosL (curPos, EFalse ); |
491 { |
457 iDescription->HandleTextChangedL(); |
492 TRect rect( Rect() ); |
458 iDescription->UpdateScrollBarsL(); |
493 |
459 SetFocus(ETrue); |
494 // Optimization: Layouting only when necessary |
460 } |
495 if( iFieldRect != rect ) |
461 CleanupStack::PopAndDestroy( text ); |
496 { |
462 } |
497 rect = NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ).Rect(); |
463 } |
498 |
464 |
499 TAknLayoutText editorLayoutText = NMRLayoutManager::GetLayoutText( |
|
500 rect, |
|
501 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
502 |
|
503 TRect editorRect = editorLayoutText.TextRect(); |
|
504 |
|
505 TRect bgRect( editorRect ); |
|
506 // Move focus rect so that it's relative to field's position. |
|
507 bgRect.Move( -Position() ); |
|
508 if( iSize.iHeight > 0 ) |
|
509 { |
|
510 bgRect.SetHeight( iSize.iHeight ); |
|
511 } |
|
512 SetFocusRect( bgRect ); |
|
513 |
|
514 iDescription->SetRect( |
|
515 TRect( editorRect.iTl, |
|
516 TSize( editorRect.Width(), iSize.iHeight ) ) ); |
|
517 |
|
518 // Set also correct font for description field |
|
519 TRAP_IGNORE( iDescription->SetFontL( editorLayoutText.Font() ) ); |
|
520 |
|
521 iFieldRect = rect; |
|
522 } |
|
523 } |
|
524 |
|
525 // --------------------------------------------------------------------------- |
|
526 // CESMRDescriptionField::MinimumSize |
|
527 // --------------------------------------------------------------------------- |
|
528 // |
|
529 TSize CESMRDescriptionField::MinimumSize() |
|
530 { |
|
531 TRect rect( Parent()->Rect() ); |
|
532 TRect listRect = |
|
533 NMRLayoutManager::GetLayoutRect( |
|
534 rect, |
|
535 NMRLayoutManager::EMRLayoutListArea ).Rect(); |
|
536 TRect fieldRect = |
|
537 NMRLayoutManager::GetFieldLayoutRect( listRect, 1 ).Rect(); |
|
538 TRect rowRect = |
|
539 NMRLayoutManager::GetFieldRowLayoutRect( fieldRect, 1 ).Rect(); |
|
540 TRect viewerRect = |
|
541 NMRLayoutManager::GetLayoutText( |
|
542 rowRect, |
|
543 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ).TextRect(); |
|
544 |
|
545 fieldRect.Resize( 0, iSize.iHeight - viewerRect.Height() ); |
|
546 |
|
547 return fieldRect.Size(); |
|
548 } |
|
549 |
|
550 // --------------------------------------------------------------------------- |
|
551 // CESMRRepeatUntilField::SetContainerWindowL |
|
552 // --------------------------------------------------------------------------- |
|
553 // |
|
554 void CESMRDescriptionField::SetContainerWindowL( |
|
555 const CCoeControl& aContainer ) |
|
556 { |
|
557 CCoeControl::SetContainerWindowL( aContainer ); |
|
558 iDescription->SetContainerWindowL( aContainer ); |
|
559 |
|
560 iDescription->SetParent( this ); |
|
561 } |
|
562 |
|
563 // --------------------------------------------------------------------------- |
|
564 // CESMRDescriptionField::StoreGeoValueL |
|
565 // --------------------------------------------------------------------------- |
|
566 // |
|
567 void CESMRDescriptionField::StoreGeoValueL( |
|
568 CCalEntry& aCalEntry, |
|
569 const TDesC& aLocationUrl ) |
|
570 { |
|
571 TReal lat, lon; |
|
572 CCalGeoValue* geoVal = aCalEntry.GeoValueL(); |
|
573 |
|
574 if ( !geoVal || ! geoVal->GetLatLong( lat, lon ) ) |
|
575 { |
|
576 // GEO value not set. Convert URL |
|
577 geoVal = UrlParserL().CreateGeoValueLC( aLocationUrl ); |
|
578 aCalEntry.SetGeoValueL( *geoVal ); |
|
579 CleanupStack::Pop( geoVal ); |
|
580 |
|
581 NotifyEventL( EESMRCmdEnableWaypointIcon ); |
|
582 } |
|
583 } |
|
584 |
|
585 // --------------------------------------------------------------------------- |
|
586 // CESMRDescriptionField::UrlParserL |
|
587 // --------------------------------------------------------------------------- |
|
588 // |
|
589 CESMRUrlParserPlugin& CESMRDescriptionField::UrlParserL() |
|
590 { |
|
591 if ( !iUrlParser ) |
|
592 { |
|
593 iUrlParser = CESMRUrlParserPlugin::NewL(); |
|
594 } |
|
595 |
|
596 return *iUrlParser; |
|
597 } |
465 |
598 |
466 // EOF |
599 // EOF |