fix TC failure
authorGwangbok Kim <gwangbok.kim@samsung.com>
Mon, 1 Jul 2013 06:12:52 +0000 (15:12 +0900)
committerGwangbok Kim <gwangbok.kim@samsung.com>
Mon, 1 Jul 2013 07:51:14 +0000 (16:51 +0900)
Change-Id: Ia5cdae93bda1edcc2db4e8c210d3b7e905f43c0f
Signed-off-by: Gwangbok Kim <gwangbok.kim@samsung.com>
CMakeLists.txt
src/FSclReminder.cpp
src/FScl_ContactImpl.cpp

index 1277bb8..a8593f6 100755 (executable)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
        /usr/include/osp/app
        /usr/include/osp/base
        /usr/include/osp/media
+       /usr/include/osp/io
        /usr/include/osp/security
        /usr/include/calendar-service2
        )
index a036398..f10d60c 100644 (file)
@@ -25,6 +25,7 @@
 #include <FIoFile.h>
 #include <FSclReminder.h>
 #include <FApp_AppInfo.h>
+#include <FIo_FileImpl.h>
 #include "FScl_ReminderImpl.h"
 
 using namespace Tizen::Base;
@@ -155,13 +156,23 @@ Reminder::SetMinutesBefore(int minutes)
 result
 Reminder::SetSoundFile(const String& filePath)
 {
-       if (!filePath.IsEmpty())
+       String tmpFilePath;
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
        {
-               SysTryReturnResult(NID_SCL, File::IsFileExist(filePath), E_INVALID_ARG
+               _FileImpl::ConvertVirtualToPhysicalPath(filePath, tmpFilePath);
+       }
+       else
+       {
+               tmpFilePath = filePath;
+       }
+
+       if (!tmpFilePath.IsEmpty())
+       {
+               SysTryReturnResult(NID_SCL, File::IsFileExist(tmpFilePath), E_INVALID_ARG
                                , "Invalid argument is used. The length of the filePath exceeds the maximum length or the file path is invalid or the file does not exist.");
        }
 
-       __soundFilePath = filePath;
+       __soundFilePath = tmpFilePath;
 
        return E_SUCCESS;
 }
index f67d06c..42b9003 100644 (file)
@@ -36,6 +36,7 @@
 #include <FSclContact.h>
 #include <FApp_AppInfo.h>
 #include <FBase_StringConverter.h>
+#include <FIo_FileImpl.h>
 #include "FScl_ContactDbConnector.h"
 #include "FScl_PhoneNumberImpl.h"
 #include "FScl_ContactImpl.h"
@@ -172,6 +173,16 @@ _ContactImpl::SetThumbnailPath(const Tizen::Base::String& filePath)
 {
        SysTryReturn(NID_SCL, filePath.IsEmpty() || File::IsFileExist(filePath), E_FILE_NOT_FOUND, E_FILE_NOT_FOUND, "[%s] The specified file is not found.", GetErrorMessage(E_FILE_NOT_FOUND));
 
+       String thumbnailPath;
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               _FileImpl::ConvertVirtualToPhysicalPath(filePath, thumbnailPath);
+       }
+       else
+       {
+               thumbnailPath = filePath;
+       }
+
        int ret = CONTACTS_ERROR_NONE;
        unsigned int count = 0;
        contacts_record_h imageHandle = null;
@@ -179,9 +190,9 @@ _ContactImpl::SetThumbnailPath(const Tizen::Base::String& filePath)
        contacts_record_get_child_record_count(__contactHandle, _contacts_contact.image, &count);
        if (count > 0)
        {
-               if (!filePath.IsEmpty())
+               if (!thumbnailPath.IsEmpty())
                {
-                       std::unique_ptr<char[]> pCharArray( _StringConverter::CopyToCharArrayN(filePath));
+                       std::unique_ptr<char[]> pCharArray( _StringConverter::CopyToCharArrayN(thumbnailPath));
                        SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                        bool isDefault = false;
@@ -216,9 +227,9 @@ _ContactImpl::SetThumbnailPath(const Tizen::Base::String& filePath)
        }
        else
        {
-               if (!filePath.IsEmpty())
+               if (!thumbnailPath.IsEmpty())
                {
-                       std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(filePath));
+                       std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(thumbnailPath));
                        SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                        int ret = contacts_record_create(_contacts_image._uri, &imageHandle);
@@ -1126,13 +1137,23 @@ _ContactImpl::SetValue(ContactPropertyId id, const String& value)
 
        case CONTACT_PROPERTY_ID_RINGTONE:
        {
-               if (!value.IsEmpty() && !File::IsFileExist(value))
+               String ringtonePath;
+               if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+               {
+                       _FileImpl::ConvertVirtualToPhysicalPath(value, ringtonePath);
+               }
+               else
+               {
+                       ringtonePath = value;
+               }
+
+               if (!ringtonePath.IsEmpty() && !File::IsFileExist(ringtonePath))
                {
                        SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. The specified ringtone file does not exist.", GetErrorMessage(E_INVALID_ARG));
                        return E_INVALID_ARG;
                }
 
-               std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(value));
+               std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(ringtonePath));
 
                contacts_record_set_str(__contactHandle, _contacts_contact.ringtone_path, pCharArray.get());
        }