omadm/omadmappui/src/NSmlDMFotaContainer.cpp
changeset 0 3ce708148e4d
child 20 f2101057ffeb
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Methods for FOTA view control container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <StringLoader.h>
       
    22 #include <featmgr.h>
       
    23 #include "NSmlDMSyncApp.h"
       
    24 #include "NSmlDMFotaContainer.h"
       
    25 #include "NSmlDMFotaView.h"
       
    26 #include "NSmlDMFotaModel.h"
       
    27 #include "NSmlDMUIDefines.h"
       
    28 #include "nsmldmsyncinternalpskeys.h"
       
    29 #include "NSmlDMSyncPrivateCRKeys.h"
       
    30 #include <etel.h>
       
    31 #include <etelmm.h>
       
    32 //multi rofs
       
    33 #include <sysutil.h>
       
    34 #include <sysversioninfo.h>
       
    35 #include "NSmlDMdef.h"
       
    36 #include <centralrepository.h>
       
    37 //multi rofs
       
    38 #include <NSmlDMSync.rsg>
       
    39 #include <e32property.h>
       
    40 #include <swi/sisregistrypackage.h>
       
    41 #include <swi/sisregistryentry.h>
       
    42 #include <swi/sisregistrysession.h>
       
    43 
       
    44 #include <csxhelp/dm.hlp.hrh>
       
    45 
       
    46 
       
    47 #include <apgtask.h>
       
    48 
       
    49 #include "NSmlDMSyncDebug.h"
       
    50 
       
    51 // ============================ MEMBER FUNCTIONS ===============================
       
    52     
       
    53 // -----------------------------------------------------------------------------
       
    54 // CNSmlDMFotaContainer::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CNSmlDMFotaContainer* CNSmlDMFotaContainer::NewL( CAknView* aView,
       
    59                                                   const TRect& aRect,
       
    60                                                   CNSmlDMFotaModel* aFotaModel )
       
    61     {
       
    62     CNSmlDMFotaContainer* self =
       
    63         new( ELeave ) CNSmlDMFotaContainer( aView, aFotaModel );
       
    64     
       
    65     CleanupStack::PushL( self );
       
    66     self->SetMopParent( (MObjectProvider*) aView );
       
    67     self->ConstructL( aRect );
       
    68     CleanupStack::Pop();
       
    69 
       
    70     return self;
       
    71     }
       
    72 
       
    73 // Destructor
       
    74 CNSmlDMFotaContainer::~CNSmlDMFotaContainer()
       
    75     {
       
    76     delete iFotaListBox;
       
    77      FeatureManager::UnInitializeLib();
       
    78     }
       
    79 
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CNSmlDMFotaContainer::SizeChanged
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CNSmlDMFotaContainer::SizeChanged()
       
    86     {
       
    87     iFotaListBox->SetRect( Rect() );    // Mandatory, otherwise not drawn
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CNSmlDMFotaContainer::HandleResourceChange
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 void CNSmlDMFotaContainer::HandleResourceChange( TInt aType )
       
    95     {
       
    96     CCoeControl::HandleResourceChange( aType );
       
    97     
       
    98     //Handle change in layout orientation
       
    99     if ( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange )
       
   100         {
       
   101         TRect mainPaneRect;
       
   102         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
       
   103         SetRect( mainPaneRect );
       
   104 		DrawDeferred();
       
   105 		}
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CNSmlDMFotaContainer::CountComponentControls
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 TInt CNSmlDMFotaContainer::CountComponentControls() const
       
   113     {
       
   114     TInt retval( 0 );
       
   115     if ( iFotaListBox )
       
   116         {
       
   117         retval = 1;
       
   118         }
       
   119     return retval; // return nbr of controls inside this container
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CNSmlDMFotaContainer::ComponentControl
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 CCoeControl* CNSmlDMFotaContainer::ComponentControl( TInt aIndex ) const
       
   127     {
       
   128     switch ( aIndex )
       
   129         {
       
   130         case 0:
       
   131             return iFotaListBox;
       
   132         default:
       
   133             return NULL;
       
   134         }
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CNSmlDMFotaContainer::Draw
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 void CNSmlDMFotaContainer::Draw( const TRect& /* aRect */ ) const
       
   142     {
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // CNSmlDMFotaContainer::OfferKeyEventL
       
   147 // Redirect keypresses to the listbox
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 TKeyResponse CNSmlDMFotaContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   151                                                          TEventCode aType )                                                                      
       
   152     {
       
   153 	FTRACE( FPrint(
       
   154 	_L("[OMADM]\t CNSmlDMFotaContainer::OfferKeyEventL>> Begin code = 0x%x"),aKeyEvent.iCode ) );
       
   155 	if( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmFota ) ) //NFUI
       
   156 		{
       
   157 		FLOG( "[OMADM]\t CNSmlDMFotaContainer::OfferKeyEventL FOta supported ." );
       
   158 		if (aKeyEvent.iScanCode == EStdKeyDevice0 
       
   159 				|| aKeyEvent.iScanCode == EStdKeyDevice3 
       
   160 				|| aKeyEvent.iScanCode ==	EStdKeyHash )
       
   161 			{
       
   162 			FLOG( "[OMADM]\t entered in to first if loop of keys" );
       
   163 			TBool value (EFalse);
       
   164 			TInt err = RProperty::Get( KPSUidNSmlDMSyncApp, KFotaDLStatus, value );
       
   165 			if (!err && value == 1)
       
   166 				{
       
   167 				FLOG( "[OMADM]\t Ongoing Fota operation identified." );
       
   168 				TApaTaskList taskList(CEikonEnv::Static()->WsSession());
       
   169 				TApaTask task1(taskList.FindApp( TUid::Uid(KOmaDMAppUid)));
       
   170 				FLOG("Bring DM UI into FG"); 
       
   171 				task1.BringToForeground(); //DM UI
       
   172 				TApaTask task=taskList.FindApp(TUid::Uid(KFotaServerUid));
       
   173 			if(task.Exists())
       
   174 				{
       
   175 				FLOG( "[OMADM]\t  Switching to FS Download" );
       
   176 				task.BringToForeground();
       
   177 				}
       
   178 				else
       
   179 				FLOG( "[OMADM]\t Inconsistency problem!! need to debug" );
       
   180 			return EKeyWasConsumed;
       
   181 			}
       
   182 		else
       
   183 			{
       
   184 				FLOG("[OMADM]\t No ongoing Fota operation identified!");
       
   185 			}
       
   186 		}
       
   187 }
       
   188     if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) 
       
   189         {
       
   190         ShowContextMenuL( R_SMLSYNC_CONTXT_MENUBAR_FOTA_VIEW );
       
   191         }
       
   192     
       
   193     if( ( iFotaListBox )
       
   194           && ( aKeyEvent.iCode != EKeyLeftArrow )
       
   195           && ( aKeyEvent.iCode != EKeyRightArrow ) )
       
   196         {
       
   197         TKeyResponse res = iFotaListBox->OfferKeyEventL( aKeyEvent, aType );
       
   198         // Store current item index for options list usage later
       
   199         return res;
       
   200         }
       
   201      
       
   202 	FLOG( "[OMADM]\t CNSmlDMFotaContainer::OfferKeyEventL << End");
       
   203     return EKeyWasNotConsumed;
       
   204     }
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // CNSmlDMFotaContainer::HandleListBoxEventL
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 void CNSmlDMFotaContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
   211                                                 TListBoxEvent /*aEventType*/ )
       
   212     {
       
   213     FLOG( "[OMADM]\t CNSmlDMFotaContainer::HandleListBoxEventL()" );
       
   214     }
       
   215 
       
   216 // -----------------------------------------------------------------------------
       
   217 // CNSmlDMFotaContainer::HandleControlEventL
       
   218 // -----------------------------------------------------------------------------
       
   219 //
       
   220 void CNSmlDMFotaContainer::HandleControlEventL( CCoeControl* /* aControl */,
       
   221                                                 TCoeEvent /* aEventType */ )
       
   222     {
       
   223     }
       
   224 
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // CNSmlDMFotaContainer::GetHelpContext
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CNSmlDMFotaContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   231     {
       
   232 	FLOG( "[OMADM] CNSmlDMFotaContainer::GetHelpContext" );
       
   233 	
       
   234 	aContext.iMajor = KUidSmlSyncApp;
       
   235     aContext.iContext = KDM_HLP_MAIN_VIEW;
       
   236     }
       
   237 
       
   238 
       
   239 
       
   240 // -----------------------------------------------------------------------------
       
   241 // CNSmlDMFotaContainer::FormatListbox
       
   242 // -----------------------------------------------------------------------------
       
   243 //
       
   244 void CNSmlDMFotaContainer::FormatListboxL( CDesCArray* aItemsArray,
       
   245 										TBool aPostponeDisplay )
       
   246     {
       
   247 	FLOG( "[OMADM] CNSmlDMFotaContainer::FormatListboxL()" );
       
   248 
       
   249     TBuf< KNSmlMaxTextLength64 > stringHolder;
       
   250     HBufC* itemText = NULL;
       
   251     aItemsArray->Reset();
       
   252 
       
   253 		TBuf< KNSmlMaxTextLength64 > prodrelease;
       
   254 		prodrelease.Zero();
       
   255 		TBuf<KSysUtilVersionTextLength> ProdRelease;
       
   256 		if ( SysUtil::GetPRInformation( ProdRelease ) == KErrNone )
       
   257 		{
       
   258 			prodrelease.Copy(ProdRelease);
       
   259 		}
       
   260 		
       
   261 		if( prodrelease.Length()>0 )
       
   262   	{
       
   263 			HBufC* itemTextRelease = StringLoader::LoadLC( R_QTN_FOTA_LIST_RELEASE,
       
   264                                             prodrelease );		
       
   265    		aItemsArray->AppendL( itemTextRelease->Des() );
       
   266 			CleanupStack::PopAndDestroy( itemTextRelease );
       
   267   	}    
       
   268 													
       
   269    if( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmFota ) ) //NFUI
       
   270 	       { 
       
   271 		if ( aPostponeDisplay && iFotaModel->FindFwUpdPkgWithStateL(
       
   272 				EDownloadProgressingWithResume ) != KErrNotFound )	       
       
   273 			{
       
   274 			TInt val (EFalse);
       
   275 			RProperty::Get(KPSUidNSmlDMSyncApp,KFotaDLRefresh,val);
       
   276 			if(!val)
       
   277 				{
       
   278 				HBufC* swItem = StringLoader::LoadLC( R_ITEM_FOTA_DOWNLOAD_POSTPONED );
       
   279 				aItemsArray->AppendL( swItem->Des() );
       
   280 				FLOG( "[OMADM] postponed item added" );
       
   281 				CleanupStack::PopAndDestroy( swItem );	        
       
   282 				}
       
   283         }
       
   284    else if ( iFotaModel->FindFwUpdPkgWithStateL( EStartingUpdate )
       
   285                                                                != KErrNotFound )
       
   286    		{
       
   287 		HBufC* swItem = StringLoader::LoadLC( R_ITEM_FOTA_NEW_SW_AVAILABLE );
       
   288 		aItemsArray->AppendL( swItem->Des() );
       
   289 		CleanupStack::PopAndDestroy( swItem );		
       
   290 		}			
       
   291 	}
       
   292     TBuf< KNSmlMaxTextLength64 > swversion;
       
   293     TBuf< KNSmlMaxTextLength64 >  swversiondate;
       
   294     TBuf< KNSmlMaxTextLength64 >  typedesignator;
       
   295     TBuf< KNSmlMaxTextLength64 >  langversion;
       
   296     TBuf< KNSmlMaxTextLength64 >  customsw;
       
   297     TBuf< KNSmlMaxTextLength64 >  customswdate;
       
   298     TBuf<KSysUtilVersionTextLength> version;
       
   299     version.Zero();
       
   300     swversion.Zero();
       
   301     swversiondate.Zero();
       
   302     typedesignator.Zero();
       
   303     langversion.Zero();
       
   304     customsw.Zero();
       
   305     customswdate.Zero();
       
   306      if ( SysUtil::GetSWVersion( version ) == KErrNone )
       
   307          {         
       
   308          TInt len= version.Length();
       
   309          TInt pos1 = version.Find(KSmlEOL);
       
   310          if( pos1 != KErrNotFound && len > pos1 )
       
   311             {
       
   312          TBuf<KSysUtilVersionTextLength> version1;
       
   313          version1.Zero();
       
   314          swversion.Append( version.Left(pos1));
       
   315          version1.Append( version.Right( len-pos1-1 ));
       
   316          len= version1.Length();
       
   317          pos1 = version1.Find(KSmlEOL);
       
   318             if( pos1 != KErrNotFound  && len > pos1 )
       
   319              {
       
   320          swversiondate.Append(version1.Left( pos1 ));
       
   321          version.Zero();
       
   322          version.Append( version1.Right( len-pos1-1 ));
       
   323             len= version.Length();
       
   324             pos1 = version.Find(KSmlEOL);
       
   325             if( pos1 != KErrNotFound  && len > pos1 )
       
   326              {
       
   327              typedesignator.Append(version.Left(pos1));         
       
   328              }
       
   329              }
       
   330            }
       
   331          }
       
   332     TBuf<KSysUtilVersionTextLength> Langversion;    
       
   333     if( SysUtil::GetLangVersion(Langversion ) == KErrNone )
       
   334       {
       
   335       langversion.Copy(Langversion);
       
   336       }
       
   337     SysVersionInfo::TVersionInfoType x = SysVersionInfo::EOPVersion;
       
   338     version.Zero();
       
   339     if( SysVersionInfo::GetVersionInfo(x,version) == KErrNone )
       
   340       {
       
   341          TInt len= version.Length();
       
   342          TInt pos1 = version.Find(KSmlEOL);
       
   343          if( pos1 != KErrNotFound  && len > pos1 )
       
   344           {        
       
   345           customsw.Append( version.Left(pos1));
       
   346           customswdate.Append( version.Right( len-pos1-1 ));         
       
   347           }
       
   348       }  
       
   349     //multi rofs   
       
   350     HBufC* itemText1 = StringLoader::LoadLC( R_QTN_FOTA_LIST_SOFTWARE_VERSION,
       
   351                                             swversion );
       
   352     HBufC* itemText2 = StringLoader::LoadLC( R_QTN_FOTA_LIST_SOFTWARE_VERSION_DATE,
       
   353                                             swversiondate );   
       
   354     HBufC* itemText3 = StringLoader::LoadLC( R_QTN_FOTA_LIST_CUSTOMSW_VERSION,
       
   355                                             customsw );              
       
   356     HBufC* itemText4 = StringLoader::LoadLC( R_QTN_FOTA_LIST_CUSTOMSWDATE_VERSION,
       
   357                                             customswdate ); 
       
   358     HBufC* itemText5 = StringLoader::LoadLC( R_QTN_FOTA_LIST_LANGUAGE_VERSION,
       
   359                                             langversion );                                                                                                                                                                                                            
       
   360     if( swversion.Length()>0 )
       
   361     {
       
   362     aItemsArray->AppendL( itemText1->Des() );
       
   363     }
       
   364     if( swversiondate.Length()>0 )
       
   365     {
       
   366     aItemsArray->AppendL( itemText2->Des() );
       
   367     }     
       
   368     if( customsw.Length()>0 )
       
   369     {
       
   370     aItemsArray->AppendL( itemText3->Des() );
       
   371     }
       
   372     if( customswdate.Length()>0 )
       
   373     {
       
   374     aItemsArray->AppendL( itemText4->Des() );
       
   375     }
       
   376     if( langversion.Length()>0 )
       
   377     {
       
   378     aItemsArray->AppendL( itemText5->Des() );
       
   379     }    
       
   380     CleanupStack::PopAndDestroy( 5 );// itemtext1 to itemtext5    
       
   381     itemText1 = NULL;
       
   382     itemText2 = NULL;
       
   383     itemText3 = NULL;
       
   384     itemText4 = NULL;
       
   385     itemText5 = NULL; 
       
   386    TInt runtimesupport(0);
       
   387    CRepository* cenrep = NULL;
       
   388     TRAPD( error, cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );  
       
   389     if(error)
       
   390       {
       
   391       	
       
   392       	FLOG( "[OMADM] CNSmlDMFotaContainer::FormatListboxL() cenrep problem" );
       
   393       }    
       
   394     if ( cenrep )
       
   395         {
       
   396         cenrep->Get( KNsmlDmRuntimeVerSupport, runtimesupport );
       
   397         delete cenrep; cenrep = NULL;
       
   398         }
       
   399   if(runtimesupport)
       
   400   {   
       
   401   	TBuf<KSysUtilVersionTextLength> productcode;
       
   402   	productcode.Zero();
       
   403   	TInt error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EProductCode, productcode);
       
   404   	if(error ==KErrNone )
       
   405    	{   		 
       
   406     	if( productcode.Length()>0 )
       
   407     	{                                       
       
   408     		HBufC* itemText6 = StringLoader::LoadLC( R_QTN_PRODUCT_CODE, productcode );   
       
   409     		aItemsArray->AppendL( itemText6->Des() ); 
       
   410     		CleanupStack::PopAndDestroy( );  
       
   411     		itemText6 = NULL;
       
   412   		}                    
       
   413    	}
       
   414   }     
       
   415   RTelServer telServer;
       
   416   User::LeaveIfError( telServer.Connect() );
       
   417   RTelServer::TPhoneInfo teleinfo;
       
   418   User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) );
       
   419   RMobilePhone phone;
       
   420 	User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) );
       
   421 	User::LeaveIfError(phone.Initialise());	
       
   422 	TUint32 teleidentityCaps;
       
   423 	phone.GetIdentityCaps( teleidentityCaps );
       
   424 	RMobilePhone::TMobilePhoneIdentityV1 telid;
       
   425 	TRequestStatus status;
       
   426 	phone.GetPhoneId( status, telid );
       
   427 	User::WaitForRequest( status );
       
   428 	if (status==KErrNone)
       
   429 	{
       
   430 		TBuf<100> phoneName;
       
   431 		phoneName.Copy( telid.iModel );
       
   432 	  HBufC* phoneModl = StringLoader::LoadLC( R_ITEM_FOTA_MODEL, phoneName );
       
   433 	  if( phoneName.Length()>0 )
       
   434     {                      
       
   435     	aItemsArray->AppendL(phoneModl ->Des() );
       
   436     }
       
   437     CleanupStack::PopAndDestroy(phoneModl);
       
   438 	}
       
   439 	else
       
   440 	{
       
   441 		HBufC* noModel = StringLoader::LoadLC( R_ITEM_DM_PHONE_NO_MODEL );
       
   442 		aItemsArray->AppendL(noModel ->Des() );
       
   443 		CleanupStack::PopAndDestroy(noModel);
       
   444 	} 
       
   445   phone.Close();
       
   446   telServer.Close();
       
   447   itemText1 = StringLoader::LoadLC( R_QTN_FOTA_LIST_TYPE_DESIGNATOR, typedesignator );
       
   448   if( typedesignator.Length()>0 )
       
   449   {
       
   450     aItemsArray->AppendL( itemText1->Des() );
       
   451   }
       
   452   CleanupStack::PopAndDestroy( itemText1 );
       
   453   itemText1 = NULL;  
       
   454   	
       
   455   if( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmFota ) ) //NFUI
       
   456 	{
       
   457     //Device updated independent of UI Evol
       
   458 		TTime time;
       
   459     TInt err = iFotaModel->LastUpdateTime( time );
       
   460     
       
   461     if ( err == KErrNone )
       
   462     {
       
   463     	TTime currentTime;
       
   464       currentTime.HomeTime();
       
   465       TDateTime currentDateTime = currentTime.DateTime();
       
   466       TDateTime dateTime = time.DateTime();
       
   467         
       
   468       if ( currentDateTime.Year() == dateTime.Year() &&
       
   469              currentDateTime.Month() == dateTime.Month() &&
       
   470              currentDateTime.Day() == dateTime.Day() )
       
   471       {
       
   472             HBufC* timeFormat = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL ); 
       
   473 
       
   474             // Format the time to user readable format. The format is locale dependent	
       
   475             time.FormatL( stringHolder, *timeFormat );
       
   476             CleanupStack::PopAndDestroy(); // timeFormat
       
   477       }
       
   478       else
       
   479       {
       
   480             HBufC* dateFormat = iEikonEnv->AllocReadResourceLC( R_QTN_DATE_USUAL );
       
   481             
       
   482             // Format the date to user readable format. The format is locale dependent
       
   483             time.FormatL( stringHolder, *dateFormat );
       
   484             CleanupStack::PopAndDestroy(); // dateFormat
       
   485       }
       
   486       AknTextUtils::DisplayTextLanguageSpecificNumberConversion( stringHolder );
       
   487       itemText = StringLoader::LoadLC( R_ITEM_FOTA_LATEST_UPDATE, stringHolder );
       
   488       aItemsArray->AppendL( itemText->Des() );
       
   489       CleanupStack::PopAndDestroy( itemText );
       
   490     }
       
   491     else
       
   492     {
       
   493     	HBufC* resStringHolder = iCoeEnv->AllocReadResourceLC( R_QTN_FOTA_NOT_UPDATED );
       
   494       AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ( TDes& ) *resStringHolder );
       
   495       itemText = StringLoader::LoadLC( R_ITEM_FOTA_LATEST_UPDATE, *resStringHolder );
       
   496       aItemsArray->AppendL( itemText->Des() );
       
   497       CleanupStack::PopAndDestroy( 2 ); // itemText, resStringHolder
       
   498      }
       
   499    }
       
   500   
       
   501    
       
   502    Swi::RSisRegistrySession sisses ;
       
   503    TInt r( sisses.Connect() );
       
   504    CleanupClosePushL( sisses );
       
   505    if (r== KErrNone && runtimesupport)
       
   506    {           
       
   507    	Swi::RSisRegistryEntry sientry;
       
   508     // #define  browseruid = 0x10008d39; 
       
   509   
       
   510     TInt oerr = sientry.Open(sisses, browseruid);
       
   511     TVersion bversion;
       
   512     TBuf <255> browserversion;
       
   513     if(oerr == KErrNone)
       
   514     {
       
   515     	TRAPD(err2,bversion= sientry.VersionL());     
       
   516       if (err2 == KErrNone)
       
   517       {
       
   518       	browserversion.AppendNum(bversion.iMajor);
       
   519         browserversion.Append(_L("."));
       
   520         browserversion.AppendNum(bversion.iMinor);
       
   521         if( browserversion.Length()>0 )
       
   522     		{                                
       
   523         	HBufC* itemText7 = StringLoader::LoadLC( R_QTN_BROWSER_VERSION, browserversion );
       
   524         	aItemsArray->AppendL( itemText7->Des() ); 
       
   525         	CleanupStack::PopAndDestroy( );
       
   526         	itemText7 =NULL;
       
   527         }
       
   528        }
       
   529      }
       
   530   }  
       
   531       
       
   532   if (r== KErrNone&& runtimesupport)
       
   533   {           
       
   534   	Swi::RSisRegistryEntry sientry;
       
   535     TInt oerr = sientry.Open(sisses, flashuid);
       
   536     TVersion fversion;
       
   537     TBuf <255> flashversion;
       
   538     if(oerr == KErrNone)
       
   539     {
       
   540     	TRAPD(err2,fversion= sientry.VersionL());         
       
   541       if (err2 == KErrNone)
       
   542       {
       
   543       	flashversion.AppendNum(fversion.iMajor);
       
   544         flashversion.Append(_L("."));
       
   545         flashversion.AppendNum(fversion.iMinor); 
       
   546         if( flashversion.Length()>0 )
       
   547     		{                               
       
   548         	HBufC*	itemText9 = StringLoader::LoadLC( R_QTN_FLASH_VERSION, flashversion );
       
   549         	aItemsArray->AppendL( itemText9->Des() ); 
       
   550         	CleanupStack::PopAndDestroy( );   
       
   551         	itemText9 =NULL;  
       
   552         }                                   
       
   553        }      
       
   554      }
       
   555    }
       
   556          
       
   557    if (r== KErrNone&& runtimesupport)
       
   558    {            
       
   559    	Swi::RSisRegistryEntry sientry;
       
   560     TInt oerr = sientry.Open(sisses, javauid);
       
   561     TVersion jversion;
       
   562     TBuf <255> javaversion;
       
   563     if(oerr == KErrNone)
       
   564     {    	
       
   565       TRAPD(err2,jversion= sientry.VersionL());     
       
   566       if (err2 == KErrNone)
       
   567       {
       
   568       	javaversion.AppendNum(jversion.iMajor);
       
   569         javaversion.Append(_L("."));
       
   570         javaversion.AppendNum(jversion.iMinor);  
       
   571         if( javaversion.Length()>0 )
       
   572     		{ 
       
   573     			HBufC*	itemText8 = StringLoader::LoadLC( R_QTN_JAVA_VERSION, javaversion );                          
       
   574         	aItemsArray->AppendL( itemText8->Des() );
       
   575         	CleanupStack::PopAndDestroy( ); 
       
   576         	itemText8 =NULL;  
       
   577         } 
       
   578        }            
       
   579      }            
       
   580    }       
       
   581       
       
   582   CleanupStack::PopAndDestroy(1);
       
   583           //sisses.Close();  
       
   584 	iFotaListBox->HandleItemAdditionL(); 
       
   585 	FLOG( "[OMADM] CNSmlDMFotaContainer::FormatListboxL() completed" );
       
   586     }
       
   587 
       
   588 // -----------------------------------------------------------------------------
       
   589 // CNSmlDMFotaContainer::ShowContextMenuL
       
   590 // -----------------------------------------------------------------------------
       
   591 //
       
   592 void CNSmlDMFotaContainer::ShowContextMenuL( TInt aResource )
       
   593     {
       
   594 	FLOG( "[OMADM] CNSmlDMFotaContainer::ShowContextMenuL()" );
       
   595 	
       
   596 	// Switch to Context specific options menu,
       
   597 	// Show it and switch back to main options menu.
       
   598 	CEikMenuBar* menuBar = iView->MenuBar();
       
   599 	menuBar->SetMenuTitleResourceId( aResource );
       
   600 
       
   601 	// TRAP displaying of menu bar.
       
   602 	// If it fails, the correct resource is set back before leave.
       
   603 	menuBar->SetMenuType( CEikMenuBar::EMenuContext );
       
   604 	TRAPD( err, menuBar->TryDisplayMenuBarL() );
       
   605 	menuBar->SetMenuTitleResourceId( R_SMLSYNC_MENUBAR_FOTA_VIEW );
       
   606 	menuBar->SetMenuType( CEikMenuBar::EMenuOptions );
       
   607 	User::LeaveIfError( err );
       
   608 
       
   609 	FLOG( "[OMADM] CNSmlDMFotaContainer::ShowContextMenuL() completed" );
       
   610     }
       
   611 
       
   612 // -----------------------------------------------------------------------------
       
   613 // CNSmlDMFotaContainer::CNSmlDMFotaContainer
       
   614 // C++ default constructor can NOT contain any code, that
       
   615 // might leave.
       
   616 // -----------------------------------------------------------------------------
       
   617 //
       
   618 CNSmlDMFotaContainer::CNSmlDMFotaContainer( CAknView* aView,
       
   619                                             CNSmlDMFotaModel* aFotaModel )
       
   620     : iView( aView ), iFotaModel( aFotaModel )
       
   621     {
       
   622     }
       
   623 
       
   624 // -----------------------------------------------------------------------------
       
   625 // CNSmlDMFotaContainer::ConstructL
       
   626 // Symbian 2nd phase constructor can leave.
       
   627 // -----------------------------------------------------------------------------
       
   628 //
       
   629 void CNSmlDMFotaContainer::ConstructL( const TRect& aRect )
       
   630     {
       
   631 	FLOG( "[OMADM] CNSmlDMFotaContainer::ConstructL()" );
       
   632 
       
   633     CreateWindowL();
       
   634     	FeatureManager::InitializeLibL();
       
   635     // Check if listbox is empty
       
   636     //__ASSERT_DEBUG( iFotaListBox == 0, User::Panic( KErrAlreadyExists ));
       
   637 
       
   638     // Create the itemlist
       
   639     iFotaListBox = new (ELeave) CAknDoubleStyleListBox;
       
   640     iFotaListBox->SetContainerWindowL( *this );
       
   641     iFotaListBox->ConstructL( this, EAknListBoxViewerFlags );
       
   642     // Set up/down arrows at bottom of the screen (scrollbar)
       
   643     iFotaListBox->CreateScrollBarFrameL( ETrue );
       
   644     iFotaListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn,
       
   645                                                              CEikScrollBarFrame::EAuto );
       
   646 
       
   647     iFotaListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );   // Does delete items array
       
   648     CDesCArray* itemsArray = (CDesCArray*) iFotaListBox->Model()->ItemTextArray();
       
   649     FormatListboxL( itemsArray, ETrue );
       
   650     iFotaListBox->HandleItemAdditionL();
       
   651 
       
   652     // Set up the observer (events listener)
       
   653     iFotaListBox->SetListBoxObserver( this );
       
   654 
       
   655     SetRect( aRect );
       
   656     ActivateL();
       
   657     
       
   658     FLOG( "[OMADM] CNSmlDMFotaContainer::ConstructL() completed" );
       
   659     }
       
   660 
       
   661 
       
   662 // -----------------------------------------------------------------------------
       
   663 // CNSmlDMFotaContainer::RefreshL 
       
   664 // -----------------------------------------------------------------------------
       
   665 //
       
   666 void CNSmlDMFotaContainer::RefreshL(TBool aPostponeDisplay)
       
   667 	{
       
   668 	CDesCArray* itemsArray = (CDesCArray*) iFotaListBox->Model()->ItemTextArray();
       
   669 	FormatListboxL(itemsArray, aPostponeDisplay);
       
   670 	}
       
   671 
       
   672 
       
   673 //  End of File