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: ESMR Description (summary) field implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cesmrdescriptionfield.h"
|
|
19 |
#include "mesmrlistobserver.h"
|
|
20 |
#include "cesmreditor.h"
|
|
21 |
#include "cesmrrichtextlink.h"
|
|
22 |
#include "esmrfieldbuilderdef.h"
|
|
23 |
#include "cesmrfeaturesettings.h"
|
|
24 |
#include "cesmrglobalnote.h"
|
|
25 |
#include "nmrlayoutmanager.h"
|
|
26 |
#include "nmrbitmapmanager.h"
|
|
27 |
//<cmail>
|
|
28 |
#include "cesmrurlparserplugin.h"
|
|
29 |
//</cmail>
|
|
30 |
|
|
31 |
#include <calentry.h>
|
|
32 |
#include <StringLoader.h>
|
|
33 |
#include <esmrgui.rsg>
|
|
34 |
#include <AknUtils.h>
|
|
35 |
#include <AknsBasicBackgroundControlContext.h>
|
|
36 |
#include <eikmfne.h>
|
|
37 |
|
|
38 |
// DEBUG
|
|
39 |
#include "emailtrace.h"
|
|
40 |
|
|
41 |
namespace // codescanner::namespace
|
|
42 |
{
|
|
43 |
/// Field's component count, iDescription
|
|
44 |
const TInt KComponentCount( 1 );
|
|
45 |
}//namespace
|
|
46 |
|
|
47 |
// ======== MEMBER FUNCTIONS ========
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
// CESMRDescriptionField::NewL
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
CESMRDescriptionField* CESMRDescriptionField::NewL( )
|
|
54 |
{
|
|
55 |
FUNC_LOG;
|
|
56 |
CESMRDescriptionField* self = new (ELeave) CESMRDescriptionField;
|
|
57 |
CleanupStack::PushL( self );
|
|
58 |
self->ConstructL();
|
|
59 |
CleanupStack::Pop( self );
|
|
60 |
return self;
|
|
61 |
}
|
|
62 |
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
// CESMRDescriptionField::~CESMRDescriptionField
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
CESMRDescriptionField::~CESMRDescriptionField( )
|
|
68 |
{
|
|
69 |
FUNC_LOG;
|
|
70 |
delete iLocationLink;
|
|
71 |
delete iFeatures;
|
|
72 |
delete iBgControlContext;
|
|
73 |
delete iUrlParser;
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CESMRDescriptionField::InitializeL
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
void CESMRDescriptionField::InitializeL()
|
|
81 |
{
|
|
82 |
FUNC_LOG;
|
|
83 |
// Do nothing
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// CESMRDescriptionField::InternalizeL
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void CESMRDescriptionField::InternalizeL( MESMRCalEntry& aEntry )
|
|
91 |
{
|
|
92 |
FUNC_LOG;
|
|
93 |
CCalEntry& entry = aEntry.Entry ( );
|
|
94 |
HBufC* summary = entry.DescriptionL().AllocLC ( );
|
|
95 |
|
|
96 |
// externalize is done only when there is text and its NOT the default one.
|
|
97 |
if ( summary->Length ( )> 0 &&
|
|
98 |
iDescription->DefaultText().Compare (*summary )!= 0 )
|
|
99 |
{
|
|
100 |
iDescription->ClearSelectionAndSetTextL ( *summary );
|
|
101 |
if ( FeaturesL().FeatureSupported(
|
|
102 |
CESMRFeatureSettings::EESMRUIMnFwIntegration ) )
|
|
103 |
{
|
|
104 |
StoreLinkL( aEntry );
|
|
105 |
}
|
|
106 |
}
|
|
107 |
|
|
108 |
CleanupStack::PopAndDestroy ( summary );
|
|
109 |
|
|
110 |
// this is needed to be re-called here, otherwise the CEikEdwin
|
|
111 |
// does not get correctly instantiated with default text
|
|
112 |
iDescription->FocusChanged(EDrawNow);
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------------------------
|
|
116 |
// CESMRDescriptionField::ExternalizeL
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
void CESMRDescriptionField::ExternalizeL( MESMRCalEntry& aEntry )
|
|
120 |
{
|
|
121 |
FUNC_LOG;
|
|
122 |
HBufC* buf = iDescription->GetTextInHBufL();
|
|
123 |
CCalEntry& entry = aEntry.Entry();
|
|
124 |
|
|
125 |
if( buf )
|
|
126 |
{
|
|
127 |
CleanupStack::PushL( buf );
|
|
128 |
|
|
129 |
if( iDescription->DefaultText().Compare( *buf ) != 0 )
|
|
130 |
{
|
|
131 |
// Edited text. Add link to description text
|
|
132 |
HBufC* newBuf = AddLinkToTextL( *buf );
|
|
133 |
if( newBuf )
|
|
134 |
{
|
|
135 |
CleanupStack::PopAndDestroy( buf );
|
|
136 |
buf = newBuf;
|
|
137 |
CleanupStack::PushL( buf );
|
|
138 |
}
|
|
139 |
entry.SetDescriptionL( *buf );
|
|
140 |
}
|
|
141 |
else if ( iLocationLink )
|
|
142 |
{
|
|
143 |
// Location link set
|
|
144 |
entry.SetDescriptionL( iLocationLink->Value() );
|
|
145 |
}
|
|
146 |
else if ( entry.DescriptionL().Length() != 0 )
|
|
147 |
{
|
|
148 |
// Clear old description
|
|
149 |
entry.SetDescriptionL( KNullDesC );
|
|
150 |
}
|
|
151 |
CleanupStack::PopAndDestroy( buf );
|
|
152 |
}
|
|
153 |
else if( iLocationLink )
|
|
154 |
{
|
|
155 |
entry.SetDescriptionL( iLocationLink->Value() );
|
|
156 |
}
|
|
157 |
else
|
|
158 |
{
|
|
159 |
entry.SetDescriptionL( KNullDesC );
|
|
160 |
}
|
|
161 |
}
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// CESMRDescriptionField::SetOutlineFocusL
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CESMRDescriptionField::SetOutlineFocusL( TBool aFocus )
|
|
168 |
{
|
|
169 |
FUNC_LOG;
|
|
170 |
CESMRField::SetOutlineFocusL ( aFocus );
|
|
171 |
if ( aFocus )
|
|
172 |
{
|
|
173 |
ChangeMiddleSoftKeyL(EESMRCmdSaveMR,R_QTN_MSK_SAVE);
|
|
174 |
}
|
|
175 |
}
|
|
176 |
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
// CESMRDescriptionField::OfferKeyEventL
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
//
|
|
181 |
TKeyResponse CESMRDescriptionField::OfferKeyEventL(const TKeyEvent& aEvent,
|
|
182 |
TEventCode aType )
|
|
183 |
{
|
|
184 |
FUNC_LOG;
|
|
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;
|
|
196 |
}
|
|
197 |
|
|
198 |
// ---------------------------------------------------------------------------
|
|
199 |
// CESMRDescriptionField::HandleEdwinSizeEventL
|
|
200 |
// ---------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
TBool CESMRDescriptionField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/,
|
|
203 |
TEdwinSizeEvent /*aType*/, TSize aSize )
|
|
204 |
{
|
|
205 |
FUNC_LOG;
|
|
206 |
if ( aSize != iSize )
|
|
207 |
{
|
|
208 |
iSize = aSize;
|
|
209 |
|
|
210 |
if ( iObserver )
|
|
211 |
{
|
|
212 |
iObserver->ControlSizeChanged ( this );
|
|
213 |
}
|
|
214 |
|
|
215 |
if( iDescription->LineCount() != iLineCount )
|
|
216 |
{
|
|
217 |
// Line count has changed, the whole component needs
|
|
218 |
// to be redrawn
|
|
219 |
DrawDeferred();
|
|
220 |
|
|
221 |
// Also if new line count is less than previous one, we
|
|
222 |
// need to redraw the parent also (this is the last field).
|
|
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 |
}
|
|
231 |
}
|
|
232 |
|
|
233 |
return ETrue;
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------------------------
|
|
237 |
// CESMRDescriptionField::HandleEdwinEventL
|
|
238 |
// ---------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
void CESMRDescriptionField::HandleEdwinEventL(
|
|
241 |
CEikEdwin* aEdwin,TEdwinEvent aEventType)
|
|
242 |
{
|
|
243 |
FUNC_LOG;
|
|
244 |
if ( aEdwin == iDescription
|
|
245 |
&& aEventType == EEventTextUpdate )
|
|
246 |
{
|
|
247 |
HBufC* text = iDescription->GetTextInHBufL();
|
|
248 |
if ( text )
|
|
249 |
{
|
|
250 |
CleanupStack::PushL( text );
|
|
251 |
TInt textLength( text->Length() );
|
|
252 |
if ( iDescription->GetLimitLength() <= textLength )
|
|
253 |
{
|
|
254 |
NotifyEventAsyncL( EESMRCmdSizeExceeded );
|
|
255 |
}
|
|
256 |
CleanupStack::PopAndDestroy( text );
|
|
257 |
}
|
|
258 |
}
|
|
259 |
}
|
|
260 |
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
// CESMRDescriptionField::CESMRDescriptionField
|
|
263 |
// ---------------------------------------------------------------------------
|
|
264 |
//
|
|
265 |
CESMRDescriptionField::CESMRDescriptionField()
|
|
266 |
{
|
|
267 |
FUNC_LOG;
|
|
268 |
SetFieldId( EESMRFieldDescription );
|
|
269 |
SetFocusType( EESMRHighlightFocus );
|
|
270 |
}
|
|
271 |
|
|
272 |
// ---------------------------------------------------------------------------
|
|
273 |
// CESMRDescriptionField::ConstructL
|
|
274 |
// ---------------------------------------------------------------------------
|
|
275 |
//
|
|
276 |
void CESMRDescriptionField::ConstructL()
|
|
277 |
{
|
|
278 |
FUNC_LOG;
|
|
279 |
iDescription = CESMREditor::NewL( this, 1, KTextLimit,
|
|
280 |
CEikEdwin::EResizable |
|
|
281 |
CEikEdwin::EAvkonEditor );
|
|
282 |
iDescription->SetEdwinSizeObserver( this );
|
|
283 |
iDescription->SetEdwinObserver( this );
|
|
284 |
CESMRField::ConstructL( iDescription );
|
|
285 |
|
|
286 |
HBufC* buf = StringLoader::LoadLC( R_QTN_MEET_REQ_DETAILS_FIELD );
|
|
287 |
iDescription->SetDefaultTextL( buf ); // ownership transferred
|
|
288 |
CleanupStack::Pop( buf );
|
|
289 |
|
|
290 |
// Setting background instead of theme skin
|
|
291 |
NMRBitmapManager::TMRBitmapStruct bitmapStruct;
|
|
292 |
bitmapStruct = NMRBitmapManager::GetBitmapStruct( NMRBitmapManager::EMRBitmapInputCenter );
|
|
293 |
|
|
294 |
TRect initialisationRect( 0, 0, 0, 0 );
|
|
295 |
iBgControlContext = CAknsBasicBackgroundControlContext::NewL(
|
|
296 |
bitmapStruct.iItemId,
|
|
297 |
initialisationRect,
|
|
298 |
EFalse );
|
|
299 |
|
|
300 |
iDescription->SetSkinBackgroundControlContextL( iBgControlContext );
|
|
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 |
{
|
|
319 |
aLower = iDescription->CurrentLineNumber() * iDescription->RowHeight();
|
|
320 |
aUpper = aLower - iDescription->RowHeight();
|
|
321 |
}
|
|
322 |
|
|
323 |
// ---------------------------------------------------------------------------
|
|
324 |
// CESMRDescriptionField::StoreLinkL
|
|
325 |
// ---------------------------------------------------------------------------
|
|
326 |
//
|
|
327 |
void CESMRDescriptionField::StoreLinkL( MESMRCalEntry& aEntry )
|
|
328 |
{
|
|
329 |
FUNC_LOG;
|
|
330 |
TPtrC urlPointer;
|
|
331 |
TInt position;
|
|
332 |
position = UrlParserL().FindLocationUrl( aEntry.Entry().DescriptionL(),
|
|
333 |
urlPointer );
|
|
334 |
|
|
335 |
if ( position >= KErrNone )
|
|
336 |
{
|
|
337 |
HBufC* description =
|
|
338 |
HBufC::NewL( aEntry.Entry().DescriptionL().Length() );
|
|
339 |
CleanupStack::PushL( description );
|
|
340 |
TPtr descriptionPointer( description->Des() );
|
|
341 |
descriptionPointer.Append( aEntry.Entry().DescriptionL() );
|
|
342 |
descriptionPointer.Delete( position, urlPointer.Length() );
|
|
343 |
descriptionPointer.TrimLeft();
|
|
344 |
if ( description->Length() != 0 )
|
|
345 |
{
|
|
346 |
iDescription->ClearSelectionAndSetTextL( *description );
|
|
347 |
}
|
|
348 |
else
|
|
349 |
{
|
|
350 |
iDescription->ClearSelectionAndSetTextL(
|
|
351 |
iDescription->DefaultText() );
|
|
352 |
}
|
|
353 |
CleanupStack::PopAndDestroy( description );
|
|
354 |
|
|
355 |
if ( iLocationLink )
|
|
356 |
{
|
|
357 |
delete iLocationLink;
|
|
358 |
iLocationLink = NULL;
|
|
359 |
}
|
|
360 |
HBufC* showOnMapBuf =
|
|
361 |
StringLoader::LoadLC( R_MEET_REQ_LINK_SHOW_ON_MAP );
|
|
362 |
iLocationLink = CESMRRichTextLink::NewL( position,
|
|
363 |
showOnMapBuf->Length(),
|
|
364 |
urlPointer,
|
|
365 |
CESMRRichTextLink::ETypeLocationUrl,
|
|
366 |
CESMRRichTextLink::ETriggerKeyOk );
|
|
367 |
CleanupStack::PopAndDestroy( showOnMapBuf );
|
|
368 |
|
|
369 |
StoreGeoValueL( aEntry.Entry(),
|
|
370 |
urlPointer );
|
|
371 |
}
|
|
372 |
}
|
|
373 |
|
|
374 |
// ---------------------------------------------------------------------------
|
|
375 |
// CESMRDescriptionField::AddLinkToTextL
|
|
376 |
// ---------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
HBufC* CESMRDescriptionField::AddLinkToTextL( const TDesC& aBuf )
|
|
379 |
{
|
|
380 |
FUNC_LOG;
|
|
381 |
if( iLocationLink )
|
|
382 |
{
|
|
383 |
TInt newTextLen = aBuf.Length() + iLocationLink->Value().Length() + 1;
|
|
384 |
HBufC* retBuf = HBufC::NewL( newTextLen );
|
|
385 |
|
|
386 |
retBuf->Des().Append( iLocationLink->Value() );
|
|
387 |
_LIT( KParagraphSeparator, "\x2029" ); // unicode paragraph separator
|
|
388 |
// add the separator after url
|
|
389 |
retBuf->Des().Append( KParagraphSeparator );
|
|
390 |
retBuf->Des().Append( aBuf );
|
|
391 |
|
|
392 |
return retBuf;
|
|
393 |
}
|
|
394 |
else
|
|
395 |
{
|
|
396 |
return NULL;
|
|
397 |
}
|
|
398 |
}
|
|
399 |
|
|
400 |
// ---------------------------------------------------------------------------
|
|
401 |
// CESMRDescriptionField::FeaturesL
|
|
402 |
// ---------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
CESMRFeatureSettings& CESMRDescriptionField::FeaturesL()
|
|
405 |
{
|
|
406 |
FUNC_LOG;
|
|
407 |
if ( !iFeatures )
|
|
408 |
{
|
|
409 |
iFeatures = CESMRFeatureSettings::NewL();
|
|
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 |
}
|
|
460 |
|
|
461 |
return isUsed;
|
|
462 |
}
|
|
463 |
|
|
464 |
// ---------------------------------------------------------------------------
|
|
465 |
// CESMRDescriptionField::CountComponentControls
|
|
466 |
// ---------------------------------------------------------------------------
|
|
467 |
//
|
|
468 |
TInt CESMRDescriptionField::CountComponentControls() const
|
|
469 |
{
|
|
470 |
return KComponentCount;
|
|
471 |
}
|
|
472 |
|
|
473 |
// ---------------------------------------------------------------------------
|
|
474 |
// CESMRDescriptionField::ComponentControl
|
|
475 |
// ---------------------------------------------------------------------------
|
|
476 |
//
|
|
477 |
CCoeControl* CESMRDescriptionField::ComponentControl( TInt aInd ) const
|
|
478 |
{
|
|
479 |
if( aInd == 0 )
|
|
480 |
{
|
|
481 |
return iDescription;
|
|
482 |
}
|
|
483 |
return NULL;
|
|
484 |
}
|
|
485 |
|
|
486 |
// ---------------------------------------------------------------------------
|
|
487 |
// CESMRDescriptionField::SizeChanged
|
|
488 |
// ---------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
void CESMRDescriptionField::SizeChanged()
|
|
491 |
{
|
|
492 |
TRect rect( Rect() );
|
|
493 |
|
|
494 |
// Optimization: Layouting only when necessary
|
|
495 |
if( iFieldRect != rect )
|
|
496 |
{
|
|
497 |
rect = NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ).Rect();
|
|
498 |
|
|
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 |
}
|
|
598 |
|
|
599 |
// EOF
|