smf/smfservermodule/smfserver/server/smfsettingshandler_symbian.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 "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  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * 
       
    14  * Description:
       
    15  * Settings Repository class of SMF
       
    16  */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include "smfsettingshandler_symbian.h"
       
    20 #include <SettingsConstants.h>
       
    21 
       
    22 // Standard construction sequence
       
    23 CSettingsRepository* CSettingsRepository::NewL()
       
    24     {
       
    25    	 CSettingsRepository* self = CSettingsRepository::NewLC();
       
    26      CleanupStack::Pop( self );
       
    27      return self;
       
    28     }
       
    29 
       
    30 CSettingsRepository* CSettingsRepository::NewLC()
       
    31     {
       
    32      CSettingsRepository* self = new ( ELeave ) CSettingsRepository;
       
    33      CleanupStack::PushL( self );
       
    34      self->ConstructL();
       
    35      return self;
       
    36     }
       
    37 CSettingsRepository::CSettingsRepository()
       
    38     {
       
    39 
       
    40     }
       
    41 
       
    42 CSettingsRepository::~CSettingsRepository()
       
    43     {
       
    44 	 if(iRepository)
       
    45 		{
       
    46 			delete iRepository;
       
    47 			iRepository = NULL;
       
    48 		}
       
    49     }
       
    50 
       
    51 void CSettingsRepository::ConstructL()
       
    52     {
       
    53    	  User::LeaveIfNull(iRepository= CRepository::NewL(KCRUidSettings));
       
    54     }
       
    55 void CSettingsRepository::SetPluginDetails(QString& aPluginName,QString& aPluginStatus)
       
    56 	{
       
    57 	TPtrC pluginNameSymbian(static_cast<const TUint16*>(aPluginName.utf16()), aPluginName.length());
       
    58 	TPtrC pluginStatusSymbian(static_cast<const TUint16*>(aPluginStatus.utf16()), aPluginStatus.length());
       
    59 	SetPluginDetails(pluginNameSymbian,pluginStatusSymbian);
       
    60 	}
       
    61 
       
    62 void CSettingsRepository::SetAuthExpirationValue(QString& aVal)
       
    63 	{
       
    64 	TPtrC valSymbian(static_cast<const TUint16*>(aVal.utf16()), aVal.length());
       
    65 	SetAuthExpirationValue(valSymbian);
       
    66 	}
       
    67 
       
    68 void CSettingsRepository::SetMaxDataTransferLimit(QString& aVal)
       
    69 	{
       
    70 	TPtrC valSymbian(static_cast<const TUint16*>(aVal.utf16()), aVal.length());
       
    71 	SetMaxDataTransferLimit(valSymbian);
       
    72 	}
       
    73 
       
    74 void CSettingsRepository::SetRoamingStatusforDataTransfer(QString& aStatus)
       
    75 	{
       
    76 	TPtrC valSymbian(static_cast<const TUint16*>(aStatus.utf16()), aStatus.length());
       
    77 	SetRoamingStatusforDataTransfer(valSymbian);
       
    78 	}
       
    79 
       
    80 void CSettingsRepository::SetUploadFileType(QString& aFileType)
       
    81 	{
       
    82 	TPtrC valSymbian(static_cast<const TUint16*>(aFileType.utf16()), aFileType.length());
       
    83 	SetRoamingStatusforDataTransfer(valSymbian);
       
    84 	}
       
    85 
       
    86 void CSettingsRepository::GetPluginDetails(QMap<QString,QString>& aDetails) 
       
    87 	{
       
    88 	TBuf<KMaxSettingValue> name ;
       
    89 	TBuf<KMaxSettingValue> details;
       
    90 	GetPluginDetailsInternal(name,details);
       
    91 
       
    92 	QString nameQt = QString::fromUtf16((name.Ptr()),name.Length());
       
    93 	QString statusQt = QString::fromUtf16((details.Ptr()),details.Length());
       
    94 	aDetails.insert(nameQt,statusQt);
       
    95 
       
    96 	}
       
    97 
       
    98 QString CSettingsRepository::GetAuthExpirationValue() const
       
    99 	{
       
   100 	TBuf<125> valSymbian;
       
   101 	GetAuthExpirationValueInternal(valSymbian);
       
   102 	QString valQt = QString::fromUtf16((valSymbian.Ptr()),valSymbian.Length());
       
   103 	return valQt;
       
   104 	}
       
   105 
       
   106 QString CSettingsRepository::GetMaxDataTransferLimit()const
       
   107 	{
       
   108 
       
   109 	TBuf<125> buf;
       
   110 	GetMaxDataTransferLimitInternal(buf);
       
   111 	QString str;
       
   112 	str = QString::fromUtf16((buf.Ptr()),buf.Length());
       
   113 	return str;
       
   114 
       
   115 	}
       
   116 
       
   117 QString CSettingsRepository::GetRoamingStatusforDataTransfer() const
       
   118 	{
       
   119 	TBuf<125> valSymbian ;
       
   120 	GetRoamingStatusforDataTransferInternal(valSymbian);
       
   121 	QString valQt;
       
   122 	valQt = QString::fromUtf16((valSymbian.Ptr()),valSymbian.Length());
       
   123 	return valQt;
       
   124 	}
       
   125 
       
   126 QString CSettingsRepository::GetUploadFileType() const
       
   127 	{
       
   128 	TBuf<125> valSymbian;
       
   129 	GetUploadFileTypeInternal(valSymbian);
       
   130 	QString valQt = QString::fromUtf16((valSymbian.Ptr()),valSymbian.Length());
       
   131 	return valQt;
       
   132 	}
       
   133 /*
       
   134 
       
   135  * Method to set the PluginDetails to Repository
       
   136  * Param - @aPluginStatus,holds the Plgugin Status.
       
   137  */
       
   138 void CSettingsRepository::SetPluginDetails(TDesC& aPluginName,TDesC& aPluginStatus)
       
   139 	{
       
   140 		User::LeaveIfError(iRepository->Set(KSettingsUIPluginNameKey,aPluginName));
       
   141 		User::LeaveIfError(iRepository->Set(KSettingsUIPluginStausKey,aPluginStatus));
       
   142 	}
       
   143 /*
       
   144  * Method to set the Auth Expiry Value to Repository
       
   145  * Param - @aVal,Auth Expiry Value
       
   146  */
       
   147 void CSettingsRepository::SetAuthExpirationValue(TDesC& aVal)
       
   148 	{
       
   149 		User::LeaveIfError(iRepository->Set(KSettingsUIAuthExpLimitKey,aVal));
       
   150 	}
       
   151 /*
       
   152  * Method to set the Max. Data Transfer Limit to Repository
       
   153  * Param - @aVal,Max. Data Transfer Limit Value
       
   154  */
       
   155 void CSettingsRepository::SetMaxDataTransferLimit(TDesC& aVal)
       
   156 	{
       
   157 		User::LeaveIfError(iRepository->Set(KSettingsUIMaxDataTransferLimitKey,aVal));
       
   158 	}
       
   159 /*
       
   160  * Method to set the Roaming Status for Data Transfer to Repository
       
   161  * Param - @aStatus,Rpaming Status value for Data Transfer
       
   162  */
       
   163 void CSettingsRepository::SetRoamingStatusforDataTransfer(TDesC& aStatus)
       
   164 	{
       
   165 		User::LeaveIfError(iRepository->Set(KSettingsUIRoamingStatusKey,aStatus));
       
   166 	}
       
   167 /*
       
   168  * Method to set the Upload File Type to Repository
       
   169  * Param - @aStatus,Upload File Type Value
       
   170  */
       
   171 void CSettingsRepository::SetUploadFileType(TDesC& aFileType)
       
   172 	{
       
   173 		User::LeaveIfError(iRepository->Set(KSettingsUIUploadFileTypeKey,aFileType));
       
   174 	}
       
   175 /*
       
   176  * Method to Get the PluginDetails from Repository
       
   177  */
       
   178 void CSettingsRepository::GetPluginDetailsInternal(TDes& aName , TDes& aDetails) const
       
   179 	{
       
   180 
       
   181 		User::LeaveIfError(iRepository->Get(KSettingsUIPluginNameKey,aName));
       
   182 		
       
   183 		User::LeaveIfError(iRepository->Get(KSettingsUIPluginStausKey,aDetails));
       
   184 	}
       
   185 /*
       
   186  * Method to Get the Auth Expiry Value from Repository
       
   187  */
       
   188 void CSettingsRepository::GetAuthExpirationValueInternal(TDes& aExp) const
       
   189 	{
       
   190 		
       
   191 		User::LeaveIfError(iRepository->Get(KSettingsUIAuthExpLimitKey,aExp));
       
   192 		
       
   193 	}
       
   194 /*
       
   195  * Method to Get the Max. Data Transfer Limit from Repository
       
   196  */
       
   197 void CSettingsRepository::GetMaxDataTransferLimitInternal(TDes& aMax) const
       
   198 	{
       
   199 		TBuf<125> Value;
       
   200 		User::LeaveIfError(iRepository->Get(KSettingsUIMaxDataTransferLimitKey,aMax));
       
   201 		
       
   202 	}
       
   203 /*
       
   204  * Method to Get the Roaming Status for Data Transfer from Repository
       
   205  */
       
   206 void CSettingsRepository::GetRoamingStatusforDataTransferInternal(TDes& aRoam) const
       
   207 	{
       
   208 		User::LeaveIfError(iRepository->Get(KSettingsUIRoamingStatusKey,aRoam));
       
   209 
       
   210 	}
       
   211 /*
       
   212  * Method to Get the Upload File Type from Repository
       
   213  */
       
   214 void CSettingsRepository::GetUploadFileTypeInternal(TDes& aFtype) const
       
   215 	{
       
   216 		User::LeaveIfError(iRepository->Get(KSettingsUIUploadFileTypeKey,aFtype));
       
   217 	}
       
   218 
       
   219