summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-11-05 13:09:28 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-11-05 13:09:28 -0200
commit6726a527fbcb9436e311c47ed92beb2c775bc07d (patch)
tree1b96a380b7b7996158142f3db29b9b0067ac9237
parent2339c34a8b737e2ef56e955ff61fa47ebff29835 (diff)
ecordova: Fixed contacts dlsym
-rw-r--r--configure.ac1
-rw-r--r--src/modules/ecordova/tizen/ecordova_contact.c136
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactaddress.c2
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactfield_private.h21
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactname.c32
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactorganization.c26
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts.c114
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts_service.c97
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts_service.h22
-rw-r--r--src/tests/ecordova/ecordova_contacts_test.c99
-rw-r--r--src/tests/ecordova/ecordova_mediafile_test.c8
11 files changed, 271 insertions, 287 deletions
diff --git a/configure.ac b/configure.ac
index f278a36f8b..2d291f8ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4599,6 +4599,7 @@ EFL_INTERNAL_DEPEND_PKG([ECORDOVA], [eo])
4599EFL_INTERNAL_DEPEND_PKG([ECORDOVA], [efl]) 4599EFL_INTERNAL_DEPEND_PKG([ECORDOVA], [efl])
4600EFL_INTERNAL_DEPEND_PKG([ECORDOVA], [ecore]) 4600EFL_INTERNAL_DEPEND_PKG([ECORDOVA], [ecore])
4601 4601
4602EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_CONTACTS_SERVICE], [contacts-service2])
4602EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_INFO], [capi-system-info]) 4603EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_INFO], [capi-system-info])
4603EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_SENSOR], [capi-system-sensor]) 4604EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_SENSOR], [capi-system-sensor])
4604EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_LOCATION_MANAGER], [capi-location-manager]) 4605EFL_OPTIONAL_DEPEND_PKG([ECORDOVA], [${want_tizen}], [TIZEN_LOCATION_MANAGER], [capi-location-manager])
diff --git a/src/modules/ecordova/tizen/ecordova_contact.c b/src/modules/ecordova/tizen/ecordova_contact.c
index 14b7441fa1..be35396f00 100644
--- a/src/modules/ecordova/tizen/ecordova_contact.c
+++ b/src/modules/ecordova/tizen/ecordova_contact.c
@@ -41,7 +41,7 @@ _ecordova_contact_eo_base_constructor(Eo *obj, Ecordova_Contact_Data *pd)
41 41
42 pd->obj = obj; 42 pd->obj = obj;
43 pd->record = NULL; 43 pd->record = NULL;
44 int ret = contacts_record_create(_contacts_contact._uri, &pd->record); 44 int ret = contacts_record_create((*_contacts_contact)._uri, &pd->record);
45 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 45 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
46 pd->name = eo_add(ECORDOVA_CONTACTNAME_CLASS, NULL); 46 pd->name = eo_add(ECORDOVA_CONTACTNAME_CLASS, NULL);
47 pd->phone_numbers = eina_array_new(1); 47 pd->phone_numbers = eina_array_new(1);
@@ -86,7 +86,7 @@ _ecordova_contact_remove(Eo *obj, Ecordova_Contact_Data *pd)
86 goto on_error; 86 goto on_error;
87 } 87 }
88 88
89 int ret = contacts_db_delete_record(_contacts_contact._uri, pd->id); 89 int ret = contacts_db_delete_record((*_contacts_contact)._uri, pd->id);
90 if (CONTACTS_ERROR_NONE != ret) 90 if (CONTACTS_ERROR_NONE != ret)
91 { 91 {
92 ERR("Error deleting record id: %d", pd->id); 92 ERR("Error deleting record id: %d", pd->id);
@@ -165,7 +165,7 @@ _ecordova_contact_save(Eo *obj, Ecordova_Contact_Data *pd)
165 165
166 // must get the inserted record so we can properly update it further 166 // must get the inserted record so we can properly update it further
167 contacts_record_h contacts_record = NULL; 167 contacts_record_h contacts_record = NULL;
168 ret = contacts_db_get_record(_contacts_contact._uri, pd->id, &contacts_record); 168 ret = contacts_db_get_record((*_contacts_contact)._uri, pd->id, &contacts_record);
169 if (CONTACTS_ERROR_NONE != ret) 169 if (CONTACTS_ERROR_NONE != ret)
170 { 170 {
171 ERR("Error getting record: %d", ret); 171 ERR("Error getting record: %d", ret);
@@ -202,7 +202,7 @@ _ecordova_contact_display_name_get(Eo *obj EINA_UNUSED,
202 Ecordova_Contact_Data *pd) 202 Ecordova_Contact_Data *pd)
203{ 203{
204 const char *value = NULL; 204 const char *value = NULL;
205 get_str_p(pd->record, _contacts_contact.display_name, &value); 205 get_str_p(pd->record, (*_contacts_contact).display_name, &value);
206 return value; 206 return value;
207} 207}
208 208
@@ -211,7 +211,7 @@ _ecordova_contact_display_name_set(Eo *obj EINA_UNUSED,
211 Ecordova_Contact_Data *pd, 211 Ecordova_Contact_Data *pd,
212 const char *value) 212 const char *value)
213{ 213{
214 set_str(pd->record, _contacts_contact.display_name, value); 214 set_str(pd->record, (*_contacts_contact).display_name, value);
215} 215}
216 216
217static Ecordova_ContactName * 217static Ecordova_ContactName *
@@ -235,7 +235,7 @@ _ecordova_contact_nickname_get(Eo *obj EINA_UNUSED, Ecordova_Contact_Data *pd)
235 int ret; 235 int ret;
236 int count = 0; 236 int count = 0;
237 ret = contacts_record_get_child_record_count(pd->record, 237 ret = contacts_record_get_child_record_count(pd->record,
238 _contacts_contact.nickname, 238 (*_contacts_contact).nickname,
239 &count); 239 &count);
240 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 240 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
241 241
@@ -243,13 +243,13 @@ _ecordova_contact_nickname_get(Eo *obj EINA_UNUSED, Ecordova_Contact_Data *pd)
243 243
244 contacts_record_h child_record = NULL; 244 contacts_record_h child_record = NULL;
245 ret = contacts_record_get_child_record_at_p(pd->record, 245 ret = contacts_record_get_child_record_at_p(pd->record,
246 _contacts_contact.nickname, 246 (*_contacts_contact).nickname,
247 0, 247 0,
248 &child_record); 248 &child_record);
249 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 249 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
250 250
251 const char *value = NULL; 251 const char *value = NULL;
252 get_str_p(child_record, _contacts_nickname.name, &value); 252 get_str_p(child_record, (*_contacts_nickname).name, &value);
253 return value; 253 return value;
254} 254}
255 255
@@ -260,17 +260,17 @@ _ecordova_contact_nickname_set(Eo *obj EINA_UNUSED,
260{ 260{
261 int ret; 261 int ret;
262 contacts_record_h child_record = NULL; 262 contacts_record_h child_record = NULL;
263 ret = contacts_record_create(_contacts_nickname._uri, &child_record); 263 ret = contacts_record_create((*_contacts_nickname)._uri, &child_record);
264 EINA_SAFETY_ON_FALSE_RETURN(CONTACTS_ERROR_NONE == ret); 264 EINA_SAFETY_ON_FALSE_RETURN(CONTACTS_ERROR_NONE == ret);
265 265
266 if (!set_str(child_record, _contacts_nickname.name, value)) 266 if (!set_str(child_record, (*_contacts_nickname).name, value))
267 goto on_error; 267 goto on_error;
268 268
269 if (!clear_all_contact_record(pd->record, _contacts_contact.nickname)) 269 if (!clear_all_contact_record(pd->record, (*_contacts_contact).nickname))
270 goto on_error; 270 goto on_error;
271 271
272 ret = contacts_record_add_child_record(pd->record, 272 ret = contacts_record_add_child_record(pd->record,
273 _contacts_contact.nickname, 273 (*_contacts_contact).nickname,
274 child_record); 274 child_record);
275 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error); 275 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error);
276 return; 276 return;
@@ -379,7 +379,7 @@ _ecordova_contact_note_get(Eo *obj EINA_UNUSED, Ecordova_Contact_Data *pd)
379 int ret; 379 int ret;
380 int count = 0; 380 int count = 0;
381 ret = contacts_record_get_child_record_count(pd->record, 381 ret = contacts_record_get_child_record_count(pd->record,
382 _contacts_contact.note, 382 (*_contacts_contact).note,
383 &count); 383 &count);
384 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 384 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
385 385
@@ -388,13 +388,13 @@ _ecordova_contact_note_get(Eo *obj EINA_UNUSED, Ecordova_Contact_Data *pd)
388 388
389 contacts_record_h child_record = NULL; 389 contacts_record_h child_record = NULL;
390 ret = contacts_record_get_child_record_at_p(pd->record, 390 ret = contacts_record_get_child_record_at_p(pd->record,
391 _contacts_contact.note, 391 (*_contacts_contact).note,
392 0, 392 0,
393 &child_record); 393 &child_record);
394 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 394 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
395 395
396 const char *value = NULL; 396 const char *value = NULL;
397 get_str_p(child_record, _contacts_note.note, &value); 397 get_str_p(child_record, (*_contacts_note).note, &value);
398 return value; 398 return value;
399} 399}
400 400
@@ -405,17 +405,17 @@ _ecordova_contact_note_set(Eo *obj EINA_UNUSED,
405{ 405{
406 int ret; 406 int ret;
407 contacts_record_h child_record = NULL; 407 contacts_record_h child_record = NULL;
408 ret = contacts_record_create(_contacts_note._uri, &child_record); 408 ret = contacts_record_create((*_contacts_note)._uri, &child_record);
409 EINA_SAFETY_ON_FALSE_RETURN(CONTACTS_ERROR_NONE == ret); 409 EINA_SAFETY_ON_FALSE_RETURN(CONTACTS_ERROR_NONE == ret);
410 410
411 if (!set_str(child_record, _contacts_note.note, value)) 411 if (!set_str(child_record, (*_contacts_note).note, value))
412 goto on_error; 412 goto on_error;
413 413
414 if (!clear_all_contact_record(pd->record, _contacts_contact.note)) 414 if (!clear_all_contact_record(pd->record, (*_contacts_contact).note))
415 goto on_error; 415 goto on_error;
416 416
417 ret = contacts_record_add_child_record(pd->record, 417 ret = contacts_record_add_child_record(pd->record,
418 _contacts_contact.note, 418 (*_contacts_contact).note,
419 child_record); 419 child_record);
420 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error); 420 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error);
421 return; 421 return;
@@ -706,75 +706,11 @@ _contactorganization_array_clear_id(Eina_Array *organizations)
706 } 706 }
707} 707}
708 708
709static const Ecordova_ContactField_Metadata 709extern Ecordova_ContactField_Metadata _contact_number_metadata;
710_contact_number_metadata = { 710extern Ecordova_ContactField_Metadata _contact_email_metadata;
711 .uri = &_contacts_number._uri, 711extern Ecordova_ContactField_Metadata _contact_messenger_metadata;
712 .ids = { 712extern Ecordova_ContactField_Metadata _contact_image_metadata;
713 [ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &_contacts_contact.number, 713extern Ecordova_ContactField_Metadata _contact_url_metadata;
714 [ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &_contacts_number.id,
715 [ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &_contacts_number.type,
716 [ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &_contacts_number.label,
717 [ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &_contacts_number.number,
718 [ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = &_contacts_number.is_default},
719 .type2label = ecordova_contactnumber_type2label,
720 .label2type = ecordova_contactnumber_label2type
721};
722
723static const Ecordova_ContactField_Metadata
724_contact_email_metadata = {
725 .uri = &_contacts_email._uri,
726 .ids = {
727 [ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &_contacts_contact.email,
728 [ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &_contacts_email.id,
729 [ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &_contacts_email.type,
730 [ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &_contacts_email.label,
731 [ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &_contacts_email.email,
732 [ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = &_contacts_email.is_default},
733 .type2label = ecordova_contactemail_type2label,
734 .label2type = ecordova_contactemail_label2type
735};
736
737static const Ecordova_ContactField_Metadata
738_contact_messenger_metadata = {
739 .uri = &_contacts_messenger._uri,
740 .ids = {
741 [ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &_contacts_contact.messenger,
742 [ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &_contacts_messenger.id,
743 [ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &_contacts_messenger.type,
744 [ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &_contacts_messenger.label,
745 [ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &_contacts_messenger.im_id,
746 [ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = NULL},
747 .type2label = ecordova_contactmessenger_type2label,
748 .label2type = ecordova_contactmessenger_label2type
749};
750
751static const Ecordova_ContactField_Metadata
752_contact_image_metadata = {
753 .uri = &_contacts_image._uri,
754 .ids = {
755 [ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &_contacts_contact.image,
756 [ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &_contacts_image.id,
757 [ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &_contacts_image.type,
758 [ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &_contacts_image.label,
759 [ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &_contacts_image.path,
760 [ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = &_contacts_image.is_default},
761 .type2label = ecordova_contactimage_type2label,
762 .label2type = ecordova_contactimage_label2type
763};
764
765static const Ecordova_ContactField_Metadata
766_contact_url_metadata = {
767 .uri = &_contacts_url._uri,
768 .ids = {
769 [ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &_contacts_contact.url,
770 [ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &_contacts_url.id,
771 [ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &_contacts_url.type,
772 [ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &_contacts_url.label,
773 [ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &_contacts_url.url,
774 [ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = NULL},
775 .type2label = ecordova_contacturl_type2label,
776 .label2type = ecordova_contacturl_label2type
777};
778 714
779Eina_Bool 715Eina_Bool
780ecordova_contact_import(Ecordova_Contact *obj, 716ecordova_contact_import(Ecordova_Contact *obj,
@@ -793,7 +729,7 @@ ecordova_contact_import(Ecordova_Contact *obj,
793 ret = contacts_record_clone(contacts_record, &pd->record); 729 ret = contacts_record_clone(contacts_record, &pd->record);
794 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 730 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
795 731
796 ret = contacts_record_get_int(pd->record, _contacts_contact.id, &pd->id); 732 ret = contacts_record_get_int(pd->record, (*_contacts_contact).id, &pd->id);
797 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 733 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
798 734
799 // name 735 // name
@@ -862,7 +798,7 @@ ecordova_contact_export(Ecordova_Contact *obj,
862 EINA_SAFETY_ON_NULL_RETURN_VAL(pd, EINA_FALSE); 798 EINA_SAFETY_ON_NULL_RETURN_VAL(pd, EINA_FALSE);
863 799
864 // name 800 // name
865 if (!clear_all_contact_record(contacts_record, _contacts_contact.name) || 801 if (!clear_all_contact_record(contacts_record, (*_contacts_contact).name) ||
866 !ecordova_contactname_export(pd->name, contacts_record)) 802 !ecordova_contactname_export(pd->name, contacts_record))
867 return EINA_FALSE; 803 return EINA_FALSE;
868 804
@@ -986,7 +922,7 @@ _ecordova_contactaddresses_import(Eina_Array *fields,
986 int ret; 922 int ret;
987 int count = 0; 923 int count = 0;
988 ret = contacts_record_get_child_record_count(contacts_record, 924 ret = contacts_record_get_child_record_count(contacts_record,
989 _contacts_contact.address, 925 (*_contacts_contact).address,
990 &count); 926 &count);
991 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 927 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
992 928
@@ -995,7 +931,7 @@ _ecordova_contactaddresses_import(Eina_Array *fields,
995 { 931 {
996 contacts_record_h child_record = NULL; 932 contacts_record_h child_record = NULL;
997 ret = contacts_record_get_child_record_at_p(contacts_record, 933 ret = contacts_record_get_child_record_at_p(contacts_record,
998 _contacts_contact.address, 934 (*_contacts_contact).address,
999 index, 935 index,
1000 &child_record); 936 &child_record);
1001 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 937 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
@@ -1018,7 +954,7 @@ static Eina_Bool
1018_ecordova_contactaddresses_export(Eina_Array *addresses, 954_ecordova_contactaddresses_export(Eina_Array *addresses,
1019 contacts_record_h contacts_record) 955 contacts_record_h contacts_record)
1020{ 956{
1021 if (!clear_all_contact_record(contacts_record, _contacts_contact.address)) 957 if (!clear_all_contact_record(contacts_record, (*_contacts_contact).address))
1022 return EINA_FALSE; 958 return EINA_FALSE;
1023 959
1024 Ecordova_ContactAddress *address; 960 Ecordova_ContactAddress *address;
@@ -1027,7 +963,7 @@ _ecordova_contactaddresses_export(Eina_Array *addresses,
1027 EINA_ARRAY_ITER_NEXT(addresses, i, address, iterator) 963 EINA_ARRAY_ITER_NEXT(addresses, i, address, iterator)
1028 { 964 {
1029 contacts_record_h record = NULL; 965 contacts_record_h record = NULL;
1030 int ret = contacts_record_create(_contacts_address._uri, &record); 966 int ret = contacts_record_create((*_contacts_address)._uri, &record);
1031 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 967 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
1032 968
1033 if (!ecordova_contactaddress_export(address, record)) 969 if (!ecordova_contactaddress_export(address, record))
@@ -1038,7 +974,7 @@ _ecordova_contactaddresses_export(Eina_Array *addresses,
1038 } 974 }
1039 975
1040 ret = contacts_record_add_child_record(contacts_record, 976 ret = contacts_record_add_child_record(contacts_record,
1041 _contacts_contact.address, 977 (*_contacts_contact).address,
1042 record); 978 record);
1043 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 979 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
1044 } 980 }
@@ -1053,7 +989,7 @@ _ecordova_contactorganizations_import(Eina_Array *organizations,
1053 int ret; 989 int ret;
1054 int count = 0; 990 int count = 0;
1055 ret = contacts_record_get_child_record_count(contacts_record, 991 ret = contacts_record_get_child_record_count(contacts_record,
1056 _contacts_contact.company, 992 (*_contacts_contact).company,
1057 &count); 993 &count);
1058 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 994 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
1059 995
@@ -1062,7 +998,7 @@ _ecordova_contactorganizations_import(Eina_Array *organizations,
1062 { 998 {
1063 contacts_record_h child_record = NULL; 999 contacts_record_h child_record = NULL;
1064 ret = contacts_record_get_child_record_at_p(contacts_record, 1000 ret = contacts_record_get_child_record_at_p(contacts_record,
1065 _contacts_contact.company, 1001 (*_contacts_contact).company,
1066 index, 1002 index,
1067 &child_record); 1003 &child_record);
1068 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 1004 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
@@ -1085,7 +1021,7 @@ static Eina_Bool
1085_ecordova_contactorganizations_export(Eina_Array *organizations, 1021_ecordova_contactorganizations_export(Eina_Array *organizations,
1086 contacts_record_h contacts_record) 1022 contacts_record_h contacts_record)
1087{ 1023{
1088 if (!clear_all_contact_record(contacts_record, _contacts_contact.company)) 1024 if (!clear_all_contact_record(contacts_record, (*_contacts_contact).company))
1089 return EINA_FALSE; 1025 return EINA_FALSE;
1090 1026
1091 Ecordova_ContactOrganization *organization; 1027 Ecordova_ContactOrganization *organization;
@@ -1094,7 +1030,7 @@ _ecordova_contactorganizations_export(Eina_Array *organizations,
1094 EINA_ARRAY_ITER_NEXT(organizations, i, organization, iterator) 1030 EINA_ARRAY_ITER_NEXT(organizations, i, organization, iterator)
1095 { 1031 {
1096 contacts_record_h record = NULL; 1032 contacts_record_h record = NULL;
1097 int ret = contacts_record_create(_contacts_company._uri, &record); 1033 int ret = contacts_record_create((*_contacts_company)._uri, &record);
1098 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 1034 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
1099 1035
1100 if (!ecordova_contactaddress_export(organization, record)) 1036 if (!ecordova_contactaddress_export(organization, record))
@@ -1105,7 +1041,7 @@ _ecordova_contactorganizations_export(Eina_Array *organizations,
1105 } 1041 }
1106 1042
1107 ret = contacts_record_add_child_record(contacts_record, 1043 ret = contacts_record_add_child_record(contacts_record,
1108 _contacts_contact.company, 1044 (*_contacts_contact).company,
1109 record); 1045 record);
1110 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 1046 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
1111 } 1047 }
diff --git a/src/modules/ecordova/tizen/ecordova_contactaddress.c b/src/modules/ecordova/tizen/ecordova_contactaddress.c
index 78f3cdf30f..69ecce835e 100644
--- a/src/modules/ecordova/tizen/ecordova_contactaddress.c
+++ b/src/modules/ecordova/tizen/ecordova_contactaddress.c
@@ -259,7 +259,7 @@ ecordova_contactaddress_export(Ecordova_ContactAddress *obj,
259 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 259 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
260 260
261 ret = contacts_record_add_child_record(contacts_record, 261 ret = contacts_record_add_child_record(contacts_record,
262 _contacts_contact.address, 262 (*_contacts_contact).address,
263 child_record); 263 child_record);
264 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 264 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
265 265
diff --git a/src/modules/ecordova/tizen/ecordova_contactfield_private.h b/src/modules/ecordova/tizen/ecordova_contactfield_private.h
index c9abcc2907..ba38be4c7a 100644
--- a/src/modules/ecordova/tizen/ecordova_contactfield_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contactfield_private.h
@@ -5,27 +5,6 @@
5#include "ecordova_contactfield.eo.h" 5#include "ecordova_contactfield.eo.h"
6#include "ecordova_contacts_service.h" 6#include "ecordova_contacts_service.h"
7 7
8typedef enum _Ecordova_ContactField_Property
9{
10 ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID,
11 ECORDOVA_CONTACTFIELD_PROPERTY_ID,
12 ECORDOVA_CONTACTFIELD_PROPERTY_TYPE,
13 ECORDOVA_CONTACTFIELD_PROPERTY_LABEL,
14 ECORDOVA_CONTACTFIELD_PROPERTY_VALUE,
15 ECORDOVA_CONTACTFIELD_PROPERTY_PREF,
16 ECORDOVA_CONTACTFIELD_PROPERTY_COUNT
17} Ecordova_ContactField_Property;
18
19typedef struct _Ecordova_ContactField_Metadata
20{
21 const char * const *uri;
22 const unsigned int *ids[ECORDOVA_CONTACTFIELD_PROPERTY_COUNT];
23 char *(*type2label)(int type, const char *custom);
24 int(*label2type)(const char *label);
25} Ecordova_ContactField_Metadata;
26
27typedef struct _Ecordova_ContactField_Data Ecordova_ContactField_Data;
28
29/** 8/**
30 * Ecordova.ContactField private data 9 * Ecordova.ContactField private data
31 */ 10 */
diff --git a/src/modules/ecordova/tizen/ecordova_contactname.c b/src/modules/ecordova/tizen/ecordova_contactname.c
index e2f3635450..71d42bf5f8 100644
--- a/src/modules/ecordova/tizen/ecordova_contactname.c
+++ b/src/modules/ecordova/tizen/ecordova_contactname.c
@@ -22,7 +22,7 @@ _ecordova_contactname_eo_base_constructor(Eo *obj,
22 pd->obj = obj; 22 pd->obj = obj;
23 pd->record = NULL; 23 pd->record = NULL;
24 24
25 int ret = contacts_record_create(_contacts_name._uri, &pd->record); 25 int ret = contacts_record_create((*_contacts_name)._uri, &pd->record);
26 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 26 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
27 27
28 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 28 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
@@ -51,7 +51,7 @@ _ecordova_contactname_formatted_get(Eo *obj,
51 EINA_SAFETY_ON_NULL_RETURN_VAL(parent_pd, NULL); 51 EINA_SAFETY_ON_NULL_RETURN_VAL(parent_pd, NULL);
52 52
53 const char *value = NULL; 53 const char *value = NULL;
54 get_str_p(parent_pd->record, _contacts_contact.display_name, &value); 54 get_str_p(parent_pd->record, (*_contacts_contact).display_name, &value);
55 return value; 55 return value;
56} 56}
57 57
@@ -67,7 +67,7 @@ _ecordova_contactname_formatted_set(Eo *obj,
67 Ecordova_Contact_Data *parent_pd = eo_data_scope_get(parent, ECORDOVA_CONTACT_CLASS); 67 Ecordova_Contact_Data *parent_pd = eo_data_scope_get(parent, ECORDOVA_CONTACT_CLASS);
68 EINA_SAFETY_ON_NULL_RETURN(parent_pd); 68 EINA_SAFETY_ON_NULL_RETURN(parent_pd);
69 69
70 set_str(parent_pd->record, _contacts_contact.display_name, value); 70 set_str(parent_pd->record, (*_contacts_contact).display_name, value);
71} 71}
72 72
73static const char * 73static const char *
@@ -75,7 +75,7 @@ _ecordova_contactname_family_name_get(Eo *obj EINA_UNUSED,
75 Ecordova_ContactName_Data *pd) 75 Ecordova_ContactName_Data *pd)
76{ 76{
77 const char *value = NULL; 77 const char *value = NULL;
78 get_str_p(pd->record, _contacts_name.last, &value); 78 get_str_p(pd->record, (*_contacts_name).last, &value);
79 return value; 79 return value;
80} 80}
81 81
@@ -84,7 +84,7 @@ _ecordova_contactname_family_name_set(Eo *obj EINA_UNUSED,
84 Ecordova_ContactName_Data *pd, 84 Ecordova_ContactName_Data *pd,
85 const char *value) 85 const char *value)
86{ 86{
87 set_str(pd->record, _contacts_name.last, value); 87 set_str(pd->record, (*_contacts_name).last, value);
88} 88}
89 89
90static const char * 90static const char *
@@ -92,7 +92,7 @@ _ecordova_contactname_given_name_get(Eo *obj EINA_UNUSED,
92 Ecordova_ContactName_Data *pd) 92 Ecordova_ContactName_Data *pd)
93{ 93{
94 const char *value = NULL; 94 const char *value = NULL;
95 get_str_p(pd->record, _contacts_name.first, &value); 95 get_str_p(pd->record, (*_contacts_name).first, &value);
96 return value; 96 return value;
97} 97}
98 98
@@ -101,7 +101,7 @@ _ecordova_contactname_given_name_set(Eo *obj EINA_UNUSED,
101 Ecordova_ContactName_Data *pd, 101 Ecordova_ContactName_Data *pd,
102 const char *value) 102 const char *value)
103{ 103{
104 set_str(pd->record, _contacts_name.first, value); 104 set_str(pd->record, (*_contacts_name).first, value);
105} 105}
106 106
107static const char * 107static const char *
@@ -109,7 +109,7 @@ _ecordova_contactname_middle_get(Eo *obj EINA_UNUSED,
109 Ecordova_ContactName_Data *pd) 109 Ecordova_ContactName_Data *pd)
110{ 110{
111 const char *value = NULL; 111 const char *value = NULL;
112 get_str_p(pd->record, _contacts_name.addition, &value); 112 get_str_p(pd->record, (*_contacts_name).addition, &value);
113 return value; 113 return value;
114} 114}
115 115
@@ -118,7 +118,7 @@ _ecordova_contactname_middle_set(Eo *obj EINA_UNUSED,
118 Ecordova_ContactName_Data *pd, 118 Ecordova_ContactName_Data *pd,
119 const char *value) 119 const char *value)
120{ 120{
121 set_str(pd->record, _contacts_name.addition, value); 121 set_str(pd->record, (*_contacts_name).addition, value);
122} 122}
123 123
124static const char * 124static const char *
@@ -126,7 +126,7 @@ _ecordova_contactname_prefix_get(Eo *obj EINA_UNUSED,
126 Ecordova_ContactName_Data *pd) 126 Ecordova_ContactName_Data *pd)
127{ 127{
128 const char *value = NULL; 128 const char *value = NULL;
129 get_str_p(pd->record, _contacts_name.prefix, &value); 129 get_str_p(pd->record, (*_contacts_name).prefix, &value);
130 return value; 130 return value;
131} 131}
132 132
@@ -135,7 +135,7 @@ _ecordova_contactname_prefix_set(Eo *obj EINA_UNUSED,
135 Ecordova_ContactName_Data *pd, 135 Ecordova_ContactName_Data *pd,
136 const char *value) 136 const char *value)
137{ 137{
138 set_str(pd->record, _contacts_name.prefix, value); 138 set_str(pd->record, (*_contacts_name).prefix, value);
139} 139}
140 140
141static const char * 141static const char *
@@ -143,7 +143,7 @@ _ecordova_contactname_suffix_get(Eo *obj EINA_UNUSED,
143 Ecordova_ContactName_Data *pd) 143 Ecordova_ContactName_Data *pd)
144{ 144{
145 const char *value = NULL; 145 const char *value = NULL;
146 get_str_p(pd->record, _contacts_name.suffix, &value); 146 get_str_p(pd->record, (*_contacts_name).suffix, &value);
147 return value; 147 return value;
148} 148}
149 149
@@ -152,7 +152,7 @@ _ecordova_contactname_suffix_set(Eo *obj EINA_UNUSED,
152 Ecordova_ContactName_Data *pd, 152 Ecordova_ContactName_Data *pd,
153 const char *value) 153 const char *value)
154{ 154{
155 set_str(pd->record, _contacts_name.suffix, value); 155 set_str(pd->record, (*_contacts_name).suffix, value);
156} 156}
157 157
158Eina_Bool 158Eina_Bool
@@ -169,14 +169,14 @@ ecordova_contactname_import(Ecordova_ContactName *obj,
169 169
170 int count = 0; 170 int count = 0;
171 ret = contacts_record_get_child_record_count(contacts_record, 171 ret = contacts_record_get_child_record_count(contacts_record,
172 _contacts_contact.name, 172 (*_contacts_contact).name,
173 &count); 173 &count);
174 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 174 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
175 EINA_SAFETY_ON_FALSE_RETURN_VAL(count == 1, EINA_FALSE); 175 EINA_SAFETY_ON_FALSE_RETURN_VAL(count == 1, EINA_FALSE);
176 176
177 contacts_record_h contactname_record = NULL; 177 contacts_record_h contactname_record = NULL;
178 ret = contacts_record_get_child_record_at_p(contacts_record, 178 ret = contacts_record_get_child_record_at_p(contacts_record,
179 _contacts_contact.name, 179 (*_contacts_contact).name,
180 0, 180 0,
181 &contactname_record); 181 &contactname_record);
182 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 182 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
@@ -206,7 +206,7 @@ ecordova_contactname_export(Ecordova_ContactName *obj,
206 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 206 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
207 207
208 ret = contacts_record_add_child_record(contacts_record, 208 ret = contacts_record_add_child_record(contacts_record,
209 _contacts_contact.name, 209 (*_contacts_contact).name,
210 contactname_record); 210 contactname_record);
211 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 211 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
212 212
diff --git a/src/modules/ecordova/tizen/ecordova_contactorganization.c b/src/modules/ecordova/tizen/ecordova_contactorganization.c
index 6ebd3614fc..4231809aac 100644
--- a/src/modules/ecordova/tizen/ecordova_contactorganization.c
+++ b/src/modules/ecordova/tizen/ecordova_contactorganization.c
@@ -20,7 +20,7 @@ _ecordova_contactorganization_eo_base_constructor(Eo *obj,
20 pd->obj = obj; 20 pd->obj = obj;
21 pd->id = 0; 21 pd->id = 0;
22 pd->record = NULL; 22 pd->record = NULL;
23 int ret = contacts_record_create(_contacts_company._uri, &pd->record); 23 int ret = contacts_record_create((*_contacts_company)._uri, &pd->record);
24 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL); 24 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, NULL);
25 25
26 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 26 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
@@ -66,7 +66,7 @@ _ecordova_contactorganization_type_get(Eo *obj EINA_UNUSED,
66 Ecordova_ContactOrganization_Data *pd) 66 Ecordova_ContactOrganization_Data *pd)
67{ 67{
68 int type; 68 int type;
69 if (!get_int(pd->record, _contacts_company.type, &type)) 69 if (!get_int(pd->record, (*_contacts_company).type, &type))
70 return NULL; 70 return NULL;
71 71
72 switch (type) 72 switch (type)
@@ -78,7 +78,7 @@ _ecordova_contactorganization_type_get(Eo *obj EINA_UNUSED,
78 default: 78 default:
79 { 79 {
80 const char *custom = NULL; 80 const char *custom = NULL;
81 get_str_p(pd->record, _contacts_company.label, &custom); 81 get_str_p(pd->record, (*_contacts_company).label, &custom);
82 return custom; 82 return custom;
83 } 83 }
84 } 84 }
@@ -97,9 +97,9 @@ _ecordova_contactorganization_type_set(Eo *obj EINA_UNUSED,
97 else 97 else
98 type = CONTACTS_COMPANY_TYPE_CUSTOM; 98 type = CONTACTS_COMPANY_TYPE_CUSTOM;
99 99
100 set_int(pd->record, _contacts_company.type, type); 100 set_int(pd->record, (*_contacts_company).type, type);
101 if (strlen(value) != 0) 101 if (strlen(value) != 0)
102 set_str(pd->record, _contacts_company.label, value); 102 set_str(pd->record, (*_contacts_company).label, value);
103} 103}
104 104
105static const char * 105static const char *
@@ -107,7 +107,7 @@ _ecordova_contactorganization_name_get(Eo *obj EINA_UNUSED,
107 Ecordova_ContactOrganization_Data *pd) 107 Ecordova_ContactOrganization_Data *pd)
108{ 108{
109 const char *value = NULL; 109 const char *value = NULL;
110 get_str_p(pd->record, _contacts_company.name, &value); 110 get_str_p(pd->record, (*_contacts_company).name, &value);
111 return value; 111 return value;
112} 112}
113 113
@@ -116,7 +116,7 @@ _ecordova_contactorganization_name_set(Eo *obj EINA_UNUSED,
116 Ecordova_ContactOrganization_Data *pd, 116 Ecordova_ContactOrganization_Data *pd,
117 const char *value) 117 const char *value)
118{ 118{
119 set_str(pd->record, _contacts_company.name, value); 119 set_str(pd->record, (*_contacts_company).name, value);
120} 120}
121 121
122static const char * 122static const char *
@@ -124,7 +124,7 @@ _ecordova_contactorganization_dept_get(Eo *obj EINA_UNUSED,
124 Ecordova_ContactOrganization_Data *pd) 124 Ecordova_ContactOrganization_Data *pd)
125{ 125{
126 const char *value = NULL; 126 const char *value = NULL;
127 get_str_p(pd->record, _contacts_company.department, &value); 127 get_str_p(pd->record, (*_contacts_company).department, &value);
128 return value; 128 return value;
129} 129}
130 130
@@ -133,7 +133,7 @@ _ecordova_contactorganization_dept_set(Eo *obj EINA_UNUSED,
133 Ecordova_ContactOrganization_Data *pd, 133 Ecordova_ContactOrganization_Data *pd,
134 const char *value) 134 const char *value)
135{ 135{
136 set_str(pd->record, _contacts_company.department, value); 136 set_str(pd->record, (*_contacts_company).department, value);
137} 137}
138 138
139static const char * 139static const char *
@@ -141,7 +141,7 @@ _ecordova_contactorganization_title_get(Eo *obj EINA_UNUSED,
141 Ecordova_ContactOrganization_Data *pd) 141 Ecordova_ContactOrganization_Data *pd)
142{ 142{
143 const char *value = NULL; 143 const char *value = NULL;
144 get_str_p(pd->record, _contacts_company.job_title, &value); 144 get_str_p(pd->record, (*_contacts_company).job_title, &value);
145 return value; 145 return value;
146} 146}
147 147
@@ -150,7 +150,7 @@ _ecordova_contactorganization_title_set(Eo *obj EINA_UNUSED,
150 Ecordova_ContactOrganization_Data *pd, 150 Ecordova_ContactOrganization_Data *pd,
151 const char *value) 151 const char *value)
152{ 152{
153 set_str(pd->record, _contacts_company.job_title, value); 153 set_str(pd->record, (*_contacts_company).job_title, value);
154} 154}
155 155
156Eina_Bool 156Eina_Bool
@@ -168,7 +168,7 @@ ecordova_contactorganization_import(Ecordova_ContactOrganization *obj,
168 ret = contacts_record_clone(child_record, &pd->record); 168 ret = contacts_record_clone(child_record, &pd->record);
169 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 169 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
170 170
171 return get_int(child_record, _contacts_company.id, &pd->id); 171 return get_int(child_record, (*_contacts_company).id, &pd->id);
172} 172}
173 173
174Eina_Bool 174Eina_Bool
@@ -186,7 +186,7 @@ ecordova_contactorganization_export(Ecordova_ContactOrganization *obj,
186 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 186 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
187 187
188 ret = contacts_record_add_child_record(contacts_record, 188 ret = contacts_record_add_child_record(contacts_record,
189 _contacts_contact.company, 189 (*_contacts_contact).company,
190 child_record); 190 child_record);
191 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE); 191 EINA_SAFETY_ON_FALSE_RETURN_VAL(CONTACTS_ERROR_NONE == ret, EINA_FALSE);
192 192
diff --git a/src/modules/ecordova/tizen/ecordova_contacts.c b/src/modules/ecordova/tizen/ecordova_contacts.c
index c225f43aa5..ee0c01ac3f 100644
--- a/src/modules/ecordova/tizen/ecordova_contacts.c
+++ b/src/modules/ecordova/tizen/ecordova_contacts.c
@@ -73,7 +73,7 @@ _ecordova_contacts_find(Eo *obj,
73 const char *field = eina_list_data_get(fields); 73 const char *field = eina_list_data_get(fields);
74 if (strcmp("*", field) == 0) 74 if (strcmp("*", field) == 0)
75 { 75 {
76 int ret = contacts_db_get_all_records(_contacts_contact._uri, 0, 0, &list); 76 int ret = contacts_db_get_all_records((*_contacts_contact)._uri, 0, 0, &list);
77 if (CONTACTS_ERROR_NONE != ret) 77 if (CONTACTS_ERROR_NONE != ret)
78 { 78 {
79 ERR("%s returned %d", "contacts_db_get_all_records", ret); 79 ERR("%s returned %d", "contacts_db_get_all_records", ret);
@@ -195,49 +195,49 @@ _get_records(const Eina_List *fields,
195 } Search_Metadata; 195 } Search_Metadata;
196 196
197 Search_Metadata search_metadata[] = { 197 Search_Metadata search_metadata[] = {
198 {"id", _contacts_contact.id, INT_FIELD, SEARCH_CONTACT}, 198 {"id", (*_contacts_contact).id, INT_FIELD, SEARCH_CONTACT},
199 {"display_name", _contacts_contact.display_name, STRING_FIELD, SEARCH_CONTACT}, 199 {"display_name", (*_contacts_contact).display_name, STRING_FIELD, SEARCH_CONTACT},
200 {"formatted", _contacts_contact.display_name, STRING_FIELD, SEARCH_CONTACT}, 200 {"formatted", (*_contacts_contact).display_name, STRING_FIELD, SEARCH_CONTACT},
201 {"name", _contacts_contact.display_name, STRING_FIELD, SEARCH_CONTACT}, 201 {"name", (*_contacts_contact).display_name, STRING_FIELD, SEARCH_CONTACT},
202 {"given_name", _contacts_name.first, STRING_FIELD, SEARCH_NAME}, 202 {"given_name", (*_contacts_name).first, STRING_FIELD, SEARCH_NAME},
203 {"family_name", _contacts_name.last, STRING_FIELD, SEARCH_NAME}, 203 {"family_name", (*_contacts_name).last, STRING_FIELD, SEARCH_NAME},
204 {"honorific_prefix", _contacts_name.prefix, STRING_FIELD, SEARCH_NAME}, 204 {"honorific_prefix", (*_contacts_name).prefix, STRING_FIELD, SEARCH_NAME},
205 {"honorific_suffix", _contacts_name.suffix, STRING_FIELD, SEARCH_NAME}, 205 {"honorific_suffix", (*_contacts_name).suffix, STRING_FIELD, SEARCH_NAME},
206 {"middle_name", _contacts_name.addition, STRING_FIELD, SEARCH_NAME}, 206 {"middle_name", (*_contacts_name).addition, STRING_FIELD, SEARCH_NAME},
207 {"country", _contacts_address.country, STRING_FIELD, SEARCH_ADDRESS}, 207 {"country", (*_contacts_address).country, STRING_FIELD, SEARCH_ADDRESS},
208 {"locality", _contacts_address.locality, STRING_FIELD, SEARCH_ADDRESS}, 208 {"locality", (*_contacts_address).locality, STRING_FIELD, SEARCH_ADDRESS},
209 {"postal_code", _contacts_address.postal_code, STRING_FIELD, SEARCH_ADDRESS}, 209 {"postal_code", (*_contacts_address).postal_code, STRING_FIELD, SEARCH_ADDRESS},
210 {"region", _contacts_address.region, STRING_FIELD, SEARCH_ADDRESS}, 210 {"region", (*_contacts_address).region, STRING_FIELD, SEARCH_ADDRESS},
211 {"street_address", _contacts_address.street, STRING_FIELD, SEARCH_ADDRESS}, 211 {"street_address", (*_contacts_address).street, STRING_FIELD, SEARCH_ADDRESS},
212 {"phone_numbers", _contacts_number.number, STRING_FIELD, SEARCH_NUMBER}, 212 {"phone_numbers", (*_contacts_number).number, STRING_FIELD, SEARCH_NUMBER},
213 {"emails", _contacts_email.email, STRING_FIELD, SEARCH_EMAIL}, 213 {"emails", (*_contacts_email).email, STRING_FIELD, SEARCH_EMAIL},
214 {"urls", _contacts_url.url, STRING_FIELD, SEARCH_URL}, 214 {"urls", (*_contacts_url).url, STRING_FIELD, SEARCH_URL},
215 {"note", _contacts_note.note, STRING_FIELD, SEARCH_NOTE}, 215 {"note", (*_contacts_note).note, STRING_FIELD, SEARCH_NOTE},
216 {"ims", _contacts_messenger.im_id, STRING_FIELD, SEARCH_MESSENGER}, 216 {"ims", (*_contacts_messenger).im_id, STRING_FIELD, SEARCH_MESSENGER},
217 {"nickname", _contacts_nickname.name, STRING_FIELD, SEARCH_NICKNAME}, 217 {"nickname", (*_contacts_nickname).name, STRING_FIELD, SEARCH_NICKNAME},
218 {"department", _contacts_company.department, STRING_FIELD, SEARCH_COMPANY}, 218 {"department", (*_contacts_company).department, STRING_FIELD, SEARCH_COMPANY},
219 {"organizations", _contacts_company.name, STRING_FIELD, SEARCH_COMPANY}, 219 {"organizations", (*_contacts_company).name, STRING_FIELD, SEARCH_COMPANY},
220 {"title", _contacts_company.job_title, STRING_FIELD, SEARCH_COMPANY}, 220 {"title", (*_contacts_company).job_title, STRING_FIELD, SEARCH_COMPANY},
221 {"photos", _contacts_image.path, STRING_FIELD, SEARCH_IMAGE}, 221 {"photos", (*_contacts_image).path, STRING_FIELD, SEARCH_IMAGE},
222 {"birthday", _contacts_event.date, BIRTHDAY_FIELD, SEARCH_EVENT}, 222 {"birthday", (*_contacts_event).date, BIRTHDAY_FIELD, SEARCH_EVENT},
223 {"addresses", 0, ADDRESSES_FIELD, SEARCH_ADDRESS}, 223 {"addresses", 0, ADDRESSES_FIELD, SEARCH_ADDRESS},
224 // TODO: categories: "categories", ? 224 // TODO: categories: "categories", ?
225 {0} 225 {0}
226 }; 226 };
227 227
228 const char *uri[SEARCH_ID_COUNT] = { 228 const char *uri[SEARCH_ID_COUNT] = {
229 [SEARCH_CONTACT] = _contacts_contact._uri, 229 [SEARCH_CONTACT] = (*_contacts_contact)._uri,
230 [SEARCH_ADDRESS] = _contacts_address._uri, 230 [SEARCH_ADDRESS] = (*_contacts_address)._uri,
231 [SEARCH_EVENT] = _contacts_event._uri, 231 [SEARCH_EVENT] = (*_contacts_event)._uri,
232 [SEARCH_COMPANY] = _contacts_company._uri, 232 [SEARCH_COMPANY] = (*_contacts_company)._uri,
233 [SEARCH_EMAIL] = _contacts_email._uri, 233 [SEARCH_EMAIL] = (*_contacts_email)._uri,
234 [SEARCH_NAME] = _contacts_name._uri, 234 [SEARCH_NAME] = (*_contacts_name)._uri,
235 [SEARCH_NICKNAME] = _contacts_nickname._uri, 235 [SEARCH_NICKNAME] = (*_contacts_nickname)._uri,
236 [SEARCH_MESSENGER] = _contacts_messenger._uri, 236 [SEARCH_MESSENGER] = (*_contacts_messenger)._uri,
237 [SEARCH_NOTE] = _contacts_note._uri, 237 [SEARCH_NOTE] = (*_contacts_note)._uri,
238 [SEARCH_NUMBER] = _contacts_number._uri, 238 [SEARCH_NUMBER] = (*_contacts_number)._uri,
239 [SEARCH_URL] = _contacts_url._uri, 239 [SEARCH_URL] = (*_contacts_url)._uri,
240 [SEARCH_IMAGE] = _contacts_image._uri 240 [SEARCH_IMAGE] = (*_contacts_image)._uri
241 }; 241 };
242 242
243 contacts_filter_h filters[SEARCH_ID_COUNT] = {NULL}; 243 contacts_filter_h filters[SEARCH_ID_COUNT] = {NULL};
@@ -299,7 +299,7 @@ _get_records(const Eina_List *fields,
299 int ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND); 299 int ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
300 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 300 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
301 301
302 ret = contacts_filter_add_int(filter, _contacts_event.type, CONTACTS_MATCH_EQUAL, CONTACTS_EVENT_TYPE_BIRTH); 302 ret = contacts_filter_add_int(filter, (*_contacts_event).type, CONTACTS_MATCH_EQUAL, CONTACTS_EVENT_TYPE_BIRTH);
303 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 303 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
304 304
305 break; 305 break;
@@ -309,31 +309,31 @@ _get_records(const Eina_List *fields,
309 filter = _filter_get(&filters[metadata->search_id], uri[metadata->search_id]); 309 filter = _filter_get(&filters[metadata->search_id], uri[metadata->search_id]);
310 if (!filter) goto on_error_1; 310 if (!filter) goto on_error_1;
311 311
312 ret = contacts_filter_add_str(filter, _contacts_address.country, CONTACTS_MATCH_CONTAINS, options->filter); 312 ret = contacts_filter_add_str(filter, (*_contacts_address).country, CONTACTS_MATCH_CONTAINS, options->filter);
313 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 313 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
314 314
315 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR); 315 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
316 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 316 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
317 317
318 ret = contacts_filter_add_str(filter, _contacts_address.region, CONTACTS_MATCH_CONTAINS, options->filter); 318 ret = contacts_filter_add_str(filter, (*_contacts_address).region, CONTACTS_MATCH_CONTAINS, options->filter);
319 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 319 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
320 320
321 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR); 321 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
322 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 322 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
323 323
324 ret = contacts_filter_add_str(filter, _contacts_address.locality, CONTACTS_MATCH_CONTAINS, options->filter); 324 ret = contacts_filter_add_str(filter, (*_contacts_address).locality, CONTACTS_MATCH_CONTAINS, options->filter);
325 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 325 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
326 326
327 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR); 327 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
328 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 328 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
329 329
330 ret = contacts_filter_add_str(filter, _contacts_address.street, CONTACTS_MATCH_CONTAINS, options->filter); 330 ret = contacts_filter_add_str(filter, (*_contacts_address).street, CONTACTS_MATCH_CONTAINS, options->filter);
331 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 331 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
332 332
333 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR); 333 ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
334 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 334 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
335 335
336 ret = contacts_filter_add_str(filter, _contacts_address.postal_code, CONTACTS_MATCH_CONTAINS, options->filter); 336 ret = contacts_filter_add_str(filter, (*_contacts_address).postal_code, CONTACTS_MATCH_CONTAINS, options->filter);
337 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1); 337 EINA_SAFETY_ON_FALSE_GOTO(CONTACTS_ERROR_NONE == ret, on_error_1);
338 338
339 break; 339 break;
@@ -360,7 +360,7 @@ _get_records(const Eina_List *fields,
360 } 360 }
361 361
362 int id; 362 int id;
363 Eina_Bool ok = get_int(record, _contacts_contact.id, &id); 363 Eina_Bool ok = get_int(record, (*_contacts_contact).id, &id);
364 EINA_SAFETY_ON_FALSE_GOTO(ok, on_error_2); 364 EINA_SAFETY_ON_FALSE_GOTO(ok, on_error_2);
365 365
366 ok = eina_hash_add(contact_ids, &id, &id) == EINA_TRUE; 366 ok = eina_hash_add(contact_ids, &id, &id) == EINA_TRUE;
@@ -453,18 +453,18 @@ _populate_list(contacts_list_h list,
453 return EINA_FALSE; 453 return EINA_FALSE;
454 454
455 unsigned int contact_id[SEARCH_ID_COUNT] = { 455 unsigned int contact_id[SEARCH_ID_COUNT] = {
456 [SEARCH_CONTACT] = _contacts_contact.id, 456 [SEARCH_CONTACT] = (*_contacts_contact).id,
457 [SEARCH_ADDRESS] = _contacts_address.contact_id, 457 [SEARCH_ADDRESS] = (*_contacts_address).contact_id,
458 [SEARCH_EVENT] = _contacts_event.contact_id, 458 [SEARCH_EVENT] = (*_contacts_event).contact_id,
459 [SEARCH_COMPANY] = _contacts_company.contact_id, 459 [SEARCH_COMPANY] = (*_contacts_company).contact_id,
460 [SEARCH_EMAIL] = _contacts_email.contact_id, 460 [SEARCH_EMAIL] = (*_contacts_email).contact_id,
461 [SEARCH_NAME] = _contacts_name.contact_id, 461 [SEARCH_NAME] = (*_contacts_name).contact_id,
462 [SEARCH_NICKNAME] = _contacts_nickname.contact_id, 462 [SEARCH_NICKNAME] = (*_contacts_nickname).contact_id,
463 [SEARCH_MESSENGER] = _contacts_messenger.contact_id, 463 [SEARCH_MESSENGER] = (*_contacts_messenger).contact_id,
464 [SEARCH_NOTE] = _contacts_note.contact_id, 464 [SEARCH_NOTE] = (*_contacts_note).contact_id,
465 [SEARCH_NUMBER] = _contacts_number.contact_id, 465 [SEARCH_NUMBER] = (*_contacts_number).contact_id,
466 [SEARCH_URL] = _contacts_url.contact_id, 466 [SEARCH_URL] = (*_contacts_url).contact_id,
467 [SEARCH_IMAGE] = _contacts_image.contact_id 467 [SEARCH_IMAGE] = (*_contacts_image).contact_id
468 }; 468 };
469 469
470 int ret; 470 int ret;
diff --git a/src/modules/ecordova/tizen/ecordova_contacts_service.c b/src/modules/ecordova/tizen/ecordova_contacts_service.c
index 718c5f8b47..52c7eee53d 100644
--- a/src/modules/ecordova/tizen/ecordova_contacts_service.c
+++ b/src/modules/ecordova/tizen/ecordova_contacts_service.c
@@ -48,24 +48,31 @@ int (*contacts_query_create)(const char* view_uri, contacts_query_h* query) = 0;
48int (*contacts_query_set_filter)(contacts_query_h query, contacts_filter_h filter) = 0; 48int (*contacts_query_set_filter)(contacts_query_h query, contacts_filter_h filter) = 0;
49int (*contacts_query_destroy)(contacts_query_h query) = 0; 49int (*contacts_query_destroy)(contacts_query_h query) = 0;
50 50
51_contacts_address_property_ids* _contacts_address = NULL; 51const _contacts_address_property_ids* _contacts_address = NULL;
52_contacts_contact_property_ids* _contacts_contact = NULL; 52const _contacts_contact_property_ids* _contacts_contact = NULL;
53_contacts_nickname_property_ids* _contacts_nickname = NULL; 53const _contacts_nickname_property_ids* _contacts_nickname = NULL;
54_contacts_note_property_ids* _contacts_note = NULL; 54const _contacts_note_property_ids* _contacts_note = NULL;
55_contacts_name_property_ids* _contacts_name = NULL; 55const _contacts_name_property_ids* _contacts_name = NULL;
56_contacts_number_property_ids* _contacts_number = NULL; 56const _contacts_number_property_ids* _contacts_number = NULL;
57_contacts_company_property_ids* _contacts_company = NULL; 57const _contacts_company_property_ids* _contacts_company = NULL;
58_contacts_email_property_ids* _contacts_email = NULL; 58const _contacts_email_property_ids* _contacts_email = NULL;
59_contacts_messenger_property_ids* _contacts_messenger = NULL; 59const _contacts_messenger_property_ids* _contacts_messenger = NULL;
60_contacts_image_property_ids* _contacts_image = NULL; 60const _contacts_image_property_ids* _contacts_image = NULL;
61_contacts_url_property_ids* _contacts_url = NULL; 61const _contacts_url_property_ids* _contacts_url = NULL;
62_contacts_event_property_ids* _contacts_event = NULL; 62const _contacts_event_property_ids* _contacts_event = NULL;
63 63
64static void* contacts_service_lib; 64static void* contacts_service_lib;
65 65
66Ecordova_ContactField_Metadata _contact_number_metadata;
67Ecordova_ContactField_Metadata _contact_email_metadata;
68Ecordova_ContactField_Metadata _contact_messenger_metadata;
69Ecordova_ContactField_Metadata _contact_image_metadata;
70Ecordova_ContactField_Metadata _contact_url_metadata;
71
66void ecordova_contacts_service_shutdown() 72void ecordova_contacts_service_shutdown()
67{ 73{
68 dlclose(contacts_service_lib); 74 if(contacts_service_lib)
75 dlclose(contacts_service_lib);
69 contacts_service_lib = NULL; 76 contacts_service_lib = NULL;
70 contacts_record_destroy = NULL; 77 contacts_record_destroy = NULL;
71 contacts_record_clone = NULL; 78 contacts_record_clone = NULL;
@@ -115,12 +122,24 @@ void ecordova_contacts_service_shutdown()
115 _contacts_event = NULL; 122 _contacts_event = NULL;
116} 123}
117 124
125char * ecordova_contactnumber_type2label(int type, const char *custom);
126int ecordova_contactnumber_label2type(const char *label);
127char * ecordova_contactemail_type2label(int type, const char *custom);
128int ecordova_contactemail_label2type(const char *label);
129char * ecordova_contactmessenger_type2label(int type, const char *custom);
130int ecordova_contactmessenger_label2type(const char *label);
131char * ecordova_contactimage_type2label(int type, const char *custom);
132int ecordova_contactimage_label2type(const char *label);
133char * ecordova_contacturl_type2label(int type, const char *custom);
134int ecordova_contacturl_label2type(const char *label);
135
118void ecordova_contacts_service_init() 136void ecordova_contacts_service_init()
119{ 137{
120 if(!contacts_service_lib) 138 if(!contacts_service_lib)
121 { 139 {
122 contacts_service_lib = dlopen("contacts-service2.so", RTLD_NOW); 140 contacts_service_lib = dlopen("contacts-service2.so", RTLD_NOW);
123 141 if(!contacts_service_lib)
142 goto on_error;
124 contacts_record_create = dlsym(contacts_service_lib, "contacts_record_create"); 143 contacts_record_create = dlsym(contacts_service_lib, "contacts_record_create");
125 if(!contacts_record_create) 144 if(!contacts_record_create)
126 goto on_error; 145 goto on_error;
@@ -262,6 +281,56 @@ void ecordova_contacts_service_init()
262 _contacts_event = dlsym(contacts_service_lib, "_contacts_event"); 281 _contacts_event = dlsym(contacts_service_lib, "_contacts_event");
263 if(!_contacts_event) 282 if(!_contacts_event)
264 goto on_error;; 283 goto on_error;;
284
285 _contact_number_metadata.uri = &(*_contacts_number)._uri;
286 _contact_number_metadata.ids[ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &(*_contacts_contact).number;
287 _contact_number_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &(*_contacts_number).id;
288 _contact_number_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &(*_contacts_number).type;
289 _contact_number_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &(*_contacts_number).label;
290 _contact_number_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &(*_contacts_number).number;
291 _contact_number_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = &(*_contacts_number).is_default;
292 _contact_number_metadata.type2label = ecordova_contactnumber_type2label;
293 _contact_number_metadata.label2type = ecordova_contactnumber_label2type;
294
295 _contact_email_metadata.uri = &(*_contacts_email)._uri;
296 _contact_email_metadata.ids[ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &(*_contacts_contact).email;
297 _contact_email_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &(*_contacts_email).id;
298 _contact_email_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &(*_contacts_email).type;
299 _contact_email_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &(*_contacts_email).label;
300 _contact_email_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &(*_contacts_email).email;
301 _contact_email_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = &(*_contacts_email).is_default;
302 _contact_email_metadata.type2label = ecordova_contactemail_type2label;
303 _contact_email_metadata.label2type = ecordova_contactemail_label2type;
304
305 _contact_messenger_metadata.uri = &(*_contacts_messenger)._uri;
306 _contact_messenger_metadata.ids[ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &(*_contacts_contact).messenger;
307 _contact_messenger_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &(*_contacts_messenger).id;
308 _contact_messenger_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &(*_contacts_messenger).type;
309 _contact_messenger_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &(*_contacts_messenger).label;
310 _contact_messenger_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &(*_contacts_messenger).im_id;
311 _contact_messenger_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = NULL;
312 _contact_messenger_metadata.type2label = ecordova_contactmessenger_type2label;
313 _contact_messenger_metadata.label2type = ecordova_contactmessenger_label2type;
314
315 _contact_image_metadata.uri = &(*_contacts_image)._uri;
316 _contact_image_metadata.ids[ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &(*_contacts_contact).image;
317 _contact_image_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &(*_contacts_image).id;
318 _contact_image_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &(*_contacts_image).type;
319 _contact_image_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &(*_contacts_image).label;
320 _contact_image_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &(*_contacts_image).path;
321 _contact_image_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = &(*_contacts_image).is_default;
322 _contact_image_metadata.type2label = ecordova_contactimage_type2label;
323 _contact_image_metadata.label2type = ecordova_contactimage_label2type;
324
325 _contact_url_metadata.uri = &(*_contacts_url)._uri;
326 _contact_url_metadata.ids[ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID] = &(*_contacts_contact).url;
327 _contact_url_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_ID] = &(*_contacts_url).id;
328 _contact_url_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_TYPE] = &(*_contacts_url).type;
329 _contact_url_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_LABEL] = &(*_contacts_url).label;
330 _contact_url_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_VALUE] = &(*_contacts_url).url;
331 _contact_url_metadata.ids[ECORDOVA_CONTACTFIELD_PROPERTY_PREF] = NULL;
332 _contact_url_metadata.type2label = ecordova_contacturl_type2label;
333 _contact_url_metadata.label2type = ecordova_contacturl_label2type;
265 } 334 }
266 335
267 return; 336 return;
diff --git a/src/modules/ecordova/tizen/ecordova_contacts_service.h b/src/modules/ecordova/tizen/ecordova_contacts_service.h
index bfb8ed2e24..524615836e 100644
--- a/src/modules/ecordova/tizen/ecordova_contacts_service.h
+++ b/src/modules/ecordova/tizen/ecordova_contacts_service.h
@@ -398,6 +398,28 @@ typedef enum
398 CONTACTS_ERROR_INTERNAL = TIZEN_ERROR_CONTACTS | 0xFF, /**< Implementation Error, Temporary Use */ 398 CONTACTS_ERROR_INTERNAL = TIZEN_ERROR_CONTACTS | 0xFF, /**< Implementation Error, Temporary Use */
399} contacts_error_e; 399} contacts_error_e;
400 400
401typedef enum _Ecordova_ContactField_Property
402{
403 ECORDOVA_CONTACTFIELD_PARENT_PROPERTY_ID,
404 ECORDOVA_CONTACTFIELD_PROPERTY_ID,
405 ECORDOVA_CONTACTFIELD_PROPERTY_TYPE,
406 ECORDOVA_CONTACTFIELD_PROPERTY_LABEL,
407 ECORDOVA_CONTACTFIELD_PROPERTY_VALUE,
408 ECORDOVA_CONTACTFIELD_PROPERTY_PREF,
409 ECORDOVA_CONTACTFIELD_PROPERTY_COUNT
410} Ecordova_ContactField_Property;
411
412
413typedef struct _Ecordova_ContactField_Metadata
414{
415 const char * const *uri;
416 const unsigned int *ids[ECORDOVA_CONTACTFIELD_PROPERTY_COUNT];
417 char *(*type2label)(int type, const char *custom);
418 int(*label2type)(const char *label);
419} Ecordova_ContactField_Metadata;
420
421typedef struct _Ecordova_ContactField_Data Ecordova_ContactField_Data;
422
401 423
402#endif 424#endif
403 425
diff --git a/src/tests/ecordova/ecordova_contacts_test.c b/src/tests/ecordova/ecordova_contacts_test.c
index af833ebc4e..d44fe3e77d 100644
--- a/src/tests/ecordova/ecordova_contacts_test.c
+++ b/src/tests/ecordova/ecordova_contacts_test.c
@@ -9,6 +9,7 @@
9 9
10#include <check.h> 10#include <check.h>
11 11
12#ifdef HAVE_TIZEN_CONTACTS_SERVICE
12#define CHECK(x) {int ret = x; ck_assert_int_eq(CONTACTS_ERROR_NONE, ret);} 13#define CHECK(x) {int ret = x; ck_assert_int_eq(CONTACTS_ERROR_NONE, ret);}
13 14
14static int _contact_id; 15static int _contact_id;
@@ -23,34 +24,11 @@ _setup(void)
23 ck_assert_int_eq(ret, 1); 24 ck_assert_int_eq(ret, 1);
24 25
25 DBG("%s", "_setup"); 26 DBG("%s", "_setup");
26
27 /* CHECK(contacts_connect()); */
28
29 // TODO: delete all record in the database to be back to square 1 and make tests deterministic
30 DBG("%s", "_setup");
31
32 /* // create contact record */
33 /* contacts_record_h contact = NULL; */
34 /* CHECK(contacts_record_create(_contacts_contact._uri, &contact)); */
35
36 /* // add name */
37 /* contacts_record_h name = NULL; */
38 /* CHECK(contacts_record_create(_contacts_name._uri, &name)); */
39 /* CHECK(contacts_record_set_str(name, _contacts_name.first, _contact_name)); */
40 /* CHECK(contacts_record_add_child_record(contact, _contacts_contact.name, name)); */
41
42 /* CHECK(contacts_db_insert_record(contact, &_contact_id)); */
43
44 /* CHECK(contacts_record_destroy(contact, true)); */
45} 27}
46 28
47static void 29static void
48_teardown(void) 30_teardown(void)
49{ 31{
50 /* CHECK(contacts_db_delete_record(_contacts_contact._uri, _contact_id)); */
51
52 /* CHECK(contacts_disconnect()); */
53
54 int ret = ecordova_shutdown(); 32 int ret = ecordova_shutdown();
55 ck_assert_int_eq(ret, 0); 33 ck_assert_int_eq(ret, 0);
56} 34}
@@ -254,41 +232,42 @@ ecordova_contacts_test(TCase *tc)
254 tcase_add_test(tc, find_by_id); 232 tcase_add_test(tc, find_by_id);
255 tcase_add_test(tc, find_by_name); 233 tcase_add_test(tc, find_by_name);
256} 234}
257/* #else */ 235#else
258/* START_TEST(contacts_fail_load) */ 236START_TEST(contacts_fail_load)
259/* { */ 237{
260/* ecordova_init(); */ 238 ecordova_init();
261 239
262/* fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); */ 240 fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
263/* Ecordova_Contacts *contacts = eo_add(ECORDOVA_CONTACTS_CLASS, NULL); */ 241 Ecordova_Contacts *contacts = eo_add(ECORDOVA_CONTACTS_CLASS, NULL);
264/* ck_assert_ptr_eq(contacts, NULL); */ 242 ck_assert_ptr_eq(contacts, NULL);
265 243
266/* fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); */ 244 fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
267/* Ecordova_Contact *contact = eo_add(ECORDOVA_CONTACT_CLASS, NULL); */ 245 Ecordova_Contact *contact = eo_add(ECORDOVA_CONTACT_CLASS, NULL);
268/* ck_assert_ptr_eq(contact, NULL); */ 246 ck_assert_ptr_eq(contact, NULL);
269 247
270/* fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); */ 248 fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
271/* Ecordova_ContactAddress *contact_address = eo_add(ECORDOVA_CONTACTADDRESS_CLASS, NULL); */ 249 Ecordova_ContactAddress *contact_address = eo_add(ECORDOVA_CONTACTADDRESS_CLASS, NULL);
272/* ck_assert_ptr_eq(contact_address, NULL); */ 250 ck_assert_ptr_eq(contact_address, NULL);
273 251
274/* fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); */ 252 fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
275/* Ecordova_ContactField *contact_field = eo_add(ECORDOVA_CONTACTFIELD_CLASS, NULL); */ 253 Ecordova_ContactField *contact_field = eo_add(ECORDOVA_CONTACTFIELD_CLASS, NULL);
276/* ck_assert_ptr_eq(contact_field, NULL); */ 254 ck_assert_ptr_eq(contact_field, NULL);
277 255
278/* fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); */ 256 fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
279/* Ecordova_ContactName *contact_name = eo_add(ECORDOVA_CONTACTNAME_CLASS, NULL); */ 257 Ecordova_ContactName *contact_name = eo_add(ECORDOVA_CONTACTNAME_CLASS, NULL);
280/* ck_assert_ptr_eq(contact_name, NULL); */ 258 ck_assert_ptr_eq(contact_name, NULL);
281 259
282/* fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); */ 260 fprintf(stderr, "contacts_fail_load %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
283/* Ecordova_ContactOrganization *contact_organization = eo_add(ECORDOVA_CONTACTORGANIZATION_CLASS, NULL); */ 261 Ecordova_ContactOrganization *contact_organization = eo_add(ECORDOVA_CONTACTORGANIZATION_CLASS, NULL);
284/* ck_assert_ptr_eq(contact_organization, NULL); */ 262 ck_assert_ptr_eq(contact_organization, NULL);
285 263
286/* ecordova_shutdown(); */ 264 ecordova_shutdown();
287/* } */ 265}
288/* END_TEST */ 266END_TEST
289 267
290/* void */ 268void
291/* ecordova_contacts_test(TCase *tc) */ 269ecordova_contacts_test(TCase *tc)
292/* { */ 270{
293/* tcase_add_test(tc, contacts_fail_load); */ 271 tcase_add_test(tc, contacts_fail_load);
294/* } */ 272}
273#endif
diff --git a/src/tests/ecordova/ecordova_mediafile_test.c b/src/tests/ecordova/ecordova_mediafile_test.c
index 8b139a727d..4cc156608c 100644
--- a/src/tests/ecordova/ecordova_mediafile_test.c
+++ b/src/tests/ecordova/ecordova_mediafile_test.c
@@ -33,11 +33,9 @@ _mediafile_new(const char *name,
33{ 33{
34 return eo_add(ECORDOVA_MEDIAFILE_CLASS, 34 return eo_add(ECORDOVA_MEDIAFILE_CLASS,
35 NULL, 35 NULL,
36 ecordova_mediafile_constructor(name, 36 ecordova_entry_name_set(name),
37 url, 37 ecordova_entry_url_set(url),
38 type, 38 ecordova_mediafile_type_set(type));
39 last_modified_date,
40 size));
41} 39}
42 40
43START_TEST(smoke) 41START_TEST(smoke)