25
|
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: Detailed subject field
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cesmrviewerdetailedsubjectfield.h"
|
|
19 |
#include "cesmrrichtextviewer.h"
|
|
20 |
#include "cesmrrichtextlink.h"
|
|
21 |
#include "mesmrlistobserver.h"
|
|
22 |
#include "mesmrtitlepaneobserver.h"
|
|
23 |
#include "mesmrmeetingrequestentry.h"
|
|
24 |
#include "cmrimage.h"
|
|
25 |
#include "nmrlayoutmanager.h"
|
|
26 |
#include "nmrbitmapmanager.h"
|
|
27 |
#include "cesmrglobalnote.h"
|
|
28 |
|
|
29 |
#include <esmrgui.rsg>
|
|
30 |
#include <StringLoader.h>
|
|
31 |
#include <calentry.h>
|
|
32 |
#include <AknLayout2ScalableDef.h>
|
|
33 |
|
|
34 |
// DEBUG
|
|
35 |
#include "emailtrace.h"
|
|
36 |
|
|
37 |
// Unnamed namespace for local definitions and functions
|
|
38 |
namespace { // codescanner::namespace
|
|
39 |
/**
|
|
40 |
* Adds forward prefix to calendar (meeting request) entry.
|
|
41 |
* @param aEntry Reference to calendar entry.
|
|
42 |
*/
|
|
43 |
void AddForwardPrefixToEntryL(
|
|
44 |
CCalEntry& aEntry )
|
|
45 |
{
|
|
46 |
TPtrC summary( aEntry.SummaryL() );
|
|
47 |
|
|
48 |
// loading 'FW:' prefix from resource
|
|
49 |
HBufC* fwPrefix =
|
|
50 |
StringLoader::LoadLC(
|
|
51 |
R_QTN_MEET_REQ_PLAIN_TEXT_FORWARDED );
|
|
52 |
|
|
53 |
HBufC* subjectBuffer = HBufC::NewLC(
|
|
54 |
fwPrefix->Length() + summary.Length() );
|
|
55 |
TPtr subject( subjectBuffer->Des() );
|
|
56 |
|
|
57 |
// Construc 'Fw: <summary>'
|
|
58 |
subject.Copy( *fwPrefix );
|
|
59 |
subject.Append( summary );
|
|
60 |
|
|
61 |
aEntry.SetSummaryL( subject );
|
|
62 |
|
|
63 |
CleanupStack::PopAndDestroy( subjectBuffer );
|
|
64 |
subjectBuffer = NULL;
|
|
65 |
|
|
66 |
CleanupStack::PopAndDestroy( fwPrefix );
|
|
67 |
fwPrefix = NULL;
|
|
68 |
}
|
|
69 |
|
|
70 |
}//namespace
|
|
71 |
|
|
72 |
// ======== MEMBER FUNCTIONS ========
|
|
73 |
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
// CESMRViewerDetailedSubjectField::CESMRViewerDetailedSubjectField()
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CESMRViewerDetailedSubjectField::CESMRViewerDetailedSubjectField()
|
|
79 |
{
|
|
80 |
FUNC_LOG;
|
|
81 |
SetFieldId ( EESMRFieldDetailedSubject );
|
|
82 |
SetFocusType( EESMRHighlightFocus );
|
|
83 |
}
|
|
84 |
|
|
85 |
// ---------------------------------------------------------------------------
|
|
86 |
// CESMRViewerDetailedSubjectField::~CESMRViewerDetailedSubjectField()
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
CESMRViewerDetailedSubjectField::~CESMRViewerDetailedSubjectField()
|
|
90 |
{
|
|
91 |
FUNC_LOG;
|
|
92 |
iObserver = NULL;
|
|
93 |
delete iFieldIcon;
|
|
94 |
}
|
|
95 |
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
// CESMRViewerDetailedSubjectField::NewL()
|
|
98 |
// ---------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
CESMRViewerDetailedSubjectField* CESMRViewerDetailedSubjectField::NewL()
|
|
101 |
{
|
|
102 |
FUNC_LOG;
|
|
103 |
CESMRViewerDetailedSubjectField* self =
|
|
104 |
new( ELeave )CESMRViewerDetailedSubjectField;
|
|
105 |
CleanupStack::PushL( self );
|
|
106 |
self->ConstructL();
|
|
107 |
CleanupStack::Pop( self );
|
|
108 |
return self;
|
|
109 |
}
|
|
110 |
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
// CESMRViewerDetailedSubjectField::ConstructL()
|
|
113 |
// ---------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CESMRViewerDetailedSubjectField::ConstructL()
|
|
116 |
{
|
|
117 |
FUNC_LOG;
|
|
118 |
iFieldIcon = CMRImage::NewL(
|
|
119 |
NMRBitmapManager::EMRBitmapOccasion,
|
|
120 |
this );
|
|
121 |
|
|
122 |
iRichTextViewer = CESMRRichTextViewer::NewL( this );
|
|
123 |
CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
|
|
124 |
iRichTextViewer->SetEdwinSizeObserver( this );
|
|
125 |
iRichTextViewer->SetParent( this );
|
|
126 |
iRichTextViewer->SetLinkObserver( this );
|
|
127 |
}
|
|
128 |
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
// CESMRViewerDetailedSubjectField::SetTitlePaneObserver
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CESMRViewerDetailedSubjectField::SetTitlePaneObserver(
|
|
134 |
MESMRTitlePaneObserver* aObserver )
|
|
135 |
{
|
|
136 |
FUNC_LOG;
|
|
137 |
iTitlePaneObserver = aObserver;
|
|
138 |
}
|
|
139 |
|
|
140 |
// ---------------------------------------------------------------------------
|
|
141 |
// CESMRViewerDetailedSubjectField::MinimumSize
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
TSize CESMRViewerDetailedSubjectField::MinimumSize()
|
|
145 |
{
|
|
146 |
TRect parentRect( Parent()->Rect() );
|
|
147 |
|
|
148 |
TRect fieldRect =
|
|
149 |
NMRLayoutManager::GetFieldLayoutRect( parentRect, 1 ).Rect();
|
|
150 |
|
|
151 |
TRect viewerRect( NMRLayoutManager::GetLayoutText(
|
|
152 |
fieldRect,
|
|
153 |
NMRLayoutManager::EMRTextLayoutTextEditor ).TextRect() );
|
|
154 |
|
|
155 |
// Adjust field size so that there's room for expandable editor.
|
|
156 |
fieldRect.Resize( 0, iSize.iHeight - viewerRect.Height() );
|
|
157 |
|
|
158 |
return fieldRect.Size();
|
|
159 |
}
|
|
160 |
|
|
161 |
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
// CESMRViewerDetailedSubjectField::InitializeL()
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
void CESMRViewerDetailedSubjectField::InitializeL()
|
|
167 |
{
|
|
168 |
FUNC_LOG;
|
|
169 |
// Setting Font for the rich text viewer
|
|
170 |
TAknLayoutText text = NMRLayoutManager::GetLayoutText(
|
|
171 |
Rect(),
|
|
172 |
NMRLayoutManager::EMRTextLayoutTextEditor );
|
|
173 |
|
|
174 |
iRichTextViewer->SetFontL( text.Font() );
|
|
175 |
iRichTextViewer->ApplyLayoutChangesL();
|
|
176 |
|
|
177 |
// This is called so theme changes will apply when changing theme "on the fly"
|
|
178 |
if ( IsFocused() )
|
|
179 |
{
|
|
180 |
iRichTextViewer->FocusChanged( EDrawNow );
|
|
181 |
}
|
|
182 |
iRichTextViewer->SetEventQueue( iEventQueue );
|
|
183 |
}
|
|
184 |
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
// CESMRViewerDetailedSubjectField::InternalizeL()
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
void CESMRViewerDetailedSubjectField::InternalizeL(
|
|
190 |
MESMRCalEntry& aEntry )
|
|
191 |
{
|
|
192 |
FUNC_LOG;
|
|
193 |
MESMRCalEntry::TESMRCalEntryType entryType(
|
|
194 |
aEntry.Type() );
|
|
195 |
|
|
196 |
CCalEntry& entry = aEntry.Entry();
|
|
197 |
|
|
198 |
if( !IsLocked() )
|
|
199 |
{
|
|
200 |
if( entry.PriorityL() == EFSCalenMRPriorityHigh )
|
|
201 |
{
|
|
202 |
iPriorityIcon = CMRImage::NewL(
|
|
203 |
NMRBitmapManager::EMRBitmapPriorityHigh,
|
|
204 |
this,
|
|
205 |
ETrue );
|
|
206 |
}
|
|
207 |
if( entry.PriorityL() == EFSCalenMRPriorityLow )
|
|
208 |
{
|
|
209 |
iPriorityIcon = CMRImage::NewL(
|
|
210 |
NMRBitmapManager::EMRBitmapPriorityLow,
|
|
211 |
this,
|
|
212 |
ETrue );
|
|
213 |
}
|
|
214 |
}
|
|
215 |
|
|
216 |
|
|
217 |
if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == entryType )
|
|
218 |
{
|
|
219 |
MESMRMeetingRequestEntry* mrEntry =
|
|
220 |
static_cast<MESMRMeetingRequestEntry*>(&aEntry);
|
|
221 |
|
|
222 |
if ( mrEntry->IsForwardedL() )
|
|
223 |
{
|
|
224 |
AddForwardPrefixToEntryL( entry );
|
|
225 |
|
|
226 |
if ( iTitlePaneObserver )
|
|
227 |
{
|
|
228 |
iTitlePaneObserver->UpdateTitlePaneTextL(
|
|
229 |
entry.SummaryL() );
|
|
230 |
}
|
|
231 |
}
|
|
232 |
}
|
|
233 |
|
|
234 |
HBufC* unnamed = StringLoader::LoadLC( R_QTN_MEET_REQ_CONFLICT_UNNAMED );
|
|
235 |
|
|
236 |
TPtrC summary( entry.SummaryL() );
|
|
237 |
HBufC* subject = summary.AllocLC();
|
|
238 |
|
|
239 |
if ( summary.Length() )
|
|
240 |
{
|
|
241 |
iRichTextViewer->SetTextL( subject, ETrue );
|
|
242 |
}
|
|
243 |
else
|
|
244 |
{
|
|
245 |
iRichTextViewer->SetTextL( unnamed, ETrue );
|
|
246 |
}
|
|
247 |
CleanupStack::PopAndDestroy( subject );
|
|
248 |
subject = NULL;
|
|
249 |
|
|
250 |
if ( iTitlePaneObserver && aEntry.IsStoredL() )
|
|
251 |
{
|
|
252 |
if ( summary.Length() )
|
|
253 |
{
|
|
254 |
iTitlePaneObserver->UpdateTitlePaneTextL( summary );
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
iTitlePaneObserver->UpdateTitlePaneTextL( *unnamed );
|
|
259 |
}
|
|
260 |
}
|
|
261 |
|
|
262 |
CleanupStack::PopAndDestroy( unnamed );
|
|
263 |
unnamed = NULL;
|
|
264 |
|
|
265 |
// if the entry isn't anniversary let's change the icon.
|
|
266 |
if ( CCalEntry::EAnniv != aEntry.Entry().EntryTypeL() )
|
|
267 |
{
|
|
268 |
delete iFieldIcon;
|
|
269 |
iFieldIcon = NULL;
|
|
270 |
|
|
271 |
iFieldIcon = CMRImage::NewL(
|
|
272 |
NMRBitmapManager::EMRBitmapSubject,
|
|
273 |
this );
|
|
274 |
}
|
|
275 |
|
|
276 |
SizeChanged();
|
|
277 |
}
|
|
278 |
|
|
279 |
// ---------------------------------------------------------------------------
|
|
280 |
// CESMRViewerDetailedSubjectField::OfferKeyEventL()
|
|
281 |
// ---------------------------------------------------------------------------
|
|
282 |
//
|
|
283 |
TKeyResponse CESMRViewerDetailedSubjectField::OfferKeyEventL(
|
|
284 |
const TKeyEvent& aEvent,
|
|
285 |
TEventCode aType )
|
|
286 |
{
|
|
287 |
FUNC_LOG;
|
|
288 |
return iRichTextViewer->OfferKeyEventL ( aEvent, aType );
|
|
289 |
}
|
|
290 |
|
|
291 |
// ---------------------------------------------------------------------------
|
|
292 |
// CESMRViewerDetailedSubjectField::HandleEdwinSizeEventL()
|
|
293 |
// ---------------------------------------------------------------------------
|
|
294 |
//
|
|
295 |
TBool CESMRViewerDetailedSubjectField::HandleEdwinSizeEventL(
|
|
296 |
CEikEdwin* aEdwin,
|
|
297 |
TEdwinSizeEvent /*aType*/,
|
|
298 |
TSize aSize )
|
|
299 |
{
|
|
300 |
FUNC_LOG;
|
|
301 |
TBool reDraw( EFalse );
|
|
302 |
|
|
303 |
// Let's save the required size for the iRichTextViewer
|
|
304 |
iSize = aSize;
|
|
305 |
|
|
306 |
if ( iObserver && aEdwin == iRichTextViewer )
|
|
307 |
{
|
|
308 |
iObserver->ControlSizeChanged( this );
|
|
309 |
|
|
310 |
if ( !iOutlineFocus )
|
|
311 |
{
|
|
312 |
RecordField();
|
|
313 |
}
|
|
314 |
|
|
315 |
reDraw = ETrue;
|
|
316 |
}
|
|
317 |
|
|
318 |
return reDraw;
|
|
319 |
}
|
|
320 |
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
// CESMRViewerDetailedSubjectField::ListObserverSet
|
|
323 |
// ---------------------------------------------------------------------------
|
|
324 |
//
|
|
325 |
void CESMRViewerDetailedSubjectField::ListObserverSet()
|
|
326 |
{
|
|
327 |
FUNC_LOG;
|
|
328 |
iRichTextViewer->SetListObserver( iObserver );
|
|
329 |
}
|
|
330 |
|
|
331 |
// ---------------------------------------------------------------------------
|
|
332 |
// CESMRViewerDetailedSubjectField::ExecuteGenericCommandL()
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
TBool CESMRViewerDetailedSubjectField::ExecuteGenericCommandL( TInt aCommand )
|
|
336 |
{
|
|
337 |
FUNC_LOG;
|
|
338 |
TBool isUsed( EFalse );
|
|
339 |
if (aCommand == EESMRCmdClipboardCopy)
|
|
340 |
{
|
|
341 |
iRichTextViewer->CopyCurrentLinkToClipBoardL();
|
|
342 |
isUsed = ETrue;
|
|
343 |
}
|
|
344 |
else if ( aCommand == EAknSoftkeySelect )
|
|
345 |
{
|
|
346 |
iRichTextViewer->LinkSelectedL();
|
|
347 |
isUsed = ETrue;
|
|
348 |
}
|
|
349 |
else if ( aCommand == EAknCmdOpen )
|
|
350 |
{
|
|
351 |
if ( IsLocked() )
|
|
352 |
{
|
|
353 |
HandleTactileFeedbackL();
|
|
354 |
|
|
355 |
CESMRGlobalNote::ExecuteL(
|
|
356 |
CESMRGlobalNote::EESMRUnableToEdit );
|
|
357 |
isUsed = ETrue;
|
|
358 |
}
|
|
359 |
}
|
|
360 |
return isUsed;
|
|
361 |
}
|
|
362 |
|
|
363 |
// ---------------------------------------------------------------------------
|
|
364 |
// CESMRViewerDetailedSubjectField::SetOutlineFocusL()
|
|
365 |
// ---------------------------------------------------------------------------
|
|
366 |
//
|
|
367 |
void CESMRViewerDetailedSubjectField::SetOutlineFocusL( TBool aFocus )
|
|
368 |
{
|
|
369 |
FUNC_LOG;
|
|
370 |
CESMRField::SetOutlineFocusL ( aFocus );
|
|
371 |
iRichTextViewer->SetFocus( aFocus );
|
|
372 |
|
|
373 |
if( aFocus )
|
|
374 |
{
|
|
375 |
SetMiddleSoftkeyL();
|
|
376 |
}
|
|
377 |
|
|
378 |
else
|
|
379 |
{
|
|
380 |
//need to tell action menu that focus has changed
|
|
381 |
iRichTextViewer->ResetActionMenuL();
|
|
382 |
}
|
|
383 |
}
|
|
384 |
|
|
385 |
// ---------------------------------------------------------------------------
|
|
386 |
// CESMRViewerDetailedSubjectField::GetCursorLineVerticalPos
|
|
387 |
// ---------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
void CESMRViewerDetailedSubjectField::GetCursorLineVerticalPos(
|
|
390 |
TInt& aUpper,
|
|
391 |
TInt& aLower )
|
|
392 |
{
|
|
393 |
FUNC_LOG;
|
|
394 |
|
|
395 |
aLower = iRichTextViewer->CurrentLineNumber() * iRichTextViewer->RowHeight();
|
|
396 |
aUpper = aLower - iRichTextViewer->RowHeight();
|
|
397 |
}
|
|
398 |
|
|
399 |
// ---------------------------------------------------------------------------
|
|
400 |
// CESMRViewerDetailedSubjectField::HandleLongtapEventL
|
|
401 |
// ---------------------------------------------------------------------------
|
|
402 |
//
|
|
403 |
void CESMRViewerDetailedSubjectField::HandleLongtapEventL(
|
|
404 |
const TPoint& aPosition )
|
|
405 |
{
|
|
406 |
FUNC_LOG;
|
|
407 |
|
|
408 |
if ( iRichTextViewer->Rect().Contains( aPosition ) )
|
|
409 |
{
|
|
410 |
iRichTextViewer->LinkSelectedL();
|
|
411 |
}
|
|
412 |
}
|
|
413 |
|
|
414 |
// ---------------------------------------------------------------------------
|
|
415 |
// CESMRViewerDetailedSubjectField::LockL
|
|
416 |
// ---------------------------------------------------------------------------
|
|
417 |
//
|
|
418 |
void CESMRViewerDetailedSubjectField::LockL()
|
|
419 |
{
|
|
420 |
FUNC_LOG;
|
|
421 |
if( IsLocked() )
|
|
422 |
{
|
|
423 |
return;
|
|
424 |
}
|
|
425 |
|
|
426 |
CESMRField::LockL();
|
|
427 |
|
|
428 |
delete iPriorityIcon;
|
|
429 |
iPriorityIcon = NULL;
|
|
430 |
iPriorityIcon = CMRImage::NewL(
|
|
431 |
NMRBitmapManager::EMRBitmapLockField,
|
|
432 |
this,
|
|
433 |
ETrue );
|
|
434 |
}
|
|
435 |
|
|
436 |
// ---------------------------------------------------------------------------
|
|
437 |
// CESMRViewerDetailedSubjectField::SetMiddleSoftkeyL
|
|
438 |
// ---------------------------------------------------------------------------
|
|
439 |
//
|
|
440 |
void CESMRViewerDetailedSubjectField::SetMiddleSoftkeyL()
|
|
441 |
{
|
|
442 |
FUNC_LOG;
|
|
443 |
const CESMRRichTextLink* link = iRichTextViewer->GetSelectedLink();
|
|
444 |
if( link )
|
|
445 |
{
|
|
446 |
if ( ( link->Type() == CESMRRichTextLink::ETypeURL ) ||
|
|
447 |
( link->Type() == CESMRRichTextLink::ETypeEmail ) ||
|
|
448 |
( link->Type() == CESMRRichTextLink::ETypePhoneNumber ) )
|
|
449 |
{
|
|
450 |
SetMiddleSoftKeyVisible( ETrue );
|
|
451 |
}
|
|
452 |
else
|
|
453 |
{
|
|
454 |
RestoreMiddleSoftKeyL();
|
|
455 |
}
|
|
456 |
}
|
|
457 |
}
|
|
458 |
|
|
459 |
|
|
460 |
// ---------------------------------------------------------------------------
|
|
461 |
// CESMRViewerDetailedSubjectField::HandleRichTextLinkSelection
|
|
462 |
// ---------------------------------------------------------------------------
|
|
463 |
//
|
|
464 |
TBool CESMRViewerDetailedSubjectField::HandleRichTextLinkSelection(
|
|
465 |
const CESMRRichTextLink* /*aLink*/ )
|
|
466 |
{
|
|
467 |
TBool result = EFalse;
|
|
468 |
|
|
469 |
// No implementation yet: waiting for UI spec.
|
|
470 |
|
|
471 |
return result;
|
|
472 |
}
|
|
473 |
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
// CESMRViewerDetailedSubjectField::CountComponentControls
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
//
|
|
478 |
TInt CESMRViewerDetailedSubjectField::CountComponentControls() const
|
|
479 |
{
|
|
480 |
TInt count( 0 );
|
|
481 |
if ( iFieldIcon )
|
|
482 |
{
|
|
483 |
++count;
|
|
484 |
}
|
|
485 |
|
|
486 |
if ( iRichTextViewer )
|
|
487 |
{
|
|
488 |
++count;
|
|
489 |
}
|
|
490 |
|
|
491 |
if ( iPriorityIcon )
|
|
492 |
{
|
|
493 |
++count;
|
|
494 |
}
|
|
495 |
|
|
496 |
return count;
|
|
497 |
}
|
|
498 |
|
|
499 |
// ---------------------------------------------------------------------------
|
|
500 |
// CESMRViewerDetailedSubjectField::ComponentControl
|
|
501 |
// ---------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
CCoeControl* CESMRViewerDetailedSubjectField::ComponentControl(
|
|
504 |
TInt aIndex ) const
|
|
505 |
{
|
|
506 |
switch ( aIndex )
|
|
507 |
{
|
|
508 |
case 0:
|
|
509 |
return iFieldIcon;
|
|
510 |
case 1:
|
|
511 |
return iRichTextViewer;
|
|
512 |
case 2:
|
|
513 |
return iPriorityIcon;
|
|
514 |
|
|
515 |
default:
|
|
516 |
return NULL;
|
|
517 |
}
|
|
518 |
}
|
|
519 |
|
|
520 |
// ---------------------------------------------------------------------------
|
|
521 |
// CESMRViewerDetailedSubjectField::SizeChanged
|
|
522 |
// ---------------------------------------------------------------------------
|
|
523 |
//
|
|
524 |
void CESMRViewerDetailedSubjectField::SizeChanged( )
|
|
525 |
{
|
|
526 |
// Store iRichTextViewer original width.
|
|
527 |
TInt richTextViewerWidth = iRichTextViewer->Size().iWidth;
|
|
528 |
TRect rect( Rect() );
|
|
529 |
|
|
530 |
TAknLayoutRect rowLayoutRect(
|
|
531 |
NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) );
|
|
532 |
TRect rowRect( rowLayoutRect.Rect() );
|
|
533 |
|
|
534 |
// Layouting field icon
|
|
535 |
if( iFieldIcon )
|
|
536 |
{
|
|
537 |
TAknWindowComponentLayout iconLayout(
|
|
538 |
NMRLayoutManager::GetWindowComponentLayout(
|
|
539 |
NMRLayoutManager::EMRLayoutSingleRowAColumnGraphic ) );
|
|
540 |
AknLayoutUtils::LayoutControl( iFieldIcon, rowRect, iconLayout );
|
|
541 |
}
|
|
542 |
|
|
543 |
// Layouting priority icon
|
|
544 |
if( iPriorityIcon )
|
|
545 |
{
|
|
546 |
TAknWindowComponentLayout iconLayout(
|
|
547 |
NMRLayoutManager::GetWindowComponentLayout(
|
|
548 |
NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
|
|
549 |
AknLayoutUtils::LayoutImage( iPriorityIcon, rowRect, iconLayout );
|
|
550 |
}
|
|
551 |
|
|
552 |
TAknLayoutText viewerLayoutText;
|
|
553 |
|
|
554 |
if( iPriorityIcon )
|
|
555 |
{
|
|
556 |
viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect,
|
|
557 |
NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
|
|
558 |
}
|
|
559 |
else
|
|
560 |
{
|
|
561 |
viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect,
|
|
562 |
NMRLayoutManager::EMRTextLayoutTextEditor );
|
|
563 |
}
|
|
564 |
|
|
565 |
// Layouting viewer field
|
|
566 |
TRect viewerRect( viewerLayoutText.TextRect() );
|
|
567 |
|
|
568 |
// Resize height according to actual height required by edwin.
|
|
569 |
viewerRect.Resize( 0, iSize.iHeight - viewerRect.Height() );
|
|
570 |
iRichTextViewer->SetRect( viewerRect );
|
|
571 |
|
|
572 |
// Layouting focus
|
|
573 |
TRect bgRect( viewerRect );
|
|
574 |
|
|
575 |
// Move focus rect so that it's relative to field's position.
|
|
576 |
bgRect.Move( -Position() );
|
|
577 |
SetFocusRect( bgRect );
|
|
578 |
|
|
579 |
// Failures are ignored.
|
|
580 |
TRAP_IGNORE(
|
|
581 |
// Try setting font
|
|
582 |
iRichTextViewer->SetFontL( viewerLayoutText.Font() );
|
|
583 |
// Try applying changes
|
|
584 |
iRichTextViewer->ApplyLayoutChangesL();
|
|
585 |
);
|
|
586 |
|
|
587 |
if ( iRichTextViewer->Size().iWidth != richTextViewerWidth )
|
|
588 |
{
|
|
589 |
// Most of this case is screen orientation, in this case we need to
|
|
590 |
// Record the index of focusing link, after updating link array, then
|
|
591 |
// reset the focusing to original one.
|
|
592 |
TInt focusingIndex = iRichTextViewer->GetFocusLink();
|
|
593 |
if ( KErrNotFound != focusingIndex )
|
|
594 |
{
|
|
595 |
iRichTextViewer->SetFocusLink( focusingIndex );
|
|
596 |
//wake up current contact menu selection by calling this
|
|
597 |
iRichTextViewer->FocusChanged(ENoDrawNow);
|
|
598 |
}
|
|
599 |
}
|
|
600 |
}
|
|
601 |
|
|
602 |
// ---------------------------------------------------------------------------
|
|
603 |
// CESMRViewerDetailedSubjectField::SupportsLongTapFunctionalityL
|
|
604 |
// ---------------------------------------------------------------------------
|
|
605 |
//
|
|
606 |
TBool CESMRViewerDetailedSubjectField::SupportsLongTapFunctionalityL(
|
|
607 |
const TPointerEvent &aPointerEvent )
|
|
608 |
{
|
|
609 |
FUNC_LOG;
|
|
610 |
TBool ret( EFalse );
|
|
611 |
|
|
612 |
if ( iRichTextViewer->Rect().Contains( aPointerEvent.iPosition ) )
|
|
613 |
{
|
|
614 |
if( iRichTextViewer->PointerEventOccuresOnALinkL( aPointerEvent ) )
|
|
615 |
{
|
|
616 |
ret = ETrue;
|
|
617 |
}
|
|
618 |
}
|
|
619 |
|
|
620 |
return ret;
|
|
621 |
}
|
|
622 |
|
|
623 |
//EOF
|