sysstatemgmt/ssmutilityplugins/ssmlocaleobserversup/src/ssmlocaleobserversup.cpp
changeset 0 4e1aa6a622a0
child 13 cef4ff1e6c4f
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implementation of CSsmLocaleObserverSup class.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <bacntf.h>
       
    19 #include <bautils.h>
       
    20 #include <connect/sbdefs.h>
       
    21 #include <s32file.h>
       
    22 
       
    23 #include "ssmmapperutilitystatic.h"
       
    24 #include "ssmlocaleobserversup.h"
       
    25 #include "trace.h"
       
    26 
       
    27 /**
       
    28 * Directory to store user-specific locale data files.
       
    29 * Private directory of SSM Utility Server.
       
    30 */
       
    31 _LIT( KLocaleDataDir, "\\private\\2000d766\\localedata\\" );
       
    32 
       
    33 /** Name is LocaleData.Dnn or CommonData.D00 */
       
    34 _LIT( KFileName, "LocaleData.D" );
       
    35 _LIT( KCommonFileName, "CommonData.D" );
       
    36 
       
    37 /**
       
    38 * Version number from 1..255 to indicate data
       
    39 * format of the file. To make dynamic data format fixes possible we need
       
    40 * version ID.
       
    41 */
       
    42 const TInt KCurrentVersionNumber = 2; // For fixing TChar r/w
       
    43 
       
    44 // ======== LOCAL FUNCTIONS ========
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // EnvChangeNotifierCallbackL
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 static TInt EnvChangeNotifierCallback( TAny* aThis )
       
    51     {
       
    52     CSsmLocaleObserverSup* self = static_cast<CSsmLocaleObserverSup*>( aThis );
       
    53     ASSERT_TRACE( self );
       
    54     TRAPD( err, self->EnvChangeOccurredL() );
       
    55     ERROR( err, "Failed to handle environment change" );
       
    56     return err;
       
    57     }
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // MakeFileNameL
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 static HBufC* MakeFileNameL( const TDesC& aPath, const TDesC& aName, const TInt aCode )
       
    65     {
       
    66     FUNC_LOG;
       
    67     INFO_3( "Locale data dir: %S, file name base: %S, lang code: %d", &aPath, &aName, aCode );
       
    68 
       
    69     TInt length = aPath.Length();
       
    70 
       
    71     // Reserve spave for language code also
       
    72     HBufC* buffer = HBufC::NewL( length + aName.Length() + 10 );
       
    73     TPtr ptr = buffer->Des();
       
    74     ptr.Append( aPath );
       
    75     if ( length > 0 && aPath[ length - 1 ] != KPathDelimiter )
       
    76         {
       
    77         ptr.Append( KPathDelimiter );
       
    78         }
       
    79 
       
    80     ptr.Append( aName );
       
    81     if ( aCode < 10 )
       
    82         {
       
    83         ptr.AppendNum( 0 ); // add leading zero to the extention
       
    84         }
       
    85     ptr.AppendNum( aCode );
       
    86 
       
    87     INFO_1( "Locale data file: %S", buffer );
       
    88 
       
    89     return buffer;
       
    90     }
       
    91 
       
    92 
       
    93 // ======== MEMBER FUNCTIONS ========
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CSsmLocaleObserverSup::NewL
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 EXPORT_C MSsmUtility* CSsmLocaleObserverSup::NewL()
       
   100     {
       
   101     CSsmLocaleObserverSup* self = new ( ELeave ) CSsmLocaleObserverSup;
       
   102     return self;
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CSsmLocaleObserverSup::~CSsmLocaleObserverSup
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 CSsmLocaleObserverSup::~CSsmLocaleObserverSup()
       
   111     {
       
   112     FUNC_LOG;
       
   113 
       
   114     Cancel();
       
   115     delete iEnvChangeNotifier;
       
   116     iFs.Close();
       
   117     iProperty.Close();
       
   118     }
       
   119 
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CSsmLocaleObserverSup::EnvChangeOccurredL
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 void CSsmLocaleObserverSup::EnvChangeOccurredL()
       
   126     {
       
   127     FUNC_LOG;
       
   128 
       
   129     const TInt changes( iEnvChangeNotifier->Change() );
       
   130     INFO_2( "Env data changed: 0x%08x, restore active: %d",
       
   131         changes, iRestoreActive );
       
   132 
       
   133     if ( !iRestoreActive && ( changes & EChangesLocale ) )
       
   134         {
       
   135         TParsePtrC parse( KLocaleDataDir );
       
   136         SaveLocaleL( parse.FullName() );
       
   137         }
       
   138 
       
   139     if( changes & EChangesSystemTime )
       
   140         {
       
   141         INFO( "Persisting HAL settings" );
       
   142         // Changes by writing to HAL
       
   143         TInt err = BaflUtils::PersistHAL();
       
   144         ERROR( err, "BaflUtils::PersistHAL failed" );
       
   145         }
       
   146     }
       
   147 
       
   148 
       
   149 // ---------------------------------------------------------------------------
       
   150 // CSsmLocaleObserverSup::RunL
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 void CSsmLocaleObserverSup::RunL()
       
   154     {
       
   155     FUNC_LOG;
       
   156 
       
   157     TInt err = iStatus.Int();
       
   158     ERROR( err, "RSsmStateAdaptation::NotifyCoopSysEvent completed with error" );
       
   159 
       
   160     if ( err != KErrServerTerminated )
       
   161         {
       
   162         Activate();
       
   163         }
       
   164 
       
   165     if ( err == KErrNone )
       
   166         {
       
   167         TInt status( 0 );
       
   168         err = iProperty.Get( status );
       
   169         ERROR( err, "Failed to get backup status from P&S" );
       
   170 
       
   171         if ( err == KErrNone )
       
   172             {
       
   173             TInt type = status & conn::KBURPartTypeMask;
       
   174             if ( type == conn::EBURRestoreFull ||
       
   175                  type == conn::EBURRestorePartial )
       
   176                 {
       
   177                 INFO( "Restore started" );
       
   178 
       
   179                 iRestoreActive = ETrue;
       
   180                 }
       
   181             else if ( type == conn::EBURNormal && iRestoreActive )
       
   182                 {
       
   183                 INFO( "Restore finished" );
       
   184 
       
   185                 iRestoreActive = EFalse;
       
   186 
       
   187                 TParsePtrC parse( KLocaleDataDir );
       
   188                 TRAP( err, LoadLocaleL( parse.FullName() ) );
       
   189                 ERROR( err, "Failed to load locale" );
       
   190                 // Can not do anything about the error - just continue.
       
   191                 }
       
   192             }
       
   193         }
       
   194     }
       
   195 
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // CSsmLocaleObserverSup::DoCancel()
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 void CSsmLocaleObserverSup::DoCancel()
       
   202     {
       
   203     FUNC_LOG;
       
   204 
       
   205     iProperty.Cancel();
       
   206     }
       
   207 
       
   208 
       
   209 // ---------------------------------------------------------------------------
       
   210 // CSsmLocaleObserverSup::InitializeL()
       
   211 // ---------------------------------------------------------------------------
       
   212 //
       
   213 void CSsmLocaleObserverSup::InitializeL()
       
   214     {
       
   215     FUNC_LOG;
       
   216 
       
   217     TInt err = iFs.Connect();
       
   218     ERROR( err, "Failed to connect to file server" );
       
   219     User::LeaveIfError( err );
       
   220 
       
   221     TRAP( err, iEnvChangeNotifier = CEnvironmentChangeNotifier::NewL(
       
   222         CActive::EPriorityStandard,
       
   223         TCallBack( EnvChangeNotifierCallback, this ) ) );
       
   224     ERROR( err, "Failed to create environment change notifier" );
       
   225     User::LeaveIfError( err );
       
   226     }
       
   227 
       
   228 
       
   229 // ---------------------------------------------------------------------------
       
   230 // CSsmLocaleObserverSup::StartL()
       
   231 // ---------------------------------------------------------------------------
       
   232 //
       
   233 void CSsmLocaleObserverSup::StartL()
       
   234     {
       
   235     FUNC_LOG;
       
   236 
       
   237     TParsePtrC parse( KLocaleDataDir );
       
   238     TRAPD_ERR( err, LoadLocaleL( parse.FullName() ) );
       
   239     ERROR( err, "Failed to load locale data the first time" );
       
   240 
       
   241     if ( iEnvChangeNotifier )
       
   242         {
       
   243         iEnvChangeNotifier->Start();
       
   244         }
       
   245 
       
   246     TInt err1 = iProperty.Attach( SsmMapperUtility::PsUid( KUidSystemCategory ), conn::KUidBackupRestoreKey );
       
   247     ERROR( err1, "Failed to attach to KUidBackupRestoreKey" );
       
   248 
       
   249     Activate();
       
   250     }
       
   251 
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 // CSsmLocaleObserverSup::Release()
       
   255 // ---------------------------------------------------------------------------
       
   256 //
       
   257 void CSsmLocaleObserverSup::Release()
       
   258     {
       
   259     FUNC_LOG;
       
   260 
       
   261     delete this;
       
   262     }
       
   263 
       
   264 
       
   265 // ---------------------------------------------------------------------------
       
   266 // CSsmLocaleObserverSup::CSsmLocaleObserverSup
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 CSsmLocaleObserverSup::CSsmLocaleObserverSup()
       
   270   : CActive( EPriorityNormal ),
       
   271     iRestoreActive( EFalse )
       
   272     {
       
   273     FUNC_LOG;
       
   274 
       
   275     CActiveScheduler::Add( this );
       
   276     }
       
   277 
       
   278 
       
   279 // ---------------------------------------------------------------------------
       
   280 // CSsmLocaleObserverSup::Activate
       
   281 // ---------------------------------------------------------------------------
       
   282 //
       
   283 void CSsmLocaleObserverSup::Activate()
       
   284     {
       
   285     FUNC_LOG;
       
   286     ASSERT_TRACE( !IsActive() );
       
   287 
       
   288     iProperty.Subscribe( iStatus );
       
   289     SetActive();
       
   290     }
       
   291 
       
   292 
       
   293 // ---------------------------------------------------------------------------
       
   294 // CSsmLocaleObserverSup::SaveLocaleL
       
   295 // ---------------------------------------------------------------------------
       
   296 //
       
   297 void CSsmLocaleObserverSup::SaveLocaleL( const TDesC& aPath )
       
   298     {
       
   299     FUNC_LOG;
       
   300     INFO( "Saving locale data" );
       
   301 
       
   302     HBufC* fName = MakeFileNameL( aPath, KFileName, User::Language() );
       
   303     CleanupStack::PushL( fName );
       
   304 
       
   305     RFileWriteStream fStream;
       
   306     CleanupClosePushL( fStream );
       
   307     // According to documentation RFileWriteStream
       
   308     // keeps written data in RAM until CommitL has been
       
   309     // called.
       
   310 
       
   311     TInt err = iFs.MkDirAll( *fName ); // Ignore errors
       
   312     err = fStream.Create( iFs, *fName, EFileWrite );
       
   313     if ( err == KErrAlreadyExists )
       
   314         {
       
   315         // Override
       
   316         err = fStream.Open( iFs, *fName, EFileWrite );
       
   317         ERROR_1( err, "Failed to open stream %S", fName );
       
   318         }
       
   319     User::LeaveIfError( err );
       
   320 
       
   321     // Write first the version number to enable
       
   322     // support for file format changes.
       
   323     fStream.WriteInt8L( KCurrentVersionNumber );
       
   324 
       
   325     TLocale locale; // copy current values
       
   326     fStream.WriteInt16L( locale.CountryCode() );
       
   327     fStream.WriteInt16L( 0 ); // reserved
       
   328     fStream.WriteInt8L( locale.DateFormat() );
       
   329     fStream.WriteInt8L( locale.TimeFormat() );
       
   330     fStream.WriteInt8L( locale.CurrencySymbolPosition() );
       
   331     fStream.WriteInt8L( locale.CurrencySpaceBetween() );
       
   332     fStream.WriteInt8L( locale.CurrencyDecimalPlaces() );
       
   333     fStream.WriteInt8L( locale.CurrencyNegativeInBrackets() );
       
   334     fStream.WriteInt8L( locale.CurrencyTriadsAllowed() );
       
   335     fStream.WriteUint32L( locale.ThousandsSeparator() );
       
   336     fStream.WriteUint32L( locale.DecimalSeparator() );
       
   337     fStream.WriteInt8L( KMaxDateSeparators ); // restoring this constant. It might chance.
       
   338     TInt counter( 0 );
       
   339     for ( counter = 0; counter < KMaxDateSeparators; counter++ )
       
   340         {
       
   341         fStream.WriteUint32L( locale.DateSeparator( counter ) );
       
   342         }
       
   343     fStream.WriteInt8L( KMaxTimeSeparators ); // restoring this constant. It might chance.
       
   344     for ( counter = 0; counter < KMaxTimeSeparators; counter++ )
       
   345         {
       
   346         fStream.WriteUint32L( locale.TimeSeparator( counter ) );
       
   347         }
       
   348     fStream.WriteInt8L( locale.AmPmSpaceBetween() );
       
   349     fStream.WriteInt8L( locale.AmPmSymbolPosition() );
       
   350 
       
   351     // DaylightSaving and HomeDaylightSavingZone are not part of TLocale
       
   352     // any more, zeros are written to LocaleData.Dxx to keep file structure
       
   353     // as it was.
       
   354     fStream.WriteInt32L( 0 );
       
   355     fStream.WriteUint32L( 0 );
       
   356 
       
   357     fStream.WriteUint8L( locale.WorkDays() );
       
   358     fStream.WriteInt8L( locale.StartOfWeek() );
       
   359     fStream.WriteInt8L( locale.ClockFormat() );
       
   360     fStream.WriteInt8L( locale.UnitsGeneral() );
       
   361     fStream.WriteInt8L( locale.UnitsDistanceShort() );
       
   362     fStream.WriteInt8L( locale.UnitsDistanceLong() );
       
   363     fStream.WriteInt8L( locale.NegativeCurrencyFormat() );
       
   364     fStream.WriteInt8L( locale.NegativeLoseSpace() );
       
   365     fStream.WriteInt8L( locale.NegativeCurrencySymbolOpposite() );
       
   366     fStream.WriteInt16L( locale.DigitType() );
       
   367 
       
   368     // Then save display language independent data
       
   369     SaveIndependentDataL( locale, aPath );
       
   370 
       
   371     // If CommitL leaves it means probably full disk.
       
   372     // It is here assumed that data has not been changed if this leaves.
       
   373     fStream.CommitL();
       
   374 
       
   375     CleanupStack::PopAndDestroy( &fStream );
       
   376     CleanupStack::PopAndDestroy( fName );
       
   377     }
       
   378 
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // CSsmLocaleObserverSup::LoadLocaleL
       
   382 // ---------------------------------------------------------------------------
       
   383 //
       
   384 void CSsmLocaleObserverSup::LoadLocaleL( const TDesC& aPath )
       
   385     {
       
   386     FUNC_LOG;
       
   387     INFO( "Loading locale data" );
       
   388 
       
   389     HBufC* fName = MakeFileNameL( aPath, KFileName, User::Language() );
       
   390     CleanupStack::PushL( fName );
       
   391 
       
   392     TLocale locale; // copy current values
       
   393 
       
   394     RFileReadStream fStream;
       
   395     CleanupClosePushL( fStream );
       
   396     TInt err = fStream.Open( iFs, *fName, EFileRead );
       
   397     if ( err != KErrNotFound && err != KErrPathNotFound )
       
   398         {
       
   399         ERROR_1( err, "Failed to open stream %S", fName );
       
   400         // Data file is missing upon the first boot or when switching into a
       
   401         // language for the first time
       
   402         }
       
   403 
       
   404     if ( err == KErrNone  )
       
   405         {
       
   406         TInt version = fStream.ReadInt8L();
       
   407         INFO_1( "Locale file version: %d", version );
       
   408 
       
   409         locale.SetCountryCode( fStream.ReadInt16L() );
       
   410         fStream.ReadInt16L(); // obsolete
       
   411         locale.SetDateFormat( static_cast< TDateFormat >( fStream.ReadInt8L() ) );
       
   412         locale.SetTimeFormat( static_cast< TTimeFormat >( fStream.ReadInt8L() ) );
       
   413         locale.SetCurrencySymbolPosition( static_cast< TLocalePos >( fStream.ReadInt8L() ) );
       
   414         locale.SetCurrencySpaceBetween( fStream.ReadInt8L() );
       
   415         locale.SetCurrencyDecimalPlaces( fStream.ReadInt8L() );
       
   416         locale.SetCurrencyNegativeInBrackets( fStream.ReadInt8L() );
       
   417         locale.SetCurrencyTriadsAllowed( fStream.ReadInt8L() );
       
   418         locale.SetThousandsSeparator( fStream.ReadUint32L() );
       
   419         locale.SetDecimalSeparator( fStream.ReadUint32L() );
       
   420         TInt dateSeparators = fStream.ReadInt8L();
       
   421         TInt counter( 0 );
       
   422         for ( counter = 0; counter < dateSeparators ; counter++ )
       
   423             {
       
   424             locale.SetDateSeparator( fStream.ReadUint32L(), counter );
       
   425             }
       
   426         TInt timeSeparators = fStream.ReadInt8L();
       
   427         for ( counter = 0; counter < timeSeparators; counter++ )
       
   428             {
       
   429             locale.SetTimeSeparator( fStream.ReadUint32L(), counter );
       
   430             }
       
   431         locale.SetAmPmSpaceBetween( fStream.ReadInt8L() );
       
   432         locale.SetAmPmSymbolPosition( static_cast< TLocalePos >( fStream.ReadInt8L() ) );
       
   433 
       
   434         // DaylightSaving and HomeDaylightSavingZone are not part of TLocale
       
   435         // any more, zeros are written to LocaleData.Dxx to keep file structure
       
   436         // as it was.
       
   437         fStream.ReadUint32L();
       
   438         fStream.ReadUint32L();
       
   439 
       
   440         locale.SetWorkDays( fStream.ReadUint8L() );
       
   441         locale.SetStartOfWeek( static_cast< TDay >( fStream.ReadInt8L() ) );
       
   442         locale.SetClockFormat( static_cast< TClockFormat>( fStream.ReadInt8L() ) );
       
   443         locale.SetUnitsGeneral( static_cast< TUnitsFormat >( fStream.ReadInt8L() ) );
       
   444         locale.SetUnitsDistanceShort( static_cast< TUnitsFormat >( fStream.ReadInt8L() ) );
       
   445         locale.SetUnitsDistanceLong( static_cast< TUnitsFormat >( fStream.ReadInt8L() ) );
       
   446         locale.SetNegativeCurrencyFormat(
       
   447             static_cast< TLocale::TNegativeCurrencyFormat >( fStream.ReadInt8L() ) );
       
   448         locale.SetNegativeLoseSpace( fStream.ReadInt8L() );
       
   449         locale.SetNegativeCurrencySymbolOpposite( fStream.ReadInt8L() );
       
   450         locale.SetDigitType( static_cast< TDigitType >( fStream.ReadInt16L() ) );
       
   451         }
       
   452 
       
   453     // Then patch data with locale independent data (code 00)
       
   454     // No changes to locale if no independent data can be found (the very first boot)
       
   455     LoadIndependentDataL( locale, aPath );
       
   456 
       
   457     // Save changes to the system.
       
   458     locale.Set();
       
   459 
       
   460     CleanupStack::PopAndDestroy( &fStream );
       
   461     CleanupStack::PopAndDestroy( fName );
       
   462     }
       
   463 
       
   464 
       
   465 // ---------------------------------------------------------------------------
       
   466 // CSsmLocaleObserverSup::SaveIndependentDataL
       
   467 // ---------------------------------------------------------------------------
       
   468 //
       
   469 void CSsmLocaleObserverSup::SaveIndependentDataL(
       
   470     const TLocale& aLocale,
       
   471     const TDesC& aPath )
       
   472     {
       
   473     FUNC_LOG;
       
   474 
       
   475     // Get old independent data, if any.
       
   476     TLocale savedLoc;
       
   477     TRAPD( err, LoadIndependentDataL( savedLoc, aPath ) );
       
   478     ERROR( err, "Failed to load locale independent data" );
       
   479 
       
   480     HBufC* fName = MakeFileNameL( aPath, KCommonFileName, 0 );
       
   481     CleanupStack::PushL( fName );
       
   482     RFileWriteStream fStream;
       
   483     CleanupClosePushL( fStream );
       
   484 
       
   485     err = iFs.MkDirAll( *fName ); // Ignore errors
       
   486     err = fStream.Create( iFs, *fName, EFileWrite );
       
   487     if ( err == KErrAlreadyExists )
       
   488         {
       
   489         // Override
       
   490         err = fStream.Open( iFs, *fName, EFileWrite );
       
   491         ERROR_1( err, "Failed to create stream %S", fName );
       
   492         }
       
   493     User::LeaveIfError( err );
       
   494 
       
   495     // Write first the version number to enable support for file format changes.
       
   496     fStream.WriteInt8L( KCurrentVersionNumber );
       
   497     fStream.WriteInt32L( 0 ); // Universal time offset is not part of TLocale
       
   498                               // any more. Write zero here to keep file structure.
       
   499     // Clock format is also common.
       
   500     fStream.WriteUint32L( aLocale.ClockFormat() );
       
   501     fStream.WriteUint32L( 0 );  // reserved 2
       
   502     fStream.WriteUint32L( 0 );  // reserved 3
       
   503 
       
   504     fStream.CommitL();
       
   505 
       
   506     CleanupStack::PopAndDestroy( &fStream );
       
   507     CleanupStack::PopAndDestroy( fName );
       
   508     }
       
   509 
       
   510 
       
   511 // ---------------------------------------------------------------------------
       
   512 // CSsmLocaleObserverSup::LoadIndependentDataL
       
   513 // ---------------------------------------------------------------------------
       
   514 //
       
   515 void CSsmLocaleObserverSup::LoadIndependentDataL(
       
   516     TLocale& aLocale,
       
   517     const TDesC& aPath )
       
   518     {
       
   519     FUNC_LOG;
       
   520 
       
   521     HBufC* fName = MakeFileNameL( aPath, KCommonFileName, 0 );
       
   522     CleanupStack::PushL( fName );
       
   523 
       
   524     RFileReadStream fStream;
       
   525     CleanupClosePushL( fStream );
       
   526     TInt err = fStream.Open( iFs, *fName, EFileRead );
       
   527     if ( err != KErrNotFound && err != KErrPathNotFound )
       
   528         {
       
   529         ERROR_1( err, "Failed to open stream %S", fName );
       
   530         // Data file is missing upon the first boot or when switching into a
       
   531         // language for the first time
       
   532         }
       
   533 
       
   534     if ( err == KErrNotFound || err == KErrPathNotFound )
       
   535         {
       
   536         // File not found --> Not an error because
       
   537         // this is a new file and older builds do not have this file.
       
   538         INFO( "No locale data found" );
       
   539         }
       
   540     else
       
   541         {
       
   542         User::LeaveIfError( err );
       
   543 
       
   544         fStream.ReadInt8L();    // Version.
       
   545         fStream.ReadInt32L();   // Universal time offset was stored here.
       
   546         aLocale.SetClockFormat( ( TClockFormat ) fStream.ReadUint32L() );
       
   547         fStream.ReadUint32L(); // reserved 2
       
   548         fStream.ReadUint32L(); // reserved 3
       
   549         }
       
   550 
       
   551     CleanupStack::PopAndDestroy( &fStream );
       
   552     CleanupStack::PopAndDestroy( fName );
       
   553     }