author | Simon Howkins <simonh@symbian.org> |
Thu, 25 Nov 2010 12:13:04 +0000 | |
branch | RCL_3 |
changeset 83 | 31a5fbf5db1d |
parent 80 | 726fba06891a |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Meeting request description field |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "cesmrviewerdescriptionfield.h" |
|
19 |
||
20 |
#include "esmrfieldbuilderdef.h" |
|
21 |
#include "cesmrrichtextviewer.h" |
|
22 |
#include "cesmrrichtextlink.h" |
|
23 |
#include "mesmrlistobserver.h" |
|
24 |
#include "cesmrlocationplugin.h" |
|
25 |
#include "esmrconfig.hrh" |
|
26 |
#include "cesmrfeaturesettings.h" |
|
27 |
#include "cesmrfieldcommandevent.h" |
|
28 |
#include "nmrlayoutmanager.h" |
|
29 |
||
30 |
//<cmail> |
|
31 |
#include "cesmrurlparserplugin.h" |
|
32 |
//</cmail> |
|
33 |
#include <calentry.h> |
|
34 |
#include <AknUtils.h> |
|
35 |
#include <StringLoader.h> |
|
36 |
#include <esmrgui.rsg> |
|
37 |
#include <avkon.rsg> |
|
38 |
#include <txtrich.h> |
|
39 |
||
40 |
#include "emailtrace.h" |
|
41 |
||
42 |
// Unnamed namespace for local definitions and functions |
|
43 |
namespace { // codescanner::namespace |
|
44 |
||
45 |
const TInt KMargin (5); |
|
46 |
||
47 |
}//namespace |
|
48 |
||
49 |
// ======== MEMBER FUNCTIONS ======== |
|
50 |
||
51 |
// --------------------------------------------------------------------------- |
|
52 |
// CESMRViewerDescriptionField::NewL() |
|
53 |
// --------------------------------------------------------------------------- |
|
54 |
// |
|
55 |
CESMRViewerDescriptionField* CESMRViewerDescriptionField::NewL( ) |
|
56 |
{ |
|
57 |
FUNC_LOG; |
|
58 |
CESMRViewerDescriptionField* self = new (ELeave) CESMRViewerDescriptionField; |
|
59 |
CleanupStack::PushL (self ); |
|
60 |
self->ConstructL ( ); |
|
61 |
CleanupStack::Pop (self ); |
|
62 |
return self; |
|
63 |
} |
|
64 |
||
65 |
// --------------------------------------------------------------------------- |
|
66 |
// CESMRViewerDescriptionField::~CESMRViewerDescriptionField() |
|
67 |
// --------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
CESMRViewerDescriptionField::~CESMRViewerDescriptionField( ) |
|
70 |
{ |
|
71 |
FUNC_LOG; |
|
72 |
delete iLocationPlugin; |
|
73 |
delete iFeatures; |
|
74 |
delete iUrlParser; |
|
75 |
} |
|
76 |
||
77 |
// --------------------------------------------------------------------------- |
|
78 |
// CESMRViewerDescriptionField::InitializeL() |
|
79 |
// --------------------------------------------------------------------------- |
|
80 |
// |
|
81 |
void CESMRViewerDescriptionField::InitializeL() |
|
82 |
{ |
|
83 |
FUNC_LOG; |
|
84 |
TAknLayoutText layoutText = |
|
85 |
NMRLayoutManager::GetLayoutText( Rect(), NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
86 |
iRichTextViewer->SetFontL( layoutText.Font() ); |
|
87 |
iRichTextViewer->ApplyLayoutChangesL(); |
|
88 |
||
89 |
if ( IsFocused() ) |
|
90 |
{ |
|
91 |
iRichTextViewer->FocusChanged( EDrawNow ); |
|
92 |
} |
|
93 |
||
94 |
iRichTextViewer->HandleTextChangedL(); |
|
95 |
iRichTextViewer->SetEventQueue( iEventQueue ); |
|
96 |
} |
|
97 |
||
98 |
// --------------------------------------------------------------------------- |
|
99 |
// CESMRViewerDescriptionField::InternalizeL() |
|
100 |
// --------------------------------------------------------------------------- |
|
101 |
// |
|
102 |
void CESMRViewerDescriptionField::InternalizeL( MESMRCalEntry& aEntry ) |
|
103 |
{ |
|
104 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
105 |
iDisableRedraw = ETrue; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
106 |
|
64 | 107 |
TPtrC text = aEntry.Entry().DescriptionL ( ); |
108 |
if( text.Length() == 0 ) |
|
109 |
{ |
|
110 |
iObserver->HideControl( FieldId() ); |
|
111 |
} |
|
112 |
else if ( FeaturesL().FeatureSupported( |
|
113 |
CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
114 |
{ |
|
115 |
AddShowOnMapLinkL( aEntry ); |
|
116 |
} |
|
117 |
else |
|
118 |
{ |
|
119 |
TPtrC text = aEntry.Entry().DescriptionL(); |
|
120 |
iRichTextViewer->SetTextL( &text, ETrue ); |
|
121 |
iRichTextViewer->SetMargins( KMargin ); |
|
122 |
iRichTextViewer->ApplyLayoutChangesL(); |
|
123 |
} |
|
124 |
} |
|
125 |
||
126 |
// --------------------------------------------------------------------------- |
|
127 |
// CESMRViewerDescriptionField::OfferKeyEventL() |
|
128 |
// --------------------------------------------------------------------------- |
|
129 |
// |
|
130 |
TKeyResponse CESMRViewerDescriptionField::OfferKeyEventL( |
|
131 |
const TKeyEvent& aEvent, TEventCode aType ) |
|
132 |
{ |
|
133 |
FUNC_LOG; |
|
134 |
TKeyResponse response = EKeyWasNotConsumed; |
|
135 |
response = iRichTextViewer->OfferKeyEventL ( aEvent, aType ); |
|
136 |
||
137 |
//track up and down events to change MSK |
|
138 |
if ( aType == EEventKey ) |
|
139 |
{ |
|
140 |
if ( aEvent.iCode == EKeyUpArrow || aEvent.iCode == EKeyDownArrow ) |
|
141 |
{ |
|
142 |
if ( !iRichTextViewer->GetSelectedLink() ) |
|
143 |
{ |
|
144 |
// Restore default middle softkey if field does not contain link |
|
145 |
RestoreMiddleSoftKeyL(); |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
return response; |
|
150 |
} |
|
151 |
||
152 |
// --------------------------------------------------------------------------- |
|
153 |
// CESMRViewerDescriptionField::MinimumSize() |
|
154 |
// --------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
TSize CESMRViewerDescriptionField::MinimumSize() |
|
157 |
{ |
|
158 |
TRect rect( Parent()->Rect() ); |
|
159 |
TRect listRect = |
|
160 |
NMRLayoutManager::GetLayoutRect( rect, NMRLayoutManager::EMRLayoutListArea ).Rect(); |
|
161 |
TRect fieldRect = |
|
162 |
NMRLayoutManager::GetFieldLayoutRect( listRect, 1 ).Rect(); |
|
163 |
TRect rowRect = |
|
164 |
NMRLayoutManager::GetFieldRowLayoutRect( fieldRect, 1 ).Rect(); |
|
165 |
TRect viewerRect = |
|
166 |
NMRLayoutManager::GetLayoutText( rowRect, NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ).TextRect(); |
|
167 |
||
168 |
fieldRect.Resize( 0, iSize.iHeight - viewerRect.Height() ); |
|
169 |
fieldRect.SetWidth( Parent()->Rect().Width() ); |
|
170 |
return fieldRect.Size(); |
|
171 |
} |
|
172 |
||
173 |
// --------------------------------------------------------------------------- |
|
174 |
// CESMRViewerDescriptionField::SizeChanged() |
|
175 |
// --------------------------------------------------------------------------- |
|
176 |
// |
|
177 |
void CESMRViewerDescriptionField::SizeChanged() |
|
178 |
{ |
|
179 |
// Store iRichTextViewer original width. |
|
180 |
TInt richTextViewerWidth = iRichTextViewer->Size().iWidth; |
|
181 |
TRect rect( Rect() ); |
|
182 |
rect = NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ).Rect(); |
|
183 |
||
184 |
TRect viewerRect = |
|
185 |
NMRLayoutManager::GetLayoutText( |
|
186 |
rect, |
|
187 |
NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ).TextRect(); |
|
188 |
||
189 |
TRect bgRect( viewerRect.iTl, |
|
190 |
TSize( viewerRect.Width(), iSize.iHeight ) ); |
|
191 |
// Move focus rect so that it's relative to field's position. |
|
192 |
bgRect.Move( -Position() ); |
|
193 |
||
194 |
// Setting Font for the rich text viewer |
|
195 |
TAknLayoutText text = NMRLayoutManager::GetLayoutText( |
|
196 |
Rect(), |
|
197 |
NMRLayoutManager::EMRTextLayoutTextEditor ); |
|
198 |
||
199 |
// Failures are ignored. |
|
200 |
TRAP_IGNORE( |
|
201 |
// Try setting font |
|
202 |
iRichTextViewer->SetFontL( text.Font() ); |
|
203 |
// Try applying changes |
|
204 |
iRichTextViewer->ApplyLayoutChangesL(); |
|
205 |
); |
|
206 |
||
207 |
iRichTextViewer->SetRect( |
|
208 |
TRect( viewerRect.iTl, |
|
209 |
TSize( viewerRect.Width(), iSize.iHeight ) ) ); |
|
210 |
||
211 |
if ( iRichTextViewer->Size().iWidth != richTextViewerWidth ) |
|
212 |
{ |
|
213 |
// Most of this case is screen orientation, in this case we need to |
|
214 |
// Record the index of focusing link, after updating link array, then |
|
215 |
// reset the focusing to original one. |
|
216 |
TInt focusingIndex = iRichTextViewer->GetFocusLink(); |
|
217 |
if ( KErrNotFound != focusingIndex ) |
|
218 |
{ |
|
219 |
iRichTextViewer->SetFocusLink( focusingIndex ); |
|
220 |
//wake up current contact menu selection by calling this |
|
221 |
iRichTextViewer->FocusChanged(ENoDrawNow); |
|
222 |
} |
|
223 |
} |
|
224 |
} |
|
225 |
||
226 |
// --------------------------------------------------------------------------- |
|
227 |
// CESMRViewerDescriptionField::CountComponentControls() |
|
228 |
// --------------------------------------------------------------------------- |
|
229 |
// |
|
230 |
TInt CESMRViewerDescriptionField::CountComponentControls() const |
|
231 |
{ |
|
232 |
return 1; |
|
233 |
} |
|
234 |
||
235 |
// --------------------------------------------------------------------------- |
|
236 |
// CESMRViewerDescriptionField::ComponentControl() |
|
237 |
// --------------------------------------------------------------------------- |
|
238 |
// |
|
239 |
CCoeControl* CESMRViewerDescriptionField::ComponentControl( TInt aIndex ) const |
|
240 |
{ |
|
241 |
switch ( aIndex ) |
|
242 |
{ |
|
243 |
case 0: |
|
244 |
return iRichTextViewer; |
|
245 |
default: |
|
246 |
return NULL; |
|
247 |
} |
|
248 |
} |
|
249 |
||
250 |
// --------------------------------------------------------------------------- |
|
251 |
// CESMRViewerDescriptionField::HandleEdwinSizeEventL() |
|
252 |
// --------------------------------------------------------------------------- |
|
253 |
// |
|
254 |
TBool CESMRViewerDescriptionField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
|
255 |
TEdwinSizeEvent /*aType*/, TSize aSize ) |
|
256 |
{ |
|
257 |
FUNC_LOG; |
|
258 |
iSize = aSize; |
|
259 |
||
260 |
if ( iObserver && iDisableRedraw ) |
|
261 |
{ |
|
262 |
iObserver->ControlSizeChanged ( this ); |
|
263 |
} |
|
264 |
||
265 |
if ( !iOutlineFocus ) |
|
266 |
{ |
|
267 |
RecordField(); |
|
268 |
} |
|
269 |
||
270 |
return iDisableRedraw; |
|
271 |
} |
|
272 |
||
273 |
// --------------------------------------------------------------------------- |
|
274 |
// CESMRViewerDescriptionField::HandleRichTextLinkSelection |
|
275 |
// --------------------------------------------------------------------------- |
|
276 |
// |
|
277 |
TBool CESMRViewerDescriptionField::HandleRichTextLinkSelection( |
|
278 |
const CESMRRichTextLink* aLink ) |
|
279 |
{ |
|
280 |
TBool result = EFalse; |
|
281 |
if ( aLink && |
|
282 |
aLink->Type() == CESMRRichTextLink::ETypeLocationUrl ) |
|
283 |
{ |
|
284 |
TRAPD( error, ShowLocationOnMapL( *aLink ) ) |
|
285 |
if ( error ) |
|
286 |
{ |
|
287 |
iCoeEnv->HandleError( error ); |
|
288 |
} |
|
289 |
result = ETrue; |
|
290 |
} |
|
291 |
return result; |
|
292 |
} |
|
293 |
||
294 |
// --------------------------------------------------------------------------- |
|
295 |
// CESMRViewerDescriptionField::CESMRViewerDescriptionField() |
|
296 |
// --------------------------------------------------------------------------- |
|
297 |
// |
|
298 |
CESMRViewerDescriptionField::CESMRViewerDescriptionField( ) |
|
299 |
{ |
|
300 |
FUNC_LOG; |
|
301 |
SetFieldId( EESMRFieldDescription ); |
|
302 |
SetFocusType( EESMRHighlightFocus ); |
|
303 |
} |
|
304 |
||
305 |
// --------------------------------------------------------------------------- |
|
306 |
// CESMRViewerDescriptionField::ConstructL() |
|
307 |
// --------------------------------------------------------------------------- |
|
308 |
// |
|
309 |
void CESMRViewerDescriptionField::ConstructL( ) |
|
310 |
{ |
|
311 |
FUNC_LOG; |
|
312 |
iRichTextViewer = CESMRRichTextViewer::NewL( this ); |
|
313 |
iRichTextViewer->SetEdwinSizeObserver( this ); |
|
314 |
CESMRField::ConstructL( iRichTextViewer ); // ownership transferred |
|
315 |
iRichTextViewer->SetParent( this ); |
|
316 |
iRichTextViewer->SetLinkObserver( this ); |
|
317 |
} |
|
318 |
||
319 |
// --------------------------------------------------------------------------- |
|
320 |
// CESMRViewerDescriptionField::GetCursorLineVerticalPos() |
|
321 |
// --------------------------------------------------------------------------- |
|
322 |
// |
|
323 |
void CESMRViewerDescriptionField::GetCursorLineVerticalPos( TInt& aUpper, TInt& aLower ) |
|
324 |
{ |
|
325 |
FUNC_LOG; |
|
326 |
aLower = iRichTextViewer->CurrentLineNumber() * iRichTextViewer->RowHeight(); |
|
327 |
aUpper = aLower - iRichTextViewer->RowHeight(); |
|
328 |
} |
|
329 |
||
330 |
// --------------------------------------------------------------------------- |
|
331 |
// CESMRViewerDescriptionField::ListObserverSet |
|
332 |
// --------------------------------------------------------------------------- |
|
333 |
// |
|
334 |
void CESMRViewerDescriptionField::ListObserverSet() |
|
335 |
{ |
|
336 |
FUNC_LOG; |
|
337 |
iRichTextViewer->SetListObserver( iObserver ); |
|
338 |
} |
|
339 |
||
340 |
// --------------------------------------------------------------------------- |
|
341 |
// CESMRViewerDescriptionField::ExecuteGenericCommandL() |
|
342 |
// --------------------------------------------------------------------------- |
|
343 |
// |
|
344 |
TBool CESMRViewerDescriptionField::ExecuteGenericCommandL( TInt aCommand ) |
|
345 |
{ |
|
346 |
FUNC_LOG; |
|
347 |
TBool isUsed( EFalse ); |
|
348 |
switch ( aCommand ) |
|
349 |
{ |
|
350 |
case EESMRCmdClipboardCopy: |
|
351 |
{ |
|
352 |
iRichTextViewer->CopyCurrentLinkToClipBoardL(); |
|
353 |
isUsed = ETrue; |
|
354 |
break; |
|
355 |
} |
|
356 |
case EAknSoftkeySelect: |
|
357 |
{ |
|
358 |
iRichTextViewer->LinkSelectedL(); |
|
359 |
isUsed = ETrue; |
|
360 |
break; |
|
361 |
} |
|
362 |
default: |
|
363 |
{ |
|
364 |
break; |
|
365 |
} |
|
366 |
} |
|
367 |
return isUsed; |
|
368 |
} |
|
369 |
||
370 |
// --------------------------------------------------------------------------- |
|
371 |
// CESMRDescriptionField::SetOutlineFocusL |
|
372 |
// --------------------------------------------------------------------------- |
|
373 |
// |
|
374 |
void CESMRViewerDescriptionField::SetOutlineFocusL( TBool aFocus ) |
|
375 |
{ |
|
376 |
FUNC_LOG; |
|
377 |
CESMRField::SetOutlineFocusL ( aFocus ); |
|
378 |
||
379 |
iRichTextViewer->SetFocus( aFocus ); |
|
380 |
||
381 |
if ( FeaturesL().FeatureSupported( |
|
382 |
CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
383 |
{ |
|
384 |
if ( aFocus ) |
|
385 |
{ |
|
386 |
SetShowOnMapLinkMiddleSoftKeyL(); |
|
387 |
} |
|
388 |
} |
|
389 |
||
390 |
if ( !aFocus ) |
|
391 |
{ |
|
392 |
//need to tell action menu that focus has changed |
|
393 |
iRichTextViewer->ResetActionMenuL(); |
|
394 |
} |
|
395 |
} |
|
396 |
||
397 |
// --------------------------------------------------------------------------- |
|
398 |
// CESMRDescriptionField::HandleLongtapEventL |
|
399 |
// --------------------------------------------------------------------------- |
|
400 |
// |
|
401 |
void CESMRViewerDescriptionField::HandleLongtapEventL( |
|
402 |
const TPoint& aPosition ) |
|
403 |
{ |
|
404 |
FUNC_LOG; |
|
405 |
||
406 |
if ( iRichTextViewer->Rect().Contains( aPosition ) ) |
|
407 |
{ |
|
408 |
if( iRichTextViewer->LinkSelectedL() ) |
|
409 |
{ |
|
410 |
HandleTactileFeedbackL(); |
|
411 |
} |
|
412 |
||
413 |
} |
|
414 |
} |
|
415 |
||
416 |
// --------------------------------------------------------------------------- |
|
417 |
// CESMRViewerDescriptionField::AddShowOnMapLinkL |
|
418 |
// --------------------------------------------------------------------------- |
|
419 |
// |
|
420 |
void CESMRViewerDescriptionField::AddShowOnMapLinkL( MESMRCalEntry& aEntry ) |
|
421 |
{ |
|
422 |
FUNC_LOG; |
|
423 |
||
424 |
TPtrC urlPointer; |
|
425 |
TInt position; |
|
426 |
position = UrlParserL().FindLocationUrl( aEntry.Entry().DescriptionL(), |
|
427 |
urlPointer ); |
|
428 |
||
429 |
// Location url is found and need to be replaced with show on map link |
|
430 |
if ( position >= KErrNone ) |
|
431 |
{ |
|
432 |
HBufC* showOnMapBuf = |
|
433 |
StringLoader::LoadLC( R_MEET_REQ_LINK_SHOW_ON_MAP, |
|
434 |
iCoeEnv ); |
|
435 |
HBufC* description = |
|
436 |
HBufC::NewL( aEntry.Entry().DescriptionL().Length() + 1); |
|
437 |
CleanupStack::PushL( description ); |
|
438 |
TPtr descriptionPointer( description->Des() ); |
|
439 |
descriptionPointer.Append( aEntry.Entry().DescriptionL() ); |
|
440 |
descriptionPointer.Replace( position, |
|
441 |
urlPointer.Length(), |
|
442 |
*showOnMapBuf ); |
|
443 |
CESMRRichTextLink* showOnMapLink = CESMRRichTextLink::NewL( position, |
|
444 |
showOnMapBuf->Length(), |
|
445 |
urlPointer, |
|
446 |
CESMRRichTextLink::ETypeLocationUrl, |
|
447 |
CESMRRichTextLink::ETriggerKeyOk ); |
|
448 |
CleanupStack::PushL( showOnMapLink ); |
|
449 |
iRichTextViewer->SetTextL( description, ETrue ); |
|
450 |
iRichTextViewer->InsertLinkL( showOnMapLink, 0 ); |
|
451 |
CleanupStack::Pop( showOnMapLink ); |
|
452 |
iRichTextViewer->HandleTextChangedL(); |
|
453 |
CleanupStack::PopAndDestroy( description ); |
|
454 |
CleanupStack::PopAndDestroy( showOnMapBuf ); |
|
455 |
||
456 |
StoreGeoValueL( |
|
457 |
aEntry.Entry(), |
|
458 |
urlPointer ); |
|
459 |
} |
|
460 |
// No location url found. Other description text is added to field. |
|
461 |
else |
|
462 |
{ |
|
463 |
TPtrC text = aEntry.Entry().DescriptionL(); |
|
464 |
iRichTextViewer->SetTextL( &text, ETrue ); |
|
465 |
} |
|
466 |
||
467 |
iRichTextViewer->SetMargins( KMargin ); |
|
468 |
} |
|
469 |
||
470 |
// --------------------------------------------------------------------------- |
|
471 |
// CESMRViewerDescriptionField::SetShowOnMapLinkMiddleSoftKeyL |
|
472 |
// --------------------------------------------------------------------------- |
|
473 |
// |
|
474 |
void CESMRViewerDescriptionField::SetShowOnMapLinkMiddleSoftKeyL() |
|
475 |
{ |
|
476 |
FUNC_LOG; |
|
477 |
const CESMRRichTextLink* link = iRichTextViewer->GetSelectedLink(); |
|
478 |
if( link ) |
|
479 |
{ |
|
480 |
if ( link->Type() == CESMRRichTextLink::ETypeLocationUrl ) |
|
481 |
{ |
|
482 |
ChangeMiddleSoftKeyL(EESMRCmdShowOnMap, R_QTN_MSK_OPEN ); |
|
483 |
} |
|
484 |
else |
|
485 |
{ |
|
486 |
RestoreMiddleSoftKeyL(); |
|
487 |
} |
|
488 |
||
489 |
SetMiddleSoftKeyVisible( ETrue ); |
|
490 |
} |
|
491 |
else |
|
492 |
{ |
|
493 |
RestoreMiddleSoftKeyL(); |
|
494 |
} |
|
495 |
} |
|
496 |
||
497 |
// --------------------------------------------------------------------------- |
|
498 |
// CESMRViewerDescriptionField::FeaturesL |
|
499 |
// --------------------------------------------------------------------------- |
|
500 |
// |
|
501 |
CESMRFeatureSettings& CESMRViewerDescriptionField::FeaturesL() |
|
502 |
{ |
|
503 |
FUNC_LOG; |
|
504 |
if ( !iFeatures ) |
|
505 |
{ |
|
506 |
iFeatures = CESMRFeatureSettings::NewL(); |
|
507 |
} |
|
508 |
||
509 |
return *iFeatures; |
|
510 |
} |
|
511 |
||
512 |
// --------------------------------------------------------------------------- |
|
513 |
// CESMRViewerDescriptionField::LocationPluginL |
|
514 |
// --------------------------------------------------------------------------- |
|
515 |
// |
|
516 |
CESMRLocationPlugin& CESMRViewerDescriptionField::LocationPluginL() |
|
517 |
{ |
|
518 |
FUNC_LOG; |
|
519 |
if ( !iLocationPlugin ) |
|
520 |
{ |
|
521 |
iLocationPlugin = CESMRLocationPlugin::NewL(); |
|
522 |
} |
|
523 |
||
524 |
return *iLocationPlugin; |
|
525 |
} |
|
526 |
||
527 |
// --------------------------------------------------------------------------- |
|
528 |
// CESMRViewerDescriptionField::ShowLocationOnMapL |
|
529 |
// --------------------------------------------------------------------------- |
|
530 |
// |
|
531 |
void CESMRViewerDescriptionField::ShowLocationOnMapL( |
|
532 |
const CESMRRichTextLink& aLink ) |
|
533 |
{ |
|
534 |
FUNC_LOG; |
|
535 |
||
536 |
if ( FeaturesL().FeatureSupported( |
|
537 |
CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
538 |
{ |
|
539 |
LocationPluginL().ShowOnMapL( aLink.Value() ); |
|
540 |
} |
|
541 |
} |
|
542 |
||
543 |
// --------------------------------------------------------------------------- |
|
544 |
// CESMRViewerDescriptionField::StoreGeoValueL |
|
545 |
// --------------------------------------------------------------------------- |
|
546 |
// |
|
547 |
void CESMRViewerDescriptionField::StoreGeoValueL( |
|
548 |
CCalEntry& aCalEntry, |
|
549 |
const TDesC& aLocationUrl ) |
|
550 |
{ |
|
551 |
FUNC_LOG; |
|
552 |
||
553 |
TReal lat, lon; |
|
554 |
CCalGeoValue* geoVal = aCalEntry.GeoValueL(); |
|
555 |
||
556 |
if ( !geoVal || ! geoVal->GetLatLong( lat, lon ) ) |
|
557 |
{ |
|
558 |
// GEO value not set. Convert URL |
|
559 |
geoVal = UrlParserL().CreateGeoValueLC( aLocationUrl ); |
|
560 |
aCalEntry.SetGeoValueL( *geoVal ); |
|
561 |
CleanupStack::Pop( geoVal ); |
|
562 |
||
563 |
NotifyEventL( EESMRCmdEnableWaypointIcon ); |
|
564 |
} |
|
565 |
} |
|
566 |
||
567 |
// --------------------------------------------------------------------------- |
|
568 |
// CESMRViewerDescriptionField::UrlParserL |
|
569 |
// --------------------------------------------------------------------------- |
|
570 |
// |
|
571 |
CESMRUrlParserPlugin& CESMRViewerDescriptionField::UrlParserL() |
|
572 |
{ |
|
573 |
FUNC_LOG; |
|
574 |
||
575 |
if ( !iUrlParser ) |
|
576 |
{ |
|
577 |
iUrlParser = CESMRUrlParserPlugin::NewL(); |
|
578 |
} |
|
579 |
||
580 |
return *iUrlParser; |
|
581 |
} |
|
582 |
||
583 |
// --------------------------------------------------------------------------- |
|
584 |
// CESMRViewerDescriptionField::SupportsLongTapFunctionalityL |
|
585 |
// --------------------------------------------------------------------------- |
|
586 |
// |
|
587 |
TBool CESMRViewerDescriptionField::SupportsLongTapFunctionalityL( |
|
588 |
const TPointerEvent &aPointerEvent ) |
|
589 |
{ |
|
590 |
FUNC_LOG; |
|
591 |
TBool ret( EFalse ); |
|
592 |
||
593 |
if ( iRichTextViewer->Rect().Contains( aPointerEvent.iPosition ) ) |
|
594 |
{ |
|
595 |
if( iRichTextViewer->PointerEventOccuresOnALinkL( aPointerEvent ) ) |
|
596 |
{ |
|
597 |
ret = ETrue; |
|
598 |
} |
|
599 |
} |
|
600 |
||
601 |
return ret; |
|
602 |
} |
|
603 |
||
604 |
//EOF |
|
605 |