summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungKyu Song <hk76.song@samsung.com>2013-02-15 15:00:48 (GMT)
committerHyungKyu Song <hk76.song@samsung.com>2013-02-15 15:00:48 (GMT)
commit63a62fe09386d6c7d9ec6e912556be1bf9956ad3 (patch)
tree6edbe93ecee55afe6b0cb401f600d11f2212180c
parentb9b4104f70d3f35414260d964f4c7c0221d21446 (diff)
downloadphone-contacts-tizen_2.0.zip
phone-contacts-tizen_2.0.tar.gz
phone-contacts-tizen_2.0.tar.bz2
-rwxr-xr-xCMakeLists.txt72
-rwxr-xr-xLICENSE.flora76
-rwxr-xr-xNOTICE3
-rw-r--r--contacts-appservice/CMakeLists.txt29
-rwxr-xr-xcontacts-appservice/contacts-appservice.c351
-rw-r--r--contacts-appservice/icon_contacts-appservice.pngbin0 -> 7562 bytes
-rw-r--r--contacts-appservice/org.tizen.contacts-appservice.xml26
-rw-r--r--contacts-viewer/CMakeLists.txt26
-rwxr-xr-xcontacts-viewer/contacts-viewer.c552
-rw-r--r--contacts-viewer/icon_contacts-viewer.pngbin0 -> 7562 bytes
-rwxr-xr-xcontacts-viewer/org.tizen.contacts-viewer.xml31
-rw-r--r--contacts/CMakeLists.txt23
-rwxr-xr-xcontacts/contacts.c320
-rwxr-xr-xcontacts/icon_contacts.pngbin0 -> 20661 bytes
-rwxr-xr-xcontacts/org.tizen.contacts.xml62
-rwxr-xr-xinclude/contacts-ug.h266
-rwxr-xr-xinclude/phone-ug.h171
-rwxr-xr-xlib/CMakeLists.txt166
-rwxr-xr-xlib/common/ct-group-input-view.c1102
-rwxr-xr-xlib/common/ct-list-detail.c464
-rwxr-xr-xlib/common/ct-list-view-common.c2436
-rwxr-xr-xlib/common/include/ct-group.h31
-rwxr-xr-xlib/common/include/phone-common.h760
-rwxr-xr-xlib/common/include/phone-path.h136
-rwxr-xr-xlib/common/include/phone-text.h308
-rwxr-xr-xlib/common/include/phone.h107
-rwxr-xr-xlib/common/ph-common.c1930
-rwxr-xr-xlib/common/ph-detail-log.c495
-rwxr-xr-xlib/common/ph-dialer-speed.c130
-rwxr-xr-xlib/common/ph-text.c400
-rwxr-xr-xlib/ct-front/CMakeLists.txt14
-rw-r--r--lib/ct-front/contacts-tabui-efl.xml29
-rwxr-xr-xlib/ct-front/ct-front-main.c221
-rwxr-xr-xlib/ct-front/ct-front-view.c655
-rwxr-xr-xlib/ct-front/ct-front-view.h24
-rwxr-xr-xlib/ct-front/include/ct-front.h71
-rwxr-xr-xlib/details/CMakeLists.txt24
-rw-r--r--lib/details/base_addrbook0
-rw-r--r--lib/details/contacts-details-efl.xml29
-rwxr-xr-xlib/details/ct-detail-activity.c263
-rwxr-xr-xlib/details/ct-detail-activity.h27
-rwxr-xr-xlib/details/ct-detail-history.c876
-rwxr-xr-xlib/details/ct-detail-history.h29
-rwxr-xr-xlib/details/ct-detail-main.c548
-rwxr-xr-xlib/details/ct-detail-utils.c2287
-rwxr-xr-xlib/details/ct-detail-utils.h66
-rwxr-xr-xlib/details/ct-detail-view.c2617
-rwxr-xr-xlib/details/ct-detail-view.h41
-rwxr-xr-xlib/details/ct-group-assign-view.c644
-rwxr-xr-xlib/details/ct-group-assign-view.h24
-rwxr-xr-xlib/details/ct-image-viewer.c355
-rwxr-xr-xlib/details/ct-image-viewer.h25
-rwxr-xr-xlib/details/ct-input-change-name.c167
-rwxr-xr-xlib/details/ct-input-change-name.h26
-rwxr-xr-xlib/details/ct-input-num-email.c1090
-rwxr-xr-xlib/details/ct-input-num-email.h25
-rwxr-xr-xlib/details/ct-input-utils.c1487
-rwxr-xr-xlib/details/ct-input-utils.h68
-rwxr-xr-xlib/details/ct-input-view.c3245
-rwxr-xr-xlib/details/ct-input-view.h28
-rwxr-xr-xlib/details/ct-share-info-ug.c857
-rwxr-xr-xlib/details/include/ct-detail.h39
-rwxr-xr-xlib/dialer/CMakeLists.txt23
-rw-r--r--lib/dialer/dialer-efl.desktop.in10
-rw-r--r--lib/dialer/dialer-efl.xml29
-rwxr-xr-xlib/dialer/include/phone-dialer.h138
-rwxr-xr-xlib/dialer/ph-dialer-main.c216
-rwxr-xr-xlib/dialer/ph-dialer-search.c38
-rwxr-xr-xlib/dialer/ph-dialer-search.h31
-rwxr-xr-xlib/dialer/ph-dialer-tapi.c503
-rwxr-xr-xlib/dialer/ph-dialer-tapi.h28
-rwxr-xr-xlib/dialer/ph-dialer-utils.c780
-rwxr-xr-xlib/dialer/ph-dialer-utils.h86
-rwxr-xr-xlib/dialer/ph-dialer-view.c1826
-rwxr-xr-xlib/dialer/ph-dialer-view.h56
-rwxr-xr-xlib/edc/contact_button.edc48
-rwxr-xr-xlib/edc/contacts.edc19
-rw-r--r--lib/edc/detail_theme.edc1732
-rwxr-xr-xlib/edc/dialer.edc1297
-rwxr-xr-xlib/edc/dialer_btn.edc113
-rwxr-xr-xlib/edc/dialer_theme.edc387
-rwxr-xr-xlib/edc/favorites_theme.edc570
-rwxr-xr-xlib/edc/group_theme.edc901
-rwxr-xr-xlib/edc/image_layout.edc115
-rwxr-xr-xlib/edc/input_theme.edc767
-rwxr-xr-xlib/edc/list.edc102
-rwxr-xr-xlib/edc/list_theme.edc766
-rwxr-xr-xlib/edc/logdetail_theme.edc1434
-rwxr-xr-xlib/edc/nocontent_layout.edc109
-rwxr-xr-xlib/edc/progress.edc192
-rwxr-xr-xlib/edc/selectioninfo.edc66
-rwxr-xr-xlib/edc/speeddial_theme.edc157
-rwxr-xr-xlib/favor/CMakeLists.txt9
-rwxr-xr-xlib/favor/include/ct-favor.h80
-rwxr-xr-xlib/favor/ph-favorite-edit-view.c430
-rwxr-xr-xlib/favor/ph-favorite-edit-view.h31
-rwxr-xr-xlib/favor/ph-favorite-view.c2180
-rwxr-xr-xlib/favor/ph-favorite-view.h30
-rwxr-xr-xlib/images/contact_images/00_Nocontents_picture.pngbin0 -> 6530 bytes
-rwxr-xr-xlib/images/contact_images/00_check_checking.pngbin0 -> 3165 bytes
-rw-r--r--lib/images/contact_images/00_list_group_bg.pngbin0 -> 4162 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_add-to-bookmarks.pngbin0 -> 1478 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_add_account.pngbin0 -> 3695 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_add_to_contact.pngbin0 -> 4210 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_bluetooth_preview.pngbin0 -> 1920 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_close.pngbin0 -> 1076 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_exchangs_register.pngbin0 -> 4517 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_groups.pngbin0 -> 1195 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_more.pngbin0 -> 3061 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_next.pngbin0 -> 834 bytes
-rw-r--r--lib/images/contact_images/01_controlbar_icon_previous.pngbin0 -> 834 bytes
-rw-r--r--lib/images/contact_images/C02_account_00.pngbin0 -> 3058 bytes
-rw-r--r--lib/images/contact_images/C02_account_01.pngbin0 -> 3801 bytes
-rw-r--r--lib/images/contact_images/C02_account_02.pngbin0 -> 5247 bytes
-rw-r--r--lib/images/contact_images/C02_account_03.pngbin0 -> 4073 bytes
-rw-r--r--lib/images/contact_images/C02_account_04.pngbin0 -> 7110 bytes
-rw-r--r--lib/images/contact_images/C02_account_default.pngbin0 -> 7562 bytes
-rw-r--r--lib/images/contact_images/C02_account_sim.pngbin0 -> 3251 bytes
-rwxr-xr-xlib/images/contact_images/C02_caller_id_icon_camera.pngbin0 -> 12196 bytes
-rwxr-xr-xlib/images/contact_images/C02_caller_id_icon_camera_dim.pngbin0 -> 12030 bytes
-rwxr-xr-xlib/images/contact_images/C02_caller_id_icon_camera_press.pngbin0 -> 17168 bytes
-rwxr-xr-xlib/images/contact_images/C02_caller_id_icon_gallery.pngbin0 -> 12319 bytes
-rwxr-xr-xlib/images/contact_images/C02_caller_id_icon_gallery_dim.pngbin0 -> 12160 bytes
-rwxr-xr-xlib/images/contact_images/C02_caller_id_icon_gallery_press.pngbin0 -> 17179 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_button.pngbin0 -> 13968 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_button_press.pngbin0 -> 15848 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_icon_call.pngbin0 -> 5404 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_icon_call_press.pngbin0 -> 3763 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_icon_sms.pngbin0 -> 3875 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_icon_sms_press.pngbin0 -> 3311 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_icon_vt-call.pngbin0 -> 6726 bytes
-rwxr-xr-xlib/images/contact_images/C02_circle_icon_vt-call_press.pngbin0 -> 4260 bytes
-rwxr-xr-xlib/images/contact_images/C02_favorite_icon.pngbin0 -> 3440 bytes
-rw-r--r--lib/images/contact_images/C02_icon_add_group.pngbin0 -> 7328 bytes
-rw-r--r--lib/images/contact_images/C02_icon_favorite.pngbin0 -> 5068 bytes
-rw-r--r--lib/images/contact_images/C02_icon_favorite_on.pngbin0 -> 5584 bytes
-rw-r--r--lib/images/contact_images/C02_icon_reset.pngbin0 -> 3399 bytes
-rw-r--r--lib/images/contact_images/C04_icon_joyn.pngbin0 -> 3866 bytes
-rw-r--r--lib/images/contact_images/caller_ID_default_128x128.pngbin0 -> 5099 bytes
-rw-r--r--lib/images/contact_images/caller_ID_default_96x96.pngbin0 -> 4500 bytes
-rw-r--r--lib/images/contact_images/caller_ID_edit.pngbin0 -> 5162 bytes
-rwxr-xr-xlib/images/contact_images/email.pngbin0 -> 5948 bytes
-rw-r--r--lib/images/contact_images/message.pngbin0 -> 6073 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_button_01.pngbin0 -> 10879 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_button_01_dim.pngbin0 -> 10879 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_button_01_press.pngbin0 -> 13287 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_button_02.pngbin0 -> 10941 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_button_02_dim.pngbin0 -> 11006 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_button_02_press.pngbin0 -> 14438 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_dialer_button_01_press.pngbin0 -> 11587 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_call.pngbin0 -> 3474 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_call_dim.pngbin0 -> 4118 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_call_press.pngbin0 -> 3474 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_delete.pngbin0 -> 3564 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_expand_01.pngbin0 -> 3062 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_expand_02.pngbin0 -> 3007 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_message.pngbin0 -> 4636 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_message_dim.pngbin0 -> 3537 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_message_press.pngbin0 -> 3694 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_video_call.pngbin0 -> 5778 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_video_call_dim.pngbin0 -> 5572 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_icon_video_call_press.pngbin0 -> 4512 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_keypad_bg.pngbin0 -> 84873 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_keypad_bg_reduction.pngbin0 -> 7861 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_keypad_press.pngbin0 -> 8381 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_search_bg_01.pngbin0 -> 45741 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_search_bg_02.pngbin0 -> 38978 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_search_field.pngbin0 -> 3311 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_search_icon.pngbin0 -> 5378 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_thumbnail_bg.pngbin0 -> 10710 bytes
-rwxr-xr-xlib/images/dialer_images/C01-3_title_divider.pngbin0 -> 2812 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_00.pngbin0 -> 4225 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_01.pngbin0 -> 1984 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_02.pngbin0 -> 3695 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_03.pngbin0 -> 4293 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_04.pngbin0 -> 2733 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_05.pngbin0 -> 3951 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_06.pngbin0 -> 4704 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_07.pngbin0 -> 2786 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_08.pngbin0 -> 4577 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_09.pngbin0 -> 4648 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_asterisk.pngbin0 -> 2922 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_auto_answer.pngbin0 -> 3389 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_mute.pngbin0 -> 3204 bytes
-rwxr-xr-xlib/images/dialer_images/keypad/C01-3_keypad_number_sharp.pngbin0 -> 3155 bytes
-rw-r--r--lib/images/phoneug_images/00_button_icon_expand_closed.pngbin0 -> 3204 bytes
-rw-r--r--lib/images/phoneug_images/00_button_icon_expand_opened.pngbin0 -> 3250 bytes
-rwxr-xr-xlib/images/phoneug_images/00_button_plus.pngbin0 -> 3119 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_contacts.pngbin0 -> 999 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_create.pngbin0 -> 742 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_dialer.pngbin0 -> 891 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_edit.pngbin0 -> 1262 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_favorite.pngbin0 -> 1136 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_logs.pngbin0 -> 1476 bytes
-rw-r--r--lib/images/phoneug_images/01_controlbar_icon_save.pngbin0 -> 1063 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_btn_icon_call_dim.pngbin0 -> 3253 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_btn_icon_message_dim.pngbin0 -> 3341 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_btn_icon_video_call_dim.pngbin0 -> 3173 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_circle_button.pngbin0 -> 13968 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_circle_button_press.pngbin0 -> 15848 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_controlbar_icon_all.pngbin0 -> 450 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_controlbar_icon_create.pngbin0 -> 3625 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_controlbar_icon_delete.pngbin0 -> 572 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_controlbar_icon_missed_call.pngbin0 -> 774 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_controlbar_icon_view_block.pngbin0 -> 4308 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_controlbar_icon_view_contacts.pngbin0 -> 999 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_icon_Blocked(Auto-rejected).pngbin0 -> 3237 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_icon_Blocked.pngbin0 -> 4363 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_icon_call_blocked.pngbin0 -> 978 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_icon_dialed.pngbin0 -> 3055 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_icon_message_blocked.pngbin0 -> 1423 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_icon_missed-call.pngbin0 -> 3119 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_icon_received.pngbin0 -> 3043 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_icon_rejected.pngbin0 -> 3252 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-4_list_icon_call.pngbin0 -> 3218 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_list_icon_mms.pngbin0 -> 3355 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_list_icon_sms.pngbin0 -> 3212 bytes
-rw-r--r--lib/images/phoneug_images/C01-4_list_icon_vt-call.pngbin0 -> 3094 bytes
-rwxr-xr-xlib/images/phoneug_images/C01-5_icon_voicecall.pngbin0 -> 3572 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_call.pngbin0 -> 3361 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_call_dim.pngbin0 -> 3357 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_call_press.pngbin0 -> 3332 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_delete.pngbin0 -> 3448 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_delete_dim.pngbin0 -> 3379 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_delete_press.pngbin0 -> 3448 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_message.pngbin0 -> 3132 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_message_dim.pngbin0 -> 3122 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_message_press.pngbin0 -> 3139 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_videocall.pngbin0 -> 3641 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_videocall_dim.pngbin0 -> 3677 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_button_icon_videocall_press.pngbin0 -> 3670 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_circle_icon_call.pngbin0 -> 5191 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_circle_icon_call_press.pngbin0 -> 3763 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_circle_icon_sms.pngbin0 -> 3686 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_circle_icon_sms_press.pngbin0 -> 3311 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_circle_icon_vt-call.pngbin0 -> 6325 bytes
-rwxr-xr-xlib/images/phoneug_images/C02_circle_icon_vt-call_press.pngbin0 -> 4260 bytes
-rw-r--r--lib/images/phoneug_images/C02_icon_call.pngbin0 -> 3294 bytes
-rw-r--r--lib/images/phoneug_images/C02_icon_chat_on.pngbin0 -> 3392 bytes
-rw-r--r--lib/images/phoneug_images/C02_icon_filetransfer.pngbin0 -> 3382 bytes
-rw-r--r--lib/images/phoneug_images/C02_icon_message.pngbin0 -> 3330 bytes
-rw-r--r--lib/images/phoneug_images/C02_icon_video_call.pngbin0 -> 3159 bytes
-rw-r--r--lib/images/phoneug_images/caller_ID_default_70x70_man.pngbin0 -> 5345 bytes
-rwxr-xr-xlib/images/phoneug_images/camera_mode_shutter_icon.pngbin0 -> 2249 bytes
-rw-r--r--lib/images/phoneug_images/phone.pngbin0 -> 8211 bytes
-rwxr-xr-xlib/list/CMakeLists.txt18
-rw-r--r--lib/list/contacts-list-efl.xml29
-rwxr-xr-xlib/list/ct-group-edit-view.h23
-rwxr-xr-xlib/list/ct-group-view.c1270
-rwxr-xr-xlib/list/ct-list-contact-view.c995
-rwxr-xr-xlib/list/ct-list-contact-view.h23
-rwxr-xr-xlib/list/ct-list-edit-view.c656
-rwxr-xr-xlib/list/ct-list-edit-view.h29
-rwxr-xr-xlib/list/ct-list-main.c608
-rwxr-xr-xlib/list/ct-list-utils.c866
-rwxr-xr-xlib/list/ct-list-utils.h31
-rwxr-xr-xlib/list/ct-list-view-ug.c691
-rwxr-xr-xlib/list/ct-list-view-ug.h27
-rwxr-xr-xlib/list/include/ct-list.h115
-rwxr-xr-xlib/log/CMakeLists.txt20
-rwxr-xr-xlib/log/include/phone-log.h111
-rwxr-xr-xlib/log/ph-log-check-view.c324
-rwxr-xr-xlib/log/ph-log-check-view.h29
-rwxr-xr-xlib/log/ph-log-detail-view.c1153
-rwxr-xr-xlib/log/ph-log-detail-view.h51
-rwxr-xr-xlib/log/ph-log-main-view.c1833
-rwxr-xr-xlib/log/ph-log-main-view.h28
-rwxr-xr-xlib/log/ph-log-main.c300
-rwxr-xr-xlib/log/ph-log-utils.c54
-rwxr-xr-xlib/log/ph-log-utils.h25
-rwxr-xr-xlib/ph-front/CMakeLists.txt14
-rwxr-xr-xlib/ph-front/include/ph-front.h74
-rwxr-xr-xlib/ph-front/ph-front-main.c193
-rwxr-xr-xlib/ph-front/ph-front-view.c574
-rwxr-xr-xlib/ph-front/ph-front-view.h24
-rw-r--r--lib/ph-front/phone-tabui-efl.xml29
-rwxr-xr-xlib/settings/CMakeLists.txt13
-rw-r--r--lib/settings/contacts-settings-efl.xml29
-rwxr-xr-xlib/settings/ct-setting-main.c157
-rwxr-xr-xlib/settings/ct-setting-view.c1377
-rwxr-xr-xlib/settings/ct-setting-view.h63
-rw-r--r--lib/settings/mfc_option0
-rwxr-xr-xlib/speed/CMakeLists.txt16
-rwxr-xr-xlib/speed/include/phone-speed.h25
-rwxr-xr-xlib/speed/ph-speeddial-main.c203
-rwxr-xr-xlib/speed/ph-speeddial-view.c588
-rwxr-xr-xlib/speed/ph-speeddial-view.h43
-rw-r--r--lib/speed/speeddial-efl.xml29
-rw-r--r--libug-phone-efl.manifest11
-rw-r--r--org.tizen.contacts-appservice.manifest8
-rw-r--r--org.tizen.contacts-viewer.manifest13
-rw-r--r--org.tizen.contacts.manifest35
-rw-r--r--org.tizen.dialer.manifest12
-rw-r--r--org.tizen.phone.manifest32
-rwxr-xr-xpackaging/phone.spec200
-rw-r--r--phone/CMakeLists.txt12
-rwxr-xr-xphone/icon_phone.pngbin0 -> 9195 bytes
-rwxr-xr-xphone/org.tizen.phone.xml69
-rwxr-xr-xphone/phone.c333
-rwxr-xr-xpo/CMakeLists.txt23
-rwxr-xr-xpo/POTFILES.in3
-rwxr-xr-xpo/ar.po1601
-rwxr-xr-xpo/az.po2019
-rwxr-xr-xpo/bg.po2022
-rwxr-xr-xpo/ca.po2020
-rwxr-xr-xpo/cs.po2019
-rwxr-xr-xpo/da.po2019
-rwxr-xr-xpo/de_DE.po2021
-rwxr-xr-xpo/el_GR.po2021
-rwxr-xr-xpo/en.po2019
-rwxr-xr-xpo/en_PH.po2019
-rwxr-xr-xpo/en_US.po2019
-rwxr-xr-xpo/es_ES.po2020
-rwxr-xr-xpo/es_US.po2001
-rwxr-xr-xpo/et.po2020
-rwxr-xr-xpo/eu.po2020
-rwxr-xr-xpo/fi.po2022
-rwxr-xr-xpo/fr_CA.po2020
-rwxr-xr-xpo/fr_FR.po2020
-rwxr-xr-xpo/ga.po2024
-rwxr-xr-xpo/gl.po2020
-rwxr-xr-xpo/hi.po2020
-rwxr-xr-xpo/hr.po2020
-rwxr-xr-xpo/hu.po2022
-rwxr-xr-xpo/hy.po2020
-rwxr-xr-xpo/is.po2020
-rwxr-xr-xpo/it_IT.po2028
-rwxr-xr-xpo/ja_JP.po2020
-rwxr-xr-xpo/ka.po2021
-rwxr-xr-xpo/kk.po2020
-rwxr-xr-xpo/ko_KR.po2020
-rwxr-xr-xpo/lt.po2020
-rwxr-xr-xpo/lv.po2020
-rwxr-xr-xpo/mk.po2020
-rwxr-xr-xpo/nb.po2020
-rwxr-xr-xpo/nl_NL.po2020
-rwxr-xr-xpo/phone.pot1664
-rwxr-xr-xpo/pl.po2020
-rwxr-xr-xpo/pt_BR.po2020
-rwxr-xr-xpo/pt_PT.po2022
-rwxr-xr-xpo/ro.po2020
-rwxr-xr-xpo/ru_RU.po2023
-rwxr-xr-xpo/sk.po2020
-rwxr-xr-xpo/sl.po2020
-rwxr-xr-xpo/sr.po2020
-rwxr-xr-xpo/sv.po2020
-rwxr-xr-xpo/tr_TR.po2022
-rwxr-xr-xpo/uk.po2021
-rwxr-xr-xpo/update-po.sh59
-rwxr-xr-xpo/uz.po2020
-rwxr-xr-xpo/zh_CN.po1602
-rwxr-xr-xpo/zh_HK.po1602
-rwxr-xr-xpo/zh_SG.po2020
-rwxr-xr-xpo/zh_TW.po2020
354 files changed, 158676 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..c85e681
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,72 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(phone C)
+
+SET(VENDOR "tizen")
+SET(PACKAGE ${PROJECT_NAME})
+SET(PKGNAME "org.${VENDOR}.${PACKAGE}")
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(BINDIR "${PREFIX}/bin")
+SET(RESDIR "${PREFIX}/res")
+SET(DATADIR "${PREFIX}/data")
+SET(LOCALEDIR "/usr/ug/res/locale")
+SET(EDC_SRC_DIR "${CMAKE_SOURCE_DIR}/lib/edc")
+SET(EDJDIR "/usr/ug/res/edje/ug-${PACKAGE}")
+SET(IMGDIR "/usr/ug/res/images/ug-${PACKAGE}")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.6.63.21")
+
+SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+SET(CMAKE_INSTALL_RPATH "/usr/ug/lib")
+SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED appcore-efl ui-gadget-1 contacts-service2 ecore-x evas ecore ecore-input edje eina syspopup-caller capi-appfw-application capi-system-runtime-info accounts-svc capi-content-media-content capi-appfw-app-manager capi-system-info notification)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "")
+SET(CMAKE_C_FLAGS_RELEASE "")
+
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--hash-style=both -Wl,--as-needed")
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--hash-style=both -Wl,--as-needed")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
+ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DEDJDIR=\"${EDJDIR}\"")
+ADD_DEFINITIONS("-DIMGDIR=\"${IMGDIR}\"")
+ADD_DEFINITIONS("-DUGDATADIR=\"${UGDATADIR}\"")
+
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/images/phoneug_images/ DESTINATION ${IMGDIR})
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/images/contact_images/ DESTINATION ${IMGDIR})
+INSTALL(DIRECTORY DESTINATION ${DATADIR})
+
+ADD_SUBDIRECTORY(lib)
+ADD_SUBDIRECTORY(phone)
+ADD_SUBDIRECTORY(contacts)
+ADD_SUBDIRECTORY(contacts-viewer)
+ADD_SUBDIRECTORY(contacts-appservice)
+
+# i18n
+ADD_SUBDIRECTORY(po)
+
diff --git a/LICENSE.flora b/LICENSE.flora
new file mode 100755
index 0000000..d2d96b4
--- /dev/null
+++ b/LICENSE.flora
@@ -0,0 +1,76 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Flora License, Version 1.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://floralicense.org/license/
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
diff --git a/NOTICE b/NOTICE
new file mode 100755
index 0000000..221b55e
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE.flora file for Flora License, Version 1 terms and conditions.
diff --git a/contacts-appservice/CMakeLists.txt b/contacts-appservice/CMakeLists.txt
new file mode 100644
index 0000000..e32d970
--- /dev/null
+++ b/contacts-appservice/CMakeLists.txt
@@ -0,0 +1,29 @@
+SET(APPSERVICE contacts-appservice)
+
+SET(SRCS contacts-appservice.c)
+
+SET(APPSERVICE_PKGNAME "org.${VENDOR}.${APPSERVICE}")
+SET(APPSERVICE_PREFIX "/usr/apps/${APPSERVICE_PKGNAME}")
+SET(APPSERVICE_BINDIR "${APPSERVICE_PREFIX}/bin")
+SET(APPSERVICE_RESDIR "${APPSERVICE_PREFIX}/res")
+SET(APPSERVICE_DATADIR "${APPSERVICE_PREFIX}/data")
+
+ADD_DEFINITIONS("-DAPPSERVICE_PACKAGE=\"${APPSERVICE}\"")
+ADD_DEFINITIONS("-DAPPSERVICE_PACKAGE_NAME=\"${APPSERVICE_PKGNAME}\"")
+
+ADD_EXECUTABLE(${APPSERVICE} ${SRCS})
+SET_TARGET_PROPERTIES(${APPSERVICE} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -fpie")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/common/include)
+
+pkg_check_modules(appservice_pkgs REQUIRED appcore-efl ecore-x capi-appfw-application ui-gadget-1 utilX)
+FOREACH(flag ${appservice_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+TARGET_LINK_LIBRARIES(${APPSERVICE} ${appservice_pkgs_LDFLAGS})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/contacts-appservice/org.tizen.contacts-appservice.xml DESTINATION "/usr/share/packages")
+INSTALL(TARGETS ${APPSERVICE} DESTINATION ${APPSERVICE_BINDIR})
+INSTALL(DIRECTORY DESTINATION ${APPSERVICE_DATADIR})
+
+# install icon
+INSTALL(FILES icon_${APPSERVICE}.png DESTINATION "/usr/share/icons/default/small" RENAME "${APPSERVICE_PKGNAME}.png")
diff --git a/contacts-appservice/contacts-appservice.c b/contacts-appservice/contacts-appservice.c
new file mode 100755
index 0000000..a612ac7
--- /dev/null
+++ b/contacts-appservice/contacts-appservice.c
@@ -0,0 +1,351 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdio.h>
+#include <aul.h>
+#include <Ecore_X.h>
+#include <ui-gadget.h>
+#include <app.h>
+#include <utilX.h>
+
+#include "phone.h"
+
+#if !defined(APPSERVICE_PACKAGE)
+# define APPSERVICE_PACKAGE "contacts-appservice"
+#endif
+
+#define CONTACTS_LIST_UG "contacts-list-efl"
+#define CONTACTS_DETAILS_UG "contacts-details-efl"
+
+#define CT_LIST_UG_SELECT_CONTACT_ADD_TO_HOME "15"
+#define CT_LIST_UG_SELECT_GROUP_ADD_TO_HOME "16"
+#define CT_DETAILS_UG_REQUEST_ADD_WITH_NUM "22"
+#define CT_DETAILS_UG_REQUEST_DETAIL "0"
+
+#define CT_APPSERVICE_REQUEST_DETAIL 0
+#define CT_APPSERVICE_ADD_CONTACT_LIVEBOX 1
+#define CT_APPSERVICE_ADD_GROUP_LIVEBOX 2
+#define CT_APPSERVICE_ADD_WITH_NUM 22
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *layout;
+ ui_gadget_h ug;
+ Ecore_Event_Handler *event_handler;
+} ct_app_service_data;
+
+static Evas_Object* appservice_create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_conformant_set(eo, EINA_TRUE);
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+#else
+ elm_win_borderless_set(eo, EINA_TRUE);
+#endif
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
+ elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
+ }
+
+ return eo;
+}
+
+static Eina_Bool __appservice_hard_key_down(void *data, int type, void *event_info)
+{
+ Ecore_Event_Key *ev = event_info;
+ if (0 == strcmp(ev->keyname, KEY_HOME))
+ elm_exit();
+ return ECORE_CALLBACK_DONE;
+}
+
+static void __appservice_grab_key(ct_app_service_data *cappservice_d)
+{
+ Ecore_X_Window xwin;
+ Ecore_X_Display *disp = NULL;
+
+ disp = ecore_x_display_get();
+ xwin = elm_win_xwindow_get(cappservice_d->win);
+ utilx_grab_key(disp, xwin, KEY_HOME, TOP_POSITION_GRAB);
+ cappservice_d->event_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __appservice_hard_key_down, cappservice_d);
+}
+
+static void __appservice_ungrab_key(ct_app_service_data *cappservice_d)
+{
+ Ecore_X_Window xwin;
+ Ecore_X_Display *disp = NULL;
+
+ disp = ecore_x_display_get();
+ xwin = elm_win_xwindow_get(cappservice_d->win);
+ utilx_ungrab_key(disp, xwin, KEY_HOME);
+ if (cappservice_d->event_handler) {
+ ecore_event_handler_del(cappservice_d->event_handler);
+ cappservice_d->event_handler = NULL;
+ }
+}
+
+static bool appservice_create(void *data)
+{
+ PH_FN_CALL;
+ ct_app_service_data *cappservice_d = data;
+ Evas_Object *win;
+
+ /* create window */
+ win = appservice_create_win(APPSERVICE_PACKAGE);
+ p_retvm_if(NULL == win, false, "ctapp_create_win() Failed");
+ cappservice_d->win = win;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ evas_object_show(win);
+
+ UG_INIT_EFL(cappservice_d->win, UG_OPT_INDICATOR_ENABLE);
+ __appservice_grab_key(cappservice_d);
+
+ return true;
+}
+
+static void appservice_terminate(void *data)
+{
+ PH_FN_CALL;
+ ct_app_service_data *cappservice_d = data;
+
+ __appservice_ungrab_key(cappservice_d);
+
+ if (cappservice_d->ug)
+ ug_destroy(cappservice_d->ug);
+
+ if (cappservice_d->win)
+ evas_object_del(cappservice_d->win);
+
+ return;
+}
+
+static void appservice_pause(void *data)
+{
+ PH_FN_CALL;
+ return;
+}
+
+static void appservice_resume(void *data)
+{
+ PH_FN_CALL;
+ return;
+}
+
+static void appservice_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+{
+ ct_app_service_data *cappservice_d = priv;
+ Evas_Object *base;
+
+ if (!ug)
+ return;
+
+ base = ug_get_layout(ug);
+ if (!base) {
+ ERR("ug_get_layout() return NULL");
+ ug_destroy(ug);
+ return;
+ }
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ ug_disable_effect(ug);
+ elm_object_content_set(cappservice_d->layout, base);
+ evas_object_show(base);
+}
+
+static void appservice_ug_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ ct_app_service_data *cappservice_d = priv;
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ ug_destroy(ug);
+ cappservice_d->ug = NULL;
+
+ elm_exit();
+}
+
+static void appservice_lauch_list_ug(ct_app_service_data *cappservice_d, int type)
+{
+ service_h service;
+ struct ug_cbs cbs = {0};
+
+ p_retm_if(NULL == cappservice_d, "parameter(cappservice_d) is NULL");
+
+ service_create(&service);
+
+ if (2 == type)
+ service_add_extra_data(service, "type", CT_LIST_UG_SELECT_GROUP_ADD_TO_HOME);
+ else
+ service_add_extra_data(service, "type", CT_LIST_UG_SELECT_CONTACT_ADD_TO_HOME);
+
+ cbs.layout_cb = appservice_ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = appservice_ug_destroy_cb;
+ cbs.priv = cappservice_d;
+
+ cappservice_d->ug = ug_create(NULL, CONTACTS_LIST_UG, UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
+}
+
+static void appservice_launch_details_ug(ct_app_service_data *cappservice_d, const char *type, char *val)
+{
+ service_h service;
+ struct ug_cbs cbs = {0};
+
+ p_retm_if(NULL == cappservice_d, "parameter(cappservice_d) is NULL");
+
+ service_create(&service);
+ if (type == CT_APPSERVICE_REQUEST_DETAIL) {
+ service_add_extra_data(service, "type", CT_DETAILS_UG_REQUEST_DETAIL);
+ PH_DBG("val=%s",val);
+ if (val && *val)
+ service_add_extra_data(service, "person_id", val);
+ }
+ else if (type == CT_APPSERVICE_ADD_WITH_NUM) {
+ service_add_extra_data(service, "type", CT_DETAILS_UG_REQUEST_ADD_WITH_NUM);
+ if (val && *val)
+ service_add_extra_data(service, "ct_num", val);
+ }
+
+ cbs.layout_cb = appservice_ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = appservice_ug_destroy_cb;
+ cbs.priv = cappservice_d;
+
+ cappservice_d->ug = ug_create(NULL, CONTACTS_DETAILS_UG, UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
+
+}
+
+static Evas_Object* __appservice_create_base_layout(Evas_Object *parent, bool is_fullview)
+{
+ Evas_Object *base;
+
+ base = elm_layout_add(parent);
+ p_retvm_if(NULL == base, NULL, "elm_layout_add() Failed");
+ if (is_fullview)
+ elm_layout_theme_set(base, "layout", "application", "default");
+ else
+ elm_layout_theme_set(base, "layout", "application", "noindicator");
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ elm_object_content_set(parent, base);
+
+ return base;
+}
+
+static void __appservice_create_bg(Evas_Object *win)
+{
+ Evas_Object *bg;
+
+ bg = elm_bg_add(win);
+ p_retm_if(NULL == bg, "elm_bg_add() return NULL");
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(win, "elm.swallow.bg", bg);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+}
+
+static Evas_Object* __appservice_create_conformant(Evas_Object *win)
+{
+ Evas_Object *conform;
+
+ conform = elm_conformant_add(win);
+ p_retvm_if(NULL == conform, NULL, "elm_conformant_add() Failed");
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, conform);
+ evas_object_show(conform);
+
+ return conform;
+}
+
+static void __appservice_create_content(ct_app_service_data *cappservice_data)
+{
+ Evas_Object *bg = NULL;
+ Evas_Object *conform = NULL;
+
+ __appservice_create_bg(cappservice_data->win);
+ conform = __appservice_create_conformant(cappservice_data->win);
+ cappservice_data->layout = __appservice_create_base_layout(conform, true);
+}
+
+
+static void appservice_service(service_h service, void *data)
+{
+ PH_FN_CALL;
+ char *val = NULL;
+ int ret;
+ int type;
+ ct_app_service_data *cappservice_d = data;
+
+ __appservice_create_content(cappservice_d);
+
+ ret = service_get_extra_data(service, "type", &val);
+ if (SERVICE_ERROR_NONE != ret) {
+ ERR("service_get_operation is failed(%d)", ret);
+ elm_exit();
+ return;
+ }
+
+ if (val && *val) {
+ char *extra_data = NULL;
+ type = atoi(val);
+ free(val);
+
+ if (type == CT_APPSERVICE_ADD_CONTACT_LIVEBOX || type == CT_APPSERVICE_ADD_GROUP_LIVEBOX)
+ appservice_lauch_list_ug(cappservice_d, type);
+ else if (type == CT_APPSERVICE_REQUEST_DETAIL) {
+ ret = service_get_extra_data(service, "person_id", &extra_data);
+ appservice_launch_details_ug(cappservice_d,CT_APPSERVICE_REQUEST_DETAIL, extra_data);
+ free(extra_data);
+ }
+ else if (type == CT_APPSERVICE_ADD_WITH_NUM) {
+ ret = service_get_extra_data(service, "ct_num", &extra_data);
+ appservice_launch_details_ug(cappservice_d, CT_APPSERVICE_ADD_WITH_NUM, extra_data);
+ free(extra_data);
+ }
+ else {
+ ERR("Invalid type(%d)", type);
+ elm_exit();
+ return;
+ }
+ }
+ elm_win_activate(cappservice_d->win);
+ return;
+}
+
+API int main(int argc, char *argv[])
+{
+ PH_FN_CALL;
+
+ ct_app_service_data ad = {0};
+ app_event_callback_s event_callback = {0,};
+ event_callback.create = appservice_create;
+ event_callback.terminate = appservice_terminate;
+ event_callback.pause = appservice_pause;
+ event_callback.resume = appservice_resume;
+ event_callback.service = appservice_service;
+ event_callback.low_memory = NULL;
+ event_callback.low_battery = NULL;
+ event_callback.device_orientation = NULL;
+ event_callback.language_changed = NULL;
+ event_callback.region_format_changed = NULL;
+
+ return app_efl_main(&argc, &argv, &event_callback, &ad);
+}
diff --git a/contacts-appservice/icon_contacts-appservice.png b/contacts-appservice/icon_contacts-appservice.png
new file mode 100644
index 0000000..900dcde
--- /dev/null
+++ b/contacts-appservice/icon_contacts-appservice.png
Binary files differ
diff --git a/contacts-appservice/org.tizen.contacts-appservice.xml b/contacts-appservice/org.tizen.contacts-appservice.xml
new file mode 100644
index 0000000..0cdf657
--- /dev/null
+++ b/contacts-appservice/org.tizen.contacts-appservice.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.contacts-appservice" version="0.1.2" install-location="internal-only">
+ <label>Contacts-Appservice</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>Contacts-appservice Application</description>
+ <ui-application appid="org.tizen.contacts-appservice" exec="/usr/apps/org.tizen.contacts-appservice/bin/contacts-appservice" nodisplay="true" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.contacts.png</icon>
+ <label>Contacts-Appservice</label>
+ <label xml:lang="en-us">Contacts-Appservice</label>
+ <label xml:lang="nl-nl">Contacts-Appservice</label>
+ <label xml:lang="de-de">Contacts-Appservice</label>
+ <label xml:lang="en-gb">Contacts-Appservice</label>
+ <label xml:lang="zh-hk">Contacts-Appservice</label>
+ <label xml:lang="zh-cn">Contacts-Appservice</label>
+ <label xml:lang="ru-ru">Contacts-Appservice</label>
+ <label xml:lang="zh-tw">Contacts-Appservice</label>
+ <label xml:lang="ja-jp">Contacts-Appservice</label>
+ <label xml:lang="es-es">Contacts-Appservice</label>
+ <label xml:lang="el-gr">Contacts-Appservice</label>
+ <label xml:lang="it-it">Contacts-Appservice</label>
+ <label xml:lang="tr-tr">Contacts-Appservice</label>
+ <label xml:lang="pt-pt">Contacts-Appservice</label>
+ <label xml:lang="fr-fr">Contacts-Appservice</label>
+ <label xml:lang="ko-kr">Contacts-Appservice</label>
+ </ui-application>
+</manifest>
diff --git a/contacts-viewer/CMakeLists.txt b/contacts-viewer/CMakeLists.txt
new file mode 100644
index 0000000..718471f
--- /dev/null
+++ b/contacts-viewer/CMakeLists.txt
@@ -0,0 +1,26 @@
+SET(VIEWER contacts-viewer)
+
+SET(SRCS contacts-viewer.c)
+
+SET(VV_PKGNAME "org.${VENDOR}.${VIEWER}")
+SET(VV_PREFIX "/usr/apps/${VV_PKGNAME}")
+SET(VV_BINDIR "${VV_PREFIX}/bin")
+SET(VV_RESDIR "${VV_PREFIX}/res")
+SET(VV_DATADIR "${VV_PREFIX}/data")
+
+ADD_DEFINITIONS("-DCV_PACKAGE=\"${VIEWER}\"")
+ADD_DEFINITIONS("-DCV_PACKAGE_NAME=\"${VV_PKGNAME}\"")
+
+ADD_EXECUTABLE(${VIEWER} ${SRCS})
+SET_TARGET_PROPERTIES(${VIEWER} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -fpie")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/details/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/list/include)
+TARGET_LINK_LIBRARIES(${VIEWER} ug-contacts-details-efl ug-contacts-list-efl "-pie")
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/contacts-viewer/org.tizen.contacts-viewer.xml DESTINATION "/usr/share/packages")
+INSTALL(TARGETS ${VIEWER} DESTINATION ${VV_BINDIR})
+INSTALL(DIRECTORY DESTINATION ${VV_DATADIR})
+
+# install icon
+INSTALL(FILES icon_${VIEWER}.png DESTINATION "/usr/share/icons/default/small" RENAME "${VV_PKGNAME}.png")
diff --git a/contacts-viewer/contacts-viewer.c b/contacts-viewer/contacts-viewer.c
new file mode 100755
index 0000000..2cebc25
--- /dev/null
+++ b/contacts-viewer/contacts-viewer.c
@@ -0,0 +1,552 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <stdio.h>
+#include <aul.h>
+#include <Ecore_X.h>
+#include <ui-gadget.h>
+#include <app.h>
+
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-list.h"
+
+#if !defined(CV_PACKAGE)
+# define CV_PACKAGE "contacts-viewer"
+#endif
+
+typedef struct {
+ char *path;
+ Evas_Object *win;
+ Evas_Object *content;
+ Evas_Object *popup;
+ Eina_List *list;
+ ph_progress_info *p_info;
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ Evas_Object *icon;
+ Evas_Object *prev_btn;
+#endif
+} ct_viewer_data;
+
+static void cv_win_del(void *data, Evas_Object *obj, void *event)
+{
+ elm_exit();
+}
+
+static Evas_Object* cv_create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+#else
+ elm_win_borderless_set(eo, EINA_TRUE);
+#endif
+ evas_object_smart_callback_add(eo, "delete,request", cv_win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
+ elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
+ }
+ elm_win_conformant_set(eo, EINA_TRUE);
+ return eo;
+}
+
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+static Evas_Object* __set_win_icon(ct_viewer_data *ad)
+{
+ Evas_Object *image = evas_object_image_add(evas_object_evas_get(ad->win));
+ evas_object_image_file_set(image, "/usr/share/icons/default/small/org.tizen.contacts-viewer.png", NULL);
+ elm_win_icon_object_set(ad->win, image);
+
+ return image;
+}
+
+static void __win_profile_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if(data == NULL)
+ return;
+
+ ct_viewer_data *ad = data;
+ Evas_Object *navi = evas_object_data_get(ad->win, "naviframe");
+ const char *profile = elm_config_profile_get();
+ if(!strcmp(profile, "desktop")) {
+ Elm_Object_Item *navi_item = elm_naviframe_bottom_item_get(navi);
+ ad->prev_btn = elm_object_item_part_content_unset(navi_item, "prev_btn");
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE);
+ if(!ad->icon)
+ ad->icon = __set_win_icon(ad);
+ }
+ else {
+ Elm_Object_Item *navi_item = elm_naviframe_bottom_item_get(navi);
+ if (ad->prev_btn) {
+ elm_object_item_part_content_set(navi_item, "prev_btn", ad->prev_btn);
+ ad->prev_btn = NULL;
+ }
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+ }
+}
+#endif // _PHONE_CONTACTS_DESKTOP_MODE_
+static bool viewer_create(void *data)
+{
+ int rotate;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_viewer_data *cviewer_d = data;
+ Evas_Object *win;
+
+ err = contacts_connect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
+
+ /* create window */
+ win = cv_create_win(CV_PACKAGE);
+ p_retvm_if(NULL == win, false, "ctapp_create_win() Failed");
+ cviewer_d->win = win;
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ evas_object_smart_callback_add(cviewer_d->win, "profile,changed", __win_profile_changed_cb, cviewer_d);
+#endif
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ evas_object_show(win);
+
+ rotate = app_get_device_orientation();
+ elm_win_rotation_with_resize_set(cviewer_d->win, rotate);
+
+ UG_INIT_EFL(cviewer_d->win, UG_OPT_INDICATOR_PORTRAIT_ONLY);
+
+ return true;
+}
+
+static void viewer_terminate(void *data)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_viewer_data *cviewer_d = data;
+
+ if (cviewer_d->p_info) {
+ cviewer_d->p_info->alive = false;
+ pthread_join(cviewer_d->p_info->thread, NULL);
+ ecore_timer_del(cviewer_d->p_info->timer);
+ free(cviewer_d->p_info);
+ }
+
+ free(cviewer_d->path);
+
+ if (cviewer_d->win) {
+ evas_object_data_del(cviewer_d->win, "naviframe");
+ evas_object_del(cviewer_d->win);
+ cviewer_d->win = NULL;
+ }
+
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+
+ return;
+}
+
+static void viewer_pause(void *data)
+{
+ return;
+}
+
+static void viewer_resume(void *data)
+{
+ return;
+}
+
+
+static bool viewer_load_vcard_foreach_cb(contacts_record_h record, void *data)
+{
+ ct_person_list *person_info = NULL;
+ ct_viewer_data *cviewer_d = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ if (NULL == cviewer_d) {
+ ERR("Invalid parameter(cviewer_d is NULL)");
+ return false;
+ }
+
+ if (false == cviewer_d->p_info->alive)
+ return false;
+
+ person_info = calloc(1, sizeof(ct_person_list));
+ if (NULL == person_info) {
+ ERR("calloc() return NULL");
+ cviewer_d->p_info->result = FALSE;
+ if (cviewer_d->p_info->cnt == cviewer_d->p_info->cnt_checked_total)
+ cviewer_d->p_info->completed = true;
+ return false;
+ }
+
+ person_info->id = cviewer_d->p_info->cnt;
+ err = contacts_record_get_str(record, _contacts_contact.display_name, &(person_info->display));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+ person_info->img_loaded = true;
+
+ cviewer_d->list = eina_list_append(cviewer_d->list, person_info);
+ ++cviewer_d->p_info->cnt;
+ return true;
+
+}
+
+static PTHREAD_FN viewer_load_vcard_contacts_thread_fn(void* data)
+{
+ contacts_connect_on_thread();
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_viewer_data *cviewer_d = data;
+
+ err = contacts_vcard_parse_to_contact_foreach(cviewer_d->path, viewer_load_vcard_foreach_cb, cviewer_d);
+ if (CONTACTS_ERROR_NONE != err) {
+ cviewer_d->p_info->result = FALSE;
+ ERR("contacts_svc_vcard_foreach() Failed(%d)", err);
+ }
+ cviewer_d->p_info->completed = true;
+
+ contacts_disconnect_on_thread();
+
+ pthread_exit(NULL);
+}
+
+static inline void viewer_get_filename(char *fullpath, char *dest, int size_dest)
+{
+ char* index;
+ index = strrchr(fullpath, '/');
+ snprintf(dest, size_dest, "%s", index + 1);
+}
+
+static Eina_Bool viewer_load_vcard_timer_cb(void *data)
+{
+ ct_viewer_data *cviewer_d = data;
+
+ p_retvm_if(NULL == cviewer_d , ECORE_CALLBACK_CANCEL, "parameter(ct_viewer_data) is NULL");
+ p_retvm_if(NULL == cviewer_d->p_info , ECORE_CALLBACK_CANCEL, "parameter(ct_viewer_data->p_info) is NULL");
+
+ if (!cviewer_d->p_info->completed) {
+ char count[PH_TEXT_SHORT_LEN];
+ char percent[PH_TEXT_SHORT_LEN];
+ double value = (double)cviewer_d->p_info->cnt / (double)cviewer_d->p_info->cnt_checked_total;
+
+ if (!cviewer_d->p_info->alive) {
+ cviewer_d->p_info->result = FALSE;
+ cviewer_d->p_info->completed = true;
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ elm_progressbar_value_set(cviewer_d->p_info->progressbar, value);
+ snprintf(percent, sizeof(percent), "%d%%", (int)(100.0 * (double)cviewer_d->p_info->cnt/(double)cviewer_d->p_info->cnt_checked_total));
+ snprintf(count, sizeof(count), "%d/%d", cviewer_d->p_info->cnt, cviewer_d->p_info->cnt_checked_total);
+ edje_object_part_text_set(elm_layout_edje_get(cviewer_d->p_info->layout), "elm.text.subtext1", percent);
+ edje_object_part_text_set(elm_layout_edje_get(cviewer_d->p_info->layout), "elm.text.subtext2", count);
+
+ if (cviewer_d->p_info->cnt == cviewer_d->p_info->cnt_checked_total)
+ cviewer_d->p_info->completed = true;
+
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ pthread_join(cviewer_d->p_info->thread, NULL);
+
+ evas_object_del(cviewer_d->popup);
+ cviewer_d->popup = NULL;
+
+ cviewer_d->p_info->timer = NULL;
+
+ if (!cviewer_d->p_info->result) {
+ free(cviewer_d->p_info);
+ cviewer_d->p_info= NULL;
+ elm_exit();
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ cviewer_d->content = ctui_create_vcard_list_view(cviewer_d->win, cviewer_d->list, cviewer_d->path);
+ p_retvm_if(NULL == cviewer_d->content, ECORE_CALLBACK_CANCEL, "ctui_create_vcard_list_view() return NULL");
+
+ free(cviewer_d->p_info);
+ cviewer_d->p_info = NULL;
+
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+static int viewer_load_vcard_contact(ct_viewer_data *cviewer_d)
+{
+ Evas_Object *popup;
+
+ if (cviewer_d->path && *cviewer_d->path) {
+ cviewer_d->content = ctui_contacts_viewer(cviewer_d->win, NULL, 0, cviewer_d->path);
+ if (NULL == cviewer_d->content) {
+ ERR("ctui_contacts_viewer() return NULL");
+ elm_exit();
+ return -1;
+ }
+ }
+ else {
+ popup = phone_show_popup(cviewer_d->win, S_(CT_SYS_POP_ERROR), 1.5);
+ evas_object_smart_callback_add(popup, "timeout", cv_win_del, NULL);
+ }
+ return 0;
+}
+
+static int viewer_load_vcard_contacts(ct_viewer_data *cviewer_d, int cnt_vcard)
+{
+ int ret;
+ char title[PH_TEXT_MAX_LEN];
+ char filepath[PH_TEXT_MAX_LEN];
+ ph_progress_info *p_info;
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ if (NULL == p_info) {
+ ERR("calloc() return NULL");
+ elm_exit();
+ return -1;
+ }
+
+ cviewer_d->p_info = p_info;
+ cviewer_d->list = NULL;
+
+ p_info->cnt = 0;
+ p_info->cnt_checked_total = cnt_vcard;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->completed = false;
+
+ viewer_get_filename(cviewer_d->path, filepath, sizeof(filepath));
+ snprintf(title, sizeof(title), "%s<br>%s", T_(CT_GET_TEXT_BASIC, CTTEXT_LOADING_VCARD), filepath);
+
+ ret = pthread_create(&p_info->thread, NULL, viewer_load_vcard_contacts_thread_fn, cviewer_d);
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ cviewer_d->p_info = NULL;
+ elm_exit();
+ return -1;
+ }
+ p_info->timer = ecore_timer_add(0.2, viewer_load_vcard_timer_cb, cviewer_d);
+ if (NULL == p_info->timer) {
+ ERR("ecore_timer_add() return NULL");
+
+ p_info->alive = false;
+ pthread_join(p_info->thread, NULL);
+
+ free(p_info);
+ cviewer_d->p_info = NULL;
+ elm_exit();
+ return -1;
+ }
+ cviewer_d->popup = phone_progressbar_popup(cviewer_d->win, p_info, title);
+ return 0;
+}
+
+static void viewer_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_exit();
+}
+
+static bool __viewer_is_valid_person(int person_id)
+{
+ contacts_error_e err;
+ contacts_record_h record = NULL;
+ err = contacts_db_get_record(_contacts_person._uri, person_id, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ contacts_record_destroy(record, true);
+ return false;
+ }
+ contacts_record_destroy(record, true);
+ return true;
+}
+
+static void viewer_service(service_h service, void *data)
+{
+ int ret;
+ int person_id;
+ char *val = NULL;
+ char val_vcard[PH_TEXT_MAX_LEN];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_viewer_data *cviewer_d = data;
+
+ if (NULL == cviewer_d->win) {
+ ERR("win is NULL");
+ elm_exit();
+ return;
+ }
+
+ if (cviewer_d->p_info) {
+ cviewer_d->p_info->alive = false;
+ pthread_join(cviewer_d->p_info->thread, NULL);
+ ecore_timer_del(cviewer_d->p_info->timer);
+ free(cviewer_d->p_info);
+ cviewer_d->p_info = NULL;
+ }
+
+ if (cviewer_d->content) {
+ evas_object_del(cviewer_d->content);
+ cviewer_d->content = NULL;
+ }
+
+ ret = service_get_extra_data(service, "person_id", &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_operation is failed(%d)", ret);
+
+ if (val && *val) {
+ person_id = atoi(val);
+ if (person_id <= 0) {
+ ERR("service value(person_id) is wrong(%d)", person_id);
+ }
+ else if(false == __viewer_is_valid_person(person_id)) {
+ Evas_Object *popup;
+ popup = elm_popup_add(cviewer_d->win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS));
+ elm_popup_timeout_set(popup, 2.0);
+ evas_object_smart_callback_add(popup, "timeout", viewer_popup_hide_cb, NULL);
+ evas_object_show(popup);
+ }
+ else {
+ cviewer_d->content = ctui_contacts_viewer(cviewer_d->win, NULL, person_id, NULL);
+ if (NULL == cviewer_d->content) {
+ Evas_Object *popup;
+ ERR("ctui_contacts_viewer() return NULL");
+ popup = elm_popup_add(cviewer_d->win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, S_(PH_SYS_POP_FAILED));
+ elm_popup_timeout_set(popup, 2.0);
+ evas_object_smart_callback_add(popup, "timeout", viewer_popup_hide_cb, NULL);
+
+ evas_object_show(popup);
+ }
+ free(val);
+ }
+ }
+ else {
+ int cnt_vcard = 0;
+ ret = service_get_uri(service, &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_uri is failed(%d)", ret);
+
+ val_vcard[0] = '\0';
+
+ if (val && *val) {
+ if (0 == strncmp(val, "file://", 7))
+ snprintf(val_vcard, sizeof(val_vcard), "%s", val+7);
+ else
+ snprintf(val_vcard, sizeof(val_vcard), "%s", val);
+ }
+ else {
+ ret = service_get_extra_data(service, AUL_K_MIME_CONTENT, &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+ if (val && *val)
+ snprintf(val_vcard, sizeof(val_vcard), "%s", val);
+ }
+ free(val);
+
+ if ('\0' == *val_vcard) {
+ ERR("service value is NULL");
+ elm_exit();
+ return;
+ }
+
+ free(cviewer_d->path);
+ cviewer_d->path = strdup(val_vcard);
+ err = contacts_vcard_get_entity_count(cviewer_d->path, &cnt_vcard);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_vcard_get_entity_count() Failed(%d)", err);
+
+ if (cnt_vcard < 1) {
+ ERR("invalid vcard(%s)", cviewer_d->path);
+ elm_exit();
+ return;
+ }
+ else if (1 == cnt_vcard) {
+ ret = viewer_load_vcard_contact(cviewer_d);
+ if (0 != ret) {
+ ERR("viewer_load_vcard_contact() Failed(%d)", ret);
+ elm_exit();
+ return;
+ }
+ }
+ else {
+ ret = viewer_load_vcard_contacts(cviewer_d, cnt_vcard);
+ if (0 != ret) {
+ ERR("viewer_load_vcard_contact() Failed(%d)", ret);
+ elm_exit();
+ return;
+ }
+ }
+ }
+ elm_win_activate(cviewer_d->win);
+ return;
+}
+
+static void viewer_device_orientation(app_device_orientation_e orientation, void *data)
+{
+ PH_FN_CALL;
+ int rotate;
+ ct_viewer_data *cviewer_d = data;
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ const char *config = elm_config_profile_get();
+ if(!strcmp(config, "desktop"))
+ return;
+#endif
+ p_retm_if(cviewer_d == NULL || cviewer_d->win == NULL, "Paramter is NULL");
+
+ switch (orientation) {
+ case APP_DEVICE_ORIENTATION_0:
+ rotate = 0;
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
+ break;
+ case APP_DEVICE_ORIENTATION_180:
+ rotate = 180;
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
+ break;
+ case APP_DEVICE_ORIENTATION_270:
+ rotate = 270;
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
+ break;
+ case APP_DEVICE_ORIENTATION_90:
+ rotate = 90;
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
+ break;
+ default:
+ rotate = -1;
+ break;
+ }
+
+ if (0 <= rotate)
+ elm_win_rotation_with_resize_set(cviewer_d->win, rotate);
+
+ return;
+}
+
+API int main(int argc, char *argv[])
+{
+ ct_viewer_data ad = {0};
+ app_event_callback_s event_callback = {0,};
+
+ //vibration engine set, guide by settings - temporary fix
+ elm_init(argc, argv);
+ elm_config_preferred_engine_set("opengl_x11");
+
+ event_callback.create = viewer_create;
+ event_callback.terminate = viewer_terminate;
+ event_callback.pause = viewer_pause;
+ event_callback.resume = viewer_resume;
+ event_callback.service = viewer_service;
+ event_callback.low_memory = NULL;
+ event_callback.low_battery = NULL;
+ event_callback.device_orientation = viewer_device_orientation;
+ event_callback.language_changed = NULL;
+ event_callback.region_format_changed = NULL;
+
+ return app_efl_main(&argc, &argv, &event_callback, &ad);
+}
diff --git a/contacts-viewer/icon_contacts-viewer.png b/contacts-viewer/icon_contacts-viewer.png
new file mode 100644
index 0000000..900dcde
--- /dev/null
+++ b/contacts-viewer/icon_contacts-viewer.png
Binary files differ
diff --git a/contacts-viewer/org.tizen.contacts-viewer.xml b/contacts-viewer/org.tizen.contacts-viewer.xml
new file mode 100755
index 0000000..2387e5e
--- /dev/null
+++ b/contacts-viewer/org.tizen.contacts-viewer.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.contacts-viewer" version="0.1.2" install-location="internal-only">
+ <label>Contacts-Viewer</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>Contacts-Viewer Application</description>
+ <ui-application appid="org.tizen.contacts-viewer" exec="/usr/apps/org.tizen.contacts-viewer/bin/contacts-viewer" nodisplay="true" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.contacts.png</icon>
+ <label>Contacts-Viewer</label>
+ <label xml:lang="en-us">Contacts-Viewer</label>
+ <label xml:lang="nl-nl">Contacts-Viewer</label>
+ <label xml:lang="de-de">Contacts-Viewer</label>
+ <label xml:lang="en-gb">Contacts-Viewer</label>
+ <label xml:lang="zh-hk">Contacts-Viewer</label>
+ <label xml:lang="zh-cn">Contacts-Viewer</label>
+ <label xml:lang="ru-ru">Contacts-Viewer</label>
+ <label xml:lang="zh-tw">Contacts-Viewer</label>
+ <label xml:lang="ja-jp">Contacts-Viewer</label>
+ <label xml:lang="es-es">Contacts-Viewer</label>
+ <label xml:lang="el-gr">Contacts-Viewer</label>
+ <label xml:lang="it-it">Contacts-Viewer</label>
+ <label xml:lang="tr-tr">Contacts-Viewer</label>
+ <label xml:lang="pt-pt">Contacts-Viewer</label>
+ <label xml:lang="fr-fr">Contacts-Viewer</label>
+ <label xml:lang="ko-kr">Contacts-Viewer</label>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/view"/>
+ <mime name="text/x-vcard"/>
+ <mime name="text/directory"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/contacts/CMakeLists.txt b/contacts/CMakeLists.txt
new file mode 100644
index 0000000..e3802a4
--- /dev/null
+++ b/contacts/CMakeLists.txt
@@ -0,0 +1,23 @@
+SET(CONTACTS "contacts")
+SET(CONTACTS_PKGNAME "org.${VENDOR}.${CONTACTS}")
+
+SET(CONTACTS_SRCS contacts.c)
+
+ADD_DEFINITIONS("-DC_PACKAGE=\"${CONTACTS}\"")
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC")
+
+FOREACH(flag ${contacts_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_EXECUTABLE(${CONTACTS} ${CONTACTS_SRCS})
+SET_TARGET_PROPERTIES(${CONTACTS} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -fpie")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/ct-front/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/common/include)
+TARGET_LINK_LIBRARIES(${CONTACTS} ${contacts_pkgs_LDFLAGS} common ug-contacts-tabui-efl "-pie")
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${CONTACTS}/${CONTACTS_PKGNAME}.xml DESTINATION "/usr/share/packages")
+INSTALL(FILES icon_${CONTACTS}.png DESTINATION "/usr/share/icons/default/small" RENAME "${CONTACTS_PKGNAME}.png")
+INSTALL(TARGETS ${CONTACTS} DESTINATION /usr/apps/${CONTACTS_PKGNAME}/bin)
+INSTALL(DIRECTORY DESTINATION /usr/apps/${CONTACTS_PKGNAME}/data)
diff --git a/contacts/contacts.c b/contacts/contacts.c
new file mode 100755
index 0000000..87c3679
--- /dev/null
+++ b/contacts/contacts.c
@@ -0,0 +1,320 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <app.h>
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <aul.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include "phone.h"
+#include "phone-common.h"
+#include "ct-front.h"
+
+#if !defined(C_PACKAGE)
+# define C_PACKAGE "contacts"
+#endif
+
+struct contact_data
+{
+ Evas_Object *win;
+ ct_front_data *cfront_d;
+ /* add more variables here */
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ Evas_Object *icon;
+ Evas_Object *prev_btn;
+#endif
+};
+
+static void ctapp_win_del(void *data, Evas_Object *obj, void *event)
+{
+ elm_exit();
+}
+
+static Evas_Object* ctapp_create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+#else
+ elm_win_borderless_set(eo, EINA_TRUE);
+#endif
+ evas_object_smart_callback_add(eo, "delete,request", ctapp_win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
+ elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
+ }
+ elm_win_conformant_set(eo, EINA_TRUE);
+ return eo;
+}
+
+static void ctapp_region_changed(void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ct_front_data *cfront_d = ad->cfront_d;
+ ctui_front_view_region_changed(cfront_d);
+ ug_send_event(UG_EVENT_REGION_CHANGE);
+ return;
+}
+
+static void ctapp_language_changed(void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ct_front_data *cfront_d = ad->cfront_d;
+ ctui_front_view_language_changed(cfront_d);
+ ug_send_event(UG_EVENT_LANG_CHANGE);
+ return;
+}
+
+static void device_orientation(app_device_orientation_e orientation, void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ct_front_data *cfront_d = ad->cfront_d;
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ const char *config = elm_config_profile_get();
+ if(!strcmp(config, "desktop"))
+ return;
+#endif
+ p_retm_if(cfront_d == NULL || cfront_d->win == NULL, "Paramter is NULL");
+ p_ret_if(!cfront_d->auto_rorate_screen);
+ cfront_d->rotate = orientation;
+ ctui_front_view_rotate(cfront_d, orientation);
+ return;
+}
+
+static int ctapp_open(void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ct_front_data *cfront_d = ad->cfront_d;
+ if (EINA_FALSE == evas_object_visible_get(cfront_d->win)){
+ evas_object_show(cfront_d->win);
+ if(CT_VIEW_NONE == cfront_d->select_tab)
+ ctui_front_view_reset(cfront_d, CT_VIEW_CONTACT, -1, NULL);
+ }
+ return 0;
+}
+
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+static Evas_Object* __set_win_icon(struct contact_data *ad)
+{
+ Evas_Object *image = evas_object_image_add(evas_object_evas_get(ad->win));
+ evas_object_image_file_set(image, "/usr/share/icons/default/small/org.tizen.contacts.png", NULL);
+ elm_win_icon_object_set(ad->win, image);
+
+ return image;
+}
+
+static void __win_profile_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if(data == NULL)
+ return;
+
+ struct contact_data *ad = data;
+
+ const char *profile = elm_config_profile_get();
+ if(!strcmp(profile, "desktop")) {
+ Elm_Object_Item *navi_item = elm_naviframe_bottom_item_get(ad->cfront_d->navi);
+ ad->prev_btn = elm_object_item_part_content_unset(navi_item, "prev_btn");
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE);
+ if(!ad->icon)
+ ad->icon = __set_win_icon(ad);
+ }
+ else {
+ Elm_Object_Item *navi_item = elm_naviframe_bottom_item_get(ad->cfront_d->navi);
+ if (ad->prev_btn) {
+ elm_object_item_part_content_set(navi_item, "prev_btn", ad->prev_btn);
+ ad->prev_btn = NULL;
+ }
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+ }
+}
+#endif //_PHONE_CONTACTS_DESKTOP_MODE_
+
+static void __ctapp_auto_rotate_screen_bool_changed(keynode_t *key, void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+
+ ct_front_data *cfront_d = ad->cfront_d;
+ p_retm_if(cfront_d == NULL || cfront_d->win == NULL, "Paramter is NULL");
+
+ vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &cfront_d->auto_rorate_screen);
+ if (cfront_d->rotate != APP_DEVICE_ORIENTATION_0) {
+ if (cfront_d->auto_rorate_screen)
+ ctui_front_view_rotate(cfront_d, cfront_d->rotate);
+ else
+ ctui_front_view_rotate(cfront_d, APP_DEVICE_ORIENTATION_0);
+ }
+ return;
+}
+
+static bool ctapp_create(void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ Evas_Object *win;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ /* create window */
+ win = ctapp_create_win(C_PACKAGE);
+ p_retvm_if(NULL == win, false, "phapp_create_win() Failed");
+ ad->win = win;
+
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ err = contacts_connect2();
+ if (CONTACTS_ERROR_NONE != err) {
+ Evas_Object *popup;
+ ERR("contacts_connect2() Failed(%d)", err);
+ evas_object_show(win);
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(popup);
+ elm_object_text_set(popup, T_(PH_GET_TEXT_BASIC, PHTEXT_INITIALIZING));
+ elm_popup_timeout_set(popup, 1.5);
+ evas_object_smart_callback_add(popup, "timeout", ctapp_win_del, NULL);
+ return true;
+ }
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ evas_object_smart_callback_add(ad->win, "profile,changed", __win_profile_changed_cb, ad);
+#endif
+
+ UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
+ ad->cfront_d = ctui_front_view_create(ad->win);
+
+ vconf_notify_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, __ctapp_auto_rotate_screen_bool_changed, ad);
+ vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &(ad->cfront_d->auto_rorate_screen));
+
+ ad->cfront_d->rotate = app_get_device_orientation();
+ if (ad->cfront_d->auto_rorate_screen)
+ elm_win_rotation_with_resize_set(ad->cfront_d->win, ad->cfront_d->rotate);
+ appcore_set_open_cb(ctapp_open, data);
+ return true;
+}
+
+static void ctapp_terminate(void *data)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ struct contact_data *ad = data;
+
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, __ctapp_auto_rotate_screen_bool_changed);
+
+ if (NULL != ad->win)
+ evas_object_del(ad->win);
+ //ug_destroy_all();
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ return;
+}
+
+static void ctapp_pause(void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ctui_front_view_pause(ad->cfront_d);
+ ug_pause();
+ return;
+}
+
+static void ctapp_resume(void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ct_front_data *cfront_d = ad->cfront_d;
+ if (CT_VIEW_NONE == cfront_d->select_tab)
+ ctui_front_view_reset(cfront_d, CT_VIEW_CONTACT, -1, NULL);
+ else
+ ctui_front_view_resume(ad->cfront_d);
+ ug_resume();
+ return;
+}
+
+static void ctapp_service(service_h service, void *data)
+{
+ PH_FN_CALL;
+ struct contact_data *ad = data;
+ ct_front_data *cfront_d;
+ int ret;
+ char* val = NULL;
+
+ p_retm_if(NULL == ad || NULL == ad->cfront_d, "data is null");
+ cfront_d = ad->cfront_d;
+
+ ret = service_get_extra_data(service, "launch_type", &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+
+ if (val && *val) {
+ if (0 == strcmp(val, "favorite"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_FAVORITE, -1, NULL);
+ else if (0 == strcmp(val, "groups"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_GROUP, -1, NULL);
+ else if (0 == strcmp(val, "group_message"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_GROUP, CT_FRONT_GROUP_MESSAGE, service);
+ else if (0 == strcmp(val, "group_email"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_GROUP, CT_FRONT_GROUP_EMAIL, service);
+ else if (0 == strcmp(val, "group_detail"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_GROUP, CT_FRONT_GROUP_DETAIL, service);
+ else if (0 == strcmp(val, "new"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_CONTACT, CT_FRONT_CONTACT_NEW, NULL);
+ else if (0 == strcmp(val, "addrbook"))
+ ctui_front_view_reset(cfront_d, CT_VIEW_CONTACT, CT_FRONT_CONTACT_ADDR, service);
+ else if (0 == strcmp(val, "booting"))
+ elm_win_lower(cfront_d->win);
+ free(val);
+ return;
+ }
+
+ ret = service_get_extra_data(service, "search_name", &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+
+ if (val && *val) {
+ ctui_front_view_reset(cfront_d, CT_VIEW_CONTACT, CT_FRONT_CONTACT_SEARCH, service);
+ free(val);
+ return;
+ }
+
+ ctui_front_view_reset(cfront_d, CT_VIEW_CONTACT, -1, NULL);
+ return;
+}
+
+API int main(int argc, char *argv[])
+{
+ struct contact_data ad = {0};
+ app_event_callback_s event_callback = {0,};
+
+ event_callback.create = ctapp_create;
+ event_callback.terminate = ctapp_terminate;
+ event_callback.pause = ctapp_pause;
+ event_callback.resume = ctapp_resume;
+ event_callback.service = ctapp_service;
+ event_callback.low_memory = NULL;
+ event_callback.low_battery = NULL;
+ event_callback.device_orientation = device_orientation;
+ event_callback.language_changed = ctapp_language_changed;
+ event_callback.region_format_changed = ctapp_region_changed;
+
+ return app_efl_main(&argc, &argv, &event_callback, &ad);
+}
+
diff --git a/contacts/icon_contacts.png b/contacts/icon_contacts.png
new file mode 100755
index 0000000..eabeaaf
--- /dev/null
+++ b/contacts/icon_contacts.png
Binary files differ
diff --git a/contacts/org.tizen.contacts.xml b/contacts/org.tizen.contacts.xml
new file mode 100755
index 0000000..c8e95b3
--- /dev/null
+++ b/contacts/org.tizen.contacts.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.contacts" version="0.1.2" install-location="internal-only">
+ <label>Contacts</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>Contacts Application</description>
+ <ui-application appid="org.tizen.contacts" exec="/usr/apps/org.tizen.contacts/bin/contacts" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.contacts.png</icon>
+ <label>Contacts</label>
+ <label xml:lang="hy-am">Կոնտակտներ</label>
+ <label xml:lang="az-az">Adlar</label>
+ <label xml:lang="eu-es">Kontaktuak</label>
+ <label xml:lang="bg-bg">Телефонен указател</label>
+ <label xml:lang="ca-es">Contactes</label>
+ <label xml:lang="zh-cn">联系人</label>
+ <label xml:lang="zh-hk">聯絡人</label>
+ <label xml:lang="zh-tw">聯絡人</label>
+ <label xml:lang="hr-hr">Imenik</label>
+ <label xml:lang="cs-cz">Kontakty</label>
+ <label xml:lang="da-dk">Kontakter</label>
+ <label xml:lang="nl-nl">Contacten</label>
+ <label xml:lang="en-gb">Contacts</label>
+ <label xml:lang="en-us">Contacts</label>
+ <label xml:lang="et-ee">Kontaktid</label>
+ <label xml:lang="fi-fi">Yhteystiedot</label>
+ <label xml:lang="fr-fr">Contacts</label>
+ <label xml:lang="gl-es">Contactos</label>
+ <label xml:lang="ka-ge">კონტაქტები</label>
+ <label xml:lang="de-de">Kontakte</label>
+ <label xml:lang="el-gr">Επαφές</label>
+ <label xml:lang="hu-hu">Névjegyek</label>
+ <label xml:lang="is-is">Tengiliðir</label>
+ <label xml:lang="ga-ie">Teagmhálaithe</label>
+ <label xml:lang="it-it">Rubrica</label>
+ <label xml:lang="ja-jp">電話帳</label>
+ <label xml:lang="kk-kz">Контактілер</label>
+ <label xml:lang="ko-kr">전화번호부</label>
+ <label xml:lang="lv-lv">Kontakti</label>
+ <label xml:lang="lt-lt">Adresatai</label>
+ <label xml:lang="mk-mk">Именик</label>
+ <label xml:lang="nb-no">Kontakter</label>
+ <label xml:lang="pl-pl">Kontakty</label>
+ <label xml:lang="pt-pt">Contactos</label>
+ <label xml:lang="pt-br">Contatos</label>
+ <label xml:lang="ro-ro">Contacte</label>
+ <label xml:lang="ru-ru">Контакты</label>
+ <label xml:lang="sr-rs">Kontakti</label>
+ <label xml:lang="sk-sk">Kontakty</label>
+ <label xml:lang="sl-si">Imenik</label>
+ <label xml:lang="es-es">Contactos</label>
+ <label xml:lang="es-us">Contactos</label>
+ <label xml:lang="sv-se">Kontakter</label>
+ <label xml:lang="tr-tr">Rehber</label>
+ <label xml:lang="uk-ua">Контакти</label>
+ <label xml:lang="uz-uz">Kontaktlar</label>
+ <label xml:lang="ar-ae">الأسماء</label>
+ <label xml:lang="zh-sg">"联系人</label>
+ <label xml:lang="hi-in">संपर्क</label>
+ <label xml:lang="en-ph">Contacts</label>
+ <label xml:lang="fr-ca">Contacts</label>
+ </ui-application>
+
+</manifest>
diff --git a/include/contacts-ug.h b/include/contacts-ug.h
new file mode 100755
index 0000000..78bd7e7
--- /dev/null
+++ b/include/contacts-ug.h
@@ -0,0 +1,266 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CONTACTS_UG_H__
+#define __CONTACTS_UG_H__
+
+/**
+ * @defgroup CONTACTS_UG Contacts UI-gadget
+ * @ingroup SLP_UG
+ * @addtogroup CONTACTS_UG
+ * @{
+ *
+ * Contacts UI-gadget
+ * \n This header file contains the declaration & description for Contacts UG.
+ *
+ * @section Header To use Them:
+ * @code
+ * #include <contacts-ug.h>
+ * @endcode
+ *
+ * @section example Example:
+ * @code
+ #include <stdio.h>
+ #include <ui-gadget.h>
+ #include <contacts-ug.h>
+
+ void contacts_detail_ug(int contact_id)
+ {
+ bundle *bd;
+ char buf[16];
+
+ bd = bundle_create();
+ if(NULL == bd) {
+ ERR("bundle_create() Failed");
+ return;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_DETAIL);
+ bundle_add(bd, CT_UG_BUNDLE_TYPE, buf);
+ snprintf(buf, sizeof(buf), "%d", contact_id);
+ bundle_add(bd, CT_UG_BUNDLE_ID, buf);
+
+ cbs.layout_cb = ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_destroy_cb;
+
+ ug = ug_create(NULL, UG_CONTACTS_DETAILS, UG_MODE_FULLVIEW, bd, &cbs);
+ if(NULL == ug)
+ ERR("ug_create() Failed");
+
+ bundle_free(bd);
+ }
+ * @endcode
+ *
+ */
+
+/**
+ * The name of details/new/edit UG
+ * @see #CT_UG_DETAILS_TYPES
+ */
+#define UG_CONTACTS_DETAILS "contacts-details-efl"
+
+/**
+ * The name of list UG
+ * @see #CT_UG_LIST_TYPES
+ */
+#define UG_CONTACTS_LIST "contacts-list-efl"
+
+/**
+ * The name of setting UG
+ */
+#define UG_CONTACTS_SETTINGS "contacts-settings-efl"
+
+/**
+ * types of #UG_CONTACTS_DETAILS
+ */
+enum CT_UG_DETAILS_TYPES{
+ CT_UG_REQUEST_DETAIL = 0,/**< . */
+
+ CT_UG_REQUEST_EDIT = 11,/**< . */
+
+ CT_UG_REQUEST_ADD = 21,/**< . */
+ CT_UG_REQUEST_ADD_WITH_NUM = 22,/**< . */
+ CT_UG_REQUEST_ADD_WITH_EMAIL = 23,/**< . */
+ CT_UG_REQUEST_ADD_WITH_WEB = 24,/**< . */
+};
+
+/**
+ * types of #UG_CONTACTS_LIST
+ */
+enum CT_UG_LIST_TYPES{
+ CT_UG_REQUEST_LIST = 0,/**< . */
+ CT_UG_REQUEST_LIST_WITH_BACK = 1,/**< . */
+
+ CT_UG_REQUEST_SELECT_PERSON = 11,/**< . */
+ CT_UG_REQUEST_SELECT_NUMBER = 12,/**< . */
+ CT_UG_REQUEST_SELECT_EMAIL = 13,/**< . */
+ CT_UG_REQUEST_SELECT_VCARD = 14,/**< . */
+ CT_UG_REQUEST_SELECT_CONTACT_ADD_TO_HOME = 15,/**< . */
+ CT_UG_REQUEST_SELECT_GROUP_ADD_TO_HOME = 16,/**< . */
+ CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL = 17,/**< . */
+ CT_UG_REQUEST_SELECT_GROUP = 18, /**< . */
+
+ CT_UG_REQUEST_UPDATE_CONTACT = 20,/**< . */
+ CT_UG_REQUEST_UPDATE_WITH_NUM = 21,/**< . */
+ CT_UG_REQUEST_UPDATE_WITH_EMAIL = 22,/**< . */
+ CT_UG_REQUEST_UPDATE_WITH_WEB = 23,/**< . */
+
+ CT_UG_REQUEST_CHECK = 31,/**< . */
+ CT_UG_REQUEST_CHECK_FOR_NUMBER = 32,/**< . */
+ CT_UG_REQUEST_CHECK_FOR_EMAIL = 33,/**< . */
+ CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL = 34,/**< . */
+
+ CT_UG_REQUEST_SAVE_IMG = 41,/**< . */
+ CT_UG_REQUEST_SAVE_RINGTONE = 42,/**< . */
+
+ CT_UG_REQUEST_SHARE_CONTACT_INFO = 61,/**< . */
+};
+
+#define CT_UG_BUNDLE_ACCOUNTID "account_id"
+#define CT_UG_BUNDLE_PERSON_ID "ct_person_id"
+
+/**
+ * The key of request bundle for type.
+ * \n Value : convert id to string by using \%d.
+ */
+#define CT_UG_BUNDLE_TYPE "type"
+
+/**
+ * The key of request bundle for contact index
+ * \n Value : convert id to string by using \%d
+ * \n Use on #CT_UG_REQUEST_DETAIL, #CT_UG_REQUEST_EDIT
+ */
+#define CT_UG_BUNDLE_ID "person_id"
+
+/**
+ * The key of request bundle for vcard stream.
+ * \n Value : vcard stream.(It is not a filepath.)
+ * \n Use only on #CT_UG_REQUEST_ADD.
+ */
+#define CT_UG_BUNDLE_VCARD "ct_vcard"
+
+/**
+ * The key of request bundle for number
+ * \n Use on #CT_UG_REQUEST_ADD_WITH_NUM, #CT_UG_REQUEST_UPDATE_WITH_NUM
+ * \n Value : (string)number
+ */
+#define CT_UG_BUNDLE_NUM "ct_num"
+
+/**
+ * The key of request bundle for email
+ * \n Use on #CT_UG_REQUEST_ADD_WITH_EMAIL, #CT_UG_REQUEST_UPDATE_WITH_EMAIL
+ * \n (string)email address
+ */
+#define CT_UG_BUNDLE_EMAIL "ct_email"
+
+/**
+ * The key of request bundle for web
+ * \n Use on #CT_UG_REQUEST_ADD_WITH_WEB, #CT_UG_REQUEST_UPDATE_WITH_WEB
+ * \n Value : (string)web address
+ */
+#define CT_UG_BUNDLE_WEB "ct_web"
+
+/**
+ * The key of request bundle for path(ringtone or img)
+ * \n Use on #CT_UG_REQUEST_SAVE_IMG, #CT_UG_REQUEST_SAVE_RINGTONE
+ * \n Value : (string)absolutely path
+ */
+#define CT_UG_BUNDLE_PATH "ct_path"
+
+/**
+ * The key of request bundle for maximum number to select.
+ * \n Use on #CT_UG_REQUEST_CHECK
+ * \n Value : convert maximum number to string by using \%d (0 is ALL)
+ */
+#define CT_UG_BUNDLE_MAX "ct_max"
+
+/**
+ * The key of result bundle for contact index
+ * \n The contact index on #CT_UG_REQUEST_ADD , CT_UG_REQUEST_ADD_XXX
+ * \n The contact index on #CT_UG_REQUEST_SELECT_PERSON
+ * \n Value : convert id to integer by using atoi()
+ * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ */
+#define CT_UG_BUNDLE_RESULT_PERSON_ID "person_id"
+
+/**
+ * The key of result bundle for the index of number value
+ * \n The number value index on #CT_UG_REQUEST_SELECT_NUMBER
+ * \n Value : convert id to integer by using atoi()
+ * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ */
+#define CT_UG_BUNDLE_RESULT_NUMBER_ID "num_id"
+
+/**
+ * The key of result bundle for the index of email value
+ * \n The email value index on #CT_UG_REQUEST_SELECT_EMAIL
+ * \n Value : convert id to integer by using atoi()
+ * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ */
+#define CT_UG_BUNDLE_RESULT_EMAIL_ID "email_id"
+
+/**
+ * The key of result bundle for the index of group value
+ * \n The group value index on #CT_UG_REQUEST_SELECT_GROUP
+ * \n Value : convert id to integer by using atoi()
+ * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ */
+#define CT_UG_BUNDLE_RESULT_GROUP_ID "group_id"
+
+/**
+ * The key of result bundle for a list of contact index
+ * \n The contact index on #CT_UG_REQUEST_CHECK
+ * \n Value : convert string to a integer array by using g_base64_decode()
+ * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ * @par example
+ * @code
+ void contacts_result_cb(struct ui_gadget *ug, bundle *result, void *data)
+ {
+ if(NULL == ug || NULL == data)
+ return;
+
+ if(result) {
+ const char *val;
+ int *list, len, i;
+
+ val = bundle_get_val(result, CT_UG_BUNDLE_RESULT_PERSON_ID_LIST);
+ list = (int *)g_base64_decode(val, &len);
+
+ for(i=0;i<len/sizeof(int);i++)
+ printf("selected contact = %d", list[i]);
+
+ g_free(list);
+ }
+ }
+ *
+ * @endcode
+ */
+#define CT_UG_BUNDLE_RESULT_PERSON_ID_LIST "person_id_list"
+#define CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST "num_id_list"
+#define CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST "email_id_list"
+#define CT_UG_BUNDLE_RESULT_PERSON_INFO "person_info"
+/**
+ * @}
+ */
+
+#endif //__CONTACTS_UG_H__
diff --git a/include/phone-ug.h b/include/phone-ug.h
new file mode 100755
index 0000000..e608458
--- /dev/null
+++ b/include/phone-ug.h
@@ -0,0 +1,171 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __PHONE_UG_H__
+#define __PHONE_UG_H__
+
+/**
+ * @defgroup PHONE_UG PHONE UI-gadget
+ * @ingroup SLP_UG
+ * @addtogroup PHONE_UG
+ * @{
+ *
+ * Phone UI-gadget
+ * \n This header file contains the declaration & description for Phone UG.
+ *
+ * @section Header To use Them:
+ * @code
+ * #include <phone-ug.h>
+ * @endcode
+ *
+ * @section example Example:
+ * @code
+ #include <stdio.h>
+ #include <ui-gadget.h>
+ #include <phone-ug.h>
+ * @endcode
+ *
+ void phonelog_ug ()
+ {
+ bundle *bd;
+ char buf[16];
+
+ bd = bundle_create();
+ if(NULL == bd) {
+ ERR("bundle_create() Failed");
+ return;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", PH_UG_REQUEST_LOG_CHECK);
+ bundle_add(bd, PH_UG_BUNDLE_TYPE, buf);
+
+ cbs.layout_cb = ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_destroy_cb;
+
+ ug = ug_create(NULL, UG_PHONE_LOG, UG_MODE_FULLVIEW, bd, &cbs);
+ if(NULL == ug)
+ ERR("ug_create() Failed");
+
+ bundle_free(bd);
+ }
+ * @endcode
+ */
+
+/**
+ * The name of phonelog UG
+ */
+#define UG_DIALER_LOG "dialer-efl"
+
+/**
+ * The name of dialer UG
+ * @see #PH_UG_LOG_TYPES
+ */
+#define UG_PHONE_LOG "phonelog-efl"
+
+/**
+ * The name of phoneui UG
+ */
+#define UG_PHONEUI_LOG "phoneui-efl"
+
+/**
+ * types of #UG_PHONEUI
+ */
+enum PHUI_UG_LIST_TYPES{
+ PH_UG_REQUEST_SELECT = 11,/**< . */
+ PH_UG_REQUEST_SELECT_NUMBER = 12,/**< . */
+ PH_UG_REQUEST_SELECT_EMAIL = 13,/**< . */
+ PH_UG_REQUEST_SELECT_NUMBER_OR_EMAIL = 17,/**< . */
+
+ PH_UG_REQUEST_SET_WITH_NUM = 21,/**< . */
+ PH_UG_REQUEST_SET_WITH_EMAIL = 22,/**< . */
+ PH_UG_REQUEST_SET_WITH_WEB = 23,/**< . */
+ PH_UG_REQUEST_SET_WITH_IMG = 24,/**< . */
+ PH_UG_REQUEST_SET_WITH_RINGTONE = 25,/**< . */
+
+ PH_UG_REQUEST_CHECK = 31,/**< . */
+ PH_UG_REQUEST_CHECK_FOR_NUMBER = 32,/**< . */
+ PH_UG_REQUEST_CHECK_FOR_EMAIL = 33,/**< . */
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL = 34,/**< . */
+
+ PH_UG_REQUEST_LAUNCH_VOICECALL = 51,/**< . */
+};
+
+/**
+ * The name of speeddial UG
+ */
+#define UG_SPEEDDIAL_LOG "speeddial-efl"
+
+
+/**
+ * types of #PH_UG_LOG_TYPES
+ */
+enum PH_UG_LOG_TYPES{
+ PH_UG_REQUEST_LOG_CHECK = 11,
+ PH_UG_REQUEST_LOG_SELECT = 12,
+};
+
+/**
+ * The key of request bundle for type.
+ * \n Value : convert id to string by using \%d.
+ */
+#define PH_UG_BUNDLE_TYPE "type"
+
+/**
+ * The key of result bundle for phonelog index
+ * \n The contact index on #PH_UG_REQUEST_LOG_SELECT
+ * \n Value : convert id to integer by using atoi()
+ * \n Recommends to destroy Phone UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ */
+#define PH_UG_BUNDLE_RESULT_PLOG_ID "plog_id"
+
+/**
+ * The key of result bundle for a list of phonelog index
+ * \n The phonelog index on #PH_UG_REQUEST_LOG_CHECK
+ * \n Value : convert string to a integer array by using g_base64_decode()
+ * \n Recommends to destroy Phone UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
+ * \n In ug_cbs.result_cb, ug_destroy() should not be called.
+ * @par example
+ * @code
+ void phonelog_result_cb(struct ui_gadget *ug, bundle *result, void *data)
+ {
+ if(NULL == ug || NULL == data)
+ return;
+
+ if(result) {
+ const char *val;
+ int *list, len, i;
+
+ val = bundle_get_val(result, PH_UG_BUNDLE_RESULT_PLOG_ID_LIST);
+ list = (int *)g_base64_decode(val, &len);
+
+ for(i=0;i<len/sizeof(int);i++)
+ printf("selected contact = %d", list[i]);
+
+ g_free(list);
+ }
+ }
+ *
+ * @endcode
+ */
+#define PH_UG_BUNDLE_RESULT_PLOG_ID_LIST "get_select_list" // TODO : change to "plog_id_list"
+
+/**
+ * @}
+ */
+
+#endif //__PHONE_UG_H__
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100755
index 0000000..f064e7b
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,166 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/ct-front/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/details/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/dialer/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/favor/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/list/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/log/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/ph-front/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/speed/include)
+
+SET(COMMON_LIB common)
+SET(FAVOR_LIB favorite)
+SET(SPEEDDIAL ug-speeddial-efl)
+SET(PH_LOG ug-phonelog-efl)
+SET(CT_DETAILS ug-contacts-details-efl)
+SET(CT_LIST ug-contacts-list-efl)
+SET(CT_SETTING ug-contacts-settings-efl)
+SET(PH_DIALER ug-dialer-efl)
+SET(PH_FRONT ug-phone-tabui-efl)
+SET(CT_FRONT ug-contacts-tabui-efl)
+SET(UGLIBDIR "/usr/ug/lib")
+
+FILE(GLOB COMMON_SRCS common/*.c)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(ug_pkgs REQUIRED contacts-service2 msg-service)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC")
+
+FOREACH(flag ${ug_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(ug_pkgs_LDFLAGS "${pkgs_LDFLAGS} ${ug_pkgs_LDFLAGS}")
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/contact_button.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images/phoneug-images
+ ${EDC_SRC_DIR}/contact_button.edc ${CMAKE_BINARY_DIR}/contact_button.edj
+ DEPENDS ${EDC_SRC_DIR}/contact_button.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/progress.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/progress.edc ${CMAKE_BINARY_DIR}/progress.edj
+ DEPENDS ${EDC_SRC_DIR}/progress.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/dialer.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/dialer.edc ${CMAKE_BINARY_DIR}/dialer.edj
+ DEPENDS ${EDC_SRC_DIR}/dialer.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/dialer_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/dialer_theme.edc ${CMAKE_BINARY_DIR}/dialer_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/dialer_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/speeddial_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/speeddial_theme.edc ${CMAKE_BINARY_DIR}/speeddial_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/speeddial_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/logdetail_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/logdetail_theme.edc ${CMAKE_BINARY_DIR}/logdetail_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/logdetail_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/contacts.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images/contact_images
+ ${EDC_SRC_DIR}/contacts.edc ${CMAKE_BINARY_DIR}/contacts.edj
+ DEPENDS ${EDC_SRC_DIR}/contacts.edc ${EDC_SRC_DIR}/list.edc ${EDC_SRC_DIR}/progress.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/favorites_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/favorites_theme.edc ${CMAKE_BINARY_DIR}/favorites_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/favorites_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/group_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/images
+ ${EDC_SRC_DIR}/group_theme.edc ${CMAKE_BINARY_DIR}/group_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/group_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/image_layout.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/images
+ ${EDC_SRC_DIR}/image_layout.edc ${CMAKE_BINARY_DIR}/image_layout.edj
+ DEPENDS ${EDC_SRC_DIR}/image_layout.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/list_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/images
+ ${EDC_SRC_DIR}/list_theme.edc ${CMAKE_BINARY_DIR}/list_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/list_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/detail_theme.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images
+ ${EDC_SRC_DIR}/detail_theme.edc ${CMAKE_BINARY_DIR}/detail_theme.edj
+ DEPENDS ${EDC_SRC_DIR}/detail_theme.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/selectioninfo.edj
+ COMMAND edje_cc
+ ${EDC_SRC_DIR}/selectioninfo.edc ${CMAKE_BINARY_DIR}/selectioninfo.edj
+ DEPENDS ${EDC_SRC_DIR}/selectioninfo.edc
+ )
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/nocontent_layout.edj
+ COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/lib/images/
+ ${EDC_SRC_DIR}/nocontent_layout.edc ${CMAKE_BINARY_DIR}/nocontent_layout.edj
+ DEPENDS ${EDC_SRC_DIR}/nocontent_layout.edc
+ )
+
+ADD_CUSTOM_TARGET(contact_button_edj_build DEPENDS ${CMAKE_BINARY_DIR}/contact_button.edj)
+ADD_CUSTOM_TARGET(progress_edj_build DEPENDS ${CMAKE_BINARY_DIR}/progress.edj)
+ADD_CUSTOM_TARGET(dialer_theme_build DEPENDS ${CMAKE_BINARY_DIR}/dialer_theme.edj)
+ADD_CUSTOM_TARGET(dialer_edj_build DEPENDS ${CMAKE_BINARY_DIR}/dialer.edj)
+ADD_CUSTOM_TARGET(speeddial_theme_build DEPENDS ${CMAKE_BINARY_DIR}/speeddial_theme.edj)
+ADD_CUSTOM_TARGET(logdetail_theme_build DEPENDS ${CMAKE_BINARY_DIR}/logdetail_theme.edj)
+ADD_CUSTOM_TARGET(contacts_edj_build DEPENDS ${CMAKE_BINARY_DIR}/contacts.edj)
+ADD_CUSTOM_TARGET(favorites_theme_build DEPENDS ${CMAKE_BINARY_DIR}/favorites_theme.edj)
+ADD_CUSTOM_TARGET(group_theme_edj_build DEPENDS ${CMAKE_BINARY_DIR}/group_theme.edj)
+ADD_CUSTOM_TARGET(image_layout_edj_build DEPENDS ${CMAKE_BINARY_DIR}/image_layout.edj)
+ADD_CUSTOM_TARGET(list_theme_edj_build DEPENDS ${CMAKE_BINARY_DIR}/list_theme.edj)
+ADD_CUSTOM_TARGET(detail_theme_edj_build DEPENDS ${CMAKE_BINARY_DIR}/detail_theme.edj)
+ADD_CUSTOM_TARGET(selectioninfo_edj_build DEPENDS ${CMAKE_BINARY_DIR}/selectioninfo.edj)
+ADD_CUSTOM_TARGET(nocontent_layout_edj_build DEPENDS ${CMAKE_BINARY_DIR}/nocontent_layout.edj)
+
+ADD_LIBRARY(${COMMON_LIB} STATIC ${COMMON_SRCS})
+SET_TARGET_PROPERTIES(${COMMON_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
+TARGET_LINK_LIBRARIES(${COMMON_LIB} ${ug_pkgs_LDFLAGS})
+ADD_DEPENDENCIES(${COMMON_LIB} selectioninfo_edj_build)
+ADD_DEPENDENCIES(${COMMON_LIB} nocontent_layout_edj_build)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/phone-ug.h DESTINATION /usr/include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/contacts-ug.h DESTINATION /usr/include)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/contact_button.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/contacts.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/progress.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/dialer.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/dialer_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/speeddial_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/logdetail_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/favorites_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/group_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/image_layout.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/list_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/detail_theme.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/selectioninfo.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/nocontent_layout.edj DESTINATION ${EDJDIR})
+
+ADD_SUBDIRECTORY(speed)
+ADD_SUBDIRECTORY(log)
+ADD_SUBDIRECTORY(dialer)
+ADD_SUBDIRECTORY(details)
+ADD_SUBDIRECTORY(list)
+ADD_SUBDIRECTORY(settings)
+ADD_SUBDIRECTORY(favor)
+ADD_SUBDIRECTORY(ph-front)
+ADD_SUBDIRECTORY(ct-front)
diff --git a/lib/common/ct-group-input-view.c b/lib/common/ct-group-input-view.c
new file mode 100755
index 0000000..82bf015
--- /dev/null
+++ b/lib/common/ct-group-input-view.c
@@ -0,0 +1,1102 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <Ecore_X.h>
+#include <app_service.h>
+#include "phone.h"
+#include "phone-common.h"
+
+#include "ct-list.h"
+#include "ct-group.h"
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *entry;
+ Elm_Theme *th;
+ Elm_Object_Item *navi_it;
+ Elm_Object_Item *ab_gen_item;
+ Elm_Object_Item *vibration_gen_item;
+ Elm_Object_Item *ringtone_gen_item;
+ Elm_Object_Item *image_item;
+ Evas_Object *done_button;
+ Evas_Object *navi_it_pop_to;
+ Ecore_Event_Handler *win_prop_change;
+ bool camera_service_launched;
+ ct_group_input_result_cb result_cb;
+ void *result_cb_data;
+ void *ug;
+ void *crop_ug;
+ void *src_ug;
+ void *child_ug;//vibration,ringtone ug
+ int id_ab;
+ char *ab_name;
+ char *gname_old;
+ char *gname;
+ char *img;
+ char *ringtone;
+ char *vibration;
+ int id_grp;
+ bool editgroup;
+ bool err;
+ bool is_read_only;
+ Eina_List *member_list;
+} ct_group_input_data;
+
+enum GINPUT_ITC_TYPE{
+ GINPUT_ITC_GROUP_IMAGE,
+ GINPUT_ITC_GROUP_CREATE,
+ GINPUT_ITC_GROUP_VIBRATION,
+ GINPUT_ITC_GROUP_RINGTON,
+ GINPUT_ITC_ADDRBOOK,
+ GINPUT_ITC_ADDMEM_BUTTON,
+ GINPUT_ITC_LINE,
+};
+
+static Elm_Genlist_Item_Class group_input_itcs[] = {
+ {.item_style="image_layout"},
+ {.item_style="dialogue/1icon"},
+ {.item_style="dialogue/2text.3"},
+ {.item_style="dialogue/2text.3"},
+ {.item_style="dialogue/2text.3"},
+ {.item_style="1icon/with_no_line"},
+ {.item_style="dialogue/separator/1/with_line"},
+};
+
+static int group_input_group_update(ct_group_input_data *cgroup_input_d)
+{
+ PH_FN_CALL;
+ int ret = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_record_h group_record = NULL;
+ contacts_list_h group_list = NULL;
+ unsigned int count = 0;
+
+ ret = phone_cts_get_list(_contacts_group._uri, _contacts_group.address_book_id,cgroup_input_d->id_ab, &group_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "phone_cts_get_list() Failed(%d)", ret);
+
+ ret = contacts_list_get_count(group_list,&count);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_count() Failed(%d)", ret);
+ if(count > 0){ //when detault group removed error
+ if(cgroup_input_d->editgroup == false)
+ {
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while (record) {
+ char* group_name;
+ ret = contacts_record_get_str_p(record,_contacts_group.name,&group_name);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_get_str_p() Failed(%d)", ret);
+ if(strcmp(cgroup_input_d->gname, group_name) == 0) {
+ ret = -1;
+ contacts_list_destroy(group_list, true);
+ PH_DBG("create group :cgroup_input_d->id_grp =&d",cgroup_input_d->id_grp);
+ return ret;
+ }
+ ret = contacts_list_next(group_list);
+ if(CONTACTS_ERROR_NO_DATA == ret)
+ break;
+ else {
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_next() Failed(%d)", ret);
+ }
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ }
+ else{
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while (record) {
+ char* group_name;
+ ret = contacts_record_get_str(record,_contacts_group.name ,&group_name);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_get_str() Failed(%d)", ret);
+ if(strcmp(cgroup_input_d->gname, group_name) == 0) {
+ int group_id;
+ ret = contacts_record_get_int(record,_contacts_group.id ,&group_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_get_int() Failed(%d)", ret);
+ if(group_id != cgroup_input_d->id_grp){
+ ret = -1;
+ contacts_list_destroy(group_list, true);
+ PH_DBG("group id = %d,cgroup_input_d->id_grp =&d",group_id,cgroup_input_d->id_grp);
+ return ret;
+ }
+ }
+ ret = contacts_list_next(group_list);
+ if(CONTACTS_ERROR_NONE != ret) break;
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+
+
+ }
+ }
+ }
+ if(cgroup_input_d->editgroup == true){
+ ret = contacts_db_get_record(_contacts_group._uri,cgroup_input_d->id_grp,&group_record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_db_get_record() Failed(%d)", ret);
+ }
+ else{
+ ret = contacts_record_create(_contacts_group._uri,&group_record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_create() Failed(%d)", ret);
+ }
+
+ ret = contacts_record_set_str(group_record, _contacts_group.name, cgroup_input_d->gname);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+
+
+ ret = contacts_record_set_str(group_record, _contacts_group.image_path, cgroup_input_d->img);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+ PH_DBG("cgroup_input_d->img = %s",cgroup_input_d->img);
+
+ ret = contacts_record_set_str(group_record, _contacts_group.ringtone_path, cgroup_input_d->ringtone);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+
+
+ ret = contacts_record_set_str(group_record, _contacts_group.vibration, cgroup_input_d->vibration);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+
+ if(cgroup_input_d->editgroup == true){
+ ret = contacts_db_update_record(group_record);
+ PH_DBG("cgroup_input_d->id_grp = %d",cgroup_input_d->id_grp);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_db_update_record() Failed(%d)", ret);
+ }
+ else{
+ ret = contacts_db_insert_record(group_record, &cgroup_input_d->id_grp);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_db_insert_record() Failed(%d)", ret);
+ }
+
+ ret = contacts_record_destroy(group_record, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_destroy() Failed(%d)", ret);
+
+ ret = contacts_list_destroy(group_list, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_destroy() Failed(%d)", ret);
+
+ return ret;
+
+}
+static void group_input_save_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int ret;
+ Evas_Object *entry;
+ Evas_Object *navi_it_pop_to;
+ char *text;
+ ct_group_input_data *cgroup_input_d = data;
+ char msg[256];
+ entry = cgroup_input_d->entry;
+
+ text = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == text, "ctui_entry_markup_to_utf8() return NULL");
+ cgroup_input_d->gname = SAFE_STRDUP(text);
+
+ ret = group_input_group_update(cgroup_input_d);
+
+ if (ret != CONTACTS_ERROR_NONE) {
+ const char *err_msg;
+ cgroup_input_d->err = true;
+ FREEandSTRDUP(cgroup_input_d->gname_old ,text);
+ switch (ret) {
+ case CONTACTS_ERROR_NO_DATA:
+ err_msg = T_(CT_GET_TEXT_ERR, CTTEXT_ERR_DB_LOCKED);
+ break;
+ case CONTACTS_ERROR_FILE_NO_SPACE:
+ err_msg = S_(CT_SYS_POP_NOT_ENOUGH_MEMORY);
+ break;
+ case -1:
+ err_msg = T_(CT_GET_TEXT_ERR, CTTEXT_ALREADY_EXIST);
+ break;
+ default:
+ err_msg = S_(PH_SYS_POP_FAILED);
+ break;
+ }
+
+ snprintf(msg, sizeof(msg), "<color=#FF0000>%s</>", err_msg);
+ elm_entry_entry_set(entry, msg);
+ ctui_navi_left_btn_disabled_set(cgroup_input_d->navi_it, EINA_TRUE);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_TRUE);
+ free(text);
+ return;
+ }
+ free(text);
+
+ navi_it_pop_to = NULL;
+ navi_it_pop_to = evas_object_data_get(cgroup_input_d->navi, "navi_it_pop");
+ if (navi_it_pop_to){ // group - create/edit - assign member
+ if(cgroup_input_d->editgroup == true)
+ {
+ elm_naviframe_item_pop(cgroup_input_d->navi);
+ //ctui_create_gadd_list_select_view(cgroup_input_d->win, cgroup_input_d->navi, cgroup_input_d->id_grp, cgroup_input_d->id_ab, cgroup_input_d->member_list);
+ }
+ else
+ ctui_create_gadd_list_select_view(cgroup_input_d->win, cgroup_input_d->navi, cgroup_input_d->id_grp, cgroup_input_d->id_ab, NULL);
+ }
+ else { // group detail - add member
+ if (cgroup_input_d->result_cb)
+ cgroup_input_d->result_cb(ret, cgroup_input_d->result_cb_data,false);
+ elm_naviframe_item_pop(cgroup_input_d->navi);
+ }
+}
+
+
+static void group_input_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ evas_object_del(cgroup_input_d->popup);
+ cgroup_input_d->popup = NULL;
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+}
+
+static void group_input_ab_popup_item_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ ct_ab_popup_data *ab_popup_data;
+ char account_name[PH_TEXT_MAX_LEN+1];
+ char temp[PH_TEXT_MAX_LEN+1];
+
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+
+ ab_popup_data = elm_object_item_data_get(event_info);
+ p_retm_if(NULL == ab_popup_data, "elm_object_item_data_get() return NULL");
+
+ if (cgroup_input_d->id_ab == ab_popup_data->id)
+ return;
+
+ cgroup_input_d->id_ab = ab_popup_data->id;
+
+ if (ab_popup_data->id) {
+ ctui_get_addressbook_name(ab_popup_data->id, account_name, sizeof(account_name));
+ snprintf(temp, sizeof(temp), "%s(%s)", account_name, ab_popup_data->name);
+ }
+ else {
+ snprintf(temp, sizeof(temp), "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+ free(cgroup_input_d->ab_name);
+ cgroup_input_d->ab_name = strdup(temp);
+ elm_genlist_item_update(cgroup_input_d->ab_gen_item);
+
+ // FIXME : push contact list view to select contacts added to the created group
+}
+
+static void group_input_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup;
+ Evas_Object *btn;
+ ct_group_input_data *cgroup_input_d = data;
+ Elm_Object_Item *item = event_info;
+
+ if (elm_genlist_item_flip_get(item))
+ return;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ popup = ctui_addrbook_popup(cgroup_input_d->win, group_input_ab_popup_item_sel_cb, cgroup_input_d, CT_AB_POPUP_TYPE_GINPUT_VIEW);
+ p_retm_if(NULL == popup, "ctui_addrbook_popup() return NULL");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASE_OP, CTTEXT_SAVE_TO));
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_POP_CLOSE));
+ elm_object_part_content_set(popup, "button1", btn);
+ elm_object_style_set(btn, "popup_button/default");
+ evas_object_smart_callback_add(btn, "clicked", group_input_popup_hide_cb, cgroup_input_d);
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+ cgroup_input_d->popup = popup;
+}
+static void group_input_setting_ringtone_result(ui_gadget_h ug, service_h service, void *data)
+{
+ PH_FN_CALL;
+ char *val = NULL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "result", &val);
+ p_retm_if(!val, "return value is NULL");
+ FREEandSTRDUP(cgroup_input_d->ringtone,val);
+ free(val);
+ }
+ elm_genlist_item_update(cgroup_input_d->ringtone_gen_item);
+}
+static void group_input_child_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = priv;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ if (cgroup_input_d->child_ug) {
+ ug_destroy(cgroup_input_d->child_ug);
+ cgroup_input_d->child_ug = NULL;
+ }
+}
+
+/*
+static void group_input_gl_vibration_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ //ToDo can not use a setting vibration view yet
+ return;
+}
+*/
+
+static void group_input_gl_ringtone_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = data;
+ Elm_Object_Item *item = event_info;
+
+ if (elm_genlist_item_flip_get(item))
+ return;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ struct ug_cbs cbs = {0};
+
+ service_h service;
+
+ service_create(&service);
+ service_add_extra_data(service, "path", "/opt/share/settings/Ringtones");
+ service_add_extra_data(service, "select_type", "SINGLE_FILE");
+ service_add_extra_data(service, "file_type", "SOUND");
+ if(cgroup_input_d->ringtone)
+ service_add_extra_data(service, "marked_mode", cgroup_input_d->ringtone);
+
+ cbs.result_cb = group_input_setting_ringtone_result;
+ cbs.destroy_cb = group_input_child_ug_destroy;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cgroup_input_d;
+
+ cgroup_input_d->child_ug = ug_create(cgroup_input_d->ug, MYFILES_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cgroup_input_d->child_ug, "ug_create() Failed");
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+ service_destroy(service);
+}
+static void group_input_fill_genlist(ct_group_input_data *cgroup_input_d)
+{
+ Elm_Object_Item *item;
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_IMAGE], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ cgroup_input_d->image_item = item;
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_LINE], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_CREATE], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+// item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_VIBRATION], cgroup_input_d, NULL,
+// ELM_GENLIST_ITEM_NONE, group_input_gl_sel, cgroup_input_d);
+// cgroup_input_d->vibration_gen_item = item; can not use a setting vibration view yet.
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_RINGTON], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, group_input_gl_ringtone_sel, cgroup_input_d);
+ cgroup_input_d->ringtone_gen_item = item;
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_ADDRBOOK], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, group_input_gl_sel, cgroup_input_d);
+ cgroup_input_d->ab_gen_item = item;
+
+ if(cgroup_input_d->is_read_only == true)
+ elm_object_item_disabled_set(item, EINA_TRUE);
+
+ if(cgroup_input_d->editgroup == true){
+ ctui_genlist_append_separator_20px(cgroup_input_d->genlist);
+ elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_ADDMEM_BUTTON], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+
+}
+
+static char* group_input_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ const char *display;
+
+ if (!strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_SAVE_TO));
+ else if (!strcmp(part, "elm.text.2")) {
+ if (cgroup_input_d && 0 == cgroup_input_d->id_ab)
+ display = S_(CT_SYS_BODY_PHONE);
+ else if (cgroup_input_d && cgroup_input_d->ab_name)
+ display = cgroup_input_d->ab_name;
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+ return SAFE_STRDUP(display);
+ }
+ return NULL;
+}
+static char* group_input_gl_vibration_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = data;
+ const char *display;
+
+ if (!strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_VIBRATION_PATTERN));
+ else if (!strcmp(part, "elm.text.2")) {
+ if (cgroup_input_d && 0 == cgroup_input_d->id_ab)
+ display = T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT);
+ else if (cgroup_input_d && cgroup_input_d->vibration)
+ display = strrchr(cgroup_input_d->vibration, '/')+1;
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+ return SAFE_STRDUP(display);
+ }
+ return NULL;
+}
+static char* group_input_gl_ringtone_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ const char *display;
+
+ if (!strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_RINGTONE));
+ else if (!strcmp(part, "elm.text.2")) {
+ if (cgroup_input_d && cgroup_input_d->ringtone == NULL)
+ display = T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT);
+ else if (cgroup_input_d && cgroup_input_d->ringtone){
+ display = strrchr(cgroup_input_d->ringtone, '/')+1;
+ }
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+ return SAFE_STRDUP(display);
+ }
+ return NULL;
+}
+static void group_input_entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *text;
+ ct_group_input_data *cgroup_input_d = data;
+
+ text = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ p_retm_if(NULL == text, "ctui_entry_markup_to_utf8() return NULL");
+
+ if (*text) {
+ ctui_navi_left_btn_disabled_set(cgroup_input_d->navi_it, EINA_FALSE);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_FALSE);
+ }
+ else {
+ ctui_navi_left_btn_disabled_set(cgroup_input_d->navi_it, EINA_TRUE);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_TRUE);
+ }
+ free(text);
+}
+
+static void group_input_err_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+
+ if(NULL!=cgroup_input_d->src_ug)
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+ p_retm_if(NULL == cgroup_input_d->gname_old, "cgroup_input_d->gname_old is NULL");
+
+ if(cgroup_input_d->err == true) {
+ ctui_entry_entry_set(obj, cgroup_input_d->gname_old);
+ cgroup_input_d->err = false;
+ }
+
+ elm_entry_cursor_end_set(obj);
+}
+
+static void group_input_src_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ ct_group_input_data *cgroup_input_d = priv;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ if (NULL == cgroup_input_d->crop_ug) {
+ ug_destroy(cgroup_input_d->src_ug);
+ cgroup_input_d->src_ug = NULL;
+ }
+}
+
+static void group_input_crop_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ ct_group_input_data *cgroup_input_d = priv;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ if (cgroup_input_d->crop_ug) {
+ ug_destroy(ug);
+ cgroup_input_d->crop_ug = NULL;
+ }
+ if (cgroup_input_d->src_ug) {
+ ug_destroy(cgroup_input_d->src_ug);
+ cgroup_input_d->src_ug = NULL;
+ }
+}
+
+static void group_input_image_crop_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *img = NULL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "crop_image_path", &img);
+ p_retm_if(!img, "return value is NULL.\n");
+ PH_DBG("img = %s",img);
+ FREEandSTRDUP(cgroup_input_d->img, img);
+ free(img);
+ elm_genlist_item_update(cgroup_input_d->image_item);
+ }
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+}
+
+
+static void group_input_image_delete_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+ free(cgroup_input_d->img);
+ cgroup_input_d->img = NULL;
+ elm_genlist_item_update(cgroup_input_d->image_item);
+}
+
+static void group_input_image_gallery_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ struct ug_cbs cbs = {0};
+
+ service_get_extra_data(service, "path", &val);
+ p_retm_if(!val, "return value is NULL.\n");
+
+ cbs.result_cb = group_input_image_crop_result;
+ cbs.destroy_cb = group_input_crop_ug_destroy;
+ cbs.priv = cgroup_input_d;
+ cgroup_input_d->crop_ug = phone_image_crop_ug(cgroup_input_d->ug, val, &cbs);
+ free(val);
+ }
+}
+
+static void group_input_camera_result(service_h service, service_h reply, service_result_e result, void* user_data)
+{
+ char *img = NULL;
+ ct_group_input_data *cgroup_input_d = user_data;
+ cgroup_input_d->camera_service_launched = false;
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ service_get_extra_data(reply, "crop_image_path", &img);
+ p_retm_if(!img, "return value is NULL.\n");
+
+ FREEandSTRDUP(cgroup_input_d->img, img);
+ free(img);
+ elm_genlist_item_update(cgroup_input_d->image_item);
+}
+
+static void __group_input_gallery(ct_group_input_data *cgroup_input_d)
+{
+ service_h service;
+ struct ug_cbs cbs = {0};
+
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+
+ service_create(&service);
+ service_add_extra_data(service, "launch-type", "select-one");
+ service_add_extra_data(service, "file-type", "image");
+
+ cbs.result_cb = group_input_image_gallery_result;
+ cbs.destroy_cb = group_input_src_ug_destroy;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cgroup_input_d;
+
+
+ cgroup_input_d->src_ug = ug_create(cgroup_input_d->ug, GALLERY_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cgroup_input_d->src_ug, "ug_create() Failed");
+
+ service_destroy(service);
+}
+
+static void __group_input_camera(ct_group_input_data *cgroup_input_d)
+{
+ service_h service;
+ p_ret_if(cgroup_input_d->camera_service_launched);
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+
+ service_create(&service);
+ service_set_window(service, elm_win_xwindow_get(cgroup_input_d->win));
+ service_set_operation(service, SERVICE_OPERATION_CREATE_CONTENT);
+ service_set_mime(service, "image/jpg");
+ service_add_extra_data(service, "CALLER", "contacts");
+ service_send_launch_request(service, group_input_camera_result, cgroup_input_d);
+ cgroup_input_d->camera_service_launched = true;
+ service_destroy(service);
+}
+
+static void __group_input_gallery_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ service_h service;
+ struct ug_cbs cbs = {0};
+ ct_group_input_data *cgroup_input_d = data;
+
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ if(ev == NULL){
+ ERR("ev is null!!!");
+ return;
+ }
+
+ int x, y, w, h;
+
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ elm_icon_file_set(obj, cgroup_input_d->img, NULL);
+ }
+ else
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_GALLERY, NULL);
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y)
+ return;
+
+ __group_input_gallery(cgroup_input_d);
+}
+
+static void __group_input_gallery_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ elm_icon_file_set(obj, cgroup_input_d->img, NULL);
+ }
+ else
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_GALLERY_PRESSED, NULL);
+}
+
+static void __group_input_camera_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ int x, y, w, h;
+ service_h service;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ if(ev == NULL){
+ ERR("ev is null!!!");
+ return;
+ }
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_CAMERA, NULL);
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y)
+ return;
+
+ __group_input_camera(cgroup_input_d);
+
+}
+static void __group_input_camera_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_CAMERA_PRESSED, NULL);
+}
+
+static Evas_Object* group_input_gl_create_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ p_retvm_if(NULL== data, NULL, "The parameter(data) is NULL");
+
+ if (0 == strcmp(part, "elm.icon")) {
+ static Elm_Entry_Filter_Limit_Size limit_filter_data;
+ Evas_Object *edit_field;
+ Evas_Object *entry;
+
+ edit_field = ctui_create_editfield(obj, T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP_NAME), NULL, false);
+ evas_object_propagate_events_set(edit_field, EINA_FALSE);
+
+ entry = elm_object_part_content_get(edit_field, "elm.swallow.content");
+ elm_object_signal_emit(edit_field, "elm,state,guidetext,hide", "elm");
+ evas_object_data_set(obj,"entry", entry);
+ cgroup_input_d->entry = entry;
+
+ limit_filter_data.max_char_count = CT_EDITFIELD_MAX_CHAR;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+ evas_object_smart_callback_add(entry, "changed", group_input_entry_changed_cb, cgroup_input_d);
+ evas_object_smart_callback_add(entry, "preedit,changed", group_input_entry_changed_cb, cgroup_input_d);
+ evas_object_smart_callback_add(entry, "focused", group_input_err_entry_focused_cb, cgroup_input_d);
+
+ if(cgroup_input_d->editgroup == true)
+ ctui_entry_entry_set(entry, cgroup_input_d->gname);
+
+ if(cgroup_input_d->is_read_only == true)
+ elm_object_disabled_set(entry,EINA_TRUE);
+
+ evas_object_show(entry);
+
+ return edit_field;
+ }
+ return NULL;
+}
+
+static Evas_Object* group_input_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ p_retvm_if(NULL== data, NULL, "The parameter(data) is NULL");
+
+ if (0 == strcmp(part, "elm.icon")) {
+ Evas_Object *icon;
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ PH_DBG("img : %s",cgroup_input_d->img);
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, cgroup_input_d->img, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(icon, 0.5, EVAS_HINT_FILL);
+ }
+ else {
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, CTUI_IMG_INPUT_GALLERY, NULL);
+ elm_icon_resizable_set(icon, EINA_FALSE, EINA_FALSE);
+ }
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_DOWN, __group_input_gallery_mouse_down, cgroup_input_d);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP, __group_input_gallery_mouse_up, cgroup_input_d);
+ return icon;
+ }
+ if (0 == strcmp(part, "elm.icon3")) {
+ Evas_Object *icon = NULL;
+
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, CTUI_IMG_INPUT_CAMERA, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(icon, 0.5, EVAS_HINT_FILL);
+ evas_object_propagate_events_set(icon, EINA_FALSE);
+ evas_object_color_set(icon, 255, 255, 255, 255);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_DOWN, __group_input_camera_mouse_down, cgroup_input_d);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP, __group_input_camera_mouse_up, cgroup_input_d);
+ //evas_object_smart_callback_add(icon, "clicked", group_input_image_camera_cb, cgroup_input_d);
+ return icon;
+ }
+ if (0 == strcmp(part, "elm.icon4")) {
+ Evas_Object *btn_minus;
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ btn_minus = elm_button_add(obj);
+ p_retvm_if(NULL == btn_minus, NULL, "elm_button_add() return NULL");
+ elm_object_style_set(btn_minus, "icon_minus");
+ evas_object_size_hint_aspect_set(btn_minus, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(btn_minus, 0.5, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn_minus, "clicked", group_input_image_delete_cb, cgroup_input_d);
+ return btn_minus;
+ }
+ else
+ return NULL;
+ }
+ return NULL;
+}
+
+int group_input_get_member_list(int group_id, Eina_List **list)
+{
+ int ret;
+ int person_id;
+ contacts_record_h record = NULL;
+ contacts_list_h person_list = NULL;
+
+ ret = phone_cts_get_list(_contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, group_id, &person_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "phone_cts_get_list() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(person_list,&record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while (record) {
+ ct_person_list *person_info;
+ char *display_name = NULL;
+ char *addressbook_ids = NULL;
+
+ ret = contacts_record_get_int(record, _contacts_person.id,&person_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_int() Failed(%d)", ret);
+
+ person_info = calloc(1, sizeof(ct_person_list));
+ person_info->id = person_id;
+ ret = contacts_record_get_str_p(record, _contacts_person.display_name,&display_name);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_str_p() Failed(%d)", ret);
+ person_info->display = SAFE_STRDUP(display_name);
+
+ ret = contacts_record_get_int(record, _contacts_person.link_count,&(person_info->link_count));
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_int() Failed(%d)", ret);
+
+ ret = contacts_record_get_str(record, _contacts_person.addressbook_ids,&addressbook_ids);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_int() Failed(%d)", ret);
+ person_info->addressbook_id_list = ctui_get_addressbook_id_list(addressbook_ids, " ");
+
+ *list = eina_list_append(*list, person_info);
+
+ ret = contacts_list_next(person_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_next() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(person_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ ret = contacts_list_destroy(person_list, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_destroy() Failed(%d)", ret);
+
+ return ret;
+}
+
+
+static void group_input_add_member_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ p_retm_if(NULL == cgroup_input_d, "parameter(cgroup_input_d) is NULL");
+
+ ctui_create_gadd_list_select_view(cgroup_input_d->win, cgroup_input_d->navi, cgroup_input_d->id_grp, cgroup_input_d->id_ab, cgroup_input_d->member_list);
+}
+static Evas_Object* group_input_gl_btn_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *ret_obj;
+ ct_group_input_data *cgroup_input_d = data;
+ p_retvm_if(NULL == cgroup_input_d, NULL, "parameter(cgroup_input_d) is NULL");
+
+ ret_obj = NULL;
+ if (0 == strcmp(part, "elm.icon")) {
+ Evas_Object *btn;
+ btn = ctui_create_btn(obj, T_(CT_GET_TEXT_BASE_OP, CTTEXT_ADD_MEMBER));
+ p_retvm_if(NULL == btn, NULL, "ctui_create_btn() return NULL");
+ evas_object_smart_callback_add(btn, "clicked", group_input_add_member_clicked_cb, cgroup_input_d);
+
+ ret_obj = btn;
+ }
+ return ret_obj;
+}
+
+
+static void group_input_genlist_style_set(void)
+{
+ group_input_itcs[GINPUT_ITC_GROUP_IMAGE].func.content_get = group_input_gl_icon_get;
+ group_input_itcs[GINPUT_ITC_GROUP_CREATE].func.content_get = group_input_gl_create_icon_get;
+ group_input_itcs[GINPUT_ITC_GROUP_VIBRATION].func.text_get = group_input_gl_vibration_label_get;
+ group_input_itcs[GINPUT_ITC_GROUP_RINGTON].func.text_get = group_input_gl_ringtone_label_get;
+ group_input_itcs[GINPUT_ITC_ADDRBOOK].func.text_get = group_input_gl_label_get;
+ group_input_itcs[GINPUT_ITC_ADDMEM_BUTTON].func.content_get = group_input_gl_btn_icon_get;
+}
+
+static void group_input_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ if (cgroup_input_d->popup)
+ evas_object_del(cgroup_input_d->popup);
+ if (cgroup_input_d->th) {
+ elm_theme_extension_del(cgroup_input_d->th, IMAGE_LAYOUT_EDJ);
+ elm_theme_free(cgroup_input_d->th);
+ }
+
+ if (cgroup_input_d->src_ug)
+ ug_destroy(cgroup_input_d->src_ug);
+
+ if (cgroup_input_d->crop_ug)
+ ug_destroy(cgroup_input_d->crop_ug);
+
+ if (cgroup_input_d->win_prop_change)
+ ecore_event_handler_del(cgroup_input_d->win_prop_change);
+
+ evas_object_data_del(cgroup_input_d->navi, "navi_it_pop_to");
+ ctui_list_free_contacts(cgroup_input_d->member_list);
+ free(cgroup_input_d->ab_name);
+ free(cgroup_input_d->gname_old);
+ free(cgroup_input_d->gname);
+ free(cgroup_input_d->img);
+ free(cgroup_input_d->ringtone);
+ free(cgroup_input_d->vibration);
+ free(cgroup_input_d);
+}
+
+static Eina_Bool group_input_win_prop_change(void *data, int type, void *event)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ Evas_Object *l_btn, *r_btn;
+ char *text;
+ Ecore_X_Event_Window_Property *ev = event;
+ Ecore_X_Virtual_Keyboard_State state = ecore_x_e_virtual_keyboard_state_get(ev->win);
+
+ p_retvm_if(NULL == cgroup_input_d, ECORE_CALLBACK_CANCEL, "parameter(clist_d) is NULL");
+ p_retvm_if(NULL == cgroup_input_d->navi_it, ECORE_CALLBACK_CANCEL, "parameter(clist_d->navi_it) is NULL");
+ if (ECORE_X_VIRTUAL_KEYBOARD_STATE_ON == state &&
+ NULL == elm_object_item_part_content_get(cgroup_input_d->navi_it, "title_left_btn")) {
+ l_btn = phone_create_navi_btn(cgroup_input_d->navi, "plus");
+ evas_object_smart_callback_add(l_btn, "clicked", group_input_save_btn_cb, cgroup_input_d);
+ evas_object_show(l_btn);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_left_btn", l_btn);
+ text = ctui_entry_markup_to_utf8(elm_entry_entry_get(cgroup_input_d->entry));
+ p_retvm_if(NULL == text, ECORE_CALLBACK_PASS_ON, "ctui_entry_markup_to_utf8() return NULL");
+ if (*text)
+ elm_object_disabled_set(l_btn, EINA_FALSE);
+ else
+ elm_object_disabled_set(l_btn, EINA_TRUE);
+
+ r_btn = phone_create_navi_btn(cgroup_input_d->navi, "naviframe/prev_btn/default");
+ evas_object_smart_callback_add(r_btn, "clicked", phone_view_back_btn_cb, cgroup_input_d->navi);
+ evas_object_show(r_btn);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_right_btn", r_btn);
+
+ free(text);
+ }
+ else if (ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF == state &&
+ NULL != elm_object_item_part_content_get(cgroup_input_d->navi_it, "title_left_btn")) {
+
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_left_btn", NULL);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_right_btn", NULL);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void group_input_get_data(ct_group_input_data *cgroup_input_d)
+{
+ PH_FN_CALL;
+ char *img = NULL;
+ char *vibration = NULL;
+ char *ringtone = NULL;
+ char *gname = NULL;
+ bool is_read_only = false;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_record(_contacts_group._uri,cgroup_input_d->id_grp,&record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+ err = contacts_record_get_str_p(record,_contacts_group.image_path,&img);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ cgroup_input_d->img = SAFE_STRDUP(img);
+
+ err = contacts_record_get_str_p(record,_contacts_group.vibration,&vibration);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ cgroup_input_d->vibration = SAFE_STRDUP(vibration);
+
+ err = contacts_record_get_str_p(record,_contacts_group.ringtone_path,&ringtone);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ cgroup_input_d->ringtone = SAFE_STRDUP(ringtone);
+
+ err = contacts_record_get_str_p(record,_contacts_group.name,&gname);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (gname && *gname) {
+ if (strcmp(gname,"friends") == 0)
+ gname = T_(CT_GET_TEXT_BASIC, CTTEXT_FRIENDS);
+ else if (strcmp(gname,"family") == 0)
+ gname = T_(CT_GET_TEXT_BASIC, CTTEXT_FAMILY);
+ else if (strcmp(gname,"coworkers") == 0)
+ gname = T_(CT_GET_TEXT_BASIC, CTTEXT_CO_WORKERS);
+ }
+
+ cgroup_input_d->gname = SAFE_STRDUP(gname);
+ cgroup_input_d->gname_old = SAFE_STRDUP(gname);
+
+ err = contacts_record_get_bool(record,_contacts_group.is_read_only,&is_read_only);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+ cgroup_input_d->is_read_only = is_read_only;
+
+ err = contacts_record_destroy(record, true);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+}
+
+void ctui_create_group_input_view(Evas_Object *win, Evas_Object *navi, ct_group_list *info, ct_group_input_result_cb result_cb, void *cb_data)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d;
+ Evas_Object *layout;
+ Evas_Object *bg;
+ Evas_Object *back_btn;
+ Elm_Theme *th;
+
+ cgroup_input_d = calloc(1, sizeof(ct_group_input_data));
+ p_retm_if(NULL == cgroup_input_d, "calloc() return NULL");
+
+ if(info != NULL){
+ cgroup_input_d->id_grp = info->id_grp;
+
+ cgroup_input_d->id_ab = info->id_ab;
+ group_input_get_data(cgroup_input_d);
+ cgroup_input_d->editgroup = true;
+ group_input_get_member_list(cgroup_input_d->id_grp, &cgroup_input_d->member_list);
+ PH_DBG("cgroup_input_d->id_grp : %d",cgroup_input_d->id_grp );
+ }
+ else{
+ cgroup_input_d->editgroup = false;
+ cgroup_input_d->id_ab = 0;
+ }
+ cgroup_input_d->win = win;
+ cgroup_input_d->navi = navi;
+ cgroup_input_d->result_cb = result_cb;
+ cgroup_input_d->result_cb_data = cb_data;
+
+ layout = phone_create_base_layout(cgroup_input_d->navi, false);
+ bg = phone_create_bg(layout);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ free(cgroup_input_d);
+ evas_object_del(layout);
+ return;
+ }
+
+ elm_win_conformant_set(cgroup_input_d->win, EINA_TRUE);
+ cgroup_input_d->win_prop_change = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, group_input_win_prop_change, cgroup_input_d);
+ cgroup_input_d->genlist = elm_genlist_add(layout);
+ elm_object_style_set(cgroup_input_d->genlist, "dialogue");
+ elm_object_style_set(cgroup_input_d->genlist, "no_effect");
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, IMAGE_LAYOUT_EDJ);
+ cgroup_input_d->th = th;
+ elm_object_theme_set(cgroup_input_d->genlist, cgroup_input_d->th);
+ elm_genlist_decorate_mode_set(cgroup_input_d->genlist, EINA_TRUE);
+ group_input_genlist_style_set();
+ evas_object_size_hint_weight_set(cgroup_input_d->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cgroup_input_d->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(cgroup_input_d->genlist);
+ elm_object_part_content_set(layout, "elm.swallow.content", cgroup_input_d->genlist);
+ group_input_fill_genlist(cgroup_input_d);
+
+ back_btn = elm_button_add(cgroup_input_d->navi);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", phone_view_back_btn_cb, cgroup_input_d->navi);
+
+ phone_navi_item_clear(cgroup_input_d->navi_it);
+
+ if(cgroup_input_d->editgroup == true){
+ cgroup_input_d->navi_it = elm_naviframe_item_push(cgroup_input_d->navi,
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_EDIT_GROUP), back_btn, NULL, layout, NULL);
+ evas_object_data_set(cgroup_input_d->navi, "navi_it_pop", cgroup_input_d->navi_it);
+ }
+ else{
+ cgroup_input_d->navi_it = elm_naviframe_item_push(cgroup_input_d->navi,
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_CREATE_GROUP), back_btn, NULL, layout, NULL);
+ evas_object_data_set(cgroup_input_d->navi, "navi_it_pop", evas_object_data_get(cgroup_input_d->navi, "navi_it_pop_to"));
+ }
+
+ cgroup_input_d->done_button = phone_create_toolbar_btn(cgroup_input_d->navi, S_(CT_SYS_SK_DONE), group_input_save_btn_cb, cgroup_input_d);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "toolbar_button1", cgroup_input_d->done_button);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_TRUE);
+
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL,
+ group_input_view_delete_cb, cgroup_input_d);
+}
diff --git a/lib/common/ct-list-detail.c b/lib/common/ct-list-detail.c
new file mode 100755
index 0000000..aa12524
--- /dev/null
+++ b/lib/common/ct-list-detail.c
@@ -0,0 +1,464 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <aul.h>
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-common.h"
+
+#include "ct-list.h"
+
+inline void ctui_ld_to_dd(ct_list_data *clist_d, ct_detail_data *cdetail_d)
+{
+ cdetail_d->win = clist_d->win;
+ cdetail_d->navi = clist_d->navi;
+ cdetail_d->base_grp = clist_d->base_grp;
+ cdetail_d->base_ab = clist_d->base_ab;
+ cdetail_d->ug = clist_d->ug;
+ cdetail_d->prev_navi_item = clist_d->navi_item;
+ cdetail_d->prev_view_data = clist_d;
+}
+
+void ctui_get_number_type_str(contacts_record_h record, int number_type, char *dest, int dest_len)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ const char* type_str;
+ char *custom = NULL;
+
+ if (number_type & CONTACTS_NUMBER_TYPE_CUSTOM) {
+ err = contacts_record_get_str_p(record, _contacts_number.label, &custom);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (NULL == custom || '\0' == custom[0])
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_OTHER);
+ else {
+ snprintf(dest, dest_len, "%s", custom);
+ return;
+ }
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_CELL) {
+ if (number_type & CONTACTS_NUMBER_TYPE_HOME)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_HOME2);
+ else if (number_type & CONTACTS_NUMBER_TYPE_WORK)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_WORK2);
+ else
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_MOBILE);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_VOICE) {
+ if (number_type & CONTACTS_NUMBER_TYPE_HOME)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_HOME);
+ else if (number_type & CONTACTS_NUMBER_TYPE_WORK)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_WORK);
+ else
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_TELEPHONE);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_FAX) {
+ if (number_type & CONTACTS_NUMBER_TYPE_HOME)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_FAX_HOME);
+ else if (number_type & CONTACTS_NUMBER_TYPE_WORK)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_FAX_WORK);
+ else
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_FAX);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_PAGER)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_PAGER);
+ else if (number_type & CONTACTS_NUMBER_TYPE_CAR)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_CAR);
+ else if (number_type & CONTACTS_NUMBER_TYPE_ASSISTANT)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_ASSISTANT);
+ else {
+ if (number_type == CONTACTS_NUMBER_TYPE_HOME)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_HOME);
+ else if (number_type == CONTACTS_NUMBER_TYPE_WORK)
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_WORK);
+ else
+ type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_OTHER);
+ }
+
+ snprintf(dest, dest_len, "%s", type_str);
+}
+
+const char* ctui_get_default_contact_img(int view_type)
+{
+ switch (view_type) {
+ case CT_VIEW_DETAIL:
+ return CTUI_IMG_DEFAULT_PHOTO_BIG;
+
+ case CT_VIEW_INPUT:
+ return CTUI_IMG_PHOTO_EDIT;
+
+ case CT_VIEW_ETC:
+ default:
+ return CTUI_IMG_DEFAULT_PHOTO_SMALL;
+ }
+}
+
+Evas_Object* ctui_create_btn(Evas_Object *parent, const char *label)
+{
+ Evas_Object *btn;
+
+ btn = elm_button_add(parent);
+ p_retvm_if(NULL == btn, NULL, "elm_button_add() return NULL");
+
+ elm_object_text_set(btn, label);
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_show(btn);
+
+ return btn;
+}
+
+void ctui_destroy_child_ug(void *data)
+{
+ void **child = data;
+ *child = NULL;
+}
+
+void* ctui_msg_ug(ui_gadget_h parent, const char *number, const int person_id,
+ const char *attach, void(*destroy_cb)(void*), void *cb_param)
+{
+ struct ug_cbs cbs = {0};
+ ui_gadget_h ug;
+ struct ug_priv_data *priv_data;
+ service_h service;
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retvm_if(NULL == priv_data, NULL, "calloc is failed");
+ priv_data->destroy_cb = destroy_cb;
+ priv_data->cb_param = cb_param;
+
+ service_create(&service);
+
+ if (number && person_id) {
+ char temp[PH_TEXT_MAX_LEN+1] = {0,};
+ snprintf(temp, sizeof(temp), "%s/%d", number, person_id);
+ service_add_extra_data(service, "number/index", temp);
+ }
+ else if (number) {
+ service_add_extra_data(service, "TO", number);
+ }
+
+ if (attach) {
+ service_add_extra_data(service, "ATTACHFILE", attach);
+ service_add_extra_data(service, "SUBJECT", "Contacts name card");
+ }
+
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_common_destroy_cb;
+ cbs.priv = priv_data;
+
+ ug = ug_create(parent, MSG_COMPOSER_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == ug, "ug_create() Failed");
+
+ service_destroy(service);
+ return ug;
+}
+
+void ctui_entry_limit_size_set(Evas_Object *entry)
+{
+ static Elm_Entry_Filter_Limit_Size filter;
+ p_retm_if(NULL == entry, "parameter(entry) is NULL");
+
+ filter.max_char_count = CT_EDITFIELD_MAX_CHAR;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &filter);
+}
+
+void ctui_genlist_append_separator_10px(Evas_Object *genlist)
+{
+ static Elm_Genlist_Item_Class itc = { .item_style="dialogue/separator/10" };
+
+ Elm_Object_Item *item;
+ item = elm_genlist_item_append(genlist, &itc, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+}
+
+void ctui_genlist_append_separator_20px(Evas_Object *genlist)
+{
+ static Elm_Genlist_Item_Class itc = { .item_style="dialogue/separator/20" };
+
+ Elm_Object_Item *item;
+ item = elm_genlist_item_append(genlist, &itc, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+}
+
+void ctui_navi_btn_disabled_set(Evas_Object *navi, Eina_Bool disabled)
+{
+ Evas_Object *done_button, *delete_item, *share_button;
+
+ p_retm_if(NULL == navi, "parameter(navi) is NULL");
+
+ done_button = evas_object_data_get(navi, "done_button");
+ delete_item = evas_object_data_get(navi, "delete_button");
+ share_button = evas_object_data_get(navi, "share_button");
+
+ if(done_button)
+ elm_object_disabled_set(done_button, disabled);
+ if(delete_item)
+ elm_object_disabled_set(delete_item, disabled);
+ if(share_button)
+ elm_object_disabled_set(share_button, disabled);
+}
+
+char* ctui_entry_markup_to_utf8(const char *s)
+{
+ int i;
+ char *ret;
+
+ ret = elm_entry_markup_to_utf8(s);
+ p_retvm_if(NULL == ret, NULL, "elm_entry_markup_to_utf8() return NULL");
+
+ for (i = 0; i < strlen(ret); i++)
+ if (' ' != ret[i]) return ret;
+
+ ret[0] = '\0';
+ return ret;
+}
+
+void ctui_entry_entry_set(Evas_Object *entry, const char *s)
+{
+ char *s_markup;
+ s_markup = elm_entry_utf8_to_markup(s);
+ elm_entry_entry_set(entry, s_markup);
+ free(s_markup);
+}
+
+
+enum LIST_DETAIL_ITC_TYPE{
+ LIST_DETAIL_ITC_ADDRBOOK,
+ LIST_DETAIL_ITC_ADDRBOOK_EDIT,
+ LIST_DETAIL_ITC_ADDRBOOK_NAME,
+ LIST_DETAIL_ITC_ADDRBOOK_NAME_EDIT,
+ LIST_DETAIL_ITC_MAX,
+};
+
+static Elm_Genlist_Item_Class list_detail_itcs[] = {
+ {.item_style="2text.1icon.9"},
+ {.item_style="2text.2icon.5"},
+ {.item_style="1text.1icon.2"},
+ {.item_style="1text.2icon.2"},
+};
+
+static void list_detail_addrbook_gl_del(void *data, Evas_Object *obj)
+{
+ ct_ab_popup_data *info = data;
+ p_retm_if(NULL == info, "data is NULL");
+ free(info->name);
+ free(info);
+}
+
+static char* list_detail_addrbook_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_ab_popup_data *ab_popup_data = data;
+ p_retvm_if(NULL == ab_popup_data, NULL, "parameter(ab_popup_data) is NULL");
+
+ if (0 == strcmp(part, "elm.text") || 0 == strcmp(part, "elm.text.2")) {
+ if (0 == ab_popup_data->id)
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ else
+ return SAFE_STRDUP(ab_popup_data->name);
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ char buf[PH_TEXT_MAX_LEN+1];
+ buf[0] = '\0';
+ ctui_get_account_name_by_address_book_id(ab_popup_data->id, buf, sizeof(buf));
+ if (*buf)
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static Evas_Object* list_detail_addrbook_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ int selected_id;
+ Evas_Object *radio;
+ Evas_Object *radio_main;
+
+ ct_ab_popup_data *ab_popup_data = data;
+ p_retvm_if(NULL == ab_popup_data, NULL, "parameter(ab_popup_data) is NULL");
+
+ if (0 == strcmp(part, "elm.icon.1") || ab_popup_data->all_contacts_item == true) {
+ radio = elm_radio_add(obj);
+ p_retvm_if(NULL == radio, NULL, "elm_radio_add() return NULL");
+
+ selected_id = (int)evas_object_data_get(obj, "selected_id");
+ if (-1 == ab_popup_data->id) {
+ evas_object_data_set(obj, "radio_main", radio);
+ }
+ else {
+ radio_main = evas_object_data_get(obj, "radio_main");
+ p_retvm_if(NULL == radio_main, NULL, "evas_object_data_get() return NULL");
+ elm_radio_group_add(radio, radio_main);
+ }
+
+ elm_radio_state_value_set(radio, ab_popup_data->id);
+ if (selected_id == ab_popup_data->id)
+ elm_radio_value_set(radio, selected_id);
+
+ evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_propagate_events_set(radio, EINA_FALSE);
+
+ return radio;
+ }
+ else if (0 == strcmp(part, "elm.icon") || 0 == strcmp(part, "elm.icon.2")) {
+ char *icon_path;
+ Evas_Object *icon;
+ icon_path = ctui_get_addressbook_icon_path(ab_popup_data->id);
+
+ if (icon_path && *icon_path) {
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+
+ elm_icon_file_set(icon, icon_path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ free(icon_path);
+ return icon;
+ }
+ }
+ return NULL;
+}
+
+
+static inline void list_detail_create_itcs()
+{
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK].func.text_get = list_detail_addrbook_gl_label_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK].func.content_get = list_detail_addrbook_gl_icon_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK].func.del = list_detail_addrbook_gl_del;
+
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_EDIT].func.text_get = list_detail_addrbook_gl_label_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_EDIT].func.content_get = list_detail_addrbook_gl_icon_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_EDIT].func.del = list_detail_addrbook_gl_del;
+
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME].func.text_get = list_detail_addrbook_gl_label_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME].func.content_get = list_detail_addrbook_gl_icon_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME].func.del = list_detail_addrbook_gl_del;
+
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME_EDIT].func.text_get = list_detail_addrbook_gl_label_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME_EDIT].func.content_get = list_detail_addrbook_gl_icon_get;
+ list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME_EDIT].func.del = list_detail_addrbook_gl_del;
+}
+
+
+Evas_Object* ctui_addrbook_popup(Evas_Object *parent, Evas_Smart_Cb item_sel_cb, void *sel_cb_data, ct_addrbook_popup_type ab_type)
+{
+ PH_FN_CALL;
+ int addressbook_id;
+ int addressbook_mode;
+ char *addressbook_name;
+ Evas_Object *genlist;
+ Evas_Object *popup;
+ Elm_Object_Item *item;
+ ct_ab_popup_data *ab_popup_data;
+ Elm_Genlist_Item_Class *itc, *itc_name, *itc_all_contacts;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+
+ list_detail_create_itcs();
+
+ popup = elm_popup_add(parent);
+ p_retvm_if(NULL == popup, NULL, "elm_popup_add() return NULL");
+ elm_object_style_set(popup, "liststyle");
+
+ genlist = elm_genlist_add(popup);
+ p_retvm_if(NULL == genlist, NULL, "elm_genlist_add() return NULL");
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ if (CT_AB_POPUP_TYPE_LIST_VIEW == ab_type) {
+ ct_list_data *clist_d = sel_cb_data;
+
+ itc = &list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_EDIT];
+ itc_name = &list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME_EDIT];
+ itc_all_contacts = &list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME];
+
+ if (CT_GET_LIST_PERSON_OF_ADDRBOOK_ID == clist_d->list_op)
+ evas_object_data_set(genlist, "selected_id", (void *)clist_d->base_ab);
+ else
+ evas_object_data_set(genlist, "selected_id", (void *)-1);
+
+ /* All contacts */
+ ab_popup_data = calloc(1, sizeof(ct_ab_popup_data));
+ p_retvm_if(NULL == ab_popup_data, NULL, "calloc() return NULL");
+ ab_popup_data->id = -1;
+ ab_popup_data->name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_ALL_CONTACTS));
+ ab_popup_data->all_contacts_item = true;
+
+ item = elm_genlist_item_append(genlist, itc_all_contacts, ab_popup_data,
+ NULL, ELM_GENLIST_ITEM_NONE, item_sel_cb, sel_cb_data);
+ ab_popup_data->item = item;
+ }
+ else {
+ itc = &list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK];
+ itc_name = &list_detail_itcs[LIST_DETAIL_ITC_ADDRBOOK_NAME];
+ }
+
+ err = contacts_db_get_all_records(_contacts_address_book._uri, 0, 0, &list);
+ while (CONTACTS_ERROR_NONE == err) {
+ phone_cts_get_int_from_list(list, _contacts_address_book.mode, &addressbook_mode);
+ if (addressbook_mode == CONTACTS_ADDRESS_BOOK_MODE_READONLY && CT_AB_POPUP_TYPE_LIST_VIEW != ab_type) {
+ err = contacts_list_next(list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ continue;
+ }
+
+ ab_popup_data = calloc(1, sizeof(ct_ab_popup_data));
+ if (NULL == ab_popup_data) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+
+ err = phone_cts_get_int_from_list(list, _contacts_address_book.id, &addressbook_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_address_book.name, &addressbook_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() Failed(%d)", err);
+
+ ab_popup_data->id = addressbook_id;
+ ab_popup_data->mode = addressbook_mode;
+ ab_popup_data->name = addressbook_name;
+
+ if (0 == ab_popup_data->id){
+ item = elm_genlist_item_append(genlist, itc_name, ab_popup_data, NULL,
+ ELM_GENLIST_ITEM_NONE, item_sel_cb, sel_cb_data);
+ }
+ else{
+ item = elm_genlist_item_append(genlist, itc, ab_popup_data, NULL,
+ ELM_GENLIST_ITEM_NONE, item_sel_cb, sel_cb_data);
+ }
+
+ ab_popup_data->item = item;
+
+ err = contacts_list_next(list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ }
+
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err,"contacts_list_destroy() Failed(%d)", err);
+
+ elm_object_content_set(popup, genlist);
+ evas_object_show(popup);
+ return popup;
+}
+
+void ctui_list_ug_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ug_destroy_me(data);
+}
+
+
+
diff --git a/lib/common/ct-list-view-common.c b/lib/common/ct-list-view-common.c
new file mode 100755
index 0000000..b4649c0
--- /dev/null
+++ b/lib/common/ct-list-view-common.c
@@ -0,0 +1,2436 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#define _GNU_SOURCE // for strcasestr
+#include <aul.h>
+#include <string.h>
+#include <ui-gadget-module.h>
+#include <unicode/ulocdata.h>
+#include <unicode/uset.h>
+#include <unicode/ustring.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#include "phone.h"
+#include "phone-common.h"
+#include "ct-list.h"
+
+static char pre_search_str[CT_LIST_MAX_SEARCH_STR];
+
+static void list_get_number_str(int id, char *buf, int buf_len);
+
+void ctui_list_free_contacts(Eina_List* list)
+{
+ ct_person_list *person_info;
+ Eina_List* l;
+
+ EINA_LIST_FOREACH(list, l, person_info) {
+ if (person_info) {
+
+ eina_list_free(person_info->addressbook_id_list);
+ free(person_info->img_path);
+ free(person_info->display);
+ free(person_info->display_index);
+ free(person_info->number);
+ free(person_info->status_str);
+ if (person_info->number_list)
+ ctui_free_record_list(person_info->number_list);
+ if (person_info->email_list)
+ ctui_free_record_list(person_info->email_list);
+ free(person_info);
+ }
+ }
+ eina_list_free(list);
+}
+
+void ctui_list_free_index(Eina_List* list)
+{
+ ct_list_index_data *data;
+ Eina_List* l;
+
+ EINA_LIST_FOREACH(list, l, data) {
+ if (data) {
+ free(data);
+ }
+ }
+ eina_list_free(list);
+}
+
+static inline int list_get_grp_person_id(Eina_List *list)
+{
+ ct_person_list *person_info;
+ if (NULL == list) return 0;
+ person_info = list->data;
+ return person_info->id;
+}
+
+static contacts_filter_h list_create_filter_int(contacts_filter_h filter, const char *view_uri, int property_id, contacts_match_int_flag_e flag, int match_value)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ if (NULL == filter) {
+ err = contacts_filter_create(view_uri, &filter);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_filter_create() Failed(%d)", err);
+ }
+ else {
+ err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_add_operator() Failed(%d)", err);
+ }
+
+ err = contacts_filter_add_int(filter, property_id, flag, match_value);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_add_int() Failed(%d)", err);
+
+ return filter;
+}
+
+static contacts_filter_h list_create_filter_bool(contacts_filter_h filter, const char *view_uri, int property_id, contacts_match_int_flag_e flag, bool match_value)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ if (NULL == filter) {
+ err = contacts_filter_create(view_uri, &filter);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_filter_create() Failed(%d)", err);
+ }
+ else {
+ err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_add_operator() Failed(%d)", err);
+ }
+
+ err = contacts_filter_add_bool(filter, property_id, match_value);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_add_int() Failed(%d)", err);
+
+ return filter;
+}
+
+
+int ct_list_get_contacts(ct_list_data *clist_d, Eina_List **list_out)
+{
+ PH_FN_CALL;
+ unsigned int count = 0;
+ int person_id;
+ int grp_person_id;
+
+ unsigned int person_contact_projection[] = {
+ _contacts_person_contact.person_id,
+ _contacts_person_contact.status,
+ _contacts_person_contact.display_name,
+ _contacts_person_contact.display_name_index,
+ _contacts_person_contact.addressbook_ids,
+ };
+ unsigned int person_grouprel_projection[] = {
+ _contacts_person_grouprel.person_id,
+ _contacts_person_grouprel.status,
+ _contacts_person_grouprel.display_name,
+ _contacts_person_grouprel.display_name_index,
+ _contacts_person_grouprel.addressbook_ids,
+ };
+ unsigned int person_projection[] = {
+ _contacts_person.id,
+ _contacts_person.status,
+ _contacts_person.display_name,
+ _contacts_person.display_name_index,
+ _contacts_person.addressbook_ids,
+ };
+
+ const char *view_uri = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_filter_h filter2 = NULL;
+
+ Eina_List *result = NULL;
+
+ p_retvm_if(NULL == list_out, CONTACTS_ERROR_INTERNAL, "parameter(list_out) is NULL");
+ *list_out = NULL;
+
+ PH_DBG("clist_d->list_op : %d",clist_d->list_op);
+ switch (clist_d->list_op) {
+ case CT_GET_LIST_ALL_PERSON:
+ view_uri = _contacts_person._uri;
+ if (clist_d->search_str && *clist_d->search_str) {
+ err = contacts_db_search_records(_contacts_person._uri, clist_d->search_str, 0, 0, &list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_search_records() Failed(%d)", err);
+ }
+ else {
+ PH_DBG("_contacts_person");
+ err = contacts_db_get_all_records(_contacts_person._uri, 0, 0, &list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_all_records() Failed(%d)", err);
+ }
+ break;
+ case CT_GET_LIST_ALL_PERSON_HAD_NUMBER:
+ view_uri = _contacts_person._uri;
+
+ err = contacts_query_create(_contacts_person._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ do {
+ filter = list_create_filter_bool(filter, _contacts_person._uri, _contacts_person.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_projection, sizeof(person_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_ALL_PERSON_HAD_EMAIL:
+ view_uri = _contacts_person._uri;
+
+ err = contacts_query_create(_contacts_person._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_bool(filter, _contacts_person._uri, _contacts_person.has_email, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_projection, sizeof(person_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+
+ case CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL:
+ view_uri = _contacts_person._uri;
+
+ err = contacts_query_create(_contacts_person._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_bool(filter, _contacts_person._uri, _contacts_person.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_bool(filter, _contacts_person.has_email, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_projection, sizeof(person_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_PERSON_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_contact._uri;
+
+ err = contacts_query_create(_contacts_person_contact._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_contact._uri, _contacts_person_contact.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_contact_projection, sizeof(person_contact_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+
+ case CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID:
+ view_uri = _contacts_person_contact._uri;
+
+ err = contacts_query_create(_contacts_person_contact._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_contact._uri, _contacts_person_contact.address_book_mode, CONTACTS_MATCH_EQUAL, CONTACTS_ADDRESS_BOOK_MODE_NONE);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_contact_projection, sizeof(person_contact_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_contact._uri;
+
+ err = contacts_query_create(_contacts_person_contact._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_contact._uri, _contacts_person_contact.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter = list_create_filter_bool(filter, _contacts_person_contact._uri, _contacts_person_contact.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_contact_projection, sizeof(person_contact_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_contact._uri;
+
+ err = contacts_query_create(_contacts_person_contact._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_contact._uri, _contacts_person_contact.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter = list_create_filter_bool(filter, _contacts_person_contact._uri, _contacts_person_contact.has_email, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_contact_projection, sizeof(person_contact_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ break;
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_contact._uri;
+
+ err = contacts_query_create(_contacts_person_contact._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_contact._uri, _contacts_person_contact.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter2 = list_create_filter_bool(NULL, _contacts_person_contact._uri, _contacts_person_contact.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter2, CONTACTS_FILTER_OPERATOR_OR))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_bool(filter2, _contacts_person_contact.has_email, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_filter(filter, filter2))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_contact_projection, sizeof(person_contact_projection)/sizeof(int)))) break;
+
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ contacts_filter_destroy(filter);
+ contacts_filter_destroy(filter2);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_PERSON_OF_GROUP_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_EQUAL, clist_d->base_grp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OF_GROUP_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_EQUAL, clist_d->base_grp);
+ filter = list_create_filter_bool(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true) )) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_PERSON_HAD_EMAIL_OF_GROUP_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_EQUAL, clist_d->base_grp);
+ filter = list_create_filter_bool(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.has_email, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_GROUP_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_EQUAL, clist_d->base_grp);
+ filter2 = list_create_filter_bool(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter2, CONTACTS_FILTER_OPERATOR_OR))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_bool(filter2, _contacts_person_grouprel.has_email, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND))) break;
+
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_filter(filter, filter2))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_filter_destroy(filter2);
+ contacts_query_destroy(query);
+
+ break;
+
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter = list_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_NONE, 0);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true) )) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ break;
+
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter = list_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_NONE, 0);
+ filter2 = list_create_filter_bool(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter2, CONTACTS_FILTER_OPERATOR_OR))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_bool(filter2, _contacts_person_grouprel.has_email, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_filter(filter, filter2))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true) )) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_filter_destroy(filter2);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_EMAIL_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter = list_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_NONE, 0);
+ filter = list_create_filter_bool(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.has_email, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true) )) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ break;
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OF_ADDRBOOK_ID:
+ view_uri = _contacts_person_grouprel._uri;
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ do {
+ filter = list_create_filter_int(NULL, _contacts_person_grouprel._uri, _contacts_person_grouprel.address_book_id, CONTACTS_MATCH_EQUAL, clist_d->base_ab);
+ filter = list_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_NONE, 0);
+ filter = list_create_filter_bool(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.has_phonenumber, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true) )) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ if (clist_d->search_str && *clist_d->search_str) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_search_records_with_query(query, clist_d->search_str, 0, 0, &list))) break;
+ }
+ else {
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ }
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ break;
+ default:
+ ERR("Invalid op");
+ return CONTACTS_ERROR_INTERNAL;
+ }
+ PH_DBG("end cotnacts_db_get_list, start while");
+
+ clist_d->cnt_list_total = 0;
+
+ // group - add member
+ Eina_List *l;
+ Eina_List *list_grp_person;
+ list_grp_person = clist_d->list_grp_person;
+
+ p_retvm_if(NULL == list, CONTACTS_ERROR_INTERNAL, "list is NULL");
+
+ err = contacts_list_get_count(list, &count);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, CONTACTS_ERROR_INTERNAL, "contacts_list_get_count() Failed(%d)", err);
+ p_retvm_if(0 == count, CONTACTS_ERROR_NO_DATA, "list is empty");
+
+ while (err == CONTACTS_ERROR_NONE) {
+ ct_person_list *person_info;
+ char *temp_addressbooks = NULL;
+
+ if (0 == strcmp(_contacts_person_contact._uri,view_uri))
+ err = phone_cts_get_int_from_list(list, _contacts_person_contact.person_id, &person_id);
+ else
+ err = phone_cts_get_int_from_list(list, _contacts_person.id, &person_id);
+
+ if (person_id == clist_d->selected_person_id) {
+ contacts_list_next(list);
+ continue;
+ }
+ ct_person_list *data;
+ bool check = false;
+ EINA_LIST_FOREACH(list_grp_person,l,data){
+ if(data) {
+ grp_person_id = data->id;
+ PH_DBG("add member : grp_person_id =%d,person_id =%d",grp_person_id,person_id);
+ if (grp_person_id && grp_person_id == person_id) {
+ contacts_list_next(list);
+ check = true;
+ break;
+ }
+ }
+ else
+ ERR("list_grp_person' data is null");
+ }
+ if(check)continue;
+
+ person_info = calloc(1, sizeof(ct_person_list));
+ if (NULL == person_info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+ person_info->id = person_id;
+ if (0 == strcmp(_contacts_person_contact._uri,view_uri)) {
+ err = phone_cts_get_str_from_list(list, _contacts_person_contact.status, &(person_info->status_str));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_person_contact.display_name, &(person_info->display));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_person_contact.display_name_index, &(person_info->display_index));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_person_contact.addressbook_ids, &temp_addressbooks);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ person_info->addressbook_id_list = ctui_get_addressbook_id_list(temp_addressbooks, " ");
+ }
+ else {
+ err = phone_cts_get_str_from_list(list, _contacts_person.status, &(person_info->status_str));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_person.display_name, &(person_info->display));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ err = phone_cts_get_int_from_list(list, _contacts_person.link_count, &(person_info->link_count));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_person.display_name_index, &(person_info->display_index));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ err = phone_cts_get_str_from_list(list, _contacts_person.addressbook_ids, &temp_addressbooks);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ person_info->addressbook_id_list = ctui_get_addressbook_id_list(temp_addressbooks, " ");
+ }
+
+ result = eina_list_append(result, person_info);
+ clist_d->cnt_list_total++;
+
+ err = contacts_list_next(list);
+ }
+ *list_out = result;
+
+ if (CONTACTS_ERROR_NO_DATA != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ return err;
+ }
+ return 0;
+}
+
+static inline int list_check_utf8(char c)
+{
+ if (c < 128)
+ return 1;
+ else if ((c & 0xe0) == 0xc0)
+ return 2;
+ else if ((c & 0xf0) == 0xe0)
+ return 3;
+ else if ((c & 0xf8) == 0xf0)
+ return 4;
+ else if ((c & 0xfc) == 0xf8)
+ return 5;
+ else if ((c & 0xfe) == 0xfc)
+ return 6;
+ else
+ return CONTACTS_ERROR_INTERNAL;
+}
+
+void ct_list_init_account_data(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ int i = 0;
+ int account_id = 0;
+ int addressbook_id = 0;
+ bool addressbook_exist = false;
+ Eina_List *l = NULL;
+ ct_ab_map acc_types[CT_MAX_ADDRBOOK];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+ char addressbook_name[PH_TEXT_MAX_LEN]={0,};
+
+
+ addressbook_id = ctui_get_view_mode();
+
+ err = contacts_db_get_all_records(_contacts_address_book._uri, 0, 0, &list);
+ while (CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_int_from_list(list, _contacts_address_book.id, &(acc_types[i].id));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+ err = phone_cts_get_int_from_list(list, _contacts_address_book.account_id, &(acc_types[i].account_id));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+
+ acc_types[i].icon_path = ctui_get_addressbook_icon_path(acc_types[i].id);
+ PH_DBG("icon_path = %s",acc_types[i].icon_path);
+ if(acc_types[i].id == addressbook_id)
+ addressbook_exist = true;
+
+ ctui_get_addressbook_name(acc_types[i].id, addressbook_name,sizeof(addressbook_name));
+ acc_types[i].addressbook_name = SAFE_STRDUP(addressbook_name);
+
+ if (++i == sizeof(acc_types)/sizeof(*acc_types))
+ break;
+
+ err = contacts_list_next(list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+
+ if(addressbook_exist == false)
+ ctui_set_view_mode(-1);
+
+ if (!clist_d->ug /*&& CT_GET_LIST_ALL_PERSON != clist_d->list_op*/) {
+ addressbook_id = ctui_get_view_mode();
+ if(addressbook_id == -1 && clist_d->list_op > CT_GET_LIST_ALL_PERSON) {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON;
+ clist_d->base_ab = -1;
+ }
+ }
+
+ if (i == sizeof(acc_types)/sizeof(*acc_types)) {
+ ERR("addressbook are too many");
+ i--;
+ }
+ clist_d->acc_types = realloc(clist_d->acc_types, i * sizeof(ct_ab_map));
+ p_retm_if(NULL == clist_d->acc_types, "realloc() return NULL");
+
+ memcpy(clist_d->acc_types, acc_types, i * sizeof(ct_ab_map));
+ clist_d->acc_count = i;
+}
+
+void ct_list_get_addrbook_icon_path(ct_list_data *clist_d, int addressbook_id, char *dest, int dest_len)
+{
+ int i = 0;
+ bool not_found;
+
+ p_retm_if(NULL == dest, "parameter(dest) is NULL");
+ dest[0] = '\0';
+ if (0 == addressbook_id) return;
+ p_retm_if(NULL == clist_d->acc_types, "clist_d->acc_types is NULL");
+
+ not_found = true;
+
+ int count = clist_d->acc_count;
+ for( i=0;i<count;i++) {
+ if (addressbook_id == clist_d->acc_types[i].account_id) {
+ not_found = false;
+ break;
+ }
+ }
+ p_retm_if(not_found, "invalid id_ab(%d)", addressbook_id);
+
+ if (clist_d->acc_types[i].icon_path && *clist_d->acc_types[i].icon_path)
+ snprintf(dest, dest_len, "%s", clist_d->acc_types[i].icon_path);
+}
+
+static inline void list_clean_ecore_task(ct_list_data *clist_d)
+{
+ if (clist_d->list_idler) {
+ ecore_idler_del(clist_d->list_idler);
+ clist_d->list_idler = NULL;
+ }
+
+}
+
+static void list_searchbar_entry_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+
+ ctui_list_set_unsweep(clist_d);
+}
+
+
+static void list_searchbar_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ ct_list_data *clist_d;
+ elm_object_focus_set(data, EINA_TRUE);
+
+ clist_d = evas_object_data_get(data, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+
+ list_searchbar_entry_clicked_cb(clist_d, NULL, NULL);
+}
+
+static char *list_group_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *group_index = data;
+ if (0 == strcmp(part, "elm.text") && group_index && *group_index)
+ return strdup(group_index);
+ else
+ return NULL;
+}
+
+static Elm_Genlist_Item_Class group_index =
+{
+ .item_style = "grouptitle",
+ .func.text_get = list_group_label_get,
+};
+
+
+static void __list_set_index_letter(ct_list_data *clist_d)
+{
+ char *copy_index_string = NULL;
+ char *p = NULL;
+ char *save_p = NULL;
+ char *save_p2 = NULL;
+ char *p_group = NULL;
+ char *copy_p_group = NULL;
+ int group_count = 0;
+ bool has_digit = false;
+ char *index_string = NULL;
+ ct_list_index_data *index_data;
+
+ if(CT_GET_LIST_VCARD == clist_d->list_op) return;
+
+ ctui_list_free_index(clist_d->list_index);
+ clist_d->list_index = NULL;
+
+ contacts_utils_get_index_characters(&index_string);
+
+ PH_DBG("index_string = %s", index_string);
+
+ if (index_string) {
+ copy_index_string = SAFE_STRDUP(index_string);
+ p_group = strtok_r(copy_index_string, ":", &save_p2);
+
+ while (p_group) {
+ copy_p_group = SAFE_STRDUP(p_group);
+ p = strtok_r(copy_p_group, ";", &save_p);
+ group_count++;
+
+ while(p) {
+ //in case number
+ if(isdigit(p[0])) {
+ if(has_digit == false)
+ has_digit = true;
+ else {
+ p = strtok_r(NULL, ";", &save_p);
+ continue;
+ }
+ }
+ //in case Alphabet is sencond laguange
+ if(group_count > 2) {
+ if(*p > 'A' && *p < 'Z') {
+ p = strtok_r(NULL, ";", &save_p);
+ continue;
+ }
+ }
+
+ index_data = calloc(1, sizeof(ct_list_index_data));
+ snprintf(index_data->index, sizeof(index_data->index), "%s", p);
+
+ index_data->item = elm_index_item_append(clist_d->fast_index, index_data->index, NULL, NULL);
+ clist_d->list_index = eina_list_append(clist_d->list_index, index_data);
+
+ p = strtok_r(NULL, ";", &save_p);
+ }
+ free(copy_p_group);
+ p_group = strtok_r(NULL, ":", &save_p2);
+ }
+ free(copy_index_string);
+ }
+ return;
+}
+
+
+static bool __is_special_letter(char* letter, ct_list_data *clist_d)
+{
+ ct_list_index_data *first_data;
+ ct_list_index_data *last_data;
+ unsigned int count;
+ if(clist_d->list_index == NULL) {
+ ERR("clist_d->list_index is null");
+ return false;
+ }
+
+ count = eina_list_count(clist_d->list_index);
+
+ first_data = (ct_list_index_data*)eina_list_nth(clist_d->list_index, 1);// first primary letter
+ last_data = (ct_list_index_data*)eina_list_nth(clist_d->list_index, count-2);// last primary letter
+
+ if(*first_data->index == 'A' && *last_data->index == 'Z') {
+ if(*letter < 'A' || *letter > 'Z')
+ return true;
+ }
+ else {
+ if((*letter < 'A' || *letter > 'Z') && (*letter < *first_data->index || *letter > *first_data->index))
+ return true;
+ }
+
+ return false;
+}
+
+static void list_append_item(ct_list_data *clist_d, ct_person_list *person_info)
+{
+ char cur_index[10] = {0,};
+ ct_list_index_data *data;
+ Eina_List* l;
+ Elm_Object_Item *item;
+
+
+ // append group title if condition is accepted
+ if(CT_GET_LIST_VCARD != clist_d->list_op && !(clist_d->search_str && *clist_d->search_str)) {
+ if (NULL == person_info->display)
+ snprintf(cur_index, sizeof(cur_index), "#");
+ else {
+ snprintf(cur_index, sizeof(cur_index), "%s", person_info->display_index);
+ if (isdigit(person_info->display_index[0]))
+ snprintf(cur_index, sizeof(cur_index), "0");
+ else if(__is_special_letter(person_info->display_index, clist_d))
+ snprintf(cur_index, sizeof(cur_index), "#");
+ }
+
+ if (strcmp(clist_d->group_index, cur_index)) {
+ item = elm_genlist_item_append(clist_d->genlist, &group_index, strdup(cur_index), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ snprintf(clist_d->group_index, sizeof(clist_d->group_index), "%s", cur_index);
+ clist_d->group_item = item;
+
+ //link to fastscroll
+ bool matched = false;
+ bool first_item = false;
+ data = eina_list_nth(clist_d->list_index, 0);
+ if(elm_object_item_data_get(data->item) == NULL) {
+ first_item = true;
+ }
+
+ EINA_LIST_FOREACH(clist_d->list_index, l, data) {
+ if(first_item == true) {
+ elm_object_item_data_set(data->item, item);
+ continue;
+ }
+
+ if(0 == strcmp(cur_index, data->index))
+ matched = true;
+ if(matched == true)
+ elm_object_item_data_set(data->item, item);
+ }
+ }
+ }
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ bool has_phonenumber = false;
+
+ if(!clist_d->vcard_path) {
+ err = contacts_db_get_record(_contacts_person._uri, person_info->id, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+ err = contacts_record_get_bool(record, _contacts_person.has_phonenumber, &has_phonenumber);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+
+ if (clist_d->search_str && *clist_d->search_str){
+ if(has_phonenumber)
+ item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER], person_info, NULL,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ else
+ item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_SEARCH], person_info, NULL,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ }
+ else{
+ if(has_phonenumber)
+ item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_NO_NUMBER], person_info, clist_d->group_item,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ else
+ item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM], person_info, clist_d->group_item,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ }
+
+ person_info->item = item;
+ if (person_info->checked) clist_d->cnt_checked++;
+}
+
+
+#define N 20
+static Eina_Bool list_append_part(void *user_data)
+{
+ int i = 0;
+ Eina_List *cursor;
+ ct_person_list *person_info;
+ ct_list_data *clist_d = user_data;
+
+ cursor = eina_list_nth_list(clist_d->list, clist_d->readed_n);
+ EINA_LIST_FOREACH(cursor, cursor, person_info) {
+ if (i++ == N) break;
+ list_append_item(clist_d, person_info);
+ }
+ if (N < i) {
+ clist_d->readed_n += N;
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ clist_d->list_idler = NULL;
+ if (EINA_FALSE == elm_genlist_decorate_mode_get(clist_d->genlist)) {
+ clist_d->count_item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_COUNT],
+ (void *)clist_d->cnt_list_total, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_object_item_disabled_set(clist_d->count_item, EINA_TRUE);
+ }
+ clist_d->list_idler = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+
+static bool __list_get_addressbook_name(int addressbook_id, char *buf, int buf_size)
+{
+ int addressbook_mode = CONTACTS_ADDRESS_BOOK_MODE_NONE;
+ char *cur_ab;
+ char cur_account_name[200] = {0,};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retvm_if(buf == NULL, false, "out_name in null");
+
+ ctui_get_account_name_by_address_book_id(addressbook_id, cur_account_name, sizeof(cur_account_name));
+ if (addressbook_id > 0) {
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address_book.name, &cur_ab);
+ if(err != CONTACTS_ERROR_NONE) {
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_record_get_int(record, _contacts_address_book.mode, &addressbook_mode);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY == addressbook_mode)
+ snprintf(buf, buf_size, "%s", cur_account_name);
+ else
+ snprintf(buf, buf_size, "%s %s", cur_account_name, cur_ab);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+ else{
+ snprintf(buf, buf_size, "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+
+ return true;
+}
+
+
+void ctui_list_handle_search(ct_list_data *clist_d)
+{
+ int i=0;
+ int readed = 0;
+ Eina_List *cursor;
+ ct_person_list *person_info;
+ char group_title[PH_TEXT_MAX_LEN];
+ char addressbook_name[PH_TEXT_MAX_LEN];
+
+ elm_genlist_clear(clist_d->genlist);
+ elm_index_item_clear(clist_d->fast_index);
+ clist_d->group_index[0] = '\0';
+ clist_d->group_item = NULL;
+ clist_d->cnt_checked = 0;
+
+ if (clist_d->list_idler) {
+ ecore_idler_del(clist_d->list_idler);
+ clist_d->list_idler = NULL;
+ }
+
+
+ if(__list_get_addressbook_name(clist_d->base_ab, addressbook_name, sizeof(addressbook_name)) == true)
+ snprintf(group_title, sizeof(group_title), "%s (%d)", addressbook_name, eina_list_count(clist_d->list));
+ else
+ snprintf(group_title, sizeof(group_title), "%s (%d)", S_(PH_SYS_BODY_CONTACTS), eina_list_count(clist_d->list));
+
+ clist_d->search_group_item = elm_genlist_item_append(clist_d->genlist, &group_index, strdup(group_title), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(clist_d->search_group_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ EINA_LIST_FOREACH(clist_d->list, cursor, person_info) {
+ if (i++ == N) break;
+ list_append_item(clist_d, person_info);
+ readed++;
+ }
+ if (N < i) {
+ clist_d->readed_n = readed;
+ clist_d->list_idler = ecore_idler_add(list_append_part, clist_d);
+ }
+ else {
+ if (!(clist_d->search_str && *clist_d->search_str)) {
+ if (EINA_FALSE == elm_genlist_decorate_mode_get(clist_d->genlist)) {
+ clist_d->count_item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_COUNT],
+ (void *)clist_d->cnt_list_total, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_object_item_disabled_set(clist_d->count_item, EINA_TRUE);
+ }
+ }
+ }
+
+}
+
+
+static void list_append_all(ct_list_data *clist_d)
+{
+ PH_START_TIME_CHECK;
+ int i = 0;
+ Eina_List *cursor;
+ ct_person_list *person_info;
+
+ if (clist_d->list_idler) {
+ ecore_idler_del(clist_d->list_idler);
+ clist_d->list_idler = NULL;
+ }
+
+ __list_set_index_letter(clist_d);
+
+ if(clist_d->base_ab > -1){
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ Elm_Object_Item *item;
+ int addressbook_mode;
+ char title[400] = {0,};
+ char cur_account_name[200] = {0,};
+ char *cur_ab;
+
+ ctui_get_account_name_by_address_book_id(clist_d->base_ab, cur_account_name, sizeof(cur_account_name));
+ if (clist_d->base_ab > 0) {
+ err = contacts_db_get_record(_contacts_address_book._uri, clist_d->base_ab, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address_book.name, &cur_ab);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_address_book.mode, &addressbook_mode);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY == addressbook_mode)
+ snprintf(title, sizeof(title), "%s", cur_account_name);
+ else
+ snprintf(title, sizeof(title), "%s %s", cur_account_name, cur_ab);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+ else{
+ snprintf(title, sizeof(title), "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+
+ item = elm_genlist_item_append(clist_d->genlist, &group_index, strdup(title), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+
+ EINA_LIST_FOREACH(clist_d->list, cursor, person_info) {
+ if (i++ == N) break;
+ list_append_item(clist_d, person_info);
+ }
+ if (N < i) {
+ clist_d->readed_n = N;
+ clist_d->list_idler = ecore_idler_add(list_append_part, clist_d);
+ }
+ else {
+ if (EINA_FALSE == elm_genlist_decorate_mode_get(clist_d->genlist)) {
+ clist_d->count_item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_COUNT],
+ (void *)clist_d->cnt_list_total, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_object_item_disabled_set(clist_d->count_item, EINA_TRUE);
+ }
+ }
+
+ PH_END_TIME_CHECK("list_append_all");
+}
+#undef N
+
+void ctui_list_refresh_genlist(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ elm_genlist_clear(clist_d->genlist);
+ elm_index_item_clear(clist_d->fast_index);
+ clist_d->group_index[0] = '\0';
+ clist_d->group_item = NULL;
+ clist_d->cnt_checked = 0;
+ list_append_all(clist_d);
+}
+
+static void list_update_person_list_check_status(Eina_List *list_person, Eina_List *list_check)
+{
+ void *data;
+ Eina_List *l, *l_temp;
+ ct_person_list *person_info;
+
+ p_retm_if(NULL == list_person, "parameter(list_person) is NULL");
+ p_retm_if(NULL == list_check, "parameter(list_check) is NULL");
+
+ EINA_LIST_FOREACH(list_person, l, person_info) {
+ EINA_LIST_FOREACH(list_check, l_temp, data) {
+ if (person_info->id == (int)data) {
+ person_info->checked = true;
+ break;
+ }
+ }
+ }
+}
+
+static void list_searchbar_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ Evas_Object *en;
+ Evas_Object *sb = data;
+ ct_list_data *clist_d;
+ char *search_str;
+
+ clist_d = evas_object_data_get(sb, "clist_d");
+ p_retm_if(NULL == sb, "evas_object_data_get() return NULL");
+
+ en = elm_object_part_content_get(sb, "elm.swallow.content");
+ p_retm_if(NULL == en, "elm_object_part_content_get() return NULL");
+
+ if (!elm_entry_is_empty(en))
+ elm_object_signal_emit(sb, "elm,state,guidetext,hide", "elm");
+
+ if (elm_object_focus_get(sb)) {
+ if (elm_entry_is_empty(en))
+ elm_object_signal_emit(sb, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(sb, "elm,state,eraser,show", "elm");
+ }
+ else{
+ if (elm_entry_is_empty(en)){
+ elm_object_signal_emit(sb, "elm,state,guidetext,show", "elm");
+ elm_object_signal_emit(sb, "elm,state,eraser,hide", "elm");
+ }
+ }
+ search_str = ctui_entry_markup_to_utf8(elm_entry_entry_get(en));
+ p_retm_if(NULL == search_str, "ctui_entry_markup_to_utf8() return NULL");
+
+ if(strlen(search_str)>0) {
+ if(NULL !=clist_d->select_all_layout){
+ elm_box_unpack(clist_d->box, clist_d->select_all_layout);
+ evas_object_del(clist_d->select_all_layout);
+ clist_d->select_all_layout = NULL;
+ }
+ }
+ else {
+ ctui_list_set_selectall(clist_d);
+ }
+ if (search_str && clist_d->search_str){
+ if(pre_search_str[0] == '\0' && search_str[0] == '\0'){
+ clist_d->search_str = NULL;
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ list_update_person_list_check_status(clist_d->list, clist_d->list_check);
+ elm_genlist_homogeneous_set(clist_d->genlist, EINA_TRUE);
+ elm_genlist_mode_set(clist_d->genlist, ELM_LIST_SCROLL);
+ ctui_list_refresh_genlist(clist_d);
+ }
+ else{
+ if(0 == strcmp(search_str, clist_d->search_str)){
+ free(search_str);
+ return;
+ }
+ }
+ }
+ if('\0' == search_str[0] && NULL == clist_d->search_str) {
+ if (elm_genlist_decorate_mode_get(clist_d->genlist) && clist_d->edit_sel_update)
+ clist_d->edit_sel_update(clist_d);
+ free(search_str);
+ return;
+ }
+
+ free(clist_d->search_str);
+ clist_d->search_str = search_str;
+
+ if (strcmp(pre_search_str, search_str)) {
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ list_update_person_list_check_status(clist_d->list, clist_d->list_check);
+
+ if (*search_str) {
+ elm_genlist_mode_set(clist_d->genlist, ELM_LIST_COMPRESS);
+ ctui_list_handle_search(clist_d);
+ }
+ else {
+ elm_genlist_homogeneous_set(clist_d->genlist, EINA_TRUE);
+ elm_genlist_mode_set(clist_d->genlist, ELM_LIST_SCROLL);
+ ctui_list_refresh_genlist(clist_d);
+ }
+ }
+
+ snprintf(pre_search_str, sizeof(pre_search_str), "%s", search_str);
+
+ if (elm_genlist_decorate_mode_get(clist_d->genlist) && clist_d->edit_sel_update)
+ clist_d->edit_sel_update(clist_d);
+
+}
+
+static void list_searchbar_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+ elm_object_signal_emit(data, "cancel,in", "");
+
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+}
+
+static void list_searchbar_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ Evas_Object *cancel_btn;
+
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ cancel_btn = elm_object_part_content_get(data, "button_cancel");
+ evas_object_hide(cancel_btn);
+ elm_object_signal_emit(data, "cancel,out", "");
+}
+
+int ctui_list_checked_cnt_get(Eina_List *list) {
+ int cnt = 0;
+ Eina_List *l;
+ ct_person_list *person_info;
+
+ EINA_LIST_FOREACH(list, l, person_info) {
+ if (NULL == person_info) continue;
+ if (person_info->checked)
+ cnt++;
+ }
+ return cnt;
+}
+
+void ctui_list_update_selection_info(void *data)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d = data;
+ int checked_cnt = 0;
+ char buf[PH_TEXT_SHORT_LEN];
+
+ if(CT_LIST_MODE_EDIT != clist_d->list_mode)
+ return;
+
+ if (clist_d->ug_request && NULL == clist_d->select_all_layout) {
+ checked_cnt = ctui_list_checked_cnt_get(clist_d->list);
+ }
+ else {
+ Evas_Object *check = elm_object_part_content_get(clist_d->select_all_layout, "elm.icon");
+ if(check) {
+ if (0 != clist_d->cnt_list_total && clist_d->cnt_checked == clist_d->cnt_list_total)
+ elm_check_state_set(check, EINA_TRUE);
+ else if (0 == clist_d->cnt_list_total || clist_d->cnt_checked != clist_d->cnt_list_total)
+ elm_check_state_set(check, EINA_FALSE);
+ }
+ checked_cnt = clist_d->cnt_checked;
+ }
+ if (0 == clist_d->cnt_list_total) {
+ phone_hide_notify(clist_d->base_layout);
+ ctui_navi_btn_disabled_set(clist_d->navi, EINA_TRUE);
+ }
+ else {
+ if (0 == checked_cnt ) {
+ phone_show_notify(clist_d->base_layout, T_(CT_GET_TEXT_BASIC, CTTEXT_SELECT_CONTACTS));
+ ctui_navi_btn_disabled_set(clist_d->navi, EINA_TRUE);
+ }
+ else {
+ ctui_navi_btn_disabled_set(clist_d->navi, EINA_FALSE);
+ if (clist_d->cnt_max_check)
+ snprintf(buf, sizeof(buf), "%s (%d/%d)", S_(PH_SYS_POP_SELECTED), clist_d->cnt_checked, clist_d->cnt_max_check);
+ else
+ snprintf(buf, sizeof(buf), "%s (%d)", S_(PH_SYS_POP_SELECTED), clist_d->cnt_checked);
+ phone_show_notify(clist_d->base_layout, buf);
+ }
+ }
+}
+
+void ctui_list_searchbar_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *sb = data;
+ Evas_Object *en;
+ ct_list_data *clist_d;
+ const char *text;
+
+ p_retm_if(NULL == sb, "parameter(sb) is NULL");
+
+ clist_d = evas_object_data_get(sb, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+
+ en = elm_object_part_content_get(sb, "elm.swallow.content");
+ p_retm_if(NULL == en, "elm_object_part_content_get() return NULL");
+
+ free(clist_d->search_str);
+ clist_d->search_str = NULL;
+
+ text = elm_entry_entry_get(en);
+ if (text && *text)
+ elm_entry_entry_set(en, NULL);
+ elm_object_focus_set(en, EINA_FALSE);
+ pre_search_str[0] = '\0';
+
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ list_update_person_list_check_status(clist_d->list, clist_d->list_check);
+ ctui_list_update_selection_info(clist_d);
+
+ elm_genlist_homogeneous_set(clist_d->genlist, EINA_TRUE);
+ elm_genlist_mode_set(clist_d->genlist, ELM_LIST_SCROLL);
+ ctui_list_refresh_genlist(clist_d);
+
+ // problem of set focus automatically on searchbar when resumed app
+ elm_object_focus_set(clist_d->genlist, EINA_TRUE);
+}
+
+static void list_searchbar_eraser_cb(void *data, Evas_Object *obj, const char *emission,
+ const char *source)
+{
+ elm_entry_entry_set(data, "");
+ pre_search_str[0] = '\0';
+}
+
+static Evas_Object* list_create_searchbar(Evas_Object* parent, ct_list_data *clist_d)
+{
+ Evas_Object *sb;
+ Evas_Object *en;
+ Evas_Object *cancel_btn;
+
+ sb = elm_layout_add(parent);
+ p_retvm_if(NULL == sb, NULL, "elm_layout_add() return NULL");
+ evas_object_data_set(sb, "clist_d", clist_d);
+
+ elm_layout_theme_set(sb, "layout", "searchbar", "cancel_button");
+
+ en = elm_entry_add(sb);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_single_line_set(en, EINA_TRUE);
+ elm_object_part_content_set(sb, "elm.swallow.content", en);
+ elm_object_part_text_set(sb, "elm.guidetext", S_(CT_SYS_BODY_SEARCH));
+ elm_entry_cnp_mode_set(en, ELM_CNP_MODE_PLAINTEXT);
+
+ ctui_entry_limit_size_set(en);
+ elm_entry_input_panel_layout_set(en, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+
+ cancel_btn = elm_button_add(sb);
+ elm_object_part_content_set(sb, "button_cancel", cancel_btn);
+ elm_object_style_set(cancel_btn, "searchbar/default");
+ elm_object_text_set(cancel_btn, S_(PH_SYS_SK_CANCEL));
+
+ evas_object_smart_callback_add(en, "focused", list_searchbar_focused_cb, sb);
+ evas_object_smart_callback_add(en, "unfocused", list_searchbar_unfocused_cb, sb);
+ evas_object_smart_callback_add(en, "changed", list_searchbar_changed_cb, sb);
+ evas_object_smart_callback_add(en, "preedit,changed", list_searchbar_changed_cb, sb);
+ evas_object_smart_callback_add(en, "clicked", list_searchbar_entry_clicked_cb, clist_d);
+ elm_object_signal_callback_add(sb, "elm,bg,clicked", "elm", list_searchbar_clicked_cb, en);
+ elm_object_signal_callback_add(sb, "elm,eraser,clicked", "elm", list_searchbar_eraser_cb, en);
+ evas_object_smart_callback_add(cancel_btn, "clicked", ctui_list_searchbar_cancel_cb, sb);
+
+ return sb;
+}
+
+static Evas_Object* list_create_navi_content_genlist(Evas_Object* parent)
+{
+ Evas_Object *genlist = elm_genlist_add(parent);
+
+ elm_genlist_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+ elm_genlist_block_count_set(genlist, 20);
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ return genlist;
+}
+
+static void list_fast_delayed_changed(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ // called on a change but delayed in case multiple changes happen in a
+ // short timespan
+ elm_genlist_item_bring_in(elm_object_item_data_get(event_info),
+ ELM_GENLIST_ITEM_SCROLLTO_TOP);
+}
+
+static void list_fast_selected(void *data, Evas_Object *obj, void *event_info)
+{
+ // called on final select
+ elm_genlist_item_bring_in(elm_object_item_data_get(event_info),
+ ELM_GENLIST_ITEM_SCROLLTO_TOP);
+}
+
+static void list_start_sweep_effect(void *data)
+{
+ elm_genlist_item_decorate_mode_set(data, "slide", EINA_TRUE);
+ elm_genlist_item_select_mode_set(data, ELM_OBJECT_SELECT_MODE_NONE);
+}
+
+static void list_get_number_str(int id, char *buf, int buf_len)
+{
+ char *number;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_record(_contacts_person_number._uri, id, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_person_number.number, &number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (number && *number)
+ snprintf(buf, buf_len, "%s", number);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+}
+
+static void list_gl_sweep(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_person_list *person_info;
+ ct_list_data *clist_d = data;
+ Elm_Object_Item *item = event_info;
+ Elm_Genlist_Item_Class *itc;
+ Elm_Genlist_Item_Type type;
+
+ p_ret_if(!item);
+ p_ret_if(CT_GET_LIST_VCARD == clist_d->list_op);
+ p_ret_if(CT_LIST_MODE_EDIT == clist_d->list_mode);
+
+ type = elm_genlist_item_type_get(item);
+ p_ret_if(ELM_GENLIST_ITEM_GROUP == type);
+ p_ret_if(&clist_d->itcs[CT_LIST_ITEM_COUNT] == elm_genlist_item_item_class_get(item));
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "ct_person_list is null");
+ if (!person_info->number_loaded) {
+ char buf[PH_TEXT_MAX_LEN];
+ buf[0] = '\0';
+ list_get_number_str(person_info->id, buf, sizeof(buf));
+ if (*buf)
+ person_info->number = strdup(buf);
+ person_info->number_loaded = true;
+ }
+
+ itc = (Elm_Genlist_Item_Class *)elm_genlist_item_item_class_get(item);
+ p_retm_if(NULL == itc, "item class is null");
+
+ if ((NULL == person_info->number || '\0' == *person_info->number)
+ && strcmp(itc->decorate_item_style, clist_d->itcs[CT_LIST_ITEM].decorate_item_style)){
+ if (clist_d->search_str && *clist_d->search_str)
+ elm_genlist_item_item_class_update(item, &clist_d->itcs[CT_LIST_ITEM_SEARCH]);
+ else
+ elm_genlist_item_item_class_update(item, &clist_d->itcs[CT_LIST_ITEM]);
+ }
+ else if ((person_info->number && *person_info->number)
+ && strcmp(itc->decorate_item_style, clist_d->itcs[CT_LIST_ITEM_NO_NUMBER].decorate_item_style)) {
+ if (clist_d->search_str && *clist_d->search_str)
+ elm_genlist_item_item_class_update(item, &clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER]);
+ else
+ elm_genlist_item_item_class_update(item, &clist_d->itcs[CT_LIST_ITEM_NO_NUMBER]);
+ }
+
+ if(clist_d->fast_index) {
+ evas_object_hide(clist_d->fast_index);
+ elm_object_disabled_set(clist_d->fast_index, EINA_TRUE);
+ }
+
+ clist_d->last_sweep_item = item;
+ elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_TRUE);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
+}
+
+static void list_gl_unsweep(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ if (NULL == clist_d->last_sweep_item) return;
+
+ elm_genlist_item_decorate_mode_set(clist_d->last_sweep_item, "slide", EINA_FALSE);
+ elm_genlist_item_select_mode_set(clist_d->last_sweep_item, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ clist_d->last_sweep_item = NULL;
+ if(clist_d->fast_index) {
+ evas_object_show(clist_d->fast_index);
+ elm_object_disabled_set(clist_d->fast_index, EINA_FALSE);
+ }
+}
+
+void ctui_list_set_unsweep(ct_list_data *clist_d)
+{
+ list_gl_unsweep(clist_d, NULL, NULL);
+}
+
+static Evas_Object* list_create_contact_list(Evas_Object *parent, ct_list_data *clist_d)
+{
+ Evas_Object *layout, *fast_index, *searchbar, *genlist;
+
+ elm_win_conformant_set(clist_d->win, EINA_TRUE);
+
+ layout = elm_layout_add(parent);
+ if(CT_GET_LIST_VCARD == clist_d->list_op)
+ elm_layout_file_set(layout, CONTACTS_EDJ, "genlist_no_searchbar");
+ else
+ elm_layout_file_set(layout, CONTACTS_EDJ, "genlist");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ clist_d->layout = layout;
+
+ if(CT_GET_LIST_VCARD != clist_d->list_op){
+ searchbar = list_create_searchbar(layout, clist_d);
+ elm_object_part_content_set(layout, "searchbar", searchbar);
+ evas_object_show(searchbar);
+ clist_d->searchbar = searchbar;
+ }
+
+ clist_d->box = elm_box_add(layout);
+ evas_object_size_hint_weight_set(clist_d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(clist_d->box);
+ elm_object_part_content_set(layout, "content", clist_d->box);
+
+ // Create genlist
+ genlist = list_create_navi_content_genlist(clist_d->box);
+ evas_object_show(genlist);
+ elm_object_theme_set(genlist, clist_d->th);
+
+ evas_object_smart_callback_add(genlist, "drag,start,right", list_gl_sweep, clist_d);
+ evas_object_smart_callback_add(genlist, "drag,start,left", list_gl_unsweep, clist_d);
+ evas_object_smart_callback_add(genlist, "drag,start,up", list_gl_unsweep, clist_d);
+ evas_object_smart_callback_add(genlist, "drag,start,down", list_gl_unsweep, clist_d);
+
+ clist_d->genlist = genlist;
+
+ elm_box_pack_end(clist_d->box, genlist);
+ evas_object_data_set(genlist, "clist_d", clist_d);
+
+ if (CT_GET_LIST_VCARD != clist_d->list_op) {
+ // Create fast scroll
+ fast_index = elm_index_add(layout);
+ elm_object_part_content_set(layout, "fastscroll", fast_index);
+ evas_object_show(fast_index);
+ clist_d->fast_index = fast_index;
+ evas_object_smart_callback_add(fast_index, "delay,changed", list_fast_delayed_changed, fast_index);
+ evas_object_smart_callback_add(fast_index, "selected", list_fast_selected, NULL);
+ elm_index_level_go(fast_index, 0);
+ }
+
+ // Genlist item append
+ pre_search_str[0] = '\0';
+
+ evas_object_show(layout);
+
+ return layout;
+}
+
+static void list_resize_contact_view(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ int rotate;
+ Evas_Object *scroller;
+ Evas_Object *box;
+ ct_list_data *clist_d = data;
+
+ if (clist_d->list || clist_d->search_str)
+ return;
+
+ rotate = (int)evas_object_data_get(clist_d->navi, "phone_rotate");
+
+ if (90 == rotate || 270 == rotate) {
+ scroller = elm_object_part_content_get(clist_d->content_layout, "elm.swallow.content");
+ p_retm_if(NULL == scroller, "elm_object_part_content_get() return NULL");
+ box = elm_object_content_get(scroller);
+ p_retm_if(NULL == box, "elm_object_content_get() return NULL");
+ elm_box_unpack(box, clist_d->nocontent);
+ p_retm_if(NULL == clist_d->nocontent, "elm_box_unpack() return NULL");
+ evas_object_size_hint_weight_set(clist_d->nocontent, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(clist_d->nocontent, EVAS_HINT_FILL, 0.0);
+ elm_box_pack_end(box, clist_d->nocontent);
+ elm_object_content_set(scroller, box);
+ evas_object_size_hint_min_set(box, 720, 650);
+ elm_object_part_content_set(clist_d->content_layout, "elm.swallow.content", scroller);
+ }
+ else if (0 == rotate || 180 == rotate) {
+ scroller = elm_object_part_content_get(clist_d->content_layout, "elm.swallow.content");
+ p_retm_if(NULL == scroller, "elm_object_part_content_get() return NULL");
+ box = elm_object_content_get(scroller);
+ p_retm_if(NULL == box, "elm_object_content_get() return NULL");
+ elm_box_unpack(box, clist_d->nocontent);
+ p_retm_if(NULL == clist_d->nocontent, "elm_box_unpack() return NULL");
+ evas_object_size_hint_weight_set(clist_d->nocontent, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(clist_d->nocontent, EVAS_HINT_FILL, 0.2);
+ elm_box_pack_end(box, clist_d->nocontent);
+ elm_object_content_set(scroller, box);
+ evas_object_size_hint_min_set(box, 720, 650);
+ elm_object_part_content_set(clist_d->content_layout, "elm.swallow.content", scroller);
+ }
+}
+
+
+static void list_fill_contact_view(Evas_Object *parent, ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ Evas_Object *content = NULL;
+ Evas_Object *base = NULL;
+
+ if (clist_d->list || clist_d->search_str) {
+ if (NULL == clist_d->genlist) {
+ content = list_create_contact_list(parent, clist_d);
+ list_append_all(clist_d);
+
+ if (CT_LIST_MODE_EDIT == clist_d->list_mode)
+ ctui_list_edit_mode_start(clist_d);
+ elm_object_part_content_set(parent, "elm.swallow.content", content);
+ }
+ else {
+ if (clist_d->search_str && *clist_d->search_str)
+ ctui_list_handle_search(clist_d);
+ else
+ ctui_list_refresh_genlist(clist_d);
+ }
+ }
+ else {
+ char buf[PH_TEXT_MAX_LEN] ={0,};
+ Evas_Object *scroller;
+ Evas_Object *box;
+
+ list_clean_ecore_task(clist_d);
+
+ scroller = elm_scroller_add(parent);
+ p_retm_if(NULL == scroller, "elm_scroller_add() return NULL");
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ evas_object_show(scroller);
+
+ box = elm_box_add(scroller);
+ p_retm_if(NULL == box, "elm_box_add() return NULL");
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
+ elm_object_content_set(scroller, box);
+ evas_object_show(box);
+
+ base = elm_layout_add(box);
+ p_retm_if(NULL == base, "elm_layout_add() return NULL");
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(base, EVAS_HINT_FILL, 0.2);
+ elm_layout_file_set(base, NOCONTENT_LAYOUT_EDJ, "nocontent_layout");
+ snprintf(buf, sizeof(buf), "%s<br>%s", T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS), T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS_HELP_TEXT));
+ elm_object_part_text_set(base, "elm.text", buf);
+ elm_box_pack_end(box, base);
+ evas_object_size_hint_min_set(box, 720, 650);
+ evas_object_show(base);
+ clist_d->nocontent = base;
+ evas_object_event_callback_add(clist_d->nocontent, EVAS_CALLBACK_RESIZE, list_resize_contact_view, clist_d);
+ elm_object_part_content_set(parent, "elm.swallow.content", scroller);
+
+ clist_d->genlist = NULL;
+ clist_d->group_index[0] = '\0';
+ clist_d->group_item = NULL;
+
+ free(clist_d->search_str);
+ clist_d->search_str = NULL;
+ clist_d->searchbar = NULL;
+ }
+}
+
+API Eina_Bool ctui_list_genlist_update(void *data)
+{
+ PH_FN_CALL;
+ char buf[PH_TEXT_MAX_LEN+1];
+ Evas_Object *content;
+ ct_list_data *clist_d = data;
+
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ }
+
+ p_retvm_if(NULL == clist_d->navi_item, ECORE_CALLBACK_CANCEL, "navi_item is NULL");
+
+ ctui_list_free_contacts(clist_d->list);
+ clist_d->list = NULL;
+ ct_list_get_contacts(clist_d, &clist_d->list);
+
+ if(CT_LIST_IN_MULTI_TAB != clist_d->tab_mode && CT_UG_REQUEST_SELECT_PERSON <= clist_d->ug_request) {
+ snprintf(buf, sizeof(buf), "%s (%d)", clist_d->title, clist_d->cnt_list_total);
+ elm_object_item_text_set(clist_d->navi_item, buf);
+ }
+
+ content = clist_d->content_layout;
+ list_fill_contact_view(content, clist_d);
+ if (clist_d->list_navi_item_update_fn)
+ clist_d->list_navi_item_update_fn(clist_d);
+
+ clist_d->update_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void ct_list_clear_pdata(ct_list_data *clist_d)
+{
+ p_ret_if(NULL == clist_d);
+ p_ret_if(NULL == clist_d->p_info);
+
+ clist_d->p_info->alive = false;
+ pthread_join(clist_d->p_info->thread, NULL);
+
+ ecore_timer_del(clist_d->p_info->timer);
+
+ if (clist_d->popup) {
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ free(clist_d->p_info);
+ clist_d->p_info = NULL;
+}
+
+static void list_addrbook_changed(const char *view_uri, void *user_data)
+{
+ ct_list_data *clist_d = user_data;
+ ct_list_init_account_data(clist_d);
+ ctui_list_lazy_update(_contacts_person._uri ,clist_d);
+}
+
+static void list_set_group_index_item(Eina_List *list_index, const char *cur_index, Elm_Object_Item *cur_item)
+{
+ Eina_List* l;
+ ct_list_index_data *data;
+
+ EINA_LIST_FOREACH(list_index, l, data) {
+ if (0 == strcmp(cur_index, data->index)) {
+ //PH_DBG("list_append_item - %s mapping to %s", data->index, cur_index);
+ elm_object_item_data_set(data->item, cur_item);
+ break;
+ }
+ }
+}
+
+static Elm_Object_Item* list_genlist_update_group_item_get(ct_list_data *clist_d, Elm_Object_Item *item, const char *cur_index)
+{
+ int cmp;
+ char *item_index;
+ Elm_Object_Item *next_item;
+ Elm_Object_Item *item_ret;
+
+ if (NULL == item) {
+ item_ret = elm_genlist_item_append(clist_d->genlist, &group_index, strdup(cur_index), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item_ret, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ list_set_group_index_item(clist_d->list_index, cur_index, item_ret);
+ return item_ret;
+ }
+ if (ELM_GENLIST_ITEM_GROUP != elm_genlist_item_type_get(item)) {
+ next_item = elm_genlist_item_next_get(item);
+ item_ret = list_genlist_update_group_item_get(clist_d, next_item, cur_index);
+ elm_object_item_del(item);
+ return item_ret;
+ }
+
+ item_index = elm_object_item_data_get(item);
+ cmp = strcmp(item_index, cur_index);
+
+ if (0 == cmp) {
+ return item;
+ }
+ else if (0 < cmp) {
+ item_ret = elm_genlist_item_insert_before(clist_d->genlist, &group_index, strdup(cur_index), NULL, item, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item_ret, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ list_set_group_index_item(clist_d->list_index, cur_index, item_ret);
+ return item_ret;
+ }
+ else {
+ next_item = elm_genlist_item_next_get(item);
+ item_ret = list_genlist_update_group_item_get(clist_d, next_item, cur_index);
+ elm_object_item_del(item);
+ return item_ret;
+ }
+}
+
+static Eina_Bool list_genlist_update(void *data)
+{
+ PH_FN_CALL;
+ int ret;
+ char buf[PH_TEXT_MAX_LEN] = {0,};
+ char cur_index[10] = {0,};
+ char group_letter[10] = {0,};
+ Eina_List *list_new;
+ Eina_List *l;
+ Elm_Object_Item *item = NULL;
+ Elm_Object_Item *item_cur = NULL;
+ Elm_Object_Item *item_second = NULL;
+ Elm_Object_Item *next_item;
+ Elm_Object_Item *group_item = NULL;
+ ct_person_list *person_info;
+ ct_list_data *clist_d = data;
+
+ if (clist_d->list_idler) {
+ ecore_idler_del(clist_d->list_idler);
+ clist_d->list_idler = NULL;
+ }
+
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ }
+
+ p_retvm_if(NULL == clist_d->navi_item, ECORE_CALLBACK_CANCEL, "navi_item is NULL");
+
+ list_new = NULL;
+ ret = ct_list_get_contacts(clist_d, &list_new);
+ if (0 != ret && ret != CONTACTS_ERROR_NO_DATA) {
+ ERR("ct_list_get_contacts() Failed(%d)", ret);
+ ctui_list_free_contacts(list_new);
+ clist_d->need_update = true;
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ if (!list_new && !clist_d->search_str) {
+ Evas_Object *base;
+ Evas_Object *scroller;
+ Evas_Object *box;
+ char help_text[PH_TEXT_MAX_LEN] = {0,};
+
+ list_clean_ecore_task(clist_d);
+
+ scroller = elm_scroller_add(clist_d->content_layout);
+ p_retvm_if(NULL == scroller, ECORE_CALLBACK_CANCEL, "elm_scroller_add() return NULL");
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ evas_object_show(scroller);
+
+ box = elm_box_add(scroller);
+ p_retvm_if(NULL == box, ECORE_CALLBACK_CANCEL, "elm_box_add() return NULL");
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
+ elm_object_content_set(scroller, box);
+ evas_object_show(box);
+
+ base = elm_layout_add(box);
+ p_retvm_if(NULL == base, ECORE_CALLBACK_CANCEL, "elm_layout_add() return NULL");
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(base, EVAS_HINT_FILL, 0.2);
+
+ elm_layout_file_set(base, NOCONTENT_LAYOUT_EDJ, "nocontent_layout");
+
+ snprintf(help_text, sizeof(help_text), "%s<br>%s", T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS), T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS_HELP_TEXT));
+ elm_object_part_text_set(base, "elm.text", help_text);
+ elm_box_pack_end(box, base);
+ evas_object_size_hint_min_set(box, 720, 650);
+ evas_object_show(base);
+ clist_d->nocontent = base;
+ evas_object_event_callback_add(clist_d->nocontent, EVAS_CALLBACK_RESIZE, list_resize_contact_view, clist_d);
+ elm_object_part_content_set(clist_d->content_layout, "elm.swallow.content", scroller);
+
+ clist_d->genlist = NULL;
+ clist_d->group_index[0] = '\0';
+ clist_d->group_item = NULL;
+
+ free(clist_d->search_str);
+ clist_d->search_str = NULL;
+ clist_d->searchbar = NULL;
+ }
+ else {
+ if (NULL == clist_d->genlist) {
+ Evas_Object *content = NULL;
+ content = list_create_contact_list(clist_d->content_layout, clist_d);
+
+ if (CT_LIST_MODE_EDIT == clist_d->list_mode)
+ ctui_list_edit_mode_start(clist_d);
+
+ elm_object_part_content_set(clist_d->content_layout, "elm.swallow.content", content);
+ if (!(clist_d->search_str && *clist_d->search_str))
+ __list_set_index_letter(clist_d);
+ }
+ else {
+ ctui_list_set_unsweep(clist_d);
+
+ if (clist_d->count_item)
+ elm_object_item_del(clist_d->count_item);
+ }
+
+ evas_object_show(clist_d->fast_index);
+ elm_object_disabled_set(clist_d->fast_index, EINA_FALSE);
+
+ clist_d->group_index[0] = '\0';
+ clist_d->group_item = NULL;
+
+ item_cur = elm_genlist_first_item_get(clist_d->genlist);
+ if(item_cur)
+ item_second = elm_genlist_item_next_get(item_cur);
+ else {
+ if(clist_d->base_ab > -1){
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ Elm_Object_Item *item;
+ int addressbook_mode;
+ char title[400] = {0,};
+ char cur_account_name[200] = {0,};
+ char *cur_ab;
+
+ ctui_get_account_name_by_address_book_id(clist_d->base_ab, cur_account_name, sizeof(cur_account_name));
+ if (clist_d->base_ab > 0) {
+ err = contacts_db_get_record(_contacts_address_book._uri, clist_d->base_ab, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ do {
+ if (CONTACTS_ERROR_NONE != (err = contacts_record_get_str_p(record, _contacts_address_book.name, &cur_ab))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_record_get_int(record, _contacts_address_book.mode, &addressbook_mode))) break;
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_value() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY == addressbook_mode)
+ snprintf(title, sizeof(title), "%s", cur_account_name);
+ else
+ snprintf(title, sizeof(title), "%s %s", cur_account_name, cur_ab);
+ }
+ else{
+ snprintf(title, sizeof(title), "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+
+ item = elm_genlist_item_append(clist_d->genlist, &group_index, strdup(title), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+ }
+
+ group_letter[0] = '\0';
+
+ if(ELM_GENLIST_ITEM_GROUP == elm_genlist_item_type_get(item_second))
+ item_cur = item_second;
+
+ if (clist_d->search_str && *clist_d->search_str)
+ item_cur = elm_genlist_item_next_get(clist_d->search_group_item);
+
+ EINA_LIST_FOREACH(list_new, l, person_info) {
+ if (NULL == person_info)
+ continue;
+
+ if(!clist_d->search_str) {
+ cur_index[0] = '\0';
+ if (NULL == person_info->display)
+ snprintf(cur_index, sizeof(cur_index), "#");
+ else {
+ snprintf(cur_index, sizeof(cur_index), "%s", person_info->display_index);
+ if (isdigit(person_info->display_index[0]))
+ snprintf(cur_index, sizeof(cur_index), "0");
+ else if(__is_special_letter(person_info->display_index, clist_d))
+ snprintf(cur_index, sizeof(cur_index), "#");
+ }
+
+ if ('\0' == group_letter[0] || 0 != strcmp(cur_index, group_letter)) {
+ group_item = list_genlist_update_group_item_get(clist_d, item_cur, cur_index);
+ if (NULL == group_item) {
+ ERR("list_genlist_update_group_item_get() return NULL");
+ break;
+ }
+ snprintf(group_letter, sizeof(group_letter), "%s", cur_index);
+ item_cur = elm_genlist_item_next_get(group_item);
+ }
+ }
+
+ if (NULL == item_cur) {
+ if (clist_d->search_str && *clist_d->search_str){
+ item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER], person_info, clist_d->search_group_item,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ }
+ else{
+ item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_NO_NUMBER], person_info, group_item,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ }
+ }
+ else if (ELM_GENLIST_ITEM_NONE == elm_genlist_item_type_get(item_cur)) {
+ elm_object_item_data_set(item_cur, person_info);
+ item = item_cur;
+ item_cur = elm_genlist_item_next_get(item_cur);
+ }
+ else {
+ if (clist_d->search_str && *clist_d->search_str){
+ item = elm_genlist_item_insert_before(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER], person_info, clist_d->search_group_item, item_cur,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ }
+ else{
+ item = elm_genlist_item_insert_before(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_NO_NUMBER], person_info, group_item, item_cur,
+ ELM_GENLIST_ITEM_NONE, clist_d->gl_sel, clist_d->gl_sel_data);
+ }
+ }
+ person_info->item = item;
+ }
+
+ if (item_cur) {
+ while(next_item = elm_genlist_item_next_get(item_cur)) {
+ if(next_item)
+ elm_object_item_del(next_item);
+ else
+ break;
+ }
+ elm_object_item_del(item_cur);
+ }
+
+
+ if(clist_d->search_str && *clist_d->search_str) {
+ if(clist_d->search_group_item) {
+ char group_title[PH_TEXT_MAX_LEN];
+ snprintf(group_title, sizeof(group_title), "%s (%d)", S_(PH_SYS_BODY_CONTACTS), eina_list_count(list_new));
+ elm_object_item_data_set(clist_d->search_group_item, strdup(group_title));
+ elm_genlist_item_update(clist_d->search_group_item);
+ }
+ }
+
+ if(CT_LIST_IN_MULTI_TAB != clist_d->tab_mode && CT_UG_REQUEST_SELECT_PERSON <= clist_d->ug_request) {
+ snprintf(buf, sizeof(buf), "%s (%d)", clist_d->title, clist_d->cnt_list_total);
+ elm_object_item_text_set(clist_d->navi_item, buf);
+ }
+ }
+
+ ctui_list_free_contacts(clist_d->list);
+ clist_d->list = list_new;
+ list_update_person_list_check_status(clist_d->list, clist_d->list_check);
+
+ if (clist_d->genlist) {
+ elm_genlist_realized_items_update(clist_d->genlist);
+ if (!(clist_d->search_str && *clist_d->search_str)) {
+ if (EINA_FALSE == elm_genlist_decorate_mode_get(clist_d->genlist)) {
+ clist_d->count_item = elm_genlist_item_append(clist_d->genlist, &clist_d->itcs[CT_LIST_ITEM_COUNT],
+ (void *)clist_d->cnt_list_total, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_object_item_disabled_set(clist_d->count_item, EINA_TRUE);
+ }
+ }
+ }
+ if (clist_d->list_navi_item_update_fn)
+ clist_d->list_navi_item_update_fn(clist_d);
+
+ if (clist_d->base_grp)
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, clist_d);
+
+ if(clist_d->genlist)
+ elm_object_focus_set(clist_d->genlist, EINA_TRUE);
+
+ PH_FN_END;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool list_genlist_update_queue_timer_cb(void *data)
+{
+ ct_list_data *clist_d = data;
+ p_retvm_if(NULL == clist_d, ECORE_CALLBACK_CANCEL, "parameter(clist_d) is NULL");
+
+ if (clist_d->need_update) {
+ clist_d->need_update = false;
+ list_genlist_update(clist_d);
+ return ECORE_CALLBACK_RENEW;
+ }
+ clist_d->update_queue_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void ctui_list_lazy_update(const char *view_uri, void *data)
+{
+ int ui_updated;
+ ct_list_data *clist_d = data;
+
+ if (clist_d->updating)
+ return;
+ PH_DBG("ctui_list_lazy_update");
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ }
+
+ PH_DBG("is_background = %d", clist_d->is_background);
+
+ if (clist_d->is_background) {
+ clist_d->need_update = false;
+ clist_d->update_timer = ecore_timer_add(3.0, list_genlist_update, clist_d);
+ return;
+ }
+
+ ui_updated = (int)evas_object_data_del(clist_d->navi, "ct_list_update_ui");
+ if (0 == ui_updated && clist_d->update_queue_timer) {
+ clist_d->need_update = true;
+ }
+ else {
+ list_genlist_update(clist_d);
+ clist_d->update_queue_timer = ecore_timer_add(1.0, list_genlist_update_queue_timer_cb, clist_d);
+ p_warn_if(NULL == clist_d->update_queue_timer, "ecore_timer_add() return NULL");
+ }
+}
+
+static void list_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ int i;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_list_data *clist_d = data;
+
+ ct_list_clear_pdata(clist_d);
+ list_clean_ecore_task(clist_d);
+
+ // TODO: Fixme BS when destroy a contact ug
+ if(clist_d->genlist) {
+ evas_object_del(clist_d->genlist);
+ clist_d->genlist = NULL;
+ }
+
+ evas_object_event_callback_del(clist_d->nocontent, EVAS_CALLBACK_RESIZE, list_resize_contact_view);
+
+ if (CT_GET_LIST_PERSON_OF_GROUP_ID == clist_d->list_op) {
+ err = contacts_db_remove_changed_cb(_contacts_contact._uri, ctui_list_lazy_update, clist_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ }
+
+ // if (clist_d->gl_sel_data != clist_d) - 1. Input > Relationship, 2. Details > Link
+ if (CT_GET_LIST_VCARD != clist_d->list_op && clist_d->gl_sel_data == clist_d) {
+ err = contacts_db_remove_changed_cb(_contacts_person._uri, ctui_list_lazy_update, clist_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ err = contacts_db_remove_changed_cb(_contacts_address_book._uri, list_addrbook_changed, clist_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ }
+
+ if(clist_d->list) {
+ ctui_list_free_contacts(clist_d->list);
+ clist_d->list = NULL;
+ }
+ if(clist_d->list_index) {
+ ctui_list_free_index(clist_d->list_index);
+ clist_d->list_index = NULL;
+ }
+
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ }
+
+ if (clist_d->update_queue_timer) {
+ ecore_timer_del(clist_d->update_queue_timer);
+ clist_d->update_queue_timer = NULL;
+ }
+
+ if (clist_d->popup) {
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ if(clist_d->nocontent) {
+ evas_object_del(clist_d->nocontent);
+ clist_d->nocontent = NULL;
+ }
+
+ if (clist_d->th) {
+ elm_theme_extension_del(clist_d->th, CONTACTS_EDJ);
+ elm_theme_free(clist_d->th);
+ clist_d->th = NULL;
+ }
+
+ if (clist_d->child_ug) {
+ ug_destroy(clist_d->child_ug);
+ clist_d->child_ug = NULL;
+ }
+
+ if(clist_d->list_check) {
+ eina_list_free(clist_d->list_check);
+ clist_d->list_check = NULL;
+ }
+
+ evas_object_data_del(clist_d->navi, "gadd_list_d");
+ evas_object_data_del(clist_d->navi, "favor_list_d");
+
+ if (clist_d->acc_types) {
+ int count = clist_d->acc_count;
+ for (i=0;i<count;i++)
+ free(clist_d->acc_types[i].icon_path);
+ free(clist_d->acc_types);
+ clist_d->acc_types = NULL;
+ }
+
+ if(clist_d->search_str) {
+ free(clist_d->search_str);
+ clist_d->search_str = NULL;
+ }
+ if(clist_d->sub_title) {
+ free(clist_d->sub_title);
+ clist_d->sub_title = NULL;
+ }
+ if(clist_d->title) {
+ free(clist_d->title);
+ clist_d->title = NULL;
+ }
+
+ if(!clist_d->ug) {
+ PH_DBG("no ug");
+ free(clist_d);
+ }
+ else {
+ PH_DBG("view destroy called earlier than ug destroy");
+ clist_d->ug = NULL;
+ }
+}
+
+char* ctui_list_get_highlight_text(ct_list_data *clist_d, const char *src)
+{
+ int len_search;
+ int len_display;
+ char *pos;
+ char display[PH_TEXT_MAX_LEN] = {0, };
+
+ if (NULL == clist_d->search_str || '\0' == clist_d->search_str[0])
+ return strdup(src);
+
+ len_display = strlen(src);
+ len_search = strlen(clist_d->search_str);
+ pos = strcasestr(src, clist_d->search_str);
+
+ if (0 < pos) {
+ char first[PH_TEXT_MAX_LEN] = {0};
+ char middle[PH_TEXT_MAX_LEN] = {0};
+
+ snprintf(first, (int)(pos - src)+1, "%s", src);
+ snprintf(middle, len_search+1, "%s", (char *)pos);
+
+ snprintf(display, sizeof(display), "%s<match>%s</>%s", first, middle, (char *)(pos + len_search));
+ return strdup(display);
+ }
+ return strdup(src);
+}
+
+char* ct_list_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_person_list *person_info = data;
+ int count = eina_list_count(person_info->addressbook_id_list);
+ p_retvm_if(NULL == person_info, NULL, "The parameter(data) is NULL");
+
+ if ((person_info->status_str && 0 == strcmp(part, "elm.text.1")) ||
+ NULL == person_info->status_str && 0 == strcmp(part, "elm.text") ) {
+ if (person_info->display && *person_info->display) {
+ ct_list_data *clist_d = evas_object_data_get(obj, "clist_d");
+ p_retvm_if(NULL == clist_d, strdup(person_info->display), "evas_object_data_get() return NULL");
+ return ctui_list_get_highlight_text(clist_d, person_info->display);
+ }
+ else
+ return strdup(T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }
+ else if ( person_info->status_str && 0 == strcmp(part, "elm.text.2") ) {
+ return strdup(person_info->status_str);
+ }
+
+ return NULL;
+}
+
+char* ct_list_count_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PH_TEXT_SHORT_LEN];
+ int count = (int)data;
+ if(count == 1)
+ return strdup(T_(CT_GET_TEXT_BASIC,CTTEXT_1_CONTACT));
+ else
+ {
+ snprintf(buf, sizeof(buf), T_(CT_GET_TEXT_BASIC, CTTEXT_COUNT_CONTACTS), count);
+ return strdup(buf);
+ }
+}
+
+
+Evas_Object* ct_list_create_contact_layout(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ int ret;
+ Elm_Theme *th;
+ Evas_Object *base;
+ Evas_Object *layout;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, LIST_THEME_EDJ);
+ clist_d->th = th;
+
+ base = elm_layout_add(clist_d->navi);
+ p_retvm_if(NULL == base, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(base, SELECTION_INFO_EDJ, "selectioninfo_layout");
+
+ layout = phone_create_base_layout(base, false);
+ elm_object_part_content_set(base, "contents", layout);
+ list_fill_contact_view(layout, clist_d);
+ clist_d->content_layout = layout;
+
+ // if (clist_d->gl_sel_data != clist_d) - 1. Input > Relationship, 2. Details > Link
+ if (CT_GET_LIST_VCARD != clist_d->list_op && clist_d->gl_sel_data == clist_d) {
+ err = contacts_db_add_changed_cb(_contacts_person._uri, ctui_list_lazy_update, clist_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ err = contacts_db_add_changed_cb(_contacts_address_book._uri, list_addrbook_changed, clist_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ if (CT_GET_LIST_PERSON_OF_GROUP_ID == clist_d->list_op) {
+ err = contacts_db_add_changed_cb(_contacts_contact._uri, ctui_list_lazy_update, clist_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+ }
+ }
+
+ evas_object_event_callback_add(base, EVAS_CALLBACK_DEL, list_view_delete_cb, clist_d);
+
+ PH_DBG("##### [TSP_TEST] lauching contact application #####");
+ PH_FN_END;
+ return base;
+}
+
diff --git a/lib/common/include/ct-group.h b/lib/common/include/ct-group.h
new file mode 100755
index 0000000..6e7661e
--- /dev/null
+++ b/lib/common/include/ct-group.h
@@ -0,0 +1,31 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CT_GROUP_H__
+#define __CT_GROUP_H__
+
+Evas_Object* phone_create_group_view(ph_view_info *view_info);
+Evas_Object* phone_create_group_view_ug(ui_gadget_h ug, Evas_Object *parent, int ug_request);
+void phone_group_set_navi(Evas_Object *layout);
+void phone_group_view_reset(Evas_Object *base);
+void phone_group_view_language_changed(Evas_Object *navi);
+void phone_group_set_background(Evas_Object *obj, bool is_background);
+void phone_group_email_result_cb(void *data, int *list, int cnt);
+void phone_group_message_result_cb(void *data, int *list, int cnt);
+
+
+#endif /* __CT_GROUP_H__ */
diff --git a/lib/common/include/phone-common.h b/lib/common/include/phone-common.h
new file mode 100755
index 0000000..d48d10b
--- /dev/null
+++ b/lib/common/include/phone-common.h
@@ -0,0 +1,760 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __PHONE_COMMON_H__
+#define __PHONE_COMMON_H__
+
+#include <time.h>
+#include <libintl.h>
+#include <ui-gadget.h>
+#include <contacts.h>
+#include <unicode/udat.h>
+#include <bundle.h>
+#include "phone-ug.h"
+#include "phone-path.h"
+#include "phone-text.h"
+#include "contacts-ug.h"
+
+
+#define PH_TIMECHECK
+#ifdef PH_TIMECHECK
+double ph_correction, ph_startT;
+double ph_set_start_time(void);
+double ph_exec_time(double start);
+int ph_init_time(void);
+#define PH_TIME_CHECK \
+ DBG("time = %f ms\n", ph_set_start_time());
+#define PH_START_TIME_CHECK \
+ ph_init_time();\
+ph_startT = ph_set_start_time();
+#define PH_END_TIME_CHECK(fmt, arg...) \
+ DBG(fmt" time = %f ms\n", ##arg, ph_exec_time(ph_startT));
+#else //PH_TIMECHECK
+#define PH_START_TIME_CHECK
+#define PH_END_TIME_CHECK(arg)
+#endif //PH_TIMECHECK
+
+#if !defined(LOCALEDIR)
+# define LOCALEDIR "/usr/ug/res/locale"
+#endif
+
+#ifndef STRLEN
+#define STRLEN(str) (((str) == NULL) ? 0: strlen(str))
+#endif
+
+#define PH_TEXT_MAX_LEN 1024
+#define PH_TEXT_SHORT_LEN 256
+#define CT_EDITFIELD_MAX_CHAR 1000
+#define PH_BLOCK_MSG_MAX_LEN 40
+
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
+#define MSG_COMPOSER_UG "msg-composer-efl"
+#define MYFILES_UG "myfile-efl"
+#define VIBRATION_UG "setting-profile-efl"
+#define ACCOUNT_UG "setting-myaccount-efl"
+#define IMG_VIEWER_UG "image-viewer-efl"
+#define GALLERY_UG "gallery-efl"
+#define BLUETOOTH_UG "setting-bluetooth-efl"
+#define WIFI_DIRECT_UG "fileshare-efl"
+
+#define EMAIL_COMPOSER_PKG "email-composer-efl"
+#define VOICECALL_PKG "org.tizen.call"
+#define VIDEOCALL_PKG "org.tizen.vtmain"
+#define CONTACTS_VIEWER_PKG "org.tizen.contacts-viewer"
+#define BROWSER_UI_PKG "org.tizen.browser"
+
+#define SETTING_MFC_PATH "/opt/usr/ug/data/ug-phone/mfc_option"
+#define VIEW_MODE_PATH "/opt/usr/ug/data/ug-phone/view_mode"
+
+
+typedef enum date_style{
+ PH_LOG_TIME_ONLY,
+ PH_LOG_DATE_ONLY,
+}date_style;
+
+typedef enum{
+ LOG_TYPE_CALL = 0,
+ LOG_TYPE_VIDEO_CALL,
+ LOG_TYPE_SMS_MESSAGE,
+ LOG_TYPE_MMS_MESSAGE,
+ LOG_TYPE_MAX
+} Log_Type;
+
+typedef enum{
+ LOG_ACTION_DIALLED = 0,
+ LOG_ACTION_MISSED,
+ LOG_ACTION_RECEIVED,
+ LOG_ACTION_REJECTED,
+ LOG_ACTION_BLOCKED,
+ LOG_ACTION_MAX
+} Log_Action;
+
+
+enum {
+ CTTEXT_TYPE_CUSTOM,
+ CTTEXT_TYPE_MOBILE,
+ CTTEXT_TYPE_HOME,
+ CTTEXT_TYPE_WORK,
+ CTTEXT_TYPE_FAX_HOME,
+ CTTEXT_TYPE_FAX_WORK,
+ CTTEXT_TYPE_ASSISTANT,
+ CTTEXT_TYPE_PAGER,
+ CTTEXT_TYPE_OTHER,
+ CTTEXT_TYPE_TELEPHONE,
+ CTTEXT_TYPE_FAX,
+ CTTEXT_TYPE_CAR,
+ CTTEXT_TYPE_HOME2,
+ CTTEXT_TYPE_WORK2,
+ CTTEXT_TYPE_COMPANY_MAIN,
+ CTTEXT_TYPE_RADIO,
+}; //CT_GET_TEXT_NUM_TYPE
+
+enum {
+ CT_VIEW_DETAIL,
+ CT_VIEW_INPUT,
+ CT_VIEW_ETC,
+};
+
+enum {
+ CT_LIST_NORMAL = 0x00,
+ CT_LIST_NORMAL_CONTACT = 0x01,
+ CT_LIST_NORMAL_FAVORITE = 0x02,
+ CT_LIST_NORMAL_MEMBER = 0x03,
+ CT_LIST_NORMAL_SDN = 0x04,
+
+ CT_LIST_SINGLE = 0x30,
+ CT_LIST_SINGLE_LINK = 0x31,
+ CT_LIST_SINGLE_RELATION = 0x32,
+
+ CT_LIST_SINGLE_UG = 0x50,
+
+ CT_LIST_MULTI = 0x70,
+ CT_LIST_MULTI_DELETE = 0x71,
+ CT_LIST_MULTI_ADD_MEMBER = 0x72,
+ CT_LIST_MULTI_REMOVE_MEMBER = 0x73,
+ CT_LIST_MULTI_ADD_FAVORITE = 0x74,
+ CT_LIST_MULTI_REMOVE_FAVORITE = 0x75,
+ CT_LIST_MULTI_EXPORT_TO_SIM = 0x76,
+ CT_LIST_MULTI_EXPORT_TO_VCARD = 0x77,
+ CT_LIST_MULTI_IMPORT_FROM_SIM = 0x78,
+ CT_LIST_MULTI_IMPORT_FROM_VCARD = 0x79,
+ CT_LIST_MULTI_RECIPIENT_MESSAGE_INGROUP = 0x7A,
+ CT_LIST_MULTI_RECIPIENT_EMAIL_INGROUP = 0x7B,
+ CT_LIST_MULTI_SHARE_MESSAGE = 0x7C,
+ CT_LIST_MULTI_SHARE_EMAIL = 0x7D,
+ CT_LIST_MULTI_SHARE_BT = 0x7E,
+ CT_LIST_MULTI_REORDER_FAVORITE = 0x7F,
+
+ CT_LIST_MULTI_UG = 0xA0,
+};
+
+enum {
+ CTUG_MSG_INVALID = 0,
+ CTUG_MSG_KEY_END = 1,
+};
+
+typedef void* PTHREAD_FN;
+typedef void (*ct_select_result_cb)(void *data, int *list, int cnt);
+typedef void (*ct_contact_add_cb)(Evas_Object *win, Evas_Object *navi, int cnt);
+typedef void (*ct_assign_result_cb)(void *data);
+typedef void (*ct_change_name_cb)(void *data, char *str);
+typedef void (*selectall_changed_cb)(void *data, Eina_Bool checked);
+typedef void (*ct_list_navi_item_update_fn)(void *data);
+typedef void (*ct_group_rename_update_cb)(void *data, bool changed);
+typedef void (*ct_person_changed_cb)(void *data);
+typedef void (*ct_group_input_result_cb)(int grp_id, void *data, bool changed);
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *navi;
+ void *ug;
+ int ug_request;
+ int ug_cnt_max;
+ char *ug_data; // update contact info
+}ph_view_info;
+
+typedef struct {
+ int cnt;
+ int cnt_checked_total;
+ int result;
+ bool alive;
+ bool completed;
+ bool without_cancel_btn;
+ pthread_t thread;
+ Ecore_Timer *timer;
+ Evas_Object *layout;
+ Evas_Object *progressbar;
+ Evas_Object *popup;
+
+ int *update_ids;
+ contacts_list_h update_list;
+ bool next_job;
+} ph_progress_info;
+
+typedef struct
+{
+ char *plog_display;
+ char *plog_img_path;
+ char *plog_number;
+
+ int id;
+ int plog_ct_id;
+ int plog_num_type;
+ int plog_log_time;
+ int plog_log_type;
+ int plog_duration;
+
+ int grouped_count;
+ Eina_Bool checked;//for check genlist
+ int group_index;//it's used as group index value.
+ int group_base_id;
+ Elm_Object_Item *item;
+
+} ph_log_info;
+
+typedef struct
+{
+ int id;
+ char *img_path;
+ char *display;
+ char *number;
+ char* numtype_label;
+ int number_type;
+ char *normal_name;
+}ph_contact_d;
+
+typedef struct
+{
+ int person_id;
+ int id_ret;
+ int id_ret_type;
+ char *display;
+ char *img_path;
+ char *number;
+ bool img_loaded;
+ bool number_loaded;
+ Eina_List *contact_list;
+ Eina_List *number_list;
+ Eina_List *email_list;
+
+ Eina_Bool checked;
+ Elm_Object_Item *item;
+}ph_favor_info;
+
+typedef struct
+{
+ char *display;
+ char *img_path;
+ char *ph_number;
+ char *numtype_label;
+ int number_type;
+ int contact_id;
+ int dial_number;
+ Eina_Bool is_checked;
+}ph_speeddial_info;
+
+struct ug_priv_data
+{
+ void (*result_cb)(void*, void*);
+ void (*destroy_cb)(void*);
+ void *cb_param;
+};
+
+typedef struct {
+ int position;
+ int skipped_count;
+ char index[10];
+ char prev_index[4];
+ Elm_Object_Item *item;
+} ct_list_index_data;
+
+typedef struct {
+ void *user_data;
+ Evas_Smart_Cb cb;
+ char *icon_path;
+} ctr_btn_info;
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *entry;
+ Elm_Object_Item *navi_it;
+ Elm_Object_Item *btn_op;
+ char *name_old;
+ void *info;
+ ct_group_rename_update_cb result_cb;
+ void *fn_data;
+} ct_group_edit_data;
+
+typedef struct {
+ int id;
+ char *icon_path;
+ char *addressbook_name;
+ int account_id;
+}ct_ab_map;
+
+typedef struct {
+ void *person;
+ contacts_record_h contact;
+ Elm_Object_Item *item;
+ bool img_loaded;
+ bool number_loaded;
+ Eina_Bool checked;
+ char *img_path;
+ char *number;
+ char *display;
+ char *status_str;
+ char *display_index;
+ int id;
+ int id_ret;
+ int id_ret_type;
+ int link_count;
+ int mode_ab;
+ Eina_List *addressbook_id_list;
+
+ Eina_List *number_list;
+ Eina_List *email_list;
+}ct_person_list;
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *box;
+ Evas_Object *navi;
+ Evas_Object *base_layout;
+ Evas_Object *content_layout;
+ Evas_Object *layout;
+ Evas_Object *nocontent;
+ Evas_Object *searchbar;
+ Evas_Object *genlist;
+ Evas_Object *fast_index;
+ Evas_Object *popup;
+ Evas_Object *select_all_layout;
+ Elm_Object_Item *navi_item;
+ Elm_Object_Item *count_item;
+ Elm_Object_Item *last_sweep_item;
+ Elm_Object_Item *search_group_item;
+ Evas_Object *ctrl_button;
+
+ Elm_Theme *th;
+ Elm_Genlist_Item_Class itcs[5];
+ void(*gl_sel)(void *data, Evas_Object *obj, void *event_info);
+ void *gl_sel_data;
+ void (*edit_sel_update)(void *data);
+
+ char group_index[4];
+ Elm_Object_Item *group_item;
+
+ char *ug_data;
+ void *ug;
+ void *child_ug;
+
+ bool updating;
+ bool is_background;
+ bool need_update;
+ int list_mode;//will be removed.
+ int view_id;
+ int tab_mode;
+ int ug_request;
+ int list_op;
+ int base_ab;
+ int base_ab_mode;
+ int base_grp;
+ int readed_n;
+ int selected_person_id;
+ int cnt_list_total;
+ int cnt_checked;
+ int cnt_max_check;
+ int cnt_import_total;
+ int cnt_import;
+ char *title;
+ char *sub_title;
+ char *search_str;
+ contacts_name_display_order_e order_display;
+ int acc_count;
+ ct_ab_map *acc_types;
+
+ ct_list_navi_item_update_fn list_navi_item_update_fn;
+
+ contacts_list_h import_list;
+ Eina_List *list;
+ Eina_List *list_index;
+ Eina_List *list_check;
+ Eina_List *list_grp_person;
+ Eina_List *list_delete_records;
+ Eina_List *list_import_records;
+
+ Ecore_Idler *list_idler;
+ Ecore_Timer *update_timer;
+ Ecore_Timer *update_queue_timer;
+
+ int idx_vcard;
+ const char *vcard_path;
+
+ ph_progress_info *p_info;
+ ct_select_result_cb select_result_cb;
+ ct_contact_add_cb contact_add_cb;
+ void *select_result_cb_data;
+
+}ct_list_data;
+
+typedef struct {
+ Elm_Theme *th;
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+
+ Elm_Object_Item *titem;
+ Elm_Object_Item *navi_item;
+ Elm_Object_Item *prev_navi_item;
+ Evas_Object *ctrl_button;
+ Elm_Object_Item *base_info_item;
+ Elm_Object_Item *base_item;
+ Elm_Object_Item *util_item;
+ Elm_Object_Item *number_util_item;
+
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Ecore_Idler *idler;
+
+ Elm_Object_Item *group_item;
+ Elm_Object_Item *ringtone_item;
+ Elm_Object_Item *vibration_item;
+
+ int order_display;
+
+ Eina_List *list_number;
+ Eina_List *list_email;
+ Eina_List *list_postal;
+ Eina_List *list_relationship;
+ Eina_List *list_event;
+ Eina_List *list_messenger;
+ Eina_List *list_website;
+ Eina_List *list_note;
+
+ bool updated;
+ bool updating;
+ bool is_shortcut;
+ bool has_detail;
+ bool has_input;
+ bool ug_detail;
+ bool has_number;
+ int touch_x;
+ int touch_y;
+ int base_grp;
+ int base_ab;
+ int base_ab_mode;
+ int view_mode;
+ char *base_ab_name;
+ char* vcard_path;
+ ui_gadget_h ug;
+ void *child_ug;
+ int ug_request;
+ int view_create_version;
+
+ int person_id;
+ contacts_record_h person;
+ contacts_record_h contact;
+ Eina_List *list_contacts;
+ Eina_List *list_activity;
+
+ void *prev_view_data;
+ UDateFormat* formatter;
+ Evas_Object *genlist_unlink;
+ ph_progress_info *p_info;
+ bool only_input;
+ bool view_destroying;
+
+ bool touch_block;
+
+}ct_detail_data;
+
+typedef struct {
+ Elm_Theme *th;
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *noc;
+ Evas_Object *scroller;
+ Evas_Object *popup;
+ Evas_Object *history_genlist;
+ Evas_Object *ctrl_button;
+ Evas_Object* select_all_layout;
+ Elm_Object_Item *select_all_item;
+ Elm_Object_Item *navi_item;
+ Eina_List *list;
+ Ecore_Idler *idler;
+ int person_id;
+ int list_count;
+ int pre_date_type;
+ UDateFormat* hformatter[5];
+ UDateFormat* formatter;
+ int cnt_checked;
+ int view_mode;
+ bool updated;
+ bool updating;
+ ph_progress_info *p_info;
+}ct_history_data;
+
+typedef struct {
+ Elm_Theme *th;
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *activity_genlist;
+ Evas_Object *ctrl_button;
+ Elm_Object_Item *navi_item;
+ Eina_List *list;
+ int person_id;
+ int pre_date_type;
+ UDateFormat* hformatter[5];
+ UDateFormat* formatter;
+ ct_ab_map *acc_types;
+ int acc_cnt;
+}ct_activity_data;
+
+typedef struct {
+ Evas_Object *box;
+ Evas_Object *scroller;
+ Evas_Object *save_button;
+ Evas_Object *popup;
+ Elm_Object_Item *pre_item;
+ Elm_Object_Item *navi_item;
+ Ecore_Event_Handler* win_prop_change;
+ Evas_Object *layout;
+
+ bool add_job_title;
+ bool add_department;
+
+ Evas_Object *ly_image;
+ Evas_Object *ly_basic_info;
+ Evas_Object *ly_basic_info_middle_name;
+ Evas_Object *ly_basic_info_last_name;
+ Evas_Object *ly_basic_info_suffix;
+ Evas_Object *ly_basic_info_nickname;
+ Evas_Object *ly_basic_info_job_title;
+ Evas_Object *ly_basic_info_department;
+ Evas_Object *ly_basic_info_company;
+ Evas_Object *ly_number_first;
+ Evas_Object *ly_number_last;
+ Evas_Object *ly_number_default;
+ Evas_Object *ly_number_set_default_separator_before;
+ Evas_Object *ly_number_set_default;
+ Evas_Object *ly_number_set_default_separator_after;
+ Evas_Object *ly_number_base;
+ Evas_Object *ly_email_first;
+ Evas_Object *ly_email_last;
+ Evas_Object *ly_email_default;
+ Evas_Object *ly_email_set_default;
+ Evas_Object *ly_email_base;
+ Evas_Object *ly_addr_first;
+ Evas_Object *ly_addr_last;
+
+ Evas_Object *ly_seperator_more;
+ Evas_Object *ly_seperator_basic_info;
+ Evas_Object *ly_messenger_first;
+ Evas_Object *ly_messenger_last;
+ Evas_Object *ly_url_first;
+ Evas_Object *ly_url_last;
+ Evas_Object *ly_relationship_first;
+ Evas_Object *ly_relationship_last;
+ Evas_Object *ly_event_first;
+ Evas_Object *ly_event_last;
+ Evas_Object *ly_note;
+
+ Evas_Object *ly_group;
+ Evas_Object *ly_ringtone;
+ Evas_Object *ly_vibration;
+ Evas_Object *ly_address_book;
+ Evas_Object *ly_moreinfo;
+
+ bool saved;
+ Eina_Bool save_disable;
+ int view_create_ver;
+ int cnt_addr;
+ int cnt_num;
+ int idx_append;
+
+ int base_ab;
+ int base_ab_mode;
+ char *name_old;
+ char *base_ab_name;
+
+ int contact_id;
+ contacts_record_h contact;
+ ct_detail_data *cdetail_d;
+
+ bool camera_service_launched;
+ ui_gadget_h src_ug;
+ ui_gadget_h crop_ug;
+ bool keypad_on;
+}ct_input_data;
+
+
+typedef struct {
+ Evas_Object *ly_content;
+ contacts_record_h record;
+ Evas_Object *data;
+ const char *view_uri;
+}ct_input_typed_data;
+
+typedef enum {
+ CT_AB_POPUP_TYPE_INPUT_VIEW,
+ CT_AB_POPUP_TYPE_GINPUT_VIEW,
+ CT_AB_POPUP_TYPE_LIST_VIEW,
+} ct_addrbook_popup_type;
+
+typedef struct {
+ int id;
+ int mode;
+ char *name;
+ bool all_contacts_item;
+ Elm_Object_Item *item;
+} ct_ab_popup_data;
+
+void phone_free_contacts(Eina_List *list);
+Eina_List * phone_load_speeddial_data(int *ref_count);
+void phone_free_speeddial_data(Eina_List *list);
+char *phone_get_voice_mail_number(void);
+
+void* phone_launch_msg_composer_ug(void *parent_ug, char *data, int msg_id, void(*destroy_cb)(void*), void *cb_param);
+void* phone_launch_contact_list_ug(void *parent_ug, int request, void(*result_cb)(void*, void*), void(*destroy_cb)(void*), void *cb_param);
+void* phone_launch_contact_detail_ug(void *parent_ug, int contact_index, void(*destroy_cb)(void*), void *cb_param);
+void* phone_launch_contact_add_list_edit_ug(void *parent_ug, char *data, void(*destroy_cb)(void*), void *cb_param);
+void* phone_image_crop_ug(ui_gadget_h parent, const char *photo,
+ struct ug_cbs *cbs);
+void* ctui_msg_ug(ui_gadget_h parent, const char *number, const int idx, const char *attach, void(*destroy_cb)(void*), void *cb_param);
+void* ctui_account_ug(void *data, Evas_Object *obj, void *event_info, void(*destroy_cb)(void*), void *cb_param);
+
+void ug_common_destroy_cb(ui_gadget_h ug, void *priv);
+void ug_common_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
+void ctui_destroy_child_ug(void *data);
+
+void phone_launch_voice_call(const int id, const char* number);
+
+Evas_Object *phone_create_base_layout(Evas_Object *parent, bool is_fullview);
+Evas_Object *phone_show_popup(Evas_Object *parent, const char *desc, double timeout);
+Evas_Object *phone_create_confirm_popup(Evas_Object **popup, Evas_Object *win, const char* description,
+ void (*btn_clicked_cb)(void *, Evas_Object *, void *), void *cb_data);
+Evas_Object *phone_create_list_sweep_btn(Evas_Object *parent, char *fullpath);
+Evas_Object *phone_create_bg(Evas_Object *parent);
+Evas_Object *phone_create_icon_with_img(Evas_Object *parent, char *full_path);
+Evas_Object *phone_create_navi_btn(Evas_Object *parent, const char *style);
+
+Evas_Object *phone_progressbar_popup(Evas_Object *parent, ph_progress_info *p_info, const char *title);
+Evas_Object *phone_get_notify(Evas_Object *parent);
+void phone_show_notify(Evas_Object *parent, const char *msg);
+void phone_hide_notify(Evas_Object *parent);
+void phone_show_tickernoti(const char *);
+void phone_view_back_btn_cb(void *data, Evas_Object *obj, void *event_info);
+void phone_ug_destroy_me_cb(void *data, Evas_Object *obj, void *event_info);
+void phone_back_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+void phone_navi_item_clear(Elm_Object_Item *navi_item);
+void phone_set_view_info(ph_view_info *view_info, Evas_Object *win, Evas_Object *navi,
+ void *ug, int ug_request, int cnt_max, char *ug_data);
+
+void phone_list_ug_return_ids(ui_gadget_h ug, int *result_list, int cnt, const char *bd_key);
+void phone_list_ug_return_number_email_ids(ui_gadget_h ug, int *result_number_list, int number_list_count, int *result_email_list, int email_list_count);
+void phone_ug_return_id(ui_gadget_h ug, int ct_id, int num_id, int email_id);
+void phone_ug_return_vcard(ui_gadget_h ug, int ct_id, char *vcard);
+Evas_Object* phone_create_nocontents(Evas_Object *parent, const char* label);
+void phone_toolbar_disabled_item_append(Evas_Object *toolbar, int cnt);
+
+char* ctui_get_addressbook_icon_path(int addressbook_id);
+const char* ctui_get_default_contact_img(int view_type);
+void ctui_get_number_type_str(contacts_record_h record, int CTS_NUMBER_type, char *dest, int dest_len);
+void ctui_ld_to_dd(ct_list_data *clist_d, ct_detail_data *cdetail_d);
+
+Evas_Object* ctui_addrbook_popup(Evas_Object *parent, Evas_Smart_Cb item_sel_cb, void *sel_cb_data, ct_addrbook_popup_type ab_type);
+void ctui_entry_limit_size_set(Evas_Object *entry);
+Evas_Object* ctui_create_btn(Evas_Object *parent, const char *label);
+void ctui_genlist_append_separator_10px(Evas_Object *genlist);
+void ctui_genlist_append_separator_20px(Evas_Object *genlist);
+void ctui_navi_btn_disabled_set(Evas_Object *navi, Eina_Bool disabled);
+char* ctui_entry_markup_to_utf8(const char *s);
+void ctui_entry_entry_set(Evas_Object *entry, const char *s);
+Evas_Object* ctui_create_editfield(Evas_Object *parent, const char *title, const char *guide, bool multiline);
+void ctui_genlist_append_separator_20px_with_line(Evas_Object *genlist);
+void ctui_navi_left_btn_disabled_set(Elm_Object_Item *item, Eina_Bool disabled);
+void ctui_list_ug_hide_cb(void *data, Evas_Object *obj, void *event_info);
+Evas_Object* phone_create_select_all(Evas_Object *box, const char *selectall_text, selectall_changed_cb cb, void *cb_data);
+void ctui_list_free_contacts(Eina_List* list);
+void ctui_list_refresh_genlist(ct_list_data *clist_d);
+void ctui_list_handle_search(ct_list_data *clist_d);
+int phone_detail_log_is_call_ing_type(int type);
+int phone_detail_log_is_mms_type(int type);
+int phone_detail_log_is_sms_type(int type);
+int phone_detail_log_is_email_type(int type);
+char* phone_detail_log_get_icon_type(int log_type);
+char* phone_detail_log_get_duration_from_number(int number);
+void phone_detail_log_init_time_format(void);
+void phone_detail_log_generate_date_format(UDateFormat **formatter);
+char* phone_detail_log_get_icon_path_with_action(int log_type);
+char* phone_detail_log_get_date(UDateFormat ** formatter, int log_time);
+char* phone_detail_log_get_time(UDateFormat ** formatter, int log_time);
+int phone_detail_log_get_date_type(int log_time, int log_duration);
+void phone_detail_log_delete_date_format(UDateFormat **formatter);
+int phone_detail_log_get_phonenumber_type(int CTS_NUMBER_type);
+char *ph_log_util_get_formatted_date(UDateFormat **formatter, int log_time, date_style style);
+void ct_list_clear_pdata(ct_list_data *clist_d);
+void phone_move_ctxpopup(Evas_Object *popup, Evas_Object *item);
+void phone_resize_notify(Evas_Object *parent, int rotate);
+void ctui_get_addressbook_name(int addressbook_id, char *dest, int dest_len);
+Eina_List* ctui_person_get_writable_contact_list(int person_id);
+Eina_List* ctui_person_get_number_list(Eina_List *contact_list);
+Eina_List* ctui_person_get_email_list(Eina_List *contact_list);
+Eina_List* ctui_person_get_contact_list(int person_id);
+void ctui_free_record_list(Eina_List *contact_list);
+int ctui_get_email_type_index(int type);
+int ctui_get_mfc_option(void);
+
+int ctui_get_view_mode(void);
+void ctui_set_view_mode(int addressbook_id);
+
+contacts_error_e phone_cts_get_list(const char *view_uri, int property_id, int match_value, contacts_list_h *out_list);
+void phone_cts_free_list(contacts_list_h list);
+contacts_error_e phone_cts_get_int_from_list(contacts_list_h list, int property_id, int *out_int);
+contacts_error_e phone_cts_get_str_from_list(contacts_list_h list, int property_id, char **out_str);
+contacts_error_e phone_cts_get_bool_from_list(contacts_list_h list, int property_id, bool *out_bool);
+contacts_error_e phone_cts_get_default_number(int person_id, contacts_record_h *record_clone);
+contacts_error_e phone_cts_get_default_email(int person_id, contacts_record_h *record_clone);
+void ctui_get_account_name_by_address_book_id(int address_book_id, char *dest, int dest_len);
+bool ctui_list_make_vcard(int contactid, char *path, int path_length);
+void ctui_list_lazy_update(const char *view_uri, void *data);
+char* ctui_list_get_highlight_text(ct_list_data *clist_d, const char *src);
+Evas_Object *phone_create_toolbar_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data);
+Evas_Object* ctui_create_more_btn(Evas_Object *parent, Evas_Smart_Cb func, void *data);
+void ctui_popup_hide_cb(void *data, Evas_Object *obj, void *event_info);
+
+
+int ctui_list_checked_cnt_get(Eina_List *list);
+void ctui_list_update_selection_info(void *data);
+void ctui_list_set_unsweep(ct_list_data *clist_d);
+
+#endif //__PHONE_COMMON_H__
+contacts_record_h ctui_get_record_image(contacts_record_h record_contact);
+
+
+int ctui_get_addressbook_id_by_index(Eina_List *list, int index);
+Eina_List* ctui_get_addressbook_id_list(const char *ori_string, const char *sep);
+void ctui_list_edit_navi_pop(void *data, Evas_Object *obj, void *event_info);
+int ctui_get_addressbook_id(char* addressbook_name);
+
+void ctui_create_contacts_error_popup(Evas_Object *parent, int err);
+
+void ctui_list_searchbar_cancel_cb(void *data, Evas_Object *obj, void *event_info);
+
diff --git a/lib/common/include/phone-path.h b/lib/common/include/phone-path.h
new file mode 100755
index 0000000..2613249
--- /dev/null
+++ b/lib/common/include/phone-path.h
@@ -0,0 +1,136 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __PHONE_PATH_H__
+#define __PHONE_PATH_H__
+
+#if !defined(IMGDIR)
+# define IMGDIR "/usr/ug/res/images/ug-"PACKAGE
+#endif
+
+#if !defined(EDJDIR)
+# define EDJDIR "/usr/ug/res/edje/ug-"PACKAGE
+#endif
+
+#if !defined(UGDATAIDR)
+# define UGDATAIDR "/opt/usr/ug/data/ug-"PACKAGE
+#endif
+
+#define PROGRESS_EDJ EDJDIR"/progress.edj"
+#define DIALER_EDJ EDJDIR"/dialer.edj"
+#define DIALER_THEME_EDJ EDJDIR"/dialer_theme.edj"
+#define LOGDETAIL_THEME_EDJ EDJDIR"/logdetail_theme.edj"
+#define SPEEDDIAL_THEME_EDJ EDJDIR"/speeddial_theme.edj"
+#define CONTACTS_EDJ EDJDIR"/contacts.edj"
+#define FAVORITES_THEME_EDJ EDJDIR"/favorites_theme.edj"
+#define GROUP_THEME_EDJ EDJDIR"/group_theme.edj"
+#define CONTACT_BUTTON_THEME_EDJ EDJDIR"/contact_button.edj"
+#define IMAGE_LAYOUT_EDJ EDJDIR"/image_layout.edj"
+#define LIST_THEME_EDJ EDJDIR"/list_theme.edj"
+#define DETAIL_THEME_EDJ EDJDIR"/detail_theme.edj"
+#define SELECTION_INFO_EDJ EDJDIR"/selectioninfo.edj"
+#define NOCONTENT_LAYOUT_EDJ EDJDIR"/nocontent_layout.edj"
+
+
+#define IMG_DEFAULT IMGDIR"/caller_ID_default_70x70_man.png"
+#define IMG_VOICEMAIL_ICON IMGDIR"/C01-5_icon_voicecall.png"
+
+#define IMG_ALL_BLOCKED_ICON IMGDIR"/C01-4_icon_Blocked.png"
+#define IMG_CALL_BLOCKED_ICON IMGDIR"/C01-4_icon_call_blocked.png"
+#define IMG_MESSAGE_BLOCKED_ICON IMGDIR"/C01-4_icon_message_blocked.png"
+
+#define PH_IMG_ICON_DIALER IMGDIR"/01_controlbar_icon_dialer.png"
+#define PH_IMG_ICON_CONTACTS IMGDIR"/01_controlbar_icon_contacts.png"
+#define PH_IMG_ICON_LOGS IMGDIR"/01_controlbar_icon_logs.png"
+#define PH_IMG_ICON_GROUP IMGDIR"/01_controlbar_icon_groups.png"
+#define PH_IMG_ICON_FAVORITE IMGDIR"/01_controlbar_icon_favorite.png"
+#define PH_IMG_ICON_DONE IMGDIR"/01_controlbar_icon_save.png"
+#define PH_IMG_ICON_EDIT IMGDIR"/01_controlbar_icon_edit.png"
+#define PH_IMG_ICON_ADD IMGDIR"/01_controlbar_icon_create.png"
+#define PH_IMG_ICON_MORE IMGDIR"/01_controlbar_icon_more.png"
+#define PH_IMG_ICON_PHONE IMGDIR"/phone.png"
+#define PH_IMG_ICON_CALL IMGDIR"/C02_button_icon_call.png"
+#define PH_IMG_ICON_CALL_PRESS IMGDIR"/C02_button_icon_call_press.png"
+#define PH_IMG_ICON_CALL_DIM IMGDIR"/C02_button_icon_call_dim.png"
+#define PH_IMG_ICON_MESSAGE IMGDIR"/C02_button_icon_message.png"
+#define PH_IMG_ICON_MESSAGE_PRESS IMGDIR"/C02_button_icon_message_press.png"
+#define PH_IMG_ICON_MESSAGE_DIM IMGDIR"/C02_button_icon_messagedim.png"
+#define PH_IMG_ICON_VIDEOCALL IMGDIR"/C02_button_icon_videocall.png"
+#define PH_IMG_ICON_VIDEOCALL_PRESS IMGDIR"/C02_button_icon_videocall_press.png"
+#define PH_IMG_ICON_VIDEOCALL_DIM IMGDIR"/C02_button_icon_videocall_call_dim.png"
+#define PH_IMG_ICON_CHAT_ON IMGDIR"/C02_icon_chat_on.png"
+#define PH_IMG_ICON_FILETRANSFER IMGDIR"/C02_icon_filetransfer.png"
+
+#define PH_IMG_CIRCLE_ICON_CALL IMGDIR"/C02_circle_icon_call.png"
+#define PH_IMG_ICON_CALL_PRESSED IMGDIR"/C02_circle_icon_call_press.png"
+#define PH_IMG_ICON_SMS IMGDIR"/C02_circle_icon_sms.png"
+#define PH_IMG_ICON_SMS_PRESSED IMGDIR"/C02_circle_icon_sms_press.png"
+#define PH_IMG_ICON_VCALL IMGDIR"/C02_circle_icon_vt-call.png"
+#define PH_IMG_ICON_VCALL_PRESSED IMGDIR"/C02_circle_icon_vt-call_press.png"
+
+#define PH_IMG_ICON_LOGTYPE_MISSED IMGDIR"/C01-4_controlbar_icon_missed_call.png"
+#define PH_IMG_ICON_LOGTYPE_ALL IMGDIR"/C01-4_controlbar_icon_all.png"
+#define PH_IMG_ICON_CREATE_CONTACT IMGDIR"/C01-4_controlbar_icon_create.png"
+#define PH_IMG_ICON_DELETE IMGDIR"/C02_button_icon_delete.png"
+#define PH_IMG_ICON_SET_BLOCK IMGDIR"/C01-4_controlbar_icon_view_block.png"
+#define PH_IMG_ICON_VIEW_CONTACT IMGDIR"/C01-4_controlbar_icon_view_contacts.png"
+
+#define CTUI_IMG_ICON_ADD_ACCOUNTS IMGDIR"/01_controlbar_icon_add_account.png"
+#define CTUI_IMG_ICON_ADD_FAVORITE IMGDIR"/01_controlbar_icon_add-to-bookmarks.png"
+#define CTUI_IMG_ICON_CREATE_GROUP IMGDIR"/01_controlbar_icon_exchangs_register.png"
+#define CTUI_IMG_ICON_ADD_TO_CONTACTS IMGDIR"/01_controlbar_icon_add_to_contact.png"
+#define CTUI_IMG_ICON_CLOSE IMGDIR"/01_controlbar_icon_close.png"
+#define CTUI_IMG_ICON_EXPAND_OPENED IMGDIR"/00_button_icon_expand_opened.png"
+#define CTUI_IMG_ICON_EXPAND_CLOSED IMGDIR"/00_button_icon_expand_closed.png"
+#define CTUI_IMG_ICON_VIEW IMGDIR"/01_controlbar_icon_bluetooth_preview.png"
+#define CTUI_IMG_ICON_RESET IMGDIR"/C02_icon_reset.png"
+#define CTUI_IMG_ICON_ADD_GROUP IMGDIR"/C02_icon_add_group.png"
+#define CTUI_IMG_ICON_FAVORITE IMGDIR"/C02_favorite_icon.png"
+#define CTUI_IMG_ICON_CIRCLE IMGDIR"/C02_circle_button.png"
+#define CTUI_IMG_ICON_CIRCLE_PRESSED IMGDIR"/C02_circle_button_press.png"
+#define CTUI_IMG_ICON_CALL IMGDIR"/C02_circle_icon_call.png"
+#define CTUI_IMG_ICON_CALL_PRESSED IMGDIR"/C02_circle_icon_call_press.png"
+#define CTUI_IMG_ICON_SMS IMGDIR"/C02_circle_icon_sms.png"
+#define CTUI_IMG_ICON_SMS_PRESSED IMGDIR"/C02_circle_icon_sms_press.png"
+#define CTUI_IMG_ICON_VCALL IMGDIR"/C02_circle_icon_vt-call.png"
+#define CTUI_IMG_ICON_VCALL_PRESSED IMGDIR"/C02_circle_icon_vt-call_press.png"
+#define CTUI_IMG_ICON_PREVIOUS IMGDIR"/01_controlbar_icon_previous.png"
+#define CTUI_IMG_ICON_NEXT IMGDIR"/01_controlbar_icon_next.png"
+
+#define CTUI_IMG_ICON_EMAIL IMGDIR"/email.png"
+#define CTUI_IMG_ICON_MESSAGE IMGDIR"/message.png"
+
+#define CTUI_IMG_CHECK IMGDIR"/00_check_checking.png"
+#define CTUI_IMG_DEFAULT_PHOTO_SMALL IMGDIR"/caller_ID_default_96x96.png"
+#define CTUI_IMG_DEFAULT_PHOTO_BIG IMGDIR"/caller_ID_default_128x128.png"
+#define CTUI_IMG_PHOTO_EDIT IMGDIR"/caller_ID_edit.png"
+#define CTUI_IMG_INPUT_PLUS IMGDIR"/00_button_plus.png"
+#define CTUI_IMG_INPUT_GALLERY IMGDIR"/C02_caller_id_icon_gallery.png"
+#define CTUI_IMG_INPUT_GALLERY_PRESSED IMGDIR"/C02_caller_id_icon_gallery_press.png"
+#define CTUI_IMG_INPUT_CAMERA IMGDIR"/C02_caller_id_icon_camera.png"
+#define CTUI_IMG_INPUT_CAMERA_PRESSED IMGDIR"/C02_caller_id_icon_camera_press.png"
+
+#define CTUI_IMG_ACC_PHONE IMGDIR"/C02_account_00.png"
+#define CTUI_IMG_ACC_GOOGLE IMGDIR"/C02_account_01.png"
+#define CTUI_IMG_ACC_FACEBOOK IMGDIR"/C02_account_02.png"
+#define CTUI_IMG_ACC_YAHOO IMGDIR"/C02_account_03.png"
+#define CTUI_IMG_ACC_EXCHANGE IMGDIR"/C02_account_04.png"
+#define CTUI_IMG_ACC_DEFAULT IMGDIR"/C02_account_default.png"
+#define CTUI_IMG_ACC_RCS IMGDIR"/C04_icon_joyn.png"
+#define CTUI_IMG_ACC_SIM IMGDIR"/C02_account_sim.png"
+#endif //__PHONE_PATH_H__
+
diff --git a/lib/common/include/phone-text.h b/lib/common/include/phone-text.h
new file mode 100755
index 0000000..f8536a5
--- /dev/null
+++ b/lib/common/include/phone-text.h
@@ -0,0 +1,308 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __PHONE_TEXT_H__
+#define __PHONE_TEXT_H__
+
+#include <libintl.h>
+
+#define gettext_noop(String) (String)
+#define N_(String) gettext_noop (String)
+
+enum {
+ PHTEXT_KEYPAD,
+ PHTEXT_FAVORITES,
+ PHTEXT_SPEEDDIAL,
+ PHTEXT_VOICE_MAIL,
+ PHTEXT_LOGS,
+ PHTEXT_SPEED_DIAL_REQUEST,
+ PHTEXT_REQUEST_FAIL,
+ PHTEXT_REQUEST_SUCCESS,
+ PHTEXT_EMERGENCY_CALL,
+ PHTEXT_NO_LOGS,
+ PHTEXT_NO_FAVORITES,
+ PHTEXT_NOT_EXIST_MESSAGE,
+ PHTEXT_EXCEED_NUM_MAX_LENGTH,
+ PHTEXT_DELETING_LOGS,
+ PHTEXT_DELETING_FAVORITES,
+ PHTEXT_INITIALIZING,
+ PHTEXT_SOUND_OFF,
+ PHTEXT_SOUND_ON,
+ PHTEXT_PREVIOUS_SCREEN_ABB,
+ PHTEXT_BACK_TO_CALL,
+ PHTEXT_INCOMMING_CALL,
+ PHTEXT_OUTGOING_CALL,
+ PHTEXT_MISSED_CALL,
+ PHTEXT_SENT_MESSAGE,
+ PHTEXT_RECEIVED_MESSAGE,
+ PHTEXT_REJECTED_CALL_ABB,
+ PHTEXT_BLOCKED_CALL_ABB,
+ PHTEXT_EDIT_NUMBER_BEFORE_CALL,
+}; //PH_GET_TEXT_BASIC
+
+
+enum {
+ CTTEXT_ALL_CONTACTS,
+ CTTEXT_NOT_ASSIGNED,
+ CTTEXT_SDN,
+ CTTEXT_PHONE,
+ CTTEXT_GROUP,
+ CTTEXT_DEFAULT,
+ CTTEXT_RINGTONE,
+ CTTEXT_URL,
+ CTTEXT_INSTANT_MESSENGER,
+ CTTEXT_EMAIL,
+ CTTEXT_NUMBER,
+ CTTEXT_NOTE,
+ CTTEXT_POSTAL_ADDRESS,
+ CTTEXT_DETAILS,
+ CTTEXT_COMPANY,
+ CTTEXT_ORDER_DISPLAY_NAME,
+ CTTEXT_OWN_NUMBER,
+ CTTEXT_FIRSTNAME,
+ CTTEXT_LASTNAME,
+ CTTEXT_MIDDLE,
+ CTTEXT_SUFFIX,
+ CTTEXT_NICKNAME,
+ CTTEXT_SELECT_EXPORT_ADDRBOOK,
+ CTTEXT_SELECT_CONTACTS,
+ CTTEXT_POSTAL_CODE,
+ CTTEXT_COUNTRY,
+ CTTEXT_PROVINCE,
+ CTTEXT_CITY,
+ CTTEXT_STREET,
+ CTTEXT_SAVED_IN,
+ CTTEXT_MOST_FREQUENT_CONTACTS,
+ CTTEXT_COPIED,
+ CTTEXT_EXPORTED,
+ CTTEXT_DELETING_CONTACTS,
+ CTTEXT_MOVING_CONTACTS,
+ CTTEXT_COPYING_CONTACTS,
+ CTTEXT_IMPORTING_SIM_CONTACTS,
+ CTTEXT_IMPORTING_SD_CONTACTS,
+ CTTEXT_EXPORTING_CONTACTS_TO,
+ CTTEXT_VCARD_CONTACTS,
+ CTTEXT_LOADING_VCARD,
+ CTTEXT_IMPORTED,
+ CTTEXT_NA,
+ CTTEXT_ALL_LINKED_CONTACTS,
+ CTTEXT_LINKED_CONTACTS,
+ CTTEXT_MORE_INFORMATION,
+ CTTEXT_JOB_TITLE,
+ CTTEXT_DEPARTMENT,
+ CTTEXT_GROUP_NAME,
+ CTTEXT_ADD_ACCOUNT,
+ CTTEXT_ADDING_MEMBERS_TO_GROUP,
+ CTTEXT_VIEW,
+ CTTEXT_COUNT_CONTACTS,
+ CTTEXT_RENAME,
+ CTTEXT_RELATIONSHIP,
+ CTTEXT_NO_HISTORIES,
+ CTTEXT_NO_ACTIVITIES,
+ CTTEXT_ADDING_ING,
+ CTTEXT_CUSTOM,
+ CTTEXT_ADDITIONAL_INFO,
+ CTTEXT_PO_BOX,
+ CTTEXT_STATE,
+ CTTEXT_FRIENDS,
+ CTTEXT_FAMILY,
+ CTTEXT_CO_WORKERS,
+ CTTEXT_WORK,
+ CTTEXT_VIBRATION_PATTERN,
+ CTTEXT_SET_DEFAULT,
+ CTTEXT_EVENT,
+ CTTEXT_SHARE_CONTACT_INFO,
+ CTTEXT_1_CONTACT,
+ CTTEXT_WI_FI_DIRECT,
+ CTTEXT_EXPORT_TO_SIM_CARD,
+ CTTEXT_INFO,
+ CTTEXT_HISTORY,
+ CTTEXT_ACTIVITIES,
+ CTTEXT_GROUP_MESSAGE,
+ CTTEXT_GROUP_EMAIL,
+}; //CT_GET_TEXT_BASIC
+
+enum {
+ CTTEXT_NONAME,
+ CTTEXT_INVALID_EMAIL,
+ CTTEXT_SAVE_FAIL,
+ CTTEXT_ERR_DB_LOCKED,
+ CTTEXT_ADD_FAIL_EXIST,
+ CTTEXT_ALREADY_EXIST,
+ CTTEXT_NO_GROUP,
+ CTTEXT_NO_NUMBER,
+ CTTEXT_NO_EMAIL,
+ CTTEXT_NO_CONTACTS,
+ CTTEXT_IMPORT_SIM_NO_DATA,
+ CTTEXT_EXCEED_LIMIT,
+ CTTEXT_DATA_NOT_EXIST,
+ CTTEXT_INVALID_NUMBER,
+ CTTEXT_SIM_MEMORY_FULL,
+ CTTEXT_NO_CONTACTS_HELP_TEXT,
+ CTTEXT_NO_HISTORIES_HELP_TEXT,
+ CTTEXT_UNABLE_TO_SEND_NAME_CARDS,
+};//CT_GET_TEXT_ERR
+
+enum {
+ PHTEXT_SELECT_LOGS,
+ PHTEXT_SELECT_SPEED_DIAL_CONTACTS,
+ PHTEXT_UNBLOCK,
+ PHTEXT_CHANGE_CONTACT,
+ PHTEXT_ADD_PAUSE,
+ PHTEXT_ADD_WAIT,
+ PHTEXT_MISSED,
+ PHTEXT_EXIT,
+}; // PH_GET_TEXT_BASE_OP
+
+enum {
+ PHTEXT_BODY_SUNDAY,
+ PHTEXT_BODY_MONDAY,
+ PHTEXT_BODY_TUESDAY,
+ PHTEXT_BODY_WEDNESDAY,
+ PHTEXT_BODY_THURSDAY,
+ PHTEXT_BODY_FRIDAY,
+ PHTEXT_BODY_SATURDAY,
+}; // PH_GET_TEXT_DAY
+
+enum {
+ CTTEXT_SET_DEFAULT_NUMBER,
+ CTTEXT_SET_DEFAULT_EMAIL,
+ CTTEXT_IMAGE,
+ CTTEXT_TAKE_A_PHOTO,
+ CTTEXT_DELETE_PHOTO,
+ CTTEXT_ADD_TO_HOME,
+ CTTEXT_SAVE_CONTACT_TO,
+ CTTEXT_SAVE_TO,
+ CTTEXT_IMPORT_SIM_CONTACTS,
+ CTTEXT_FIRSTLAST,
+ CTTEXT_LASTFIRST,
+ CTTEXT_SHOW,
+ CTTEXT_HIDE,
+ CTTEXT_SEND_NAME_CARD,
+ CTTEXT_CREATE_GROUP,
+ CTTEXT_SELECT_GROUP,
+ CTTEXT_EXPORT_CONTACTS,
+ CTTEXT_IMPORT_CONTACTS,
+ CTTEXT_LINK_CONTACTS,
+ CTTEXT_UNLINK,
+ CTTEXT_ALL_LINKED_CONTACTS_WILL_BE_DELETED,
+ CTTEXT_ADD_TO_FAVOURITES,
+ CTTEXT_EDIT_GROUP,
+ CTTEXT_ADD_MEMBER,
+}; //CT_GET_TEXT_BASE_OP
+
+enum {
+ CTTEXT_REL_NONE,
+ CTTEXT_REL_ASSISTANT,
+ CTTEXT_REL_BROTHER,
+ CTTEXT_REL_CHILD,
+ CTTEXT_REL_DOMESTIC_PARTNER,
+ CTTEXT_REL_FATHER,
+ CTTEXT_REL_FRIEND,
+ CTTEXT_REL_MANAGER,
+ CTTEXT_REL_MOTHER,
+ CTTEXT_REL_PARENT,
+ CTTEXT_REL_PARTNER,
+ CTTEXT_REL_REFERRED_BY,
+ CTTEXT_REL_RELATIVE,
+ CTTEXT_REL_SISTER,
+ CTTEXT_REL_SPOUSE,
+ CTTEXT_REL_CUSTOM,
+}; //CT_GET_TEXT_RELATIONSHIP_TYPE
+
+enum {
+ PH_GET_TEXT_BASIC,
+ PH_GET_TEXT_BASE_OP,
+ PH_GET_TEXT_DAY,
+ CT_GET_TEXT_BASIC,
+ CT_GET_TEXT_ERR,
+ CT_GET_TEXT_BASE_OP,
+ CT_GET_TEXT_NUM_TYPE,
+ CT_GET_TEXT_EMAIL_TYPE,
+ CT_GET_TEXT_WEBSITE_TYPE,
+ CT_GET_TEXT_POSTAL_TYPE,
+ CT_GET_TEXT_EVENT_TYPE,
+ CT_GET_TEXT_IM_TYPE,
+ CT_GET_TEXT_MONTH,
+ CT_GET_TEXT_RELATIONSHIP_TYPE,
+};
+const char* phone_get_text(int op, int type);
+#define T_(op, type) phone_get_text(op, type)
+
+enum {
+ PH_SYS_SK_OK,
+ CT_SYS_SK_SAVE,
+ CT_SYS_SK_DONE,
+ PH_SYS_SK_EDIT,
+ PH_SYS_SK_DELETE,
+ PH_SYS_SK_CANCEL,
+ PH_SYS_SK3_BLOCK,
+ PH_SYS_SK_NO,
+ PH_SYS_SK_YES,
+ CT_SYS_SK_ADD,
+ CT_SYS_SK_MORE,
+ CT_SYS_SK_NEXT,
+ PH_SYS_BODY_CALL,
+ PH_SYS_BODY_MESSAGE,
+ PH_SYS_BODY_VIDEO_CALL,
+ PH_SYS_BODY_UNKNOWN,
+ PH_SYS_BODY_SELECT_ALL,
+ PH_SYS_BODY_CONTACTS,
+ PH_SYS_BODY_DETAILS,
+ PH_SYS_BODY_REMOVE,
+ PH_SYS_BODY_TODAY,
+ PH_SYS_BODY_YESTERDAY,
+ PH_SYS_BODY_PREVIOUS,
+ PH_SYS_BODY_NONAME,
+ CT_SYS_BODY_CREATE,
+ CT_SYS_BODY_MOVE,
+ CT_SYS_BODY_COPY,
+ CT_SYS_BODY_PHONE,
+ CT_SYS_BODY_SEARCH,
+ CT_SYS_BODY_BLUETOOTH,
+ CT_SYS_BODY_EMAIL,
+ CT_SYS_BODY_SIM,
+ CT_SYS_BODY_MEMORYCARD,
+ CT_SYS_BODY_NAME,
+ PH_SYS_BODY_ALL,
+ PH_SYS_POP_FAIL,
+ PH_SYS_POP_FAILED,
+ PH_SYS_POP_CLOSE,
+ PH_SYS_POP_REMOVED,
+ PH_SYS_POP_DELETED,
+ PH_SYS_POP_INCORRECT_PASSWORD,
+ PH_SYS_POP_ALREDY_EXISTS,
+ PH_SYS_POP_SELECTED,
+ CT_SYS_POP_SUCCESS,
+ CT_SYS_POP_ERROR,
+ CT_SYS_POP_MOVED,
+ CT_SYS_POP_ADDED,
+ CT_SYS_POP_NOT_ENOUGH_MEMORY,
+ CT_SYS_POP_NOTHING_SELECTED,
+ CT_SYS_POP_FILE_NOT_FOUND,
+ CT_SYS_POP_ADDRESS,
+ PH_SYS_OPT_ADD_TO_CONTACTS,
+ PH_SYS_BODY_SELECTED_DATA_NOT_FOUND,
+ PH_SYS_POP_DELETE_Q,
+ CT_SYS_SK_SET,
+ CT_SYS_SK_RESET,
+};
+
+const char* phone_get_system_string(int type);
+#define S_(text) phone_get_system_string(text)
+
+#endif //__PHONE_TEXT_H__
diff --git a/lib/common/include/phone.h b/lib/common/include/phone.h
new file mode 100755
index 0000000..4fc78af
--- /dev/null
+++ b/lib/common/include/phone.h
@@ -0,0 +1,107 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __PHONE_APP_H__
+#define __PHONE_APP_H__
+
+#include <Elementary.h>
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+
+#if !defined(PACKAGE)
+# define PACKAGE "phone"
+#endif
+
+#define PHONE_PKG "org.tizen.phone"
+
+#define _EDJ(obj) (Evas_Object *)elm_layout_edje_get(obj)
+
+#define PH_DLOG_OUT
+#define PH_DEBUGGING
+
+#ifdef PH_DLOG_OUT
+#define LOG_TAG "PHONE"
+#include <dlog.h>
+#define DLOG(prio, fmt, arg...) \
+ do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
+#define INFO(fmt, arg...) SLOGI(fmt, ##arg)
+#define ERR(fmt, arg...) SLOGE("%s[%d]:" fmt, __FUNCTION__, __LINE__, ##arg)
+#define DBG(fmt, arg...) SLOGD("%s[%d]:" fmt, __FUNCTION__, __LINE__, ##arg)
+#else //PH_DLOG_OUT
+#define PRT(prio, fmt, arg...) \
+ do { fprintf((prio?stderr:stdout), "[Phone]" fmt"\n", ##arg); } while (0)
+#define INFO(fmt, arg...) PRT(0, fmt, ##arg)
+#define ERR(fmt, arg...) PRT(1, "%s :" fmt, __FUNCTION__, ##arg)
+#define DBG(fmt, arg...) \
+ do { \
+ printf("\x1b[105;37m[Phone]\x1b[0m(%s)" fmt "\n", __FUNCTION__, ##arg); \
+ } while (0)
+#endif //PH_DLOG_OUT
+
+#ifdef PH_DEBUGGING
+#define PH_FN_CALL DBG(">>>>>>>> called")
+#define PH_FN_END DBG("<<<<<<<< ended")
+#define PH_DBG(fmt, arg...) DBG(fmt, ##arg)
+#else /* PH_DEBUGGING */
+#define PH_FN_CALL
+#define PH_FN_END
+#define PH_DBG(...)
+#endif /* PH_DEBUGGING */
+
+#define p_warn_if(expr, fmt, arg...) do { \
+ if (expr) { \
+ ERR(fmt, ##arg); \
+ } \
+} while (0)
+#define p_ret_if(expr) do { \
+ if (expr) { \
+ ERR("(%s)", #expr); \
+ return; \
+ } \
+} while (0)
+#define p_retv_if(expr, val) do { \
+ if (expr) { \
+ ERR("(%s)", #expr); \
+ return (val); \
+ } \
+} while (0)
+#define p_retm_if(expr, fmt, arg...) do { \
+ if (expr) { \
+ ERR(fmt, ##arg); \
+ return; \
+ } \
+} while (0)
+#define p_retvm_if(expr, val, fmt, arg...) do { \
+ if (expr) { \
+ ERR(fmt, ##arg); \
+ return (val); \
+ } \
+} while (0)
+
+
+#define SAFE_STR(src) (src)?src:""
+#define STR_BLANK(str, src) (str && src)?" ":"", SAFE_STR(src)
+#define SAFE_STRDUP(src) (src)?strdup(src):NULL
+#define FREEandSTRDUP(dest, src) \
+ do{ \
+ free(dest); dest=NULL;\
+ if (src) dest = strdup(src); \
+ }while(false)
+
+#endif //__PHONE_APP_H__
diff --git a/lib/common/ph-common.c b/lib/common/ph-common.c
new file mode 100755
index 0000000..92d88f0
--- /dev/null
+++ b/lib/common/ph-common.c
@@ -0,0 +1,1930 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <app.h>
+#include <fcntl.h>
+#include <ui-gadget-module.h>
+#include <account-types.h>
+#include <syspopup_caller.h>
+#include <account.h>
+#include <notification.h>
+
+#include "phone.h"
+#include "phone-common.h"
+
+
+#define CT_CBAR_ITEM_MAX 4
+
+#ifdef PH_TIMECHECK
+double ph_set_start_time(void)
+{
+ struct timeval tv;
+ double curtime;
+
+ gettimeofday(&tv, NULL);
+ curtime = tv.tv_sec * 1000 + (double)tv.tv_usec/1000;
+ return curtime;
+}
+
+double ph_exec_time(double start)
+{
+ double end = ph_set_start_time();
+ return (end - start - ph_correction);
+}
+
+int ph_init_time(void)
+{
+ double temp_t;
+ temp_t = ph_set_start_time();
+ ph_correction = ph_exec_time(temp_t);
+
+ return 0;
+}
+#endif
+
+static void progress_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ bool *is_alive = data;
+ *is_alive = false;
+}
+
+void phone_free_contacts(Eina_List *list)
+{
+ Eina_List *l;
+ ph_contact_d *cd;
+
+ p_retm_if(NULL == list, "list is NULL");
+
+ EINA_LIST_FOREACH(list, l, cd) {
+ if (NULL == cd)
+ continue;
+
+ free(cd->display);
+ free(cd->img_path);
+ free(cd->number);
+ free(cd);
+ }
+ eina_list_free(list);
+}
+
+void ctui_list_edit_navi_pop(void *data, Evas_Object *obj, void *event_info)
+{
+ int cnt_checked;
+ int person_count = 0;
+ int number_count = 0;
+ int email_count = 0;
+ int *result_list_number = NULL;
+ int *result_list_email = NULL;
+ int *result_list_person = NULL;
+ Eina_List *l;
+ ct_person_list *person_info;
+ ct_list_data *clist_d = data;
+
+ cnt_checked = ctui_list_checked_cnt_get(clist_d->list);
+
+ PH_DBG("clist_d->ug_request %d count %d", clist_d->ug_request, cnt_checked);
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request)
+ result_list_number = calloc(cnt_checked, sizeof(int));
+ else if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request)
+ result_list_email = calloc(cnt_checked, sizeof(int));
+ else if (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request) {
+ result_list_number = calloc(cnt_checked, sizeof(int));
+ result_list_email = calloc(cnt_checked, sizeof(int));
+ }
+ else
+ result_list_person = calloc(cnt_checked, sizeof(int));
+
+
+ EINA_LIST_FOREACH(clist_d->list, l, person_info) {
+ if (NULL == person_info || !person_info->checked) continue;
+ if (1 == person_info->id_ret_type)
+ result_list_number[number_count++] = person_info->id_ret;
+ else if (2 == person_info->id_ret_type)
+ result_list_email[email_count++] = person_info->id_ret;
+ else
+ result_list_person[person_count++] = person_info->id;
+ }
+
+ // setting - import,export / group-view - message,email,chaton,calendar
+ if (clist_d->select_result_cb) { // called by setting view - check person_info
+ if (0 < cnt_checked) {
+ if (result_list_number)
+ clist_d->select_result_cb(clist_d->select_result_cb_data, result_list_number, number_count);
+ else if (result_list_email)
+ clist_d->select_result_cb(clist_d->select_result_cb_data, result_list_email, email_count);
+ else
+ clist_d->select_result_cb(clist_d->select_result_cb_data, result_list_person, person_count);
+ }
+ }
+ if(result_list_person)
+ free(result_list_person);
+ if(result_list_number)
+ free(result_list_number);
+ if(result_list_email)
+ free(result_list_email);
+}
+
+void phone_view_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ /* TODO : remove evas_object_smart_callback_del, it will be controlled by WINSET */
+ evas_object_smart_callback_del(obj, "clicked", phone_view_back_btn_cb);
+ phone_hide_notify(data);
+ evas_object_smart_callback_del(data, "transition,finished", ctui_list_edit_navi_pop);
+ elm_naviframe_item_pop(data);
+}
+
+void ug_common_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+{
+ Evas_Object *base;
+
+ if (!ug)
+ return;
+
+ base = ug_get_layout(ug);
+ if (!base) {
+ ERR("ug_get_layout() return NULL");
+ ug_destroy(ug);
+ return;
+ }
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(base);
+}
+
+void ug_common_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ struct ug_priv_data *priv_data;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+ ug_destroy(ug);
+
+ p_retm_if(NULL == priv, "priv is NULL");
+
+ priv_data = (struct ug_priv_data *)priv;
+
+ if (priv_data->destroy_cb)
+ priv_data->destroy_cb(priv_data->cb_param);
+
+ free(priv);
+
+ PH_FN_END;
+}
+
+void * phone_image_crop_ug(ui_gadget_h parent, const char *photo,
+ struct ug_cbs *cbs)
+{
+ ui_gadget_h ug;
+
+ service_h service;
+
+ service_create(&service);
+ service_add_extra_data(service, "Path", photo);
+ service_add_extra_data(service, "View Mode", "SETAS");
+ service_add_extra_data(service, "Setas type", "CallerID");
+ service_add_extra_data(service, "Area Size", "100");
+
+ cbs->layout_cb = ug_common_layout_cb;
+
+ ug = ug_create(parent, IMG_VIEWER_UG, UG_MODE_FULLVIEW, service, cbs);
+ p_warn_if(NULL == ug, "ug_create() Failed");
+
+ service_destroy(service);
+
+ return ug;
+}
+
+void* phone_launch_msg_composer_ug(void *parent_ug, char *number, int msg_id,
+ void(*destroy_cb)(void*), void *cb_param)
+{
+ PH_FN_CALL;
+ ui_gadget_h ug;
+ struct ug_cbs cbs = {0};
+ struct ug_priv_data *priv_data;
+ service_h service;
+ char ret[PH_TEXT_MAX_LEN] = {0};
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retvm_if(NULL == priv_data, NULL, "calloc is failed");
+ priv_data->destroy_cb = destroy_cb;
+ priv_data->cb_param = cb_param;
+
+ service_create(&service);
+ if (number && *number)
+ service_add_extra_data(service, "TO", (char*)number);
+ else if (msg_id) {
+ service_add_extra_data(service, "type", "msg_id");
+ snprintf(ret, sizeof(ret), "%d", msg_id);
+ service_add_extra_data(service, "msgId", ret);
+ }
+
+ cbs.priv = priv_data;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_common_destroy_cb;
+
+ ug = ug_create(parent_ug, MSG_COMPOSER_UG, UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
+
+ if (ug == NULL) {
+ free(priv_data);
+ ERR("%s ug_create is failed", MSG_COMPOSER_UG);
+ }
+ return ug;
+}
+
+void* phone_launch_contact_detail_ug(void *parent_ug, int contact_index,
+ void(*destroy_cb)(void*), void *cb_param)
+{
+ PH_FN_CALL;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ struct ug_cbs cbs = {0};
+ service_h service;
+ ui_gadget_h ug;
+ struct ug_priv_data *priv_data;
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retvm_if(NULL == priv_data, NULL, "calloc is failed");
+ priv_data->destroy_cb = destroy_cb;
+ priv_data->cb_param = cb_param;
+
+ service_create(&service);
+
+ snprintf(buf, sizeof(buf), "%d", contact_index);
+ service_add_extra_data(service, CT_UG_BUNDLE_ID, buf);
+ snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_DETAIL);
+ service_add_extra_data(service, CT_UG_BUNDLE_TYPE, buf);
+
+ cbs.priv = priv_data;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_common_destroy_cb;
+
+ ug = ug_create(parent_ug, UG_CONTACTS_DETAILS, UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
+
+ if (NULL == ug) {
+ free(priv_data);
+ ERR("%s ug_create fail", UG_CONTACTS_DETAILS);
+ }
+ return ug;
+}
+
+void* phone_launch_contact_add_list_edit_ug(void *parent_ug, char *data,
+ void (*destroy_cb)(void *), void *cb_param)
+{
+ PH_FN_END;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ struct ug_cbs cbs = {0};
+ struct ug_priv_data *priv_data;
+ ui_gadget_h ug;
+ service_h service;
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retvm_if(NULL == priv_data, NULL, "calloc is failed");
+ priv_data->destroy_cb = destroy_cb;
+ priv_data->cb_param = cb_param;
+
+ service_create(&service);
+
+ snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_UPDATE_WITH_NUM);
+ service_add_extra_data(service, CT_UG_BUNDLE_TYPE, buf);
+ snprintf(buf, sizeof(buf), "%s", data);
+ service_add_extra_data(service, CT_UG_BUNDLE_NUM, buf);
+ PH_DBG("number %s", buf);
+
+ cbs.priv = priv_data;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_common_destroy_cb;
+
+ ug = ug_create(parent_ug, UG_CONTACTS_LIST, UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
+ if (NULL == ug) {
+ free(priv_data);
+ ERR("%s ug_create fail", UG_CONTACTS_LIST);
+ }
+ return ug;
+}
+
+static void ug_contact_list_result_cb(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ char *temp_p = NULL;
+ struct ug_priv_data *priv_data = priv;
+ int id;
+ p_retm_if(NULL == priv, "private data is NULL");
+
+ service_get_extra_data(service, "id", &temp_p);
+ id = atoi(temp_p);
+ free(temp_p);
+ if (priv_data->result_cb)
+ priv_data->result_cb(priv_data->cb_param, (void*)&id);
+ PH_FN_END;
+}
+
+void* phone_launch_contact_list_ug(void *parent_ug, int request,
+ void(*result_cb)(void*, void*), void(*destroy_cb)(void*), void*cb_param)
+{
+ PH_FN_CALL;
+ char ug_request[PH_TEXT_MAX_LEN] = {0};
+ struct ug_priv_data *priv_data;
+ ui_gadget_h ug;
+ struct ug_cbs cbs = {0};
+ service_h service;
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retvm_if(NULL == priv_data, NULL, "calloc is failed");
+ priv_data->destroy_cb = destroy_cb;
+ priv_data->result_cb = result_cb;
+ priv_data->cb_param = cb_param;
+
+ service_create(&service);
+
+ snprintf(ug_request, sizeof(ug_request), "%d", request);
+ service_add_extra_data(service, CT_UG_BUNDLE_TYPE, ug_request);
+
+ cbs.priv = priv_data;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.destroy_cb = ug_common_destroy_cb;
+ cbs.result_cb = ug_contact_list_result_cb;
+
+ ug = ug_create(parent_ug, UG_CONTACTS_LIST, UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
+ if (NULL == ug) {
+ free(priv_data);
+ ERR("%s ug_create fail", UG_CONTACTS_LIST);
+ }
+ return ug;
+}
+
+Evas_Object* phone_create_list_sweep_btn(Evas_Object *parent, char *fullpath)
+{
+ Evas_Object *btn;
+ Evas_Object *icon;
+
+ btn = elm_button_add(parent);
+ p_retvm_if(NULL == btn, NULL, "elm_button_add() return NULL");
+
+ icon = elm_icon_add(btn);
+ p_retvm_if(NULL == icon, NULL, "phone_create_icon_with_img() return NULL");
+
+ elm_icon_file_set(icon, fullpath, NULL);
+ elm_icon_resizable_set(icon, EINA_FALSE, EINA_FALSE);
+ elm_object_part_content_set(btn, "icon", icon);
+
+ return btn;
+}
+
+void phone_resize_notify(Evas_Object *parent, int rotate)
+{
+ Evas_Object *notify;
+ Evas_Object *layout;
+ const char *msg;
+ p_retm_if(NULL == parent, "parent is NULL");
+ notify = phone_get_notify(parent);
+ layout = elm_object_content_get(notify);
+ msg = edje_object_part_text_get(_EDJ(layout), "elm.text");
+
+ elm_layout_theme_set(layout, "standard", "selectioninfo", "center_text");
+
+ if (msg && *msg)
+ edje_object_part_text_set(_EDJ(layout), "elm.text", msg);
+}
+
+Evas_Object * phone_get_notify(Evas_Object *parent)
+{
+ Evas_Object *notify;
+
+ notify = evas_object_data_get(parent, "notify");
+ if (NULL == notify) {
+ Evas_Object *info_layout;
+ notify = phone_create_base_layout(parent, false);
+ elm_object_part_content_set(parent, "selectioninfo", notify);
+ info_layout = elm_layout_add(parent);
+ elm_object_part_content_set(notify, "elm.swallow.content", info_layout);
+ elm_layout_theme_set(info_layout, "standard", "selectioninfo", "center_text");
+ evas_object_data_set(parent, "notify", notify);
+ }
+ evas_object_show(notify);
+ return notify;
+}
+
+void phone_show_tickernoti(const char *msg)
+{
+ int err = notification_status_message_post(msg);
+ p_retm_if(NOTIFICATION_ERROR_NONE != err, "notification_status_message_post is failed");
+}
+
+void phone_show_notify(Evas_Object *parent, const char *msg)
+{
+ Evas_Object *selectioninfo;
+ Evas_Object *notify;
+
+ notify = phone_get_notify(parent);
+ selectioninfo = elm_object_part_content_get(notify, "elm.swallow.content");
+ elm_object_part_text_set(selectioninfo, "elm.text", msg);
+ elm_object_signal_emit(parent, "show,selection,info", "elm");
+ evas_object_show(selectioninfo);
+}
+
+void phone_hide_notify(Evas_Object *parent)
+{
+ Evas_Object *selectioninfo;
+ Evas_Object *notify;
+
+ notify = evas_object_data_get(parent, "notify");
+ selectioninfo = elm_object_part_content_get(notify, "elm.swallow.content");
+ elm_object_signal_emit(parent, "hide,selection,info", "elm");
+ evas_object_hide(notify);
+ evas_object_hide(selectioninfo);
+}
+
+static void popup_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object **popup = data;
+ evas_object_del(*popup);
+ *popup = NULL;
+}
+
+void ctui_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_del(data);
+}
+
+Evas_Object *phone_show_popup(Evas_Object *parent, const char *desc, double timeout)
+{
+ Evas_Object *popup;
+
+ popup = evas_object_data_get(parent, "popup");
+ if (NULL == popup) {
+ popup = elm_popup_add(parent);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(popup, "block,clicked", ctui_popup_hide_cb, NULL);
+ evas_object_show(popup);
+ }
+ elm_object_text_set(popup, desc);
+ elm_popup_timeout_set(popup, timeout);
+ return popup;
+}
+
+Evas_Object* phone_create_confirm_popup(Evas_Object **popup, Evas_Object *win, const char* description,
+ void (*btn_clicked_cb)(void *, Evas_Object *, void *), void *cb_data)
+{
+ Evas_Object *btn1, *btn2;
+ *popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(*popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(*popup, description);
+
+ btn1 = elm_button_add(*popup);
+ elm_object_text_set(btn1, S_(PH_SYS_SK_YES));
+ elm_object_part_content_set(*popup, "button1", btn1);
+ elm_object_style_set(btn1, "popup_button/default");
+ evas_object_smart_callback_add(btn1, "clicked", btn_clicked_cb, cb_data);
+
+ btn2 = elm_button_add(*popup);
+ elm_object_text_set(btn2, S_(PH_SYS_SK_NO));
+ elm_object_part_content_set(*popup, "button2", btn2);
+ elm_object_style_set(btn2, "popup_button/default");
+ evas_object_smart_callback_add(btn2, "clicked", popup_cancel_btn_cb, &(*popup));
+
+ evas_object_show(*popup);
+
+ return btn1;
+}
+
+void phone_launch_voice_call(const int person_id, const char* number)
+{
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ service_h service;
+ int ret;
+
+ ret = service_create(&service);
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_create() Failed(%d)", ret);
+
+ service_set_operation(service, SERVICE_OPERATION_CALL);
+ snprintf(buf, sizeof(buf), "tel:%s", number);
+ service_set_uri(service, buf);
+
+ if (0 < person_id) {
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ snprintf(buf, sizeof(buf), "%d", person_id);
+ service_add_extra_data(service, "ctindex", buf);
+
+ }
+ service_send_launch_request(service, NULL, NULL);
+ service_destroy(service);
+}
+
+Evas_Object* phone_create_base_layout(Evas_Object *parent, bool is_fullview)
+{
+ Evas_Object *base;
+
+ base = elm_layout_add(parent);
+ p_retvm_if(NULL == base, NULL, "elm_layout_add() Failed");
+ if (is_fullview)
+ elm_layout_theme_set(base, "layout", "application", "default");
+ else
+ elm_layout_theme_set(base, "layout", "application", "noindicator");
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ return base;
+}
+
+void phone_ug_destroy_me_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ if(data)
+ ug_destroy_me(data);
+ PH_FN_END;
+}
+
+void phone_back_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win = data;
+ elm_win_lower(win);
+}
+
+Evas_Object* phone_create_bg(Evas_Object *parent)
+{
+ Evas_Object *bg;
+
+ bg = elm_bg_add(parent);
+ p_retvm_if(NULL == bg, NULL, "elm_bg_add() return NULL");
+
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(parent, "elm.swallow.bg", bg);
+
+ return bg;
+}
+
+Evas_Object* phone_progressbar_popup(Evas_Object *parent, ph_progress_info *p_info, const char *title)
+{
+ char buf[PH_TEXT_MAX_LEN];
+ Evas_Object *popup;
+ Evas_Object *layout;
+ Evas_Object *label;
+ Evas_Object *progressbar;
+ Evas_Object *btn;
+
+ popup = elm_popup_add(parent);
+ p_retvm_if(NULL == popup, NULL, "elm_popup_add() return NULL");
+
+ layout = elm_layout_add(popup);
+ p_retvm_if(NULL == layout, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(layout, PROGRESS_EDJ, "popup_center_text_progressview");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ p_info->layout = layout;
+
+ label = elm_label_add(popup);
+ p_retvm_if(NULL == label, NULL, "elm_label_add() return NULL");
+ elm_object_style_set(label, "popup/progressview");
+ elm_label_line_wrap_set(label, ELM_WRAP_WORD);
+ elm_object_text_set(label, title);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(label);
+
+ progressbar = elm_progressbar_add(popup);
+ p_retvm_if(NULL == progressbar, NULL, "elm_progressbar_add() return NULL");
+ p_info->progressbar= progressbar;
+
+ if (0 < p_info->cnt_checked_total) {
+ elm_object_style_set(progressbar, "list_progress");
+ elm_progressbar_value_set(progressbar, 0.0);
+ }
+ else {
+ elm_object_style_set(progressbar, "pending_list");
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+ }
+
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(progressbar);
+
+ elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
+ elm_object_part_content_set(layout, "elm.swallow.content", label);
+ elm_object_part_content_set(layout, "elm.swallow.end", progressbar);
+ evas_object_show(layout);
+ elm_object_content_set(popup, layout);
+
+ if(false == p_info->without_cancel_btn)
+ {
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button1", btn);
+ elm_object_style_set(btn, "popup_button/default");
+ evas_object_smart_callback_add(btn, "clicked", progress_popup_cancel_cb, &p_info->alive);
+ }
+ evas_object_show(popup);
+ return popup;
+}
+
+void phone_navi_item_clear(Elm_Object_Item *navi_item)
+{
+ int i = 0;
+ Evas_Object *toolbar_button = NULL;
+ const char* toolbar_button_name[] = {
+ "toolbar_button1",
+ "toolbar_button2",
+ "toolbar_more_btn",
+ "title_left_btn",
+ "title_right_btn",
+ "prev_btn",
+ };
+
+ for (i=0;i<sizeof(toolbar_button_name)/sizeof(char*);i++) {
+ toolbar_button = elm_object_item_part_content_unset(navi_item, toolbar_button_name[i]);
+ if (toolbar_button)
+ evas_object_del(toolbar_button);
+ }
+}
+
+Evas_Object *phone_create_icon_with_img(Evas_Object *parent, char *full_path)
+{
+ Evas_Object *ic = elm_icon_add(parent);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(ic, full_path, NULL);
+ elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+ evas_object_image_smooth_scale_set(ic, EINA_FALSE);
+ return ic;
+}
+
+
+contacts_error_e phone_cts_get_list(const char *view_uri, int property_id, int match_value, contacts_list_h *out_list)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+
+ p_retvm_if(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(out_list) is NULL");
+
+ unsigned int person_grouprel_projection[] = {
+ _contacts_person_grouprel.person_id,
+ _contacts_person_grouprel.status,
+ _contacts_person_grouprel.display_name,
+ _contacts_person_grouprel.display_name_index,
+ _contacts_person_grouprel.addressbook_ids,
+ _contacts_person_grouprel.image_thumbnail_path,
+ _contacts_person_grouprel.link_count,
+ };
+
+ err = contacts_filter_create(view_uri, &filter);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, err, "contactcs_filter_create() Failed(%d)", err);
+
+ do {
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_int(filter, property_id, CONTACTS_MATCH_EQUAL, match_value))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_create(view_uri, &query))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+
+ if (0 == strcmp(view_uri, _contacts_person_grouprel._uri)) {
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_distinct(query, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_projection(query, person_grouprel_projection, sizeof(person_grouprel_projection)/sizeof(int)))) break;
+ }
+
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, out_list))) break;
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ return CONTACTS_ERROR_NONE;
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ return err;
+}
+
+void phone_cts_free_list(contacts_list_h list)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+}
+
+contacts_error_e phone_cts_get_int_from_list(contacts_list_h list, int property_id, int *out_int)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retvm_if(NULL == out_int, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(out_int) is NULL");
+ p_retvm_if(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(list) is NULL");
+
+ err = contacts_list_get_current_record_p(list, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ return err;
+ }
+
+ err = contacts_record_get_int(record, property_id, out_int);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ return err;
+ }
+
+ return CONTACTS_ERROR_NONE;
+}
+
+contacts_error_e phone_cts_get_str_from_list(contacts_list_h list, int property_id, char **out_str)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retvm_if(NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(out_int) is NULL");
+ p_retvm_if(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(list) is NULL");
+
+ err = contacts_list_get_current_record_p(list, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ return err;
+ }
+
+ err = contacts_record_get_str(record, property_id, out_str);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_str() Failed(%d)", err);
+ return err;
+ }
+
+ return CONTACTS_ERROR_NONE;
+}
+
+contacts_error_e phone_cts_get_bool_from_list(contacts_list_h list, int property_id, bool *out_bool)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retvm_if(NULL == out_bool, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(out_bool) is NULL");
+ p_retvm_if(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(list) is NULL");
+
+ err = contacts_list_get_current_record_p(list, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ return err;
+ }
+
+ err = contacts_record_get_bool(record, property_id, out_bool);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_bool() Failed(%d)", err);
+ return err;
+ }
+
+ return CONTACTS_ERROR_NONE;
+}
+
+
+char* ctui_get_addressbook_icon_path(int addressbook_id)
+{
+ int ret;
+ int account_id;
+ char *icon_path;
+ char *addressbook_name = NULL;
+ account_h account;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "phone_cts_get_list() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_address_book.account_id, &account_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ return NULL;
+ }
+ err = contacts_record_get_str_p(record, _contacts_address_book.name, &addressbook_name);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ if (0 == account_id){
+ return SAFE_STRDUP(CTUI_IMG_ACC_PHONE);
+ }
+
+
+ ret = account_connect();
+ p_retvm_if(ACCOUNT_ERROR_NONE != ret, NULL, "account_connect() Failed(%d)", ret);
+
+ account = NULL;
+ ret = account_create(&account);
+ p_retvm_if(ACCOUNT_ERROR_NONE != ret, false, "account_create() Failed(%d)", ret);
+
+ ret = account_query_account_by_account_id(account_id, &account);
+ if (ACCOUNT_ERROR_NONE != ret) {
+ ERR("account_query_account_by_account_id() Failed(%d)", ret);
+ account_destroy(account);
+ account_disconnect();
+ return NULL;
+ }
+ p_retvm_if(ACCOUNT_ERROR_NONE != ret, NULL, "account_query_account_by_account_id() Failed(%d)", ret);
+
+ ret = account_get_icon_path(account, &icon_path);
+ if (ACCOUNT_ERROR_NONE != ret) {
+ ERR("account_get_icon_path() Failed(%d)", ret);
+ account_destroy(account);
+ account_disconnect();
+ return NULL;
+ }
+ account_destroy(account);
+ account_disconnect();
+
+ return icon_path;
+}
+
+Evas_Object* phone_create_navi_btn(Evas_Object *parent, const char *style)
+{
+ Evas_Object *btn;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, style);
+ evas_object_show(btn);
+
+ return btn;
+}
+
+void phone_set_view_info(ph_view_info *view_info, Evas_Object *win, Evas_Object *navi,
+ void *ug, int ug_request, int cnt_max, char *ug_data)
+{
+ view_info->win = win;
+ view_info->navi = navi;
+ view_info->ug = ug;
+ view_info->ug_request = ug_request;
+ view_info->ug_cnt_max = cnt_max;
+ view_info->ug_data = ug_data;
+}
+
+void phone_list_ug_return_ids(ui_gadget_h ug, int *result_list, int cnt, const char *bd_key)
+{
+ gchar *encoded_str;
+ service_h service;
+
+ service_create(&service);
+
+ if (result_list) {
+ encoded_str = g_base64_encode((guchar *)result_list, cnt*sizeof(int));
+ service_add_extra_data(service, bd_key, encoded_str);
+ g_free(encoded_str);
+ }
+
+ ug_send_result(ug, service);
+
+ service_destroy(service);
+}
+
+void phone_list_ug_return_number_email_ids(ui_gadget_h ug, int *result_number_list, int number_list_count, int *result_email_list, int email_list_count)
+{
+ gchar *encoded_str;
+ service_h service;
+ service_create(&service);
+
+ if (result_number_list && number_list_count) {
+ encoded_str = g_base64_encode((guchar *)result_number_list, number_list_count*sizeof(int));
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST, encoded_str);
+ g_free(encoded_str);
+ }
+
+ if (result_email_list && email_list_count) {
+ encoded_str = g_base64_encode((guchar *)result_email_list, email_list_count*sizeof(int));
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST, encoded_str);
+ g_free(encoded_str);
+ }
+
+ ug_send_result(ug, service);
+ service_destroy(service);
+}
+
+
+#define CT_UG_BUNDLE_RESULT_ID "id"
+#define CT_UG_BUNDLE_RESULT_VCARD "vcard"
+
+void phone_ug_return_id(ui_gadget_h ug, int ct_id, int num_id, int email_id)
+{
+ service_h service;
+ char buf[16];
+
+ service_create(&service);
+
+ if (ct_id) {
+ snprintf(buf, sizeof(buf), "%d", ct_id);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_ID, buf);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_PERSON_ID, buf);
+ }
+
+ if (num_id) {
+ snprintf(buf, sizeof(buf), "%d", num_id);
+ service_remove_extra_data(service, CT_UG_BUNDLE_RESULT_ID);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_ID, buf);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_NUMBER_ID, buf);
+ }
+
+ if (email_id) {
+ snprintf(buf, sizeof(buf), "%d", email_id);
+ service_remove_extra_data(service, CT_UG_BUNDLE_RESULT_ID);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_ID, buf);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_EMAIL_ID, buf);
+ }
+
+ PH_DBG("ct_id =%d, num_id=%d,email_id=%d",ct_id,num_id,email_id);
+ ug_send_result(ug, service);
+
+ service_destroy(service);
+}
+
+void phone_ug_return_vcard(ui_gadget_h ug, int ct_id, char *vcard)
+{
+ service_h service;
+ char buf[16];
+
+ service_create(&service);
+
+ if (ct_id) {
+ snprintf(buf, sizeof(buf), "%d", ct_id);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_ID, buf);
+ }
+
+ if (vcard) {
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_VCARD, vcard);
+ }
+
+ ug_send_result(ug, service);
+
+ service_destroy(service);
+}
+
+static void editfield_exceed_string_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ phone_show_tickernoti(T_(CT_GET_TEXT_ERR, CTTEXT_EXCEED_LIMIT));
+}
+
+static void editfield_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+
+ if (elm_object_focus_get(data)) {
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ }
+}
+static void editfield_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+}
+
+static void editfield_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+}
+
+static void editfield_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ elm_entry_entry_set(data, "");
+}
+
+Evas_Object* ctui_create_editfield(Evas_Object *parent, const char *title, const char *guide, bool multiline)
+{
+ Evas_Object *layout, *entry;
+
+ layout = elm_layout_add(parent);
+ if (title && *title) {
+ elm_layout_theme_set(layout, "layout", "editfield", "title");
+ elm_object_part_text_set(layout, "elm.text", title);
+ }
+ else
+ elm_layout_theme_set(layout, "layout", "editfield", "default");
+
+ if (guide && *guide)
+ elm_object_part_text_set(layout, "elm.guidetext", guide);
+
+ entry = elm_entry_add(parent);
+ if (!multiline) {
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ }
+ ctui_entry_limit_size_set(entry);
+ elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+ evas_object_smart_callback_add(entry, "changed", editfield_changed_cb, layout);
+ evas_object_smart_callback_add(entry, "preedit,changed", editfield_changed_cb, layout);
+ evas_object_smart_callback_add(entry, "focused", editfield_focused_cb, layout);
+ evas_object_smart_callback_add(entry, "unfocused", editfield_unfocused_cb, layout);
+ evas_object_smart_callback_add(entry, "maxlength,reached", editfield_exceed_string_cb, layout);
+ elm_object_part_content_set(layout, "elm.swallow.content", entry);
+ elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", editfield_eraser_clicked_cb, entry);
+ return layout;
+}
+
+// This function is used in Contact view, Group view
+void* ctui_account_ug(void *data, Evas_Object *obj, void *event_info,
+ void(*destroy_cb)(void*), void *cb_param)
+{
+ struct ug_cbs cbs = {0};
+ ui_gadget_h ug;
+ service_h service;
+ struct ug_priv_data *priv_data;
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retvm_if(NULL == priv_data, NULL, "calloc is failed");
+ priv_data->destroy_cb = destroy_cb;
+ priv_data->cb_param = cb_param;
+
+ service_create(&service);
+ service_add_extra_data(service, "mode", "account_list");
+ service_add_extra_data(service, "capability_filter", ACCOUNT_SUPPORTS_CAPABILITY_CONTACT);
+
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = ug_common_destroy_cb;
+ cbs.priv = priv_data;
+
+ ug = ug_create(data, ACCOUNT_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == ug, "ug_create() Failed");
+
+ service_destroy(service);
+ return ug;
+}
+
+Evas_Object* phone_create_nocontents(Evas_Object *parent, const char* label)
+{
+ Evas_Object *layout;
+
+ layout = elm_layout_add(parent);
+ p_retvm_if(NULL == layout, NULL, "elm_layout_add() return NULL");
+
+ elm_layout_theme_set(layout, "layout", "nocontents", "full");
+ elm_object_part_text_set(layout, "elm.text", label);
+
+ return layout;
+}
+
+void ctui_genlist_append_separator_20px_with_line(Evas_Object *genlist)
+{
+ static Elm_Genlist_Item_Class itc = { .item_style="dialogue/separator/21/with_line"};
+
+ Elm_Object_Item *item;
+ item = elm_genlist_item_append(genlist, &itc, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+}
+
+void phone_toolbar_disabled_item_append(Evas_Object *toolbar, int cnt)
+{
+ int i;
+ Elm_Object_Item *item;
+ for (i=0;i<cnt;i++) {
+ item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+ elm_object_item_disabled_set(item, EINA_TRUE);
+ }
+}
+
+void ctui_navi_left_btn_disabled_set(Elm_Object_Item *item, Eina_Bool disabled)
+{
+ Evas_Object *btn;
+ btn = elm_object_item_part_content_get(item, "title_left_btn");
+ p_retm_if(NULL == btn, "elm_object_item_part_content_get() return NULL");
+ elm_object_focus_set(btn, EINA_FALSE);
+ elm_object_disabled_set(btn, disabled);
+}
+
+int ctui_get_mfc_option(void)
+{
+ int fd;
+ int size;
+ char buf[PH_TEXT_SHORT_LEN];
+
+ fd = open(SETTING_MFC_PATH, O_RDONLY);
+ if(fd < 0){
+ ERR("Open(%s) O_RDONLY Failed", SETTING_MFC_PATH);
+ fd = open(SETTING_MFC_PATH, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ p_retvm_if(fd < 0, 0, "Open(%s) Failed", SETTING_MFC_PATH);
+ if (-1 == write(fd, "0", 1))
+ ERR("write()... Failed(%s)", strerror(errno));
+ }
+ size = read(fd, buf, sizeof(buf));
+ close(fd);
+ if (0 < size)
+ return atoi(buf);
+ else
+ return 0;
+}
+
+static void genlist_selectall_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ int x, y, w, h;
+ Eina_Bool is_checked;
+ Evas_Object *check;
+ Evas_Event_Mouse_Up *ev = event_info;
+ void *cb_data;
+ selectall_changed_cb changed_cb = data;
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y)
+ return;
+
+ p_retm_if(NULL == changed_cb, "changed_cb is NULL");
+
+ check = elm_object_part_content_get(obj, "elm.icon");
+ p_retm_if(NULL == check, "elm_object_part_content_get() return NULL");
+
+ cb_data = evas_object_data_get(check, "cb_data");
+ p_retm_if(NULL == cb_data, "cb_data is NULL");
+
+ is_checked = !elm_check_state_get(check);
+ elm_check_state_set(check, is_checked);
+
+ changed_cb(cb_data, is_checked);
+}
+
+static void genlist_selectall_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Eina_Bool is_checked;
+ void *cb_data;
+ selectall_changed_cb changed_cb = data;
+ p_retm_if(NULL == changed_cb, "changed_cb is NULL");
+
+ cb_data = evas_object_data_get(obj, "cb_data");
+ p_retm_if(NULL == cb_data, "cb_data is NULL");
+
+ is_checked = elm_check_state_get(obj);
+ changed_cb(cb_data, is_checked);
+}
+
+Evas_Object* phone_create_select_all(Evas_Object *parent, const char *selectall_text,
+ selectall_changed_cb changed_cb, void *cb_data)
+{
+ Evas_Object *layout;
+ Evas_Object *check;
+
+ p_retvm_if(NULL == parent, NULL, "parameter(parent) is NULL");
+
+ layout = elm_layout_add(parent);
+ p_retvm_if(NULL == layout, NULL, "elm_layout_add() return NULL");
+ elm_layout_theme_set(layout, "genlist", "item", "select_all/default");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_UP, genlist_selectall_mouseup_cb, changed_cb);
+
+ check = elm_check_add(layout);
+ p_retvm_if(NULL == check, NULL, "elm_check_add() return NULL");
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ elm_object_part_content_set(layout, "elm.icon", check);
+ evas_object_smart_callback_add(check, "changed", genlist_selectall_changed_cb, changed_cb);
+ evas_object_data_set(check, "cb_data", cb_data);
+
+ elm_object_part_text_set(layout, "elm.text", selectall_text);
+ evas_object_show(layout);
+
+ return layout;
+}
+
+void phone_move_ctxpopup(Evas_Object *popup, Evas_Object *item)
+{
+ int x,y,w,h;
+ int pos_x;
+ int pos_y;
+ p_retm_if(NULL == popup, "parameter(popup) is NULL");
+ p_retm_if(NULL == item, "parameter(item) is NULL");
+
+ evas_object_geometry_get(item, &x, &y, &w, &h);
+
+ pos_x = x + (Evas_Coord)w/2;
+ pos_y = y + (Evas_Coord)h/2;
+
+ evas_object_move(popup, pos_x, pos_y);
+}
+
+void ctui_get_addressbook_name(int addressbook_id, char *dest, int dest_len)
+{
+ char *display_name = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retm_if(NULL == dest, "parameter(dest) is NULL");
+ dest[0] = '\0';
+
+ if (addressbook_id <= 0) {
+ snprintf(dest, dest_len, "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ return;
+ }
+
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address_book.name, &display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (display_name && *display_name)
+ snprintf(dest, dest_len, "%s", display_name);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+}
+
+void ctui_get_account_name_by_address_book_id(int address_book_id, char *dest, int dest_len)
+{
+ PH_FN_CALL;
+ int ret;
+ int account_id;
+ char *domain_name;
+ account_h account;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_record(_contacts_address_book._uri, address_book_id, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_address_book.account_id, &account_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ return;
+ }
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (0 == account_id)
+ return;
+
+ ret = account_connect();
+ p_retm_if(ACCOUNT_ERROR_NONE != ret, "account_connect() Failed(%d)", ret);
+
+ account = NULL;
+ ret = account_create(&account);
+ if (ACCOUNT_ERROR_NONE != ret) {
+ ERR("account_create() Failed(%d)", ret);
+ account_disconnect();
+ return;
+ }
+
+ ret = account_query_account_by_account_id(account_id, &account);
+ if (ACCOUNT_ERROR_NONE != ret) {
+ ERR("account_query_account_by_account_id() Failed(%d)", ret);
+ account_destroy(account);
+ account_disconnect();
+ return;
+ }
+
+ ret = account_get_domain_name(account, &domain_name);
+ if (ACCOUNT_ERROR_NONE != ret) {
+ ERR("account_get_display_name() Failed(%d)", ret);
+ account_destroy(account);
+ account_disconnect();
+ return;
+ }
+ PH_DBG("domain_name = %s", domain_name);
+
+ account_destroy(account);
+ account_disconnect();
+
+ if (domain_name && *domain_name)
+ snprintf(dest, dest_len, "%s", domain_name);
+
+ free(domain_name);
+}
+
+// TODO: Fixme
+Eina_List* ctui_person_get_writable_contact_list(int person_id)
+{
+ int addressbook_id;
+ int addressbook_mode;
+ Eina_List *list_contact_record = NULL;
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list_contact = NULL;
+ contacts_record_h record_addressbook = NULL;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_contact_clone = NULL;
+
+ p_retvm_if(person_id <= 0, NULL, "Invalid parameter(%d)", person_id);
+
+ err = phone_cts_get_list(_contacts_contact._uri, _contacts_contact.person_id, person_id, &list_contact);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "phone_cts_get_list() Failed(%d)", err);
+
+ while (CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_int_from_list(list_contact, _contacts_contact.address_book_id, &addressbook_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record_addressbook);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_get_int(record_addressbook, _contacts_address_book.mode, &addressbook_mode);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ err = contacts_record_destroy(record_addressbook, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_destroy(record_addressbook, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ // TODO: Fixme
+ if (1 == addressbook_mode)
+ continue;
+
+ err = contacts_list_get_current_record_p(list_contact, &record_contact);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_clone(record_contact, &record_contact_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ break;
+ }
+
+ list_contact_record = eina_list_append(list_contact_record, record_contact_clone);
+
+ err = contacts_list_next(list_contact);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ phone_cts_free_list(list_contact);
+
+ return list_contact_record;
+}
+
+static bool __phone_list_is_email_exist(Eina_List *list, char *email_address)
+{
+ Eina_List *l;
+ char *email_address_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_str_p(record_temp, _contacts_email.email, &email_address_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == email_address_temp)
+ continue;
+
+ if (0 == strcmp(email_address_temp, email_address))
+ return true;
+ }
+ return false;
+}
+
+Eina_List* ctui_person_get_email_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ char *email_address;
+ Eina_List *l;
+ Eina_List *list_email_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_record_h record_email = NULL;
+ contacts_record_h record_clone = NULL;
+
+ EINA_LIST_FOREACH(contact_list, l, record) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record, _contacts_contact.email, index++, &record_email)) {
+ err = contacts_record_get_str_p(record_email, _contacts_email.email, &email_address);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ if( checkduplicate ){
+ if (__phone_list_is_email_exist(list_email_record, email_address)) {
+ ERR("__phone_list_is_email_exist() return true (email address = %s", email_address);
+ continue;
+ }
+ }
+ err = contacts_record_clone(record_email, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_email_record = eina_list_append(list_email_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_email_record;
+}
+
+static bool __phone_list_is_number_exist(Eina_List *list, char *number_str)
+{
+ Eina_List *l;
+ char *number_str_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_str_p(record_temp, _contacts_number.number, &number_str_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == number_str_temp)
+ continue;
+
+ if (0 == strcmp(number_str_temp, number_str))
+ return true;
+ }
+ return false;
+}
+
+Eina_List* ctui_person_get_number_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ char *number_str;
+ Eina_List *l;
+ Eina_List *list_number_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_record_h record_number = NULL;
+ contacts_record_h record_clone = NULL;
+
+ EINA_LIST_FOREACH(contact_list, l, record) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record, _contacts_contact.number, index++, &record_number)) {
+ err = contacts_record_get_str_p(record_number, _contacts_number.number, &number_str);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ if( checkduplicate ){
+ if (__phone_list_is_number_exist(list_number_record, number_str)) {
+ ERR("__phone_list_is_number_exist() return true (number = %s", number_str);
+ continue;
+ }
+ }
+ err = contacts_record_clone(record_number, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_number_record = eina_list_append(list_number_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_number_record;
+}
+
+Eina_List* ctui_person_get_contact_list(int person_id)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_contact_clone = NULL;
+ contacts_list_h list_contacts = NULL;
+ Eina_List *list_contact_records = NULL;
+
+ err = phone_cts_get_list(_contacts_contact._uri, _contacts_contact.person_id, person_id, &list_contacts);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "phone_cts_get_list() Failed(%d)", err);
+
+ while (err == CONTACTS_ERROR_NONE) {
+ err = contacts_list_get_current_record_p(list_contacts, &record_contact);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_clone(record_contact, &record_contact_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ break;
+ }
+
+ list_contact_records = eina_list_append(list_contact_records, record_contact_clone);
+
+ err = contacts_list_next(list_contacts);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ }
+ phone_cts_free_list(list_contacts);
+
+ return list_contact_records;
+}
+
+void ctui_free_record_list(Eina_List *contact_list)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ p_retm_if(NULL == contact_list, "contact_list is NULL");
+
+ EINA_LIST_FREE(contact_list, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_destroy() Failed(%d)", err);
+ continue;
+ }
+ }
+}
+
+// TODO: Fixme
+int ctui_get_email_type_index(int type)
+{
+ switch (type) {
+ case CONTACTS_EMAIL_TYPE_CUSTOM:
+ return 1;
+ case CONTACTS_EMAIL_TYPE_HOME:
+ return 2;
+ case CONTACTS_EMAIL_TYPE_WORK:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+int ctui_get_view_mode(void)
+{
+ PH_FN_CALL;
+ int fd;
+ int size;
+ char buf[PH_TEXT_SHORT_LEN];
+
+ fd = open(VIEW_MODE_PATH, O_RDONLY);
+ if(fd < 0) {
+ ctui_set_view_mode(-1);
+ PH_DBG("Open(%s) Failed so create new", VIEW_MODE_PATH);
+ return -1;
+ }
+ size = read(fd, buf, sizeof(buf));
+ close(fd);
+ if (0 < size)
+ return atoi(buf);
+ else
+ return -1;
+}
+
+void ctui_set_view_mode(int addressbook_id)
+{
+ PH_FN_CALL;
+ int fd;
+ char buf[PH_TEXT_SHORT_LEN] = {0};
+
+ fd = open(VIEW_MODE_PATH, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ p_retm_if(fd < 0, "Open(%s) Failed", VIEW_MODE_PATH);
+ snprintf(buf, sizeof(buf), "%d",addressbook_id);
+ if (-1 == write(fd, buf, strlen(buf)))
+ ERR("write()... Failed(%s)", strerror(errno));
+ close(fd);
+}
+
+contacts_error_e phone_cts_get_default_number(int person_id, contacts_record_h *record_clone)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_list_h list = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+
+ p_retvm_if(NULL == record_clone, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(record_clone) is NULL");
+
+ err = contacts_query_create(_contacts_person_number._uri, &query);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, err, "contacts_query_create() Failed(%d)", err);
+
+ err = contacts_filter_create(_contacts_person_number._uri, &filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_create() Failed(%d)", err);
+ contacts_query_destroy(query);
+ return err;
+ }
+
+ do {
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_int(filter, _contacts_person_number.person_id, CONTACTS_MATCH_EQUAL, person_id))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_bool(filter, _contacts_person_number.is_primary_default, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_list_get_current_record_p(list, &record))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_record_clone(record, record_clone))) break;
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ contacts_list_destroy(list, true);
+
+ return CONTACTS_ERROR_NONE;
+ } while (0);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ if (list)
+ contacts_list_destroy(list, true);
+
+ return err;
+}
+
+contacts_error_e phone_cts_get_default_email(int person_id, contacts_record_h *record_clone)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_list_h list = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+
+ p_retvm_if(NULL == record_clone, CONTACTS_ERROR_INVALID_PARAMETER, "parameter(record_clone) is NULL");
+
+ err = contacts_query_create(_contacts_person_email._uri, &query);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, err, "contacts_query_create() Failed(%d)", err);
+
+ err = contacts_filter_create(_contacts_person_email._uri, &filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_create() Failed(%d)", err);
+ contacts_query_destroy(query);
+ return err;
+ }
+
+ do {
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_int(filter, _contacts_person_email.person_id, CONTACTS_MATCH_EQUAL, person_id))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_bool(filter, _contacts_person_email.is_primary_default, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_list_get_current_record_p(list, &record))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_record_clone(record, record_clone))) break;
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ contacts_list_destroy(list, true);
+
+ return CONTACTS_ERROR_NONE;
+ } while (0);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+
+ if (list)
+ contacts_list_destroy(list, true);
+ return err;
+}
+
+bool ctui_list_make_vcard(int person_id, char *path, int path_length)
+{
+ int fd;
+ char *display = NULL;
+ char *vcard = NULL;
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_db_get_record(_contacts_person._uri, person_id, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_record_get_str_p(record, _contacts_person.display_name, &display);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (display && *display)
+ snprintf(path, path_length, "%s/%s.vcf", UGDATAIDR, display);
+ else
+ snprintf(path, path_length, "%s/%s.vcf", UGDATAIDR, T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+
+ err = contacts_vcard_make_from_person(record, &vcard);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_vcard_make_from_person() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+
+ if (-1 == write(fd, vcard, strlen(vcard))) {
+ ERR("write()... Failed(%s)", strerror(errno));
+ free(vcard);
+ return false;
+ }
+ free(vcard);
+ return true;
+}
+
+
+int ctui_get_addressbook_id_by_index(Eina_List *list, int index)
+{
+ p_retvm_if(NULL == list, -1, "list is NULL");
+ void *addressbook_id;
+
+ if(eina_list_count(list) <= index)
+ {
+ ERR("index is bigger than count");
+ return -1;
+ }
+
+ addressbook_id = eina_list_nth(list, index);
+
+ return (int)addressbook_id;
+}
+
+Eina_List* ctui_get_addressbook_id_list(const char *ori_string, const char *sep)
+{
+ Eina_List *e_list = NULL;
+ char *p = NULL;
+ char *copy_string;
+ char *save_p;
+
+ if (!ori_string) {
+ PH_DBG("Input string is NULL");
+ return NULL;
+ }
+
+ copy_string = SAFE_STRDUP(ori_string);
+
+ if (copy_string) {
+ p = strtok_r(copy_string, sep, &save_p);
+
+ while (p) {
+ int id = atoi(p);
+ if(eina_list_data_find(e_list, (void*)id) == NULL)
+ e_list = eina_list_append(e_list, (void*)id);
+
+ p = strtok_r(NULL, sep, &save_p);
+ }
+
+ free(copy_string);
+ }
+
+ return e_list;
+}
+
+
+Eina_List* __make_tokenize_list(const char *ori_string, const char *sep)
+{
+ Eina_List *e_list = NULL;
+ char *p = NULL;
+ char *copy_string;
+ char *save_p;
+
+ if (!ori_string) {
+ PH_DBG("Input string is NULL");
+ return NULL;
+ }
+
+ copy_string = SAFE_STRDUP(ori_string);
+
+ if (copy_string) {
+ p = strtok_r(copy_string, sep, &save_p);
+
+ if (p)
+ PH_DBG("list item = %s", p);
+
+ while (p) {
+ char *c = SAFE_STRDUP(p);
+
+ e_list = eina_list_append(e_list, c);
+
+ p = strtok_r(NULL, sep, &save_p);
+
+ if (p)
+ PH_DBG("list item = %s", p);
+ }
+
+ free(copy_string);
+ }
+
+ return e_list;
+}
+
+
+
+contacts_record_h ctui_get_record_image(contacts_record_h record_contact)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ p_retvm_if(NULL == record_contact, NULL, "parameter(record_contact) is NULL");
+
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.image, 0, &record);
+ if (NULL != record) return record;
+
+ err = contacts_record_create(_contacts_image._uri, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(record_contact, _contacts_contact.image, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+
+ return record;
+}
+
+
+Evas_Object *phone_create_toolbar_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data)
+{
+ Evas_Object *btn = elm_button_add(parent);
+ if (!btn) return NULL;
+ elm_object_style_set(btn, "naviframe/toolbar/default");
+ elm_object_text_set(btn, text);
+ evas_object_smart_callback_add(btn, "clicked", func, data);
+ return btn;
+}
+
+Evas_Object* ctui_create_more_btn(Evas_Object *parent, Evas_Smart_Cb func, void *data)
+{
+ Evas_Object *btn = elm_button_add(parent);
+ if (!btn) return NULL;
+ elm_object_style_set(btn, "naviframe/more/default");
+ evas_object_smart_callback_add(btn, "clicked", func, data);
+ return btn;
+}
+
+int ctui_get_addressbook_id(char* addressbook_name)
+{
+ PH_FN_CALL;
+ PH_DBG("addressbook_name = %s", addressbook_name);
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+ contacts_list_h list = NULL;
+ contacts_record_h record = NULL;
+ unsigned int count =0;
+ int addressbook_id =-1;//0 is phone addressbook id
+
+ err = contacts_filter_create(_contacts_address_book._uri, &filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contactcs_filter_create() Failed(%d)", err);
+
+
+ err = contacts_filter_add_str(filter,_contacts_address_book.name , CONTACTS_MATCH_FULLSTRING, addressbook_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_add_str() Failed(%d)", err);
+ err = contacts_query_create(_contacts_address_book._uri, &query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+ err = contacts_query_set_filter(query, filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_set_filter() Failed(%d)", err);
+ err = contacts_db_get_records_with_query(query, 0, 0, &list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_records_with_query() Failed(%d)", err);
+
+ if(list != NULL)
+ {
+ err = contacts_list_get_count(list,&count );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+ PH_DBG("count = %d",count);
+ if(count > 0){
+ err = contacts_list_get_current_record_p(list, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+ contacts_record_get_int(record,_contacts_address_book.id,&addressbook_id);
+ err = contacts_list_destroy(list,true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+ }
+ }
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+
+ PH_DBG("addressbook id = %d",addressbook_id);
+ return addressbook_id;
+
+}
+
+void ctui_create_contacts_error_popup(Evas_Object *parent, int err)
+{
+ p_retm_if(CONTACTS_ERROR_NONE == err, "ctui_create_contacts_error_popup no errer");
+ p_retm_if(NULL == parent, "ctui_create_contacts_error_popup parent is null");
+
+ ERR("ctui_create_contacts_error_popup() err(%d)", err);
+ switch (err) {
+ case CONTACTS_ERROR_DB:
+ phone_show_popup(parent, T_(CT_GET_TEXT_ERR, CTTEXT_ERR_DB_LOCKED), 1.5);
+ break;
+ case CONTACTS_ERROR_FILE_NO_SPACE:
+ phone_show_popup(parent, S_(CT_SYS_POP_NOT_ENOUGH_MEMORY), 1.5);
+ break;
+ default:
+ phone_show_popup(parent, S_(PH_SYS_POP_FAILED), 1.5);
+ break;
+ }
+
+ return;
+
+}
+
diff --git a/lib/common/ph-detail-log.c b/lib/common/ph-detail-log.c
new file mode 100755
index 0000000..fb81596
--- /dev/null
+++ b/lib/common/ph-detail-log.c
@@ -0,0 +1,495 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include "phone.h"
+#include <unicode/udat.h>
+#include <unicode/udatpg.h>
+#include <unicode/ucal.h>
+#include <unicode/ustring.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <runtime_info.h>
+
+#include "phone-common.h"
+
+enum{
+ LOG_FORMAT_TIME_12 = 0,
+ LOG_FORMAT_TIME_24,
+ LOG_FORMAT_DATE,
+ LOG_FORMAT_MAX,
+};
+
+static const char *date_time_format[] = {
+ "hm",
+ "Hm",
+ "yMMMdd",
+ "yMMMddhm",
+ "yMMMddHm",
+};
+
+static char *m_img_logtype_tbl[LOG_TYPE_MAX] = {
+ IMGDIR"/C01-4_list_icon_call.png",
+ IMGDIR"/C01-4_list_icon_vt-call.png",
+ IMGDIR"/C01-4_list_icon_sms.png",
+ IMGDIR"/C01-4_list_icon_mms.png"
+};
+
+static char *m_img_logaction_tbl[LOG_ACTION_MAX] = {
+ IMGDIR"/C01-4_icon_dialed.png",
+ IMGDIR"/C01-4_icon_missed-call.png",
+ IMGDIR"/C01-4_icon_received.png",
+ IMGDIR"/C01-4_icon_rejected.png",
+ IMGDIR"/C01-4_icon_Blocked(Auto-rejected).png"
+};
+
+static bool is_24hour_enabled = false;
+
+int phone_detail_log_is_call_ing_type(int type)
+{
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VOICE_OUTGOING:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VIDEO_OUTGOING:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static int detail_log_is_voice_call_type(int type)
+{
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VOICE_OUTGOING:
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN:
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING_SEEN:
+ case CONTACTS_PLOG_TYPE_VOICE_REJECT:
+ case CONTACTS_PLOG_TYPE_VOICE_BLOCKED:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+int phone_detail_log_is_mms_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_MMS_INCOMMING
+ || type == CONTACTS_PLOG_TYPE_MMS_OUTGOING
+ || type == CONTACTS_PLOG_TYPE_MMS_BLOCKED)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+int phone_detail_log_is_sms_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_SMS_INCOMMING
+ || type == CONTACTS_PLOG_TYPE_SMS_OUTGOING
+ || type == CONTACTS_PLOG_TYPE_SMS_BLOCKED)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+int phone_detail_log_is_email_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_EMAIL_RECEIVED
+ || type == CONTACTS_PLOG_TYPE_EMAIL_SENT)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
+static int detail_log_is_video_call_type(int type)
+{
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VIDEO_OUTGOING:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN:
+ case CONTACTS_PLOG_TYPE_VIDEO_REJECT:
+ case CONTACTS_PLOG_TYPE_VIDEO_BLOCKED:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static int phone_detail_log_is_call_dial_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_VOICE_OUTGOING
+ || type == CONTACTS_PLOG_TYPE_VIDEO_OUTGOING)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static int detail_log_is_msg_out_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_MMS_OUTGOING
+ || type == CONTACTS_PLOG_TYPE_SMS_OUTGOING
+ || type == CONTACTS_PLOG_TYPE_EMAIL_SENT)
+ return TRUE;
+ else
+ return FALSE;
+
+}
+
+static int detail_log_is_call_receive_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_VOICE_INCOMMING
+ || type == CONTACTS_PLOG_TYPE_VIDEO_INCOMMING)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static int detail_log_is_msg_income_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_MMS_INCOMMING
+ || type == CONTACTS_PLOG_TYPE_SMS_INCOMMING
+ || type == CONTACTS_PLOG_TYPE_EMAIL_RECEIVED)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static int detail_log_is_call_miss_type(int type)
+{
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN:
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING_SEEN:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static int detail_log_is_call_rejected_type(int type)
+{
+ if (type == CONTACTS_PLOG_TYPE_VOICE_REJECT
+ || type == CONTACTS_PLOG_TYPE_VIDEO_REJECT)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static int detail_log_is_blocked_type(int type)
+{
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_BLOCKED:
+ case CONTACTS_PLOG_TYPE_VIDEO_BLOCKED:
+ case CONTACTS_PLOG_TYPE_SMS_BLOCKED:
+ case CONTACTS_PLOG_TYPE_MMS_BLOCKED:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+char* phone_detail_log_get_icon_type(int log_type)
+{
+ Log_Type type = -1;
+ char buf[PATH_MAX]={0};
+
+ if (TRUE == detail_log_is_voice_call_type(log_type))
+ type = LOG_TYPE_CALL;
+ else if (TRUE == detail_log_is_video_call_type(log_type))
+ type = LOG_TYPE_VIDEO_CALL;
+ else if (TRUE == phone_detail_log_is_sms_type(log_type))
+ type = LOG_TYPE_SMS_MESSAGE;
+ else if (TRUE == phone_detail_log_is_mms_type(log_type))
+ type = LOG_TYPE_MMS_MESSAGE;
+ else if (TRUE == phone_detail_log_is_email_type(log_type))
+ type = LOG_TYPE_MMS_MESSAGE;
+ else {
+ PH_DBG("error invalid type");
+ return NULL;
+ }
+ snprintf(buf, sizeof(buf), "%s", m_img_logtype_tbl[type]);
+ return strdup(buf);
+}
+
+char* phone_detail_log_get_duration_from_number(int number)
+{
+ int sec, min, hour, day;
+ struct tm tmp={0};
+ char buf[PATH_MAX]={0};
+ char buf_t[PATH_MAX]={0};
+
+ sec = number;
+ day = sec/(60*60*24);
+ sec %= (60*60*24);
+ hour = sec/(60*60);
+ sec %= (60*60);
+ min = sec/(60);
+ sec %= (60);
+ tmp.tm_mday = day;
+ tmp.tm_hour = hour;
+ tmp.tm_min = min;
+ tmp.tm_sec = sec;
+ strftime(buf_t, sizeof(buf_t), "%H:%M:%S", &tmp);
+ snprintf(buf, sizeof(buf), "%s", buf_t);
+
+ return strdup(buf_t);
+}
+
+void phone_detail_log_init_time_format(void)
+{
+ PH_FN_CALL;
+ static int already_init = FALSE;
+
+ if (!already_init) {
+ UErrorCode status = U_ZERO_ERROR;
+
+ uloc_setDefault(getenv("LC_TIME"), &status);
+ PH_DBG("phone_detail_log_init_time_format : %s", getenv("LC_TIME") );
+ already_init = TRUE;
+ }
+}
+
+void phone_detail_log_delete_date_format(UDateFormat **formatter)
+{
+ PH_FN_CALL;
+ int i;
+ for (i=LOG_FORMAT_TIME_12;i<LOG_FORMAT_MAX;i++) {
+ if (formatter[i]) {
+ udat_close(formatter[i]);
+ formatter[i] = NULL;
+ }
+ }
+}
+
+static void _ph_set_default_timezone_id()
+{
+ PH_FN_CALL;
+ UErrorCode error = U_ZERO_ERROR;
+ UChar utimezone_id [PH_TEXT_SHORT_LEN] = {0};
+ char timezone_buffer[PH_TEXT_SHORT_LEN] = {0};
+ char timezone_id[PH_TEXT_SHORT_LEN] = {0};
+
+ int timezone_str_size;
+
+ strncpy(timezone_id, vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID), sizeof(timezone_id));
+ timezone_str_size = readlink("/opt/etc/localtime", timezone_buffer, sizeof(timezone_buffer));
+
+
+ if (timezone_str_size > 0)
+ {
+ char *ptr, *sp, *zone= NULL, *city= NULL;
+ ptr = strtok_r(timezone_buffer, "/", &sp);
+
+ while((ptr = strtok_r(NULL, "/", &sp)))
+ {
+ zone = city;
+ city = ptr;
+ }
+
+ if(zone != NULL && city != NULL) {
+ if(strcmp("zoneinfo", zone) == 0)
+ sprintf(timezone_id, "%s", city);
+ else
+ sprintf(timezone_id, "%s/%s", zone, city);
+ }
+ }
+
+ else
+ {
+ PH_DBG("%s", "readlink fail");
+ }
+
+ if (*timezone_id) {
+ u_uastrncpy(utimezone_id, timezone_id, sizeof(timezone_buffer)/2);
+ ucal_setDefaultTimeZone(utimezone_id , &error);
+ }
+ else {
+ p_retm_if(NULL == timezone_id, "get timezone_id is failed(%d)", error);
+ }
+}
+
+void phone_detail_log_generate_date_format(UDateFormat **formatter)
+{
+ PH_FN_CALL;
+ UDateTimePatternGenerator *generator;
+ UErrorCode error = U_ZERO_ERROR;
+
+ int i;
+ int ret;
+ const char *locale = NULL;
+
+ _ph_set_default_timezone_id();
+
+ ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED, &is_24hour_enabled);
+ if (RUNTIME_INFO_ERROR_NONE != ret || false == is_24hour_enabled)
+ is_24hour_enabled = false;
+
+ locale = uloc_getDefault();
+ phone_detail_log_delete_date_format(formatter);
+
+ generator = udatpg_open(locale, &error);
+ p_retm_if(NULL == generator, "udatpg_open is failed(%d)", error);
+
+ for (i=LOG_FORMAT_TIME_12;i<LOG_FORMAT_MAX;i++) {
+ UChar skeleton[64]={'\0'};
+ UChar best_pattern[64] = {0};
+
+ u_uastrncpy(skeleton, date_time_format[i], strlen(date_time_format[i]));
+ udatpg_getBestPattern(generator, skeleton, u_strlen(skeleton), best_pattern,
+ (int32_t)(sizeof(best_pattern)/sizeof(UChar)), &error);
+ formatter[i] = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, best_pattern, -1, &error);
+ }
+ udatpg_close(generator);
+}
+
+char* phone_detail_log_get_icon_path_with_action(int log_type)
+{
+ char buf[PATH_MAX]={0};
+ Log_Action action = -1;
+
+ if (TRUE == phone_detail_log_is_call_dial_type(log_type) || TRUE == detail_log_is_msg_out_type(log_type))
+ action = LOG_ACTION_DIALLED;
+ else if (TRUE == detail_log_is_call_miss_type(log_type))
+ action = LOG_ACTION_MISSED;
+ else if (TRUE == detail_log_is_call_receive_type(log_type) || TRUE == detail_log_is_msg_income_type(log_type))
+ action = LOG_ACTION_RECEIVED;
+ else if (TRUE == detail_log_is_call_rejected_type(log_type))
+ action = LOG_ACTION_REJECTED;
+ else if (TRUE == detail_log_is_blocked_type(log_type))
+ action = LOG_ACTION_BLOCKED;
+ else {
+ PH_DBG("error invalid type %d", log_type);
+ return NULL;
+ }
+ snprintf(buf, sizeof(buf), "%s", m_img_logaction_tbl[action]);
+ return strdup(buf);
+}
+
+char *ph_log_util_get_formatted_date(UDateFormat **formatter, int log_time,
+ date_style style)
+{
+ time_t stime;
+ UErrorCode status = U_ZERO_ERROR;
+ UDate date;
+ UChar formatted[64] = {0};
+ int32_t formatted_size;
+ int32_t formatted_len;
+ char formatted_str[PH_TEXT_SHORT_LEN] = {0};
+ int type = LOG_FORMAT_DATE;
+
+ stime = log_time;
+ date = (UDate)stime * 1000;
+
+ formatted_size = (int32_t)(sizeof(formatted)/sizeof(UChar));
+ if (PH_LOG_TIME_ONLY == style) {
+ if (true == is_24hour_enabled)
+ type = LOG_FORMAT_TIME_24;
+ else
+ type = LOG_FORMAT_TIME_12;
+ }
+ else if (PH_LOG_DATE_ONLY == style)
+ type = LOG_FORMAT_DATE;
+ formatted_len = udat_format(formatter[type], date, formatted, formatted_size, NULL, &status);
+ u_austrncpy(formatted_str, formatted, PH_TEXT_SHORT_LEN);
+ return strdup(formatted_str);
+}
+
+char *phone_detail_log_get_date(UDateFormat ** formatter, int log_time)
+{
+ return ph_log_util_get_formatted_date(formatter, log_time, PH_LOG_DATE_ONLY);
+}
+
+char *phone_detail_log_get_time(UDateFormat ** formatter, int log_time)
+{
+ return ph_log_util_get_formatted_date(formatter, log_time, PH_LOG_TIME_ONLY);;
+}
+
+
+// 0: today, 1: yesterday, 2: previous
+int phone_detail_log_get_date_type(int log_time, int log_duration)
+{
+ time_t stime;
+ struct timeval timeval;
+ struct tm *tmp;
+ int yday, cur_yday;
+
+ gettimeofday(&timeval, 0);
+ tmp = localtime(&timeval.tv_sec);
+ p_retvm_if(NULL == tmp, 2, "localtime is null");
+ cur_yday = tmp->tm_yday;
+
+ stime = log_time - log_duration;
+ tmp = localtime(&stime);
+ p_retvm_if(NULL == tmp, 2, "localtime is null");
+
+ yday = tmp->tm_yday;
+
+ if (yday == cur_yday)
+ return 0;
+ else if (yday == cur_yday-1)
+ return 1;
+ else
+ return 2;
+}
+
+int phone_detail_log_get_phonenumber_type(int number_type)
+{
+ if (number_type & CONTACTS_NUMBER_TYPE_CUSTOM) {
+ return (CTTEXT_TYPE_OTHER);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_CELL) {
+ if (number_type & CONTACTS_NUMBER_TYPE_HOME)
+ return (CTTEXT_TYPE_HOME2);
+ else if (number_type & CONTACTS_NUMBER_TYPE_WORK)
+ return (CTTEXT_TYPE_WORK2);
+ else
+ return (CTTEXT_TYPE_MOBILE);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_VOICE) {
+ if (number_type & CONTACTS_NUMBER_TYPE_HOME)
+ return (CTTEXT_TYPE_HOME);
+ else if (number_type & CONTACTS_NUMBER_TYPE_WORK)
+ return (CTTEXT_TYPE_WORK);
+ else
+ return (CTTEXT_TYPE_TELEPHONE);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_FAX) {
+ if (number_type & CONTACTS_NUMBER_TYPE_HOME)
+ return (CTTEXT_TYPE_FAX_HOME);
+ else if (number_type & CONTACTS_NUMBER_TYPE_WORK)
+ return (CTTEXT_TYPE_FAX_WORK);
+ else
+ return (CTTEXT_TYPE_FAX);
+ }
+ else if (number_type & CONTACTS_NUMBER_TYPE_PAGER)
+ return (CTTEXT_TYPE_PAGER);
+ else if (number_type & CONTACTS_NUMBER_TYPE_CAR)
+ return (CTTEXT_TYPE_CAR);
+ else if (number_type & CONTACTS_NUMBER_TYPE_ASSISTANT)
+ return (CTTEXT_TYPE_ASSISTANT);
+ else {
+ if (number_type == CONTACTS_NUMBER_TYPE_HOME)
+ return (CTTEXT_TYPE_HOME);
+ else if (number_type == CONTACTS_NUMBER_TYPE_WORK)
+ return (CTTEXT_TYPE_WORK);
+ else
+ return (CTTEXT_TYPE_OTHER);
+ }
+}
diff --git a/lib/common/ph-dialer-speed.c b/lib/common/ph-dialer-speed.c
new file mode 100755
index 0000000..ed8d6a5
--- /dev/null
+++ b/lib/common/ph-dialer-speed.c
@@ -0,0 +1,130 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include "msg.h"
+#include "phone.h"
+#include "phone-common.h"
+
+char *phone_get_voice_mail_number()
+{
+ int ret;
+ msg_handle_t handle;
+ msg_struct_t voice_mail;
+ char strValue[MAX_PHONE_NUMBER_LEN+1] = {0,};
+
+ ret = msg_open_msg_handle(&handle);
+ p_retvm_if (MSG_SUCCESS != ret, NULL, "msg_open_msg_handle is Failed(%d)", ret);
+
+ voice_mail = msg_create_struct(MSG_STRUCT_SETTING_VOICE_MSG_OPT);
+ ret = msg_get_voice_msg_opt(handle, voice_mail);
+
+ if (ret != MSG_SUCCESS) {
+ ERR("msg_get_confi is faild(%d)", ret);
+ ret = msg_close_msg_handle(&handle);
+ p_warn_if (MSG_SUCCESS != ret, "msg_close_msg_handles is Failed(%d)", ret);
+ return NULL;
+ }
+
+ ret = msg_get_str_value(voice_mail, MSG_VOICEMSG_ADDRESS_STR, strValue, MAX_PHONE_NUMBER_LEN);
+ p_warn_if (MSG_SUCCESS != ret, "msg_get_str_value is Failed(%d)", ret);
+ p_warn_if (strlen(strValue) == 0, "voicemail number is none");
+ PH_DBG("Voicemail Number : %s", strValue);
+
+ ret = msg_close_msg_handle(&handle);
+ p_warn_if (MSG_SUCCESS != ret, "msg_close_msg_handles is Failed(%d)", ret);
+
+ return strdup(strValue);
+}
+
+Eina_List *phone_load_speeddial_data(int *ref_count)
+{
+ Eina_List *list = NULL;
+ int count = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h spdial_list = NULL;
+ ph_speeddial_info *voice_mail;
+ unsigned int record_cnt = 0;
+
+ err = contacts_db_get_all_records(_contacts_speeddial._uri, 0, 0, &spdial_list);
+ contacts_list_get_count( spdial_list, &record_cnt );
+ PH_DBG("get speeddial records (%d)", record_cnt);
+ while (CONTACTS_ERROR_NONE == err && record_cnt > 0) {
+ ph_speeddial_info *speed_info;
+ speed_info = calloc(1, sizeof(ph_speeddial_info));
+
+ err = phone_cts_get_str_from_list(spdial_list, _contacts_speeddial.number, &speed_info->ph_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() for number Failed(%d)", err);
+ err = phone_cts_get_int_from_list(spdial_list, _contacts_speeddial.person_id, &speed_info->contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() for person_id Failed(%d)", err);
+ err = phone_cts_get_int_from_list(spdial_list, _contacts_speeddial.speeddial_number, &speed_info->dial_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() for speeddial_number Failed(%d)", err);
+ err = phone_cts_get_int_from_list(spdial_list, _contacts_speeddial.number_type, &speed_info->number_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() for speeddial_number Failed(%d)", err);
+ err = phone_cts_get_str_from_list(spdial_list, _contacts_speeddial.number_label, &speed_info->numtype_label);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() for number_lable Failed(%d)", err);
+ err = phone_cts_get_str_from_list(spdial_list, _contacts_speeddial.display_name, &speed_info->display);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() for display_name Failed(%d)", err);
+ err = phone_cts_get_str_from_list(spdial_list, _contacts_speeddial.image_thumbnail_path, &speed_info->img_path);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() for image_thumbnail_path Failed(%d)", err);
+
+ list = eina_list_append(list, (void*)speed_info);
+ count++;
+
+ err = contacts_list_next(spdial_list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ }
+ err = contacts_list_destroy(spdial_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+
+ voice_mail = calloc(1, sizeof(ph_speeddial_info));
+ if (NULL == voice_mail) {
+ ERR("calloc Failed");
+ *ref_count = count;
+ phone_free_speeddial_data(list);
+ return NULL;
+ }
+ voice_mail->ph_number = phone_get_voice_mail_number();
+ voice_mail->contact_id = 0;
+ voice_mail->dial_number = 1;
+ voice_mail->display = strdup(T_(PH_GET_TEXT_BASIC, PHTEXT_VOICE_MAIL));
+ voice_mail->img_path = strdup(IMG_VOICEMAIL_ICON);
+ list = eina_list_prepend(list, (void*)voice_mail);
+
+ *ref_count = count;
+ return list;
+}
+
+void phone_free_speeddial_data(Eina_List *list)
+{
+ PH_FN_CALL;
+ Eina_List *l;
+ ph_speeddial_info *s_info;
+
+ p_retm_if(NULL == list, "List is null");
+
+ EINA_LIST_FOREACH(list, l, s_info) {
+ if (NULL == s_info)
+ continue;
+ free(s_info->display);
+ free(s_info->img_path);
+ free(s_info->ph_number);
+ free(s_info);
+ }
+ eina_list_free(list);
+ PH_FN_END;
+}
+
diff --git a/lib/common/ph-text.c b/lib/common/ph-text.c
new file mode 100755
index 0000000..81739a2
--- /dev/null
+++ b/lib/common/ph-text.c
@@ -0,0 +1,400 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include "phone.h"
+#include "phone-text.h"
+
+static const char *basic_str[] = {
+ N_("IDS_KPD_TAB4_KEYPAD"),
+ N_("IDS_PB_ITAB4_FAVOURITES"),
+ N_("IDS_PB_HEADER_SPEEDDIAL"),
+ N_("IDS_CST_BODY_VOICE_MAIL"),
+ N_("IDS_CLOG_ITAB4_LOGS"),
+ N_("IDS_COM_POP_NO_SPEED_DIAL_NUMBER_ASSIGN_ONE_NOW_Q"),
+ N_("IDS_PB_POP_REQUEST_FAILED"),
+ N_("IDS_PB_POP_REQUEST_SUCCESS"),
+ N_("IDS_CALL_POP_EMERGENCY_CALL"),
+ N_("IDS_CLOG_BODY_NO_LOGS"),
+ N_("IDS_PB_BODY_NO_FAVOURITES"),
+ N_("IDS_CLOG_POP_MESSAGE_DELETED"),
+ N_("IDS_PB_POP_MAXIMUM_PHONE_NUMBER_LENGTH_EXCEEDED"),
+ N_("IDS_CLOG_POP_DELETING_LOGS_ING"),
+ N_("IDS_PB_POP_DELETING_FAVOURITES_ING"),
+ N_("IDS_PB_POP_INITIALISING_TRY_LATER_ING"),
+ N_("IDS_COM_POP_SOUND_OFF"),
+ N_("IDS_COM_POP_SOUND_ON"),
+ N_("IDS_KPD_BODY_PREVIOUS_SCREEN_ABB"),
+ N_("IDS_COM_BODY_BACK_TO_CALL"),
+ N_("IDS_ST_BODY_INCOMMING_CALL"),
+ N_("IDS_ST_BODY_OUTGOING_CALL"),
+ N_("IDS_CLOG_HEADER_MISSED_CALL"),
+ N_("IDS_CLOG_OPT_SENT_MESSAGE"),
+ N_("IDS_CLOG_OPT_RECEIVED_MESSAGE"),
+ N_("IDS_LOGS_BODY_REJECTED_CALL_ABB"),
+ N_("IDS_LOGS_BODY_BLOCKED_CALL_ABB"),
+ N_("IDS_CLOG_OPT_EDIT_NUMBER_BEFORE_CALL"),
+};
+
+static const char *base_op_str[] = {
+ N_("IDS_CLOG_HEADER_SELECT_LOGS"),
+ N_("IDS_CST_HEADER_SELECT_SPEED_DIAL_CONTACTS"),
+ N_("IDS_CLOG_BUTTON2_UNBLOCK"),
+ N_("IDS_CST_OPT_CHANGE_CONTACT_ABB"),
+ N_("IDS_KPD_OPT_ADD_PD_SEC_PAUSE"),
+ N_("IDS_KPD_OPT_ADD_WAIT"),
+ N_("IDS_CLOG_HEADER_MISSED"),
+ N_("IDS_COM_OPT_EXIT"),
+};
+
+static const char *number_type_str[] = {
+ N_("IDS_PB_BODY_CUSTOM_T_PHONEBOOK"),/*Custom*/
+ N_("IDS_PB_BODY_MOBILE"),/*Mobile*/
+ N_("IDS_PB_BODY_HOME"),/*Home*/
+ N_("IDS_PB_BODY_WORK"),/*Work*/
+ N_("IDS_PB_BODY_FAX_HHOME"),/*Fax(home)*/
+ N_("IDS_PB_BODY_FAX_HWORK"),/*Fax(work)*/
+ N_("IDS_PB_BODY_ASSISTANT_S_NUMBER"),/*Assistant*/
+ N_("IDS_PB_BODY_PAGER"),/*Pager*/
+ N_("IDS_PB_BODY_OTHER"),/*Other*/
+ N_("IDS_PB_BODY_TELEPHONE"),/*Telephone*/
+ N_("IDS_PB_BODY_FAX"),/*Fax*/
+ N_("IDS_PB_BODY_CAR_TELEPHONE"),/*Car*/
+ N_("IDS_PB_BODY_HOME_2"),/*Home2*/
+ N_("IDS_PB_BODY_WORK"),/*Work2*/ // TODO: Fixme
+ N_("IDS_PB_BODY_COMPANY_MAIN"),/*Company main*/
+ N_("IDS_PB_BODY_RADIO"),/*Radio*/
+};
+
+static const char *postal_type_str[] = {
+ N_("IDS_PB_BODY_OTHER"),/*Other*/
+ N_("IDS_PB_BODY_CUSTOM_T_PHONEBOOK"),/*Custom*/
+ N_("IDS_PB_BODY_HOME"),/*Home*/
+ N_("IDS_PB_BODY_WORK"),/*Work*/
+};
+
+static const char *cbasic_str[] = {
+ N_("IDS_PB_BODY_ALL_CONTACTS"),/*All Contacts*/
+ N_("IDS_PB_BODY_NOT_ASSIGNED"),/*Not Assigned*/
+ N_("IDS_PB_BODY_SERVICE_NUMBER"),/*Service Number*/
+ N_("IDS_PB_BODY_PHONE"),/*Phone*/
+ N_("IDS_PB_BODY_GROUPS"),/*Groups*/
+ N_("IDS_PB_BODY_DEFAULT"),/*Default*/
+ N_("IDS_PB_BODY_RINGTONE"),/*Ringtone*/
+ N_("IDS_PB_BODY_URL"),/*URL*/
+ N_("IDS_PB_BODY_IM"),/*Instant Messenger*/
+ N_("IDS_PB_BODY_EMAIL"),/*Email*/
+ N_("IDS_PB_BODY_NUMBER"),/*Number*/
+ N_("IDS_PB_BODY_NOTE"),/*Note*/
+ N_("IDS_PB_BODY_POSTAL_ADDRESS"),/*Postal Address*/
+ N_("IDS_PB_HEADER_DETAILS"),/*Details*/
+ N_("IDS_PB_BODY_COMPANY"),/*Company*/
+ N_("IDS_PB_BODY_ORDER_OF_DISPLAY_NAME"),/* Order display name */
+ N_("IDS_PB_BODY_OWN_NUMBER"),/* Own number */
+ N_("IDS_PB_BODY_FIRST_NAME"),
+ N_("IDS_PB_BODY_LAST_NAME"),
+ N_("IDS_PB_BODY_MIDDLE_NAME"),
+ N_("IDS_PB_BODY_SUFFIX"),
+ N_("IDS_PB_BODY_NICKNAME"),
+ N_("IDS_PB_BODY_EXPORT_CONTACTS"),
+ N_("IDS_PB_HEADER_SELECT_CONTACTS"),
+ N_("IDS_PB_BODY_POSTAL_CODE"),
+ N_("IDS_PB_BODY_COUNTRY"),
+ N_("IDS_PB_BODY_PROVINCE"),
+ N_("IDS_PB_BODY_CITY"),
+ N_("IDS_PB_BODY_STREET"),
+ N_("IDS_EMAIL_BODY_SAVED_IN_PS"),
+ N_("IDS_PB_BODY_FREQUENTLY_CONTACTED_ABB"),
+ N_("IDS_PB_POP_COPIED"),
+ N_("IDS_COM_BODY_EXPORTED"),
+ N_("IDS_PB_POP_DELETING_CONTACTS_ING"),
+ N_("IDS_PB_BODY_MOVING_ING"),
+ N_("IDS_PB_BODY_COPYING_ING"),
+ N_("IDS_PB_POP_IMPORTING_SIM_CONTACTS_ING"),
+ N_("IDS_PB_POP_IMPORTING_CONTACTS_FROM_VCARD_ING"),
+ N_("IDS_PB_POP_EXPORTING_CONTACTS_TO_PS_ING"),
+ N_("IDS_PB_BODY_VCARD"),
+ N_("IDS_PB_BODY_READING_VCARD_ING"),
+ N_("IDS_COM_BODY_IMPORTED_ABB"),
+ N_("IDS_COM_BODY_NA"),
+ N_("IDS_PB_OPT_ALL_LINKED_CONTACTS_ABB"),
+ N_("IDS_PB_BODY_LINKED_CONTACTS"),
+ N_("IDS_KA_BODY_MORE_INFORMATION"),
+ N_("IDS_PB_BODY_JOB_TITLE"),
+ N_("IDS_PB_BODY_DEPARTMENT"),
+ N_("IDS_PB_OPT_GROUP_NAME"),
+ N_("IDS_PB_BODY_ADD_ACCOUNT"),
+ N_("IDS_PB_POP_ADDING_MEMBERS_TO_GROUP_ING"),
+ N_("IDS_PB_OPT_VIEW"),
+ N_("IDS_PB_BODY_PD_CONTACTS"),
+ N_("IDS_PB_OPT_RENAME"),
+ N_("IDS_PB_OPT_RELATIONSHIP"),
+ N_("IDS_PB_BODY_NO_HISTORIES"),
+ N_("IDS_PB_BODY_NO_ACTIVITIES"),
+ N_("IDS_PB_POP_ADDING_ING"),
+ N_("IDS_PB_BODY_CUSTOM_T_PHONEBOOK"),
+ N_("IDS_PB_BODY_EDITADDITIONALINFO"),
+ N_("IDS_PB_BODY_PO_BOX"),
+ N_("IDS_PB_BODY_STATE"),
+ N_("IDS_PB_BODY_DEFAULT_GROUP_FRIENDS"),
+ N_("IDS_PB_BODY_DEFAULT_GROUP_FAMILY"),
+ N_("IDS_PB_BODY_CO_WORKERS"),
+ N_("IDS_PB_BODY_DEFAULT_GROUP_WORK"),
+ N_("IDS_PB_BODY_VIBRATION_PATTERN"),
+ N_("IDS_PB_OPT_SET_DEFAULT"),
+ N_("IDS_COM_OPT_EVENT"),
+ N_("IDS_PB_OPT_SHARE_CONTACT_INFORMATION"),
+ N_("IDS_PB_BODY_1_CONTACT"),
+ N_("IDS_COM_OPT1_WI_FI_DIRECT"),
+ N_("IDS_PB_OPT_EXPORT_TO_SIM_CARD"),
+ N_("IDS_PB_SK3_INFO"),
+ N_("IDS_PB_TAB4_HISTORY"),
+ N_("IDS_PB_TAB4_ACTIVITIES"),
+ N_("IDS_CMT_HEADER_GROUP_MESSAGE_TMO"),
+ N_("IDS_CMT_HEADER_GROUP_EMAIL_TMO"),
+};
+
+static const char *err_str[] = {
+ N_("IDS_PB_BODY_NO_NAME"),
+ N_("IDS_PB_POP_INVALID_EMAIL_ADDRESS"),
+ N_("IDS_PB_POP_COMPLETE_AT_LEAST_ONE_FIELD_AS_WELL_AS_NAME"),
+ N_("IDS_IM_BODY_FAILED_TO_ACCESS_DATABASE"),
+ N_("IDS_PB_POP_ALREADY_ADDED"),
+ N_("IDS_PB_POP_GROUP_ALREADY_IN_USE"),
+ N_("IDS_PB_BODY_NO_GROUP"),
+ N_("IDS_PB_POP_NO_NUMBER"),
+ N_("IDS_PB_POP_NO_EMAIL_ADDRESSES"),
+ N_("IDS_PB_BODY_NO_CONTACTS"),
+ N_("IDS_PB_POP_SIM_MEMORY_EMPTY"),
+ N_("IDS_PB_POP_MAXIMUM_NUMBER_OF_ENTRIES_EXCEEDED"),
+ N_("IDS_SEARCH_BODY_DATA_DOES_NOT_EXIST"),
+ N_("IDS_PB_BODY_INVALID_NUMBER"),
+ N_("IDS_PB_POP_SIM_MEMORY_FULL"),
+ N_("IDS_PB_BODY_YOU_CAN_IMPORT_CONTACTS_FROM_SIM_CARD_TO_YOUR_PHONE_IN_SETTINGS_HELP_MSG"),
+ N_("IDS_CLOG_POP_NO_LOGS_AFTER_YOU_MAKE_RECEIVE_A_CALL_OR_SEND_RECEIVE_A_MESSAGE_LOGS_WILL_BE_SHOWN"),
+ N_("IDS_PB_POP_UNABLE_TO_SEND_NAME_CARDS"),
+};
+
+static const char *cbase_op_str[] = {
+ N_("IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"),/*Set Default Number*/
+ N_("IDS_PB_BODY_MARK_AS_DEFAULT_EMAIL"),/*Set Default Email*/
+ N_("IDS_PB_BODY_IMAGE"),/*Image*/
+ N_("IDS_PB_BODY_TAKE_A_PHOTO"),/*Take a photo*/
+ N_("IDS_PB_OPT_REMOVE_PHOTO_ABB"),/*Delete photo*/
+ N_("IDS_PB_SK1_ADD_TO_HOME_SCREEN"),/*Add to Home*/
+ N_("IDS_PB_BODY_SAVE_CONTACT_TO"),/*Save contact to*/
+ N_("IDS_PB_OPT_SAVE_TO"),/*Save to*/
+ N_("IDS_PB_BODY_IMPORT_SIM_CONTACTS"), /* Import SIM contacts */
+ N_("IDS_PB_BODY_FIRST_NAME_FIRST"),/* order display - First name first */
+ N_("IDS_PB_BODY_LAST_NAME_FIRST_ABB"),/* order display - Last name first */
+ N_("IDS_ST_SK_SHOW"),/* setting - mfc show */
+ N_("IDS_ST_SK_HIDE"),/* setting - mfc hide */
+ N_("IDS_PB_HEADER_SEND_NAMECARD"),
+ N_("IDS_PB_HEADER_CREATE_GROUP"),
+ N_("IDS_PB_HEADER_SELECT_GROUP"),
+ N_("IDS_PB_BODY_EXPORT_CONTACTS"),
+ N_("IDS_PB_SK_IMPORT_CONTACTS"),
+ N_("IDS_PB_BODY_LINK_CONTACT"),
+ N_("IDS_PB_OPT_UNLINK"),
+ N_("IDS_PB_POP_ALL_LINKED_CONTACTS_WILL_BE_DELETED"),
+ N_("IDS_PB_BODY_ADD_TO_FAVOURITES"),
+ N_("IDS_PB_HEADER_EDIT_GROUP"),
+ N_("IDS_PB_SK_ADD_MEMBER"),
+};
+
+static const char *event_type_str[] = {
+ N_("IDS_PB_HEADER_UNKNOWN"),/*CTS_EVENT_TYPE_OTHER*/
+ N_("IDS_PB_BODY_CUSTOM_T_PHONEBOOK"),/*CTS_EVENT_TYPE_CUSTOM*/
+ N_("IDS_PB_BODY_BIRTHDAY"),/*CTS_EVENT_TYPE_BIRTH*/
+ N_("IDS_PB_BODY_ANNIVERSARY")/*CTS_EVENT_TYPE_ANNIVERSARY*/
+};
+
+static const char *im_type_str[] = {
+ N_("IDS_PB_BODY_OTHER"),/*CTS_IM_TYPE_OTHER*/
+ N_("IDS_PB_BODY_CUSTOM_T_PHONEBOOK"),/*CTS_IM_TYPE_CUSTOM*/
+ N_("IDS_PB_OPT_GOOGLE_TALK"),/*CTS_IM_TYPE_GOOGLE*/
+ N_("IDS_PB_OPT_WINDOWS_LIVE_MESSENGER"),/*CTS_IM_TYPE_WLM*/
+ N_("IDS_PB_BODY_YAHOO"),/*CTS_IM_TYPE_YAHOO*/
+ N_("IDS_PB_BODY_FACEBOOK"),/*CTS_IM_TYPE_FACEBOOK*/
+ N_("IDS_PB_BODY_IMPSCOMMUNITY_ICQ"),/*CTS_IM_TYPE_ICQ*/
+ N_("IDS_PB_BODY_IMPSCOMMUNITY_AIM"),/*CTS_IM_TYPE_AIM*/
+ N_("IDS_PB_OPT_QQ"),/*CTS_IM_TYPE_QQ*/
+ N_("IDS_PB_OPT_JABBER"),/*CTS_IM_TYPE_JABBER*/
+ N_("IDS_PB_OPT_SKYPE"),/*CTS_IM_TYPE_SKYPE*/
+};
+
+static const char *day_str[] = {
+ N_("IDS_COM_BODY_SUNDAY"),
+ N_("IDS_COM_BODY_MONDAY"),
+ N_("IDS_COM_BODY_TUESDAY"),
+ N_("IDS_COM_BODY_WEDNESDAY"),
+ N_("IDS_COM_BODY_THURSDAY"),
+ N_("IDS_COM_BODY_FRIDAY"),
+ N_("IDS_COM_BODY_SATURDAY"),
+};
+
+static const char* relation_type_str[] = {
+ N_("IDS_PB_BODY_OTHER"),/*None*/
+ N_("IDS_PB_BUTTON_ASSISTANT"),/*Assistant*/
+ N_("IDS_COM_OPT_BROTHER_ABB"),/*Brother*/
+ N_("IDS_PB_BUTTON_CHILD"),/*Child*/
+ N_("IDS_PB_OPT_DOMESTIC_PARTNER_ABB"),/*Domestic partner*/
+ N_("IDS_COM_OPT_FATHER_ABB"),/*Father*/
+ N_("IDS_PB_BODY_CALLERIDFRIEND"),/*Friend*/
+ N_("IDS_JAVA_BODY_MANAGER"),/*Manager*/
+ N_("IDS_COM_OPT_MOTHER_ABB"),/*Mother*/
+ N_("IDS_COM_OPT_PARENT_ABB"),/*Parent*/
+ N_("IDS_PB_BODY_CALLERIDPARTNER"),/*Partner*/
+ N_("IDS_PB_OPT_REFERRED_BY"),/*Referred by*/
+ N_("IDS_COM_BODY_RELATIVE_ABB"),/*Relative*/
+ N_("IDS_COM_OPT_SISTER_ABB"),/*Sister*/
+ N_("IDS_PB_BODY_SPOUSE"),/*Spouse*/
+ N_("IDS_PB_BODY_CUSTOM_T_PHONEBOOK"),/*Custom*/
+};
+
+static const char *month_str[] = {
+ "IDS_COM_BODY_NONE",
+ "IDS_COM_BODY_JAN",
+ "IDS_COM_BODY_FEB",
+ "IDS_COM_BODY_MAR",
+ "IDS_COM_BODY_APR",
+ "IDS_COM_BODY_MAY",
+ "IDS_COM_BODY_JUN",
+ "IDS_COM_BODY_JUL",
+ "IDS_COM_BODY_AUG",
+ "IDS_COM_BODY_SEP",
+ "IDS_COM_BODY_OCT",
+ "IDS_COM_BODY_NOV",
+ "IDS_COM_BODY_DEC"
+};
+
+const char* phone_get_text(int op, int type)
+{
+ const char **table;
+
+ switch (op) {
+ case PH_GET_TEXT_BASIC:
+ table = basic_str;
+ break;
+ case PH_GET_TEXT_BASE_OP:
+ table = base_op_str;
+ break;
+ case CT_GET_TEXT_BASIC:
+ table = cbasic_str;
+ break;
+ case CT_GET_TEXT_ERR:
+ table = err_str;
+ break;
+ case CT_GET_TEXT_BASE_OP:
+ table = cbase_op_str;
+ break;
+ case CT_GET_TEXT_NUM_TYPE:
+ table = number_type_str;
+ break;
+ case CT_GET_TEXT_POSTAL_TYPE:
+ case CT_GET_TEXT_WEBSITE_TYPE:
+ case CT_GET_TEXT_EMAIL_TYPE:
+ table = postal_type_str;
+ break;
+ case CT_GET_TEXT_EVENT_TYPE:
+ table = event_type_str;
+ break;
+ case CT_GET_TEXT_IM_TYPE:
+ table = im_type_str;
+ break;
+ case CT_GET_TEXT_MONTH:
+ if (sizeof(month_str) / sizeof(month_str[0]) <= type)
+ return NULL;
+ else
+ return dgettext("sys_string", month_str[type]);
+ case CT_GET_TEXT_RELATIONSHIP_TYPE:
+ table = relation_type_str;
+ break;
+ case PH_GET_TEXT_DAY:
+ if (sizeof(day_str) / sizeof(day_str[0]) <= type)
+ return NULL;
+ else
+ table = day_str;
+ break;
+ default:
+ return NULL;
+ }
+ return dgettext(PACKAGE, table[type]);
+}
+
+static const char *sys_str[] = {
+ "IDS_COM_SK_OK",
+ "IDS_COM_SK_SAVE",
+ "IDS_COM_SK_DONE",
+ "IDS_COM_SK_EDIT",
+ "IDS_COM_SK_DELETE",
+ "IDS_COM_SK_CANCEL",
+ "IDS_COM_SK3_BLOCK",
+ "IDS_COM_SK_NO",
+ "IDS_COM_SK_YES",
+ "IDS_COM_SK_ADD",
+ "IDS_COM_SK_MORE",
+ "IDS_COM_SK_NEXT",
+ "IDS_COM_BODY_CALL",
+ "IDS_COM_BODY_MESSAGE",
+ "IDS_COM_BODY_VIDEO_CALL",
+ "IDS_COM_BODY_UNKNOWN",
+ "IDS_COM_BODY_SELECT_ALL",
+ "IDS_COM_BODY_CONTACTS",
+ "IDS_COM_BODY_DETAILS",
+ "IDS_COM_BODY_REMOVE",
+ "IDS_COM_BODY_TODAY",
+ "IDS_COM_BODY_YESTERDAY",
+ "IDS_COM_BODY_PREVIOUS",
+ "IDS_COM_BODY_NO_NAME",
+ "IDS_COM_BODY_CREATE",
+ "IDS_COM_BODY_MOVE",
+ "IDS_COM_BODY_COPY",
+ "IDS_COM_BODY_PHONE",
+ "IDS_COM_BODY_SEARCH",
+ "IDS_COM_BODY_BLUETOOTH",
+ "IDS_COM_BODY_EMAIL",
+ "IDS_COM_BODY_ADDTOPHONEBOOK_SIM",
+ "IDS_COM_BODY_MEMORY_CARD",
+ "IDS_COM_BODY_DETAILS_NAME",
+ "IDS_COM_BODY_ALL",
+ "IDS_COM_POP_FAIL",
+ "IDS_COM_POP_FAILED",
+ "IDS_COM_POP_CLOSE",
+ "IDS_COM_POP_REMOVED",
+ "IDS_COM_POP_DELETED",
+ "IDS_COM_POP_INCORRECT_PASSWORD",
+ "IDS_COM_POP_ALREDY_EXISTS",
+ "IDS_COM_POP_SELECTED",
+ "IDS_COM_POP_SUCCESS",
+ "IDS_COM_POP_ERROR",
+ "IDS_COM_POP_MOVED",
+ "IDS_COM_POP_ADDED",
+ "IDS_COM_POP_NOT_ENOUGH_MEMORY",
+ "IDS_COM_POP_NOTHING_SELECTED",
+ "IDS_COM_POP_FILE_NOT_FOUND",
+ "IDS_COM_POP_ADDRESS",
+ "IDS_COM_OPT_ADD_TO_CONTACTS",
+ "IDS_COM_BODY_SELECTED_DATA_NOT_FOUND",
+ "IDS_COM_POP_DELETE_Q",
+ "IDS_COM_SK_SET",
+ "IDS_COM_BODY_RESET",
+};
+
+const char* phone_get_system_string(int type)
+{
+ return dgettext("sys_string", sys_str[type]);
+}
diff --git a/lib/ct-front/CMakeLists.txt b/lib/ct-front/CMakeLists.txt
new file mode 100755
index 0000000..e4b3f66
--- /dev/null
+++ b/lib/ct-front/CMakeLists.txt
@@ -0,0 +1,14 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${CT_FRONT})
+
+FILE(GLOB SRCS *.c)
+
+ADD_LIBRARY(${TARGET} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
+TARGET_LINK_LIBRARIES(${TARGET} ${COMMON_LIB} ${FAVOR_LIB} ${ug_pkgs_LDFLAGS} ${PH_LOG} ${CT_DETAILS} ${CT_LIST})
+
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/ct-front/contacts-tabui-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/ct-front/contacts-tabui-efl.xml b/lib/ct-front/contacts-tabui-efl.xml
new file mode 100644
index 0000000..dded70a
--- /dev/null
+++ b/lib/ct-front/contacts-tabui-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="contacts-tabui-efl" version="0.1.0-0" install-location="internal-only">
+ <label>contacts-tabui</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>contacts-tabui-efl Application</description>
+ <ui-application appid="contacts-tabui-efl" exec="/usr/ug/bin/contacts-tabui-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.contacts.png</icon>
+ <label>contacts-tabui</label>
+ <label xml:lang="en-us">contacts-tabui</label>
+ <label xml:lang="nl-nl">contacts-tabui</label>
+ <label xml:lang="de-de">contacts-tabui</label>
+ <label xml:lang="en-gb">contacts-tabui</label>
+ <label xml:lang="zh-hk">contacts-tabui</label>
+ <label xml:lang="zh-cn">contacts-tabui</label>
+ <label xml:lang="ru-ru">contacts-tabui</label>
+ <label xml:lang="zh-tw">contacts-tabui</label>
+ <label xml:lang="ja-jp">contacts-tabui</label>
+ <label xml:lang="es-es">contacts-tabui</label>
+ <label xml:lang="el-gr">contacts-tabui</label>
+ <label xml:lang="it-it">contacts-tabui</label>
+ <label xml:lang="tr-tr">contacts-tabui</label>
+ <label xml:lang="pt-pt">contacts-tabui</label>
+ <label xml:lang="fr-fr">contacts-tabui</label>
+ <label xml:lang="ko-kr">contacts-tabui</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/lib/ct-front/ct-front-main.c b/lib/ct-front/ct-front-main.c
new file mode 100755
index 0000000..704ffcd
--- /dev/null
+++ b/lib/ct-front/ct-front-main.c
@@ -0,0 +1,221 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-common.h"
+#include "contacts-ug.h"
+#include "ct-front.h"
+#include "ct-front-view.h"
+
+static int cfront_parse_bundle(ct_front_data *cfront_d, service_h service)
+{
+ PH_FN_CALL;
+ char* val = NULL;
+
+ cfront_d->view_visible[CT_VIEW_CONTACT] = true;
+ cfront_d->view_visible[CT_VIEW_GROUP] = true;
+ cfront_d->view_visible[CT_VIEW_FAVORITE] = true;
+
+ if (service) {
+ service_get_extra_data(service, PH_UG_BUNDLE_TYPE, &val);
+ if (val) cfront_d->ug_request = atoi(val);
+ PH_DBG("type = %d", cfront_d->ug_request);
+ free(val);
+ }
+
+ switch (cfront_d->ug_request) {
+ case PH_UG_REQUEST_SELECT:
+ case PH_UG_REQUEST_SELECT_NUMBER:
+ case PH_UG_REQUEST_SELECT_EMAIL:
+ cfront_d->view_visible[CT_VIEW_LOG] = true;
+ break;
+ case PH_UG_REQUEST_SET_WITH_NUM:
+ service_get_extra_data(service, CT_UG_BUNDLE_NUM, &cfront_d->ug_data);
+ break;
+ case PH_UG_REQUEST_SET_WITH_EMAIL:
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &cfront_d->ug_data);
+ break;
+ case PH_UG_REQUEST_SET_WITH_WEB:
+ service_get_extra_data(service, CT_UG_BUNDLE_WEB, &cfront_d->ug_data);
+ break;
+ case PH_UG_REQUEST_SET_WITH_IMG:
+ case PH_UG_REQUEST_SET_WITH_RINGTONE:
+ service_get_extra_data(service, CT_UG_BUNDLE_PATH, &cfront_d->ug_data);
+ break;
+ case PH_UG_REQUEST_CHECK:
+ case PH_UG_REQUEST_CHECK_FOR_NUMBER:
+ case PH_UG_REQUEST_CHECK_FOR_EMAIL:
+ case PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ cfront_d->view_visible[CT_VIEW_LOG] = true;
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_MAX, &val);
+ if (val) cfront_d->cnt_max = atoi(val);
+ free(val);
+ default:
+ break;
+ }
+ return 0;
+}
+
+void *ct_tabui_on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *bg;
+ Evas_Object *parent;
+ Evas_Object *layout;
+ ct_front_data *cfront_d;
+
+ if (!ug || !priv)
+ return NULL;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ cfront_d = priv;
+ ret = cfront_parse_bundle(cfront_d, service);
+ p_retvm_if(-1 == ret, NULL, "ph_front_view_parse_bundle() Failed");
+
+ err = contacts_connect2();
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_connect2() Failed(%d)", err);
+
+ parent = ug_get_parent_layout(ug);
+ if (!parent)
+ return NULL;
+
+ cfront_d = priv;
+ cfront_d->win = ug_get_window();
+ cfront_d->select_tab = CT_VIEW_NONE;
+ cfront_d->ug = ug;
+
+ layout = ct_front_view_create_toolbar(cfront_d);
+
+ bg = phone_create_bg(layout);
+ if (NULL == bg) {
+ PH_DBG("phone_create_bg() return NULL");
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ return NULL;
+ }
+
+ return layout;
+}
+
+void ct_tabui_on_start(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ ct_front_data *cfront_d = priv;
+
+ elm_toolbar_select_mode_set(cfront_d->tabbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ cfront_d->timer = ecore_timer_add(3.0, ctui_front_view_load_timer, cfront_d);
+ PH_FN_END;
+}
+
+void ct_tabui_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+void ct_tabui_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+void ct_tabui_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_front_data *cfront_d = priv;
+
+ if (!ug)
+ return;
+
+ free(cfront_d->ug_data);
+
+ if(cfront_d->ug) {
+ evas_object_del(ug_get_layout(ug));
+ }
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ PH_FN_END;
+}
+
+void ct_tabui_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+void ct_tabui_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ ct_front_data *cfront_d = priv;
+ switch (event) {
+ case UG_EVENT_REGION_CHANGE:
+ ctui_front_view_region_changed(cfront_d);
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ ctui_front_view_language_changed(cfront_d);
+ break;
+ default:
+ break;
+ }
+}
+
+void ct_tabui_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
+{
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ct_front_data *cfront_d;
+
+ if (!ops)
+ return -1;
+
+ cfront_d = calloc(1, sizeof(ct_front_data));
+ if (!cfront_d)
+ return -1;
+
+ ops->create = ct_tabui_on_create;
+ ops->start = ct_tabui_on_start;
+ ops->pause = ct_tabui_on_pause;
+ ops->resume = ct_tabui_on_resume;
+ ops->destroy = ct_tabui_on_destroy;
+ ops->message = ct_tabui_on_message;
+ ops->event = ct_tabui_on_event;
+ ops->key_event = ct_tabui_on_key_event;
+ ops->priv = cfront_d;
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+
+ return 0;
+}
+
+API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ PH_FN_CALL;
+ if (!ops)
+ return;
+
+ free(ops->priv);
+ ops->priv = NULL;
+}
+
diff --git a/lib/ct-front/ct-front-view.c b/lib/ct-front/ct-front-view.c
new file mode 100755
index 0000000..1201d30
--- /dev/null
+++ b/lib/ct-front/ct-front-view.c
@@ -0,0 +1,655 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <bundle.h>
+#include <app.h>
+#include "phone.h"
+#include "ct-front.h"
+#include "phone-log.h"
+#include "ct-front-view.h"
+#include "ct-list.h"
+#include "ct-group.h"
+#include "ct-favor.h"
+
+static void cfront_view_reset_current_sub_view(ct_front_data *cfront_d)
+{
+ PH_FN_CALL;
+ p_retm_if(cfront_d->select_tab <= CT_VIEW_NONE || CT_VIEW_MAX <= cfront_d->select_tab, "select_tab %d", cfront_d->select_tab);
+ if (cfront_d->sub_view[cfront_d->select_tab]) {
+ switch (cfront_d->select_tab) {
+ case CT_VIEW_CONTACT :
+ ctui_list_view_reset(evas_object_data_get(cfront_d->navi, "clist_d"));
+ ctui_list_set_background(cfront_d->navi, true);
+ break;
+ case CT_VIEW_LOG :
+ phone_log_view_reset(cfront_d->navi);
+ phone_log_set_background(cfront_d->navi, true);
+ break;
+ case CT_VIEW_GROUP:
+ phone_group_view_reset(cfront_d->sub_view[CT_VIEW_GROUP]);
+ phone_group_set_background(cfront_d->sub_view[CT_VIEW_GROUP], true);
+ break;
+ case CT_VIEW_FAVORITE :
+ phone_favor_view_reset(cfront_d->sub_view[CT_VIEW_FAVORITE]);
+ phone_favor_set_background(cfront_d->sub_view[CT_VIEW_FAVORITE], true);
+ break;
+ }
+ }
+}
+
+static void cfront_view_load_sub_view(ct_front_data *cfront_d, int tab_index)
+{
+ PH_FN_CALL;
+ ph_view_info *view_info;
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, cfront_d->win, cfront_d->navi, cfront_d->ug, cfront_d->ug_request,
+ cfront_d->cnt_max, cfront_d->ug_data);
+ switch (tab_index) {
+ case CT_VIEW_CONTACT:
+ cfront_d->sub_view[tab_index] = ctui_create_phone_list_view(view_info);
+ break;
+ case CT_VIEW_LOG:
+ cfront_d->sub_view[tab_index] = phone_create_log_view(view_info);
+ break;
+ case CT_VIEW_GROUP:
+ cfront_d->sub_view[tab_index] = phone_create_group_view(view_info);
+ break;
+ case CT_VIEW_FAVORITE:
+ cfront_d->sub_view[tab_index] = phone_favor_create_view(view_info);
+ break;
+ default:
+ ERR("tab_index is invalid");
+ break;
+ };
+ free(view_info);
+}
+
+static void cfront_view_show_sub_view(ct_front_data *cfront_d, int tab_index)
+{
+ PH_FN_CALL;
+ Evas_Object *view;
+ ph_view_info *view_info;
+ p_retm_if(cfront_d->select_tab == tab_index, "The tab is already shown");
+
+ cfront_view_reset_current_sub_view(cfront_d);
+ phone_hide_notify(cfront_d->navi);
+
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, cfront_d->win, cfront_d->navi, cfront_d->ug, cfront_d->ug_request,
+ cfront_d->cnt_max, cfront_d->ug_data);
+
+ switch (tab_index) {
+ case CT_VIEW_CONTACT:
+ if (NULL == cfront_d->sub_view[tab_index])
+ cfront_d->sub_view[tab_index] = ctui_create_phone_list_view(view_info);
+ ctui_list_set_background(cfront_d->navi, false);
+ if (PH_UG_REQUEST_CHECK == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_EMAIL == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == cfront_d->ug_request) {
+ ctui_list_edit_mode_start(evas_object_data_get(cfront_d->navi, "clist_d"));
+ }
+ else
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, evas_object_data_get(cfront_d->navi, "clist_d"));
+ break;
+ case CT_VIEW_LOG:
+ if (NULL == cfront_d->sub_view[tab_index])
+ cfront_d->sub_view[tab_index] = phone_create_log_view(view_info);
+ phone_log_set_background(cfront_d->navi, false);
+ if (PH_UG_REQUEST_CHECK == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_EMAIL == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == cfront_d->ug_request)
+ phone_log_check_mode_start(evas_object_data_get(cfront_d->navi, "log_data"));
+ else
+ phone_log_set_navi(cfront_d->navi);
+ break;
+ case CT_VIEW_GROUP:
+ if (NULL == cfront_d->sub_view[tab_index])
+ cfront_d->sub_view[tab_index] = phone_create_group_view(view_info);
+ phone_group_set_background(cfront_d->sub_view[tab_index], false);
+ phone_group_set_navi(cfront_d->sub_view[tab_index]);
+ break;
+ case CT_VIEW_FAVORITE:
+ if (NULL == cfront_d->sub_view[tab_index])
+ cfront_d->sub_view[tab_index] = phone_favor_create_view(view_info);
+ phone_favor_set_background(cfront_d->sub_view[CT_VIEW_FAVORITE], false);
+ if (cfront_d->ug &&
+ (PH_UG_REQUEST_CHECK == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_EMAIL == cfront_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == cfront_d->ug_request)) {
+ phone_favor_edit_mode_start(evas_object_data_get(cfront_d->sub_view[tab_index], "favor_d"));
+ }
+ else
+ phone_favor_set_navi(cfront_d->sub_view[tab_index], PH_FAVOR_MODE_DEFAULT);
+ break;
+ default:
+ free(view_info);
+ ERR("tab_index is invalid");
+ return;
+ }
+ cfront_d->select_tab = tab_index;
+
+ view = elm_object_part_content_unset(cfront_d->layout, "elm.swallow.content");
+ if (view)
+ evas_object_hide(view);
+
+ elm_object_part_content_set(cfront_d->layout, "elm.swallow.content", cfront_d->sub_view[tab_index]);
+ evas_object_show(cfront_d->sub_view[tab_index]);
+
+ free(view_info);
+}
+
+static Eina_Bool cfront_view_load_all_sub_view(void *data)
+{
+ PH_FN_CALL;
+ ct_front_data *cfront_d = data;
+ int i;
+
+ for (i=CT_VIEW_CONTACT;i<CT_VIEW_MAX;i++) {
+ if (cfront_d->view_visible[i] && NULL == cfront_d->sub_view[i]) {
+ cfront_view_load_sub_view(cfront_d, i);
+ return ECORE_CALLBACK_RENEW;
+ }
+ }
+ cfront_d->idler = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+API Eina_Bool ctui_front_view_load_timer(void *data)
+{
+ PH_FN_CALL;
+ ct_front_data *cfront_d = data;
+
+ cfront_d->idler = ecore_idler_add(cfront_view_load_all_sub_view, cfront_d);
+ cfront_d->timer = NULL;
+
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void cfront_view_change_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int i;
+ Elm_Object_Item *selected_it;
+ ct_front_data *cfront_d = data;
+
+ selected_it = elm_toolbar_selected_item_get(obj);
+
+ if (!selected_it) {
+ selected_it = cfront_d->item[cfront_d->select_tab];
+ elm_toolbar_item_selected_set(cfront_d->item[cfront_d->select_tab], EINA_TRUE);
+ }
+ for (i=CT_VIEW_CONTACT;i<CT_VIEW_MAX;i++) {
+ if (cfront_d->item[i])
+ if (selected_it == cfront_d->item[i]) break;
+ }
+ PH_DBG("cur sel : %d, sel index : %d", cfront_d->select_tab, i);
+ cfront_view_show_sub_view(cfront_d, i);
+}
+
+static void cfront_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_front_data *cfront_d = data;
+ int i;
+
+ p_retm_if(NULL == cfront_d, "cfront_d is null");
+
+ for (i=0;i<CT_VIEW_MAX;i++) {
+ if (cfront_d->sub_view[i])
+ evas_object_del(cfront_d->sub_view[i]);
+ cfront_d->sub_view[i] = NULL;
+ }
+
+ if (cfront_d->idler) {
+ ecore_idler_del(cfront_d->idler);
+ cfront_d->idler = NULL;
+ }
+
+ if (cfront_d->timer) {
+ ecore_timer_del(cfront_d->timer);
+ cfront_d->timer = NULL;
+ }
+
+ if(!cfront_d->ug)
+ free(cfront_d);
+ else
+ cfront_d->ug = NULL;
+ PH_FN_END;
+}
+
+Evas_Object* ct_front_view_create_toolbar(ct_front_data *cfront_d)
+{
+ Evas_Object *base;
+ Evas_Object *layout;
+ Evas_Object *naviframe;
+ Evas_Object *toolbar;
+ Elm_Object_Item *navi_it;
+ Evas_Object *conform;
+
+ conform = elm_conformant_add(cfront_d->win);
+ p_retvm_if(NULL == conform, NULL, "elm_conformant_add() Failed");
+
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ base = elm_layout_add(conform);
+ p_retvm_if(NULL == base, NULL, "elm_layout_add() Failed");
+
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_layout_theme_set(base, "layout", "application", "default");
+ elm_win_resize_object_add(cfront_d->win, conform);
+ elm_object_content_set(conform, base);
+ evas_object_show(base);
+ evas_object_show(conform);
+
+ naviframe = elm_naviframe_add(base);
+ elm_naviframe_prev_btn_auto_pushed_set(naviframe, EINA_FALSE);
+ elm_object_part_content_set(base, "elm.swallow.content", naviframe);
+ cfront_d->navi = naviframe;
+
+ layout = elm_layout_add(naviframe);
+ p_retvm_if(NULL == layout, NULL, "elm_layout_add() Failed");
+ elm_layout_theme_set(layout, "layout", "tabbar", "default");
+ cfront_d->layout = layout;
+
+ toolbar = elm_toolbar_add(naviframe);
+ p_retvm_if(NULL == toolbar, NULL, "elm_toolbar_add() Failed");
+ elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
+ elm_object_style_set(toolbar, "tabbar");
+ elm_object_part_content_set(layout, "elm.swallow.tabbar", toolbar);
+ cfront_d->tabbar = toolbar;
+
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+
+ if (cfront_d->view_visible[CT_VIEW_CONTACT])
+ cfront_d->item[CT_VIEW_CONTACT] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_CONTACTS, S_(PH_SYS_BODY_CONTACTS), cfront_view_change_cb, cfront_d);
+ if (cfront_d->view_visible[CT_VIEW_GROUP])
+ cfront_d->item[CT_VIEW_GROUP] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_GROUP, T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP), cfront_view_change_cb, cfront_d);
+ if (cfront_d->view_visible[CT_VIEW_FAVORITE])
+ cfront_d->item[CT_VIEW_FAVORITE] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_FAVORITE, T_(PH_GET_TEXT_BASIC, PHTEXT_FAVORITES), cfront_view_change_cb, cfront_d);
+ if (cfront_d->view_visible[CT_VIEW_LOG])
+ cfront_d->item[CT_VIEW_LOG] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_LOGS, T_(PH_GET_TEXT_BASIC, PHTEXT_LOGS), cfront_view_change_cb, cfront_d);
+
+ navi_it = elm_naviframe_item_push(naviframe, NULL, NULL, NULL, layout, NULL);
+ elm_naviframe_item_title_visible_set(navi_it, EINA_FALSE);
+ evas_object_event_callback_add(base, EVAS_CALLBACK_DEL, cfront_view_delete_cb, cfront_d);
+
+ return base;
+}
+
+API ct_front_data* ctui_front_view_create(Evas_Object *win)
+{
+ PH_FN_CALL;
+ Evas_Object *bg;
+ Evas_Object *layout;
+ ct_front_data *cfront_d = calloc(1, sizeof(ct_front_data));
+ cfront_d->win = win;
+ cfront_d->select_tab = CT_VIEW_NONE;
+
+ cfront_d->view_visible[CT_VIEW_CONTACT] = true;
+ cfront_d->view_visible[CT_VIEW_GROUP] = true;
+ cfront_d->view_visible[CT_VIEW_FAVORITE] = true;
+
+ layout = ct_front_view_create_toolbar(cfront_d);
+ if (NULL == layout) {
+ PH_DBG("layout_main is null");
+ free(cfront_d);
+ return NULL;
+ }
+
+ bg = phone_create_bg(layout);
+ if (NULL == bg) {
+ PH_DBG("phone_create_bg() return NULL");
+ free(cfront_d);
+ return NULL;
+ }
+
+ return cfront_d;
+}
+
+API void ctui_front_view_region_changed(ct_front_data *cfront_d)
+{
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_LOG])
+ phone_log_views_update(cfront_d->navi);
+ // TODO: update contact detail history view
+}
+
+API void ctui_front_view_pause(ct_front_data *cfront_d)
+{
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_LOG])
+ phone_log_set_background(cfront_d->navi, true);
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_CONTACT])
+ ctui_list_view_pause(cfront_d->navi);
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_GROUP])
+ phone_group_set_background(cfront_d->sub_view[CT_VIEW_GROUP], true);
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_FAVORITE])
+ phone_favor_set_background(cfront_d->sub_view[CT_VIEW_FAVORITE], true);
+}
+
+API void ctui_front_view_resume(ct_front_data *cfront_d)
+{
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_LOG]) {
+ if (CT_VIEW_LOG == cfront_d->select_tab) {
+ phone_log_set_background(cfront_d->navi, false);
+ phone_log_view_resume(cfront_d->navi);
+ }
+ }
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_CONTACT])
+ ctui_list_view_resume(cfront_d->navi);
+
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_GROUP] && CT_VIEW_GROUP == cfront_d->select_tab)
+ phone_group_set_background(cfront_d->sub_view[CT_VIEW_GROUP], false);
+
+ if (cfront_d && cfront_d->sub_view[CT_VIEW_FAVORITE] && CT_VIEW_FAVORITE == cfront_d->select_tab)
+ phone_favor_set_background(cfront_d->sub_view[CT_VIEW_FAVORITE], false);
+}
+
+static void cfront_view_win_activate(void *data, Evas *e, void *even_info)
+{
+ elm_win_activate(data);
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST, cfront_view_win_activate);
+}
+
+API int ctui_front_view_rotate(ct_front_data *cfront_d, app_device_orientation_e orientation)
+{
+ int rotate;
+ int ret = 0;
+
+ switch (orientation) {
+ case APP_DEVICE_ORIENTATION_0:
+ rotate = 0;
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
+ break;
+ case APP_DEVICE_ORIENTATION_180:
+ rotate = 180;
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
+ break;
+ case APP_DEVICE_ORIENTATION_270:
+ rotate = 270;
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
+ break;
+ case APP_DEVICE_ORIENTATION_90:
+ rotate = 90;
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
+ break;
+ default:
+ rotate = -1;
+ break;
+ }
+
+ evas_object_data_set(cfront_d->navi, "phone_rotate", (void *)rotate);
+ if (0 <= rotate)
+ elm_win_rotation_with_resize_set(cfront_d->win, rotate);
+ return ret;
+}
+
+API void ctui_front_view_language_changed(ct_front_data *cfront_d)
+{
+ PH_FN_CALL;
+ p_retm_if(NULL == cfront_d, "parameter(cfront_d) is NULL");
+ Elm_Object_Item *selected_it = NULL;
+
+ int i = 0;
+
+ // 1. Update tabbar
+ if (cfront_d->item[CT_VIEW_CONTACT])
+ elm_object_item_text_set(cfront_d->item[CT_VIEW_CONTACT], S_(PH_SYS_BODY_CONTACTS));
+
+ if (cfront_d->item[CT_VIEW_GROUP])
+ elm_object_item_text_set(cfront_d->item[CT_VIEW_GROUP], T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP));
+
+ if (cfront_d->item[CT_VIEW_FAVORITE])
+ elm_object_item_text_set(cfront_d->item[CT_VIEW_FAVORITE], T_(PH_GET_TEXT_BASIC, PHTEXT_FAVORITES));
+
+ if (cfront_d->item[CT_VIEW_LOG])
+ elm_object_item_text_set(cfront_d->item[CT_VIEW_LOG], T_(PH_GET_TEXT_BASIC, PHTEXT_LOGS));
+
+
+ // 2. update view and selection info
+ if (cfront_d->sub_view[CT_VIEW_LOG])
+ phone_log_view_language_changed(cfront_d->navi);
+
+ if (cfront_d->sub_view[CT_VIEW_CONTACT])
+ ctui_list_view_language_changed(cfront_d->navi);
+
+ if (cfront_d->sub_view[CT_VIEW_GROUP])
+ phone_group_view_language_changed(cfront_d->sub_view[CT_VIEW_GROUP]);
+
+ if (cfront_d->sub_view[CT_VIEW_FAVORITE])
+ phone_favor_view_language_changed(cfront_d->sub_view[CT_VIEW_FAVORITE]);
+
+ // 3. Update tabbar
+ selected_it = elm_toolbar_selected_item_get(cfront_d->tabbar);
+ for (i=CT_VIEW_CONTACT;i<CT_VIEW_MAX;i++) {
+ if (cfront_d->item[i])
+ if (selected_it == cfront_d->item[i]) break;
+ }
+ PH_DBG("cur sel : %d, sel index : %d", cfront_d->select_tab, i);
+ cfront_view_show_sub_view(cfront_d, i);
+ switch (cfront_d->select_tab) {
+ case CT_VIEW_CONTACT:
+ {
+ ct_list_data *clist_d = evas_object_data_get(cfront_d->navi, "clist_d");
+ if(clist_d)
+ ctui_list_navi_set(clist_d->list_mode, clist_d);
+ break;
+ }
+ case CT_VIEW_GROUP:
+ phone_group_set_navi(cfront_d->sub_view[cfront_d->select_tab]);
+ break;
+ case CT_VIEW_FAVORITE:
+ phone_favor_set_navi(cfront_d->sub_view[cfront_d->select_tab], PH_FAVOR_MODE_DEFAULT);
+ break;
+ case CT_VIEW_LOG:
+ phone_log_set_navi(cfront_d->navi);
+ break;
+ }
+}
+
+API void ctui_front_view_reset(ct_front_data *cfront_d, int select_index, int op, service_h service)
+{
+ PH_FN_CALL;
+ int call_launched = FALSE;
+ ph_view_info *view_info;
+ Evas_Object *view;
+ char *buf = NULL;
+ int ret;
+ int addressbook_id = 0;
+ int grp_id = 0;
+ char *group_name = NULL;
+
+ elm_toolbar_select_mode_set(cfront_d->tabbar, ELM_OBJECT_SELECT_MODE_NONE);
+
+ cfront_view_reset_current_sub_view(cfront_d);
+ if (cfront_d->sub_view[CT_VIEW_CONTACT])
+ ctui_list_view_resume(cfront_d->navi);
+
+ view = elm_object_part_content_unset(cfront_d->layout, "elm.swallow.content");
+ if (view)
+ evas_object_hide(view);
+
+ elm_toolbar_select_mode_set(cfront_d->tabbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, cfront_d->win, cfront_d->navi, cfront_d->ug, cfront_d->ug_request,
+ cfront_d->cnt_max, cfront_d->ug_data);
+
+ switch (select_index) {
+ case CT_VIEW_CONTACT:
+ if (NULL == cfront_d->sub_view[select_index]) {
+ cfront_d->sub_view[CT_VIEW_CONTACT] = ctui_create_phone_list_view(view_info);
+ }
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, evas_object_data_get(cfront_d->navi, "clist_d"));
+ if (CT_FRONT_CONTACT_NEW == op)
+ ctui_list_new_btn_clicked_cb(evas_object_data_get(cfront_d->navi, "clist_d"), NULL, NULL);
+ else if (CT_FRONT_CONTACT_ADDR == op) {
+ int ab_id = 0;
+ ret = service_get_extra_data(service, "launch_type", &buf);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+
+ if (buf && *buf) {
+ ab_id = atoi(buf);
+ if (0 <= ab_id) {
+ ct_list_data *clist_d;
+ clist_d = evas_object_data_get(cfront_d->navi, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ clist_d->base_ab = ab_id;
+ ctui_list_genlist_update(clist_d);
+ }
+ free(buf);
+ }
+ }
+ else if (CT_FRONT_CONTACT_SEARCH == op) {
+ ret = service_get_extra_data(service, "search_name", &buf);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+ ctui_list_set_search_text(evas_object_data_get(cfront_d->navi, "clist_d"), buf);
+ free(buf);
+ }
+ break;
+ case CT_VIEW_LOG:
+ if (NULL == cfront_d->sub_view[select_index])
+ cfront_d->sub_view[select_index] = phone_create_log_view(view_info);
+ if (!cfront_d->ug)
+ phone_log_missed_info_update(cfront_d->navi);
+ phone_log_set_navi(cfront_d->navi);
+ break;
+ case CT_VIEW_GROUP:
+ if (NULL == cfront_d->sub_view[select_index])
+ cfront_d->sub_view[select_index] = phone_create_group_view(view_info);
+ phone_group_set_navi(cfront_d->sub_view[select_index]);
+
+ ret = service_get_extra_data(service, "addr_id", &buf);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+
+ if (buf)
+ addressbook_id = atoi(buf);
+
+ buf = NULL;
+
+ ret = service_get_extra_data(service, "group_id", &buf);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+
+ if (buf)
+ grp_id = atoi(buf);
+
+ buf = NULL;
+ ret = service_get_extra_data(service, "group_name", &buf);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+ FREEandSTRDUP(group_name, buf);
+
+ free(buf);
+
+ if (CT_FRONT_GROUP_MESSAGE == op) {
+ int list_op;
+ if (-1 == grp_id)
+ list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID;
+ else if (grp_id)
+ list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_GROUP_ID;
+ else
+ list_op = CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OF_ADDRBOOK_ID;
+
+ ctui_create_list_select_view(view_info->navi, phone_group_message_result_cb, evas_object_data_get(cfront_d->sub_view[select_index], "cgroup_d"), list_op, addressbook_id, grp_id, 0);
+ }
+ else if (CT_FRONT_GROUP_EMAIL == op) {
+ int list_op;
+ if (-1 == grp_id)
+ list_op = CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID;
+ else if (grp_id)
+ list_op = CT_GET_LIST_PERSON_HAD_EMAIL_OF_GROUP_ID;
+ else
+ list_op = CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_EMAIL_OF_ADDRBOOK_ID;
+
+ ctui_create_list_select_view(view_info->navi, phone_group_email_result_cb, evas_object_data_get(cfront_d->sub_view[select_index], "cgroup_d"), list_op, addressbook_id, grp_id, 0);
+ }
+ else if (CT_FRONT_GROUP_DETAIL == op) {
+ int list_op;
+ int addressbook_mode;
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_group_list *info;
+
+ info = calloc(1, sizeof(ct_group_list));
+ if (NULL == info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_address_book.mode, &addressbook_mode);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (-1 == grp_id)
+ list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID;
+ else if (grp_id)
+ list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_GROUP_ID;
+ else
+ list_op = CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OF_ADDRBOOK_ID;
+ info->id_ab = addressbook_id;
+ info->id_grp = grp_id;
+ info->name = group_name;
+ info->mode = addressbook_mode;
+ ctui_list_create_contact_view_with_info(view_info, list_op, info);
+
+ free(info);
+ }
+ break;
+ case CT_VIEW_FAVORITE:
+ if (NULL == cfront_d->sub_view[select_index])
+ cfront_d->sub_view[select_index] = phone_favor_create_view(view_info);
+ phone_favor_set_navi(cfront_d->sub_view[select_index], PH_FAVOR_MODE_DEFAULT);
+ break;
+ default:
+ break;
+ }
+
+ cfront_d->select_tab = select_index;
+
+ if (CT_VIEW_NONE < select_index && select_index < CT_VIEW_MAX) {
+ elm_object_part_content_set(cfront_d->layout, "elm.swallow.content", cfront_d->sub_view[select_index]);
+ evas_object_show(cfront_d->sub_view[select_index]);
+ elm_toolbar_item_selected_set(cfront_d->item[select_index], EINA_TRUE);
+ }
+
+ if (cfront_d->win && FALSE == call_launched && CT_VIEW_NONE != select_index){
+ if (EINA_FALSE == evas_object_visible_get(cfront_d->win))
+ evas_object_show(cfront_d->win);
+ evas_event_callback_add(evas_object_evas_get(cfront_d->navi),
+ EVAS_CALLBACK_RENDER_FLUSH_POST, cfront_view_win_activate, cfront_d->win);
+ elm_win_activate(cfront_d->win);
+ }
+ else
+ elm_win_lower(cfront_d->win);
+
+ cfront_d->timer = ecore_timer_add(3.0, ctui_front_view_load_timer, cfront_d);
+
+ free(view_info);
+ PH_FN_END;
+}
+
diff --git a/lib/ct-front/ct-front-view.h b/lib/ct-front/ct-front-view.h
new file mode 100755
index 0000000..84410c9
--- /dev/null
+++ b/lib/ct-front/ct-front-view.h
@@ -0,0 +1,24 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CT_FRONT_VIEW_H__
+#define __CT_FRONT_VIEW_H__
+
+Evas_Object* ct_front_view_create_toolbar(ct_front_data *cfront_d);
+
+#endif /* __CT_FRONT_VIEW_H__ */
+
diff --git a/lib/ct-front/include/ct-front.h b/lib/ct-front/include/ct-front.h
new file mode 100755
index 0000000..785b62f
--- /dev/null
+++ b/lib/ct-front/include/ct-front.h
@@ -0,0 +1,71 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CT_FRONT_H__
+#define __CT_FRONT_H__
+
+#include <app.h>
+
+enum {
+ CT_FRONT_CONTACT_NEW,
+ CT_FRONT_CONTACT_ADDR,
+ CT_FRONT_CONTACT_SEARCH,
+ CT_FRONT_GROUP_MESSAGE,
+ CT_FRONT_GROUP_EMAIL,
+ CT_FRONT_GROUP_DETAIL,
+};
+
+enum CT_VIEW_TYPE {
+ CT_VIEW_NONE = -1,
+ CT_VIEW_CONTACT,
+ CT_VIEW_LOG,
+ CT_VIEW_GROUP,
+ CT_VIEW_FAVORITE,
+ CT_VIEW_MAX,
+};
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *tabbar;
+ Evas_Object *sub_view[CT_VIEW_MAX];
+ Elm_Object_Item *item[CT_VIEW_MAX];
+ bool view_visible[CT_VIEW_MAX];
+ void *ug;
+ char *ug_data;
+ int ug_request;
+ int cnt_max;
+ int select_tab;
+ int auto_rorate_screen;
+ app_device_orientation_e rotate;
+ Ecore_Idler *idler;
+ Ecore_Timer *timer;
+}ct_front_data;
+
+ct_front_data* ctui_front_view_create(Evas_Object *win);
+Eina_Bool ctui_front_view_load_timer(void *data);
+void ctui_front_view_region_changed(ct_front_data *cfront_d);
+void ctui_front_view_reset(ct_front_data *cfront_d, int tab_index, int op, service_h service);
+void ctui_front_view_language_changed(ct_front_data *cfront_d);
+void ctui_front_view_resume(ct_front_data *cfront_d);
+void ctui_front_view_pause(ct_front_data *cfront_d);
+int ctui_front_view_rotate(ct_front_data *cfront_d, app_device_orientation_e orientation);
+
+#endif /* __CT_FRONT_H__ */
+
diff --git a/lib/details/CMakeLists.txt b/lib/details/CMakeLists.txt
new file mode 100755
index 0000000..8a87b1e
--- /dev/null
+++ b/lib/details/CMakeLists.txt
@@ -0,0 +1,24 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${CT_DETAILS})
+
+FILE(GLOB SRCS *.c)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(details_pkgs REQUIRED icu-i18n)
+
+FOREACH(flag ${details_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${TARGET} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
+TARGET_LINK_LIBRARIES(${TARGET} ${COMMON_LIB} ${ug_pkgs_LDFLAGS} ${details_pkgs_LDFLAGS})
+
+ADD_DEPENDENCIES(${TARGET} contacts_edj_build image_layout_edj_build detail_theme_edj_build)
+
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/details/contacts-details-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/details/base_addrbook b/lib/details/base_addrbook
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/details/base_addrbook
diff --git a/lib/details/contacts-details-efl.xml b/lib/details/contacts-details-efl.xml
new file mode 100644
index 0000000..1896de3
--- /dev/null
+++ b/lib/details/contacts-details-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="contacts-details-efl" version="0.1.0-0" install-location="internal-only">
+ <label>contacts-details</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>contacts-details-efl Application</description>
+ <ui-application appid="contacts-details-efl" exec="/usr/ug/bin/contacts-details-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.contacts.png</icon>
+ <label>contacts-details</label>
+ <label xml:lang="en-us">contacts-details</label>
+ <label xml:lang="nl-nl">contacts-details</label>
+ <label xml:lang="de-de">contacts-details</label>
+ <label xml:lang="en-gb">contacts-details</label>
+ <label xml:lang="zh-hk">contacts-details</label>
+ <label xml:lang="zh-cn">contacts-details</label>
+ <label xml:lang="ru-ru">contacts-details</label>
+ <label xml:lang="zh-tw">contacts-details</label>
+ <label xml:lang="ja-jp">contacts-details</label>
+ <label xml:lang="es-es">contacts-details</label>
+ <label xml:lang="el-gr">contacts-details</label>
+ <label xml:lang="it-it">contacts-details</label>
+ <label xml:lang="tr-tr">contacts-details</label>
+ <label xml:lang="pt-pt">contacts-details</label>
+ <label xml:lang="fr-fr">contacts-details</label>
+ <label xml:lang="ko-kr">contacts-details</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/lib/details/ct-detail-activity.c b/lib/details/ct-detail-activity.c
new file mode 100755
index 0000000..bd59617
--- /dev/null
+++ b/lib/details/ct-detail-activity.c
@@ -0,0 +1,263 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include "phone.h"
+#include "phone-common.h"
+#include <account-types.h>
+#include <account.h>
+
+typedef struct
+{
+ int activity_id;
+ int contact_id;
+ int address_book_id;
+ char *acc_name;
+ char *status;
+ int time;
+ char *data;
+ char *icon_path;
+}ct_detail_activity_info;
+
+enum ACTIVITY_ITC_TYPE {
+ ACTIVITY_ITC_NUM_UTIL_BTN = 0,
+ ACTIVITY_ITC_ACTIVITY,
+ ACTIVITY_ITC_ACTIVITY_NO_IMG,
+ ACTIVITY_ITC_MAX,
+};
+
+static Elm_Genlist_Item_Class activity_itcs[] = {
+ {.item_style="detail.3icon"},
+ {.item_style="activity_list"},
+ {.item_style="activity_list_no_img"},
+};
+
+static void detail_activity_fill_genlist(ct_activity_data *cactivity_d)
+{
+ PH_FN_CALL;
+ Evas_Object *genlist;
+ Eina_List *l;
+ ct_detail_activity_info *l_info;
+
+ if (NULL == cactivity_d->activity_genlist) {
+ genlist = elm_genlist_add(cactivity_d->layout);
+ elm_object_theme_set(genlist, cactivity_d->th);
+ cactivity_d->activity_genlist = genlist;
+ evas_object_data_set(genlist, "cactivity_d", cactivity_d);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ }
+ else {
+ genlist = cactivity_d->activity_genlist;
+ elm_genlist_clear(genlist);
+ }
+
+ EINA_LIST_FOREACH(cactivity_d->list, l, l_info) {
+ /* Temporary code need to fix l_info->data for activity image*/
+ /*
+ if (l_info->data && *l_info->data)
+ elm_genlist_item_append(genlist, &activity_itcs[ACTIVITY_ITC_ACTIVITY], l_info, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, l_info);
+ else */
+ elm_genlist_item_append(genlist, &activity_itcs[ACTIVITY_ITC_ACTIVITY_NO_IMG], l_info, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, l_info);
+ }
+}
+
+static Evas_Object *detail_activity_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_detail_activity_info * l_info = data;
+
+ char buf[PATH_MAX]={0};
+ Evas_Object *ic;
+
+ ic = elm_icon_add(obj);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add() return NULL");
+
+ // Temporary code need to fix l_info->data for activity image
+ if (0 == strcmp(part, "elm.icon.2")) {
+ if ('\0' == *l_info->data)
+ return NULL;
+
+ snprintf(buf, sizeof(buf), "%s", l_info->data);
+ elm_icon_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return ic;
+ }
+ else if (0 == strcmp(part, "elm.icon.1")) {
+ if (NULL == l_info->icon_path || '\0' == *l_info->icon_path)
+ return NULL;
+ elm_icon_file_set(ic, l_info->icon_path, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return ic;
+ }
+ else
+ return NULL;
+}
+
+static char* detail_activity_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_detail_activity_info * activity_info = data;
+ ct_activity_data *cactivity_d;
+ cactivity_d = evas_object_data_get(obj, "cactivity_d");
+ if (0 == strcmp(part, "elm.text.1")) {
+ return SAFE_STRDUP(activity_info->status);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ return phone_detail_log_get_time(cactivity_d->hformatter, activity_info->time);
+ }
+ return NULL;
+}
+
+void ct_detail_activity_create_itcs()
+{
+ activity_itcs[ACTIVITY_ITC_ACTIVITY].func.text_get = detail_activity_gl_label_get;
+ activity_itcs[ACTIVITY_ITC_ACTIVITY].func.content_get = detail_activity_gl_icon_get;
+
+ activity_itcs[ACTIVITY_ITC_ACTIVITY_NO_IMG].func.text_get = detail_activity_gl_label_get;
+ activity_itcs[ACTIVITY_ITC_ACTIVITY_NO_IMG].func.content_get = detail_activity_gl_icon_get;
+}
+
+void ct_detail_activity_load_data(ct_activity_data *cactivity_d)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list_activity = NULL;
+ contacts_record_h record_activity = NULL;
+ Eina_List *list = NULL;
+ int count = 0;
+ int i = 0;
+
+ err = phone_cts_get_list(_contacts_contact_activity._uri, _contacts_contact_activity.person_id, cactivity_d->person_id, &list_activity);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list(list_activity) Failed(%d)", err);
+
+ while (CONTACTS_ERROR_NONE == err) {
+ ct_detail_activity_info *activity_info;
+
+ err = contacts_list_get_current_record_p(list_activity, &record_activity);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ activity_info = calloc(1, sizeof(ct_detail_activity_info));
+
+ err = contacts_record_get_int(record_activity, _contacts_contact_activity.activity_id, &(activity_info->activity_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(id) Failed(%d)", err);
+ err = contacts_record_get_int(record_activity, _contacts_contact_activity.contact_id, &(activity_info->contact_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(contact_id) Failed(%d)", err);
+ err = contacts_record_get_int(record_activity, _contacts_contact_activity.address_book_id, &(activity_info->address_book_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(address_book_id) Failed(%d)", err);
+ err = contacts_record_get_str(record_activity, _contacts_contact_activity.source_name, &(activity_info->acc_name));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(source_name) Failed(%d)", err);
+ err = contacts_record_get_str(record_activity, _contacts_contact_activity.status, &(activity_info->status));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(status) Failed(%d)", err);
+ err = contacts_record_get_int(record_activity, _contacts_contact_activity.timestamp, &(activity_info->time));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(timestamp) Failed(%d)", err);
+ for (i = 0; i < cactivity_d->acc_cnt; i++) {
+ if (cactivity_d->acc_types[i].id == activity_info->address_book_id)
+ activity_info->icon_path = cactivity_d->acc_types[i].icon_path;
+ }
+ /* Need To Fix Facebook Sync Data*/
+ /*
+ err = contacts_record_get_str(record_activity, _contacts_contact_activity.sync_data1, &(activity_info->data));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(sync_data1) Failed(%d)", err);
+ */
+
+ list = eina_list_append(list, (void*)activity_info);
+ PH_DBG("status = %s", activity_info->status);
+
+ err = contacts_list_next(list_activity);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+
+ err = contacts_list_destroy(list_activity, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy(list_activity) Failed(%d)", err);
+ cactivity_d->list = list;
+}
+
+static void detail_activity_free_list(ct_activity_data *cactivity_d)
+{
+ ct_detail_activity_info *l_info;
+
+ EINA_LIST_FREE(cactivity_d->list, l_info) {
+ if (NULL == l_info) continue;
+ free(l_info->acc_name);
+ free(l_info->status);
+ free(l_info->data);
+ free(l_info);
+ }
+ cactivity_d->list = NULL;
+}
+
+static void detail_activity_view_delete_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ ct_activity_data *cactivity_d = data;
+
+ detail_activity_free_list(cactivity_d);
+
+ if (cactivity_d->activity_genlist)
+ evas_object_del(cactivity_d->activity_genlist);
+
+ if (cactivity_d->th) {
+ elm_theme_extension_del(cactivity_d->th, DETAIL_THEME_EDJ);
+ elm_theme_free(cactivity_d->th);
+ }
+
+ free(cactivity_d);
+}
+
+static void detail_activity_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_activity_data *cactivity_d = (ct_activity_data *)data;
+ elm_naviframe_item_pop(cactivity_d->navi);
+}
+
+static void detail_activity_back_btn(ct_activity_data *cactivity_d)
+{
+ Evas_Object *back_btn;
+ back_btn = elm_button_add(cactivity_d->navi);
+ p_retm_if(NULL == back_btn, "elm_button_add() return NULL");
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ elm_object_item_part_content_set(cactivity_d->navi_item, "prev_btn", back_btn);
+ evas_object_smart_callback_add(back_btn, "clicked", detail_activity_back_btn_cb, cactivity_d);
+}
+
+static void detail_activity_set_navi(ct_activity_data *cactivity_d)
+{
+ p_retm_if(NULL == cactivity_d->navi_item, "navi item is NULL");
+
+ phone_navi_item_clear(cactivity_d->navi_item);
+ detail_activity_back_btn(cactivity_d);
+}
+
+void ct_detail_activity_fill_layout(ct_activity_data *cactivity_d)
+{
+ Evas_Object *layout;
+
+ layout = phone_create_base_layout(cactivity_d->navi, false);
+ cactivity_d->layout = layout;
+
+ detail_activity_fill_genlist(cactivity_d);
+ elm_object_part_content_set(layout, "elm.swallow.content", cactivity_d->activity_genlist);
+
+ cactivity_d->navi_item = elm_naviframe_item_push(cactivity_d->navi, "Activity", NULL, NULL, cactivity_d->layout, NULL);
+ elm_naviframe_item_title_visible_set(cactivity_d->navi_item, EINA_TRUE);
+ evas_object_event_callback_add(cactivity_d->layout, EVAS_CALLBACK_DEL, detail_activity_view_delete_cb, cactivity_d);
+ detail_activity_set_navi(cactivity_d);
+}
diff --git a/lib/details/ct-detail-activity.h b/lib/details/ct-detail-activity.h
new file mode 100755
index 0000000..057aa81
--- /dev/null
+++ b/lib/details/ct-detail-activity.h
@@ -0,0 +1,27 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CONTACTS_DETAIL_ACTIVITY_H__
+#define __CONTACTS_DETAIL_ACTIVITY_H__
+
+#include "phone-common.h"
+
+void ct_detail_activity_create_itcs();
+void ct_detail_activity_load_data(ct_activity_data *cactivity_d);
+void ct_detail_activity_fill_layout(ct_activity_data *cactivity_d);
+
+#endif //__CONTACTS_DETAIL_ACTIVITY_H__
diff --git a/lib/details/ct-detail-history.c b/lib/details/ct-detail-history.c
new file mode 100755
index 0000000..a209f67
--- /dev/null
+++ b/lib/details/ct-detail-history.c
@@ -0,0 +1,876 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include "phone.h"
+#include "ct-detail-history.h"
+#include "ct-detail-utils.h"
+#include "ct-detail-view.h"
+
+typedef struct
+{
+ int plog_id;
+ int plog_type;
+ int plog_time;
+ int plog_duration;
+ int plog_msgid;
+ int group_index;
+ char *plog_number;
+ char *plog_shortmsg;
+ Eina_Bool checked;
+}ct_detail_history_info;
+
+enum HISTORY_ITC_TYPE {
+ HISTORY_ITC_NUM_UTIL_BTN = 0,
+ HISTORY_ITC_HISTORY,
+ HISTORY_ITC_DATE,
+ HISTORY_ITC_SELECT_ALL,
+ HISTORY_ITC_MAX,
+};
+
+static Elm_Genlist_Item_Class history_itcs[] = {
+ {.item_style="detail.3icon"},
+ {.item_style="history_list"},
+ {.item_style="grouptitle"},
+ {.item_style="1icon"},
+};
+
+static void detail_history_check_del(ct_history_data *chistory_d);
+static void detail_history_set_navi(ct_history_data *chistory_d, int mode);
+static Eina_Bool detail_history_refresh_view(void *data);
+
+void ct_detail_history_changed_cb(const char *view_uri, void *data)
+{
+ ct_history_data *chistory_d = data;
+
+ if (chistory_d->updating) return;
+ if (chistory_d->idler) {
+ ecore_idler_del(chistory_d->idler);
+ chistory_d->idler = NULL;
+ }
+ chistory_d->idler = ecore_idler_add(detail_history_refresh_view, chistory_d);
+}
+
+static void detail_history_delete_records_cb(int err, void *data)
+{
+ ct_history_data *chistory_d = data;
+ ph_progress_info *p_info = NULL;
+
+ p_retm_if(NULL == chistory_d, "Invalid parameter(chistory_d is NULL)");
+ p_info = chistory_d->p_info;
+ p_retm_if(NULL == p_info, "Invalid parameter(p_info is NULL)");
+
+ if (p_info->update_ids) {
+ free(p_info->update_ids);
+ p_info->update_ids = NULL;
+ }
+
+ if (CONTACTS_ERROR_NONE != err || p_info->alive == false) {
+ if (p_info->popup) {
+ evas_object_del(p_info->popup);
+ p_info->popup = NULL;
+ }
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ free(p_info);
+ chistory_d->p_info = NULL;
+ chistory_d->updating = false;
+ elm_genlist_decorate_mode_set(chistory_d->history_genlist, EINA_FALSE);
+ chistory_d->view_mode = DETAIL_VIEW_MODE_HISTORY;
+ ct_detail_history_changed_cb(_contacts_phone_log._uri, chistory_d);
+ return;
+ }
+ else if (p_info->cnt == p_info->cnt_checked_total) {
+ if (p_info->popup) {
+ evas_object_del(p_info->popup);
+ p_info->popup = NULL;
+ }
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ free(p_info);
+ chistory_d->p_info = NULL;
+ chistory_d->updating = false;
+ elm_genlist_decorate_mode_set(chistory_d->history_genlist, EINA_FALSE);
+ chistory_d->view_mode = DETAIL_VIEW_MODE_HISTORY;
+ ct_detail_history_changed_cb(_contacts_phone_log._uri, chistory_d);
+ return;
+ }
+ else {
+ detail_history_check_del(chistory_d);
+ }
+}
+
+static void detail_history_check_del(ct_history_data *chistory_d)
+{
+ const int DETAIL_BULK_LENGTH = 50;
+ char percent_total[PH_TEXT_MAX_LEN+1] = {0, };
+ char percent[PH_TEXT_MAX_LEN+1] = {0, };
+ int *ids = NULL;
+ double value = 0.0;
+ int count = 0;
+ int base_count = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_progress_info *p_info = chistory_d->p_info;
+ Eina_List *l;
+ ct_detail_history_info *l_info;
+
+ if (p_info->cnt_checked_total - p_info->cnt < DETAIL_BULK_LENGTH)
+ ids = calloc(1, sizeof(int) * (p_info->cnt_checked_total - p_info->cnt));
+ else
+ ids = calloc(1, sizeof(int) * DETAIL_BULK_LENGTH);
+ p_retm_if(NULL == ids, "calloc() return NULL");
+
+ EINA_LIST_FOREACH(chistory_d->list, l, l_info) {
+ if (!l_info) continue;
+ if (TRUE == l_info->checked) {
+ if (base_count < p_info->cnt) {
+ base_count++;
+ continue;
+ }
+
+ ids[count++] = l_info->plog_id;
+ if (DETAIL_BULK_LENGTH == count || (count + p_info->cnt) == p_info->cnt_checked_total) {
+ p_info->cnt += count;
+ break;
+ }
+ }
+ }
+ value = (double)p_info->cnt / (double)p_info->cnt_checked_total;
+ elm_progressbar_value_set(p_info->progressbar, value);
+ snprintf(percent, sizeof(percent), "%d%%", (int)(100.0 * (double)p_info->cnt/(double)p_info->cnt_checked_total));
+ snprintf(percent_total, sizeof(percent_total), "%d/%d", p_info->cnt, p_info->cnt_checked_total);
+ edje_object_part_text_set(elm_layout_edje_get(p_info->layout), "elm.text.subtext1", percent);
+ edje_object_part_text_set(elm_layout_edje_get(p_info->layout), "elm.text.subtext2", percent_total);
+
+ p_info->update_ids = ids;
+ err = contacts_db_delete_records_async(_contacts_phone_log._uri, ids, count, detail_history_delete_records_cb, chistory_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_delete_records_async() Failed(%d)", err);
+}
+
+static void detail_history_del_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_history_data *chistory_d = data;
+ ph_progress_info *p_info;
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc return NULL");
+
+ chistory_d->updating = true;
+
+ chistory_d->p_info = p_info;
+ p_info->cnt_checked_total = chistory_d->cnt_checked;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->popup = phone_progressbar_popup(chistory_d->win, p_info, T_(PH_GET_TEXT_BASIC, PHTEXT_DELETING_LOGS));
+ detail_history_check_del(chistory_d);
+}
+
+static void detail_history_all_items_checked_set(Eina_List *list,
+ Eina_Bool checked)
+{
+ Eina_List *l;
+ ct_detail_history_info *info;
+
+ EINA_LIST_FOREACH(list, l, info) {
+ if (NULL == info) {
+ ERR("elm_object_item_data_get() return NULL");
+ continue;
+ }
+ info->checked = checked;
+ }
+}
+
+static void detail_history_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_history_data *chistory_d = (ct_history_data *)data;
+ elm_naviframe_item_pop(chistory_d->navi);
+}
+
+static void detail_history_back_btn(ct_history_data *chistory_d)
+{
+ Evas_Object *back_btn;
+ back_btn = elm_button_add(chistory_d->navi);
+ p_retm_if(NULL == back_btn, "elm_button_add() return NULL");
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ elm_object_item_part_content_set(chistory_d->navi_item, "prev_btn", back_btn);
+ evas_object_smart_callback_add(back_btn, "clicked", detail_history_back_btn_cb, chistory_d);
+}
+
+static void detail_history_edit_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_history_data *chistory_d = data;
+
+ chistory_d->view_mode = DETAIL_VIEW_MODE_CHECK;
+
+ if (chistory_d->popup)
+ evas_object_del(chistory_d->popup);
+
+ elm_genlist_decorate_mode_set(chistory_d->history_genlist, EINA_TRUE);
+
+ chistory_d->select_all_item = elm_genlist_item_prepend(chistory_d->history_genlist, &history_itcs[HISTORY_ITC_SELECT_ALL],
+ chistory_d, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(chistory_d->select_all_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ phone_show_notify(chistory_d->layout, T_(PH_GET_TEXT_BASE_OP, PHTEXT_SELECT_LOGS));
+ detail_history_set_navi(chistory_d, DETAIL_VIEW_MODE_CHECK);
+}
+
+static void detail_history_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_history_data *chistory_d = data;
+ evas_object_del(chistory_d->popup);
+ chistory_d->popup = NULL;
+ elm_object_tree_focus_allow_set(chistory_d->navi, EINA_TRUE);
+}
+
+static void detail_history_more_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int rotate;
+ ct_history_data *chistory_d = data;
+ int x,y,w,h;
+
+ if (chistory_d->popup)
+ detail_history_popup_hide_cb(chistory_d, NULL, NULL);
+
+ chistory_d->popup = elm_ctxpopup_add(chistory_d->navi);
+ p_retm_if(NULL == chistory_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(chistory_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(chistory_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(chistory_d->popup, "dismissed", detail_history_popup_hide_cb, chistory_d);
+
+ evas_object_geometry_get(chistory_d->ctrl_button, &x, &y, &w, &h);
+ elm_ctxpopup_item_append(chistory_d->popup, S_(PH_SYS_SK_DELETE), NULL,
+ detail_history_edit_btn_clicked_cb, chistory_d);
+ evas_object_move(chistory_d->popup, w/2, y+h/2);
+ evas_object_show(chistory_d->popup);
+}
+
+static void detail_history_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_history_data *chistory_d = data;
+ phone_hide_notify(chistory_d->layout);
+
+ if (chistory_d->select_all_item) {
+ elm_object_item_del(chistory_d->select_all_item);
+ chistory_d->select_all_item = NULL;
+ }
+ detail_history_all_items_checked_set(chistory_d->list, EINA_FALSE);
+ elm_genlist_decorate_mode_set(chistory_d->history_genlist, EINA_FALSE);
+ detail_history_set_navi(chistory_d, DETAIL_VIEW_MODE_HISTORY);
+}
+
+static void detail_history_set_navi(ct_history_data *chistory_d, int mode)
+{
+ Evas_Object *cancel_button = NULL;
+
+ chistory_d->cnt_checked = 0;
+ chistory_d->view_mode = mode;
+ p_retm_if(NULL == chistory_d->navi_item, "navi item is NULL");
+
+ phone_navi_item_clear(chistory_d->navi_item);
+
+ if (DETAIL_VIEW_MODE_HISTORY == mode) {
+ detail_history_back_btn(chistory_d);
+ chistory_d->ctrl_button = ctui_create_more_btn(chistory_d->navi, detail_history_more_btn_clicked_cb, chistory_d);
+ elm_object_item_part_content_set(chistory_d->navi_item, "toolbar_more_btn", chistory_d->ctrl_button);
+ if (chistory_d->list_count <= 0)
+ elm_object_disabled_set(chistory_d->ctrl_button, EINA_TRUE);
+ }
+ else if (DETAIL_VIEW_MODE_CHECK == mode) {
+ chistory_d->ctrl_button = phone_create_toolbar_btn(chistory_d->navi, S_(PH_SYS_SK_DELETE), detail_history_del_btn_clicked_cb, chistory_d);
+ elm_object_item_part_content_set(chistory_d->navi_item, "toolbar_button1", chistory_d->ctrl_button);
+ elm_object_disabled_set(chistory_d->ctrl_button, EINA_TRUE);
+
+ cancel_button = phone_create_toolbar_btn(chistory_d->navi, S_(PH_SYS_SK_CANCEL), detail_history_cancel_btn_cb, chistory_d);
+ elm_object_item_part_content_set(chistory_d->navi_item, "toolbar_button2", cancel_button);
+ }
+}
+
+static void detail_history_check_update_selection_info(ct_history_data *chistory_d)
+{
+ if (chistory_d->cnt_checked == 0)
+ phone_show_notify(chistory_d->layout, T_(PH_GET_TEXT_BASE_OP, PHTEXT_SELECT_LOGS));
+ else {
+ char info_text[PH_TEXT_SHORT_LEN]={0};
+ snprintf(info_text, sizeof(info_text), "%s (%d)", S_(PH_SYS_POP_SELECTED),
+ chistory_d->cnt_checked);
+ phone_show_notify(chistory_d->layout, info_text);
+ }
+}
+
+static void detail_history_check_update_button_status(ct_history_data *chistory_d)
+{
+ Eina_Bool disabled;
+ p_retm_if(NULL == chistory_d, "parameter is NULL");
+ p_retm_if(NULL == chistory_d->ctrl_button, "ctrl_item is NULL");
+
+ if (0 == chistory_d->list_count)
+ disabled = EINA_TRUE;
+ else if (chistory_d->history_genlist && elm_genlist_decorate_mode_get(chistory_d->history_genlist)) {
+ if (0 < chistory_d->cnt_checked)
+ disabled = EINA_FALSE;
+ else
+ disabled = EINA_TRUE;
+ }
+ else
+ disabled = EINA_FALSE;
+
+ elm_object_disabled_set(chistory_d->ctrl_button, disabled);
+}
+
+static void detail_history_check_select_all(void *data, Eina_Bool checked)
+{
+ Eina_List *l;
+ Elm_Object_Item *item;
+ ct_detail_history_info *l_info;
+ ct_history_data *chistory_d = data;
+
+ if (checked)
+ chistory_d->cnt_checked = chistory_d->list_count;
+ else
+ chistory_d->cnt_checked = 0;
+
+ EINA_LIST_FOREACH(chistory_d->list, l, l_info) {
+ if (!l_info) continue;
+ l_info->checked = checked;
+ }
+
+ item = elm_genlist_item_next_get(chistory_d->select_all_item);
+ while (item) {
+ elm_genlist_item_update(item);
+ item = elm_genlist_item_next_get(item);
+ }
+
+ detail_history_check_update_selection_info(chistory_d);
+ detail_history_check_update_button_status(chistory_d);
+}
+
+static void detail_history_append_separate_date_index(ct_history_data *chistory_d, void *data, int index)
+{
+ ct_detail_history_info *l_info = data;
+ Elm_Object_Item *item;
+ int type = phone_detail_log_get_date_type(l_info->plog_time, l_info->plog_duration);
+
+ if (0 == index || chistory_d->pre_date_type != type) {
+ chistory_d->pre_date_type = type;
+ l_info->group_index = type;
+ item = elm_genlist_item_append(chistory_d->history_genlist, &history_itcs[HISTORY_ITC_DATE], data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+}
+static void detail_history_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ ct_detail_history_info *l_info = data;
+ ct_history_data *chistory_d = evas_object_data_get(obj, "chistory_d");
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (elm_genlist_decorate_mode_get(chistory_d->history_genlist)) {
+ l_info->checked = !l_info->checked;
+ if (l_info->checked)
+ chistory_d->cnt_checked++;
+ else
+ chistory_d->cnt_checked--;
+
+ elm_genlist_item_fields_update(event_info, "elm.edit.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT);
+
+ if (chistory_d->select_all_layout) {
+ Evas_Object *check;
+ check = elm_object_part_content_get(chistory_d->select_all_layout, "elm.icon");
+ if (chistory_d->cnt_checked == chistory_d->list_count)
+ elm_check_state_set(check, EINA_TRUE);
+ else
+ elm_check_state_set(check, EINA_FALSE);
+ }
+ detail_history_check_update_selection_info(chistory_d);
+ detail_history_check_update_button_status(chistory_d);
+ }
+}
+
+static void detail_history_fill_genlist(ct_history_data *chistory_d)
+{
+ Evas_Object *genlist;
+ Evas_Object *layout;
+ Eina_List *l;
+ int count;
+ ct_detail_history_info *l_info;
+
+ layout = elm_object_part_content_get(chistory_d->layout, "contents");
+
+ if (NULL == chistory_d->history_genlist) {
+ genlist = elm_genlist_add(layout);
+ elm_object_theme_set(genlist, chistory_d->th);
+ chistory_d->history_genlist = genlist;
+ evas_object_data_set(genlist, "chistory_d", chistory_d);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ }
+ else {
+ genlist = chistory_d->history_genlist;
+ elm_genlist_clear(genlist);
+ }
+
+ count = 0;
+ EINA_LIST_FOREACH(chistory_d->list, l, l_info) {
+ detail_history_append_separate_date_index(chistory_d, l_info, count);
+ elm_genlist_item_append(genlist, &history_itcs[HISTORY_ITC_HISTORY], l_info, NULL,
+ ELM_GENLIST_ITEM_NONE, detail_history_gl_sel, l_info);
+ count++;
+ }
+}
+
+static void detail_history_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_history_data *chistory_d = data;
+
+ if (elm_check_state_get(obj))
+ chistory_d->cnt_checked++;
+ else
+ chistory_d->cnt_checked--;
+
+ if (chistory_d->select_all_layout) {
+ Evas_Object *check;
+ check = elm_object_part_content_get(chistory_d->select_all_layout, "elm.icon");
+ if (chistory_d->cnt_checked == chistory_d->list_count)
+ elm_check_state_set(check, EINA_TRUE);
+ else
+ elm_check_state_set(check, EINA_FALSE);
+ }
+ detail_history_check_update_selection_info(chistory_d);
+ detail_history_check_update_button_status(chistory_d);
+}
+
+static char* detail_history_gl_sep_date_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_detail_history_info * history_info = data;
+ const char *when;
+ int index = history_info->group_index;
+
+ if (0 == strcmp(part, "elm.text")) {
+ char *date_temp;
+ ct_history_data *chistory_d;
+
+ if (0 == index)
+ when = S_(PH_SYS_BODY_TODAY);
+ else if (1 == index)
+ when = S_(PH_SYS_BODY_YESTERDAY);
+ else
+ when = S_(PH_SYS_BODY_PREVIOUS);
+
+ chistory_d = evas_object_data_get(obj, "chistory_d");
+ date_temp = phone_detail_log_get_date(chistory_d->hformatter, history_info->plog_time);
+ if (date_temp) {
+ char buf[PATH_MAX]={0};
+ snprintf(buf, sizeof(buf), " %s (%s)", when, date_temp);
+ free(date_temp);
+ return strdup(buf);
+ }
+ else
+ return strdup(when);
+ }
+ else
+ return NULL;
+}
+
+static Evas_Object *detail_history_gl_select_all_icon_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ Evas_Object *check;
+ ct_history_data *chistory_d = data;
+
+ p_retvm_if(NULL == chistory_d, NULL, "evas_object_data_get() return NULL");
+ if (0 == strcmp(part, "elm.icon")) {
+ chistory_d->select_all_layout = phone_create_select_all(chistory_d->history_genlist, S_(PH_SYS_BODY_SELECT_ALL), detail_history_check_select_all, chistory_d);
+ check = elm_object_part_content_get(chistory_d->select_all_layout, "elm.icon");
+ if (chistory_d->cnt_checked == chistory_d->list_count)
+ elm_check_state_set(check, EINA_TRUE);
+ return chistory_d->select_all_layout;
+ }
+ return NULL;
+}
+
+static void detail_history_gl_select_all_del(void *data, Evas_Object *obj)
+{
+ ct_history_data *chistory_d = data;
+ chistory_d->select_all_layout = NULL;
+}
+
+static Evas_Object *detail_history_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_detail_history_info * l_detail_info = data;
+ char buf[PATH_MAX]={0};
+ Evas_Object *ic;
+
+ if (0 == strcmp(part, "elm.icon.2")) {
+ char *made_data = phone_detail_log_get_icon_type(l_detail_info->plog_type);
+ snprintf(buf, sizeof(buf), "%s", made_data);
+ free(made_data);
+ }
+ else if (0 == strcmp(part, "elm.icon.1")) {
+ char *made_data = phone_detail_log_get_icon_path_with_action(l_detail_info->plog_type);
+ snprintf(buf, sizeof(buf), "%s", made_data);
+ free(made_data);
+ }
+ else if (0 == strcmp(part, "elm.edit.icon.1")) {
+ ct_history_data *chistory_d = evas_object_data_get(obj, "chistory_d");
+ Evas_Object *check;
+ check = elm_check_add(obj);
+ p_retvm_if(NULL == check, NULL, "elm_check_add() return NULL");
+ elm_check_state_pointer_set(check, &l_detail_info->checked);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ evas_object_smart_callback_add(check, "changed", detail_history_check_changed_cb, chistory_d);
+ return check;
+ }
+ else
+ return NULL;
+ ic = elm_icon_add(obj);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return ic;
+}
+
+static char* detail_history_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_detail_history_info * history_info = data;
+ ct_history_data *chistory_d;
+ char *time;
+ char *duration;
+ char buf[PATH_MAX] = {0};
+ chistory_d = evas_object_data_get(obj, "chistory_d");
+
+ if (0 == strcmp(part, "elm.text.1")) {
+ snprintf(buf, sizeof(buf), "%s", history_info->plog_number);
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ if (TRUE == phone_detail_log_is_call_ing_type(history_info->plog_type)) {
+ duration = phone_detail_log_get_duration_from_number(history_info->plog_duration);
+ snprintf(buf, sizeof(buf), "%s", duration);
+ free(duration);
+ return strdup(buf);
+ }
+ else if (TRUE == phone_detail_log_is_sms_type(history_info->plog_type)
+ || TRUE == phone_detail_log_is_mms_type(history_info->plog_type)) {
+ if (history_info->plog_shortmsg && *history_info->plog_shortmsg) {
+ snprintf(buf, sizeof(buf), "%s", history_info->plog_shortmsg);
+ return strdup(buf);
+ }
+ }
+ else if (TRUE == phone_detail_log_is_email_type(history_info->plog_type)) {
+ if (history_info->plog_shortmsg && *history_info->plog_shortmsg) {
+ snprintf(buf, sizeof(buf), "%s", history_info->plog_shortmsg);
+ return strdup(buf);
+ }
+ }
+ }
+ else if (0 == strcmp(part, "elm.text.3")) {
+ time = phone_detail_log_get_time(chistory_d->hformatter, history_info->plog_time);
+ snprintf(buf, sizeof(buf), "%s", time);
+ free(time);
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+void ct_detail_history_create_itcs()
+{
+ history_itcs[HISTORY_ITC_SELECT_ALL].func.content_get = detail_history_gl_select_all_icon_get;
+ history_itcs[HISTORY_ITC_SELECT_ALL].func.del = detail_history_gl_select_all_del;
+ history_itcs[HISTORY_ITC_SELECT_ALL].decorate_all_item_style = NULL;
+
+ history_itcs[HISTORY_ITC_NUM_UTIL_BTN].func.content_get = ct_detail_gl_number_util_icon_get;
+
+ history_itcs[HISTORY_ITC_DATE].func.text_get = detail_history_gl_sep_date_label_get;
+
+ history_itcs[HISTORY_ITC_HISTORY].func.text_get = detail_history_gl_label_get;
+ history_itcs[HISTORY_ITC_HISTORY].func.content_get = detail_history_gl_icon_get;
+ history_itcs[HISTORY_ITC_HISTORY].decorate_all_item_style = "edit_default";
+}
+
+void ct_detail_history_load_data(ct_history_data *chistory_d)
+{
+ Eina_List *list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list_phonelog = NULL;
+ contacts_record_h record_phonelog = NULL;
+ int count = 0;
+
+ err = phone_cts_get_list(_contacts_person_phone_log._uri, _contacts_person_phone_log.person_id, chistory_d->person_id, &list_phonelog);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() Failed(%d)", err);
+
+ while (CONTACTS_ERROR_NONE == err) {
+ char *msg = NULL;
+ char *number;
+ ct_detail_history_info *history_info;
+
+ err = contacts_list_get_current_record_p(list_phonelog, &record_phonelog);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ history_info = calloc(1, sizeof(ct_detail_history_info));
+
+ err = contacts_record_get_str_p(record_phonelog, _contacts_person_phone_log.address, &number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(address) Failed(%d)", err);
+ history_info->plog_number = SAFE_STRDUP(number);
+ err = contacts_record_get_int(record_phonelog, _contacts_person_phone_log.log_id, &(history_info->plog_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(id) Failed(%d)", err);
+ err = contacts_record_get_int(record_phonelog, _contacts_person_phone_log.log_type, &(history_info->plog_type));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(log_type) Failed(%d)", err);
+ err = contacts_record_get_int(record_phonelog, _contacts_person_phone_log.log_time, &(history_info->plog_time));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(log_time) Failed(%d)", err);
+ err = contacts_record_get_int(record_phonelog, _contacts_person_phone_log.extra_data1, &(history_info->plog_duration));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(duration) Failed(%d)", err);
+ err = contacts_record_get_str_p(record_phonelog, _contacts_person_phone_log.extra_data2, &msg);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(shortmsg) Failed(%d)", err);
+ if (msg) {
+ int i;
+ char temp[PH_TEXT_MAX_LEN];
+ for (i=0;i<strlen(msg);i++) {
+ if (msg[i] =='\n')
+ temp[i] = ' ';
+ else
+ temp[i] = msg[i];
+ }
+ temp[i] = '\0';
+ history_info->plog_shortmsg = strdup(temp);
+ }
+ list = eina_list_append(list, (void*)history_info);
+ count++;
+ err = contacts_list_next(list_phonelog);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+
+ chistory_d->list = list;
+ chistory_d->list_count = count;
+}
+
+static void detail_history_view_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *layout;
+ Evas_Object *scroller;
+ Evas_Object *box;
+ int rotate;
+ ct_history_data *chistory_d = data;
+
+ if (0 < chistory_d->list_count)
+ return;
+
+ rotate = (int)evas_object_data_get(chistory_d->navi, "phone_rotate");
+
+ if (90 == rotate || 270 == rotate) {
+ layout = elm_object_part_content_get(chistory_d->layout, "contents");
+ p_retm_if(NULL == layout, "elm_object_part_content_get() return NULL");
+ scroller = elm_object_part_content_get(layout, "elm.swallow.content");
+ p_retm_if(NULL == scroller, "elm_object_part_content_get() return NULL");
+ box = elm_object_content_get(scroller);
+ p_retm_if(NULL == box, "elm_object_content_get() return NULL");
+ elm_box_unpack(box, chistory_d->noc);
+ p_retm_if(NULL == chistory_d->noc, "elm_box_unpack() return NULL");
+ evas_object_size_hint_weight_set(chistory_d->noc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(chistory_d->noc, EVAS_HINT_FILL, 0.0);
+ elm_box_pack_end(box, chistory_d->noc);
+ elm_object_content_set(scroller, box);
+ evas_object_size_hint_min_set(box, 720, 650);
+ elm_object_part_content_set(layout, "elm.swallow.content", scroller);
+ }
+ else if (0 == rotate || 180 == rotate) {
+ layout = elm_object_part_content_get(chistory_d->layout, "contents");
+ p_retm_if(NULL == layout, "elm_object_part_content_get() return NULL");
+ scroller = elm_object_part_content_get(layout, "elm.swallow.content");
+ p_retm_if(NULL == scroller, "elm_object_part_content_get() return NULL");
+ box = elm_object_content_get(scroller);
+ p_retm_if(NULL == box, "elm_object_content_get() return NULL");
+ elm_box_unpack(box, chistory_d->noc);
+ p_retm_if(NULL == chistory_d->noc, "elm_box_unpack() return NULL");
+ evas_object_size_hint_weight_set(chistory_d->noc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(chistory_d->noc, EVAS_HINT_FILL, 0.2);
+ elm_box_pack_end(box, chistory_d->noc);
+ elm_object_content_set(scroller, box);
+ evas_object_size_hint_min_set(box, 720, 650);
+ elm_object_part_content_set(layout, "elm.swallow.content", scroller);
+ }
+}
+
+static Eina_Bool detail_history_refresh_view(void *data)
+{
+ ct_history_data *chistory_d = data;
+ Evas_Object *layout;
+
+ phone_hide_notify(chistory_d->layout);
+ if (chistory_d->select_all_item && DETAIL_VIEW_MODE_CHECK != chistory_d->view_mode) {
+ elm_object_item_del(chistory_d->select_all_item);
+ chistory_d->select_all_item = NULL;
+ }
+ ct_detail_history_load_data(chistory_d);
+
+ layout = elm_object_part_content_get(chistory_d->layout, "contents");
+
+ if (0 < chistory_d->list_count) {
+ detail_history_fill_genlist(chistory_d);
+ elm_object_part_content_set(layout, "elm.swallow.content", chistory_d->history_genlist);
+ }
+ else {
+ if (!chistory_d->scroller) {
+ Evas_Object *scroller;
+ Evas_Object *nocontent;
+ Evas_Object *box;
+ char buf[PH_TEXT_MAX_LEN] = {0,};
+
+ scroller = elm_scroller_add(layout);
+ p_retvm_if(NULL == scroller, ECORE_CALLBACK_CANCEL, "elm_scroller_add() return NULL");
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+ box = elm_box_add(scroller);
+ p_retvm_if(NULL == box, ECORE_CALLBACK_CANCEL, "elm_box_add() return NULL");
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
+ elm_object_content_set(scroller, box);
+ evas_object_show(box);
+
+ nocontent = elm_layout_add(box);
+ p_retvm_if(NULL == nocontent, ECORE_CALLBACK_CANCEL, "elm_layout_add() return NULL");
+ evas_object_size_hint_weight_set(nocontent, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(nocontent, EVAS_HINT_FILL, 0.2);
+ elm_layout_file_set(nocontent, NOCONTENT_LAYOUT_EDJ, "nocontent_layout");
+ snprintf(buf, sizeof(buf), "%s<br>%s<br>", T_(CT_GET_TEXT_BASIC, CTTEXT_NO_HISTORIES), T_(CT_GET_TEXT_ERR, CTTEXT_NO_HISTORIES_HELP_TEXT));
+ elm_box_pack_end(box, nocontent);
+ evas_object_size_hint_min_set(box, 720, 650);
+ evas_object_show(nocontent);
+ elm_object_part_text_set(nocontent, "elm.text", buf);
+ chistory_d->scroller = scroller;
+ chistory_d->noc = nocontent;
+ }
+ evas_object_show(chistory_d->scroller);
+ elm_object_part_content_set(layout, "elm.swallow.content", chistory_d->scroller);
+ }
+
+ detail_history_set_navi(chistory_d, DETAIL_VIEW_MODE_HISTORY);
+ chistory_d->idler = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void detail_history_free_list(ct_history_data *chistory_d)
+{
+ ct_detail_history_info *l_info;
+
+ EINA_LIST_FREE(chistory_d->list, l_info) {
+ if (NULL == l_info) continue;
+ free(l_info->plog_number);
+ free(l_info->plog_shortmsg);
+ free(l_info);
+ }
+ chistory_d->list = NULL;
+}
+
+static void detail_history_view_delete_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_history_data *chistory_d = data;
+
+ if (0 < chistory_d->list_count)
+ detail_history_free_list(chistory_d);
+
+ if (chistory_d->history_genlist)
+ evas_object_del(chistory_d->history_genlist);
+ if (chistory_d->noc)
+ evas_object_del(chistory_d->noc);
+ if (chistory_d->scroller)
+ evas_object_del(chistory_d->scroller);
+ if (chistory_d->popup)
+ evas_object_del(chistory_d->popup);
+ if (chistory_d->th) {
+ elm_theme_extension_del(chistory_d->th, DETAIL_THEME_EDJ);
+ elm_theme_free(chistory_d->th);
+ }
+
+ err = contacts_db_remove_changed_cb(_contacts_phone_log._uri, ct_detail_history_changed_cb, chistory_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ evas_object_event_callback_del(chistory_d->layout, EVAS_CALLBACK_RESIZE, detail_history_view_resize);
+
+ free(chistory_d);
+
+}
+
+void ct_detail_history_fill_layout(ct_history_data *chistory_d)
+{
+ Evas_Object *base;
+ Evas_Object *layout;
+
+ base = elm_layout_add(chistory_d->navi);
+ p_retm_if(NULL == base, "elm_layout_add() return NULL");
+
+ elm_layout_file_set(base, SELECTION_INFO_EDJ, "selectioninfo_layout");
+ layout = phone_create_base_layout(base, false);
+ elm_object_part_content_set(base, "contents", layout);
+
+ chistory_d->layout = base;
+
+ evas_object_event_callback_add(chistory_d->layout, EVAS_CALLBACK_RESIZE, detail_history_view_resize, chistory_d);
+
+ if (0 < chistory_d->list_count) {
+ detail_history_fill_genlist(chistory_d);
+ elm_object_part_content_set(layout, "elm.swallow.content", chistory_d->history_genlist);
+ }
+ else {
+ if (!chistory_d->scroller) {
+ Evas_Object *scroller;
+ Evas_Object *nocontent;
+ Evas_Object *box;
+ char buf[PH_TEXT_MAX_LEN] = {0,};
+
+ scroller = elm_scroller_add(layout);
+ p_retm_if(NULL == scroller, "elm_scroller_add() return NULL");
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+ box = elm_box_add(scroller);
+ p_retm_if(NULL == box, "elm_box_add() return NULL");
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
+ elm_object_content_set(scroller, box);
+ evas_object_show(box);
+
+ nocontent = elm_layout_add(box);
+ p_retm_if(NULL == nocontent, "elm_layout_add() return NULL");
+ evas_object_size_hint_weight_set(nocontent, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(nocontent, EVAS_HINT_FILL, 0.2);
+ elm_layout_file_set(nocontent, NOCONTENT_LAYOUT_EDJ, "nocontent_layout");
+ snprintf(buf, sizeof(buf), "%s<br>%s<br>", T_(CT_GET_TEXT_BASIC, CTTEXT_NO_HISTORIES), T_(CT_GET_TEXT_ERR, CTTEXT_NO_HISTORIES_HELP_TEXT));
+ elm_box_pack_end(box, nocontent);
+ evas_object_size_hint_min_set(box, 720, 650);
+ evas_object_show(nocontent);
+ elm_object_part_text_set(nocontent, "elm.text", buf);
+ chistory_d->noc = nocontent;
+ chistory_d->scroller = scroller;
+ }
+ evas_object_show(chistory_d->scroller);
+ elm_object_part_content_set(layout, "elm.swallow.content", chistory_d->scroller);
+ }
+
+ chistory_d->navi_item = elm_naviframe_item_push(chistory_d->navi, "History", NULL, NULL, chistory_d->layout, NULL);
+ elm_naviframe_item_title_visible_set(chistory_d->navi_item, EINA_TRUE);
+ evas_object_event_callback_add(chistory_d->layout, EVAS_CALLBACK_DEL, detail_history_view_delete_cb, chistory_d);
+ detail_history_set_navi(chistory_d, DETAIL_VIEW_MODE_HISTORY);
+}
+
diff --git a/lib/details/ct-detail-history.h b/lib/details/ct-detail-history.h
new file mode 100755
index 0000000..e6ff994
--- /dev/null
+++ b/lib/details/ct-detail-history.h
@@ -0,0 +1,29 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CONTACTS_DETAIL_HISTORY_H__
+#define __CONTACTS_DETAIL_HISTORY_H__
+
+#include "phone-common.h"
+
+void ct_detail_history_create_itcs();
+void ct_detail_history_load_data(ct_history_data *chistory_d);
+void ct_detail_history_fill_layout(ct_history_data *chistory_d);
+void ct_detail_history_changed_cb(const char *view_uri, void *data);
+
+#endif //__CONTACTS_DETAIL_HISTORY_H__
+
diff --git a/lib/details/ct-detail-main.c b/lib/details/ct-detail-main.c
new file mode 100755
index 0000000..f20c3ee
--- /dev/null
+++ b/lib/details/ct-detail-main.c
@@ -0,0 +1,548 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+#include <ui-gadget-module.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <fcntl.h>
+
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-detail-utils.h"
+#include "ct-detail-view.h"
+#include "ct-input-view.h"
+#include "ct-input-utils.h"
+
+static int create_ug_detail_view(Evas_Object *base, int request, ct_detail_data *cdetail_d)
+{
+ p_retvm_if(NULL == base, FALSE, "base is NULL");
+
+ cdetail_d->navi = elm_naviframe_add(base);
+ p_retvm_if (NULL == cdetail_d->navi, FALSE, "elm_naviframe_add() return NULL");
+
+ elm_naviframe_prev_btn_auto_pushed_set(cdetail_d->navi, EINA_FALSE);
+ evas_object_show(cdetail_d->navi);
+ elm_object_part_content_set(base, "elm.swallow.content", cdetail_d->navi);
+
+ cdetail_d->ug_detail = true;
+ if (CT_UG_REQUEST_DETAIL == request) {
+ Evas_Object *content;
+
+ content = ct_detail_create_content(cdetail_d);
+ if (NULL == content)
+ return FALSE;
+
+ cdetail_d->navi_item = elm_naviframe_item_push(cdetail_d->navi, NULL, NULL, NULL, content, NULL);
+ elm_naviframe_item_title_visible_set(cdetail_d->navi_item, EINA_FALSE);
+ ct_detail_set_navi(cdetail_d, DETAIL_VIEW_MODE_INFO);
+ }
+ else {
+ int contact_id = 0;
+ contacts_record_h record_contact = cdetail_d->contact;
+ if (record_contact)
+ contacts_record_get_int(record_contact, _contacts_contact.id, &contact_id);
+
+ if (NULL == cdetail_d->list_contacts)
+ cdetail_d->list_contacts = eina_list_append(cdetail_d->list_contacts, cdetail_d->contact);
+
+ ct_input_push_navi_content(cdetail_d, record_contact, contact_id);
+ }
+ return TRUE;
+}
+
+static void *detail_on_create(ui_gadget_h ug, enum ug_mode mode,
+ service_h service, void *priv)
+{
+ int ret;
+ int request;
+ Evas_Object *bg;
+ Evas_Object *base;
+ Evas_Object *parent;
+ contacts_error_e err;
+ ct_detail_data *cdetail_d = priv;
+
+ p_retvm_if(NULL == ug || NULL == priv, NULL,
+ "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
+
+ cdetail_d->win = ug_get_window();
+ parent = ug_get_parent_layout(ug);
+ p_retvm_if(NULL == parent, NULL, "ug_get_parent_layout() return NULL");
+ cdetail_d->ug = ug;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ err = contacts_connect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
+ PH_DBG("contacts_connect()");
+
+ if (UG_MODE_FULLVIEW == mode)
+ base = phone_create_base_layout(parent, true);
+ else
+ base = phone_create_base_layout(parent, false);
+
+ request = ct_detail_parse_bundle(service, cdetail_d, &ret);
+ if (-2 == ret) {
+ Evas_Object *popup;
+ popup = elm_popup_add(base);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, S_(PH_SYS_BODY_SELECTED_DATA_NOT_FOUND));
+ elm_popup_timeout_set(popup, 1.5);
+ evas_object_show(popup);
+ evas_object_smart_callback_add(popup, "timeout", ctui_list_ug_hide_cb, cdetail_d->ug);
+ return base;
+ }
+ p_retvm_if(request < 0, NULL, "ct_detail_parse_bundle() Failed(%d)", request);
+
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ evas_object_del(base);
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ return NULL;
+ }
+
+ if (!create_ug_detail_view(base, request, cdetail_d)) {
+ evas_object_del(base);
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ }
+ return base;
+}
+
+static void detail_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ contacts_error_e err;
+ ct_detail_data *cdetail_d = priv;
+ p_retm_if(NULL == ug, "The parameter is invalid(ug=%p)", ug);
+
+ if (cdetail_d && !cdetail_d->navi)
+ free(cdetail_d);
+
+ evas_object_del(ug_get_layout(ug));
+
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+}
+
+static void detail_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ ct_detail_data *cdetail_d = priv;
+
+ if (!ug)
+ return;
+
+ switch (event) {
+ case UG_KEY_EVENT_END:
+ if (cdetail_d->popup) {
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+ }
+ else {
+ if (elm_naviframe_top_item_get(cdetail_d->navi)
+ == cdetail_d->navi_item) {
+ ug_destroy_me(ug);
+ }
+ else
+ elm_naviframe_item_pop(cdetail_d->navi);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static void detail_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+ char* val = NULL;
+ ct_detail_data *cdetail_d = priv;
+
+ if (UG_MODE_FRAMEVIEW == ug_get_mode(ug)) {
+ if (msg) {
+ service_get_extra_data(service, "key_event", &val);
+ if (val && CTUG_MSG_KEY_END == atoi(val)) {
+ if (cdetail_d->popup) {
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+ }
+ else {
+ if (elm_naviframe_top_item_get(cdetail_d->navi)
+ == cdetail_d->navi_item) {
+ ug_destroy_me(ug);
+ }
+ else
+ elm_naviframe_item_pop(cdetail_d->navi);
+ }
+ }
+ free(val);
+ }
+ }
+}
+
+static void detail_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ contacts_name_display_order_e name_display_order;
+ ct_detail_data *cdetail_d = priv;
+ contacts_setting_get_name_display_order(&name_display_order);
+ cdetail_d->order_display = (int)name_display_order;
+}
+
+static void detail_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ contacts_name_display_order_e order;
+ ct_detail_data *cdetail_d = priv;
+
+ contacts_setting_get_name_display_order(&order);
+ if (cdetail_d->order_display != order)
+ ctui_detail_genlist_update(cdetail_d);
+}
+
+static void detail_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ ct_detail_data *cdetail_d = priv;
+ switch (event) {
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ ct_detail_view_language_changed(cdetail_d);
+ break;
+ default:
+ break;
+ }
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ct_detail_data *cdetail_d;
+
+ p_retvm_if(!ops, -1, "ops is NULL");
+
+ cdetail_d = calloc(1, sizeof(ct_detail_data));
+ p_retvm_if(!cdetail_d, -1, "UG data is NULL, Not enough memory");
+
+ ops->create = detail_on_create;
+ ops->start = NULL;
+ ops->pause = detail_on_pause;
+ ops->resume = detail_on_resume;
+ ops->destroy = detail_on_destroy;
+ ops->message = detail_on_message;
+ ops->event = detail_on_event;
+ ops->key_event = detail_on_key_event;
+ ops->priv = cdetail_d;
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+
+ return 0;
+}
+
+API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ p_retm_if(!ops, "ops is NULL");
+
+ ops->priv = NULL;
+}
+
+API int ctui_create_detail_view(ct_list_data *clist_d, ct_person_list *person_info)
+{
+ PH_FN_CALL;
+ PH_START_TIME_CHECK;
+ ct_detail_data *cdetail_d;
+ Evas_Object *content;
+
+ cdetail_d = calloc(1, sizeof(ct_detail_data));
+ p_retvm_if(!cdetail_d, -1, "cdetail_d is NULL, Not enough memory");
+
+ ctui_ld_to_dd(clist_d, cdetail_d);
+ cdetail_d->person_id = person_info->id;
+ cdetail_d->titem = NULL;
+ cdetail_d->ctrl_button = NULL;
+ content = ct_detail_create_content(cdetail_d);
+ if (NULL == content) {
+ ERR("ct_detail_create_content() Failed");
+ free(cdetail_d);
+ return -1;
+ }
+
+ cdetail_d->navi_item = elm_naviframe_item_push(cdetail_d->navi, NULL, NULL, NULL, content, NULL);
+ elm_naviframe_item_title_visible_set(cdetail_d->navi_item, EINA_FALSE);
+ ct_detail_set_navi(cdetail_d, DETAIL_VIEW_MODE_INFO);
+
+ PH_DBG("##### [TSP_TEST] list->detail end#####");
+
+ PH_END_TIME_CHECK();
+ return 0;
+}
+
+
+API void ct_detail_view_language_changed(ct_detail_data *cdetail_d)
+{
+ PH_FN_CALL;
+ p_retm_if(NULL == cdetail_d, "parameter(cdetail_d) is NULL");
+
+ // 1. update title
+ if (cdetail_d->navi_item)
+ elm_object_item_text_set(cdetail_d->navi_item, T_(CT_GET_TEXT_BASIC, CTTEXT_DETAILS));
+
+ // 2. update content
+ ct_detail_refresh_view(cdetail_d);
+
+ // 3. update controlbar
+
+
+ if (cdetail_d->has_input)
+ ct_input_language_changed(cdetail_d->navi);
+}
+
+
+API int ctui_create_input_view(ct_detail_data *cdetail_d)
+{
+ PH_FN_CALL;
+ PH_START_TIME_CHECK;
+ int contact_id = 0;
+ char addressbook_name[50] = {0,};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact_clone = NULL;
+
+ p_retvm_if(!cdetail_d, -1, "cdetail_d is NULL");
+ if (cdetail_d->contact) {
+ err = contacts_record_clone(cdetail_d->contact, &record_contact_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ return 0;
+ }
+ contacts_record_get_int(cdetail_d->contact, _contacts_contact.id, &contact_id );
+ }
+ else if (cdetail_d->person_id) {
+ Eina_List *list_contact;
+ list_contact = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if (NULL == list_contact){
+ err = contacts_record_create(_contacts_contact._uri, &record_contact_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_create() Failed(%d)", err);
+ return 0;
+ }
+ }
+ else {
+ err = contacts_record_clone(cdetail_d->contact, &record_contact_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ return 0;
+ }
+ ctui_free_record_list(list_contact);
+ }
+ }
+
+ ctui_get_addressbook_name( ct_input_get_base_ab(), addressbook_name, sizeof(addressbook_name));
+ PH_DBG("addressbook_name : %s",addressbook_name );
+
+ ct_input_push_navi_content(cdetail_d, record_contact_clone, contact_id);
+
+ PH_END_TIME_CHECK("ct_input_push_navi_content");
+ return 0;
+}
+
+API Evas_Object* ctui_contacts_viewer(Evas_Object *win, Evas_Object *navi, int personid_vcardidx, const char *vcard_path)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d;
+ Evas_Object *bg;
+ Evas_Object *base = NULL;
+ Evas_Object *content;
+ Evas_Object *conform = NULL;
+
+ cdetail_d = calloc(1, sizeof(ct_detail_data));
+ p_retvm_if(!cdetail_d, NULL, "cdetail_d is NULL, Not enough memory");
+
+ cdetail_d->win = win;
+ if (navi)
+ cdetail_d->navi = navi;
+ else {
+ conform = elm_conformant_add(win);
+ p_retvm_if(NULL == conform, NULL, "elm_conformant_add() Failed");
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ base = phone_create_base_layout(conform, true);
+ cdetail_d->navi = elm_naviframe_add(base);
+ evas_object_show(cdetail_d->navi);
+
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ evas_object_del(base);
+ free(cdetail_d);
+ return NULL;
+ }
+ elm_object_style_set(bg, "group_list");
+ }
+
+ evas_object_data_set(cdetail_d->win, "naviframe", (void *)cdetail_d->navi);
+
+ if(NULL== vcard_path){
+ int person_id = personid_vcardidx;
+ if (person_id) {
+ cdetail_d->is_shortcut = true;
+ cdetail_d->person_id = person_id;
+ err = contacts_db_get_record(_contacts_person._uri, person_id, &(cdetail_d->person));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record(%d) Failed(%d)", person_id, err);
+ if (base)
+ evas_object_del(base);
+ free(cdetail_d);
+ return NULL;
+ }
+ cdetail_d->list_contacts = ctui_person_get_contact_list(cdetail_d->person_id);
+ }
+ else
+ ERR("personid_vcardidx <= 0");
+ }
+ else {
+ int fd = 0;
+ int size = 0;
+ int vcard_idx = personid_vcardidx;
+ char buf[CT_VCARD_FILE_MAX_SIZE+1] = {0, };
+
+ contacts_record_h record;
+ contacts_list_h list_contacts_vcard = NULL;
+ cdetail_d->vcard_path = strdup(vcard_path);
+
+ if (NULL == cdetail_d->vcard_path) {
+ ERR("strdup() return NULL");
+ if (base)
+ evas_object_del(base);
+ free(cdetail_d);
+ return NULL;
+ }
+
+ fd = open(cdetail_d->vcard_path, O_RDONLY);
+
+ p_retvm_if(-1 == fd, NULL, "open() return -1");
+ size = read(fd, buf, sizeof(buf)-1);
+ close(fd);
+
+ err = contacts_vcard_parse_to_contacts(buf, &list_contacts_vcard);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_vcard_parse_to_contacts(%s) Failed(%d)", vcard_path, err);
+ if (base)
+ evas_object_del(base);
+ free(cdetail_d);
+ return NULL;
+ }
+
+ if ( vcard_idx <= 0 ) {
+ err = contacts_list_get_current_record_p(list_contacts_vcard, &record);
+ if (CONTACTS_ERROR_NONE == err) {
+ err = contacts_record_clone(record, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_clone() Failed(%d)", err);
+ }
+ }
+ else{
+ int idx = 0;
+ err = CONTACTS_ERROR_NONE;
+ idx=1;
+ while (CONTACTS_ERROR_NONE == err) {
+ if(vcard_idx == idx){
+ err = contacts_list_get_current_record_p(list_contacts_vcard, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+ err = contacts_record_clone(record, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_clone() Failed(%d)", err);
+ break;
+ }
+ err = contacts_list_next(list_contacts_vcard);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d) vcard_idx %d, idx %d", err, vcard_idx, idx);
+ break;
+ }
+ ++idx;
+ }
+ }
+ err = contacts_list_destroy(list_contacts_vcard, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy(list_contacts_vcard) Failed(%d)", err);
+ }
+
+ content = ct_detail_create_content(cdetail_d);
+ if (NULL == content) {
+ ERR("ct_detail_create_content() Failed");
+ if (base)
+ evas_object_del(base);
+ if (cdetail_d->contact)
+ contacts_record_destroy(cdetail_d->contact, true);
+ if (cdetail_d->person)
+ contacts_record_destroy(cdetail_d->person, true);
+ free(cdetail_d);
+ return NULL;
+ }
+
+ cdetail_d->navi_item = elm_naviframe_item_push(cdetail_d->navi,NULL, NULL, NULL, content, NULL);
+ elm_naviframe_item_title_visible_set(cdetail_d->navi_item, EINA_FALSE);
+
+ if (NULL == vcard_path)
+ ct_detail_set_navi(cdetail_d, DETAIL_VIEW_MODE_INFO);
+ else
+ ct_detail_set_navi(cdetail_d, DETAIL_VIEW_MODE_VCARD);
+
+ if (navi)
+ return navi;
+ else {
+ elm_object_part_content_set(base, "elm.swallow.content", cdetail_d->navi);
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, base);
+ elm_win_resize_object_add(win, conform);
+ elm_object_content_set(conform, base);
+ evas_object_show(base);
+ evas_object_show(conform);
+ return conform;
+ }
+}
+
+API int ctui_create_detail_view_from_phone(Evas_Object *win, Evas_Object *navi, ui_gadget_h ug, int id)
+{
+ PH_FN_CALL;
+ PH_START_TIME_CHECK;
+ ct_detail_data *cdetail_d;
+ Evas_Object *content;
+
+ cdetail_d = calloc(1, sizeof(ct_detail_data));
+ p_retvm_if(!cdetail_d, -1, "cdetail_d is NULL, Not enough memory");
+
+ cdetail_d->win = win;
+ cdetail_d->navi = navi;
+ cdetail_d->ug = ug;
+ cdetail_d->prev_navi_item = elm_naviframe_top_item_get(navi);
+ cdetail_d->person_id = id;
+
+ content = ct_detail_create_content(cdetail_d);
+ if (NULL == content) {
+ ERR("ct_detail_create_content() Failed");
+ free(cdetail_d);
+ return -1;
+ }
+
+ cdetail_d->navi_item = elm_naviframe_item_push(cdetail_d->navi, NULL, NULL, NULL, content, NULL);
+ elm_naviframe_item_title_visible_set(cdetail_d->navi_item, EINA_FALSE);
+
+ ct_detail_set_navi(cdetail_d, DETAIL_VIEW_MODE_INFO);
+
+ PH_END_TIME_CHECK();
+ return 0;
+}
+
+
+
diff --git a/lib/details/ct-detail-utils.c b/lib/details/ct-detail-utils.c
new file mode 100755
index 0000000..6fd57e0
--- /dev/null
+++ b/lib/details/ct-detail-utils.c
@@ -0,0 +1,2287 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <fcntl.h>
+#include <vconf.h>
+#include <Ecore_X.h>
+#include <ui-gadget-module.h>
+#include <account.h>
+#include <unicode/udatpg.h>
+#include <unicode/ucal.h>
+#include <unicode/ustring.h>
+
+#include "phone.h"
+#include "ct-list.h"
+#include "ct-detail.h"
+#include "ct-detail-view.h"
+#include "ct-detail-utils.h"
+#include "ct-image-viewer.h"
+
+
+int ct_detail_parse_bundle(service_h service, ct_detail_data* cdetail_d, int *ret)
+{
+ int type = CT_UG_REQUEST_DETAIL;
+ char* val = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retvm_if(NULL == ret, -1, "parameter(ret) is NULL");
+ *ret = 0;
+
+ if (service) {
+ service_get_extra_data(service, CT_UG_BUNDLE_TYPE, &val);
+ if (val) type = atoi(val);
+ PH_DBG("type = %d", type);
+ free(val);
+
+ switch (type) {
+ case CT_UG_REQUEST_DETAIL:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ID, &val);
+
+ if (val) {
+ cdetail_d->person_id = atoi(val);
+ free(val);
+ break;
+ }
+
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_PERSON_ID, &val);
+ if (val) {
+ cdetail_d->person_id = atoi(val);
+ free(val);
+ break;
+ }
+
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_VCARD, &val);
+ if (val) {
+ if(ct_detail_load_vcard_contact(cdetail_d, val) < 0)
+ PH_DBG("ct_detail_load_vcard_contact fail");
+ free(val);
+ }
+ break;
+
+ case CT_UG_REQUEST_EDIT:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ID, &val);
+
+ if (val)
+ cdetail_d->person_id = atoi(val);
+ free(val);
+
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_PERSON_ID, &val);
+ if (val)
+ cdetail_d->person_id = atoi(val);
+ free(val);
+
+ if (cdetail_d->person_id) { // From OSP
+ Eina_List *list_contact = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if (list_contact) {
+ cdetail_d->contact = list_contact->data;
+ eina_list_free(list_contact);
+ }
+ }
+
+ //number
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_NUM, &val);
+ if (val) {
+ contacts_record_h record_number;
+
+ if (NULL == cdetail_d->contact && cdetail_d->person_id) {
+ Eina_List *list_contact_id = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if (list_contact_id) {
+ int contact_id = (int)list_contact_id->data;
+ eina_list_free(list_contact_id);
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record(%d) Failed(%d)", contact_id, err);
+ }
+ }
+
+ err = contacts_record_create( _contacts_number._uri, &record_number );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int( record_number,_contacts_number.type, CONTACTS_NUMBER_TYPE_CELL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str( record_number,_contacts_number.number, (const char*)val );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.number, record_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ }
+
+ //email
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &val);
+ if (val) {
+ contacts_record_h record_email;
+
+ if (NULL == cdetail_d->contact && cdetail_d->person_id) {
+ Eina_List *list_contact_id = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if (list_contact_id) {
+ int contact_id = (int)list_contact_id->data;
+ eina_list_free(list_contact_id);
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record(%d) Failed(%d)", contact_id, err);
+ }
+ }
+
+ contacts_record_create( _contacts_email._uri, &record_email);
+ contacts_record_set_int( record_email,_contacts_email.type, CONTACTS_EMAIL_TYPE_HOME);
+ contacts_record_set_str( record_email,_contacts_email.email, (const char*)val );
+
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.email, record_email);
+ }
+ //url
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_WEB, &val);
+ if (val) {
+ contacts_record_h record_website;
+
+ if (NULL == cdetail_d->contact && cdetail_d->person_id) {
+ Eina_List *list_contact_id = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if (list_contact_id) {
+ int contact_id = (int)list_contact_id->data;
+ eina_list_free(list_contact_id);
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record(%d) Failed(%d)", contact_id, err);
+ }
+ }
+ contacts_record_create( _contacts_url._uri, &record_website);
+ contacts_record_set_int( record_website,_contacts_url.type, CONTACTS_EMAIL_TYPE_HOME);
+ contacts_record_set_str( record_website,_contacts_url.url, (const char*)val );
+
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.url, record_website);
+ }
+ break;
+ case CT_UG_REQUEST_ADD:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_VCARD, &val);
+ if (val) {
+ contacts_list_h list;
+ err = contacts_vcard_parse_to_contacts(val, &list);
+ if (CONTACTS_ERROR_NONE == err) {
+ contacts_record_h record;
+ err = contacts_list_get_current_record_p(list, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ err = contacts_record_clone(record, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_clone() Failed(%d)", err);
+ }
+ }
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+
+ free(val);
+ break;
+ }
+
+ //number
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_NUM, &val);
+ if (val) {
+ contacts_record_h record_number = NULL;
+ if (NULL == cdetail_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+ }
+
+ err = contacts_record_create(_contacts_number._uri, &record_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_number, _contacts_number.type, CONTACTS_NUMBER_TYPE_HOME | CONTACTS_NUMBER_TYPE_CELL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_number, _contacts_number.number, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.number, record_number);
+
+ free(val);
+ }
+
+ //email
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &val);
+ if (val) {
+ contacts_record_h record_email = NULL;
+ if (NULL == cdetail_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+ }
+
+ err = contacts_record_create(_contacts_email._uri, &record_email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_email, _contacts_email.type, CONTACTS_EMAIL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_email, _contacts_email.email, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.email, record_email);
+
+ free(val);
+ }
+
+ //url
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_WEB, &val);
+ if (val) {
+ contacts_record_h record_url = NULL;
+ if (NULL == cdetail_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+ }
+ err = contacts_record_create(_contacts_url._uri, &record_url);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_url, _contacts_url.type, CONTACTS_URL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_url, _contacts_url.url, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.url, record_url);
+
+ free(val);
+ }
+ break;
+ case CT_UG_REQUEST_ADD_WITH_NUM:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_NUM, &val);
+ if (val) {
+ contacts_record_h record_number = NULL;
+ if (cdetail_d->person_id) {
+ int contact_id = 0;
+ Eina_List *contact_id_list;
+
+ contact_id_list = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if(NULL == contact_id_list) {
+ ERR("ctui_person_get_writable_contact_list() return NULL");
+ break;
+ }
+
+ contact_id = (int)contact_id_list->data;
+ eina_list_free(contact_id_list);
+
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &(cdetail_d->contact));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_create(_contacts_number._uri, &record_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_number, _contacts_number.type, CONTACTS_NUMBER_TYPE_HOME | CONTACTS_NUMBER_TYPE_VOICE);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_number, _contacts_number.number, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.number, record_number);
+ }
+ else {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_create(_contacts_number._uri, &record_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_number, _contacts_number.type, CONTACTS_NUMBER_TYPE_HOME | CONTACTS_NUMBER_TYPE_VOICE);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_number, _contacts_number.number, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.number, record_number);
+ }
+ }
+ free(val);
+ break;
+ case CT_UG_REQUEST_ADD_WITH_EMAIL:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &val);
+ if (val) {
+ contacts_record_h record_email;
+ if (cdetail_d->person_id) {
+ int contact_id = 0;
+ Eina_List *contact_id_list;
+
+ PH_DBG("cdetail_d->person_id=%d", cdetail_d->person_id);
+
+ contact_id_list = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if(NULL == contact_id_list) {
+ ERR("ctui_person_get_writable_contact_list() return NULL");
+ break;
+ }
+
+ contact_id = (int)contact_id_list->data;
+ eina_list_free(contact_id_list);
+
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &(cdetail_d->contact));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_create(_contacts_email._uri, &record_email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_email, _contacts_email.type, CONTACTS_EMAIL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_email, _contacts_email.email, val);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.email, record_email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ }
+ else {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_create(_contacts_email._uri, &record_email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_email, _contacts_email.type, CONTACTS_EMAIL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_email, _contacts_email.email, val);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.email, record_email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ }
+ }
+ free(val);
+ break;
+ case CT_UG_REQUEST_ADD_WITH_WEB:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &val);
+ if (val) {
+ contacts_record_h record_url;
+ if (cdetail_d->person_id) {
+ int contact_id = 0;
+ Eina_List *contact_id_list;
+
+ contact_id_list = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if(NULL == contact_id_list) {
+ ERR("ctui_person_get_writable_contact_list() return NULL");
+ break;
+ }
+
+ contact_id = (int)contact_id_list->data;
+ eina_list_free(contact_id_list);
+
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &(cdetail_d->contact));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_create(_contacts_url._uri, &record_url);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_url, _contacts_url.type, CONTACTS_URL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_url, _contacts_url.url, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.url, record_url);
+ }
+ else {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_create(_contacts_url._uri, &record_url);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_url, _contacts_url.type, CONTACTS_URL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record_url, _contacts_url.url, val);
+ contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.url, record_url);
+ }
+ }
+ free(val);
+ break;
+ }
+ }
+
+ // FIXME : improve performance
+ if (cdetail_d->person_id) {
+ cdetail_d->list_contacts = ctui_person_get_contact_list(cdetail_d->person_id);
+ if (NULL == cdetail_d->list_contacts)
+ *ret = -2;
+ }
+
+ return type;
+}
+
+static inline bool detail_is_usable_char(char c)
+{
+ switch (c) {
+ case '\\':
+ case '/':
+ case ':':
+ case '*':
+ case '?':
+ case '\"':
+ case '<':
+ case '>':
+ case '|':
+ case ';':
+ return false;
+ default:
+ return true;
+ }
+}
+
+static inline bool detail_is_blank_str(char *display)
+{
+ int i;
+ for (i = 0 ; i < strlen(display); i++)
+ if (' ' != display[i]) return false;
+ return true;
+}
+
+static void detail_get_vcard_filepath(ct_detail_data *cdetail_d, char* path_buf, int buf_size)
+{
+ char display[PH_TEXT_MAX_LEN];
+ char temp[PH_TEXT_MAX_LEN];
+ char *display_name = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ temp[0] = '\0';
+ if (cdetail_d->person)
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.display_name, &display_name);
+ else if (cdetail_d->contact)
+ err = contacts_record_get_str_p(cdetail_d->contact, _contacts_contact.display_name, &display_name);
+
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (display_name && *display_name)
+ snprintf(temp, sizeof(temp), "%s", display_name);
+
+ display[0] = '\0';
+ if (*temp) {
+ int i;
+ int idx = 0;
+ for (i = 0 ; i < strlen(temp); i++) {
+ if (detail_is_usable_char(temp[i]))
+ display[idx++] = temp[i];
+ }
+ display[idx] = '\0';
+ }
+
+ if ('\0' == display[0] || detail_is_blank_str(display)) {
+ snprintf(display, sizeof(display), "%s", T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }
+ snprintf(path_buf, buf_size, "%s/%s.vcf", UGDATAIDR, display);
+}
+
+static int detail_make_vcard(ct_detail_data *cdetail_d, char *path_buf, int buf_size)
+{
+ int ret, fd;
+ char* vcard = NULL;
+
+ detail_get_vcard_filepath(cdetail_d, path_buf, buf_size);
+ p_retvm_if(NULL == path_buf, FALSE, "detail_get_vcard_filepath() return NULL");
+ p_retvm_if(NULL == cdetail_d->list_contacts, FALSE, "contact_list is NULL");
+
+ if (cdetail_d->person)
+ ret = contacts_vcard_make_from_person(cdetail_d->person, &vcard);
+ else
+ ret = contacts_vcard_make_from_contact(cdetail_d->contact, &vcard);
+
+ p_retvm_if(NULL == vcard, FALSE, "contacts_vcard_make_from_person() Failed(%d)", ret);
+
+ fd = open(path_buf, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (fd < 0) {
+ ERR("Open(%s) Failed", path_buf);
+ free(vcard);
+ return FALSE;
+ }
+
+ if (-1 == write(fd, vcard, strlen(vcard)))
+ ERR("write()... Failed(%s)", strerror(errno));
+ close(fd);
+
+ free(vcard);
+ return TRUE;
+}
+
+void ct_detail_delete_namecards(ct_detail_data *cdetail_d)
+{
+ int ret;
+ int fd;
+ char file_path[FILENAME_MAX];
+
+ detail_get_vcard_filepath(cdetail_d, file_path, sizeof(file_path));
+
+ fd = open(file_path, O_RDONLY);
+ if (fd < 0) return;
+
+ close(fd);
+
+ ret = unlink(file_path);
+ p_warn_if(ret < 0, "unlink(%s) failed(%d)", file_path, ret);
+}
+
+static void __detail_destroy_child_ug(void *data)
+{
+ ct_detail_data *cdetail_d = (ct_detail_data*)data;
+ p_retm_if(NULL == cdetail_d, "ct_detail_data is NULL");
+ cdetail_d->child_ug = NULL;
+
+}
+
+
+static void detail_destroy_child_ug(ui_gadget_h ug, void *priv)
+{
+ ct_detail_data *cdetail_d = priv;
+ p_retm_if(NULL == ug, "ug is NULL");
+ ug_destroy(ug);
+
+ p_retm_if(NULL == priv, "priv is NULL");
+ cdetail_d->child_ug = NULL;
+
+}
+
+void ct_detail_make_vcard(ct_detail_data *cdetail_d)
+{
+ int ret;
+ char file_path[FILENAME_MAX] = {0,};
+
+ ret = detail_make_vcard(cdetail_d, file_path, sizeof(file_path));
+ if(TRUE != ret)
+ cdetail_d->vcard_path = NULL;
+ else
+ cdetail_d->vcard_path = strdup(file_path);
+ PH_DBG("vcf path %s", file_path);
+}
+
+void ct_detail_send_via_msg(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ char file_path[FILENAME_MAX];
+ ct_detail_data *cdetail_d = data;
+
+ ret = detail_make_vcard(cdetail_d, file_path, sizeof(file_path));
+ if (TRUE != ret) {
+ PH_DBG("detail_make_vcard() Failed(%d)", ret);
+ phone_show_popup(cdetail_d->win, T_(CT_GET_TEXT_ERR, CTTEXT_UNABLE_TO_SEND_NAME_CARDS), 1.5);
+ return;
+ }
+ cdetail_d->child_ug = ctui_msg_ug(cdetail_d->ug, NULL, 0, file_path,
+ __detail_destroy_child_ug, cdetail_d);
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+}
+
+void ct_detail_send_via_email(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ char file_path[FILENAME_MAX];
+ service_h service;
+ Ecore_X_Window win_id;
+ ct_detail_data *cdetail_d = data;
+
+ ret = detail_make_vcard(cdetail_d, file_path, sizeof(file_path));
+ if (TRUE != ret) {
+ PH_DBG("detail_make_vcard() Failed(%d)", ret);
+ phone_show_popup(cdetail_d->win, T_(CT_GET_TEXT_ERR, CTTEXT_UNABLE_TO_SEND_NAME_CARDS), 1.5);
+ return;
+ }
+
+ win_id = elm_win_xwindow_get(cdetail_d->win);
+ service_create(&service);
+ service_set_operation(service, SERVICE_OPERATION_SEND);
+ service_set_uri(service, file_path);
+ service_set_app_id(service, EMAIL_COMPOSER_PKG);
+ service_add_extra_data(service, SERVICE_DATA_SUBJECT, "Contacts name card");
+
+ service_set_window(service, win_id);
+ service_send_launch_request(service, NULL, NULL);
+ service_destroy(service);
+
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+}
+
+void ct_detail_send_via_bluetooth(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ service_h service;
+ ct_detail_data *cdetail_d = data;
+ char file_path[FILENAME_MAX];
+ struct ug_cbs cbs = {0};
+
+ ret = detail_make_vcard(cdetail_d, file_path, sizeof(file_path));
+ if (TRUE != ret) {
+ PH_DBG("detail_make_vcard() Failed(%d)", ret);
+ phone_show_popup(cdetail_d->win, T_(CT_GET_TEXT_ERR, CTTEXT_UNABLE_TO_SEND_NAME_CARDS), 1.5);
+ return;
+ }
+
+ service_create(&service);
+ service_add_extra_data(service, "launch-type", "send");
+ service_add_extra_data(service, "filecount", "1");
+ service_add_extra_data(service, "files", file_path);
+
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = detail_destroy_child_ug;
+ cbs.priv = data;
+
+ cdetail_d->child_ug = ug_create(cdetail_d->ug, BLUETOOTH_UG, UG_MODE_FULLVIEW, service, &cbs);
+
+ service_destroy(service);
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+}
+
+
+static void detail_get_displayname(contacts_record_h record_name, char *display, int display_len)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_name_display_order_e name_display_order;
+ char *first, *last, *middle;
+ char temp[CT_EDITFIELD_MAX_CHAR*2+2] = {0,};
+
+ err = contacts_record_get_str_p(record_name, _contacts_name.first, &first);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() first Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record_name, _contacts_name.addition, &middle);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() addition Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record_name, _contacts_name.last, &last);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() last Failed(%d)", err);
+
+ if (STRLEN(middle)>0) {
+ if (STRLEN(first)>0)
+ snprintf(temp, CT_EDITFIELD_MAX_CHAR*2+1, "%s %s", first, middle);
+ else
+ snprintf(temp, CT_EDITFIELD_MAX_CHAR, "%s", middle);
+ }
+ else{
+ if (STRLEN(first)>0)
+ snprintf(temp, CT_EDITFIELD_MAX_CHAR, "%s", first);
+ }
+
+ contacts_setting_get_name_display_order(&name_display_order);
+ if( CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == name_display_order){
+ if (STRLEN(last) > 0 ) {
+ if (STRLEN(temp)>0)
+ snprintf(display, display_len-1, "%s %s", temp, last);
+ else
+ snprintf(display, display_len-1, "%s", last);
+ }
+ else{
+ if (STRLEN(temp)>0)
+ snprintf(display, display_len-1, "%s", temp);
+ }
+ }
+ else{
+ if (STRLEN(last) > 0 ) {
+ if (STRLEN(temp)>0)
+ snprintf(display, display_len-1, "%s, %s", last, temp );
+ else
+ snprintf(display, display_len-1, "%s", last);
+ }
+ else{
+ if (STRLEN(temp)>0)
+ snprintf(display, display_len-1, "%s", temp);
+ }
+ }
+}
+
+static void detail_get_company_str(contacts_record_h record_company, char *dest, int dest_len)
+{
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *company, *job, *department;
+ char temp[dest_len];
+
+ p_ret_if(NULL == dest);
+
+ err = contacts_record_get_str_p(record_company, _contacts_company.name, (char**)&company);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_company, _contacts_company.department, (char**)&department);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_company, _contacts_company.job_title, (char**)&job );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (company) {
+ if(strlen(company)>CT_EDITFIELD_MAX_CHAR){
+ company[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+ if (*dest) {
+ ret = snprintf(temp, dest_len, "%s, %s", dest, company);
+ if (0 < ret)
+ memcpy(dest, temp, ret+1);
+ }
+ else {
+ snprintf(dest, dest_len, "%s", company);
+ }
+ }
+
+ if (department) {
+ if(strlen(department)>CT_EDITFIELD_MAX_CHAR){
+ department[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+ if (*dest) {
+ ret = snprintf(temp, dest_len, "%s, %s", dest, department);
+ if (0 < ret)
+ memcpy(dest, temp, ret+1);
+ }
+ else {
+ snprintf(dest, dest_len, "%s", department);
+ }
+ }
+
+ if (job) {
+ if(strlen(job)>CT_EDITFIELD_MAX_CHAR){
+ job[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+ if (*dest) {
+ ret = snprintf(temp, dest_len, "%s, %s", dest, job);
+ if (0 < ret)
+ memcpy(dest, temp, ret+1);
+ }
+ else {
+ snprintf(dest, dest_len, "%s", job);
+ }
+ }
+}
+
+void ct_detail_person_get_company_str(Eina_List *contact_list, char *dest, int dest_len)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_company = NULL;
+ Eina_List *l;
+ p_retm_if(NULL == contact_list, "contact_list is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ if (NULL == record_contact)
+ continue;
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.company, 0, &record_company);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+ if (CONTACTS_ERROR_NONE == err) {
+ detail_get_company_str(record_company, dest, dest_len);
+ break;
+ }
+ }
+}
+
+static void detail_get_extra_name_str(contacts_record_h record_name, contacts_record_h record_nickname, char *dest, int dest_len)
+{
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *suffix;
+ char *nickname;
+ char temp[CT_EDITFIELD_MAX_CHAR+1] = {0,};
+
+ p_ret_if(NULL == dest);
+
+ err = contacts_record_get_str_p(record_name, _contacts_name.suffix, (char**)&suffix);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() suffix Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record_nickname, _contacts_nickname.name, (char**)&nickname);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() name Failed(%d)", err);
+
+ if (suffix && *suffix) {
+ if(strlen(suffix)>CT_EDITFIELD_MAX_CHAR){
+ suffix[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+ if (*dest) {
+ ret = snprintf(temp, sizeof(temp)-1, "%s, %s", dest, suffix);
+ if (0 < ret)
+ memcpy(dest, temp, ret+1);
+ }
+ else {
+ snprintf(dest, dest_len-1, "%s", suffix);
+ }
+ }
+
+ if (nickname && *nickname) {
+ if(strlen(nickname)>CT_EDITFIELD_MAX_CHAR){
+ nickname[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+ if (*dest) {
+ ret = snprintf(temp, sizeof(temp)-1, "%s, %s", dest, nickname);
+ if (0 < ret)
+ memcpy(dest, temp, ret+1);
+ }
+ else {
+ snprintf(dest, dest_len-1, "%s", nickname);
+ }
+ }
+}
+
+void ct_detail_person_get_extra_name(Eina_List *contact_list, contacts_record_h record_person, char *dest, int dest_len)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_name = NULL;
+ contacts_record_h record_nickname = NULL;
+ Eina_List *l;
+
+ p_retm_if(NULL == contact_list, "contact_list is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ if (NULL == record_contact)
+ continue;
+
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.name, 0, &record_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() name Failed(%d)", err);
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.nickname, 0, &record_nickname);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() nickname Failed(%d)", err);
+
+ if (CONTACTS_ERROR_NONE == err) {
+ detail_get_extra_name_str(record_name, record_nickname, dest, dest_len);
+ break;
+ }
+ }
+}
+
+char* ct_detail_gl_baseinfo_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ const char *display_name = NULL;
+ char display[PH_TEXT_MAX_LEN*4+1] ={0,} ;
+ ct_detail_data *cdetail_d = data;
+ p_retvm_if(NULL == cdetail_d, NULL, "parameter(cdetail_d) is NULL");
+
+ display[0] = '\0';
+ if (0 == strcmp(part, "elm.text.name")) {
+ if (cdetail_d->person) {
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.display_name, (char**)&display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (display_name && *display_name)
+ return strdup(display_name);
+ }
+ else if (cdetail_d->contact) {
+ err = contacts_record_get_str_p(cdetail_d->contact, _contacts_contact.display_name, (char**)&display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if ( STRLEN(display_name)>0 ) {
+ snprintf(display, sizeof(display), "%s", display_name);
+ return strdup(display);
+ }
+ else{
+ contacts_record_h record_name;
+
+ err = contacts_record_get_child_record_at_p(cdetail_d->contact, _contacts_contact.name, 0, &record_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+
+ detail_get_displayname(record_name, display, sizeof(display));
+
+ if (STRLEN(display) > 0)
+ return strdup(display);
+ }
+ }
+ }
+ else if (0 == strcmp(part, "elm.text.subname")) {
+ if (cdetail_d->list_contacts) {
+ ct_detail_person_get_extra_name(cdetail_d->list_contacts, cdetail_d->person, display, sizeof(display));
+ if (strlen(display)>0)
+ return strdup(display);
+
+ ct_detail_person_get_company_str(cdetail_d->list_contacts, display, sizeof(display));
+ if (strlen(display)>0)
+ return strdup(display);
+ }
+ }
+ else if (0 == strcmp(part, "elm.text.subname2")) {
+ if (cdetail_d->list_contacts) {
+ ct_detail_person_get_company_str(cdetail_d->list_contacts, display, sizeof(display));
+ if (strlen(display)>0)
+ return strdup(display);
+ }
+ }
+ return NULL;
+}
+
+
+static bool detail_set_favorite(contacts_record_h record_person, bool is_set)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_record_set_bool(record_person, _contacts_person.is_favorite, is_set);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_set_bool() Failed(%d)", err);
+
+ return true;
+}
+
+static void detail_favorite_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ bool is_favorite;
+ bool success;
+ int x,y,w,h;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ const char* result_msg;
+ ct_detail_data *cdetail_d = data;
+ Evas_Event_Mouse_Up *ev = event_info;
+
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get() return NULL");
+ p_retm_if(NULL == cdetail_d->person, "person is NULL");
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y || ev->output.x < x || x + w < ev->output.x)
+ return;
+
+ err = contacts_record_get_bool(cdetail_d->person, _contacts_person.is_favorite, &is_favorite);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+
+ is_favorite = !is_favorite;
+ success = detail_set_favorite(cdetail_d->person, is_favorite);
+
+ if (is_favorite && success)
+ result_msg = S_(CT_SYS_POP_ADDED);
+ else if (!is_favorite && success)
+ result_msg = S_(PH_SYS_POP_REMOVED);
+ else
+ result_msg = S_(PH_SYS_POP_FAILED);
+
+ phone_show_tickernoti(result_msg);
+ err = contacts_db_update_record(cdetail_d->person);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+
+ elm_genlist_item_update(cdetail_d->base_item);
+}
+
+static void detail_person_changed_cb(void *data)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+ p_retm_if(NULL == cdetail_d, "paramter(ct_detail_data) is NULL");
+ p_retm_if(NULL == cdetail_d->person, "paramter(cdetail_d->person) is NULL");
+ p_retm_if(0 == cdetail_d->person_id, "paramter(cdetail_d->person_id) is 0");
+
+ err = contacts_record_destroy(cdetail_d->person, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ err = contacts_db_get_record(_contacts_person._uri, cdetail_d->person_id, &(cdetail_d->person));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record(%d) Failed(%d)", cdetail_d->person_id, err);
+ }
+
+ elm_genlist_item_update(cdetail_d->base_item);
+}
+
+static void detail_image_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int x,y,w,h;
+
+ Evas_Event_Mouse_Up *ev = event_info;
+ ct_detail_data *cdetail_d = data;
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y || ev->output.x < x || x + w < ev->output.x)
+ return;
+
+ p_ret_if(NULL != cdetail_d->vcard_path);
+ p_retm_if(NULL == cdetail_d->person && NULL == cdetail_d->list_contacts, "parameter(person, list_contacts) is NULL");
+ ct_image_viewer(cdetail_d->navi, cdetail_d->person, cdetail_d->list_contacts, detail_person_changed_cb, cdetail_d);
+}
+
+Evas_Object *ct_detail_gl_baseinfo_icon_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ const char *value_data = NULL;
+ Evas_Object *img;
+ Evas_Object *icon;
+ bool is_favorite = false;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+ p_retvm_if(cdetail_d->person == NULL && cdetail_d->contact == NULL, NULL, "parameter(person/contact) is NULL");
+
+ if (0 == strcmp(part, "elm.icon.image")) {
+
+ if (cdetail_d->person)
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.image_thumbnail_path, (char**)&value_data);
+ else
+ err = contacts_record_get_str_p(cdetail_d->contact, _contacts_contact.image_thumbnail_path, (char**)&value_data);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ img = elm_image_add(obj);
+ p_retvm_if(NULL == img, NULL, "elm_image_add() return NULL");
+ evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
+ elm_image_file_set(img, value_data, NULL);
+
+ evas_object_event_callback_add(img, EVAS_CALLBACK_MOUSE_UP, detail_image_mouseup_cb, cdetail_d);
+ return img;
+ }
+ else if (0 == strcmp(part, "elm.icon.favorite")) {
+
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP, detail_favorite_mouseup_cb, cdetail_d);
+ elm_icon_resizable_set(icon, EINA_FALSE, EINA_FALSE);
+
+ if (cdetail_d->person)
+ err = contacts_record_get_bool(cdetail_d->person, _contacts_person.is_favorite, &is_favorite);
+ else{
+ if(cdetail_d->vcard_path) return NULL;
+ err = contacts_record_get_bool(cdetail_d->contact, _contacts_contact.is_favorite, &is_favorite);
+ }
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+
+ elm_icon_file_set(icon, CTUI_IMG_ICON_FAVORITE, NULL);
+ if (!is_favorite)
+ evas_object_color_set(icon, 185, 185, 185, 255);
+ else
+ evas_object_color_set(icon, 59, 115, 182, 255);
+
+ return icon;
+ }
+ return NULL;
+}
+
+
+static void __detail_voice_call_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ p_retm_if(NULL == data, "data is NULL");
+ elm_icon_file_set(data, CTUI_IMG_ICON_CALL_PRESSED, NULL);
+}
+
+static void __detail_voice_call_unpressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ p_retm_if(NULL == data, "data is NULL");
+ elm_icon_file_set(data, CTUI_IMG_ICON_CALL, NULL);
+}
+
+static void __detail_msg_ug_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ p_retm_if(NULL == data, "data is NULL");
+ elm_icon_file_set(data, CTUI_IMG_ICON_SMS_PRESSED, NULL);
+}
+
+static void __detail_msg_ug_unpressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ p_retm_if(NULL == data, "data is NULL");
+ elm_icon_file_set(data, CTUI_IMG_ICON_SMS, NULL);
+}
+
+Evas_Object *ct_detail_gl_number_util_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *fullpath;
+ const char *number;
+ contacts_record_h default_nubmer = data;
+ ct_detail_data *cdetail_d;
+ Evas_Object *btn;
+ Evas_Object *icon;
+ Evas_Smart_Cb clicked_fn = NULL;
+ Evas_Smart_Cb pressed_fn = NULL;
+ Evas_Smart_Cb unpressed_fn = NULL;
+
+ p_retv_if(NULL == data, NULL);
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retvm_if(NULL == cdetail_d, NULL, "evas_object_data_get() return NULL");
+ if (0 == strcmp(part, "elm.icon.1")) {
+ fullpath = CTUI_IMG_ICON_CALL;
+ clicked_fn = ct_detail_voice_call_cb;
+ pressed_fn = __detail_voice_call_pressed_cb;
+ unpressed_fn = __detail_voice_call_unpressed_cb;
+ }
+ else if (0 == strcmp(part, "elm.icon.2")) {
+ fullpath = CTUI_IMG_ICON_SMS;
+ clicked_fn = ct_detail_msg_ug_cb;
+ pressed_fn = __detail_msg_ug_pressed_cb;
+ unpressed_fn = __detail_msg_ug_unpressed_cb;
+ }
+ else {
+ return NULL;
+ }
+
+
+ err = contacts_record_get_str_p(default_nubmer, _contacts_number.number, (char**)&number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ btn = elm_button_add(obj);
+ p_retvm_if(NULL == btn, NULL, "elm_button_add() return NULL");
+ elm_object_style_set(btn, "detail.circle/empty");
+
+ icon = elm_icon_add(btn);
+ p_retvm_if(NULL == icon, NULL, "phone_create_icon_with_img() return NULL");
+ elm_icon_file_set(icon, fullpath, NULL);
+ elm_icon_resizable_set(icon, EINA_TRUE, EINA_TRUE);
+ elm_object_part_content_set(btn, "elm.swallow.content", icon);
+ evas_object_data_set(btn, "cdetail_d", cdetail_d);
+ evas_object_smart_callback_add(btn, "clicked", clicked_fn, number);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN, pressed_fn, icon);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, unpressed_fn, icon);
+
+ return btn;
+}
+
+void ct_detail_voice_call_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d;
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get() return NULL");
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ phone_launch_voice_call(cdetail_d->person_id, data);
+}
+
+void ct_detail_msg_ug_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d;
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get() return NULL");
+ p_retm_if(NULL != cdetail_d->child_ug, "child_ug is not null");
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ cdetail_d->child_ug = ctui_msg_ug(cdetail_d->ug, data, cdetail_d->person_id, NULL, __detail_destroy_child_ug, cdetail_d);
+}
+
+
+void ct_detail_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = data;
+ evas_object_del(cdetail_d->popup);
+ cdetail_d->popup = NULL;
+ elm_object_tree_focus_allow_set(cdetail_d->navi, EINA_TRUE);
+}
+
+const char* ct_detail_get_ringtone_display_name(const char *real_data)
+{
+ const char *data;
+
+ if (NULL == real_data)
+ data = T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT);
+ else {
+ data = strrchr(real_data, '/');
+ if (NULL == data)
+ data = real_data;
+ else
+ data = data + 1;
+ }
+ return data;
+}
+
+const char* ct_detail_get_vibration_display_name(const char *real_data)
+{
+ const char *data;
+
+ if (NULL == real_data)
+ data = T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT);
+ else {
+ data = strrchr(real_data, '/');
+ if (NULL == data)
+ data = real_data;
+ else
+ data = data + 1;
+ }
+ return data;
+}
+
+void ct_detail_get_group_names(contacts_record_h record_contact, char *dest, int dest_len)
+{
+ PH_FN_CALL;
+ int ret;
+ int index = 0;
+ int group_id;
+ char *group_str;
+ char temp[PH_TEXT_MAX_LEN];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_record_h group_record = NULL;
+ dest[0] = '\0';
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.group_relation, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_group_relation.group_id, &group_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ PH_DBG("group id = %d",group_id);
+ err = contacts_db_get_record(_contacts_group._uri,group_id, &group_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+ if(err == CONTACTS_ERROR_NONE){
+ err = contacts_record_get_str_p(group_record, _contacts_group.name, &group_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ PH_DBG("group name = %s",group_str);
+ if (group_str && *group_str) {
+ if (*dest) {
+ ret = snprintf(temp, PH_TEXT_MAX_LEN, "%s, %s", dest, group_str);
+ if (ret < dest_len) {
+ memcpy(dest, temp, ret + 1);
+ }
+ else {
+ memcpy(dest, temp, dest_len);
+ dest[dest_len - 1] = '\0';
+ }
+ }
+ else {
+ snprintf(dest, PH_TEXT_MAX_LEN, "%s", group_str);
+ }
+ }
+ }
+ err = contacts_record_destroy(group_record,true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+
+ if ('\0' == *dest)
+ snprintf(dest, dest_len, "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_NOT_ASSIGNED));
+}
+
+void ct_detail_person_get_group_names(Eina_List *contact_list, char *dest, int dest_len)
+{
+ PH_FN_CALL;
+ int ret;
+ int index = 0;
+ Eina_List *l;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_group_relation = NULL;
+ char* group_names = NULL;
+ p_retm_if(NULL == contact_list, "contact_list is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ if (NULL == record_contact)
+ continue;
+ while(CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact,
+ _contacts_contact.group_relation, index++, &record_group_relation)) {
+
+ err = contacts_record_get_str_p(record_group_relation, _contacts_group_relation.name, &group_names);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ PH_DBG("group_names = %s",group_names);
+ if (group_names && *group_names) {
+ if (*dest) {
+ char temp[PH_TEXT_MAX_LEN];
+ ret = snprintf(temp, sizeof(temp), "%s, %s", dest, group_names);
+ if (0 < ret)
+ memcpy(dest, temp, ret+1);
+ }
+ else {
+ snprintf(dest, dest_len, "%s", group_names);
+ }
+ }
+ }
+ index = 0;
+ }
+ if ('\0' == *dest)
+ snprintf(dest, dest_len, "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_NOT_ASSIGNED));
+}
+
+void ct_detail_refresh_view(ct_detail_data *cdetail_d)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ if (cdetail_d->person) {
+ err = contacts_record_destroy(cdetail_d->person, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ cdetail_d->person = NULL;
+ }
+ ctui_free_record_list(cdetail_d->list_contacts);
+ cdetail_d->list_contacts = NULL;
+
+ if (cdetail_d->person_id) {
+ err = contacts_db_get_record( _contacts_person._uri, cdetail_d->person_id, &(cdetail_d->person));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ elm_naviframe_item_pop(cdetail_d->navi);
+ return;
+ }
+
+ cdetail_d->list_contacts = ctui_person_get_contact_list(cdetail_d->person_id);
+ }
+ else{
+ contacts_list_h list_contacts = NULL;
+ int fd = 0;
+ int size = 0;
+ char buf[CT_VCARD_FILE_MAX_SIZE+1] = {0, };
+
+ fd = open(cdetail_d->vcard_path, O_RDONLY);
+ p_retm_if(-1 == fd, "open() return -1");
+ size = read(fd, buf, sizeof(buf)-1);
+ close(fd);
+
+ err = contacts_vcard_parse_to_contacts(buf, &list_contacts);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_vcard_parse_to_contacts() Failed(%d)", err);
+ while (CONTACTS_ERROR_NONE == err) {
+ err = contacts_list_get_current_record_p(list_contacts, &(cdetail_d->contact));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ err = contacts_list_destroy(list_contacts, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy(list_contacts) Failed(%d)", err);
+ elm_exit();
+ }
+ cdetail_d->list_contacts = eina_list_append(cdetail_d->list_contacts, cdetail_d->contact);
+ }
+ err = contacts_list_destroy(list_contacts, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy(list_contacts) Failed(%d)", err);
+ }
+ ctui_detail_genlist_update(cdetail_d);
+}
+
+void ct_detail_contact_changed(const char *view_uri, void *user_data)
+{
+ PH_FN_CALL;
+ int addressbook_id = 0;
+ int contact_id = 0;
+ int changed_id = 0;
+ int changed_type = 0;
+ int out_current_version = 0;
+ bool changed = false;
+ ct_detail_data *cdetail_d = user_data;
+ Eina_List *l;
+ contacts_record_h record_contact;
+ contacts_list_h out_change_list;
+ contacts_error_e err;
+
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, record_contact) {
+ if (NULL == record_contact) continue;
+ err = contacts_record_get_int(record_contact, _contacts_contact.address_book_id, &addressbook_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() Failed(%d)", err);
+
+ err = contacts_record_get_int(record_contact, _contacts_contact.id, &contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list() Failed(%d)", err);
+
+ changed = false;
+ err = contacts_db_get_changes_by_version( _contacts_contact_updated_info._uri, addressbook_id, cdetail_d->view_create_version, &out_change_list, &out_current_version);
+
+ while (CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_int_from_list(out_change_list, _contacts_contact_updated_info.contact_id, &changed_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list(addressbook_id) Failed(%d)", err);
+ if (changed_id == contact_id){
+ changed = true;
+ phone_cts_get_int_from_list(out_change_list, _contacts_contact_updated_info.type, &changed_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_int_from_list(type) Failed(%d)", err);
+ break;
+ }
+ err = contacts_list_next(out_change_list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ }
+
+ err = contacts_list_destroy(out_change_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy(out_change_list) Failed(%d)", err);
+
+ if (changed)
+ break;
+ }
+ cdetail_d->view_create_version = out_current_version;
+
+ if (cdetail_d->updated)
+ cdetail_d->updated = false;
+
+ if (CONTACTS_CHANGE_DELETED == changed_type) {
+ if (cdetail_d->is_shortcut)
+ elm_exit();
+ else if (NULL == cdetail_d->prev_view_data && cdetail_d->ug)
+ ug_destroy_me(cdetail_d->ug);
+ else
+ elm_naviframe_item_pop_to(cdetail_d->prev_navi_item);
+ }
+ else {
+ ct_detail_refresh_view(cdetail_d);
+ }
+}
+
+static inline void detail_append_str_with_linebreak(const char *src, char *dest, int dest_len)
+{
+ char temp[PH_TEXT_MAX_LEN];
+ if (src && '\0' != src[0]) {
+ if ('\0' == dest[0])
+ snprintf(dest, dest_len, "%s", src);
+ else {
+ snprintf(temp, sizeof(temp), "%s\n%s", src, dest);
+ snprintf(dest, dest_len, "%s", temp);
+ }
+ }
+}
+
+int ct_detail_get_full_addr(contacts_record_h record, char *buf, int buf_len)
+{
+ const char *code;
+ const char *region;
+ const char *locality;
+ const char *street;
+ const char *extended;
+ const char *country;
+ const char *pobox;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_record_get_str_p(record, _contacts_address.postal_code , (char**)&code);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(postal_code) Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address.extended , (char**)&extended);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(extend) Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address.postbox , (char**)&pobox);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(postbox) Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address.street , (char**)&street);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(street) Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address.locality , (char**)&locality);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(locality) Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address.region , (char**)&region);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(region) Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_address.country ,(char**)&country);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list(country) Failed(%d)", err);
+
+ detail_append_str_with_linebreak(country, buf, buf_len);
+ detail_append_str_with_linebreak(region, buf, buf_len);
+ detail_append_str_with_linebreak(locality, buf, buf_len);
+ detail_append_str_with_linebreak(street, buf, buf_len);
+ detail_append_str_with_linebreak(pobox, buf, buf_len);
+ detail_append_str_with_linebreak(extended, buf, buf_len);
+ detail_append_str_with_linebreak(code, buf, buf_len);
+
+ return 0;
+
+}
+
+void ct_detail_mouseup(void *data, Evas *evas, Evas_Object *obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ ct_detail_data *cdetail_d = data;
+ cdetail_d->touch_x = ev->canvas.x;
+ cdetail_d->touch_y = ev->canvas.y;
+}
+
+static void detail_myfile_ringtone_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ ct_detail_data *cdetail_d = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "result", &val);
+ p_retm_if(!val, "return value is NULL");
+ p_retm_if(NULL == cdetail_d->person, "person is NULL");
+
+ err = contacts_record_set_str(cdetail_d->person, _contacts_person.ringtone_path, (const char *)val);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ err = contacts_db_update_record(cdetail_d->person);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ ctui_create_contacts_error_popup(cdetail_d->navi, err);
+
+ elm_genlist_item_update(cdetail_d->ringtone_item);
+ free(val);
+ }
+}
+
+void ct_detail_myfile_ringtone(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ struct ug_cbs cbs = {0};
+
+ service_h service;
+ char *str = NULL;
+ char buf[PH_TEXT_MAX_LEN+1];
+ const char *ringtone_path = NULL;
+ ct_detail_data *cdetail_d = data;
+
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.ringtone_path, &str);
+ if(CONTACTS_ERROR_NONE == err)
+ ringtone_path = ct_detail_get_ringtone_display_name(str);
+
+ service_create(&service);
+ service_add_extra_data(service, "path", "/opt/share/settings/Ringtones");
+ service_add_extra_data(service, "select_type", "SINGLE_FILE");
+ service_add_extra_data(service, "file_type", "SOUND");
+ if (ringtone_path) {
+ snprintf(buf, sizeof(buf), "/opt/share/settings/Ringtones/%s", ringtone_path);
+ service_add_extra_data(service, "marked_mode", buf);
+ }
+
+ cbs.result_cb = detail_myfile_ringtone_result;
+ cbs.destroy_cb = detail_destroy_child_ug;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cdetail_d;
+
+ cdetail_d->child_ug = ug_create(cdetail_d->ug, MYFILES_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cdetail_d->child_ug, "ug_create() Failed");
+
+ service_destroy(service);
+
+ if (cdetail_d->popup) {
+ evas_object_del(cdetail_d->popup);
+ cdetail_d->popup = NULL;
+ }
+}
+
+static void detail_vibration_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ ct_detail_data *cdetail_d = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "result", &val);
+ p_retm_if(!val, "return value is NULL");
+ p_retm_if(NULL == cdetail_d->person, "person is NULL");
+
+ err = contacts_record_set_str(cdetail_d->person, _contacts_person.vibration, (const char *)val);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ err = contacts_db_update_record(cdetail_d->person);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ ctui_create_contacts_error_popup(cdetail_d->navi, err);
+
+ elm_genlist_item_update(cdetail_d->vibration_item);
+ free(val);
+ }
+}
+
+void ct_detail_myfile_vibration(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ const char *vibration_path = NULL;
+ struct ug_cbs cbs = {0};
+ service_h service;
+ ct_detail_data *cdetail_d = data;
+
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.vibration, &vibration_path);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)",err);
+
+ service_create(&service);
+ service_add_extra_data(service, "caller", "org.tizen.phone");
+ if (vibration_path) {
+ service_add_extra_data(service, "selected", vibration_path);
+ }
+
+ cbs.result_cb = detail_vibration_result;
+ cbs.destroy_cb = detail_destroy_child_ug;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cdetail_d;
+
+ cdetail_d->child_ug = ug_create(cdetail_d->ug, VIBRATION_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cdetail_d->child_ug, "ug_create() Failed");
+
+ service_destroy(service);
+ if (cdetail_d->popup) {
+ evas_object_del(cdetail_d->popup);
+ cdetail_d->popup = NULL;
+ }
+}
+
+static Evas_Object* detail_list_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_person_list* person_info = data;
+ contacts_record_h record_person = NULL;
+
+ p_retvm_if(NULL == person_info, NULL, "person_info is NULL");
+
+ if (0 == strcmp(part, "elm.icon.1")) {
+ const char *path;
+ Evas_Object *icon;
+
+ if (!person_info->img_loaded) {
+ err = contacts_db_get_record( _contacts_person._uri, person_info->id, &record_person);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record(%d) Failed(%d)", person_info->id, err);
+
+ err = contacts_record_get_str(record_person, _contacts_person.image_thumbnail_path, &(person_info->img_path));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+ person_info->img_loaded = true;
+
+ err = contacts_record_destroy(record_person, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+
+ path = person_info->img_path;
+ if (NULL == path) return NULL;
+
+ icon = elm_icon_add(obj);
+ if (icon) {
+ elm_icon_prescale_set(icon, CT_LIST_ICON_SIZE);
+ elm_icon_file_set(icon, path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ evas_object_show(icon);
+ }
+ return icon;
+ }
+ else if (0 == strcmp(part, "elm.icon.2")) {
+ Evas_Object *icon;
+ char *icon_path;
+ int addressbook_id = ctui_get_addressbook_id_by_index(person_info->addressbook_id_list, 0);
+
+ if(addressbook_id < 0)
+ return NULL;
+
+ icon_path = ctui_get_addressbook_icon_path(addressbook_id);
+ if (NULL == icon_path)
+ return NULL;
+
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+
+ elm_icon_file_set(icon, icon_path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ free(icon_path);
+ return icon;
+ }
+ else if (0 == strcmp(part, "elm.icon.3")) {
+ return NULL;
+ }
+ else if (0 == strcmp(part, "elm.icon.4")) {
+ return NULL;
+ }
+ return NULL;
+}
+
+static void detial_list_create_itcs(ct_list_data *clist_d)
+{
+ clist_d->itcs[CT_LIST_ITEM_NO_NUMBER].item_style = "link_list";
+ clist_d->itcs[CT_LIST_ITEM_NO_NUMBER].func.text_get = ct_list_gl_label_get;
+ clist_d->itcs[CT_LIST_ITEM_NO_NUMBER].func.content_get = detail_list_gl_icon_get;
+
+ clist_d->itcs[CT_LIST_ITEM].item_style = "link_list";
+ clist_d->itcs[CT_LIST_ITEM].func.text_get = ct_list_gl_label_get;
+ clist_d->itcs[CT_LIST_ITEM].func.content_get = detail_list_gl_icon_get;
+
+ clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER].item_style = "link_list.tb";
+ clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER].func.text_get = ct_list_gl_label_get;
+ clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER].func.content_get = detail_list_gl_icon_get;
+
+ clist_d->itcs[CT_LIST_ITEM_SEARCH].item_style = "link_list.tb";
+ clist_d->itcs[CT_LIST_ITEM_SEARCH].func.text_get = ct_list_gl_label_get;
+ clist_d->itcs[CT_LIST_ITEM_SEARCH].func.content_get = detail_list_gl_icon_get;
+
+ clist_d->itcs[CT_LIST_ITEM_COUNT].item_style="1text_center";
+ clist_d->itcs[CT_LIST_ITEM_COUNT].func.text_get = ct_list_count_gl_label_get;
+}
+
+void ct_detail_create_list_view(ct_detail_data *cdetail_d, Evas_Smart_Cb sel_cb, void *cb_data, int id_caller)
+{
+ ct_list_data *clist_d;
+ char buf[PH_TEXT_MAX_LEN+1];
+ Evas_Object *btn;
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON;
+ clist_d->selected_person_id = id_caller;
+ clist_d->navi = cdetail_d->navi;
+ clist_d->win = cdetail_d->win;
+ clist_d->ug = cdetail_d->ug;
+ clist_d->gl_sel = sel_cb;
+ clist_d->gl_sel_data = cb_data;
+
+ ct_list_init_account_data(clist_d);
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ detial_list_create_itcs(clist_d);
+ clist_d->base_layout = ct_list_create_contact_layout(clist_d);
+
+ FREEandSTRDUP(clist_d->title, T_(CT_GET_TEXT_BASIC, CTTEXT_ALL_CONTACTS));
+ snprintf(buf, sizeof(buf), "%s (%d)", clist_d->title, clist_d->cnt_list_total);
+ clist_d->navi_item = elm_naviframe_item_push(clist_d->navi, buf, NULL, NULL, clist_d->base_layout, NULL);
+
+ btn = elm_button_add(clist_d->navi);
+ elm_object_style_set(btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(btn, "clicked", phone_view_back_btn_cb, clist_d->navi);
+ elm_object_item_part_content_set(clist_d->navi_item, "prev_btn", btn);
+}
+
+static void __detail_ug_error_popup_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ug_destroy_me(data);
+}
+
+int ct_detail_load_vcard_contact(ct_detail_data *cdetail_d, char *path)
+{
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ FILE *fp;
+ char vcard_stream[1024*100];
+ PH_DBG("path = %s", path);
+
+ fp = fopen(path, "r");
+ if (NULL == fp) {
+ ERR("fopen() return NULL");
+ elm_exit();
+ return -1;
+ }
+ ret = fread(vcard_stream, 1, sizeof(vcard_stream), fp);
+ if (0 < ret && ret < sizeof(vcard_stream)) {
+ int fd = 0;
+ int size = 0;
+ char buf[CT_VCARD_FILE_MAX_SIZE+1] = {0, };
+ contacts_record_h record = NULL;
+ contacts_list_h list_contacts = NULL;
+ vcard_stream[ret] = '\0';
+
+ cdetail_d->vcard_path = strdup(path);
+
+ fd = open(cdetail_d->vcard_path, O_RDONLY);
+ if(fd < 0){
+ close(fp);
+ ERR("vOpen(%s) Failed", cdetail_d->vcard_path);
+ return -1;
+ }
+ size = read(fd, buf, sizeof(buf)-1);
+ close(fd);
+
+ err = contacts_vcard_parse_to_contacts(buf, &list_contacts);
+ while (CONTACTS_ERROR_NONE == err) {
+ contacts_list_get_current_record_p(list_contacts, &record);
+ if (NULL == cdetail_d->contact) cdetail_d->contact = record;
+ cdetail_d->list_contacts = eina_list_append(cdetail_d->list_contacts, record);
+ err = contacts_list_next(list_contacts);
+ }
+ err = contacts_list_destroy(list_contacts, false);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_vcard_parse_to_contacts() Failed(%d)", err);
+ fclose(fp);
+ return -1;
+ }
+ }
+ else {
+ ERR("vcard is invalid(%d)", ret);
+ cdetail_d->popup = phone_show_popup(cdetail_d->win, S_(CT_SYS_POP_ERROR), 1.5);
+ evas_object_smart_callback_add(cdetail_d->popup, "timeout", __detail_ug_error_popup_cb, cdetail_d->ug);
+ }
+ fclose(fp);
+ return 0;
+}
+
+void ct_detail_person_get_addressbook_name(contacts_record_h record_contact, char *buf, int buf_len)
+{
+ int addressbook_id;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ const char *display_name;
+ char temp[PH_TEXT_MAX_LEN];
+ contacts_record_h record_addressbook = NULL;
+
+ buf[0] = '\0';
+
+ err = contacts_record_get_int(record_contact, _contacts_contact.address_book_id, &addressbook_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int(address_book_id) Failed(%d)", err);
+
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record_addressbook);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record_addressbook, _contacts_address_book.name, (char**)&display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (display_name && *display_name) {
+ if (*buf) {
+ snprintf(temp, sizeof(temp), "%s, %s", buf, display_name);
+ snprintf(buf, buf_len, "%s", temp);
+ }
+ else {
+ snprintf(buf, buf_len, "%s", display_name);
+ }
+ }
+ err = contacts_record_destroy(record_addressbook, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+}
+
+static bool __phone_list_is_postal_exist(Eina_List *list, const char *postal_str)
+{
+ Eina_List *l;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ char postaladdress_tmp[PH_TEXT_MAX_LEN] = {0,};
+ if (NULL == record_temp)
+ continue;
+
+ ct_detail_get_full_addr(record_temp, postaladdress_tmp, sizeof(postaladdress_tmp));
+ if (0 == strcmp(postaladdress_tmp, postal_str)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Eina_List* ct_detail_person_get_postal_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *l;
+ Eina_List *list_postal_record = NULL;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_address = NULL;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(contact_list == NULL, NULL, "Parameter(contact_list) is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.address, index++, &record_address)) {
+ char postaladdress[PH_TEXT_MAX_LEN] = {0,};
+ ct_detail_get_full_addr(record_address, postaladdress, sizeof(postaladdress));
+ if(checkduplicate){
+ if (__phone_list_is_postal_exist(list_postal_record, postaladdress)) {
+ ERR("__phone_list_is_postal_exist() return true number = %s", postaladdress);
+ continue;
+ }
+ }
+ err = contacts_record_clone(record_address, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ break;
+ }
+ list_postal_record = eina_list_append(list_postal_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_postal_record;
+}
+
+static bool __phone_list_is_messenger_exist(Eina_List *list, const char *messenger)
+{
+ Eina_List *l;
+ char *messenger_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_str_p(record_temp, _contacts_messenger.im_id, &messenger_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == messenger_temp)
+ continue;
+
+ if (0 == strcmp(messenger_temp, messenger)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Eina_List* ct_detail_person_get_messenger_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ char *messenger;
+ Eina_List *l;
+ Eina_List *list_messenger_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_messenger = NULL;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(contact_list == NULL, NULL, "Parameter(contact_list) is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.messenger, index++, &record_messenger)) {
+ err = contacts_record_get_str_p(record_messenger, _contacts_messenger.im_id, &messenger);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ if(checkduplicate){
+ if (__phone_list_is_messenger_exist(list_messenger_record, messenger)) {
+ ERR("__phone_list_is_email_exist() return true messenger = %s", messenger);
+ continue;
+ }
+ }
+ err = contacts_record_clone(record_messenger, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_messenger_record = eina_list_append(list_messenger_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_messenger_record;
+}
+
+static bool __phone_list_is_website_exist(Eina_List *list, const char *website)
+{
+ Eina_List *l;
+ char *website_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_str_p(record_temp, _contacts_url.url, &website_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == website_temp)
+ continue;
+
+ if (0 == strcmp(website_temp, website)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Eina_List* ct_detail_person_get_website_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index=0;
+ char *website;
+ Eina_List *l;
+ Eina_List *list_website_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_url = NULL;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(contact_list == NULL, NULL, "Parameter(contact_list) is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.url, index++, &record_url)) {
+ err = contacts_record_get_str_p(record_url, _contacts_url.url, &website);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ if (checkduplicate && __phone_list_is_website_exist(list_website_record, website)) {
+ ERR("__phone_list_is_email_exist() return true URL = %s", website);
+ continue;
+ }
+ err = contacts_record_clone(record_url, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_website_record = eina_list_append(list_website_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_website_record;
+}
+
+static bool __phone_list_is_relationship_exist(Eina_List *list, const char *relationship_name)
+{
+ Eina_List *cursor;
+ char *relationship_name_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, cursor, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_str_p(record_temp, _contacts_relationship.name, &relationship_name_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == relationship_name_temp)
+ continue;
+
+ if (0 == strcmp(relationship_name_temp, relationship_name)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Eina_List* ct_detail_person_get_relationship_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ char *relationship_name;
+ Eina_List *l;
+ Eina_List *list_relationship_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_relationship = NULL;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(contact_list == NULL, NULL, "Parameter(contact_list) is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.relationship, index++, &record_relationship)) {
+ err = contacts_record_get_str_p(record_relationship, _contacts_relationship.name, &relationship_name);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ if (checkduplicate && __phone_list_is_relationship_exist(list_relationship_record, relationship_name)) {
+ ERR("__phone_list_is_relationship_exist() return true URL = %s", relationship_name);
+ continue;
+ }
+ err = contacts_record_clone(record_relationship, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_relationship_record = eina_list_append(list_relationship_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_relationship_record;
+}
+
+static bool __phone_list_is_event_exist(Eina_List *list, int event_date)
+{
+ Eina_List *l;
+ int event_date_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_int(record_temp, _contacts_event.date, &event_date_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_int() Failed(%d)", err);
+
+ if (event_date_temp == event_date) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Eina_List* ct_detail_person_get_event_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ int event_date;
+ Eina_List *l;
+ Eina_List *list_event_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_event = NULL;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(contact_list == NULL, NULL, "Parameter(contact_list) is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.event, index++, &record_event)) {
+ err = contacts_record_get_int(record_event, _contacts_event.date, &event_date);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+ if (checkduplicate && __phone_list_is_event_exist(list_event_record, event_date)) {
+ ERR("__phone_list_is_email_exist() return true event_date = %d", event_date);
+ continue;
+ }
+ err = contacts_record_clone(record_event, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_event_record = eina_list_append(list_event_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_event_record;
+}
+
+static bool __phone_list_is_note_exist(Eina_List *list, const char *note)
+{
+ Eina_List *l;
+ char *note_temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ EINA_LIST_FOREACH(list, l, record_temp) {
+ if (NULL == record_temp)
+ continue;
+
+ err = contacts_record_get_str_p(record_temp, _contacts_note.note, &note_temp);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == note_temp)
+ continue;
+
+ if (0 == strcmp(note_temp, note)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Eina_List* ct_detail_person_get_note_list(Eina_List *contact_list)
+{
+ Eina_Bool checkduplicate = false;
+ int index = 0;
+ char *note;
+ Eina_List *l;
+ Eina_List *list_note_record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_note = NULL;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(contact_list == NULL, NULL, "Parameter(contact_list) is NULL");
+
+ EINA_LIST_FOREACH(contact_list, l, record_contact) {
+ index = 0;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.note, index++, &record_note)) {
+ err = contacts_record_get_str_p(record_note, _contacts_note.note, &note);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ if (checkduplicate && __phone_list_is_note_exist(list_note_record, note)) {
+ ERR("__phone_list_is_email_exist() return true note = %s", note);
+ continue;
+ }
+ err = contacts_record_clone(record_note, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ list_note_record = eina_list_append(list_note_record, record_clone);
+ }
+ checkduplicate = true;
+ }
+ return list_note_record;
+}
+
+// TODO: Fixme
+int ct_detail_get_address_type_index(int type)
+{
+ switch (type) {
+ case CONTACTS_ADDRESS_TYPE_CUSTOM:
+ return 1;
+ case CONTACTS_ADDRESS_TYPE_HOME:
+ return 2;
+ case CONTACTS_ADDRESS_TYPE_WORK:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+// TODO: Fixme
+int ct_detail_get_website_type_index(int type)
+{
+ switch (type) {
+ case CONTACTS_URL_TYPE_CUSTOM:
+ return 1;
+ case CONTACTS_URL_TYPE_HOME:
+ return 2;
+ case CONTACTS_URL_TYPE_WORK:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+bool ct_detail_person_get_readonly(Eina_List *list_contacts)
+{
+ PH_FN_CALL;
+ int addressbook_id = -1;
+ int addressbook_mode = CONTACTS_ADDRESS_BOOK_MODE_READONLY;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *l;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_addressbook = NULL;
+
+ p_retvm_if(NULL == list_contacts, true, "list_contacts is NULL");
+
+ EINA_LIST_FOREACH(list_contacts, l, record_contact){
+ if (NULL == record_contact)
+ continue;
+
+ err = contacts_record_get_int(record_contact, _contacts_contact.address_book_id, &addressbook_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_db_get_record(_contacts_address_book._uri, addressbook_id, &record_addressbook);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_int(record_addressbook, _contacts_address_book.mode, &addressbook_mode);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_destroy(record_addressbook, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_record_destroy() Failed(%d)", err);
+
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY != addressbook_mode)
+ return false;
+ }
+ return true;
+}
+
+UDateFormat* ct_detail_init_time_formatter(void)
+{
+ const char *locale;
+ int32_t pattern_capacity;
+ UChar pattern[PH_TEXT_SHORT_LEN];
+ UChar customSkeleton[PH_TEXT_SHORT_LEN];
+ UDateFormat *formatter = NULL;
+ UDateTimePatternGenerator generator;
+ UErrorCode status = U_ZERO_ERROR;
+
+ u_uastrncpy(customSkeleton, UDAT_YEAR_MONTH_DAY, strlen(UDAT_YEAR_MONTH_DAY));
+
+ locale = uloc_getDefault();
+ p_retvm_if(NULL == locale, NULL, "uloc_getDefault() return NULL");
+
+ generator = udatpg_open(locale, &status);
+ p_retvm_if(U_FAILURE(status), NULL, "udatpg_open() Failed()");
+
+ pattern_capacity = (int32_t) (sizeof(pattern) / sizeof((pattern)[0]));
+ udatpg_getBestPattern(generator, customSkeleton, 6, pattern, pattern_capacity, &status);
+
+ if (!U_FAILURE(status))
+ formatter = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, pattern, -1, &status);
+
+ udatpg_close(generator);
+ return formatter;
+}
+
+char* ct_detail_get_datetime_str(UDateFormat* formatter, int year, int mon, int day)
+{
+ time_t timer;
+ struct tm stime;
+ char *ret_str = NULL;
+ char formatted_str[PH_TEXT_SHORT_LEN];
+ int32_t formattedCapacity;
+ UChar formatted[PH_TEXT_SHORT_LEN];
+ UErrorCode status = U_ZERO_ERROR;
+
+ memset(&stime, 0, sizeof(struct tm));
+ stime.tm_year = year-1900;
+ stime.tm_mon = mon-1;
+ stime.tm_mday = day;
+ timer = mktime(&stime);
+
+ formattedCapacity = (int32_t)(sizeof(formatted)/sizeof((formatted)[0]));
+ udat_format(formatter, (UDate)timer*1000, formatted, formattedCapacity, NULL, &status);
+ p_retvm_if(U_FAILURE(status), NULL, "udat_format() Failed()");
+
+ u_austrcpy(formatted_str, formatted);
+ ret_str = g_strdup(formatted_str);
+
+ return ret_str;
+}
+
diff --git a/lib/details/ct-detail-utils.h b/lib/details/ct-detail-utils.h
new file mode 100755
index 0000000..fee753b
--- /dev/null
+++ b/lib/details/ct-detail-utils.h
@@ -0,0 +1,66 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef __CONTACTS_DETAIL_UTILS_H__
+#define __CONTACTS_DETAIL_UTILS_H__
+
+enum CT_BLOCK_TYPE {
+ CT_BLOCK_CALL = 0x01,
+ CT_BLOCK_MESSAGE = 0x02,
+};
+
+void ct_detail_make_vcard(ct_detail_data *cdetail_d);
+void ct_detail_send_via_msg(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_send_via_email(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_send_via_bluetooth(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_delete_namecards(ct_detail_data *cdetail_d);
+void ct_detail_popup_hide_cb(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_contact_changed(const char *view_uri, void *user_data);
+void ct_detail_mouseup(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+const char* ct_detail_get_ringtone_display_name(const char *real_data);
+const char* ct_detail_get_vibration_display_name(const char *real_data);
+void ct_detail_get_group_names(contacts_record_h record_contact, char *dest, int dest_len);
+int ct_detail_get_full_addr(contacts_record_h record, char *buf, int buf_len);
+int ct_detail_parse_bundle(service_h service, ct_detail_data* cdetail_d, int *ret);
+void ct_detail_myfile_ringtone(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_myfile_vibration(void *data, Evas_Object *obj, void *event_info);
+char* ct_detail_gl_baseinfo_label_get(void *data, Evas_Object *obj, const char *part);
+Evas_Object* ct_detail_gl_baseinfo_icon_get(void *data, Evas_Object *obj, const char *part);
+Evas_Object* ct_detail_gl_number_util_icon_get(void *data, Evas_Object *obj, const char *part);
+void ct_detail_voice_call_cb(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_msg_ug_cb(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_create_list_view(ct_detail_data *cdetail_d, Evas_Smart_Cb sel_cb, void *cb_data, int id_caller);
+int ct_detail_load_vcard_contact(ct_detail_data *cdetail_d, char *path);
+void ct_detail_person_get_group_names(Eina_List *contact_list, char *dest, int dest_len);
+void ct_detail_person_get_company_str(Eina_List *contact_list, char *dest, int dest_len);
+void ct_detail_person_get_extra_name(Eina_List *contact_list, contacts_record_h record_person, char *dest, int dest_len);
+void ct_detail_person_get_addressbook_name(contacts_record_h record_account, char *buf, int buf_len);
+Eina_List* ct_detail_person_get_postal_list(Eina_List *contact_list);
+Eina_List* ct_detail_person_get_messenger_list(Eina_List *contact_list);
+Eina_List* ct_detail_person_get_website_list(Eina_List *contact_list);
+Eina_List* ct_detail_person_get_relationship_list(Eina_List *contact_list);
+Eina_List* ct_detail_person_get_event_list(Eina_List *contact_list);
+Eina_List* ct_detail_person_get_note_list(Eina_List *contact_list);
+void ctui_person_free_contact_list(Eina_List *contact_list);
+int ct_detail_get_address_type_index(int type);
+int ct_detail_get_website_type_index(int type);
+bool ct_detail_person_get_readonly(Eina_List *list_contacts);
+UDateFormat* ct_detail_init_time_formatter(void);
+char* ct_detail_get_datetime_str(UDateFormat* formatter, int year, int mon, int day);
+void ct_detail_refresh_view(ct_detail_data *cdetail_d);
+
+#endif //__CONTACTS_DETAIL_UTILS_H__
diff --git a/lib/details/ct-detail-view.c b/lib/details/ct-detail-view.c
new file mode 100755
index 0000000..507b8dc
--- /dev/null
+++ b/lib/details/ct-detail-view.c
@@ -0,0 +1,2617 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <ui-gadget-module.h>
+
+#include <errno.h>
+#include <string.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <app.h>
+#include <msg.h>
+#include <account.h>
+
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-detail-utils.h"
+#include "ct-detail-view.h"
+#include "ct-detail-history.h"
+#include "ct-detail-activity.h"
+#include "ct-list.h"
+#include "ct-input-view.h"
+#include "ct-group.h"
+#include "ct-group-assign-view.h"
+
+#define _CT_LINK
+
+enum DETAIL_ITC_TYPE {
+ DETAIL_ITC_NOTE = 0,
+ DETAIL_ITC_NUM_UTIL_BTN,
+ DETAIL_ITC_UTIL_BTN,
+ DETAIL_ITC_ADDRBOOK,
+ DETAIL_ITC_NUMBER,
+ DETAIL_ITC_EMAIL,
+ DETAIL_ITC_URL,
+ DETAIL_ITC_MESSENGER,
+ DETAIL_ITC_EVENT,
+ DETAIL_ITC_RINGTONE,
+ DETAIL_ITC_VIBRATION,
+ DETAIL_ITC_GROUP,
+ DETAIL_ITC_RELATIONSHIP,
+ DETAIL_ITC_NUMBER_DEFAULT,
+ DETAIL_ITC_EMAIL_DEFAULT,
+ DETAIL_ITC_ADDRESS,
+ DETAIL_ITC_LINK_UNLINK,
+ DETAIL_ITC_UNLINK_POPUP,
+ DETAIL_ITC_EDIT_POPUP,
+ DETAIL_ITC_LINK_LIST,
+ DETAIL_ITC_LINK_LIST_SUB,
+ DETAIL_ITC_FIELD_TITLE,
+ DETAIL_ITC_FIELD,
+ DETAIL_ITC_TITLE,
+ DETAIL_ITC_UTIL_1BTN,
+ DETAIL_ITC_BASEINFO_1TEXT_1ICON,
+ DETAIL_ITC_BASEINFO_1TEXT_2ICON,
+ DETAIL_ITC_BASEINFO_2TEXT_1ICON,
+ DETAIL_ITC_BASEINFO_2TEXT_2ICON,
+ DETAIL_ITC_BASEINFO_3TEXT_1ICON,
+ DETAIL_ITC_BASEINFO_3TEXT_2ICON,
+ DETAIL_ITC_DEFAULT_NUMBER_SET_POPUP,
+ DETAIL_ITC_DEFAULT_EMAIL_SET_POPUP,
+ DETAIL_ITC_DEFAULT_NAME_POPUP,
+ DETAIL_ITC_MAX,
+};
+
+static Elm_Genlist_Item_Class detail_itcs[] = {
+ {.item_style="multiline/dialogue/2text"}, /* NOTE */
+ {.item_style="detail.3icon"}, /* NUMBER UTIL BUTTON */
+ {.item_style="dialogue/bg/2icon"}, /* UTIL BUTTON */
+ {.item_style="detail.title"}, /* ADDRESSBOOK */
+ {.item_style="detail.field.2text"}, /* NUMBER */
+ {.item_style="detail.field.2text"}, /* EMAIL */
+ {.item_style="detail.field.2text"}, /* URL */
+ {.item_style="dialogue/2text.2"}, /*MESSENGER */
+ {.item_style="2text.3"}, /*BIRTH*/
+ {.item_style="dialogue/2text.3"}, /* RINGTONE */
+ {.item_style="dialogue/2text.3"}, /* VIBRATION */
+ {.item_style="dialogue/2text.3"}, /* GROUP */
+ {.item_style="2text.3"}, /* RELATIONSHIP */
+ {.item_style="baseinfo.1text"}, /* DEFAULT NUMBER */
+ {.item_style="detail.field.2text"}, /* DEFAULT EMAIL */
+ {.item_style="detail.field.2text"}, /* ADDRESS */
+ {.item_style="dialogue/bg/2icon"}, /* LINK, UNLINK */
+ {.item_style="1text.1icon.2"}, /* UNLINK POPUP */
+ {.item_style="1text.1icon.2"}, /* EDIT POPUP */
+ {.item_style="dialogue/1text/expandable"}, /* LINK LIST */
+ {.item_style="dialogue/1text.1icon.2/expandable2"}, /* LINK LIST SUB */
+ {.item_style="detail.fieldtitle.1text"}, /* FIELD TITLE */
+ {.item_style="detail.field.2text"}, /* FIELD */
+ {.item_style="dialogue/title"}, /* TITLE */
+ {.item_style="dialogue/bg/1icon"}, /* UTIL 1 BUTTON */
+ {.item_style="baseinfo.1text.1icon"}, /* BASEINFO 1TEXT 1ICON */
+ {.item_style="baseinfo.1text.2icon"}, /* BASEINFO 1TEXT 2ICON */
+ {.item_style="baseinfo.2text.1icon"}, /* BASEINFO 2TEXT 1ICON */
+ {.item_style="baseinfo.2text.2icon"}, /* BASEINFO 2TEXT 2ICON */
+ {.item_style="baseinfo.3text.1icon"}, /* BASEINFO 3TEXT 1ICON */
+ {.item_style="baseinfo.3text.2icon"}, /* BASEINFO 3TEXT 2ICON */
+ {.item_style="dialogue/2text.6"}, /* DEFAULT NUMBER SET POPUP*/
+ {.item_style="dialogue/2text.6"}, /* DEFAULT EMAIL SET POPUP*/
+ {.item_style="1text"}, /* DEFAULT NAME */
+};
+
+static Elm_Genlist_Item_Class detail_ringtone_itc, detail_vibration_itc;
+
+
+static void detail_fill_number_list(Evas_Object *genlist, Eina_List *list, Evas_Smart_Cb func, int default_num_id);
+static void detail_fill_email_list(Evas_Object *genlist, Eina_List *list, Evas_Smart_Cb func, int default_num_id);
+
+static char* detail_gl_2text_multiline_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *note;
+ contacts_record_h record = data;
+
+ p_retv_if(NULL == record, NULL);
+
+ if (0 == strcmp(part, "elm.text.1")) {
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_NOTE));
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ contacts_record_get_str_p(record, _contacts_note.note, &note);
+ if (note && *note)
+ return elm_entry_utf8_to_markup(note);
+ }
+ return NULL;
+}
+
+static char* detail_gl_ringtone_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *str;
+ ct_detail_data *cdetail_d = data;
+ contacts_record_h record_person = cdetail_d->person;
+ p_retv_if(NULL == record_person, NULL);
+
+ if (0 == strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_RINGTONE));
+ else if (0 == strcmp(part, "elm.text.2")) {
+ err