internetradio2.0/settingssrc/irsettings.cpp
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
     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:
       
    15 *
       
    16 */
       
    17 #include <barsc.h>
       
    18 #include <bautils.h>
       
    19 #include <coemain.h>
       
    20 #include <data_caging_path_literals.hrh>
       
    21 #include <irsettings.rsg>
       
    22 #include <pathinfo.h>
       
    23 #include <s32file.h>
       
    24 #include <centralrepository.h>
       
    25 
       
    26 #include "irdebug.h"
       
    27 #include "irsettings.h"
       
    28 #include "irinternalcrkeys.h"
       
    29 
       
    30 // Constants
       
    31 _LIT( KIRSettingsResourceFileName, "irsettings.rsc" );
       
    32 const TInt KSix = 6;
       
    33 const TInt KFifty = 50;
       
    34 const TInt KTimeSize = 60000000 ;
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // description_if_needed
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C CIRSettings* CIRSettings::OpenL()
       
    41     {
       
    42     IRLOG_DEBUG( "CIRSettings::OpenL() - Entering" );
       
    43     CIRSettings* self = static_cast<CIRSettings*>( Dll::Tls() );
       
    44 
       
    45     if ( self )
       
    46         {
       
    47         User::LeaveIfError( self->Open() );
       
    48         }
       
    49     else
       
    50         {
       
    51         self = new ( ELeave ) CIRSettings;
       
    52         CleanupClosePushL( *self );
       
    53         self->ConstructL();
       
    54         CleanupStack::Pop( self );
       
    55         }
       
    56     IRLOG_DEBUG( "CIRSettings::OpenL() - Exiting" );
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // description_if_needed
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CIRSettings::CIRSettings()
       
    65     : iResourceFileOffset( KErrNotFound )
       
    66     {
       
    67     IRLOG_DEBUG( "CIRSettings::CIRSettings" );
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // description_if_needed
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CIRSettings::ConstructL()
       
    75     {
       
    76     IRLOG_DEBUG( "CIRSettings::ConstructL() - Enter" );
       
    77 
       
    78 	iRepository = CRepository::NewL(KCRUidInternetRadio);
       
    79 		
       
    80     User::LeaveIfError( iFs.Connect() );
       
    81 
       
    82     TParse parse;
       
    83 
       
    84     // Parses out the resource file name and path to it.
       
    85 
       
    86     TFileName resourceFileNameAndPath;
       
    87     Dll::FileName( resourceFileNameAndPath );
       
    88 
       
    89     parse.Set( KIRSettingsResourceFileName, &KDC_RESOURCE_FILES_DIR, &resourceFileNameAndPath );
       
    90     resourceFileNameAndPath = parse.FullName();
       
    91 
       
    92     BaflUtils::NearestLanguageFile( iFs, resourceFileNameAndPath );
       
    93 
       
    94     IRLOG_DEBUG2("CIRSettings::ConstructL - resourceFileNameAndPath = %S", &resourceFileNameAndPath );
       
    95     
       
    96     iResourceFileOffset = CCoeEnv::Static()->AddResourceFileL( resourceFileNameAndPath );
       
    97 
       
    98     // Parses out the private path of the running process.
       
    99 	
       
   100     User::LeaveIfError( iFs.PrivatePath( iPrivatePath ) );
       
   101     
       
   102     TParsePtrC phoneMemoryRootPath( PathInfo::PhoneMemoryRootPath() );
       
   103     TPtrC drive( phoneMemoryRootPath.Drive() );
       
   104     User::LeaveIfError( parse.Set( iPrivatePath, &drive, NULL ) );
       
   105     iPrivatePath = parse.FullName();
       
   106 
       
   107     BaflUtils::EnsurePathExistsL( iFs, parse.FullName() );
       
   108 
       
   109     IRLOG_DEBUG2("CIRSettings::ConstructL - iPrivatePath = %S", &iPrivatePath );
       
   110     
       
   111     User::LeaveIfError( Dll::SetTls( this ) );
       
   112     
       
   113     IRLOG_DEBUG( "CIRSettings::ConstructL() - Exit" );
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // description_if_needed
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 CIRSettings::~CIRSettings()
       
   121     {
       
   122     IRLOG_DEBUG( "CIRSettings::~CIRSettings() - Entering" );
       
   123 	delete iRepository;
       
   124     iFs.Close();
       
   125 
       
   126     if ( iResourceFileOffset != KErrNotFound )
       
   127         {
       
   128         CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset );
       
   129         }
       
   130     
       
   131     Dll::FreeTls();
       
   132     }
       
   133     
       
   134 // ---------------------------------------------------------------------------
       
   135 // description_if_needed
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 EXPORT_C TBool CIRSettings::IsFlagTermsAndConditionsL()
       
   139     {
       
   140        IRLOG_DEBUG( "CIRSettings::IsFlagTermsAndConditionsL() - Entering" );
       
   141        TInt value = 0;
       
   142        User::LeaveIfError( iRepository->Get(KIRTermsAndConditionsFlag, value) );
       
   143        IRLOG_DEBUG( "CIRSettings::IsFlagTermsAndConditionsL() - Exiting" );
       
   144        return value == 1 ? ETrue : EFalse;
       
   145     }
       
   146     
       
   147 // ---------------------------------------------------------------------------
       
   148 // description_if_needed
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 EXPORT_C void CIRSettings::SetFlagTermsAndConditionsL()
       
   152     {
       
   153        IRLOG_DEBUG( "CIRSettings::SetFlagTermsAndConditionsL() - Entering" );
       
   154        User::LeaveIfError ( iRepository->Set(KIRTermsAndConditionsFlag, 1));
       
   155        IRLOG_DEBUG( "CIRSettings::SetFlagTermsAndConditionsL() - Exiting" );
       
   156     }
       
   157     
       
   158 // ---------------------------------------------------------------------------
       
   159 // description_if_needed
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 EXPORT_C void CIRSettings::ReSetFlagTermsAndConditionsL()
       
   163     {
       
   164     	IRLOG_DEBUG( "CIRSettings::ReSetFlagTermsAndConditionsL() - Entering" );
       
   165         User::LeaveIfError ( iRepository->Set(KIRTermsAndConditionsFlag, 0));
       
   166         IRLOG_DEBUG( "CIRSettings::ReSetFlagTermsAndConditionsL() - Exiting" );
       
   167     }
       
   168     
       
   169 // ---------------------------------------------------------------------------
       
   170 // description_if_needed
       
   171 // ---------------------------------------------------------------------------
       
   172 //
       
   173 EXPORT_C const TDesC& CIRSettings::GetIrappVersionL() const
       
   174     {
       
   175     		IRLOG_DEBUG( "CIRSettings::GetIrappVersionL() - Entering" );
       
   176     		User::LeaveIfError( iRepository->Get(KIRIrappVer, (TDes&)iIrappVersion) );
       
   177     		IRLOG_DEBUG( "CIRSettings::GetIrappVersionL() - Exiting" );
       
   178     		return iIrappVersion;
       
   179     }
       
   180     
       
   181 // ---------------------------------------------------------------------------
       
   182 // description_if_needed
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 EXPORT_C void CIRSettings::SetIRIDL(const TDesC& aIrid)
       
   186     {
       
   187     		IRLOG_DEBUG( "CIRSettings::SetIRIDL() - Entering" );
       
   188             User::LeaveIfError ( iRepository->Set(KIRDefaultIrId, aIrid) );
       
   189             IRLOG_DEBUG( "CIRSettings::SetIRIDL() - Exiting" );
       
   190     }
       
   191     
       
   192 // ---------------------------------------------------------------------------
       
   193 // description_if_needed
       
   194 // ---------------------------------------------------------------------------
       
   195 //
       
   196 EXPORT_C const TDesC& CIRSettings::GetIRIDL() const
       
   197     {
       
   198     		IRLOG_DEBUG( "CIRSettings::GetIRIDL() - Entering" );
       
   199     		User::LeaveIfError( iRepository->Get(KIRDefaultIrId, (TDes&)iIRID) );
       
   200     		IRLOG_DEBUG( "CIRSettings::GetIRIDL() - Exiting" );
       
   201     		return iIRID;
       
   202     }
       
   203     
       
   204 // ---------------------------------------------------------------------------
       
   205 // description_if_needed
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 EXPORT_C const  TDesC& CIRSettings::GetISDSBaseUrlL() const
       
   209     {
       
   210     	IRLOG_DEBUG( "CIRSettings::GetISDSBaseUrlL() - Entering" );
       
   211     	User::LeaveIfError( iRepository->Get(KIRDefaultIsdsUrl, (TDes&)iISDSBaseUrl) );
       
   212     	IRLOG_DEBUG( "CIRSettings::GetISDSBaseUrlL() - Exiting" );
       
   213        	return iISDSBaseUrl;
       
   214     }
       
   215     
       
   216 // ---------------------------------------------------------------------------
       
   217 // description_if_needed
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 EXPORT_C void CIRSettings::SetISDSBaseUrlL(const TDesC& aIsdsUrl)
       
   221     {
       
   222     	IRLOG_DEBUG( "CIRSettings::SetISDSBaseUrlL() - Entering" );
       
   223         User::LeaveIfError ( iRepository->Set(KIRDefaultIsdsUrl, aIsdsUrl) );
       
   224         IRLOG_DEBUG( "CIRSettings::SetISDSBaseUrlL() - Exiting" );
       
   225     }
       
   226     
       
   227 // ---------------------------------------------------------------------------
       
   228 // description_if_needed
       
   229 // ---------------------------------------------------------------------------
       
   230 //
       
   231 EXPORT_C TInt CIRSettings::GetVolumeSetting() const
       
   232     {
       
   233     IRLOG_DEBUG( "CIRSettings::GetVolumeSetting() - Entering" );
       
   234     TInt value = KSix;
       
   235     TInt err = iRepository->Get(KIRDefaultPlayVolume, value);
       
   236     if(err)
       
   237 	    {
       
   238         IRLOG_DEBUG( "CIRSettings::GetVolumeSetting() - Error" );
       
   239 	    }
       
   240  
       
   241     IRLOG_DEBUG( "CIRSettings::GetVolumeSetting() - Exiting" );
       
   242     return value;
       
   243     }
       
   244     
       
   245 // ---------------------------------------------------------------------------
       
   246 // description_if_needed
       
   247 // ---------------------------------------------------------------------------
       
   248 //
       
   249 EXPORT_C void CIRSettings::SetVolumeSettingL(TInt aPlayVolume)
       
   250     {
       
   251       IRLOG_DEBUG( "CIRSettings::SetVolumeSettingL() - Entering" );
       
   252       User::LeaveIfError ( iRepository->Set(KIRDefaultPlayVolume, aPlayVolume));
       
   253       IRLOG_DEBUG( "CIRSettings::SetVolumeSettingL() - Exiting" );
       
   254     }
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // description_if_needed
       
   258 // ---------------------------------------------------------------------------
       
   259 //
       
   260 EXPORT_C TBool CIRSettings::IsUpdateAvailableL()
       
   261     {
       
   262     	IRLOG_DEBUG( "CIRSettings::IsUpdateAvailableL() - Entering" );
       
   263        TBool value = ETrue;
       
   264        User::LeaveIfError( iRepository->Get(KIRUpdateAvailablity, value) );
       
   265        IRLOG_DEBUG( "CIRSettings::IsUpdateAvailableL() - Exiting" );
       
   266        return value;
       
   267     }
       
   268     
       
   269 // ---------------------------------------------------------------------------
       
   270 // description_if_needed
       
   271 // ---------------------------------------------------------------------------
       
   272 //
       
   273 EXPORT_C void CIRSettings::SetUpdateAvailableL()
       
   274     {
       
   275     	IRLOG_DEBUG( "CIRSettings::SetUpdateAvailableL() - Entering" );
       
   276         User::LeaveIfError ( iRepository->Set(KIRUpdateAvailablity, 1));
       
   277         IRLOG_DEBUG( "CIRSettings::SetUpdateAvailableL() - Exiting" );
       
   278     }
       
   279     
       
   280 // ---------------------------------------------------------------------------
       
   281 // description_if_needed
       
   282 // ---------------------------------------------------------------------------
       
   283 //
       
   284 EXPORT_C void CIRSettings::ReSetUpdateAvailableL()
       
   285     {
       
   286     	IRLOG_DEBUG( "CIRSettings::ReSetUpdateAvailableL() - Entering" );
       
   287         User::LeaveIfError ( iRepository->Set(KIRUpdateAvailablity, 0));
       
   288         IRLOG_DEBUG( "CIRSettings::ReSetUpdateAvailableL() - Exiting" );
       
   289     }
       
   290     
       
   291  
       
   292 // ---------------------------------------------------------------------------
       
   293 // description_if_needed
       
   294 // ---------------------------------------------------------------------------
       
   295 //
       
   296 EXPORT_C TInt CIRSettings::GetLogRunningNo() const
       
   297     {
       
   298 		IRLOG_DEBUG( "CIRSettings::GetLogRunningNo() - Entering" );
       
   299         TInt value = 1;
       
   300         TInt err = iRepository->Get(KIRUserDefinedLogRunningNumber, value);
       
   301         if(err)
       
   302 	        {
       
   303     	    IRLOG_DEBUG( "CIRSettings::GetLogRunningNo() - Error" );
       
   304     	    }
       
   305     	IRLOG_DEBUG( "CIRSettings::GetLogRunningNo() - Exiting" );
       
   306     	return value;
       
   307     }
       
   308     
       
   309 // ---------------------------------------------------------------------------
       
   310 // description_if_needed
       
   311 // ---------------------------------------------------------------------------
       
   312 //
       
   313 EXPORT_C void CIRSettings::SetLogRunningNoL()
       
   314     {
       
   315     IRLOG_DEBUG( "CIRSettings::SetLogRunningNoL() - Entering" );
       
   316     TInt value = GetLogRunningNo();
       
   317     value++;
       
   318     User::LeaveIfError ( iRepository->Set(KIRUserDefinedLogRunningNumber,value));
       
   319     IRLOG_DEBUG( "CIRSettings::SetLogRunningNoL() - Exiting" );
       
   320     }
       
   321     
       
   322   
       
   323 // ---------------------------------------------------------------------------
       
   324 // description_if_needed
       
   325 // ---------------------------------------------------------------------------
       
   326 //
       
   327 EXPORT_C void CIRSettings::SetTimeOutL(TInt aTimeOut)
       
   328     {
       
   329        IRLOG_DEBUG( "CIRSettings::SetTimeOutL() - Entering" );
       
   330        User::LeaveIfError ( iRepository->Set(KIRTimeOutDuration, aTimeOut) );
       
   331        IRLOG_DEBUG( "CIRSettings::SetTimeOutL() - Exiting" );
       
   332        }
       
   333     
       
   334 // ---------------------------------------------------------------------------
       
   335 // description_if_needed
       
   336 // ---------------------------------------------------------------------------
       
   337 //
       
   338 EXPORT_C TInt CIRSettings::GetTimeOut() const
       
   339     {
       
   340     IRLOG_DEBUG( "CIRSettings::GetTimeOut() - Entering" );
       
   341     TInt value = KTimeSize;
       
   342     TInt err = iRepository->Get(KIRTimeOutDuration, value) ;
       
   343     if(err)
       
   344 	    {
       
   345         IRLOG_DEBUG( "CIRSettings::GetTimeOut() - Error" );
       
   346 	    }
       
   347 
       
   348     IRLOG_DEBUG( "CIRSettings::GetTimeOut() - Exiting" );
       
   349     return value;
       
   350     }
       
   351     
       
   352 // ---------------------------------------------------------------------------
       
   353 // description_if_needed
       
   354 // ---------------------------------------------------------------------------
       
   355 //
       
   356 EXPORT_C void CIRSettings::SetSilencePeriodL(TUint aSilencePeriod)
       
   357     {
       
   358     	IRLOG_DEBUG( "CIRSettings::SetSilencePeriodL() - Entering" );
       
   359         User::LeaveIfError ( iRepository->Set(KIRSilencePeriodDuration, (TInt)aSilencePeriod) );
       
   360         IRLOG_DEBUG( "CIRSettings::SetSilencePeriodL() - Exiting" );
       
   361     }
       
   362     
       
   363 // ---------------------------------------------------------------------------
       
   364 // description_if_needed
       
   365 // ---------------------------------------------------------------------------
       
   366 //
       
   367 EXPORT_C TUint CIRSettings::GetSilencePeriodL() const
       
   368     {
       
   369     	IRLOG_DEBUG( "CIRSettings::GetSilencePeriodL() - Entering" );
       
   370     	TInt value =0;
       
   371     	User::LeaveIfError( iRepository->Get(KIRSilencePeriodDuration, value) );
       
   372     	IRLOG_DEBUG( "CIRSettings::GetSilencePeriodL() - Exiting" );
       
   373     	return value;
       
   374     }
       
   375     
       
   376 // ---------------------------------------------------------------------------
       
   377 // description_if_needed
       
   378 // ---------------------------------------------------------------------------
       
   379 //
       
   380 EXPORT_C void CIRSettings::SetSilencePeriodStartL(const TDesC& aSilencePeriodStart)
       
   381     {
       
   382     	IRLOG_DEBUG( "CIRSettings::SetSilencePeriodStartL() - Entering" );
       
   383         User::LeaveIfError ( iRepository->Set(KIRSilencePeriodStartingTime, aSilencePeriodStart) );
       
   384         IRLOG_DEBUG( "CIRSettings::SetSilencePeriodStartL() - Exiting" );
       
   385     }
       
   386     
       
   387 // ---------------------------------------------------------------------------
       
   388 // description_if_needed
       
   389 // ---------------------------------------------------------------------------
       
   390 //
       
   391 EXPORT_C const TDesC& CIRSettings::GetSilencePeriodStartL() const
       
   392     {
       
   393     	IRLOG_DEBUG( "CIRSettings::GetSilencePeriodStartL() - Entering" );
       
   394     	User::LeaveIfError( iRepository->Get(KIRSilencePeriodStartingTime,
       
   395     					  (TDes&)iSilencePeriodStartTime) );
       
   396     	IRLOG_DEBUG( "CIRSettings::GetSilencePeriodStartL() - Exiting" );
       
   397         return iSilencePeriodStartTime;
       
   398     }
       
   399 
       
   400 // ---------------------------------------------------------------------------
       
   401 // description_if_needed
       
   402 // ---------------------------------------------------------------------------
       
   403 //
       
   404 EXPORT_C void CIRSettings::SetPreferredQualityL(TInt aQualityValue)
       
   405     {
       
   406     IRLOG_DEBUG( "CIRSettings::SetPreferredQualityL() - Entering" );
       
   407     User::LeaveIfError ( iRepository->Set(KIRPreferredQuality, aQualityValue) );
       
   408     IRLOG_DEBUG( "CIRSettings::SetPreferredQualityL() - Exiting" );
       
   409     }
       
   410 
       
   411     
       
   412 // ---------------------------------------------------------------------------
       
   413 // description_if_needed
       
   414 // ---------------------------------------------------------------------------
       
   415 //
       
   416 EXPORT_C TInt CIRSettings::GetPreferredQuality() const
       
   417     {
       
   418     	IRLOG_DEBUG( "CIRSettings::GetPreferredQuality() - Entering" );
       
   419     	TInt value = 0;
       
   420     	TInt err = iRepository->Get(KIRPreferredQuality, value);
       
   421     	if(err)
       
   422 	    	{
       
   423 	        IRLOG_DEBUG( "CIRSettings::GetPreferredQuality() - Error" );
       
   424 	    	}
       
   425 
       
   426 	    IRLOG_DEBUG( "CIRSettings::GetPreferredQuality() - Exiting" );
       
   427     	return value;
       
   428     }
       
   429 
       
   430 EXPORT_C TInt CIRSettings::GetSongHistoryShow() const
       
   431 {
       
   432     IRLOG_DEBUG( "CIRSettings::GetSongHistoryShow() - Entering" );
       
   433     TInt value = 0;
       
   434     TInt err = iRepository->Get(KIRSongHistoryShow, value);
       
   435     if(err)
       
   436         {
       
   437         IRLOG_DEBUG( "CIRSettings::GetSongHistoryShow() - Error" );
       
   438         }
       
   439 
       
   440     IRLOG_DEBUG( "CIRSettings::GetSongHistoryShow() - Exiting" );
       
   441     return value;
       
   442 }
       
   443 
       
   444 EXPORT_C void CIRSettings::SetSongHisotryShowL(TInt aShowFlag)
       
   445 {
       
   446     IRLOG_DEBUG( "CIRSettings::SetSongHisotryShow() - Entering" );
       
   447     User::LeaveIfError(iRepository->Set(KIRSongHistoryShow, aShowFlag));
       
   448     IRLOG_DEBUG( "CIRSettings::SetSongHisotryShow() - Exiting" );
       
   449 }
       
   450     
       
   451 // ---------------------------------------------------------------------------
       
   452 // description_if_needed
       
   453 // ---------------------------------------------------------------------------
       
   454 //
       
   455 EXPORT_C void CIRSettings::SetMaxPresetCountL(TInt aMaxCount)
       
   456     {
       
   457     IRLOG_DEBUG( "CIRSettings::SetMaxPresetCountL() - Entering" );
       
   458     User::LeaveIfError ( iRepository->Set(KIRDefaultMaxPresetCount, aMaxCount) );
       
   459     IRLOG_DEBUG( "CIRSettings::SetMaxPresetCountL() - Exiting" );    
       
   460     }
       
   461     
       
   462 // ---------------------------------------------------------------------------
       
   463 // description_if_needed
       
   464 // ---------------------------------------------------------------------------
       
   465 //
       
   466 EXPORT_C TInt CIRSettings::MaxPresetCount()
       
   467     {
       
   468     	IRLOG_DEBUG( "CIRSettings::MaxPresetCount() - Entering" );
       
   469     	TInt value = KFifty;
       
   470     	TInt err = iRepository->Get(KIRDefaultMaxPresetCount, value) ;
       
   471     	if(err)
       
   472 	    	{
       
   473 	        IRLOG_DEBUG( "CIRSettings::MaxPresetCount() - Error" );
       
   474 	    	}
       
   475 
       
   476 	    IRLOG_DEBUG( "CIRSettings::MaxPresetCount() - Exiting" );
       
   477     	return value;
       
   478     }
       
   479     
       
   480     
       
   481 // ---------------------------------------------------------------------------
       
   482 // description_if_needed
       
   483 // ---------------------------------------------------------------------------
       
   484 //
       
   485 EXPORT_C void CIRSettings::SetTimeCorrectionL(TInt aCorrection)
       
   486     {
       
   487     	IRLOG_DEBUG( "CIRSettings::SetTimeCorrectionL() - Entering" );
       
   488         User::LeaveIfError ( iRepository->Set(KIRDefaultTimeCorrection, aCorrection) );
       
   489         IRLOG_DEBUG( "CIRSettings::SetTimeCorrectionL() - Exiting" );
       
   490     }
       
   491     
       
   492 // ---------------------------------------------------------------------------
       
   493 // description_if_needed
       
   494 // ---------------------------------------------------------------------------
       
   495 //
       
   496 EXPORT_C TInt CIRSettings::TimeCorrection() const
       
   497     {
       
   498     	IRLOG_DEBUG( "CIRSettings::TimeCorrection() - Entering" );
       
   499         TInt value = 0;
       
   500         TInt err = iRepository->Get(KIRDefaultTimeCorrection, value) ;
       
   501         if(err)
       
   502 	        {
       
   503 	        IRLOG_DEBUG( "CIRSettings::TimeCorrection() - Error" );
       
   504 	        }
       
   505 
       
   506 	    IRLOG_DEBUG( "CIRSettings::TimeCorrection() - Exiting" );
       
   507     	return value;
       
   508     }
       
   509     
       
   510 // ---------------------------------------------------------------------------
       
   511 // description_if_needed
       
   512 // ---------------------------------------------------------------------------
       
   513 //
       
   514 EXPORT_C const TDesC& CIRSettings::PrivatePath() const
       
   515     {
       
   516     IRLOG_DEBUG( "CIRSettings::PrivatePath" );
       
   517     return iPrivatePath;
       
   518     }
       
   519 
       
   520 // ---------------------------------------------------------------------------
       
   521 // SetStartingViewIdL()
       
   522 // Sets the starting view Id in cenrep
       
   523 // ---------------------------------------------------------------------------
       
   524 //
       
   525 EXPORT_C void CIRSettings::SetStartingViewIdL(TUint32 aStartingViewId)
       
   526     {
       
   527     IRLOG_DEBUG( "CIRSettings::SetStartingViewIdL() - Entering" );
       
   528     User::LeaveIfError ( iRepository->Set(KIRStartingViewId, (TInt)aStartingViewId) );
       
   529     IRLOG_DEBUG( "CIRSettings::SetStartingViewIdL() - Exiting" );
       
   530     }
       
   531     
       
   532 // ---------------------------------------------------------------------------
       
   533 // GetStartingViewIdL()
       
   534 // Gets the starting view Id from cenrep
       
   535 // ---------------------------------------------------------------------------
       
   536 //
       
   537 EXPORT_C TUint32 CIRSettings::GetStartingViewIdL() const
       
   538     {
       
   539     IRLOG_DEBUG( "CIRSettings::GetStartingViewIdL() - Entering" );
       
   540     TInt value = 0;
       
   541     User::LeaveIfError( iRepository->Get(KIRStartingViewId, value) );
       
   542     IRLOG_DEBUG( "CIRSettings::GetStartingViewIdL() - Exiting" );
       
   543     return value;
       
   544     } 
       
   545 
       
   546 // ---------------------------------------------------------------------------
       
   547 // GetGlobalAdvFlagL()
       
   548 // Gets the global advertisement flag from cenrep
       
   549 // ---------------------------------------------------------------------------
       
   550 //
       
   551 EXPORT_C TBool CIRSettings::GetGlobalAdvFlagL()
       
   552 {
       
   553   IRLOG_DEBUG( "CIRSettings::GetGlobalAdvFlagL() - Entering" );
       
   554   TBool value = ETrue;
       
   555   User::LeaveIfError( iRepository->Get(KIRGlobalAdvFlag, value) );
       
   556   IRLOG_DEBUG( "CIRSettings::GetGlobalAdvFlagL() - Exiting" );
       
   557   return value;
       
   558 }
       
   559 
       
   560 // ---------------------------------------------------------------------------
       
   561 // description_if_needed
       
   562 // ---------------------------------------------------------------------------
       
   563 //
       
   564 EXPORT_C const  TDesC& CIRSettings::GetManuallyInputtedStationUrlL() const
       
   565     {
       
   566         IRLOG_DEBUG( "CIRSettings::GetManuallyInputtedStationUrlL() - Entering" );
       
   567         User::LeaveIfError( iRepository->Get(KIRStationUrl, (TDes&)iStationUrl) );
       
   568         IRLOG_DEBUG( "CIRSettings::GetManuallyInputtedStationUrlL() - Exiting" );
       
   569         return iStationUrl;
       
   570     }
       
   571     
       
   572 // ---------------------------------------------------------------------------
       
   573 // description_if_needed
       
   574 // ---------------------------------------------------------------------------
       
   575 //
       
   576 EXPORT_C void CIRSettings::SetManuallyInputtedStationUrlL(const TDesC& aUrl)
       
   577     {
       
   578         IRLOG_DEBUG( "CIRSettings::SetManuallyInputtedStationUrlL() - Entering" );
       
   579         User::LeaveIfError ( iRepository->Set(KIRStationUrl, aUrl) );
       
   580         IRLOG_DEBUG( "CIRSettings::SetManuallyInputtedStationUrlL() - Exiting" );
       
   581     }
       
   582 
       
   583 // ---------------------------------------------------------------------------
       
   584 // description_if_needed
       
   585 // ---------------------------------------------------------------------------
       
   586 //
       
   587 EXPORT_C const  TDesC& CIRSettings::GetManuallyInputtedStationNameL() const
       
   588     {
       
   589         IRLOG_DEBUG( "CIRSettings::GetManuallyInputtedStationNameL() - Entering" );
       
   590         User::LeaveIfError( iRepository->Get(KIRStationName, (TDes&)iStationName) );
       
   591         IRLOG_DEBUG( "CIRSettings::GetManuallyInputtedStationNameL() - Exiting" );
       
   592         return iStationName;
       
   593     }
       
   594     
       
   595 // ---------------------------------------------------------------------------
       
   596 // description_if_needed
       
   597 // ---------------------------------------------------------------------------
       
   598 //
       
   599 EXPORT_C void CIRSettings::SetManuallyInputtedStationNameL(const TDesC& aName)
       
   600     {
       
   601         IRLOG_DEBUG( "CIRSettings::SetManuallyInputtedStationNameL() - Entering" );
       
   602         User::LeaveIfError ( iRepository->Set(KIRStationName, aName) );
       
   603         IRLOG_DEBUG( "CIRSettings::SetManuallyInputtedStationNameL() - Exiting" );
       
   604     }