author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:11:15 +0300 | |
branch | RCL_3 |
changeset 80 | 726fba06891a |
parent 64 | 3533d4323edc |
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: 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 ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
121 |
iPriorityIcon = CMRImage::NewL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
122 |
NMRBitmapManager::EMRBitmapLockField, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
123 |
this ); |
64 | 124 |
iRichTextViewer = CESMRRichTextViewer::NewL( this ); |
125 |
CESMRField::ConstructL( iRichTextViewer ); // ownership transferred |
|
126 |
iRichTextViewer->SetEdwinSizeObserver( this ); |
|
127 |
iRichTextViewer->SetParent( this ); |
|
128 |
iRichTextViewer->SetLinkObserver( this ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
129 |
iCurrentPriority = EFSCalenMRPriorityNormal; |
64 | 130 |
} |
131 |
||
132 |
// --------------------------------------------------------------------------- |
|
133 |
// CESMRViewerDetailedSubjectField::SetTitlePaneObserver |
|
134 |
// --------------------------------------------------------------------------- |
|
135 |
// |
|
136 |
void CESMRViewerDetailedSubjectField::SetTitlePaneObserver( |
|
137 |
MESMRTitlePaneObserver* aObserver ) |
|
138 |
{ |
|
139 |
FUNC_LOG; |
|
140 |
iTitlePaneObserver = aObserver; |
|
141 |
} |
|
142 |
||
143 |
// --------------------------------------------------------------------------- |
|
144 |
// CESMRViewerDetailedSubjectField::MinimumSize |
|
145 |
// --------------------------------------------------------------------------- |
|
146 |
// |
|
147 |
TSize CESMRViewerDetailedSubjectField::MinimumSize() |
|
148 |
{ |
|
149 |
TRect parentRect( Parent()->Rect() ); |
|
150 |
||
151 |
TRect fieldRect = |
|
152 |
NMRLayoutManager::GetFieldLayoutRect( parentRect, 1 ).Rect(); |
|
153 |
||
154 |
TRect viewerRect( NMRLayoutManager::GetLayoutText( |
|
155 |
fieldRect, |
|
156 |
NMRLayoutManager::EMRTextLayoutTextEditor ).TextRect() ); |
|
157 |
||
158 |
// Adjust field size so that there's room for expandable editor. |
|
159 |
fieldRect.Resize( 0, iSize.iHeight - viewerRect.Height() ); |
|
160 |
||
161 |
return fieldRect.Size(); |
|
162 |
} |
|
163 |
||
164 |
||
165 |
// --------------------------------------------------------------------------- |
|
166 |
// CESMRViewerDetailedSubjectField::InitializeL() |
|
167 |
// --------------------------------------------------------------------------- |
|
168 |
// |
|
169 |
void CESMRViewerDetailedSubjectField::InitializeL() |
|
170 |
{ |
|
171 |
FUNC_LOG; |
|
172 |
// Setting Font for the rich text viewer |
|
173 |
TAknLayoutText text = NMRLayoutManager::GetLayoutText( |
|
174 |
Rect(), |
|
175 |
NMRLayoutManager::EMRTextLayoutTextEditor ); |
|
176 |
||
177 |
iRichTextViewer->SetFontL( text.Font() ); |
|
178 |
iRichTextViewer->ApplyLayoutChangesL(); |
|
179 |
||
180 |
// This is called so theme changes will apply when changing theme "on the fly" |
|
181 |
if ( IsFocused() ) |
|
182 |
{ |
|
183 |
iRichTextViewer->FocusChanged( EDrawNow ); |
|
184 |
} |
|
185 |
iRichTextViewer->SetEventQueue( iEventQueue ); |
|
186 |
} |
|
187 |
||
188 |
// --------------------------------------------------------------------------- |
|
189 |
// CESMRViewerDetailedSubjectField::InternalizeL() |
|
190 |
// --------------------------------------------------------------------------- |
|
191 |
// |
|
192 |
void CESMRViewerDetailedSubjectField::InternalizeL( |
|
193 |
MESMRCalEntry& aEntry ) |
|
194 |
{ |
|
195 |
FUNC_LOG; |
|
196 |
MESMRCalEntry::TESMRCalEntryType entryType( |
|
197 |
aEntry.Type() ); |
|
198 |
||
199 |
CCalEntry& entry = aEntry.Entry(); |
|
200 |
||
201 |
if( !IsLocked() ) |
|
202 |
{ |
|
203 |
if( entry.PriorityL() == EFSCalenMRPriorityHigh ) |
|
204 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
205 |
if( iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
206 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
207 |
delete iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
208 |
iPriorityIcon = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
209 |
} |
64 | 210 |
iPriorityIcon = CMRImage::NewL( |
211 |
NMRBitmapManager::EMRBitmapPriorityHigh, |
|
212 |
this, |
|
213 |
ETrue ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
214 |
iCurrentPriority = EFSCalenMRPriorityHigh; |
64 | 215 |
} |
216 |
if( entry.PriorityL() == EFSCalenMRPriorityLow ) |
|
217 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
218 |
if( iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
219 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
220 |
delete iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
221 |
iPriorityIcon = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
222 |
} |
64 | 223 |
iPriorityIcon = CMRImage::NewL( |
224 |
NMRBitmapManager::EMRBitmapPriorityLow, |
|
225 |
this, |
|
226 |
ETrue ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
227 |
iCurrentPriority = EFSCalenMRPriorityLow; |
64 | 228 |
} |
229 |
} |
|
230 |
||
231 |
||
232 |
if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == entryType ) |
|
233 |
{ |
|
234 |
MESMRMeetingRequestEntry* mrEntry = |
|
235 |
static_cast<MESMRMeetingRequestEntry*>(&aEntry); |
|
236 |
||
237 |
if ( mrEntry->IsForwardedL() ) |
|
238 |
{ |
|
239 |
AddForwardPrefixToEntryL( entry ); |
|
240 |
||
241 |
if ( iTitlePaneObserver ) |
|
242 |
{ |
|
243 |
iTitlePaneObserver->UpdateTitlePaneTextL( |
|
244 |
entry.SummaryL() ); |
|
245 |
} |
|
246 |
} |
|
247 |
} |
|
248 |
||
249 |
HBufC* unnamed = StringLoader::LoadLC( R_QTN_MEET_REQ_CONFLICT_UNNAMED ); |
|
250 |
||
251 |
TPtrC summary( entry.SummaryL() ); |
|
252 |
HBufC* subject = summary.AllocLC(); |
|
253 |
||
254 |
if ( summary.Length() ) |
|
255 |
{ |
|
256 |
iRichTextViewer->SetTextL( subject, ETrue ); |
|
257 |
} |
|
258 |
else |
|
259 |
{ |
|
260 |
iRichTextViewer->SetTextL( unnamed, ETrue ); |
|
261 |
} |
|
262 |
CleanupStack::PopAndDestroy( subject ); |
|
263 |
subject = NULL; |
|
264 |
||
265 |
if ( iTitlePaneObserver && aEntry.IsStoredL() ) |
|
266 |
{ |
|
267 |
if ( summary.Length() ) |
|
268 |
{ |
|
269 |
iTitlePaneObserver->UpdateTitlePaneTextL( summary ); |
|
270 |
} |
|
271 |
else |
|
272 |
{ |
|
273 |
iTitlePaneObserver->UpdateTitlePaneTextL( *unnamed ); |
|
274 |
} |
|
275 |
} |
|
276 |
||
277 |
CleanupStack::PopAndDestroy( unnamed ); |
|
278 |
unnamed = NULL; |
|
279 |
||
280 |
// if the entry isn't anniversary let's change the icon. |
|
281 |
if ( CCalEntry::EAnniv != aEntry.Entry().EntryTypeL() ) |
|
282 |
{ |
|
283 |
delete iFieldIcon; |
|
284 |
iFieldIcon = NULL; |
|
285 |
||
286 |
iFieldIcon = CMRImage::NewL( |
|
287 |
NMRBitmapManager::EMRBitmapSubject, |
|
288 |
this ); |
|
289 |
} |
|
290 |
||
291 |
SizeChanged(); |
|
292 |
} |
|
293 |
||
294 |
// --------------------------------------------------------------------------- |
|
295 |
// CESMRViewerDetailedSubjectField::OfferKeyEventL() |
|
296 |
// --------------------------------------------------------------------------- |
|
297 |
// |
|
298 |
TKeyResponse CESMRViewerDetailedSubjectField::OfferKeyEventL( |
|
299 |
const TKeyEvent& aEvent, |
|
300 |
TEventCode aType ) |
|
301 |
{ |
|
302 |
FUNC_LOG; |
|
303 |
return iRichTextViewer->OfferKeyEventL ( aEvent, aType ); |
|
304 |
} |
|
305 |
||
306 |
// --------------------------------------------------------------------------- |
|
307 |
// CESMRViewerDetailedSubjectField::HandleEdwinSizeEventL() |
|
308 |
// --------------------------------------------------------------------------- |
|
309 |
// |
|
310 |
TBool CESMRViewerDetailedSubjectField::HandleEdwinSizeEventL( |
|
311 |
CEikEdwin* aEdwin, |
|
312 |
TEdwinSizeEvent /*aType*/, |
|
313 |
TSize aSize ) |
|
314 |
{ |
|
315 |
FUNC_LOG; |
|
316 |
TBool reDraw( EFalse ); |
|
317 |
||
318 |
// Let's save the required size for the iRichTextViewer |
|
319 |
iSize = aSize; |
|
320 |
||
321 |
if ( iObserver && aEdwin == iRichTextViewer ) |
|
322 |
{ |
|
323 |
iObserver->ControlSizeChanged( this ); |
|
324 |
||
325 |
if ( !iOutlineFocus ) |
|
326 |
{ |
|
327 |
RecordField(); |
|
328 |
} |
|
329 |
||
330 |
reDraw = ETrue; |
|
331 |
} |
|
332 |
||
333 |
return reDraw; |
|
334 |
} |
|
335 |
||
336 |
// --------------------------------------------------------------------------- |
|
337 |
// CESMRViewerDetailedSubjectField::ListObserverSet |
|
338 |
// --------------------------------------------------------------------------- |
|
339 |
// |
|
340 |
void CESMRViewerDetailedSubjectField::ListObserverSet() |
|
341 |
{ |
|
342 |
FUNC_LOG; |
|
343 |
iRichTextViewer->SetListObserver( iObserver ); |
|
344 |
} |
|
345 |
||
346 |
// --------------------------------------------------------------------------- |
|
347 |
// CESMRViewerDetailedSubjectField::ExecuteGenericCommandL() |
|
348 |
// --------------------------------------------------------------------------- |
|
349 |
// |
|
350 |
TBool CESMRViewerDetailedSubjectField::ExecuteGenericCommandL( TInt aCommand ) |
|
351 |
{ |
|
352 |
FUNC_LOG; |
|
353 |
TBool isUsed( EFalse ); |
|
354 |
if (aCommand == EESMRCmdClipboardCopy) |
|
355 |
{ |
|
356 |
iRichTextViewer->CopyCurrentLinkToClipBoardL(); |
|
357 |
isUsed = ETrue; |
|
358 |
} |
|
359 |
else if ( aCommand == EAknSoftkeySelect ) |
|
360 |
{ |
|
361 |
iRichTextViewer->LinkSelectedL(); |
|
362 |
isUsed = ETrue; |
|
363 |
} |
|
364 |
else if ( aCommand == EAknCmdOpen ) |
|
365 |
{ |
|
366 |
if ( IsLocked() ) |
|
367 |
{ |
|
368 |
HandleTactileFeedbackL(); |
|
369 |
||
370 |
CESMRGlobalNote::ExecuteL( |
|
371 |
CESMRGlobalNote::EESMRUnableToEdit ); |
|
372 |
isUsed = ETrue; |
|
373 |
} |
|
374 |
} |
|
375 |
return isUsed; |
|
376 |
} |
|
377 |
||
378 |
// --------------------------------------------------------------------------- |
|
379 |
// CESMRViewerDetailedSubjectField::SetOutlineFocusL() |
|
380 |
// --------------------------------------------------------------------------- |
|
381 |
// |
|
382 |
void CESMRViewerDetailedSubjectField::SetOutlineFocusL( TBool aFocus ) |
|
383 |
{ |
|
384 |
FUNC_LOG; |
|
385 |
CESMRField::SetOutlineFocusL ( aFocus ); |
|
386 |
iRichTextViewer->SetFocus( aFocus ); |
|
387 |
||
388 |
if( aFocus ) |
|
389 |
{ |
|
390 |
SetMiddleSoftkeyL(); |
|
391 |
} |
|
392 |
||
393 |
else |
|
394 |
{ |
|
395 |
//need to tell action menu that focus has changed |
|
396 |
iRichTextViewer->ResetActionMenuL(); |
|
397 |
} |
|
398 |
} |
|
399 |
||
400 |
// --------------------------------------------------------------------------- |
|
401 |
// CESMRViewerDetailedSubjectField::GetCursorLineVerticalPos |
|
402 |
// --------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
void CESMRViewerDetailedSubjectField::GetCursorLineVerticalPos( |
|
405 |
TInt& aUpper, |
|
406 |
TInt& aLower ) |
|
407 |
{ |
|
408 |
FUNC_LOG; |
|
409 |
||
410 |
aLower = iRichTextViewer->CurrentLineNumber() * iRichTextViewer->RowHeight(); |
|
411 |
aUpper = aLower - iRichTextViewer->RowHeight(); |
|
412 |
} |
|
413 |
||
414 |
// --------------------------------------------------------------------------- |
|
415 |
// CESMRViewerDetailedSubjectField::HandleLongtapEventL |
|
416 |
// --------------------------------------------------------------------------- |
|
417 |
// |
|
418 |
void CESMRViewerDetailedSubjectField::HandleLongtapEventL( |
|
419 |
const TPoint& aPosition ) |
|
420 |
{ |
|
421 |
FUNC_LOG; |
|
422 |
||
423 |
if ( iRichTextViewer->Rect().Contains( aPosition ) ) |
|
424 |
{ |
|
425 |
iRichTextViewer->LinkSelectedL(); |
|
426 |
} |
|
427 |
} |
|
428 |
||
429 |
// --------------------------------------------------------------------------- |
|
430 |
// CESMRViewerDetailedSubjectField::LockL |
|
431 |
// --------------------------------------------------------------------------- |
|
432 |
// |
|
433 |
void CESMRViewerDetailedSubjectField::LockL() |
|
434 |
{ |
|
435 |
FUNC_LOG; |
|
436 |
if( IsLocked() ) |
|
437 |
{ |
|
438 |
return; |
|
439 |
} |
|
440 |
||
441 |
CESMRField::LockL(); |
|
442 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
443 |
if( !iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
444 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
445 |
delete iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
446 |
iPriorityIcon = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
447 |
iPriorityIcon = CMRImage::NewL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
448 |
NMRBitmapManager::EMRBitmapLockField, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
449 |
this, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
450 |
ETrue ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
451 |
} |
64 | 452 |
} |
453 |
||
454 |
// --------------------------------------------------------------------------- |
|
455 |
// CESMRViewerDetailedSubjectField::SetMiddleSoftkeyL |
|
456 |
// --------------------------------------------------------------------------- |
|
457 |
// |
|
458 |
void CESMRViewerDetailedSubjectField::SetMiddleSoftkeyL() |
|
459 |
{ |
|
460 |
FUNC_LOG; |
|
461 |
const CESMRRichTextLink* link = iRichTextViewer->GetSelectedLink(); |
|
462 |
if( link ) |
|
463 |
{ |
|
464 |
if ( ( link->Type() == CESMRRichTextLink::ETypeURL ) || |
|
465 |
( link->Type() == CESMRRichTextLink::ETypeEmail ) || |
|
466 |
( link->Type() == CESMRRichTextLink::ETypePhoneNumber ) ) |
|
467 |
{ |
|
468 |
SetMiddleSoftKeyVisible( ETrue ); |
|
469 |
} |
|
470 |
else |
|
471 |
{ |
|
472 |
RestoreMiddleSoftKeyL(); |
|
473 |
} |
|
474 |
} |
|
475 |
} |
|
476 |
||
477 |
||
478 |
// --------------------------------------------------------------------------- |
|
479 |
// CESMRViewerDetailedSubjectField::HandleRichTextLinkSelection |
|
480 |
// --------------------------------------------------------------------------- |
|
481 |
// |
|
482 |
TBool CESMRViewerDetailedSubjectField::HandleRichTextLinkSelection( |
|
483 |
const CESMRRichTextLink* /*aLink*/ ) |
|
484 |
{ |
|
485 |
TBool result = EFalse; |
|
486 |
||
487 |
// No implementation yet: waiting for UI spec. |
|
488 |
||
489 |
return result; |
|
490 |
} |
|
491 |
||
492 |
// --------------------------------------------------------------------------- |
|
493 |
// CESMRViewerDetailedSubjectField::CountComponentControls |
|
494 |
// --------------------------------------------------------------------------- |
|
495 |
// |
|
496 |
TInt CESMRViewerDetailedSubjectField::CountComponentControls() const |
|
497 |
{ |
|
498 |
TInt count( 0 ); |
|
499 |
if ( iFieldIcon ) |
|
500 |
{ |
|
501 |
++count; |
|
502 |
} |
|
503 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
504 |
if ( iPriorityIcon ) |
64 | 505 |
{ |
506 |
++count; |
|
507 |
} |
|
508 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
509 |
if ( iRichTextViewer ) |
64 | 510 |
{ |
511 |
++count; |
|
512 |
} |
|
513 |
||
514 |
return count; |
|
515 |
} |
|
516 |
||
517 |
// --------------------------------------------------------------------------- |
|
518 |
// CESMRViewerDetailedSubjectField::ComponentControl |
|
519 |
// --------------------------------------------------------------------------- |
|
520 |
// |
|
521 |
CCoeControl* CESMRViewerDetailedSubjectField::ComponentControl( |
|
522 |
TInt aIndex ) const |
|
523 |
{ |
|
524 |
switch ( aIndex ) |
|
525 |
{ |
|
526 |
case 0: |
|
527 |
return iFieldIcon; |
|
528 |
case 1: |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
529 |
return iPriorityIcon; |
64 | 530 |
case 2: |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
531 |
return iRichTextViewer; |
64 | 532 |
|
533 |
default: |
|
534 |
return NULL; |
|
535 |
} |
|
536 |
} |
|
537 |
||
538 |
// --------------------------------------------------------------------------- |
|
539 |
// CESMRViewerDetailedSubjectField::SizeChanged |
|
540 |
// --------------------------------------------------------------------------- |
|
541 |
// |
|
542 |
void CESMRViewerDetailedSubjectField::SizeChanged( ) |
|
543 |
{ |
|
544 |
// Store iRichTextViewer original width. |
|
545 |
TInt richTextViewerWidth = iRichTextViewer->Size().iWidth; |
|
546 |
TRect rect( Rect() ); |
|
547 |
||
548 |
TAknLayoutRect rowLayoutRect( |
|
549 |
NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) ); |
|
550 |
TRect rowRect( rowLayoutRect.Rect() ); |
|
551 |
||
552 |
// Layouting field icon |
|
553 |
if( iFieldIcon ) |
|
554 |
{ |
|
555 |
TAknWindowComponentLayout iconLayout( |
|
556 |
NMRLayoutManager::GetWindowComponentLayout( |
|
557 |
NMRLayoutManager::EMRLayoutSingleRowAColumnGraphic ) ); |
|
558 |
AknLayoutUtils::LayoutControl( iFieldIcon, rowRect, iconLayout ); |
|
559 |
} |
|
560 |
||
561 |
// Layouting priority icon |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
562 |
if( iPriorityIcon && ( IsLocked() || iCurrentPriority != EFSCalenMRPriorityNormal ) ) |
64 | 563 |
{ |
564 |
TAknWindowComponentLayout iconLayout( |
|
565 |
NMRLayoutManager::GetWindowComponentLayout( |
|
566 |
NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) ); |
|
567 |
AknLayoutUtils::LayoutImage( iPriorityIcon, rowRect, iconLayout ); |
|
568 |
} |
|
569 |
||
570 |
TAknLayoutText viewerLayoutText; |
|
571 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
572 |
if( iPriorityIcon && ( IsLocked() || iCurrentPriority != EFSCalenMRPriorityNormal ) ) |
64 | 573 |
{ |
574 |
viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect, |
|
575 |
NMRLayoutManager::EMRTextLayoutSingleRowEditorText ); |
|
576 |
} |
|
577 |
else |
|
578 |
{ |
|
579 |
viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect, |
|
580 |
NMRLayoutManager::EMRTextLayoutTextEditor ); |
|
581 |
} |
|
582 |
||
583 |
// Layouting viewer field |
|
584 |
TRect viewerRect( viewerLayoutText.TextRect() ); |
|
585 |
||
586 |
// Resize height according to actual height required by edwin. |
|
587 |
viewerRect.Resize( 0, iSize.iHeight - viewerRect.Height() ); |
|
588 |
iRichTextViewer->SetRect( viewerRect ); |
|
589 |
||
590 |
// Layouting focus |
|
591 |
TRect bgRect( viewerRect ); |
|
592 |
||
593 |
// Move focus rect so that it's relative to field's position. |
|
594 |
bgRect.Move( -Position() ); |
|
595 |
SetFocusRect( bgRect ); |
|
596 |
||
597 |
// Failures are ignored. |
|
598 |
TRAP_IGNORE( |
|
599 |
// Try setting font |
|
600 |
iRichTextViewer->SetFontL( viewerLayoutText.Font() ); |
|
601 |
// Try applying changes |
|
602 |
iRichTextViewer->ApplyLayoutChangesL(); |
|
603 |
); |
|
604 |
||
605 |
if ( iRichTextViewer->Size().iWidth != richTextViewerWidth ) |
|
606 |
{ |
|
607 |
// Most of this case is screen orientation, in this case we need to |
|
608 |
// Record the index of focusing link, after updating link array, then |
|
609 |
// reset the focusing to original one. |
|
610 |
TInt focusingIndex = iRichTextViewer->GetFocusLink(); |
|
611 |
if ( KErrNotFound != focusingIndex ) |
|
612 |
{ |
|
613 |
iRichTextViewer->SetFocusLink( focusingIndex ); |
|
614 |
//wake up current contact menu selection by calling this |
|
615 |
iRichTextViewer->FocusChanged(ENoDrawNow); |
|
616 |
} |
|
617 |
} |
|
618 |
} |
|
619 |
||
620 |
// --------------------------------------------------------------------------- |
|
621 |
// CESMRViewerDetailedSubjectField::SupportsLongTapFunctionalityL |
|
622 |
// --------------------------------------------------------------------------- |
|
623 |
// |
|
624 |
TBool CESMRViewerDetailedSubjectField::SupportsLongTapFunctionalityL( |
|
625 |
const TPointerEvent &aPointerEvent ) |
|
626 |
{ |
|
627 |
FUNC_LOG; |
|
628 |
TBool ret( EFalse ); |
|
629 |
||
630 |
if ( iRichTextViewer->Rect().Contains( aPointerEvent.iPosition ) ) |
|
631 |
{ |
|
632 |
if( iRichTextViewer->PointerEventOccuresOnALinkL( aPointerEvent ) ) |
|
633 |
{ |
|
634 |
ret = ETrue; |
|
635 |
} |
|
636 |
} |
|
637 |
||
638 |
return ret; |
|
639 |
} |
|
640 |
||
641 |
//EOF |