iaupdate/IAD/ui/src/iaupdatemaincontainer.cpp
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 30 398876c4ffa7
child 33 8110bf1194d1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
     1 /*
       
     2 * Copyright (c) 2007-2010 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:   This module contains the implementation of CIAUpdateMainContainer class 
       
    15 *                member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 //INCLUDES
       
    22 #include <barsread.h>
       
    23 #include <coemain.h>
       
    24 #include <aknlists.h>
       
    25 #include <badesca.h> // CDesCArray
       
    26 #include <iaupdate.rsg>
       
    27 #include <avkon.mbg>
       
    28 #include <iaupdate.mbg>
       
    29 #include <AknIconArray.h> 
       
    30 #include <gulicon.h>
       
    31 #include <StringLoader.h>
       
    32 #include <data_caging_path_literals.hrh>
       
    33 #include <e32property.h>
       
    34 #include <featmgr.h>
       
    35 
       
    36 #include "iaupdatefwnode.h"
       
    37 #include "iaupdatemaincontainer.h"
       
    38 #include "iaupdatecontainerobserver.h"
       
    39 #include "iaupdateapplication.h"
       
    40 #include "iaupdatenode.h"
       
    41 #include "iaupdatebasenode.h"
       
    42 #include "iaupdateversion.h"
       
    43 #include "iaupdatefwnsmlpskeys.h"
       
    44 
       
    45 //MACROS
       
    46 _LIT( KTabulator, "\t" );
       
    47 _LIT( KOne, "1");
       
    48 _LIT( KTwo, "2");
       
    49 _LIT( KSpace, " ");
       
    50 
       
    51 //CONSTANTS
       
    52 const TInt KKiloByte = 1024;
       
    53 const TInt KMegaByte = 1024 * 1024;
       
    54 const TInt KMaxShownInKiloBytes = 10 * KMegaByte;
       
    55 
       
    56 _LIT( KSWUPDATE_HLP_MAIN, "SWUPDATE_HLP_MAIN" ); 
       
    57 
       
    58 // MACROS
       
    59 _LIT(KIAUpdateIconFileName, "IAUpdate.mif");
       
    60 
       
    61 //CONST
       
    62 
       
    63 const TUid KFOTAUid = {0x102072C4};
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CIAUpdateMainContainer::NewL
       
    67 // Two-phased constructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CIAUpdateMainContainer* CIAUpdateMainContainer::NewL( 
       
    71                                          const TRect& aRect, 
       
    72                                          MIAUpdateContainerObserver& aObserver )
       
    73     {
       
    74     CIAUpdateMainContainer* self = CIAUpdateMainContainer::NewLC(aRect,aObserver);
       
    75     CleanupStack::Pop(self);
       
    76     return self;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CIAUpdateMainContainer::NewLC
       
    81 // 
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 CIAUpdateMainContainer* CIAUpdateMainContainer::NewLC( 
       
    85                                           const TRect& aRect, 
       
    86                                           MIAUpdateContainerObserver& aObserver )
       
    87     {
       
    88     CIAUpdateMainContainer* self = new (ELeave) CIAUpdateMainContainer(aObserver);
       
    89     CleanupStack::PushL(self);
       
    90     self->ConstructL(aRect);
       
    91     return self;
       
    92     }
       
    93 // -----------------------------------------------------------------------------
       
    94 // CIAUpdateMainContainer::CIAUpdateMainContainer
       
    95 // C++ default constructor can NOT contain any code, that
       
    96 // might leave.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 CIAUpdateMainContainer::CIAUpdateMainContainer(MIAUpdateContainerObserver& aObserver)
       
   100     : iObserver( aObserver )
       
   101     {
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CIAUpdateMainContainer::~CIAUpdateMainContainer
       
   106 // Destructor
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 CIAUpdateMainContainer::~CIAUpdateMainContainer()
       
   110     {
       
   111 	delete iListBox;
       
   112     }
       
   113     
       
   114 // -----------------------------------------------------------------------------
       
   115 // CIAUpdateMainContainer::ConstructL
       
   116 // Symbian 2nd phase constructor can leave.
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 void CIAUpdateMainContainer::ConstructL(const TRect& aRect )
       
   120     {
       
   121     // Create a window for this application view
       
   122     CreateWindowL();
       
   123 
       
   124     // Create list box
       
   125     iListBox = new (ELeave) CAknDoubleGraphicStyleListBox();
       
   126     iListBox->SetContainerWindowL( *this );
       
   127     
       
   128     TResourceReader reader;
       
   129     iEikonEnv->CreateResourceReaderLC( reader, R_IAUPDATE_UPDATES_LIST );
       
   130     iListBox->ConstructFromResourceL( reader );
       
   131     CleanupStack::PopAndDestroy();
       
   132 
       
   133     iListBox->EnableStretching( EFalse );
       
   134     iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
       
   135 
       
   136     // Setup scroll bars
       
   137     iListBox->CreateScrollBarFrameL( ETrue );
       
   138     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
       
   139         CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );    
       
   140 
       
   141     // Create item text array
       
   142     iItemTextArray = new (ELeave) CDesCArrayFlat(2);    
       
   143     iListBox->Model()->SetItemTextArray( iItemTextArray );
       
   144     iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray) ;
       
   145     
       
   146     HBufC* text = KNullDesC().AllocLC();    
       
   147     iListBox->View()->SetListEmptyTextL( *text );
       
   148     CleanupStack::PopAndDestroy( text );
       
   149    
       
   150     // Create icon array
       
   151     
       
   152     CFbsBitmap* bitmap = 0;
       
   153     CFbsBitmap* mask = 0;
       
   154 
       
   155     CArrayPtr<CGulIcon>* iconArray = new (ELeave) CAknIconArray( 3 );    
       
   156     CleanupStack::PushL( iconArray );
       
   157     
       
   158     AknIconUtils::CreateIconLC(
       
   159         bitmap, 
       
   160         mask, 
       
   161         AknIconUtils::AvkonIconFileName(), 
       
   162         EMbmAvkonQgn_prop_checkbox_on, 
       
   163         EMbmAvkonQgn_prop_checkbox_on_mask );
       
   164     CGulIcon* icon = CGulIcon::NewLC();
       
   165     icon->SetBitmap( bitmap );
       
   166     icon->SetMask( mask );
       
   167     icon->SetBitmapsOwnedExternally( EFalse );
       
   168     iconArray->AppendL( icon );
       
   169     
       
   170     CleanupStack::Pop( icon );
       
   171     CleanupStack::Pop( mask );
       
   172     CleanupStack::Pop( bitmap );
       
   173 
       
   174     AknIconUtils::CreateIconLC(
       
   175         bitmap, 
       
   176         mask, 
       
   177         AknIconUtils::AvkonIconFileName(), 
       
   178         EMbmAvkonQgn_prop_checkbox_off, 
       
   179         EMbmAvkonQgn_prop_checkbox_off_mask );
       
   180     icon = CGulIcon::NewLC();
       
   181     icon->SetBitmap( bitmap );
       
   182     icon->SetMask( mask );
       
   183     icon->SetBitmapsOwnedExternally( EFalse );
       
   184     iconArray->AppendL( icon );
       
   185     
       
   186     CleanupStack::Pop( icon );
       
   187     CleanupStack::Pop( mask );
       
   188     CleanupStack::Pop( bitmap );
       
   189     
       
   190     HBufC* iconFilePath = HBufC::NewLC( KDC_APP_BITMAP_DIR().Length() + 
       
   191                                         KIAUpdateIconFileName().Length() +2 );
       
   192     TPtr ptr = iconFilePath->Des();
       
   193     ptr.Append( KDC_APP_BITMAP_DIR );
       
   194     ptr.Append( KIAUpdateIconFileName );
       
   195           
       
   196     TRAPD( err, CreateIconL( bitmap, 
       
   197                              mask, 
       
   198                              *iconFilePath, 
       
   199                              EMbmIaupdateQgn_indi_important_add, 
       
   200                              EMbmIaupdateQgn_indi_important_add_mask ) ); 
       
   201     if ( err == KErrNone ) 
       
   202         {
       
   203         CleanupStack::PushL( bitmap );
       
   204         CleanupStack::PushL( mask );
       
   205         }
       
   206     else if ( err == KErrEof )
       
   207         {
       
   208         // icon does not exist in Z drive. I.e IAD eclipsed over phase 1 version.
       
   209         // So icon to be retrieved from C drive. 
       
   210         ptr.Zero();
       
   211     	ptr.Append( _L("C:") );
       
   212     	ptr.Append( KDC_APP_BITMAP_DIR );
       
   213         ptr.Append( KIAUpdateIconFileName );
       
   214         AknIconUtils::CreateIconLC(
       
   215                       bitmap, 
       
   216                       mask, 
       
   217                       *iconFilePath, 
       
   218                       EMbmIaupdateQgn_indi_important_add, 
       
   219                       EMbmIaupdateQgn_indi_important_add_mask );
       
   220         }
       
   221     else
       
   222         {
       
   223         User::Leave( err );	
       
   224         }
       
   225 
       
   226     icon = CGulIcon::NewLC();
       
   227     icon->SetBitmap( bitmap );
       
   228     icon->SetMask( mask );
       
   229     icon->SetBitmapsOwnedExternally( EFalse );
       
   230     iconArray->AppendL( icon );
       
   231     
       
   232     CleanupStack::Pop( icon );
       
   233     CleanupStack::Pop( mask );
       
   234     CleanupStack::Pop( bitmap );
       
   235     CleanupStack::PopAndDestroy( iconFilePath );
       
   236     
       
   237     CleanupStack::Pop( iconArray ); 
       
   238     iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
       
   239 
       
   240     iListBox->SetListBoxObserver( this );
       
   241     
       
   242     // Set the windows size
       
   243     SetRect( aRect );
       
   244 
       
   245     // Activate the window, which makes it ready to be drawn
       
   246     ActivateL();
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CIAUpdateMainContainer::HandleMarkCommandL
       
   251 // Handles Mark/Unmark commnds
       
   252 // -----------------------------------------------------------------------------
       
   253 //
       
   254 void CIAUpdateMainContainer::HandleMarkCommandL( TInt aCommand )
       
   255     {
       
   256     TInt index = iListBox->CurrentItemIndex();
       
   257        
       
   258     TBool markingAccepted = EFalse;
       
   259     if( !iListBox->View()->ItemIsSelected( index ) )                                                                                             
       
   260         {
       
   261         // aCommand is set to EAknCmdMark if current item is not selected.
       
   262         // That's because passed command id may be wrong when using touch UI 
       
   263         aCommand = EAknCmdMark;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
       
   264         markingAccepted = iObserver.MarkListItemL( ETrue, index );
       
   265         }
       
   266     else 
       
   267         {
       
   268         // aCommand is set to EAknCmdUnmark if current item is selected.
       
   269         // That's because passed command id may be wrong when using touch UI    
       
   270         aCommand = EAknCmdUnmark;
       
   271         markingAccepted = iObserver.MarkListItemL( EFalse, index ); 
       
   272         }
       
   273         
       
   274 	if ( markingAccepted )
       
   275 	    {
       
   276         AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
       
   277 	    }
       
   278     }
       
   279 
       
   280 // -----------------------------------------------------------------------------
       
   281 // CIAUpdateMainContainer::RefreshL
       
   282 // Refresh list
       
   283 // -----------------------------------------------------------------------------
       
   284 //
       
   285 void CIAUpdateMainContainer::RefreshL( const RPointerArray<MIAUpdateAnyNode>& aNodes,
       
   286                                        TInt aError )
       
   287     {
       
   288     iItemTextArray->Reset();
       
   289         
       
   290     for( TInt i = 0; i < aNodes.Count(); ++i ) 
       
   291         {
       
   292         MIAUpdateAnyNode* node = aNodes[i];
       
   293         TInt sizeInBytes = node->Base().ContentSizeL();
       
   294 
       
   295         TInt size = 0;
       
   296         TBool shownInMegabytes = EFalse;        
       
   297         if ( sizeInBytes >= KMaxShownInKiloBytes )
       
   298             {
       
   299     	    shownInMegabytes = ETrue;
       
   300     	    size = sizeInBytes / KMegaByte;
       
   301     	    if ( sizeInBytes % KMegaByte != 0 )
       
   302     	        {
       
   303     	    	size++;
       
   304     	        }
       
   305             }
       
   306         else 
       
   307             {
       
   308     	    size = sizeInBytes / KKiloByte;
       
   309     	    if ( sizeInBytes % KKiloByte != 0 )
       
   310     	        {
       
   311     	    	size++;
       
   312     	        }  
       
   313             }
       
   314             
       
   315         HBufC* importanceDescription( NULL );        
       
   316         switch( node->Base().Importance() )
       
   317         {        
       
   318         case MIAUpdateBaseNode::EMandatory:
       
   319             {
       
   320             if ( shownInMegabytes )
       
   321                 {
       
   322                 importanceDescription = StringLoader::LoadLC(
       
   323                                    R_IAUPDATE_DES_REQUIRED_UPDATE_MB, size );
       
   324                 }
       
   325             else 
       
   326                 {
       
   327                 importanceDescription = StringLoader::LoadLC(
       
   328                                    R_IAUPDATE_DES_REQUIRED_UPDATE_KB, size );   
       
   329                 }  
       
   330             break;
       
   331             }
       
   332         
       
   333         
       
   334         case MIAUpdateBaseNode::ECritical:
       
   335             {
       
   336             TBool isNSU = EFalse;
       
   337             if( node->NodeType() == MIAUpdateAnyNode::ENodeTypeFw )
       
   338                 {
       
   339                 MIAUpdateFwNode* fwnode = static_cast<MIAUpdateFwNode*>( node );          
       
   340                 if ( fwnode->FwType() == MIAUpdateFwNode::EFotiNsu )
       
   341                     {
       
   342                     isNSU = ETrue;
       
   343                     }
       
   344                 }
       
   345 
       
   346             if ( !size || isNSU )
       
   347                 {
       
   348                 //for firmware when size info is not provided by server
       
   349                 importanceDescription = StringLoader::LoadLC(
       
   350                                                        R_IAUPDATE_DES_CRITICAL_UPDATE_NO_SIZE );
       
   351                 }
       
   352             else
       
   353                 {
       
   354                 if ( shownInMegabytes )
       
   355                     {
       
   356                     importanceDescription = StringLoader::LoadLC(
       
   357                                        R_IAUPDATE_DES_CRITICAL_UPDATE_MB, size );
       
   358                     }
       
   359                 else 
       
   360                     {
       
   361                     importanceDescription = StringLoader::LoadLC(
       
   362                                        R_IAUPDATE_DES_CRITICAL_UPDATE_KB, size );   
       
   363                     } 
       
   364                 }
       
   365  
       
   366             break;
       
   367             }
       
   368     
       
   369         case MIAUpdateBaseNode::ERecommended:
       
   370             {
       
   371             if ( shownInMegabytes )
       
   372                 {
       
   373             	importanceDescription = StringLoader::LoadLC(
       
   374             	                   R_IAUPDATE_DES_RECOMMENDED_UPDATE_MB, size );
       
   375                 }
       
   376             else 
       
   377                 {
       
   378                 importanceDescription = StringLoader::LoadLC(
       
   379             	                   R_IAUPDATE_DES_RECOMMENDED_UPDATE_KB, size );	
       
   380                 }  
       
   381             break;
       
   382             }
       
   383     
       
   384         case MIAUpdateBaseNode::ENormal:
       
   385             {
       
   386             if ( shownInMegabytes )
       
   387                 {
       
   388             	importanceDescription = StringLoader::LoadLC(
       
   389             	                   R_IAUPDATE_DES_NORMAL_UPDATE_MB, size );
       
   390                 }
       
   391             else 
       
   392                 {
       
   393                 importanceDescription = StringLoader::LoadLC(
       
   394             	                   R_IAUPDATE_DES_NORMAL_UPDATE_KB, size );	
       
   395                 }  
       
   396             break;
       
   397             }
       
   398 
       
   399         default:
       
   400             {
       
   401             importanceDescription = KNullDesC().AllocLC();
       
   402             break;
       
   403             }
       
   404         }
       
   405         
       
   406         TPtr ptr = importanceDescription->Des();
       
   407         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );    
       
   408         
       
   409         
       
   410         
       
   411         if ( node->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal )  
       
   412             {       
       
   413             HBufC* name = node->Base().Name().AllocLC();
       
   414             HBufC* buffer = HBufC::NewLC( KOne.iTypeLength +
       
   415                                           KTabulator.iTypeLength + 
       
   416                                           name->Length() + 
       
   417                                           KTabulator.iTypeLength +
       
   418                                           importanceDescription->Length() );
       
   419             buffer->Des() = KOne();
       
   420             buffer->Des() += KTabulator();
       
   421             buffer->Des() += *name;
       
   422             buffer->Des() += KTabulator();
       
   423             buffer->Des() += *importanceDescription;        
       
   424             
       
   425             iItemTextArray->AppendL( *buffer );
       
   426             
       
   427             CleanupStack::PopAndDestroy( buffer );
       
   428             CleanupStack::PopAndDestroy( name );
       
   429             }
       
   430         
       
   431         if ( node->NodeType() == MIAUpdateAnyNode::ENodeTypeFw ) 
       
   432             {
       
   433             HBufC* firmwareHeader = StringLoader::LoadLC(R_IAUPDATE_MAIN_DEVICE_FW);
       
   434             HBufC* firmwarename = HBufC::NewLC( node->Base().Name().Length() +
       
   435                                                 KSpace.iTypeLength + 
       
   436                                                 firmwareHeader->Length() );
       
   437             firmwarename->Des() = node->Base().Name();
       
   438             firmwarename->Des() += KSpace();
       
   439             firmwarename->Des() += *firmwareHeader;
       
   440                      
       
   441             HBufC* buffer = HBufC::NewLC( KOne.iTypeLength +
       
   442                                           KTabulator.iTypeLength + 
       
   443                                           firmwarename->Length() + 
       
   444                                           KTabulator.iTypeLength +
       
   445                                           importanceDescription->Length() +
       
   446                                           KTabulator.iTypeLength +
       
   447                                           KTwo.iTypeLength );
       
   448             buffer->Des() = KOne();
       
   449             buffer->Des() += KTabulator();
       
   450             buffer->Des() += *firmwarename;
       
   451             buffer->Des() += KTabulator();
       
   452             buffer->Des() += *importanceDescription;        
       
   453             buffer->Des() += KTabulator();
       
   454             buffer->Des() += KTwo();
       
   455             
       
   456             iItemTextArray->AppendL( *buffer );
       
   457             CleanupStack::PopAndDestroy( buffer );
       
   458             CleanupStack::PopAndDestroy( firmwarename );
       
   459             CleanupStack::PopAndDestroy( firmwareHeader );
       
   460             }
       
   461         
       
   462         CleanupStack::PopAndDestroy( importanceDescription );
       
   463         }    
       
   464     
       
   465     if ( aNodes.Count() == 0 )
       
   466         {
       
   467     	HBufC* emptyText = NULL;
       
   468         if ( aError )
       
   469             {
       
   470             if ( aError == KErrCancel || aError == KErrAbort )
       
   471                 {
       
   472         	    emptyText = KNullDesC().AllocLC();
       
   473                 }
       
   474             else
       
   475                 {
       
   476                 emptyText = StringLoader::LoadLC( R_IAUPDATE_REFRESH_FAILED );	
       
   477                 }
       
   478     	    }
       
   479         else
       
   480             {
       
   481             emptyText = StringLoader::LoadLC( R_IAUPDATE_TEXT_NO_UPDATES );	
       
   482             }
       
   483         
       
   484         iListBox->View()->SetListEmptyTextL( *emptyText );
       
   485         CleanupStack::PopAndDestroy( emptyText );
       
   486         iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
       
   487                 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );  
       
   488         }
       
   489     else
       
   490         {
       
   491         if ( iListBox->CurrentItemIndex() == KErrNotFound )
       
   492             {
       
   493            	iListBox->SetCurrentItemIndex( aNodes.Count() - 1 );
       
   494             }
       
   495         }
       
   496         
       
   497     iListBox->HandleItemAdditionL();
       
   498     }
       
   499     
       
   500 // -----------------------------------------------------------------------------
       
   501 // CIAUpdateMainContainer::GetCurrentNode
       
   502 // 
       
   503 // -----------------------------------------------------------------------------
       
   504 //
       
   505 MIAUpdateAnyNode* CIAUpdateMainContainer::GetCurrentNode( 
       
   506                                     const RPointerArray<MIAUpdateAnyNode>& aNodes )    
       
   507     {
       
   508     MIAUpdateAnyNode* currentNode = NULL;
       
   509     
       
   510     TInt currentIndex = iListBox->CurrentItemIndex();
       
   511     
       
   512     if( currentIndex != -1 )
       
   513         {
       
   514         
       
   515         currentNode = aNodes[currentIndex];
       
   516         
       
   517         }
       
   518     return currentNode;
       
   519     }
       
   520 
       
   521 
       
   522 // -----------------------------------------------------------------------------
       
   523 // CIAUpdateMainContainer::SetSelectedIndicesL
       
   524 // 
       
   525 // -----------------------------------------------------------------------------
       
   526 //    
       
   527 void CIAUpdateMainContainer::SetSelectedIndicesL( 
       
   528                             const RArray<TInt>& aIndices )
       
   529     {    
       
   530     CArrayFixFlat<TInt>* indexes = new(ELeave) CArrayFixFlat<TInt>( aIndices.Count() + 1 );
       
   531     
       
   532     CleanupStack::PushL( indexes );
       
   533     
       
   534     for( TInt i = 0; i < aIndices.Count(); ++i )
       
   535         {
       
   536         indexes->AppendL( aIndices[i] );
       
   537         }
       
   538         
       
   539     iListBox->View()->SetSelectionIndexesL( indexes );
       
   540     
       
   541     UpdateMSKTextL();  
       
   542     CleanupStack::PopAndDestroy( indexes );
       
   543     }
       
   544 
       
   545 
       
   546 // -----------------------------------------------------------------------------
       
   547 // CIAUpdateMainContainer::CleanAllSelectionL
       
   548 // 
       
   549 // -----------------------------------------------------------------------------
       
   550 // 
       
   551 void CIAUpdateMainContainer::CleanAllSelection()
       
   552     {
       
   553     iListBox->View()->ClearSelection();
       
   554     }
       
   555 
       
   556 // -----------------------------------------------------------------------------
       
   557 // CIAUpdateMainContainer::OfferKeyEventL
       
   558 // Some key events are passed to the list componenent 
       
   559 // -----------------------------------------------------------------------------
       
   560 //       
       
   561 TKeyResponse CIAUpdateMainContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   562                                                      TEventCode aType )
       
   563     {
       
   564     TKeyResponse response = EKeyWasNotConsumed;    
       
   565 
       
   566 
       
   567     if( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmFota ) ) //NFUI
       
   568         {
       
   569         if (aKeyEvent.iScanCode == EStdKeyDevice0 
       
   570                 || aKeyEvent.iScanCode == EStdKeyDevice3 
       
   571                 || aKeyEvent.iScanCode ==   EStdKeyHash )
       
   572             {
       
   573          
       
   574             TBool value (EFalse);
       
   575             TInt err = RProperty::Get( KPSUidNSmlDMSyncApp, KFotaDLStatus, value );
       
   576             if (!err && value == 1)
       
   577                 {
       
   578     
       
   579                 TApaTaskList taskList(CEikonEnv::Static()->WsSession());
       
   580                 TApaTask task=taskList.FindApp( KFOTAUid );
       
   581            
       
   582                 if(task.Exists())
       
   583                     {
       
   584                     task.BringToForeground();
       
   585                     }
       
   586                 return EKeyWasConsumed;
       
   587                 }
       
   588             }
       
   589         }
       
   590  
       
   591     if( aType == EEventKey )
       
   592         {
       
   593         switch( aKeyEvent.iCode )
       
   594             {
       
   595             case EKeyUpArrow:
       
   596             case EKeyDownArrow:
       
   597                 {                    
       
   598                 response = iListBox->OfferKeyEventL(aKeyEvent, aType); 
       
   599                 UpdateMSKTextL();   
       
   600                 break;    
       
   601                 }
       
   602             default:
       
   603                 {
       
   604                 break;
       
   605                 }
       
   606              
       
   607             }
       
   608         }
       
   609     return response;        
       
   610     }
       
   611 
       
   612 // -----------------------------------------------------------------------------
       
   613 // CIAUpdateMainContainer::SizeChanged
       
   614 //  
       
   615 // -----------------------------------------------------------------------------
       
   616 //  
       
   617 void CIAUpdateMainContainer::SizeChanged()
       
   618     {
       
   619     iListBox->SetRect( Rect() );
       
   620     }
       
   621 
       
   622 // -----------------------------------------------------------------------------
       
   623 // CIAUpdateMainContainer::CountComponentControls
       
   624 //  
       
   625 // -----------------------------------------------------------------------------
       
   626 //  
       
   627 TInt CIAUpdateMainContainer::CountComponentControls() const
       
   628     {
       
   629     if ( iListBox )
       
   630         {
       
   631     	return 1;
       
   632         }
       
   633     else
       
   634         {
       
   635         return 0;	
       
   636         }
       
   637     }
       
   638 
       
   639 // -----------------------------------------------------------------------------
       
   640 // CIAUpdateMainContainer::ComponentControl
       
   641 //  
       
   642 // -----------------------------------------------------------------------------
       
   643 // 
       
   644 CCoeControl* CIAUpdateMainContainer::ComponentControl( TInt aIndex ) const
       
   645     {
       
   646     CCoeControl* control = 0;
       
   647 
       
   648     switch( aIndex )
       
   649         {
       
   650         case 0:
       
   651             control = iListBox;
       
   652             break;
       
   653         default:
       
   654             break;
       
   655         }
       
   656     return control;
       
   657     }
       
   658 
       
   659 
       
   660 // ---------------------------------------------------------------------------
       
   661 // CIAUpdateMainContainer::GetHelpContext
       
   662 // 
       
   663 // ---------------------------------------------------------------------------
       
   664 //
       
   665 void CIAUpdateMainContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   666     {
       
   667     aContext.iMajor = KUidIAUpdateApp;
       
   668     aContext.iContext = KSWUPDATE_HLP_MAIN;    
       
   669     }
       
   670 
       
   671 // ---------------------------------------------------------------------------
       
   672 // CIAUpdateMainContainer::HandleResourceChange
       
   673 // 
       
   674 // ---------------------------------------------------------------------------
       
   675 //
       
   676 void CIAUpdateMainContainer::HandleResourceChange( TInt aType )
       
   677     {
       
   678 	CCoeControl::HandleResourceChange( aType );
       
   679 
       
   680     if ( aType == KEikDynamicLayoutVariantSwitch ) //Handle change in layout orientation
       
   681         {
       
   682         TRect mainPaneRect;
       
   683         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
       
   684         SetRect( mainPaneRect );
       
   685 		DrawNow();
       
   686 		}
       
   687     }
       
   688 
       
   689 // -----------------------------------------------------------------------------
       
   690 // CIAUpdateMainContainer::UpdateMSKTextL
       
   691 //  
       
   692 // -----------------------------------------------------------------------------
       
   693 //        
       
   694 void CIAUpdateMainContainer::UpdateMSKTextL()
       
   695 	{
       
   696 	TInt index = iListBox->CurrentItemIndex();
       
   697 	if (index < 0 )
       
   698 	    {
       
   699 		iObserver.SetMiddleSKTextL( EFalse, EFalse );
       
   700 	    }
       
   701 	else if ( iListBox->View()->ItemIsSelected( index ) )
       
   702 	    {
       
   703 		iObserver.SetMiddleSKTextL( ETrue, ETrue );
       
   704 	    }
       
   705 	else
       
   706 	    {
       
   707 	    iObserver.SetMiddleSKTextL( ETrue, EFalse );	
       
   708 	    }    
       
   709 	}
       
   710 
       
   711 
       
   712 // -----------------------------------------------------------------------------
       
   713 // CIAUpdateMainContainer::HandleListBoxEventL
       
   714 //  
       
   715 // -----------------------------------------------------------------------------
       
   716 //  
       
   717 void CIAUpdateMainContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
   718                                                   TListBoxEvent aEventType )
       
   719     {
       
   720 
       
   721     switch  ( aEventType )
       
   722         {
       
   723         case EEventItemSingleClicked:
       
   724         case EEventEnterKeyPressed:
       
   725             {
       
   726             TInt index = iListBox->CurrentItemIndex();
       
   727             if( iListBox->View()->ItemIsSelected( index ) )
       
   728                 {
       
   729                 HandleMarkCommandL( EAknCmdUnmark );
       
   730                 }
       
   731             else
       
   732                 {
       
   733                 HandleMarkCommandL( EAknCmdMark );
       
   734                 }            
       
   735             break;
       
   736             }        
       
   737         default:
       
   738             {
       
   739             break;
       
   740             }
       
   741         }
       
   742     }
       
   743 
       
   744 // -----------------------------------------------------------------------------
       
   745 // CIAUpdateMainContainer::CreateIconL
       
   746 //  
       
   747 // -----------------------------------------------------------------------------
       
   748 // 
       
   749 void CIAUpdateMainContainer::CreateIconL( CFbsBitmap*& aBitmap,
       
   750                                           CFbsBitmap*& aMask,
       
   751                                           const TDesC& aFileName,
       
   752                                           TInt aBitmapId,
       
   753                                           TInt aMaskId )
       
   754     {
       
   755 	AknIconUtils::CreateIconLC( aBitmap,
       
   756                                 aMask, 
       
   757                                 aFileName,  
       
   758                                 aBitmapId,
       
   759                                 aMaskId );
       
   760     CleanupStack::Pop( aMask );
       
   761     CleanupStack::Pop( aBitmap );
       
   762     }