|
1 /* |
|
2 * Copyright (c) 2007 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: MsgNaviPaneControl implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // ========== INCLUDE FILES ================================ |
|
21 |
|
22 #include <coecontrolarray.h> |
|
23 #include <eiklabel.h> |
|
24 #include <eikimage.h> |
|
25 |
|
26 #include <data_caging_path_literals.hrh> |
|
27 #include <barsread.h> // TResourceReader |
|
28 #include <gulicon.h> // CGulIcon |
|
29 #include <AknsUtils.h> |
|
30 #include <AknsConstants.h> |
|
31 #include <AknUtils.h> |
|
32 #include <avkon.rsg> |
|
33 #include <layoutmetadata.cdl.h> // Layout |
|
34 #include <applayout.cdl.h> // LAF |
|
35 #include <AknStatuspaneUtils.h> // AknStatuspaneUtils |
|
36 #include <aknlayoutscalable_apps.cdl.h> |
|
37 #include <StringLoader.h> |
|
38 #include <MuiuMessageIterator.h> // for CMessageIterator |
|
39 #include <muiumsvuiserviceutilitiesinternal.h> |
|
40 #include <MsgEditorAppUi.rsg> // resouce identifiers |
|
41 |
|
42 #ifdef RD_TACTILE_FEEDBACK |
|
43 #include <touchfeedback.h> |
|
44 #endif |
|
45 |
|
46 #include <msgeditor.mbg> |
|
47 |
|
48 #include "MsgNaviPaneControl.h" |
|
49 #include "MsgNaviPaneControlObserver.h" |
|
50 |
|
51 // ========== EXTERNAL DATA STRUCTURES ===================== |
|
52 |
|
53 // ========== EXTERNAL FUNCTION PROTOTYPES ================= |
|
54 |
|
55 // ========== CONSTANTS ==================================== |
|
56 |
|
57 _LIT( KIconMbmFile, "msgeditor.mbm" ); |
|
58 const TInt KTimeStringMaxLength = 32; |
|
59 |
|
60 // ========== MACROS ======================================= |
|
61 |
|
62 // ========== LOCAL CONSTANTS AND MACROS =================== |
|
63 |
|
64 // ========== MODULE DATA STRUCTURES ======================= |
|
65 |
|
66 // ========== LOCAL FUNCTION PROTOTYPES ==================== |
|
67 |
|
68 // ========== LOCAL FUNCTIONS ============================== |
|
69 |
|
70 // ========== MEMBER FUNCTIONS ============================= |
|
71 |
|
72 // ---------------------------------------------------------------------------- |
|
73 // CMsgNaviPaneControl::CMsgNaviPaneControl |
|
74 // C++ default constructor. |
|
75 // ---------------------------------------------------------------------------- |
|
76 // |
|
77 CMsgNaviPaneControl::CMsgNaviPaneControl() |
|
78 { |
|
79 } |
|
80 |
|
81 // ---------------------------------------------------------------------------- |
|
82 // CMsgNaviPaneControl::ConstructL |
|
83 // Symbian 2nd phase constructor. |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT |
|
87 void CMsgNaviPaneControl::ConstructL( const CCoeControl* aParent ) |
|
88 { |
|
89 SetContainerWindowL( *aParent ); |
|
90 |
|
91 iControlArray = CCoeControlArray::NewL( *this ); |
|
92 iControlArray->SetControlsOwnedExternally( EFalse ); |
|
93 iPriorityIndicator = EFalse; |
|
94 UpdateVarientId(); |
|
95 SetComponentsToInheritVisibility( ETrue ); |
|
96 ActivateL(); |
|
97 } |
|
98 #else |
|
99 void CMsgNaviPaneControl::ConstructL( const CCoeControl* /*aParent*/ ) |
|
100 { |
|
101 User::Leave( KErrNotSupported ); |
|
102 } |
|
103 #endif |
|
104 |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // CMsgNaviPaneControl::NewL |
|
108 // |
|
109 // Symbian two phased constructor |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C CMsgNaviPaneControl* CMsgNaviPaneControl::NewL( const CCoeControl* aParent ) |
|
113 { |
|
114 CMsgNaviPaneControl* self = new(ELeave) CMsgNaviPaneControl(); |
|
115 |
|
116 CleanupStack::PushL( self ); |
|
117 self->ConstructL( aParent ); |
|
118 CleanupStack::Pop( self ); |
|
119 |
|
120 return self; |
|
121 } |
|
122 |
|
123 // ---------------------------------------------------------------------------- |
|
124 // CMsgNaviPaneControl::~CMsgNaviPaneControl |
|
125 // Destructor. |
|
126 // ---------------------------------------------------------------------------- |
|
127 // |
|
128 CMsgNaviPaneControl::~CMsgNaviPaneControl() |
|
129 { |
|
130 delete iControlArray; |
|
131 delete iMessageIterator; |
|
132 } |
|
133 |
|
134 // ---------------------------------------------------------------------------- |
|
135 // CMsgNaviPaneControl::SetTimeIndicatorL |
|
136 // ---------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C void CMsgNaviPaneControl::SetTimeIndicatorL( TTime aTime, TBool aUtcTime ) |
|
139 { |
|
140 if ( aUtcTime ) |
|
141 { |
|
142 MsvUiServiceUtilitiesInternal::ConvertUtcToLocalTime( aTime ); |
|
143 } |
|
144 |
|
145 iTime = aTime; |
|
146 |
|
147 UpdateTimeIndicatorL(); |
|
148 } |
|
149 |
|
150 // ---------------------------------------------------------------------------- |
|
151 // CMsgNaviPaneControl::SetPriorityIndicatorL |
|
152 // ---------------------------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C void CMsgNaviPaneControl::SetPriorityIndicatorL( TMsgEditorMsgPriority aPriority ) |
|
155 { |
|
156 iPriority = aPriority; |
|
157 |
|
158 UpdatePriorityIndicatorL(); |
|
159 } |
|
160 |
|
161 // ---------------------------------------------------------------------------- |
|
162 // CMsgNaviPaneControl::SetNavigationIndicatorL |
|
163 // ---------------------------------------------------------------------------- |
|
164 // |
|
165 EXPORT_C void CMsgNaviPaneControl::SetNavigationIndicatorL( CMsvSession& aSession, |
|
166 const TMsvEntry& aCurrentMessage ) |
|
167 { |
|
168 delete iMessageIterator; |
|
169 iMessageIterator = NULL; |
|
170 |
|
171 iMessageIterator = CMessageIterator::NewL( aSession, aCurrentMessage ); |
|
172 iMessageIterator->SetMessageIteratorObserver( this ); |
|
173 |
|
174 UpdateNavigationIndicatorsL(); |
|
175 } |
|
176 |
|
177 // ---------------------------------------------------------------------------- |
|
178 // CMsgNaviPaneControl::SetNavigationControlObserver |
|
179 // ---------------------------------------------------------------------------- |
|
180 // |
|
181 EXPORT_C void CMsgNaviPaneControl::SetNavigationControlObserver( MMsgNaviPaneControlObserver* aObserver) |
|
182 { |
|
183 iObserver = aObserver; |
|
184 } |
|
185 |
|
186 // ---------------------------------------------------------------------------- |
|
187 // CMsgNaviPaneControl::CountComponentControls |
|
188 // Returns number of child controls. |
|
189 // ---------------------------------------------------------------------------- |
|
190 // |
|
191 TInt CMsgNaviPaneControl::CountComponentControls() const |
|
192 { |
|
193 return iControlArray->Count(); |
|
194 } |
|
195 |
|
196 // ---------------------------------------------------------------------------- |
|
197 // CMsgNaviPaneControl::ComponentControl |
|
198 // Returns specified child controls. |
|
199 // ---------------------------------------------------------------------------- |
|
200 // |
|
201 CCoeControl* CMsgNaviPaneControl::ComponentControl( TInt aIndex ) const |
|
202 { |
|
203 return iControlArray->At( aIndex ).iControl; |
|
204 } |
|
205 |
|
206 // ---------------------------------------------------------------------------- |
|
207 // CMsgNaviPaneControl::SizeChanged |
|
208 // ---------------------------------------------------------------------------- |
|
209 // |
|
210 void CMsgNaviPaneControl::SizeChanged() |
|
211 { |
|
212 LayoutIndicators(); |
|
213 } |
|
214 |
|
215 // ---------------------------------------------------------------------------- |
|
216 // CMsgNaviPaneControl::PositionChanged |
|
217 // ---------------------------------------------------------------------------- |
|
218 // |
|
219 void CMsgNaviPaneControl::PositionChanged() |
|
220 { |
|
221 LayoutIndicators(); |
|
222 } |
|
223 |
|
224 // ---------------------------------------------------------------------------- |
|
225 // CMsgNaviPaneControl::HandlePointerEventL |
|
226 // ---------------------------------------------------------------------------- |
|
227 // |
|
228 void CMsgNaviPaneControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
229 { |
|
230 TBool tactilefeedback = EFalse; |
|
231 if ( iObserver && |
|
232 aPointerEvent.iType == TPointerEvent::EButton1Down || |
|
233 aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
234 { |
|
235 CEikImage* leftArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviLeftArrowControlId ); |
|
236 CEikImage* rightArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviRightArrowControlId ); |
|
237 |
|
238 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
239 { |
|
240 iPreviouslyFocusedControl = NULL; |
|
241 } |
|
242 |
|
243 if ( leftArrowIndicator && |
|
244 iLeftArrowTouchRect.Contains( aPointerEvent.iPosition ) ) |
|
245 { |
|
246 tactilefeedback = ETrue; |
|
247 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
248 { |
|
249 iPreviouslyFocusedControl = leftArrowIndicator; |
|
250 } |
|
251 else if ( iPreviouslyFocusedControl == leftArrowIndicator ) |
|
252 { |
|
253 iObserver->HandleNavigationControlEventL( |
|
254 MMsgNaviPaneControlObserver::EMsgNaviLeftArrowPressed ); |
|
255 } |
|
256 } |
|
257 else if ( rightArrowIndicator && |
|
258 iRightArrowTouchRect.Contains( aPointerEvent.iPosition ) ) |
|
259 { |
|
260 tactilefeedback = ETrue; |
|
261 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
262 { |
|
263 iPreviouslyFocusedControl = rightArrowIndicator; |
|
264 } |
|
265 else if ( iPreviouslyFocusedControl == rightArrowIndicator ) |
|
266 { |
|
267 iObserver->HandleNavigationControlEventL( |
|
268 MMsgNaviPaneControlObserver::EMsgNaviRightArrowPressed ); |
|
269 } |
|
270 } |
|
271 } |
|
272 #ifdef RD_TACTILE_FEEDBACK |
|
273 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && tactilefeedback ) |
|
274 { |
|
275 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
276 if ( feedback ) |
|
277 { |
|
278 feedback->InstantFeedback( this, ETouchFeedbackBasic ); |
|
279 } |
|
280 } |
|
281 #endif |
|
282 } |
|
283 |
|
284 // ---------------------------------------------------------------------------- |
|
285 // CMsgNaviPaneControl::HandleResourceChange |
|
286 // ---------------------------------------------------------------------------- |
|
287 // |
|
288 void CMsgNaviPaneControl::HandleResourceChange( TInt aType ) |
|
289 { |
|
290 if ( aType == KAknsMessageSkinChange ) |
|
291 { |
|
292 UpdateVarientId(); |
|
293 TRAP_IGNORE( HandleSkinChangeL() ); |
|
294 } |
|
295 } |
|
296 |
|
297 // ---------------------------------------------------------------------------- |
|
298 // CMsgNaviPaneControl::HandleIteratorEventL |
|
299 // ---------------------------------------------------------------------------- |
|
300 // |
|
301 void CMsgNaviPaneControl::HandleIteratorEventL( TMessageIteratorEvent aEvent ) |
|
302 { |
|
303 if ( aEvent == EFolderCountChanged ) |
|
304 { |
|
305 UpdateVarientId(); |
|
306 UpdateNavigationIndicatorsL(); |
|
307 LayoutNavigationIndicators(); |
|
308 } |
|
309 } |
|
310 |
|
311 // ---------------------------------------------------------------------------- |
|
312 // CMsgNaviPaneControl::LayoutIndicators |
|
313 // Sets correct layout for volume control according current LAF. Determines also |
|
314 // if either of the arrow icons are overlapping with the pause indicator. |
|
315 // ---------------------------------------------------------------------------- |
|
316 // |
|
317 void CMsgNaviPaneControl::LayoutIndicators() |
|
318 { |
|
319 UpdateVarientId(); |
|
320 LayoutTimeIndicator(); |
|
321 LayoutNavigationIndicators(); |
|
322 LayoutPriorityIndicator(); |
|
323 } |
|
324 |
|
325 // ---------------------------------------------------------------------------- |
|
326 // CMsgNaviPaneControl::LayoutNavigationIndicators |
|
327 // ---------------------------------------------------------------------------- |
|
328 // |
|
329 void CMsgNaviPaneControl::LayoutNavigationIndicators() |
|
330 { |
|
331 if ( Rect().IsEmpty() ) |
|
332 { |
|
333 return; |
|
334 } |
|
335 |
|
336 CEikImage* leftArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviLeftArrowControlId ); |
|
337 if ( leftArrowIndicator ) |
|
338 { |
|
339 TAknLayoutRect leftArrowPane; |
|
340 if ( AknLayoutUtils::LayoutMirrored() ) |
|
341 { |
|
342 leftArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g3(iVarientId) ); |
|
343 } |
|
344 else |
|
345 { |
|
346 leftArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g2(iVarientId)); |
|
347 } |
|
348 |
|
349 SetIconIndicatorExtent( leftArrowIndicator, leftArrowPane ); |
|
350 } |
|
351 |
|
352 CEikImage* rightArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviRightArrowControlId ); |
|
353 if ( rightArrowIndicator ) |
|
354 { |
|
355 TAknLayoutRect rightArrowPane; |
|
356 if ( AknLayoutUtils::LayoutMirrored() ) |
|
357 { |
|
358 rightArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g2(iVarientId) ); |
|
359 } |
|
360 else |
|
361 { |
|
362 rightArrowPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_g3(iVarientId)); |
|
363 } |
|
364 |
|
365 |
|
366 SetIconIndicatorExtent( rightArrowIndicator, rightArrowPane ); |
|
367 } |
|
368 |
|
369 if ( AknLayoutUtils::PenEnabled() ) |
|
370 { |
|
371 TAknLayoutRect leftArrowTouchRect; |
|
372 leftArrowTouchRect.LayoutRect( Rect(), AknLayoutScalable_Apps::aid_size_touch_mv_arrow_left(iVarientId) ); |
|
373 iLeftArrowTouchRect = leftArrowTouchRect.Rect(); |
|
374 |
|
375 TAknLayoutRect rightArrowTouchRect; |
|
376 rightArrowTouchRect.LayoutRect( Rect(), AknLayoutScalable_Apps::aid_size_touch_mv_arrow_right(iVarientId) ); |
|
377 iRightArrowTouchRect = rightArrowTouchRect.Rect(); |
|
378 } |
|
379 } |
|
380 |
|
381 // ---------------------------------------------------------------------------- |
|
382 // CMsgNaviPaneControl::LayoutPriorityIndicator |
|
383 // ---------------------------------------------------------------------------- |
|
384 // |
|
385 void CMsgNaviPaneControl::LayoutPriorityIndicator() |
|
386 { |
|
387 if ( Rect().IsEmpty() ) |
|
388 { |
|
389 return; |
|
390 } |
|
391 |
|
392 CEikImage* priorityIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviPriorityControlId ); |
|
393 if ( priorityIndicator ) |
|
394 { |
|
395 TAknLayoutRect priorityPane; |
|
396 if(Layout_Meta_Data::IsLandscapeOrientation()) // in landscape mode |
|
397 { |
|
398 priorityPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_mv_g2(2) ); |
|
399 } |
|
400 else // portrait mode |
|
401 { |
|
402 priorityPane.LayoutRect( Rect(), AknLayoutScalable_Apps::navi_pane_mv_g2(1) ); |
|
403 } |
|
404 SetIconIndicatorExtent( priorityIndicator, priorityPane ); |
|
405 } |
|
406 } |
|
407 |
|
408 // ---------------------------------------------------------------------------- |
|
409 // CMsgNaviPaneControl::LayoutTimeIndicatorL |
|
410 // ---------------------------------------------------------------------------- |
|
411 // |
|
412 void CMsgNaviPaneControl::LayoutTimeIndicator() |
|
413 { |
|
414 if ( Rect().IsEmpty() ) |
|
415 { |
|
416 return; |
|
417 } |
|
418 |
|
419 CEikLabel* timeIndicator = iControlArray->ControlById<CEikLabel>( EMsgNaviTimeControlId ); |
|
420 if ( timeIndicator ) |
|
421 { |
|
422 TAknLayoutText timePane; |
|
423 timePane.LayoutText( Rect(), AknLayoutScalable_Apps::navi_pane_mv_t1(iVarientId) ); |
|
424 |
|
425 timeIndicator->SetRect( timePane.TextRect() ); |
|
426 timeIndicator->SetFont( timePane.Font() ); |
|
427 |
|
428 TRgb timeColor( AKN_LAF_COLOR( KRgbBlack.Value() ) ); |
|
429 |
|
430 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
|
431 timeColor, |
|
432 KAknsIIDQsnIconColors, |
|
433 EAknsCIQsnIconColorsCG7 ); |
|
434 |
|
435 TRAP_IGNORE( timeIndicator->OverrideColorL( EColorLabelText, timeColor ) ); |
|
436 |
|
437 TInt align( ELayoutAlignNone ); |
|
438 switch( timePane.Align() ) |
|
439 { |
|
440 case CGraphicsContext::ELeft: |
|
441 { |
|
442 align = ELayoutAlignLeft; |
|
443 break; |
|
444 } |
|
445 case CGraphicsContext::ECenter: |
|
446 { |
|
447 align = ELayoutAlignCenter; |
|
448 break; |
|
449 } |
|
450 case CGraphicsContext::ERight: |
|
451 { |
|
452 align = ELayoutAlignRight; |
|
453 break; |
|
454 } |
|
455 default: |
|
456 { |
|
457 break; |
|
458 } |
|
459 } |
|
460 |
|
461 timeIndicator->SetLabelAlignment( align ); |
|
462 } |
|
463 } |
|
464 |
|
465 // ---------------------------------------------------------------------------- |
|
466 // CMsgNaviPaneControl::SetIconIndicatorExtent |
|
467 // Sets given icon extent to specified one. |
|
468 // ---------------------------------------------------------------------------- |
|
469 // |
|
470 void CMsgNaviPaneControl::SetIconIndicatorExtent( CEikImage* aIconIndicator, |
|
471 const TAknLayoutRect& aExtent) const |
|
472 { |
|
473 TInt result = AknIconUtils::SetSize( const_cast<CFbsBitmap*>( aIconIndicator->Bitmap() ), |
|
474 aExtent.Rect().Size() ); |
|
475 |
|
476 if ( result == KErrNone ) |
|
477 { |
|
478 aIconIndicator->SetRect( aExtent.Rect() ); |
|
479 } |
|
480 else |
|
481 { |
|
482 aIconIndicator->SetRect( TRect() ); |
|
483 } |
|
484 } |
|
485 |
|
486 // ---------------------------------------------------------------------------- |
|
487 // CMsgNaviPaneControl::InitializeIconIndicatorL |
|
488 // Creates and initializes given member variable icon control with specified bitmap and mask. |
|
489 // ---------------------------------------------------------------------------- |
|
490 // |
|
491 void CMsgNaviPaneControl::InitializeIconIndicatorL( CEikImage*& aIndicator, |
|
492 const TAknsItemID& aItem, |
|
493 const TInt aBitmapIndex, |
|
494 const TInt aMaskIndex ) const |
|
495 { |
|
496 // Initializes member variable |
|
497 aIndicator = new( ELeave ) CEikImage; |
|
498 aIndicator->SetContainerWindowL( *this ); |
|
499 |
|
500 TParse fileParse; |
|
501 User::LeaveIfError( fileParse.Set( KIconMbmFile, &KDC_APP_BITMAP_DIR, NULL ) ); |
|
502 |
|
503 CFbsBitmap* bitmap = NULL; |
|
504 CFbsBitmap* mask = NULL; |
|
505 |
|
506 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
507 aItem, |
|
508 KAknsIIDQsnIconColors, |
|
509 EAknsCIQsnIconColorsCG7, |
|
510 bitmap, |
|
511 mask, |
|
512 fileParse.FullName(), |
|
513 aBitmapIndex, |
|
514 aMaskIndex, |
|
515 AKN_LAF_COLOR( KRgbBlack.Value() ) ); |
|
516 |
|
517 |
|
518 aIndicator->SetNewBitmaps( bitmap, mask ); |
|
519 } |
|
520 |
|
521 // ---------------------------------------------------------------------------- |
|
522 // CSmilPlayerVolumeIndicatorController::UpdateNavigationIndicatorsL |
|
523 // ---------------------------------------------------------------------------- |
|
524 // |
|
525 void CMsgNaviPaneControl::UpdateNavigationIndicatorsL() |
|
526 { |
|
527 if ( iEikonEnv->StartedAsServerApp() ) |
|
528 { |
|
529 TBool nextMessage = iMessageIterator->NextMessageExists(); |
|
530 TBool previousMessage = iMessageIterator->PreviousMessageExists(); |
|
531 |
|
532 CEikImage* rightArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviRightArrowControlId ); |
|
533 CEikImage* leftArrowIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviLeftArrowControlId ); |
|
534 CEikImage* navigationIndicator = iControlArray->ControlById<CEikImage>( EMsgNaviNavigationControlId ); |
|
535 |
|
536 if ( AknLayoutUtils::LayoutMirrored() ) |
|
537 { |
|
538 TBool temp = nextMessage; |
|
539 nextMessage = previousMessage; |
|
540 previousMessage = temp; |
|
541 } |
|
542 |
|
543 if ( nextMessage ) |
|
544 { |
|
545 if ( !rightArrowIndicator ) |
|
546 { |
|
547 InitializeIconIndicatorL( rightArrowIndicator, |
|
548 KAknsIIDQgnIndiNaviArrowRight, |
|
549 EMbmMsgeditorQgn_indi_navi_arrow_right, |
|
550 EMbmMsgeditorQgn_indi_navi_arrow_right_mask ); |
|
551 |
|
552 AddToControlArrayL( rightArrowIndicator, EMsgNaviRightArrowControlId ); |
|
553 } |
|
554 } |
|
555 else |
|
556 { |
|
557 RemoveFromControlArray( EMsgNaviRightArrowControlId ); |
|
558 rightArrowIndicator = NULL; |
|
559 } |
|
560 |
|
561 if ( previousMessage ) |
|
562 { |
|
563 if ( !leftArrowIndicator ) |
|
564 { |
|
565 InitializeIconIndicatorL( leftArrowIndicator, |
|
566 KAknsIIDQgnIndiNaviArrowLeft, |
|
567 EMbmMsgeditorQgn_indi_navi_arrow_left, |
|
568 EMbmMsgeditorQgn_indi_navi_arrow_left_mask ); |
|
569 |
|
570 AddToControlArrayL( leftArrowIndicator, EMsgNaviLeftArrowControlId ); |
|
571 } |
|
572 } |
|
573 else |
|
574 { |
|
575 RemoveFromControlArray( EMsgNaviLeftArrowControlId ); |
|
576 leftArrowIndicator = NULL; |
|
577 } |
|
578 |
|
579 if ( rightArrowIndicator || leftArrowIndicator ) |
|
580 { |
|
581 LayoutNavigationIndicators(); |
|
582 } |
|
583 else |
|
584 { |
|
585 RemoveFromControlArray( EMsgNaviNavigationControlId ); |
|
586 } |
|
587 |
|
588 DrawDeferred(); |
|
589 } |
|
590 } |
|
591 |
|
592 // ---------------------------------------------------------------------------- |
|
593 // CMsgNaviPaneControl::UpdatePriorityIndicatorL |
|
594 // ---------------------------------------------------------------------------- |
|
595 // |
|
596 void CMsgNaviPaneControl::UpdatePriorityIndicatorL() |
|
597 { |
|
598 RemoveFromControlArray( EMsgNaviPriorityControlId ); |
|
599 |
|
600 CEikImage* priorityIndicator = NULL; |
|
601 |
|
602 if ( iPriority == EMsgEditorMsgPriorityLow ) |
|
603 { |
|
604 InitializeIconIndicatorL( priorityIndicator, |
|
605 KAknsIIDQgnIndiMcePriorityLow, |
|
606 EMbmMsgeditorQgn_indi_mce_priority_low, |
|
607 EMbmMsgeditorQgn_indi_mce_priority_low_mask ); |
|
608 } |
|
609 else if ( iPriority == EMsgEditorMsgPriorityHigh ) |
|
610 { |
|
611 InitializeIconIndicatorL( priorityIndicator, |
|
612 KAknsIIDQgnIndiMcePriorityHigh, |
|
613 EMbmMsgeditorQgn_indi_mce_priority_high, |
|
614 EMbmMsgeditorQgn_indi_mce_priority_high_mask ); |
|
615 } |
|
616 |
|
617 if ( priorityIndicator ) |
|
618 { |
|
619 iPriorityIndicator = ETrue; |
|
620 AddToControlArrayL( priorityIndicator, EMsgNaviPriorityControlId ); |
|
621 LayoutPriorityIndicator(); |
|
622 } |
|
623 else |
|
624 { |
|
625 iPriorityIndicator = EFalse; |
|
626 } |
|
627 |
|
628 DrawDeferred(); |
|
629 } |
|
630 |
|
631 // ---------------------------------------------------------------------------- |
|
632 // CMsgNaviPaneControl::UpdateTimeIndicatorL |
|
633 // ---------------------------------------------------------------------------- |
|
634 // |
|
635 void CMsgNaviPaneControl::UpdateTimeIndicatorL() |
|
636 { |
|
637 TTime homeTime; |
|
638 homeTime.HomeTime(); |
|
639 |
|
640 TDateTime nowDateTime = homeTime.DateTime(); |
|
641 TDateTime messageDateTime = iTime.DateTime(); |
|
642 |
|
643 |
|
644 HBufC* dateFormat = StringLoader::LoadLC( R_QTN_DATE_SHORT_WITH_ZERO, iCoeEnv ); |
|
645 TBuf<KTimeStringMaxLength> datestring; |
|
646 iTime.FormatL( datestring, dateFormat->Des() ); |
|
647 |
|
648 |
|
649 HBufC* timeFormat = StringLoader::LoadLC( R_QTN_TIME_USUAL,iCoeEnv ); |
|
650 TBuf<KTimeStringMaxLength> timestring; |
|
651 iTime.FormatL( timestring, timeFormat->Des() ); |
|
652 |
|
653 |
|
654 CDesCArray* array = new( ELeave )CDesCArrayFlat( 2 ); // two items |
|
655 CleanupStack::PushL( array ); |
|
656 array->AppendL( timestring ); |
|
657 array->AppendL( datestring ); |
|
658 HBufC* buff = StringLoader::LoadLC( R_QTN_MSG_TIMESTAMP,*array,iCoeEnv ); |
|
659 |
|
660 |
|
661 |
|
662 CEikLabel* timeIndicator = iControlArray->ControlById<CEikLabel>( EMsgNaviTimeControlId ); |
|
663 if ( !timeIndicator ) |
|
664 { |
|
665 timeIndicator = new( ELeave ) CEikLabel; |
|
666 AddToControlArrayL( timeIndicator, EMsgNaviTimeControlId ); |
|
667 |
|
668 timeIndicator->SetContainerWindowL( *this ); |
|
669 } |
|
670 |
|
671 TPtr datetimePtr = buff->Des(); |
|
672 AknTextUtils::DisplayTextLanguageSpecificNumberConversion(datetimePtr); |
|
673 |
|
674 timeIndicator->SetTextL(buff->Des()); |
|
675 CleanupStack::PopAndDestroy(4); // buff,array,timeformat,dateformat |
|
676 |
|
677 LayoutTimeIndicator(); |
|
678 DrawDeferred(); |
|
679 } |
|
680 |
|
681 // ---------------------------------------------------------------------------- |
|
682 // CMsgNaviPaneControl::AddToControlArrayL |
|
683 // ---------------------------------------------------------------------------- |
|
684 // |
|
685 void CMsgNaviPaneControl::AddToControlArrayL( CCoeControl* aControl, TMsgNaviControlId aControlId ) |
|
686 { |
|
687 iControlArray->AppendLC( aControl, aControlId ); |
|
688 CleanupStack::Pop( aControl ); |
|
689 } |
|
690 |
|
691 // ---------------------------------------------------------------------------- |
|
692 // CMsgNaviPaneControl::RemoveFromControlArray |
|
693 // ---------------------------------------------------------------------------- |
|
694 // |
|
695 void CMsgNaviPaneControl::RemoveFromControlArray( TMsgNaviControlId aControlId ) |
|
696 { |
|
697 CCoeControl* control = iControlArray->RemoveById( aControlId ); |
|
698 delete control; |
|
699 } |
|
700 |
|
701 // ---------------------------------------------------------------------------- |
|
702 // CMsgNaviPaneControl::HandleSkinChangeL |
|
703 // |
|
704 // Sets the currently used skin color for shown indicators. |
|
705 // ---------------------------------------------------------------------------- |
|
706 // |
|
707 void CMsgNaviPaneControl::HandleSkinChangeL() |
|
708 { |
|
709 TRgb indicatorColor( AKN_LAF_COLOR( KRgbBlack.Value() ) ); |
|
710 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
|
711 indicatorColor, |
|
712 KAknsIIDQsnIconColors, |
|
713 EAknsCIQsnIconColorsCG7 ); |
|
714 |
|
715 CEikLabel* timeIndicator = iControlArray->ControlById<CEikLabel>( EMsgNaviTimeControlId ); |
|
716 if ( timeIndicator ) |
|
717 { |
|
718 timeIndicator->OverrideColorL( EColorLabelText, indicatorColor ); |
|
719 } |
|
720 |
|
721 RemoveFromControlArray( EMsgNaviPriorityControlId ); |
|
722 UpdatePriorityIndicatorL(); |
|
723 |
|
724 RemoveFromControlArray( EMsgNaviRightArrowControlId ); |
|
725 RemoveFromControlArray( EMsgNaviLeftArrowControlId ); |
|
726 RemoveFromControlArray( EMsgNaviNavigationControlId ); |
|
727 UpdateNavigationIndicatorsL(); |
|
728 } |
|
729 |
|
730 // ---------------------------------------------------------------------------- |
|
731 // CMsgNaviPaneControl::UpdateVarientId |
|
732 // |
|
733 // Depending upon the orientation and Priority of the Message. varientid is set. |
|
734 // ---------------------------------------------------------------------------- |
|
735 // |
|
736 void CMsgNaviPaneControl::UpdateVarientId() |
|
737 { |
|
738 if(Layout_Meta_Data::IsLandscapeOrientation()) |
|
739 { |
|
740 if(iPriorityIndicator) |
|
741 { |
|
742 iVarientId = 4; |
|
743 } |
|
744 else |
|
745 { |
|
746 iVarientId = 3; |
|
747 } |
|
748 } |
|
749 else // portrait mode |
|
750 { |
|
751 if(iPriorityIndicator) |
|
752 { |
|
753 iVarientId = 2; |
|
754 } |
|
755 else |
|
756 { |
|
757 iVarientId = 1; |
|
758 } |
|
759 } |
|
760 } |
|
761 // End of File |