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: ESMR UI Container class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "cesmrview.h" |
|
19 |
#include "mesmrmeetingrequestentry.h" |
|
20 |
#include "esmrinternaluid.h" |
|
21 |
#include "cesmrtitlepane.h" |
|
22 |
#include "cesmrfield.h" |
|
23 |
#include "mesmrcalentry.h" |
|
24 |
#include "nmrlayoutmanager.h" |
|
25 |
#include "mesmrfieldstorage.h" |
|
26 |
#include "FreestyleEmailUiConstants.h" |
|
27 |
#include "cesmrcaldbmgr.h" |
|
28 |
#include "mmrfocusstrategy.h" |
|
29 |
#include "cmrnaviarrow.h" |
|
30 |
#include "mesmrlistobserver.h" |
|
31 |
#include "cmrtoolbar.h" |
|
32 |
#include "cmrattachmentindicator.h" |
|
33 |
#include "esmrdef.h" |
|
34 |
#include "mesmrfieldevent.h" |
|
35 |
#include "cesmrgenericfieldevent.h" |
|
36 |
||
37 |
#include <eiklabel.h> |
|
38 |
#include <avkon.hrh> |
|
39 |
#include <MAgnEntryUi.h> |
|
40 |
#include <StringLoader.h> |
|
41 |
#include <gulcolor.h> |
|
42 |
#include <eikimage.h> |
|
43 |
#include <esmrgui.rsg> |
|
44 |
#include <AknIconUtils.h> |
|
45 |
#include <eikenv.h> |
|
46 |
#include <AknsConstants.h> |
|
47 |
#include <AknUtils.h> |
|
48 |
#include <AknsDrawUtils.h> |
|
49 |
#include <AknsBasicBackgroundControlContext.h> |
|
50 |
#include <hlplch.h> |
|
51 |
#include <csxhelp/cmail.hlp.hrh> |
|
52 |
#include <touchfeedback.h> |
|
53 |
#include <akntoolbar.h> |
|
54 |
#include <eikcolib.h> |
|
55 |
#include <featdiscovery.h> |
|
56 |
#include <bldvariant.hrh> |
|
57 |
#include <layoutmetadata.cdl.h> |
|
58 |
||
59 |
#include "emailtrace.h" |
|
60 |
||
61 |
// ======== MEMBER FUNCTIONS ======== |
|
62 |
||
63 |
// --------------------------------------------------------------------------- |
|
64 |
// CESMRView::CESMRView() |
|
65 |
// --------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
CESMRView::CESMRView( MESMRFieldStorage* aStorage, |
|
68 |
MESMRCalEntry& aEntry, |
|
69 |
MMRFocusStrategy& aFocusStrategy, |
|
70 |
MESMRNaviArrowEventObserver* aObserver, |
|
71 |
CMRToolbar& aToolbar ) |
|
72 |
: iStorage( aStorage ), |
|
73 |
iEntry( &aEntry ), |
|
74 |
iFocusStrategy( aFocusStrategy ), |
|
75 |
iObserver( aObserver ), |
|
76 |
iToolbar( aToolbar ) |
|
77 |
{ |
|
78 |
FUNC_LOG; |
|
79 |
// Do nothing |
|
80 |
} |
|
81 |
||
82 |
// --------------------------------------------------------------------------- |
|
83 |
// CESMRView::NewL() |
|
84 |
// --------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
CESMRView* CESMRView::NewL( |
|
87 |
MESMRFieldStorage* aStorage, |
|
88 |
MESMRCalEntry& aEntry, |
|
89 |
const TRect& aRect, |
|
90 |
MMRFocusStrategy& aFocusStrategy, |
|
91 |
CMRToolbar& aToolbar, |
|
92 |
MESMRNaviArrowEventObserver* aObserver ) |
|
93 |
{ |
|
94 |
FUNC_LOG; |
|
95 |
CESMRView* self = new (ELeave) CESMRView( |
|
96 |
aStorage, aEntry, aFocusStrategy, aObserver, aToolbar ); |
|
97 |
CleanupStack::PushL( self ); |
|
98 |
self->ConstructL( aRect ); |
|
99 |
CleanupStack::Pop( self ); |
|
100 |
return self; |
|
101 |
} |
|
102 |
||
103 |
// --------------------------------------------------------------------------- |
|
104 |
// CESMRView::ConstructL() |
|
105 |
// --------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
void CESMRView::ConstructL( const TRect& aRect ) |
|
108 |
{ |
|
109 |
FUNC_LOG; |
|
110 |
CreateWindowL(); |
|
111 |
SetRect( aRect ); |
|
112 |
} |
|
113 |
||
114 |
// --------------------------------------------------------------------------- |
|
115 |
// CESMRView::~CESMRView() |
|
116 |
// --------------------------------------------------------------------------- |
|
117 |
// |
|
118 |
CESMRView::~CESMRView() |
|
119 |
{ |
|
120 |
FUNC_LOG; |
|
121 |
delete iListPane; |
|
122 |
delete iBgContext; |
|
123 |
delete iNaviArrowLeft; |
|
124 |
delete iNaviArrowRight; |
|
125 |
delete iScrollBar; |
|
126 |
delete iStorage; |
|
127 |
} |
|
128 |
||
129 |
// --------------------------------------------------------------------------- |
|
130 |
// CESMRView::ExternalizeL() |
|
131 |
// --------------------------------------------------------------------------- |
|
132 |
// |
|
133 |
void CESMRView::ExternalizeL( TBool aForceValidation ) |
|
134 |
{ |
|
135 |
FUNC_LOG; |
|
136 |
// externalize all fields: |
|
137 |
iListPane->ExternalizeL( *iEntry, aForceValidation ); |
|
138 |
} |
|
139 |
||
140 |
// --------------------------------------------------------------------------- |
|
141 |
// CESMRView::InternalizeL() |
|
142 |
// --------------------------------------------------------------------------- |
|
143 |
// |
|
144 |
void CESMRView::InternalizeL() |
|
145 |
{ |
|
146 |
FUNC_LOG; |
|
147 |
iListPane->DisableSizeChange( ETrue ); |
|
148 |
// internalize all fields: |
|
149 |
iListPane->InternalizeL( *iEntry ); |
|
150 |
iListPane->DisableSizeChange( EFalse ); |
|
151 |
iListPane->SizeChanged(); |
|
152 |
} |
|
153 |
||
154 |
// --------------------------------------------------------------------------- |
|
155 |
// CESMRView::IsControlVisible() |
|
156 |
// --------------------------------------------------------------------------- |
|
157 |
// |
|
158 |
TBool CESMRView::IsControlVisible( TESMREntryFieldId aFieldId ) const |
|
159 |
{ |
|
160 |
FUNC_LOG; |
|
161 |
return iListPane->IsControlVisible( aFieldId ); |
|
162 |
} |
|
163 |
||
164 |
// --------------------------------------------------------------------------- |
|
165 |
// CESMRView::ProcessCommandL |
|
166 |
// --------------------------------------------------------------------------- |
|
167 |
// |
|
168 |
void CESMRView::ProcessEditorCommandL( TInt aCommand ) |
|
169 |
{ |
|
170 |
FUNC_LOG; |
|
171 |
switch ( aCommand ) |
|
172 |
{ |
|
173 |
case EESMRCmdPriorityHigh: // Fall through |
|
174 |
case EESMRCmdPriorityNormal: // Fall through |
|
175 |
case EESMRCmdPriorityLow: |
|
176 |
{ |
|
177 |
CESMRField* field = iStorage->FieldById( EESMRFieldSubject ); |
|
178 |
if ( field ) |
|
179 |
{ |
|
180 |
field->ExecuteGenericCommandL( |
|
181 |
aCommand ); |
|
182 |
iListPane->SizeChanged(); |
|
183 |
} |
|
184 |
break; |
|
185 |
} |
|
186 |
case EESMRCmdAddOptAttendee: |
|
187 |
{ |
|
188 |
iListPane->ShowControl( EESMRFieldOptAttendee ); |
|
189 |
SetControlFocusedL( EESMRFieldOptAttendee ); |
|
190 |
break; |
|
191 |
} |
|
192 |
case EAknCmdHelp: |
|
193 |
{ |
|
194 |
break; |
|
195 |
} |
|
196 |
case EMRCmdHideAttachmentIndicator: |
|
197 |
{ |
|
198 |
if ( iAttachmentIndicator ) |
|
199 |
{ |
|
200 |
TInt pos = iControls.Find( iAttachmentIndicator ); |
|
201 |
if (KErrNotFound != pos ) |
|
202 |
{ |
|
203 |
iControls.Remove( pos ); |
|
204 |
} |
|
205 |
||
206 |
delete iAttachmentIndicator; |
|
207 |
iAttachmentIndicator = NULL; |
|
208 |
||
209 |
SizeChanged(); |
|
210 |
} |
|
211 |
} |
|
212 |
break; |
|
213 |
default://forward to fields |
|
214 |
{ |
|
215 |
iListPane->FocusedField()->ExecuteGenericCommandL( aCommand ); |
|
216 |
break; |
|
217 |
} |
|
218 |
} |
|
219 |
} |
|
220 |
||
221 |
// --------------------------------------------------------------------------- |
|
222 |
// CESMRView::LaunchEditorHelpL |
|
223 |
// --------------------------------------------------------------------------- |
|
224 |
// |
|
225 |
void CESMRView::LaunchEditorHelpL() |
|
226 |
{ |
|
227 |
FUNC_LOG; |
|
228 |
||
229 |
switch ( iEntry->Type() ) |
|
230 |
{ |
|
231 |
case MESMRCalEntry::EESMRCalEntryTodo: |
|
232 |
{ |
|
233 |
LaunchHelpL( KFSCA_HLP_TODO_EDITOR ); |
|
234 |
break; |
|
235 |
} |
|
236 |
case MESMRCalEntry::EESMRCalEntryMemo: |
|
237 |
{ |
|
238 |
LaunchHelpL( KFSCA_HLP_MEMO_EDITOR ); |
|
239 |
break; |
|
240 |
} |
|
241 |
case MESMRCalEntry::EESMRCalEntryAnniversary: |
|
242 |
{ |
|
243 |
LaunchHelpL( KFSCA_HLP_ANNIVERSARY_EDITOR ); |
|
244 |
break; |
|
245 |
} |
|
246 |
case MESMRCalEntry::EESMRCalEntryMeeting: |
|
247 |
{ |
|
248 |
LaunchHelpL( KFSCA_HLP_CALE_MEETING_EDITOR ); |
|
249 |
break; |
|
250 |
} |
|
251 |
case MESMRCalEntry::EESMRCalEntryMeetingRequest: |
|
252 |
{ |
|
253 |
LaunchHelpL( KMEET_REQ_HLP_EDITOR ); |
|
254 |
break; |
|
255 |
} |
|
256 |
case MESMRCalEntry::EESMRCalEntryReminder: // Fall through |
|
257 |
default: |
|
258 |
{ |
|
259 |
break; |
|
260 |
} |
|
261 |
} |
|
262 |
||
263 |
} |
|
264 |
||
265 |
// --------------------------------------------------------------------------- |
|
266 |
// CESMRView::LaunchViewerHelpL |
|
267 |
// --------------------------------------------------------------------------- |
|
268 |
// |
|
269 |
void CESMRView::LaunchViewerHelpL() |
|
270 |
{ |
|
271 |
FUNC_LOG; |
|
272 |
||
273 |
||
274 |
switch ( iEntry->Type() ) |
|
275 |
{ |
|
276 |
case MESMRCalEntry::EESMRCalEntryTodo: |
|
277 |
{ |
|
278 |
LaunchHelpL( KFSCA_HLP_TODO_VIEWER ); |
|
279 |
break; |
|
280 |
} |
|
281 |
case MESMRCalEntry::EESMRCalEntryMemo: |
|
282 |
{ |
|
283 |
LaunchHelpL( KFSCA_HLP_MEMO_VIEWER ); |
|
284 |
break; |
|
285 |
} |
|
286 |
case MESMRCalEntry::EESMRCalEntryAnniversary: |
|
287 |
{ |
|
288 |
LaunchHelpL( KFSCA_HLP_ANNI_VIEWER ); |
|
289 |
break; |
|
290 |
} |
|
291 |
case MESMRCalEntry::EESMRCalEntryMeeting: |
|
292 |
{ |
|
293 |
LaunchHelpL( KFSCA_HLP_CALE_MEETING_VIEWER ); |
|
294 |
break; |
|
295 |
} |
|
296 |
case MESMRCalEntry::EESMRCalEntryMeetingRequest: |
|
297 |
{ |
|
298 |
MESMRMeetingRequestEntry* mrEntry = |
|
299 |
static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
|
300 |
||
301 |
if ( mrEntry->IsOpenedFromMail() ) |
|
302 |
{ |
|
303 |
if ( CFeatureDiscovery::IsFeatureSupportedL( |
|
304 |
TUid::Uid( KFeatureIdFfCalMeetingRequestUi ) ) ) |
|
305 |
{ |
|
306 |
// Full functionality |
|
307 |
LaunchHelpL( KFS_VIEWER_HLP_MEETING_REQ_VIEW ); |
|
308 |
} |
|
309 |
else |
|
310 |
{ |
|
311 |
// Only viewer from Mail supported |
|
312 |
LaunchHelpL( KFS_VIEWER_HLP_MR_RECEIVED ); |
|
313 |
} |
|
314 |
} |
|
315 |
else if ( mrEntry->RoleL() == EESMRRoleOrganizer ) |
|
316 |
{ |
|
317 |
LaunchHelpL( KFSCA_HLP_VIEWER_ORGANIZER ); |
|
318 |
} |
|
319 |
else |
|
320 |
{ |
|
321 |
LaunchHelpL( KFSCA_HLP_VIEWER ); |
|
322 |
} |
|
323 |
break; |
|
324 |
} |
|
325 |
case MESMRCalEntry::EESMRCalEntryReminder: // Fall through |
|
326 |
default: |
|
327 |
{ |
|
328 |
break; |
|
329 |
} |
|
330 |
} |
|
331 |
||
332 |
} |
|
333 |
||
334 |
// --------------------------------------------------------------------------- |
|
335 |
// CESMRView::IsComponentfocused |
|
336 |
// --------------------------------------------------------------------------- |
|
337 |
// |
|
338 |
TBool CESMRView::IsComponentFocused( TESMREntryFieldId aField ) const |
|
339 |
{ |
|
340 |
FUNC_LOG; |
|
341 |
return FocusedField() == aField; |
|
342 |
} |
|
343 |
||
344 |
// --------------------------------------------------------------------------- |
|
345 |
// CESMRView::FocusedField |
|
346 |
// --------------------------------------------------------------------------- |
|
347 |
// |
|
348 |
TESMREntryFieldId CESMRView::FocusedField() const |
|
349 |
{ |
|
350 |
FUNC_LOG; |
|
351 |
TESMREntryFieldId fieldId( ( TESMREntryFieldId ) 0 ); |
|
352 |
||
353 |
CESMRField* field = iListPane->FocusedField(); |
|
354 |
||
355 |
if ( field ) |
|
356 |
{ |
|
357 |
fieldId = field->FieldId(); |
|
358 |
} |
|
359 |
||
360 |
return fieldId; |
|
361 |
} |
|
362 |
||
363 |
// --------------------------------------------------------------------------- |
|
364 |
// CESMRView::ClickedOrFocusedField |
|
365 |
// --------------------------------------------------------------------------- |
|
366 |
// |
|
367 |
TESMREntryFieldId CESMRView::ClickedOrFocusedField() const |
|
368 |
{ |
|
369 |
FUNC_LOG; |
|
370 |
TESMREntryFieldId fieldId( ( TESMREntryFieldId ) 0 ); |
|
371 |
||
372 |
// Get clicked item if exists |
|
373 |
CESMRField* field = iListPane->ClickedField(); |
|
374 |
||
375 |
if ( field ) |
|
376 |
{ |
|
377 |
fieldId = field->FieldId(); |
|
378 |
} |
|
379 |
// If doesn't, try getting focused item |
|
380 |
else |
|
381 |
{ |
|
382 |
field = iListPane->FocusedField(); |
|
383 |
if( field ) |
|
384 |
{ |
|
385 |
fieldId = FocusedField(); |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |
return fieldId; |
|
390 |
} |
|
391 |
||
392 |
// --------------------------------------------------------------------------- |
|
393 |
// CESMRView::AdjustViewL |
|
394 |
// --------------------------------------------------------------------------- |
|
395 |
// |
|
396 |
void CESMRView::AdjustViewL( |
|
397 |
MESMRCalEntry* aNewEntry, |
|
398 |
const CESMRPolicy& aNewPolicy ) |
|
399 |
{ |
|
400 |
iStorage->ChangePolicyL( aNewPolicy,*aNewEntry ); |
|
401 |
iEntry = aNewEntry; |
|
402 |
iListPane->InitializeL(); |
|
403 |
iListPane->ReActivateL(); |
|
404 |
InternalizeL(); |
|
405 |
SetControlFocusedL( EESMRFieldUnifiedEditor ); |
|
406 |
SetTitlePaneObserver(); |
|
407 |
DrawDeferred(); |
|
408 |
} |
|
409 |
||
410 |
// --------------------------------------------------------------------------- |
|
411 |
// CESMRView::LaunchHelpL |
|
412 |
// --------------------------------------------------------------------------- |
|
413 |
// |
|
414 |
void CESMRView::LaunchHelpL( const TDesC& aContext ) |
|
415 |
{ |
|
416 |
FUNC_LOG; |
|
417 |
||
418 |
CArrayFix<TCoeHelpContext>* cntx = |
|
419 |
new (ELeave) CArrayFixFlat<TCoeHelpContext>(1); |
|
420 |
CleanupStack::PushL(cntx); |
|
421 |
cntx->AppendL( TCoeHelpContext( KFSEmailUiUid, aContext ) ); |
|
422 |
CleanupStack::Pop(cntx); |
|
423 |
HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), cntx ); |
|
424 |
} |
|
425 |
||
426 |
||
427 |
// --------------------------------------------------------------------------- |
|
428 |
// CESMRView::SetTitlePaneObserver |
|
429 |
// --------------------------------------------------------------------------- |
|
430 |
// |
|
431 |
void CESMRView::SetTitlePaneObserver() |
|
432 |
{ |
|
433 |
CESMRField* field = NULL; |
|
434 |
TInt fieldCount( iStorage->Count() ); |
|
435 |
for ( TInt i(0); i < fieldCount; ++i ) |
|
436 |
{ |
|
437 |
field = iStorage->Field( i ); |
|
438 |
TESMREntryFieldId fieldId( field->FieldId() ); |
|
439 |
||
440 |
switch( fieldId ) |
|
441 |
{ |
|
442 |
case EESMRFieldSubject: //Fall through |
|
443 |
case EESMRFieldOccasion://Fall through |
|
444 |
case EESMRFieldPriority://Fall through |
|
445 |
case EESMRFieldDetailedSubject: |
|
446 |
{ |
|
447 |
field->SetTitlePaneObserver( this ); |
|
448 |
break; |
|
449 |
} |
|
450 |
default: |
|
451 |
break; |
|
452 |
} |
|
453 |
} |
|
454 |
} |
|
455 |
||
456 |
// --------------------------------------------------------------------------- |
|
457 |
// CESMRView::UpdateTitlePaneTextL |
|
458 |
// --------------------------------------------------------------------------- |
|
459 |
// |
|
460 |
void CESMRView::UpdateTitlePaneTextL( const TDesC& aText ) |
|
461 |
{ |
|
462 |
FUNC_LOG; |
|
463 |
SetTitleL( aText ); |
|
464 |
} |
|
465 |
||
466 |
// --------------------------------------------------------------------------- |
|
467 |
// CESMRView::HandleScrollEventL |
|
468 |
// --------------------------------------------------------------------------- |
|
469 |
// |
|
470 |
void CESMRView::HandleScrollEventL( |
|
471 |
CEikScrollBar* aScrollBar, |
|
472 |
TEikScrollEvent aEventType ) |
|
473 |
{ |
|
474 |
FUNC_LOG; |
|
475 |
||
476 |
if ( !aScrollBar ) |
|
477 |
{ |
|
478 |
return; |
|
479 |
} |
|
480 |
||
481 |
TInt newPosition = aScrollBar->ThumbPosition(); |
|
482 |
||
483 |
switch( aEventType ) |
|
484 |
{ |
|
485 |
case EEikScrollThumbDragVert: // Drag started |
|
486 |
case EEikScrollThumbReleaseVert: // Drag released |
|
487 |
{ |
|
488 |
if( newPosition < iScrollBarThumbPosition ) |
|
489 |
{ |
|
490 |
iListPane->ScrollFieldsDown( |
|
491 |
iScrollBarThumbPosition - newPosition ); |
|
492 |
||
493 |
iScrollBarThumbPosition = newPosition; |
|
494 |
} |
|
495 |
||
496 |
else if( newPosition > iScrollBarThumbPosition ) |
|
497 |
{ |
|
498 |
iListPane->ScrollFieldsUp( |
|
499 |
newPosition - iScrollBarThumbPosition ); |
|
500 |
||
501 |
iScrollBarThumbPosition = newPosition; |
|
502 |
} |
|
503 |
break; |
|
504 |
} |
|
505 |
case EEikScrollPageUp: |
|
506 |
{ |
|
507 |
if( newPosition < iScrollBarThumbPosition ) |
|
508 |
{ |
|
509 |
iListPane->ScrollFieldsDown( |
|
510 |
iScrollBarThumbPosition - newPosition ); |
|
511 |
||
512 |
iScrollBarThumbPosition = newPosition; |
|
513 |
} |
|
514 |
break; |
|
515 |
} |
|
516 |
case EEikScrollPageDown: |
|
517 |
{ |
|
518 |
if( newPosition > iScrollBarThumbPosition ) |
|
519 |
{ |
|
520 |
iListPane->ScrollFieldsUp( |
|
521 |
newPosition - iScrollBarThumbPosition ); |
|
522 |
||
523 |
iScrollBarThumbPosition = newPosition; |
|
524 |
} |
|
525 |
break; |
|
526 |
} |
|
527 |
default: |
|
528 |
{ |
|
529 |
break; |
|
530 |
} |
|
531 |
} |
|
532 |
||
533 |
DrawNow(); |
|
534 |
} |
|
535 |
||
536 |
// --------------------------------------------------------------------------- |
|
537 |
// CESMRView::ScrollBarPositionChanged() |
|
538 |
// --------------------------------------------------------------------------- |
|
539 |
// |
|
540 |
void CESMRView::ScrollBarPositionChanged( TInt aThumbPosition ) |
|
541 |
{ |
|
542 |
FUNC_LOG; |
|
543 |
iScrollBarThumbPosition = aThumbPosition; |
|
544 |
} |
|
545 |
||
546 |
// --------------------------------------------------------------------------- |
|
547 |
// CESMRView::SetContainerWindowL |
|
548 |
// --------------------------------------------------------------------------- |
|
549 |
// |
|
550 |
void CESMRView::SetContainerWindowL( const CCoeControl& aContainer ) |
|
551 |
{ |
|
552 |
FUNC_LOG; |
|
553 |
CCoeControl::SetContainerWindowL( aContainer ); |
|
554 |
||
555 |
/** |
|
556 |
* Somehow if list is constructed before this SetContainerWindowL is called, |
|
557 |
* all redraws throws KERN-EXEC 3 (the CCoeControl's iWin variable is NULL) |
|
558 |
*/ |
|
559 |
||
560 |
iScrollBar = new (ELeave) CAknDoubleSpanScrollBar( this ); |
|
561 |
iScrollBar->ConstructL( EFalse, this, this, CEikScrollBar::EVertical, 0 ); |
|
562 |
iScrollBar->SetModel( &iScrollBarModel ); |
|
563 |
iScrollBar->MakeVisible( ETrue ); |
|
564 |
||
565 |
iControls.AppendL( iScrollBar ); |
|
566 |
||
567 |
iListPane = CMRListPane::NewL( |
|
568 |
*this, |
|
569 |
*iStorage, |
|
570 |
iScrollBarModel, |
|
571 |
*iScrollBar, |
|
572 |
*this ); |
|
573 |
||
574 |
iControls.AppendL( iListPane ); |
|
575 |
||
576 |
iListPane->SetBackground( this ); |
|
577 |
||
578 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
579 |
KAknsIIDQsnBgAreaMain, Rect(), ETrue ); |
|
580 |
||
581 |
if( iEntry ) |
|
582 |
{ |
|
583 |
MESMRCalDbMgr& dbMgr = iEntry->GetDBMgr(); |
|
584 |
dbMgr.SetCurCalendarByEntryL( *iEntry ); |
|
585 |
} |
|
586 |
||
587 |
// Physics: enable needed pointer events |
|
588 |
EnableDragEvents(); |
|
589 |
ClaimPointerGrab(); |
|
590 |
||
591 |
// Initialize the focus |
|
592 |
iFocusStrategy.InitializeFocus(); |
|
593 |
||
594 |
if( iEntry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
595 |
{ |
|
596 |
// Static cast is safe here. We know for sure that entry is MR |
|
597 |
MESMRMeetingRequestEntry* mrEntry = |
|
598 |
static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
|
599 |
if ( mrEntry->IsOpenedFromMail() ) |
|
600 |
{ |
|
601 |
TAknLayoutRect naviArrowRightLayoutRect = |
|
602 |
NMRLayoutManager::GetLayoutRect( Rect(), |
|
603 |
NMRLayoutManager::EMRLayoutMRNaviArrowRight ); |
|
604 |
TRect naviArrowRect( naviArrowRightLayoutRect.Rect() ); |
|
605 |
||
606 |
iNaviArrowLeft = CMRNaviArrow::NewL( |
|
607 |
this, |
|
608 |
CMRNaviArrow::EMRArrowLeft, |
|
609 |
iObserver, |
|
610 |
naviArrowRect.Size() ); |
|
611 |
||
612 |
iNaviArrowRight = CMRNaviArrow::NewL( |
|
613 |
this, |
|
614 |
CMRNaviArrow::EMRArrowRight, |
|
615 |
iObserver, |
|
616 |
naviArrowRect.Size() ); |
|
617 |
||
618 |
iControls.AppendL( iNaviArrowLeft ); |
|
619 |
iControls.AppendL( iNaviArrowRight ); |
|
620 |
} |
|
621 |
} |
|
622 |
} |
|
623 |
||
624 |
// --------------------------------------------------------------------------- |
|
625 |
// CESMRView::CountComponentControls |
|
626 |
// --------------------------------------------------------------------------- |
|
627 |
// |
|
628 |
TInt CESMRView::CountComponentControls() const |
|
629 |
{ |
|
630 |
FUNC_LOG; |
|
631 |
return iControls.Count(); |
|
632 |
} |
|
633 |
||
634 |
// --------------------------------------------------------------------------- |
|
635 |
// CESMRView::ComponentControl() |
|
636 |
// --------------------------------------------------------------------------- |
|
637 |
// |
|
638 |
CCoeControl* CESMRView::ComponentControl( TInt aInd ) const |
|
639 |
{ |
|
640 |
FUNC_LOG; |
|
641 |
return iControls[aInd]; |
|
642 |
} |
|
643 |
||
644 |
// --------------------------------------------------------------------------- |
|
645 |
// CESMRView::SizeChanged() |
|
646 |
// --------------------------------------------------------------------------- |
|
647 |
// |
|
648 |
void CESMRView::SizeChanged() |
|
649 |
{ |
|
650 |
FUNC_LOG; |
|
651 |
||
652 |
// If list pane is not yet constructed, no point in layouting anything |
|
653 |
if( !iListPane ) |
|
654 |
{ |
|
655 |
return; |
|
656 |
} |
|
657 |
||
658 |
// Remove possible intersection with toolbar from container rect |
|
659 |
TRect containerRect( ContainerRect() ); |
|
660 |
||
661 |
// Now toolbar does not intersect with view, so it must not be taken |
|
662 |
// into account when calculating other component layouts. |
|
663 |
containerRect.SetRect( TPoint( 0, 0 ), containerRect.Size() ); |
|
664 |
||
665 |
// Get the rect of stripe. |
|
666 |
TAknLayoutRect stripeLayoutRect = |
|
667 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
668 |
NMRLayoutManager::EMRLayoutStripe ); |
|
669 |
iStripeRect = stripeLayoutRect.Rect(); |
|
670 |
||
671 |
// Layouting listpane, scroll bar and navi arrows in landscape mode |
|
672 |
if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
673 |
{ |
|
674 |
TAknLayoutRect listareaLayoutRect = |
|
675 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
676 |
NMRLayoutManager::EMRLayoutListArea ); |
|
677 |
TRect listareaRect( listareaLayoutRect.Rect() ); |
|
678 |
||
679 |
// List panes default rect needs to be modified due to |
|
680 |
// scrollbar and calendar indication stripe |
|
681 |
||
682 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
683 |
{ |
|
684 |
// Remove stripe width from list pane width when align is R to L |
|
685 |
listareaRect.iBr.iX -= iStripeRect.Width(); |
|
686 |
} |
|
687 |
else |
|
688 |
{ |
|
689 |
// Remove stripe width from list pane width when align is L to R |
|
690 |
listareaRect.iTl.iX += iStripeRect.Width(); |
|
691 |
} |
|
692 |
||
693 |
if( iScrollBar ) |
|
694 |
{ |
|
695 |
TAknLayoutRect scrollareaLayoutRect = |
|
696 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
697 |
NMRLayoutManager::EMRLayoutScrollBar ); |
|
698 |
TRect scrollareaRect( scrollareaLayoutRect.Rect() ); |
|
699 |
// Scroll bar's height is always the same as listpane's height |
|
700 |
scrollareaRect.SetHeight( listareaRect.Height() ); |
|
701 |
||
702 |
iScrollBar->SetRect( scrollareaRect ); |
|
703 |
} |
|
704 |
||
705 |
iListPane->SetRect( listareaRect ); |
|
706 |
||
707 |
// Make sure, that stripe height is the list pane height |
|
708 |
iStripeRect.SetHeight( iListPane->Rect().Height() ); |
|
709 |
||
710 |
if(iViewMode == EESMRViewMR) |
|
711 |
{ |
|
712 |
if( iNaviArrowLeft ) |
|
713 |
{ |
|
714 |
TAknLayoutRect naviArrowLeftLayoutRect = |
|
715 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
716 |
NMRLayoutManager::EMRLayoutMRNaviArrowLeft ); |
|
717 |
TRect naviArrowLeftRect( naviArrowLeftLayoutRect.Rect() ); |
|
718 |
||
719 |
// Left arrow needs to be moved right the amount of |
|
720 |
// stripe width in landscape |
|
721 |
naviArrowLeftRect.Move( iStripeRect.Width(), 0 ); |
|
722 |
||
723 |
iNaviArrowLeft->SetRect( naviArrowLeftRect ); |
|
724 |
} |
|
725 |
||
726 |
if( iNaviArrowRight ) |
|
727 |
{ |
|
728 |
TAknLayoutRect naviArrowRightLayoutRect = |
|
729 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
730 |
NMRLayoutManager::EMRLayoutMRNaviArrowRight ); |
|
731 |
TRect naviArrowRightRect( naviArrowRightLayoutRect.Rect() ); |
|
732 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
733 |
// Right arrow needs to be moved right the amount of |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
734 |
// stripe width in landscape |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
735 |
naviArrowRightRect.Move( iStripeRect.Width(), 0 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
736 |
|
64 | 737 |
iNaviArrowRight->SetRect( naviArrowRightRect ); |
738 |
} |
|
739 |
} |
|
740 |
else |
|
741 |
{ |
|
742 |
SetNaviArrowStatus( EFalse, EFalse ); |
|
743 |
} |
|
744 |
} |
|
745 |
||
746 |
// Layouting listpane, scroll bar and navi arrows in portrait mode |
|
747 |
else |
|
748 |
{ |
|
749 |
TAknLayoutRect listareaLayoutRect = |
|
750 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
751 |
NMRLayoutManager::EMRLayoutListArea ); |
|
752 |
TRect listareaRect( listareaLayoutRect.Rect() ); |
|
753 |
||
754 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
755 |
{ |
|
756 |
// Remove stripe width from list pane width when align is R to L |
|
757 |
listareaRect.iBr.iX -= iStripeRect.Width(); |
|
758 |
} |
|
759 |
else |
|
760 |
{ |
|
761 |
// Remove stripe width from list pane width when align is L to R |
|
762 |
listareaRect.iTl.iX += iStripeRect.Width(); |
|
763 |
} |
|
764 |
||
765 |
iListPane->SetRect( listareaRect ); |
|
766 |
||
767 |
if( iScrollBar ) |
|
768 |
{ |
|
769 |
TAknLayoutRect scrollareaLayoutRect = |
|
770 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
771 |
NMRLayoutManager::EMRLayoutScrollBar ); |
|
772 |
TRect scrollareaRect( scrollareaLayoutRect.Rect() ); |
|
773 |
// Scroll bar's height is always the same as listpane's height |
|
774 |
scrollareaRect.SetHeight( iListPane->Rect().Height() ); |
|
775 |
iScrollBar->SetRect( scrollareaRect ); |
|
776 |
} |
|
777 |
||
778 |
// Make sure, that stripe height is the list pane height |
|
779 |
iStripeRect.SetHeight( iListPane->Rect().Height() ); |
|
780 |
||
781 |
if(iViewMode == EESMRViewMR) |
|
782 |
{ |
|
783 |
if( iNaviArrowLeft ) |
|
784 |
{ |
|
785 |
TAknLayoutRect naviArrowLeftLayoutRect = |
|
786 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
787 |
NMRLayoutManager::EMRLayoutMRNaviArrowLeft ); |
|
788 |
TRect naviArrowLeftRect( naviArrowLeftLayoutRect.Rect() ); |
|
789 |
||
790 |
// Left arrow needs to be moved right the amount of |
|
791 |
// stripe width in portrait |
|
792 |
naviArrowLeftRect.Move( iStripeRect.Width(), 0 ); |
|
793 |
||
794 |
iNaviArrowLeft->SetRect( naviArrowLeftRect ); |
|
795 |
} |
|
796 |
||
797 |
if( iNaviArrowRight ) |
|
798 |
{ |
|
799 |
TAknLayoutRect naviArrowRightLayoutRect = |
|
800 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
801 |
NMRLayoutManager::EMRLayoutMRNaviArrowRight ); |
|
802 |
TRect naviArrowRightRect( naviArrowRightLayoutRect.Rect() ); |
|
803 |
||
804 |
// Right arrow needs to be moved right the amount of |
|
805 |
// stripe width in portrait |
|
806 |
naviArrowRightRect.Move( iStripeRect.Width(), 0 ); |
|
807 |
||
808 |
iNaviArrowRight->SetRect( naviArrowRightRect ); |
|
809 |
} |
|
810 |
} |
|
811 |
else |
|
812 |
{ |
|
813 |
SetNaviArrowStatus( EFalse, EFalse ); |
|
814 |
} |
|
815 |
} |
|
816 |
||
817 |
if ( iAttachmentIndicator ) |
|
818 |
{ |
|
819 |
iAttachmentIndicator->SetRect( |
|
820 |
CalculateAttachmentIndicatorLayout() ); |
|
821 |
} |
|
822 |
||
823 |
if( iBgContext ) |
|
824 |
{ |
|
825 |
iBgContext->SetRect( containerRect ); |
|
826 |
if ( &Window() ) |
|
827 |
{ |
|
828 |
iBgContext->SetParentPos( PositionRelativeToScreen() ); |
|
829 |
} |
|
830 |
} |
|
831 |
} |
|
832 |
||
833 |
// --------------------------------------------------------------------------- |
|
834 |
// CESMRView::MinimumSize() |
|
835 |
// Gets the main pane size needed by CEikDialog to layout itself correctly |
|
836 |
// --------------------------------------------------------------------------- |
|
837 |
// |
|
838 |
TSize CESMRView::MinimumSize() |
|
839 |
{ |
|
840 |
FUNC_LOG; |
|
841 |
TRect rect; |
|
842 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); |
|
843 |
return rect.Size(); |
|
844 |
} |
|
845 |
||
846 |
// --------------------------------------------------------------------------- |
|
847 |
// CESMRView::OfferKeyEventL |
|
848 |
// --------------------------------------------------------------------------- |
|
849 |
// |
|
850 |
TKeyResponse CESMRView::OfferKeyEventL( |
|
851 |
const TKeyEvent &aKeyEvent, |
|
852 |
TEventCode aType) |
|
853 |
{ |
|
854 |
FUNC_LOG; |
|
855 |
TKeyResponse response( EKeyWasNotConsumed ); |
|
856 |
if ( iListPane ) |
|
857 |
{ |
|
858 |
// Use focus strategy |
|
859 |
iFocusStrategy.EventOccured( MMRFocusStrategy::EFocusKeyEvent ); |
|
860 |
||
861 |
TBool forwardEvent( ETrue ); |
|
862 |
// Remove Delete hw key command if the focus is not visible |
|
863 |
if ( !iFocusStrategy.IsFocusVisible() ) |
|
864 |
{ |
|
865 |
if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace ) |
|
866 |
{ |
|
867 |
forwardEvent = EFalse; |
|
868 |
} |
|
869 |
} |
|
870 |
||
871 |
if ( forwardEvent ) |
|
872 |
{ |
|
873 |
response = iListPane->OfferKeyEventL( aKeyEvent, aType ); |
|
874 |
iListPane->DrawDeferred(); |
|
875 |
} |
|
876 |
} |
|
877 |
return response; |
|
878 |
} |
|
879 |
||
880 |
||
881 |
// --------------------------------------------------------------------------- |
|
882 |
// CESMRView::Draw |
|
883 |
// This Draw is called when background for title pane (iTitle) is drawn |
|
884 |
// --------------------------------------------------------------------------- |
|
885 |
// |
|
886 |
void CESMRView::Draw( const TRect& aRect ) const |
|
887 |
{ |
|
888 |
FUNC_LOG; |
|
889 |
CWindowGc& gc = SystemGc(); |
|
890 |
||
891 |
// Draw the background for iTitle using the current skin |
|
892 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
893 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
894 |
AknsDrawUtils::Background( skin, cc, this, gc, aRect ); |
|
895 |
||
896 |
// Draw color stripe |
|
897 |
MESMRCalDbMgr& DbMgr = iEntry->GetDBMgr(); |
|
898 |
||
899 |
TRgb stripeColor = DbMgr.GetCurCalendarColor(); |
|
900 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
901 |
gc.SetBrushColor( stripeColor ); |
|
902 |
gc.DrawRect( iStripeRect ); |
|
903 |
||
904 |
gc.Reset(); |
|
905 |
} |
|
906 |
||
907 |
// --------------------------------------------------------------------------- |
|
908 |
// CESMRView::Draw |
|
909 |
// This draw method draws the dialog area |
|
910 |
// --------------------------------------------------------------------------- |
|
911 |
// |
|
912 |
void CESMRView::Draw( |
|
913 |
CWindowGc& /* aGc */, |
|
914 |
const CCoeControl& aControl, |
|
915 |
const TRect& /*aRect*/) const |
|
916 |
{ |
|
917 |
FUNC_LOG; |
|
918 |
CWindowGc& gc = SystemGc(); |
|
919 |
||
920 |
// Draw the background for aControl using the current skin |
|
921 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
922 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
923 |
AknsDrawUtils::Background( skin, cc, &aControl, gc, aControl.Rect() ); |
|
924 |
} |
|
925 |
||
926 |
// --------------------------------------------------------------------------- |
|
927 |
// CESMRView::GetTextDrawer |
|
928 |
// --------------------------------------------------------------------------- |
|
929 |
// |
|
930 |
void CESMRView::GetTextDrawer( |
|
931 |
CCoeTextDrawerBase*& /*aText*/, |
|
932 |
const CCoeControl* /*aControl*/) const |
|
933 |
{ |
|
934 |
// Do nothing |
|
935 |
} |
|
936 |
||
937 |
// --------------------------------------------------------------------------- |
|
938 |
// CESMRView::SetTitleL() |
|
939 |
// --------------------------------------------------------------------------- |
|
940 |
// |
|
941 |
void CESMRView::SetTitleL( const TDesC& /*aTitle*/, TBool /*aDefault*/) |
|
942 |
{ |
|
943 |
FUNC_LOG; |
|
944 |
} |
|
945 |
||
946 |
// --------------------------------------------------------------------------- |
|
947 |
// CESMRView::SetControlFocusedL() |
|
948 |
// --------------------------------------------------------------------------- |
|
949 |
// |
|
950 |
void CESMRView::SetControlFocusedL( TESMREntryFieldId aField ) |
|
951 |
{ |
|
952 |
FUNC_LOG; |
|
953 |
iListPane->SetControlFocusedL( aField ); |
|
954 |
} |
|
955 |
||
956 |
// --------------------------------------------------------------------------- |
|
957 |
// CESMRView::HandleResourceChange() |
|
958 |
// --------------------------------------------------------------------------- |
|
959 |
// |
|
960 |
void CESMRView::HandleResourceChange( TInt aType ) |
|
961 |
{ |
|
962 |
FUNC_LOG; |
|
963 |
CCoeControl::HandleResourceChange( aType ); |
|
964 |
TInt error = KErrNone; |
|
965 |
TBool record = ETrue; |
|
966 |
||
967 |
switch ( aType ) |
|
968 |
{ |
|
969 |
case KAknsMessageSkinChange: |
|
970 |
{ |
|
971 |
TRAP( error, iListPane->InitializeL() ); |
|
972 |
break; |
|
973 |
} |
|
974 |
case KEikMessageColorSchemeChange: |
|
975 |
{ |
|
976 |
TRAP( error, iListPane->InitializeL() ); |
|
977 |
break; |
|
978 |
} |
|
979 |
case KEikDynamicLayoutVariantSwitch: |
|
980 |
case KAknLocalZoomLayoutSwitch: |
|
981 |
{ |
|
982 |
SizeChanged(); |
|
983 |
break; |
|
984 |
} |
|
985 |
default: |
|
986 |
{ |
|
987 |
record = EFalse; |
|
988 |
break; |
|
989 |
} |
|
990 |
} |
|
991 |
||
992 |
if ( error != KErrNone ) |
|
993 |
{ |
|
994 |
record = EFalse; |
|
995 |
iCoeEnv->HandleError( error ); |
|
996 |
} |
|
997 |
||
998 |
if ( record ) |
|
999 |
{ |
|
1000 |
iListPane->RecordFields(); |
|
1001 |
} |
|
1002 |
} |
|
1003 |
||
1004 |
// --------------------------------------------------------------------------- |
|
1005 |
// CESMRView::MopSupplyObject() |
|
1006 |
// --------------------------------------------------------------------------- |
|
1007 |
// |
|
1008 |
TTypeUid::Ptr CESMRView::MopSupplyObject( TTypeUid aId ) |
|
1009 |
{ |
|
1010 |
FUNC_LOG; |
|
1011 |
if ( iBgContext ) |
|
1012 |
{ |
|
1013 |
return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
1014 |
} |
|
1015 |
return CCoeControl::MopSupplyObject( aId ); |
|
1016 |
} |
|
1017 |
||
1018 |
// ----------------------------------------------------------------------------- |
|
1019 |
// CESMRView::HandlePointerEventL() |
|
1020 |
// ----------------------------------------------------------------------------- |
|
1021 |
// |
|
1022 |
void CESMRView::HandlePointerEventL( |
|
1023 |
const TPointerEvent &aPointerEvent ) |
|
1024 |
{ |
|
1025 |
FUNC_LOG; |
|
1026 |
// Call focus strategy |
|
1027 |
iFocusStrategy.EventOccured( MMRFocusStrategy::EFocusPointerEvent ); |
|
1028 |
||
1029 |
CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
1030 |
} |
|
1031 |
||
1032 |
// --------------------------------------------------------------------------- |
|
1033 |
// CESMRView::InitialScroll() |
|
1034 |
// --------------------------------------------------------------------------- |
|
1035 |
// |
|
1036 |
void CESMRView::InitialScrollL() |
|
1037 |
{ |
|
1038 |
FUNC_LOG; |
|
1039 |
iListPane->InitialScrollL(); |
|
1040 |
} |
|
1041 |
||
1042 |
// --------------------------------------------------------------------------- |
|
1043 |
// CESMRView::DynInitMenuPaneL |
|
1044 |
// --------------------------------------------------------------------------- |
|
1045 |
// |
|
1046 |
void CESMRView::DynInitMenuPaneL( |
|
1047 |
TMRMenuStyle aMenuStyle, |
|
1048 |
TInt aResourceId, |
|
1049 |
CEikMenuPane* aMenuPane ) |
|
1050 |
{ |
|
1051 |
FUNC_LOG; |
|
1052 |
// Initialize field specific options in context menu and options menu. |
|
1053 |
// Options menu has field specific options only when focus is visible. |
|
1054 |
if ( aMenuStyle != EMROptionsMenu |
|
1055 |
|| ( aMenuStyle == EMROptionsMenu |
|
1056 |
&& iFocusStrategy.IsFocusVisible() ) ) |
|
1057 |
{ |
|
1058 |
CESMRField* field = iStorage->FieldById( ClickedOrFocusedField() ); |
|
1059 |
field->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
1060 |
} |
|
1061 |
} |
|
1062 |
||
1063 |
// --------------------------------------------------------------------------- |
|
1064 |
// CESMRView::SetNaviArrowStatus |
|
1065 |
// --------------------------------------------------------------------------- |
|
1066 |
// |
|
1067 |
void CESMRView::SetNaviArrowStatus( |
|
1068 |
TBool aLeftArrowVisible, |
|
1069 |
TBool aRightArrowVisible ) |
|
1070 |
{ |
|
1071 |
FUNC_LOG; |
|
1072 |
if ( iNaviArrowLeft ) |
|
1073 |
{ |
|
1074 |
iNaviArrowLeft->SetNaviArrowStatus( aLeftArrowVisible ); |
|
1075 |
} |
|
1076 |
if ( iNaviArrowRight ) |
|
1077 |
{ |
|
1078 |
iNaviArrowRight->SetNaviArrowStatus( aRightArrowVisible ); |
|
1079 |
} |
|
1080 |
} |
|
1081 |
// --------------------------------------------------------------------------- |
|
1082 |
// CESMRView::SetViewMode |
|
1083 |
// --------------------------------------------------------------------------- |
|
1084 |
// |
|
1085 |
void CESMRView::SetViewMode(TESMRViewMode aMode) |
|
1086 |
{ |
|
1087 |
FUNC_LOG; |
|
1088 |
iViewMode = aMode; |
|
1089 |
} |
|
1090 |
// --------------------------------------------------------------------------- |
|
1091 |
// CESMRView::GetViewMode |
|
1092 |
// --------------------------------------------------------------------------- |
|
1093 |
// |
|
1094 |
TESMRViewMode CESMRView::GetViewMode() |
|
1095 |
{ |
|
1096 |
FUNC_LOG; |
|
1097 |
return iViewMode; |
|
1098 |
} |
|
1099 |
||
1100 |
// --------------------------------------------------------------------------- |
|
1101 |
// CESMRView::ProcessEventL |
|
1102 |
// --------------------------------------------------------------------------- |
|
1103 |
// |
|
1104 |
void CESMRView::ProcessEventL( const MESMRFieldEvent& aEvent ) |
|
1105 |
{ |
|
1106 |
FUNC_LOG; |
|
1107 |
||
1108 |
if ( MESMRFieldEvent::EESMRFieldChangeEvent == aEvent.Type() ) |
|
1109 |
{ |
|
1110 |
TInt* fieldId = static_cast< TInt* >( aEvent.Param( 0 ) ); |
|
1111 |
||
1112 |
if ( EESMRFieldViewerAttachments == *fieldId ) |
|
1113 |
{ |
|
1114 |
if ( !iAttachmentIndicator ) |
|
1115 |
{ |
|
1116 |
TRect attachmentDownloadIndicatorRect( |
|
1117 |
CalculateAttachmentIndicatorLayout() ); |
|
1118 |
||
1119 |
iAttachmentIndicator = CMRAttachmentIndicator::NewL( |
|
1120 |
attachmentDownloadIndicatorRect, |
|
1121 |
this ); |
|
1122 |
||
1123 |
CFbsBitmap* bitMap( NULL ); |
|
1124 |
CFbsBitmap* bitMapMask( NULL ); |
|
1125 |
TSize size( 0,0 ); |
|
1126 |
NMRBitmapManager::GetSkinBasedBitmapLC( |
|
1127 |
NMRBitmapManager::EMRBitmapDownloadAttachment, |
|
1128 |
bitMap, bitMapMask, size ); |
|
1129 |
||
1130 |
CleanupStack::Pop( 2 ); // bitMap, bitMapMask |
|
1131 |
||
1132 |
||
1133 |
||
1134 |
iAttachmentIndicator->SetImage( bitMap, bitMapMask ); |
|
1135 |
iControls.AppendL( iAttachmentIndicator ); |
|
1136 |
} |
|
1137 |
||
1138 |
MESMRFieldEventValue* value = |
|
1139 |
static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) ); |
|
1140 |
||
1141 |
iAttachmentIndicator->SetTextL( value->StringValue() ); |
|
1142 |
iAttachmentIndicator->MakeVisible( ETrue ); |
|
1143 |
||
1144 |
SizeChanged(); |
|
1145 |
} |
|
1146 |
} |
|
1147 |
} |
|
1148 |
||
1149 |
// --------------------------------------------------------------------------- |
|
1150 |
// CESMRView::CalculateAttachmentIndicatorLayout |
|
1151 |
// --------------------------------------------------------------------------- |
|
1152 |
// |
|
1153 |
TRect CESMRView::CalculateAttachmentIndicatorLayout() |
|
1154 |
{ |
|
1155 |
TRect containerRect( ContainerRect() ); |
|
1156 |
||
1157 |
||
1158 |
TAknLayoutRect naviArrowLeftLayoutRect = |
|
1159 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
1160 |
NMRLayoutManager::EMRLayoutMRNaviArrowLeft ); |
|
1161 |
TRect naviArrowLeftRect = naviArrowLeftLayoutRect.Rect(); |
|
1162 |
||
1163 |
TAknLayoutRect naviArrowRightLayoutRect = |
|
1164 |
NMRLayoutManager::GetLayoutRect( containerRect, |
|
1165 |
NMRLayoutManager::EMRLayoutMRNaviArrowRight ); |
|
1166 |
TRect naviArrowRightRect = naviArrowRightLayoutRect.Rect(); |
|
1167 |
//Exchange the narrows' rect when LayoutMirrored |
|
1168 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
1169 |
{ |
|
1170 |
naviArrowLeftRect = naviArrowRightLayoutRect.Rect(); |
|
1171 |
naviArrowRightRect= naviArrowLeftLayoutRect.Rect(); |
|
1172 |
} |
|
1173 |
||
1174 |
if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1175 |
{ |
|
1176 |
naviArrowLeftRect.Move( iStripeRect.Width(), 0 ); |
|
1177 |
||
1178 |
TInt scrollWidth( 0 ); |
|
1179 |
if( iScrollBar ) |
|
1180 |
{ |
|
1181 |
scrollWidth = iScrollBar->Rect().Width(); |
|
1182 |
} |
|
1183 |
||
1184 |
naviArrowRightRect.Move( scrollWidth, 0 ); |
|
1185 |
} |
|
1186 |
else |
|
1187 |
{ |
|
1188 |
// Left arrow needs to be moved right the amount of |
|
1189 |
// stripe width in portrait |
|
1190 |
naviArrowLeftRect.Move( iStripeRect.Width(), 0 ); |
|
1191 |
||
1192 |
TRect naviArrowRightRect = naviArrowRightLayoutRect.Rect(); |
|
1193 |
||
1194 |
naviArrowRightRect.Move( iStripeRect.Width(), 0 ); |
|
1195 |
} |
|
1196 |
||
1197 |
// Get height for one row |
|
1198 |
TAknLayoutRect rowLayout = |
|
1199 |
NMRLayoutManager::GetLayoutRect( |
|
1200 |
containerRect, NMRLayoutManager::EMRLayoutTextEditorIcon ); |
|
1201 |
TRect rowRect( rowLayout.Rect() ); |
|
1202 |
||
1203 |
TRect attachmentIndicatorRect; |
|
1204 |
||
1205 |
attachmentIndicatorRect.iTl = |
|
1206 |
TPoint( naviArrowLeftRect.iBr.iX, |
|
1207 |
naviArrowLeftRect.iBr.iY - naviArrowLeftRect.Height() ); |
|
1208 |
||
1209 |
attachmentIndicatorRect.iBr = |
|
1210 |
TPoint( naviArrowRightRect.iTl.iX, |
|
1211 |
naviArrowLeftRect.iBr.iY ); |
|
1212 |
||
1213 |
return attachmentIndicatorRect; |
|
1214 |
} |
|
1215 |
||
1216 |
// --------------------------------------------------------------------------- |
|
1217 |
// CESMRView::ContainerRect |
|
1218 |
// --------------------------------------------------------------------------- |
|
1219 |
// |
|
1220 |
TRect CESMRView::ContainerRect() const |
|
1221 |
{ |
|
1222 |
// Remove possible intersection with toolbar from container rect |
|
1223 |
TRect containerRect( PositionRelativeToScreen(), Rect().Size() ); |
|
1224 |
TRect toolbar( iToolbar.Rect() ); |
|
1225 |
if ( containerRect.Intersects( toolbar ) ) |
|
1226 |
{ |
|
1227 |
toolbar.Intersection( containerRect ); |
|
1228 |
if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1229 |
{ |
|
1230 |
containerRect.SetWidth( containerRect.Width() - toolbar.Width() ); |
|
1231 |
} |
|
1232 |
else |
|
1233 |
{ |
|
1234 |
containerRect.SetHeight( containerRect.Height() - toolbar.Height() ); |
|
1235 |
} |
|
1236 |
} |
|
1237 |
// Now toolbar does not intersect with view, so it must not be taken |
|
1238 |
// into account when calculating other component layouts. |
|
1239 |
containerRect.SetRect( TPoint( 0, 0 ), containerRect.Size() ); |
|
1240 |
||
1241 |
return containerRect; |
|
1242 |
} |
|
1243 |
||
1244 |
// EOF |