*/
#include <contacts.h>
#include <unique_ptr.h>
+#include <FApp.h>
#include <FBaseColIListT.h>
#include <FBaseColArrayListT.h>
#include <FBaseResult.h>
#include <FBaseLongLong.h>
#include <FBaseInteger.h>
+#include <FIoFile.h>
#include <FSclContact.h>
#include <FSclCategory.h>
#include <FSclUserProfile.h>
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
using namespace Tizen::Graphics;
+using namespace Tizen::Io;
namespace Tizen { namespace Social
{
int imageId = -1;
int imageId2 = -1;
- for (int i = count2 - 1; i >= 0; i--)
+ for (unsigned int i = count2 - 1; i >= 0; i--)
{
contacts_record_get_child_record_at_p(recordHandle, _contacts_contact.image, i, &imageHandle);
contacts_record_get_int(imageHandle, _contacts_image.id, &imageId);
contacts_record_h copyRecordHandle = CopyContactRecordHandle(recordHandle);
SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ contacts_record_h tempHandle = null;
+ contacts_record_get_child_record_count(copyRecordHandle, _contacts_contact.image, &count);
+
+ char* pCharValue = null;
+ String tempPath;
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ contacts_record_get_child_record_at_p(copyRecordHandle, _contacts_contact.image, i, &tempHandle);
+ contacts_record_get_str(tempHandle, _contacts_image.path, &pCharValue);
+
+ tempPath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/temp";
+ tempPath.Append((int)i);
+ tempPath.Append(L".jpg");
+ String servicePath(pCharValue);
+
+ File::Copy(servicePath, tempPath, true);
+
+ std::unique_ptr<char[]> pCharArray( _StringConverter::CopyToCharArrayN(tempPath));
+ SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(tempHandle, _contacts_image.path, pCharArray.get());
+ contacts_record_get_str(tempHandle, _contacts_image.path, &pCharValue);
+
+ tempPath.Clear();
+ }
+
ret = contacts_db_replace_record(copyRecordHandle, contactId);
contacts_record_destroy(copyRecordHandle, true);
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ tempPath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/temp";
+ tempPath.Append((int)i);
+ tempPath.Append(L".jpg");
+
+ File::Remove(tempPath);
+
+ tempPath.Clear();
+ }
}
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));
*/
#include <contacts.h>
#include <unique_ptr.h>
+#include <FApp.h>
#include <FBaseColIListT.h>
#include <FBaseColArrayListT.h>
#include <FBaseColHashMapT.h>
contacts_record_h copyRecordHandle = CopyContactRecordHandle(recordHandle);
SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ contacts_record_h tempHandle = null;
+ contacts_record_get_child_record_count(copyRecordHandle, _contacts_contact.image, &count);
+
+ char* pCharValue = null;
+ String tempPath;
+
+ for (int i = 0; i < count; i++)
+ {
+ contacts_record_get_child_record_at_p(copyRecordHandle, _contacts_contact.image, i, &tempHandle);
+ contacts_record_get_str(tempHandle, _contacts_image.path, &pCharValue);
+
+ tempPath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/temp";
+ tempPath.Append(i);
+ tempPath.Append(L".jpg");
+ String servicePath(pCharValue);
+
+ File::Copy(servicePath, tempPath, true);
+
+ std::unique_ptr<char[]> pCharArray( _StringConverter::CopyToCharArrayN(tempPath));
+ SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(tempHandle, _contacts_image.path, pCharArray.get());
+ contacts_record_get_str(tempHandle, _contacts_image.path, &pCharValue);
+
+ tempPath.Clear();
+ }
+
ret = contacts_db_replace_record(copyRecordHandle, contactId);
contacts_record_destroy(copyRecordHandle, true);
+
+ for (int i = 0; i < count; i++)
+ {
+ tempPath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/temp";
+ tempPath.Append(i);
+ tempPath.Append(L".jpg");
+
+ File::Remove(tempPath);
+
+ tempPath.Clear();
+ }
}
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));