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