smf/smfsettingsui/SettingsRepository.cpp
changeset 14 a469c0e6e7fb
child 18 013a02bf2bb0
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
       
     1 /**
       
     2 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "{License}"
       
     6 * which accompanies  this distribution, and is available
       
     7 * at the URL "{LicenseUrl}".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Settings Repository class of SMF
       
    16 */
       
    17 
       
    18 #include "SettingsRepository.h"
       
    19 
       
    20 #ifdef __FOR_SYMBIAN__
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "SettingsRepository.h"
       
    25 
       
    26 // Standard construction sequence
       
    27 CSettingsRepository* CSettingsRepository::NewL()
       
    28     {
       
    29    	 CSettingsRepository* self = CSettingsRepository::NewLC();
       
    30      CleanupStack::Pop( self );
       
    31      return self;
       
    32     }
       
    33 
       
    34 CSettingsRepository* CSettingsRepository::NewLC()
       
    35     {
       
    36      CSettingsRepository* self = new ( ELeave ) CSettingsRepository;
       
    37      CleanupStack::PushL( self );
       
    38      self->ConstructL();
       
    39      return self;
       
    40     }
       
    41 CSettingsRepository::CSettingsRepository()
       
    42     {
       
    43 
       
    44     }
       
    45 
       
    46 CSettingsRepository::~CSettingsRepository()
       
    47     {
       
    48 	 if(iRepository)
       
    49 		{
       
    50 			delete iRepository;
       
    51 			iRepository = NULL;
       
    52 		}
       
    53     }
       
    54 
       
    55 void CSettingsRepository::ConstructL()
       
    56     {
       
    57    	  User::LeaveIfNull(iRepository= CRepository::NewL(KCRUidSettings));
       
    58     }
       
    59 
       
    60 /*
       
    61 
       
    62  * Method to set the PluginDetails to Repository
       
    63  * Param - @aPluginStatus,holds the Plgugin Status.
       
    64  */
       
    65 void CSettingsRepository::SetPluginDetails(TDesC& aPluginName,TDesC& aPluginStatus)
       
    66 	{
       
    67 		User::LeaveIfError(iRepository->Set(KSettingsUIPluginNameKey,aPluginName));
       
    68 		User::LeaveIfError(iRepository->Set(KSettingsUIPluginStausKey,aPluginStatus));
       
    69 	}
       
    70 /*
       
    71  * Method to set the Auth Expiry Value to Repository
       
    72  * Param - @aVal,Auth Expiry Value
       
    73  */
       
    74 void CSettingsRepository::SetAuthExpirationValue(TDesC& aVal)
       
    75 	{
       
    76 		User::LeaveIfError(iRepository->Set(KSettingsUIAuthExpLimitKey,aVal));
       
    77 	}
       
    78 /*
       
    79  * Method to set the Max. Data Transfer Limit to Repository
       
    80  * Param - @aVal,Max. Data Transfer Limit Value
       
    81  */
       
    82 void CSettingsRepository::SetMaxDataTransferLimit(TDesC& aVal)
       
    83 	{
       
    84 		User::LeaveIfError(iRepository->Set(KSettingsUIMaxDataTransferLimitKey,aVal));
       
    85 	}
       
    86 /*
       
    87  * Method to set the Roaming Status for Data Transfer to Repository
       
    88  * Param - @aStatus,Rpaming Status value for Data Transfer
       
    89  */
       
    90 void CSettingsRepository::SetRoamingStatusforDataTransfer(TDesC& aStatus)
       
    91 	{
       
    92 		User::LeaveIfError(iRepository->Set(KSettingsUIRoamingStatusKey,aStatus));
       
    93 	}
       
    94 /*
       
    95  * Method to set the Upload File Type to Repository
       
    96  * Param - @aStatus,Upload File Type Value
       
    97  */
       
    98 void CSettingsRepository::SetUploadFileType(TDesC& aFileType)
       
    99 	{
       
   100 		User::LeaveIfError(iRepository->Set(KSettingsUIUploadFileTypeKey,aFileType));
       
   101 	}
       
   102 /*
       
   103  * Method to Get the PluginDetails from Repository
       
   104  */
       
   105 RArray<TBuf<KMaxSettingValue> >& CSettingsRepository::GetPluginDetails() const
       
   106 	{
       
   107 		TBuf<KMaxSettingValue> Value;
       
   108 		RArray<TBuf<KMaxSettingValue> > PluginDetails;
       
   109 
       
   110 		User::LeaveIfError(iRepository->Get(KSettingsUIPluginNameKey,Value));
       
   111 		PluginDetails.AppendL(Value);
       
   112 		
       
   113 		User::LeaveIfError(iRepository->Get(KSettingsUIPluginStausKey,Value));
       
   114 		PluginDetails.AppendL(Value);
       
   115 		
       
   116 		return PluginDetails;
       
   117 	}
       
   118 /*
       
   119  * Method to Get the Auth Expiry Value from Repository
       
   120  */
       
   121 TDesC& CSettingsRepository::GetAuthExpirationValue() const
       
   122 	{
       
   123 		TBuf<KMaxSettingValue> Value;
       
   124 		User::LeaveIfError(iRepository->Get(KSettingsUIAuthExpLimitKey,Value));
       
   125 		return Value;
       
   126 	}
       
   127 /*
       
   128  * Method to Get the Max. Data Transfer Limit from Repository
       
   129  */
       
   130 TDesC& CSettingsRepository::GetMaxDataTransferLimit() const
       
   131 	{
       
   132 		TBuf<KMaxSettingValue> Value;
       
   133 		User::LeaveIfError(iRepository->Get(KSettingsUIMaxDataTransferLimitKey,Value));
       
   134 		return Value;
       
   135 	}
       
   136 /*
       
   137  * Method to Get the Roaming Status for Data Transfer from Repository
       
   138  */
       
   139 TDesC& CSettingsRepository::GetRoamingStatusforDataTransfer() const
       
   140 	{
       
   141 		TBuf<KMaxSettingValue> Value;
       
   142 		User::LeaveIfError(iRepository->Get(KSettingsUIRoamingStatusKey,Value));
       
   143 		return Value;
       
   144 	}
       
   145 /*
       
   146  * Method to Get the Upload File Type from Repository
       
   147  */
       
   148 TDesC& CSettingsRepository::GetUploadFileType() const
       
   149 	{
       
   150 		TBuf<KMaxSettingValue> Value;
       
   151 		User::LeaveIfError(iRepository->Get(KSettingsUIUploadFileTypeKey,Value));
       
   152 		return Value;
       
   153 	}
       
   154 
       
   155 
       
   156 #endif