contacts_record_get_int(recordHandle, _contacts_group.id, &intValue);
SysTryReturn(NID_SCL, intValue == categoryId, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- bool isReadOnly = false;
- contacts_record_get_bool(recordHandle, _contacts_group.is_read_only, &isReadOnly);
- SysTryReturn(NID_SCL, !isReadOnly, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified category is a default category.", GetErrorMessage(E_INVALID_ARG));
+ char* pCharValue = null;
+ contacts_record_get_str_p(recordHandle, _contacts_group.extra_data, &pCharValue);
+ SysTryReturn(NID_SCL, pCharValue == null, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified category is a default category.", GetErrorMessage(E_INVALID_ARG));
ret = contacts_db_delete_record(_contacts_group._uri, categoryId);
SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
contacts_record_get_int(recordHandle, _contacts_group.id, &intValue);
SysTryReturn(NID_SCL, intValue == categoryId, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- bool isReadOnly = false;
- contacts_record_get_bool(recordHandle, _contacts_group.is_read_only, &isReadOnly);
- SysTryReturn(NID_SCL, !isReadOnly, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified category is a default category.", GetErrorMessage(E_INVALID_ARG));
+ char* pCharValue = null;
+ contacts_record_get_str_p(recordHandle, _contacts_group.extra_data, &pCharValue);
+ SysTryReturn(NID_SCL, pCharValue == null, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified category is a default category.", GetErrorMessage(E_INVALID_ARG));
ret = contacts_db_delete_record(_contacts_group._uri, categoryId);
SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
bool
_CategoryImpl::IsDefault(void) const
{
- bool isDefault = false;
+ char* pCharValue = null;
- contacts_record_get_bool(__recordHandle, _contacts_group.is_read_only, &isDefault);
+ contacts_record_get_str_p(__recordHandle, _contacts_group.extra_data, &pCharValue);
+ if (pCharValue != null)
+ {
+ return true;
+ }
- return isDefault;
+ return false;
}
void
result
_CategoryImpl::SetName(const String& name)
{
- bool isDefault = false;
- contacts_record_get_bool(__recordHandle, _contacts_group.is_read_only, &isDefault);
-
if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
{
- SysTryReturn(NID_SCL, !isDefault, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. This category is a default category.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, !IsDefault(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. This category is a default category.", GetErrorMessage(E_INVALID_ARG));
SysTryReturn(NID_SCL, name.GetLength() <= 100, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified name exceeds the max length.", GetErrorMessage(E_INVALID_ARG));
}
else
{
- SysTryReturn(NID_SCL, !isDefault, E_INVALID_OPERATION, E_INVALID_OPERATION, "[%s] This category is a default category.", GetErrorMessage(E_INVALID_OPERATION));
+ SysTryReturn(NID_SCL, !IsDefault(), E_INVALID_OPERATION, E_INVALID_OPERATION, "[%s] This category is a default category.", GetErrorMessage(E_INVALID_OPERATION));
}
SysTryReturn(NID_SCL, !name.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified file path is an empty string", GetErrorMessage(E_INVALID_ARG));