//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
* @file FSys_SettingInfoImpl.cpp
* @brief This is the implementation file for _SysSettingInfoImpl class.
*/
+#include <unique_ptr.h>
+#include <system/system_settings.h>
#include <FBaseColArrayList.h>
#include <FBaseSysLog.h>
+#include <FBaseUtilStringUtil.h>
+#include <FIoFile.h>
+#include <FApp_AppInfo.h>
+#include <FBase_StringConverter.h>
#include <FBase_NativeError.h>
#include <FSys_SettingInfoImpl.h>
+
#include "FSys_SettingClient.h"
+#include "FSys_SettingClientEx.h"
+
+using namespace std;
using namespace Tizen::App;
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
using namespace Tizen::Io;
+using namespace Tizen::Base::Utility;
namespace Tizen { namespace System
{
static const wchar_t* _SETTING_NOTIFICATION_SOUND_VOLUME = L"NotificationSoundVolume";
static const wchar_t* _SETTING_SOUND_NOTIFICATION_VOLUME = L"http://tizen.org/setting/sound.notification.volume";
+//Font
+static const wchar_t* _FONT_SIZE = L"http://tizen.org/setting/font.size";
+static const wchar_t* _FONTSIZE = L"FontSize";
+static const wchar_t* _FONT_TYPE = L"http://tizen.org/setting/font.type";
+static const wchar_t* _FONTTYPE = L"FontType";
+
+static const wchar_t* _FONT_SIZE_GIANT = L"giant";
+static const wchar_t* _FONT_SIZE_HUGE = L"huge";
+static const wchar_t* _FONT_SIZE_LARGE = L"large";
+static const wchar_t* _FONT_SIZE_MEDIUM = L"medium";
+static const wchar_t* _FONT_SIZE_SMALL = L"small";
+
+static const int _FONT_SIZE_GIANT_VCONF = 4;
+static const int _FONT_SIZE_HUGE_VCONF = 3;
+static const int _FONT_SIZE_LARGE_VCONF = 2;
+static const int _FONT_SIZE_MEDIUM_VCONF = 1;
+static const int _FONT_SIZE_SMALL_VCONF = 0;
+
+
static _SettingClient* pSettingClient = null;
+static _SettingClientEx* pSettingClientEx = null;
+static const wchar_t* _COMMON_SERVICE_ENABLED = L"/opt/usr/etc/setting_common";
+static bool common_mode = false;
void
_SettingInfoImpl::InitSettingClient(void)
{
- if(pSettingClient == null)
+ if(pSettingClient == null && pSettingClientEx == null)
{
- pSettingClient = _SettingClient::GetInstance();
+ if(File::IsFileExist(_COMMON_SERVICE_ENABLED) == false)
+ {
+ if(pSettingClient == null)
+ {
+ pSettingClient = _SettingClient::GetInstance();
+ }
+ }
+ else
+ {
+ common_mode = true;
+ if(pSettingClientEx == null)
+ {
+ pSettingClientEx = _SettingClientEx::GetInstance();
+ }
+ }
}
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, Tizen::Base::String& value)
{
- InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ result r = E_SUCCESS;
+
+ if (key == _FONT_SIZE || key == _FONT_TYPE || key == _FONTSIZE || key == _FONTTYPE)
+ {
+ String tizenKey(key);
+ if(tizenKey == _FONTSIZE)
+ {
+ tizenKey = _FONT_SIZE;
+ }
+ else if(tizenKey == _FONTTYPE)
+ {
+ tizenKey = _FONT_TYPE;
+ }
+
+ r = GetValueForFont(tizenKey, value);
+
+ if(key == _FONTSIZE)
+ {
+ if(_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat() == true)
+ {
+ if(value == _FONT_SIZE_GIANT || value == _FONT_SIZE_HUGE)
+ {
+ value = _FONT_SIZE_LARGE; //OSP not support giant or huge size of font.
+ }
+ }
+ }
+ }
+ else
+ {
+ InitSettingClient();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->GetValue(key, value);
+ }
+ }
+ return r;
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, int& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, long long& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, double& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, bool& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::SetWallpaper(const Tizen::Base::String& filePath)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- result r = pSettingClient->SetValue(_SETTING_SCREEN_WALLPAPER, filePath);
+ result r = E_SUCCESS;
+
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(_SETTING_SCREEN_WALLPAPER, filePath);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->SetValue(_SETTING_SCREEN_WALLPAPER, filePath);
+ }
if(r == E_INVALID_ARG)
r = E_FILE_NOT_FOUND;
_SettingInfoImpl::GetValueForPrivilegedKey(const String& key, bool& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValueForPrivilegedKey(key, value);
+
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValueForPrivilegedKey(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValueForPrivilegedKey(key, value);
+ }
}
result
_SettingInfoImpl::SetValue(const String& key, bool value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValue(key, value);
+ }
}
result
_SettingInfoImpl::SetValue(const String& key, int value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValue(key, value);
+ }
}
result
_SettingInfoImpl::SetValue(const String& key, String value)
{
- InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValue(key, value);
+ result r = E_SUCCESS;
+ if (key == _FONT_SIZE || key == _FONT_TYPE)
+ {
+ r = SetValueForFont(key, value);
+ }
+ else
+ {
+ InitSettingClient();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValue(key, value);
+ }
+ }
+ return r;
}
result
_SettingInfoImpl::SetValueForPrivilegedKey(const String& key, bool value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueForPrivilegedKey(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueForPrivilegedKey(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueForPrivilegedKey(key, value);
+ }
}
result
_SettingInfoImpl::SetValueForPrivilegedKey(const String& key, String value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueForPrivilegedKey(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueForPrivilegedKey(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueForPrivilegedKey(key, value);
+ }
}
bool
_SettingInfoImpl::HasKey(const String& key)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->HasKey(key);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->HasKey(key);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->HasKey(key);
+ }
}
result
_SettingInfoImpl::ResetToFactoryDefault(void)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->ResetToFactoryDefault();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->ResetToFactoryDefault();
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->ResetToFactoryDefault();
+ }
}
result
_SettingInfoImpl::SetRingtone(const Tizen::Base::String& filePath)
{
+ result r = E_SUCCESS;
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- result r = pSettingClient->SetValue(_SETTING_SOUND_RINGTONE, filePath);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(_SETTING_SOUND_RINGTONE, filePath);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->SetValue(_SETTING_SOUND_RINGTONE, filePath);
+ }
if(r == E_INVALID_ARG)
r = E_FILE_NOT_FOUND;
result r = E_SUCCESS;
String key;
- InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
-
if (soundCategory == _SETTING_SYSTEM_SOUND_VOLUME)
{
key = _SETTING_SOUND_SYSTEM_VOLUME;
key = soundCategory;
}
- r = pSettingClient->SetValue(key, level);
+ InitSettingClient();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(key, level);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->SetValue(key, level);
+ }
if (r == E_OBJ_NOT_FOUND)
{
_SettingInfoImpl::AddSettingEventListener(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->AddSettingEventListener(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->AddSettingEventListener(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->AddSettingEventListener(listener);
+ }
}
result
_SettingInfoImpl::RemoveSettingEventListener(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->RemoveSettingEventListener(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->RemoveSettingEventListener(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->RemoveSettingEventListener(listener);
+ }
}
result
_SettingInfoImpl::AddSettingEventListenerForInternal(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->AddSettingEventListenerForInternal(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->AddSettingEventListenerForInternal(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->AddSettingEventListenerForInternal(listener);
+ }
}
result
_SettingInfoImpl::RemoveSettingEventListenerForInternal(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->RemoveSettingEventListenerForInternal(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->RemoveSettingEventListenerForInternal(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->RemoveSettingEventListenerForInternal(listener);
+ }
}
result
_SettingInfoImpl::SetSettingEventListener(ISettingEventListener* pListener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetSettingEventListener(pListener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetSettingEventListener(pListener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetSettingEventListener(pListener);
+ }
+}
+
+result
+_SettingInfoImpl::SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
+{
+ InitSettingClient();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueAsync(key, value, listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueAsync(key, value, listener);
+ }
}
result
_SettingInfoImpl::SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueAsyncForPrivilegedKey(key, value, listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueAsyncForPrivilegedKey(key, value, listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueAsyncForPrivilegedKey(key, value, listener);
+ }
}
_SettingInfoImpl*
return settinginfo.__pSettingInfoImpl;
}
+result
+_SettingInfoImpl::GetValueForFont(const Tizen::Base::String& key, Tizen::Base::String& value)
+{
+ result r = E_OBJ_NOT_FOUND;
+
+ if (key == _FONT_SIZE)
+ {
+ int fontSize = 0;
+ int res = 0;
+ res = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &fontSize);
+
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to get font size.");
+
+ r = E_SUCCESS;
+ switch (fontSize)
+ {
+ case _FONT_SIZE_GIANT_VCONF:
+ value.Append(_FONT_SIZE_GIANT);
+ break;
+ case _FONT_SIZE_HUGE_VCONF:
+ value.Append(_FONT_SIZE_HUGE);
+ break;
+ case _FONT_SIZE_LARGE_VCONF:
+ value.Append(_FONT_SIZE_LARGE);
+ break;
+ case _FONT_SIZE_MEDIUM_VCONF:
+ value.Append(_FONT_SIZE_MEDIUM);
+ break;
+ case _FONT_SIZE_SMALL_VCONF:
+ value.Append(_FONT_SIZE_SMALL);
+ break;
+ default:
+ r = E_SYSTEM;
+ break;
+ }
+
+ }
+ else if (key == _FONT_TYPE)
+ {
+ r = E_SUCCESS;
+ char* pFontType = null;
+ int res = 0;
+ res = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &pFontType);
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "Failed to get font type");
+ r = StringUtil::Utf8ToString(pFontType, value);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
+ free(pFontType);
+ }
+ return r;
+}
+
+
+result
+_SettingInfoImpl::SetValueForFont(const Tizen::Base::String& key, Tizen::Base::String value)
+{
+ result r = E_OBJ_NOT_FOUND;
+
+ if(key == _FONT_SIZE)
+ {
+ int fontSize = 0;
+ int res = 0;
+ String lowerValue = value;
+ lowerValue.ToLowerCase();
+ r = E_SUCCESS;
+
+ if (lowerValue == _FONT_SIZE_GIANT)
+ {
+ fontSize = _FONT_SIZE_GIANT_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_HUGE)
+ {
+ fontSize = _FONT_SIZE_HUGE_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_LARGE)
+ {
+ fontSize = _FONT_SIZE_LARGE_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_MEDIUM)
+ {
+ fontSize = _FONT_SIZE_MEDIUM_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_SMALL)
+ {
+ fontSize = _FONT_SIZE_SMALL_VCONF;
+ }
+ else
+ {
+ return E_INVALID_ARG;
+ }
+ res = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, fontSize);
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to set font size.");
+ }
+ else if(key == _FONT_TYPE)
+ {
+ int res = 0;
+ r = E_SUCCESS;
+
+ unique_ptr<char[]> pFontType(_StringConverter::CopyToCharArrayN(value));
+ SysTryReturnResult(NID_SYS, pFontType.get() != null, E_SYSTEM, "It is failed to convert String to string.");
+ SysLog(NID_SYS, "Requested font type is %s.", pFontType.get());
+ res = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, pFontType.get());
+ SysTryReturnResult(NID_SYS, res != SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, E_INVALID_ARG, "It is not valid font type.");
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to set font type.");
+ }
+ return r;
+}
+
+
} } // Tizen::System