summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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
271 files changed, 52425 insertions, 0 deletions
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 = contacts_record_get_str_p(record_person, _contacts_person.ringtone_path, &str);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, FALSE, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (str && *str && 0 == access(str, F_OK))
+ return SAFE_STRDUP(ct_detail_get_ringtone_display_name(str));
+ else
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT));
+ }
+ return NULL;
+}
+
+static void detail_ringtone_reset_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+
+ p_retm_if(NULL == cdetail_d, "parameter(cdetail_d) is NULL");
+ p_retm_if(NULL == cdetail_d->person, "parameter(person) is NULL");
+
+ if (cdetail_d->popup){
+ evas_object_del(cdetail_d->popup);
+ cdetail_d->popup = NULL;
+ }
+
+ err = contacts_record_set_str(cdetail_d->person, _contacts_person.ringtone_path, NULL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str(ringtone_path) Failed(%d)", err);
+
+ elm_genlist_item_update(cdetail_d->ringtone_item);
+}
+
+static char *detail_popup_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (0 == strcmp(part, "elm.text"))
+ return strdup(data);
+ return NULL;
+}
+
+static void detail_ringtone_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *btn;
+ Evas_Object *box;
+ char *temp;
+ ct_detail_data *cdetail_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ popup = elm_popup_add(cdetail_d->navi);
+ elm_object_style_set(popup, "min_menustyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_RINGTONE));
+ evas_object_smart_callback_add(popup, "block,clicked", ctui_popup_hide_cb, NULL);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", ctui_popup_hide_cb, popup);
+
+ detail_ringtone_itc.item_style = "1text";
+ detail_ringtone_itc.func.text_get = detail_popup_text_get;
+ detail_ringtone_itc.func.content_get = NULL;
+ detail_ringtone_itc.func.state_get = NULL;
+ detail_ringtone_itc.func.del = NULL;
+
+ box = elm_box_add(popup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ genlist = elm_genlist_add(popup);
+ 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);
+ elm_genlist_item_append(genlist, &detail_ringtone_itc, S_(CT_SYS_SK_SET), NULL, ELM_GENLIST_ITEM_NONE, ct_detail_myfile_ringtone, data);
+
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.ringtone_path, &temp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_contact_record_get_str_p() Failed(%d)", err);
+
+ if (temp && *temp)
+ elm_genlist_item_append(genlist, &detail_ringtone_itc, S_(CT_SYS_SK_RESET), NULL, ELM_GENLIST_ITEM_NONE, detail_ringtone_reset_cb, data);
+
+ elm_box_pack_end(box, genlist);
+ evas_object_show(genlist);
+ evas_object_size_hint_min_set(box, 600, 200);
+ elm_object_content_set(popup, box);
+ evas_object_show(popup);
+ cdetail_d->popup = popup;
+}
+
+static char* detail_gl_vibration_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_VIBRATION_PATTERN));
+ else if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_str_p(record_person, _contacts_person.vibration, &str);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, FALSE, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (str && *str && 0 == access(str, F_OK))
+ return SAFE_STRDUP(ct_detail_get_vibration_display_name(str));
+ else
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT));
+ }
+ return NULL;
+}
+static void detail_vibration_reset_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+
+ p_retm_if(NULL == cdetail_d, "parameter(cdetail_d) is NULL");
+ p_retm_if(NULL == cdetail_d->person, "parameter(person) is NULL");
+
+ if (cdetail_d->popup) {
+ evas_object_del(cdetail_d->popup);
+ cdetail_d->popup = NULL;
+ }
+
+ err = contacts_record_set_str(cdetail_d->person, _contacts_person.vibration, NULL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str(vibration) Failed(%d)", err);
+
+ elm_genlist_item_update(cdetail_d->vibration_item);
+}
+
+static void detail_vibration_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *btn;
+ Evas_Object *box;
+ char *temp;
+ ct_detail_data *cdetail_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ popup = elm_popup_add(cdetail_d->navi);
+ elm_object_style_set(popup, "min_menustyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_VIBRATION_PATTERN));
+ evas_object_smart_callback_add(popup, "block,clicked", ctui_popup_hide_cb, NULL);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", ctui_popup_hide_cb, popup);
+
+ detail_vibration_itc.item_style = "1text";
+ detail_vibration_itc.func.text_get = detail_popup_text_get;
+ detail_vibration_itc.func.content_get = NULL;
+ detail_vibration_itc.func.state_get = NULL;
+ detail_vibration_itc.func.del = NULL;
+
+ box = elm_box_add(popup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ genlist = elm_genlist_add(popup);
+ 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);
+ elm_genlist_item_append(genlist, &detail_vibration_itc, S_(CT_SYS_SK_SET), NULL, ELM_GENLIST_ITEM_NONE, ct_detail_myfile_vibration, data);
+
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.vibration, &temp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_contact_record_get_str_p() Failed(%d)", err);
+
+ if (temp && *temp)
+ elm_genlist_item_append(genlist, &detail_vibration_itc, S_(CT_SYS_SK_RESET), NULL, ELM_GENLIST_ITEM_NONE, detail_vibration_reset_cb, data);
+
+ elm_box_pack_end(box, genlist);
+ evas_object_show(genlist);
+ evas_object_size_hint_min_set(box, 600, 200);
+ elm_object_content_set(popup, box);
+ evas_object_show(popup);
+ cdetail_d->popup = popup;
+}
+
+static void detail_update_group(void *data)
+{
+ PH_FN_CALL;
+ ct_detail_data *cdetail_d = data;
+ p_retm_if(NULL == cdetail_d, "parameter(cdetail_d) is NULL");
+ cdetail_d->updated = true;
+ elm_genlist_item_update(cdetail_d->group_item);
+}
+
+typedef struct {
+ int contact_id;
+ int addressbook_id;
+ Eina_Bool checked;
+ Elm_Object_Item *item;
+ void *data;
+} ct_detail_person_data;
+
+static void detail_group_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ ct_person_grp_assign_create_view(cdetail_d->navi, cdetail_d->person_id, detail_update_group, cdetail_d);
+}
+
+static char* detail_gl_group_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char display[PH_TEXT_MAX_LEN+1];
+ ct_detail_data *cdetail_d = data;
+
+ if (0 == strcmp(part, "elm.text.1")) {
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP));
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ display[0] = '\0';
+ ct_detail_person_get_group_names(cdetail_d->list_contacts, display, sizeof(display));
+ return strdup(display);
+ }
+ return NULL;
+
+}
+
+static char* detail_gl_relationship_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ if (0 == strcmp(part, "elm.text.1")) {
+ int type;
+ char *str_type = NULL;
+ char *str_name = NULL;
+ char buf[PH_TEXT_MAX_LEN+1];
+
+ err = contacts_record_get_int(record, _contacts_relationship.type, &type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (CONTACTS_RELATIONSHIP_TYPE_CUSTOM == type) {
+ err = contacts_record_get_str_p(record, _contacts_relationship.label, &str_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ }
+ if (NULL == str_type || '\0' == str_type[0])
+ str_type = (char *)T_(CT_GET_TEXT_RELATIONSHIP_TYPE, type);
+
+ err = contacts_record_get_str_p(record, _contacts_relationship.name, &str_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (str_name && *str_name)
+ snprintf(buf, sizeof(buf), "%s %s", str_type, str_name);
+ else
+ snprintf(buf, sizeof(buf), "%s", str_type);
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_RELATIONSHIP));
+ }
+ return NULL;
+}
+
+static char *detail_gl_address_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int val_type;
+ char *ret_str;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retv_if(NULL == data, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(record, _contacts_address.type, &val_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if(CONTACTS_ADDRESS_TYPE_CUSTOM == val_type){
+ err = contacts_record_get_str_p(record, _contacts_address.label, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == ret_str || '\0' == ret_str[0])
+ return strdup(T_(CT_GET_TEXT_POSTAL_TYPE, CONTACTS_ADDRESS_TYPE_OTHER));
+ else
+ return strdup(ret_str);
+ }
+ else
+ return strdup(T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(val_type)));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ char buf[PH_TEXT_MAX_LEN] = {0,};
+ ct_detail_get_full_addr(record, buf, PH_TEXT_MAX_LEN);
+ return elm_entry_utf8_to_markup(buf);
+ }
+ return NULL;
+}
+
+static char* detail_gl_messenger_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int val_type;
+ char *ret_str = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retv_if(NULL == data, NULL);
+
+ ret_str = NULL;
+ if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(record, _contacts_messenger.im_id, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ return SAFE_STRDUP(ret_str);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(record, _contacts_messenger.type, &val_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if(CONTACTS_MESSENGER_TYPE_CUSTOM == val_type){
+ err = contacts_record_get_str_p(record, _contacts_messenger.label, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(ret_str);
+ }
+ else {
+ return strdup(T_(CT_GET_TEXT_IM_TYPE, val_type));
+ }
+ }
+ return NULL;
+}
+
+
+static char* detail_gl_event_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int val_type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+ ct_detail_data *cdetail_d = evas_object_data_get(obj, "cdetail_d");
+
+ p_retv_if(NULL == data, NULL);
+
+ if (0 == strcmp(part, "elm.text.1")) {
+ int date, day, mon, year;
+
+ err = contacts_record_get_int(record, _contacts_event.date, &date);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ day = date%100;
+ mon = (date%10000)/100;
+ year = date/10000;
+
+ p_retvm_if(mon < 1 || 12 < mon || day < 1 || 31 < day, NULL, "Invalid date(mon=%d,day=%d)",mon,day);
+ return ct_detail_get_datetime_str(cdetail_d->formatter, year, mon, day);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(record, _contacts_event.type, &val_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ return strdup(T_(CT_GET_TEXT_EVENT_TYPE, val_type));
+ }
+ return NULL;
+}
+
+
+void __detail_update_number_list(ct_detail_data * cdetail_d)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int list_count = 0;
+ int number_id = 0;
+ int i;
+ Eina_List *cursor;
+ const Elm_Genlist_Item_Class *itc;
+ Elm_Object_Item *item = elm_genlist_first_item_get(cdetail_d->genlist);
+ Elm_Object_Item *item2 = NULL;
+ contacts_record_h record_number = NULL;
+
+ while(item) {
+ item2 = elm_genlist_item_next_get(item);
+ itc = elm_genlist_item_item_class_get(item);
+ if(itc == &detail_itcs[DETAIL_ITC_NUMBER_DEFAULT] || itc == &detail_itcs[DETAIL_ITC_NUMBER]) {
+ break;
+ }
+ item = item2;
+ }
+
+ Evas_Smart_Cb num_func = ct_detail_gl_number_sel;
+
+ if (cdetail_d->list_number)
+ ctui_free_record_list(cdetail_d->list_number);
+
+ cdetail_d->list_number = ctui_person_get_number_list(cdetail_d->list_contacts);
+ err = phone_cts_get_default_number(cdetail_d->person_id, &record_number);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_default_number() Failed(%d)", err);
+ }
+ int default_num_id = 0;
+ err = contacts_record_get_int(record_number, _contacts_number.id, &default_num_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ if(default_num_id > 0) {
+ elm_object_item_del(cdetail_d->number_util_item);
+ elm_genlist_item_insert_before(cdetail_d->genlist, &detail_itcs[DETAIL_ITC_NUMBER_DEFAULT], record_number, NULL, item,
+ ELM_GENLIST_ITEM_NONE, num_func, record_number);
+ cdetail_d->number_util_item = elm_genlist_item_insert_before(cdetail_d->genlist, &detail_itcs[DETAIL_ITC_NUM_UTIL_BTN], record_number, NULL, item,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+
+ list_count = eina_list_count(cdetail_d->list_number);
+ if (list_count > 1) {
+ EINA_LIST_FOREACH(cdetail_d->list_number, cursor, record_number) {
+ err = contacts_record_get_int(record_number, _contacts_number.id, &number_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if ((default_num_id != 0) && (number_id == default_num_id))
+ continue;
+
+ elm_genlist_item_insert_before(cdetail_d->genlist, &detail_itcs[DETAIL_ITC_NUMBER], record_number, NULL, item,
+ ELM_GENLIST_ITEM_NONE, num_func, record_number);
+ }
+ }
+ if (default_num_id)
+ cdetail_d->has_number = true;
+
+ for(i=0;i<list_count;i++) {
+ item2 = elm_genlist_item_next_get(item);
+ elm_object_item_del(item);
+ item = item2;
+ }
+}
+
+void __detail_update_email_list(ct_detail_data * cdetail_d)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int email_id = 0;
+ Eina_List *cursor;
+ const Elm_Genlist_Item_Class *itc;
+ Elm_Object_Item *item = elm_genlist_first_item_get(cdetail_d->genlist);
+ Elm_Object_Item *item2 = NULL;
+ contacts_record_h record_email = NULL;
+
+ while(item) {
+ item2 = elm_genlist_item_next_get(item);
+ itc = elm_genlist_item_item_class_get(item);
+ if(itc == &detail_itcs[DETAIL_ITC_EMAIL_DEFAULT] || itc == &detail_itcs[DETAIL_ITC_EMAIL]) {
+ break;
+ }
+ item = item2;
+ }
+
+ Evas_Smart_Cb email_func = ct_detail_gl_email_sel;
+
+ if (cdetail_d->list_email)
+ ctui_free_record_list(cdetail_d->list_email);
+
+ cdetail_d->list_email = ctui_person_get_email_list(cdetail_d->list_contacts);
+ err = phone_cts_get_default_email(cdetail_d->person_id, &record_email);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_default_email() Failed(%d)", err);
+ }
+ int default_email_id = 0;
+
+ err = contacts_record_get_int(record_email, _contacts_email.id, &default_email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ if(default_email_id > 0) {
+ elm_genlist_item_insert_before(cdetail_d->genlist, &detail_itcs[DETAIL_ITC_EMAIL_DEFAULT], record_email, NULL, item,
+ ELM_GENLIST_ITEM_NONE, email_func, record_email);
+ }
+
+ int list_count = eina_list_count(cdetail_d->list_email);
+ if (list_count > 1) {
+ EINA_LIST_FOREACH(cdetail_d->list_email, cursor, record_email) {
+ err = contacts_record_get_int(record_email, _contacts_email.id, &email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if ((default_email_id != 0) && (email_id == default_email_id))
+ continue;
+
+ elm_genlist_item_insert_before(cdetail_d->genlist, &detail_itcs[DETAIL_ITC_EMAIL], record_email, NULL, item,
+ ELM_GENLIST_ITEM_NONE, email_func, record_email);
+ }
+ }
+
+ int i = 0;
+ for(i=0;i<list_count;i++) {
+ item2 = elm_genlist_item_next_get(item);
+ elm_object_item_del(item);
+ item = item2;
+ }
+}
+
+
+void __detail_default_number_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+ ct_detail_data *cdetail_d;
+ int data_id;
+
+ p_retm_if(NULL == record, "parameter(record) is NULL");
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get(record) return NULL");
+
+ err = contacts_record_get_int(record, _contacts_number.id, &data_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_person_set_default_property(CONTACTS_PERSON_PROPERTY_NUMBER, cdetail_d->person_id, data_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_person_set_default_property() Failed(%d)", err);
+ // TODO: ??
+ __detail_update_number_list(cdetail_d);
+
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+}
+
+void __detail_default_email_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+ ct_detail_data *cdetail_d;
+ int data_id;
+
+ p_retm_if(NULL == record, "parameter(record) is NULL");
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get(record) return NULL");
+
+ err = contacts_record_get_int(record, _contacts_email.id, &data_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_person_set_default_property(CONTACTS_PERSON_PROPERTY_EMAIL, cdetail_d->person_id, data_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_person_set_default_property() Failed(%d)", err);
+
+ // TODO: ??
+ __detail_update_email_list(cdetail_d);
+
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+}
+
+
+void __detail_click_default_number(void *data, Evas_Object *obj, void *event_info)
+{
+ int default_number_id = 0;
+ int number_id = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *cursor;
+ contacts_record_h record_default_number = NULL;
+ contacts_record_h record_number = NULL;
+ ct_detail_data *cdetail_d = (ct_detail_data*)data;
+ Evas_Object *popup;
+ Evas_Object *btn;
+ Evas_Object *genlist;
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ popup = elm_popup_add(cdetail_d->navi);
+ p_retm_if(NULL == popup, "elm_popup_add() return NULL");
+ elm_object_style_set(popup, "liststyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASE_OP, CTTEXT_SET_DEFAULT_NUMBER));
+ cdetail_d->popup = popup;
+
+ 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", ct_detail_popup_hide_cb, cdetail_d);
+ evas_object_show(popup);
+
+ genlist = elm_genlist_add(popup);
+ p_retm_if(NULL == genlist, "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);
+ evas_object_data_set(genlist, "cdetail_d", cdetail_d);
+
+ err = phone_cts_get_default_number(cdetail_d->person_id, &record_default_number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_default_number() Failed(%d)", err);
+
+ err = contacts_record_get_int( record_default_number, _contacts_number.id, &default_number_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_destroy(record_default_number, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(cdetail_d->list_number, cursor, record_number){
+ err = contacts_record_get_int( record_number, _contacts_number.id, &number_id);
+ if (default_number_id == number_id)
+ continue;
+
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_DEFAULT_NUMBER_SET_POPUP], record_number, NULL, ELM_GENLIST_ITEM_NONE, __detail_default_number_sel, record_number);
+ }
+
+ evas_object_show(genlist);
+ elm_object_content_set(popup, genlist);
+}
+
+void __detail_click_default_email(void *data, Evas_Object *obj, void *event_info)
+{
+ int default_email_id = 0;
+ int email_id = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *cursor;
+ contacts_record_h record_default_email = NULL;
+ contacts_record_h record_email = NULL;
+ ct_detail_data *cdetail_d = (ct_detail_data*)data;
+ Evas_Object *popup;
+ Evas_Object *btn;
+ Evas_Object *genlist;
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ popup = elm_popup_add(cdetail_d->navi);
+ p_retm_if(NULL == popup, "elm_popup_add() return NULL");
+ elm_object_style_set(popup, "liststyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASE_OP, CTTEXT_SET_DEFAULT_EMAIL));
+ cdetail_d->popup = popup;
+
+ 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", ct_detail_popup_hide_cb, cdetail_d);
+ evas_object_show(popup);
+
+ genlist = elm_genlist_add(popup);
+ p_retm_if(NULL == genlist, "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);
+ evas_object_data_set(genlist, "cdetail_d", cdetail_d);
+
+ err = phone_cts_get_default_email(cdetail_d->person_id, &record_default_email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_default_email() Failed(%d)", err);
+
+ err = contacts_record_get_int( record_default_email, _contacts_email.id, &default_email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_destroy(record_default_email, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(cdetail_d->list_email, cursor, record_email){
+ err = contacts_record_get_int( record_email, _contacts_email.id, &email_id);
+ if (default_email_id == email_id)
+ continue;
+
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_DEFAULT_EMAIL_SET_POPUP], record_email, NULL, ELM_GENLIST_ITEM_NONE, __detail_default_email_sel, record_email);
+ }
+
+ evas_object_show(genlist);
+ elm_object_content_set(popup, genlist);
+}
+
+char* ct_detail_gl_number_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type;
+ char buf[PH_TEXT_MAX_LEN+1] = {0,};
+ char *ret_str = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retvm_if(NULL == data, NULL, "parameter(data) is NULL");
+
+ ret_str = NULL;
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(record, _contacts_number.type, &type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ ctui_get_number_type_str(record, type, buf, sizeof(buf));
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(record, _contacts_number.number, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(ret_str);
+ }
+ else if ( 0 == strcmp(part, "elm.text")) {
+ err = contacts_record_get_str_p(record, _contacts_number.number, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(ret_str);
+ }
+
+ return NULL;
+}
+
+char* ct_detail_gl_email_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type;
+ char *ret_str = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retvm_if(NULL == data, NULL, "parameter(data) is NULL");
+
+ ret_str = NULL;
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(record, _contacts_email.type, &type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (CONTACTS_EMAIL_TYPE_CUSTOM == type) {
+ err = contacts_record_get_str_p(record, _contacts_email.label, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(ret_str);
+ }
+ return strdup(T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(type)));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(record, _contacts_email.email, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(ret_str);
+ }
+ else if (0 == strcmp(part, "elm.text")) {
+ err = contacts_record_get_str_p(record, _contacts_email.email, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(ret_str);
+ }
+ return NULL;
+
+}
+
+static char *detail_gl_url_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type;
+ char *ret_str = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retvm_if(NULL == data, NULL, "parameter(data) is NULL");
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(record, _contacts_url.type, &type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (CONTACTS_URL_TYPE_CUSTOM == type) {
+ err = contacts_record_get_str_p(record, _contacts_url.label, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ return SAFE_STRDUP(ret_str);
+ }
+ return strdup(T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(type)));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(record, _contacts_url.url, &ret_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ return SAFE_STRDUP(ret_str);
+ }
+ return NULL;
+}
+
+
+static void detail_number_cb(contacts_record_h record_number, ct_detail_data *cdetail_d)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *num_str;
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ err = contacts_record_get_str_p( record_number, _contacts_number.number, &num_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (num_str && *num_str) {
+ int rotate;
+ cdetail_d->popup = elm_ctxpopup_add(cdetail_d->navi);
+ p_retm_if(NULL == cdetail_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(cdetail_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(cdetail_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(cdetail_d->popup, "dismissed", ct_detail_popup_hide_cb, cdetail_d);
+ evas_object_data_set(cdetail_d->popup, "cdetail_d", cdetail_d);
+
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(PH_SYS_BODY_CALL), NULL,
+ ct_detail_voice_call_cb, num_str);
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(PH_SYS_BODY_MESSAGE), NULL,
+ ct_detail_msg_ug_cb, num_str);
+
+ evas_object_move(cdetail_d->popup, cdetail_d->touch_x, cdetail_d->touch_y);
+ evas_object_show(cdetail_d->popup);
+ }
+}
+
+
+
+static void __detail_email_result(service_h service, service_h reply, service_result_e result, void* user_data)
+{
+ ct_detail_data *cdetail_d = user_data;
+
+ cdetail_d->touch_block = false;
+}
+
+
+void ct_detail_gl_email_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *email_address;
+ service_h service;
+ Ecore_X_Window win_id;
+ ct_detail_data *cdetail_d;
+ contacts_record_h record_email = data;
+ Elm_Object_Item *item = event_info;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ p_retm_if(NULL == record_email, "parameter(record_email) is NULL");
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get() return NULL");
+
+ if(cdetail_d->touch_block == true)
+ return;
+
+ err = contacts_record_get_str_p( record_email, _contacts_email.email, &email_address);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ win_id = elm_win_xwindow_get(cdetail_d->win);
+ service_create(&service);
+ service_set_app_id(service, EMAIL_COMPOSER_PKG);
+ service_set_window(service, win_id);
+ service_add_extra_data(service, SERVICE_DATA_TO, email_address);
+
+ if(service_send_launch_request(service, __detail_email_result, cdetail_d) == SERVICE_ERROR_NONE)
+ cdetail_d->touch_block = true;
+ service_destroy(service);
+}
+
+static void detail_gl_messenger_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_record_h record_email = data;
+ Elm_Object_Item *item = event_info;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ p_retm_if(NULL == record_email, "parameter(record_email) is NULL");
+
+ ERR("detail_gl_messenger_sel() not implemented");
+}
+
+static char* detail_gl_address_book_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ Eina_List *l;
+ contacts_record_h contact = NULL;
+ char temp[PH_TEXT_MAX_LEN];
+ char display[PH_TEXT_MAX_LEN];
+ ct_detail_data *cdetail_d = data;
+
+ if (0 == strcmp(part, "elm.text")) {
+ display[0] = '\0';
+ if (cdetail_d->contact) {
+ ct_detail_person_get_addressbook_name(cdetail_d->contact, temp, sizeof(temp));
+ snprintf(display, sizeof(display), T_(CT_GET_TEXT_BASIC, CTTEXT_SAVED_IN), temp);
+ }
+ else {
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, contact) {
+ ct_detail_person_get_addressbook_name(contact, temp, sizeof(temp));
+ snprintf(display, sizeof(display), T_(CT_GET_TEXT_BASIC, CTTEXT_SAVED_IN), temp);
+ }
+ }
+ if ('\0' == *display)
+ snprintf(display, sizeof(display), T_(CT_GET_TEXT_BASIC, CTTEXT_SAVED_IN), "Noname");
+ return strdup(display);
+ }
+ return NULL;
+}
+
+
+static char* detail_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *display = data;
+ if (0 == strcmp(part, "elm.text") && display && *display)
+ return strdup(display);
+ return NULL;
+}
+
+void ct_detail_gl_number_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_record_h record_number = data;
+ ct_detail_data *cdetail_d;
+ Elm_Object_Item *item = event_info;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ p_retm_if(NULL == record_number, "parameter(CTSstruct) is NULL");
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get() return NULL");
+
+ detail_number_cb(record_number, cdetail_d);
+}
+
+static void detail_send_name_card_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int rotate;
+ int x,y,w,h;
+ ct_detail_data *cdetail_d = data;
+ 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);
+
+ cdetail_d->popup = elm_ctxpopup_add(cdetail_d->navi);
+ p_retm_if(NULL == cdetail_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(cdetail_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(cdetail_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(cdetail_d->popup, "dismissed", ct_detail_popup_hide_cb, cdetail_d);
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(PH_SYS_BODY_MESSAGE), NULL,
+ ct_detail_send_via_msg, cdetail_d);
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(CT_SYS_BODY_EMAIL), NULL,
+ ct_detail_send_via_email, cdetail_d);
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(CT_SYS_BODY_BLUETOOTH), NULL,
+ ct_detail_send_via_bluetooth, cdetail_d);
+
+ evas_object_geometry_get(cdetail_d->ctrl_button, &x, &y, &w, &h);
+ evas_object_move(cdetail_d->popup, w/2, y+h/2);
+ evas_object_show(cdetail_d->popup);
+}
+
+static void detail_list_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = data;
+ ct_person_list *person_info;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Elm_Object_Item *item = event_info;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (cdetail_d->person_id) {
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() returns NULL");
+
+ err = contacts_person_link_person(cdetail_d->person_id, person_info->id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_person_link_person() Failed(%d)", err);
+
+ if (CONTACTS_ERROR_NONE == err) {
+ phone_show_tickernoti(S_(CT_SYS_POP_SUCCESS));
+ ct_detail_refresh_view(cdetail_d);
+ }
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+
+ elm_naviframe_item_pop(cdetail_d->navi);
+ }
+}
+
+static void detail_link_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = data;
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+ ct_detail_create_list_view(cdetail_d, detail_list_gl_sel, cdetail_d, cdetail_d->person_id);
+}
+
+static void detail_unlink_popup_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = data;
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+}
+
+static void detail_gl_unlink_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ int person_id;
+ ct_detail_data *cdetail_d;
+ ct_detail_person_data *person_info = data;
+ contacts_error_e err;
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get() return NULL");
+
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ err = contacts_person_unlink_contact(cdetail_d->person_id, person_info->contact_id, &person_id);
+ if (CONTACTS_ERROR_NONE == err) {
+ phone_show_tickernoti(S_(CT_SYS_POP_SUCCESS));
+ ct_detail_refresh_view(cdetail_d);
+ }
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+}
+
+static void detail_unlink_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Eina_List *l;
+ Evas_Object *genlist;
+ Evas_Object *popup;
+ Elm_Object_Item *item;
+ ct_detail_data *cdetail_d = data;
+ ct_detail_person_data *person_info;
+ Evas_Object *btn;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ popup = elm_popup_add(cdetail_d->navi);
+ p_retm_if(NULL == popup, "elm_popup_add() return NULL");
+ elm_object_style_set(popup, "liststyle");
+
+ 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", detail_unlink_popup_cancel_btn_cb, cdetail_d);
+
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASE_OP, CTTEXT_UNLINK));
+ evas_object_show(popup);
+ cdetail_d->popup = popup;
+
+ genlist = elm_genlist_add(popup);
+ p_retm_if(NULL == genlist, "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);
+ cdetail_d->genlist_unlink = genlist;
+ evas_object_data_set(genlist, "cdetail_d", cdetail_d);
+
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, record) {
+ person_info = calloc(1, sizeof(ct_detail_person_data));
+ if (NULL == person_info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+
+ err = contacts_record_get_int(record, _contacts_contact.id, &(person_info->contact_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_contact.address_book_id, &(person_info->addressbook_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_UNLINK_POPUP], person_info,
+ NULL, ELM_GENLIST_ITEM_NONE, detail_gl_unlink_item_sel, person_info);
+
+ person_info->item = item;
+ }
+
+ evas_object_show(genlist);
+ elm_object_content_set(popup, genlist);
+}
+
+static char* detail_gl_unlink_popup_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PH_TEXT_MAX_LEN+1];
+ char *display;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ ct_detail_person_data *person_info = data;
+ p_retvm_if(NULL == person_info, NULL, "person_info is NULL");
+
+ if (0 == strcmp(part, "elm.text") || 0 == strcmp(part, "elm.text.1")) {
+ buf[0] = '\0';
+
+ err = contacts_db_get_record(_contacts_simple_contact._uri, person_info->contact_id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_simple_contact.display_name, &display);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (display && *display)
+ snprintf(buf, sizeof(buf), "%s", display);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (*buf)
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+
+ buf[0] = '\0';
+ ctui_get_addressbook_name(person_info->addressbook_id, buf, sizeof(buf));
+ if (*buf)
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static Evas_Object* detail_gl_unlink_popup_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_detail_person_data *person_info = data;
+ p_retvm_if(NULL == person_info, NULL, "person_info is NULL");
+
+ if (0 == strcmp(part, "elm.icon")) {
+ char *icon_path;
+ Evas_Object *icon;
+
+ icon_path = ctui_get_addressbook_icon_path(person_info->addressbook_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 void detail_gl_unlink_popup_del(void *data, Evas_Object *obj)
+{
+ ct_detail_person_data *person_info = data;
+ p_retm_if(NULL == person_info, "person_info is NULL");
+ free(person_info);
+}
+
+static Evas_Object *detail_gl_link_unlink_icon_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ ct_detail_data *cdetail_d = data;
+ p_retvm_if(NULL == cdetail_d, NULL, "parameter(ct_detail_data) is NULL");
+
+ if (0 == strcmp(part, "elm.icon.1")) {
+ Evas_Object *btn;
+
+ btn = ctui_create_btn(obj, T_(CT_GET_TEXT_BASE_OP, CTTEXT_LINK_CONTACTS));
+ p_retvm_if(NULL == btn, NULL, "ctui_create_btn() return NULL");
+ if(!cdetail_d->ug)
+ evas_object_smart_callback_add(btn, "clicked", detail_link_cb, cdetail_d);
+
+ return btn;
+ }
+ else if (0 == strcmp(part, "elm.icon.2")) {
+ Evas_Object *btn;
+
+ btn = ctui_create_btn(obj, T_(CT_GET_TEXT_BASE_OP, CTTEXT_UNLINK));
+ p_retvm_if(NULL == btn, NULL, "ctui_create_btn() return NULL");
+
+ if (cdetail_d->list_contacts && 1 < eina_list_count(cdetail_d->list_contacts)) {
+ if(!cdetail_d->ug)
+ evas_object_smart_callback_add(btn, "clicked", detail_unlink_cb, cdetail_d);
+ }
+ else
+ elm_object_disabled_set(btn, EINA_TRUE);
+ return btn;
+ }
+ return NULL;
+}
+
+
+static Evas_Object *detail_gl_util_btn_icon_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ Evas_Object *ret_obj;
+ ct_detail_data *cdetail_d = data;
+ p_retvm_if(NULL == cdetail_d, NULL, "parameter(ct_detail_data) is NULL");
+
+ ret_obj = NULL;
+ if (0 == strcmp(part, "elm.icon.1") || 0 == strcmp(part, "elm.icon")) {
+ Evas_Object *btn;
+ btn = ctui_create_btn(obj, T_(CT_GET_TEXT_BASE_OP, CTTEXT_ADD_TO_HOME));
+ p_retvm_if(NULL == btn, NULL, "ctui_create_btn() return NULL");
+ if (!cdetail_d->has_number)
+ elm_object_disabled_set(btn, EINA_TRUE);
+ ret_obj = btn;
+ }
+ else if (0 == strcmp(part, "elm.icon.2")) {
+ Evas_Object *btn;
+ btn = ctui_create_btn(obj, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SEND_NAME_CARD));
+ p_retvm_if(NULL == btn, NULL, "ctui_create_btn() return NULL");
+ if(!cdetail_d->ug)
+ evas_object_smart_callback_add(btn, "clicked", detail_send_name_card_cb, cdetail_d);
+
+ ret_obj = btn;
+ }
+ return ret_obj;
+}
+
+static void detail_gl_website_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ char *website;
+ contacts_record_h record_website = data;
+ Elm_Object_Item *item = event_info;
+ int ret;
+ service_h service;
+
+ p_retm_if(NULL == record_website, "parameter(value) is NULL");
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ contacts_record_get_str_p( record_website, _contacts_url.url, &website );
+ if (website && *website) {
+ ret = service_create(&service);
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_create() Failed(%d)", ret);
+
+ ret = service_set_operation(service, SERVICE_OPERATION_VIEW );
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_set_operation() Failed(%d)", ret);
+
+ if (strstr(website, "http"))
+ ret = service_set_uri(service, website);
+ else {
+ char *new_url = g_strdup_printf("http://%s", website);
+ ret = service_set_uri(service, new_url);
+ free(new_url);
+ }
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_set_uri() Failed(%d)", ret);
+
+ ret = service_send_launch_request(service, NULL, NULL);
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_send_launch_request() Failed(%d)", ret);
+
+ service_destroy(service);
+ }
+}
+
+static char* detail_gl_link_list_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_ALL_LINKED_CONTACTS));
+}
+
+static char* detail_gl_link_list_sub_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int contact_id = (int)data;
+ char *display;
+ char buf[PH_TEXT_MAX_LEN];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+
+ if (0 == strcmp(part, "elm.text")) {
+ buf[0] = '\0';
+
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &record_contact);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record(%d) Failed(%d)", contact_id, err);
+
+ err = contacts_record_get_str_p( record_contact, _contacts_contact.display_name, &display );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p(display_name) Failed(%d)", err);
+
+ if (display && *display)
+ snprintf(buf, sizeof(buf), "%s", display);
+
+ err = contacts_record_destroy(record_contact, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (*buf)
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static Evas_Object* detail_gl_link_list_sub_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ int addressbook_id;
+ int contact_id = (int)data;
+ char *icon_path;
+ Evas_Object *icon;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ if (0 == strcmp(part, "elm.icon")) {
+ err = contacts_db_get_record(_contacts_simple_contact._uri, contact_id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_simple_contact.address_book_id, &addressbook_id);
+ 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);
+
+ icon_path = ctui_get_addressbook_icon_path(addressbook_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 void detail_group_changed(const char *view_uri, void *data)
+{
+ ct_detail_data *cdetail_d = data;
+ p_retm_if(NULL == cdetail_d, "parameter(cdetail_d) is NULL");
+ elm_genlist_item_update(cdetail_d->group_item);
+}
+
+static void detail_filemanager_status_changed_cb(keynode_t *key, void *data)
+{
+ Elm_Object_Item *item_ringtone = data;
+ p_retm_if(NULL == item_ringtone, "parameter(item_ringtone) is NULL");
+ elm_genlist_item_update(item_ringtone);
+}
+
+static void detail_view_delete_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ PH_FN_CALL;
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ if (cdetail_d->genlist)
+ evas_object_del(cdetail_d->genlist);
+
+ if (cdetail_d->th) {
+ elm_theme_extension_del(cdetail_d->th, DETAIL_THEME_EDJ);
+ elm_theme_free(cdetail_d->th);
+ }
+
+ ct_detail_delete_namecards(cdetail_d);
+
+ err = contacts_db_remove_changed_cb(_contacts_contact._uri, ct_detail_contact_changed, cdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ err = contacts_db_remove_changed_cb(_contacts_group._uri, detail_group_changed, cdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ ret = vconf_ignore_key_changed(VCONFKEY_FILEMANAGER_DB_STATUS, detail_filemanager_status_changed_cb);
+ p_warn_if(-1 == ret, "vconf_ignore_key_changed() Failed");
+
+/* if (cdetail_d->updated) { // group member issue when group member update at detail view
+ Eina_List *l;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h contact = NULL;
+
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, contact) {
+ // TODO: contacts_db_update_records
+ err = contacts_db_update_record(contact);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ }
+ }*/
+
+ contacts_record_h record = NULL;
+ EINA_LIST_FREE(cdetail_d->list_number, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_number) Failed(%d)", err);
+ }
+ cdetail_d->list_number = NULL;
+
+ EINA_LIST_FREE(cdetail_d->list_email, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_email) Failed(%d)", err);
+ }
+ cdetail_d->list_email = NULL;
+
+ EINA_LIST_FREE(cdetail_d->list_postal, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_postal) Failed(%d)", err);
+ }
+ cdetail_d->list_postal = NULL;
+
+ EINA_LIST_FREE(cdetail_d->list_relationship, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_relationship) Failed(%d)", err);
+ }
+ cdetail_d->list_relationship = NULL;
+
+ EINA_LIST_FREE(cdetail_d->list_event, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_event) Failed(%d)", err);
+ }
+ cdetail_d->list_event = NULL;
+
+ EINA_LIST_FREE(cdetail_d->list_messenger, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_messenger) Failed(%d)", err);
+ }
+ cdetail_d->list_messenger = NULL;
+
+ EINA_LIST_FREE(cdetail_d->list_website, record) {
+ if (NULL == record) continue;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_website) Failed(%d)", err);
+ }
+ cdetail_d->list_website = NULL;
+
+ ctui_free_record_list(cdetail_d->list_contacts);
+ free(cdetail_d->vcard_path);
+ free(cdetail_d->base_ab_name);
+
+ evas_object_data_del(cdetail_d->navi, "cdetail_d");
+
+ if (cdetail_d->formatter)
+ udat_close(cdetail_d->formatter);
+
+ if (cdetail_d->child_ug)
+ ug_destroy(cdetail_d->child_ug);
+ cdetail_d->child_ug = NULL;
+
+ cdetail_d->view_destroying = FALSE;
+
+ 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);
+ }
+
+ if (cdetail_d->has_input)
+ cdetail_d->has_detail = false;
+ else
+ free(cdetail_d);
+
+ PH_FN_END;
+}
+
+
+
+static char *__detail_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *str = NULL;
+ if(!data)
+ return NULL;
+
+ str = (char*)data;
+ if (0 == strcmp(part, "elm.text")) {
+
+ return SAFE_STRDUP(str);
+ }
+ return NULL;
+}
+
+static inline void detail_create_itcs()
+{
+ detail_itcs[DETAIL_ITC_NUMBER].func.text_get = ct_detail_gl_number_label_get;
+ detail_itcs[DETAIL_ITC_EMAIL].func.text_get = ct_detail_gl_email_label_get;
+ detail_itcs[DETAIL_ITC_URL].func.text_get = detail_gl_url_label_get;
+
+ detail_itcs[DETAIL_ITC_NUMBER_DEFAULT].func.text_get = ct_detail_gl_number_label_get;
+
+ detail_itcs[DETAIL_ITC_MESSENGER].func.text_get = detail_gl_messenger_label_get;
+ detail_itcs[DETAIL_ITC_EVENT].func.text_get = detail_gl_event_label_get;
+
+ detail_itcs[DETAIL_ITC_ADDRESS].func.text_get = detail_gl_address_label_get;
+
+ detail_itcs[DETAIL_ITC_NOTE].func.text_get = detail_gl_2text_multiline_label_get;
+
+ detail_itcs[DETAIL_ITC_RINGTONE].func.text_get = detail_gl_ringtone_label_get;
+
+ detail_itcs[DETAIL_ITC_VIBRATION].func.text_get = detail_gl_vibration_label_get;
+
+ detail_itcs[DETAIL_ITC_GROUP].func.text_get = detail_gl_group_label_get;
+
+ detail_itcs[DETAIL_ITC_RELATIONSHIP].func.text_get = detail_gl_relationship_label_get;
+
+ detail_itcs[DETAIL_ITC_NUM_UTIL_BTN].func.content_get = ct_detail_gl_number_util_icon_get;
+
+ detail_itcs[DETAIL_ITC_UTIL_BTN].func.content_get = detail_gl_util_btn_icon_get;
+
+ detail_itcs[DETAIL_ITC_UTIL_1BTN].func.content_get = detail_gl_util_btn_icon_get;
+
+ detail_itcs[DETAIL_ITC_ADDRBOOK].func.text_get = detail_gl_address_book_label_get;
+
+ detail_itcs[DETAIL_ITC_LINK_UNLINK].func.content_get = detail_gl_link_unlink_icon_get;
+
+ detail_itcs[DETAIL_ITC_UNLINK_POPUP].func.text_get = detail_gl_unlink_popup_label_get;
+ detail_itcs[DETAIL_ITC_UNLINK_POPUP].func.content_get = detail_gl_unlink_popup_icon_get;
+ detail_itcs[DETAIL_ITC_UNLINK_POPUP].func.del = detail_gl_unlink_popup_del;
+
+ detail_itcs[DETAIL_ITC_EDIT_POPUP].func.text_get = detail_gl_unlink_popup_label_get;
+ detail_itcs[DETAIL_ITC_EDIT_POPUP].func.content_get = detail_gl_unlink_popup_icon_get;
+ detail_itcs[DETAIL_ITC_EDIT_POPUP].func.del = detail_gl_unlink_popup_del;
+
+ detail_itcs[DETAIL_ITC_LINK_LIST].func.text_get = detail_gl_link_list_label_get;
+
+ detail_itcs[DETAIL_ITC_LINK_LIST_SUB].func.text_get = detail_gl_link_list_sub_label_get;
+ detail_itcs[DETAIL_ITC_LINK_LIST_SUB].func.content_get = detail_gl_link_list_sub_icon_get;
+
+ detail_itcs[DETAIL_ITC_FIELD_TITLE].func.text_get = detail_gl_title_label_get;
+ detail_itcs[DETAIL_ITC_TITLE].func.text_get = detail_gl_title_label_get;
+
+ detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_1ICON].func.text_get = ct_detail_gl_baseinfo_label_get;
+ detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_1ICON].func.content_get = ct_detail_gl_baseinfo_icon_get;
+
+ detail_itcs[DETAIL_ITC_BASEINFO_2TEXT_1ICON].func.text_get = ct_detail_gl_baseinfo_label_get;
+ detail_itcs[DETAIL_ITC_BASEINFO_2TEXT_1ICON].func.content_get = ct_detail_gl_baseinfo_icon_get;
+
+ detail_itcs[DETAIL_ITC_BASEINFO_3TEXT_1ICON].func.text_get = ct_detail_gl_baseinfo_label_get;
+ detail_itcs[DETAIL_ITC_BASEINFO_3TEXT_1ICON].func.content_get = ct_detail_gl_baseinfo_icon_get;
+
+ detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_2ICON].func.text_get = ct_detail_gl_baseinfo_label_get;
+ detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_2ICON].func.content_get = ct_detail_gl_baseinfo_icon_get;
+
+ detail_itcs[DETAIL_ITC_BASEINFO_2TEXT_2ICON].func.text_get = ct_detail_gl_baseinfo_label_get;
+ detail_itcs[DETAIL_ITC_BASEINFO_2TEXT_2ICON].func.content_get = ct_detail_gl_baseinfo_icon_get;
+
+ detail_itcs[DETAIL_ITC_BASEINFO_3TEXT_2ICON].func.text_get = ct_detail_gl_baseinfo_label_get;
+ detail_itcs[DETAIL_ITC_BASEINFO_3TEXT_2ICON].func.content_get = ct_detail_gl_baseinfo_icon_get;
+
+ detail_itcs[DETAIL_ITC_DEFAULT_NUMBER_SET_POPUP].func.text_get = ct_detail_gl_number_label_get;
+ detail_itcs[DETAIL_ITC_DEFAULT_EMAIL_SET_POPUP].func.text_get = ct_detail_gl_email_label_get;
+
+ detail_itcs[DETAIL_ITC_EMAIL_DEFAULT].func.text_get = ct_detail_gl_email_label_get;
+
+ detail_itcs[DETAIL_ITC_DEFAULT_NAME_POPUP].func.text_get = __detail_gl_label_get;
+}
+
+static void detail_genlist_append_separator_line(Evas_Object *genlist)
+{
+ static Elm_Genlist_Item_Class itc_separator_1px = { .item_style="dialogue/separator/1/with_line" };
+
+ Elm_Object_Item *item;
+ item = elm_genlist_item_append(genlist, &itc_separator_1px, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+}
+
+static void detail_fill_list(Evas_Object *genlist, Elm_Genlist_Item_Class *itc, Eina_List *list, Evas_Smart_Cb func)
+{
+ Eina_List *cursor;
+ contacts_record_h record = NULL;
+ Elm_Object_Item *item;
+
+ EINA_LIST_FOREACH(list, cursor, record) {
+ item = elm_genlist_item_append(genlist, itc, record, NULL, ELM_GENLIST_ITEM_NONE, func, record);
+
+ if (NULL == func)
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+}
+
+static void detail_fill_email_list(Evas_Object *genlist, Eina_List *list, Evas_Smart_Cb func, int default_email_id)
+{
+ Eina_List *cursor;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_email = NULL;
+ int email_id;
+
+ if (eina_list_count(list) < 2 && default_email_id > 0)
+ return;
+
+ EINA_LIST_FOREACH(list, cursor, record_email) {
+ err = contacts_record_get_int(record_email, _contacts_email.id, &email_id);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (default_email_id != 0 && default_email_id == email_id)
+ continue;
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_EMAIL], record_email, NULL,
+ ELM_GENLIST_ITEM_NONE, func, record_email);
+ }
+}
+
+static void detail_fill_number_list(Evas_Object *genlist, Eina_List *list, Evas_Smart_Cb func, int default_num_id)
+{
+ Eina_List *cursor;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_number = NULL;
+ int number_id;
+
+ if (eina_list_count(list) < 2 && default_num_id > 0)
+ return;
+
+ ctui_genlist_append_separator_20px_with_line(genlist);
+
+ EINA_LIST_FOREACH(list, cursor, record_number) {
+ err = contacts_record_get_int(record_number, _contacts_number.id, &number_id);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if ((default_num_id != 0) && (number_id == default_num_id))
+ continue;
+
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_NUMBER], record_number, NULL,
+ ELM_GENLIST_ITEM_NONE, func, record_number);
+ }
+}
+
+static void detail_gl_link_list_exp(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *l;
+ contacts_record_h record_temp = NULL;
+ Evas_Object *genlist = obj;
+ Elm_Object_Item *it_parent = event_info;
+ Elm_Object_Item *item;
+ ct_detail_data *cdetail_d = data;
+
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, record_temp){
+ int contact_id;
+ err = contacts_record_get_int(record_temp, _contacts_contact.id, &contact_id );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_LINK_LIST_SUB],
+ (void *)contact_id, it_parent, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
+ }
+}
+
+static void detail_gl_link_list_con(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ elm_genlist_item_subitems_clear(item);
+}
+
+static void __detail_baseinfo_item_update(ct_detail_data *cdetail_d)
+{
+ cdetail_d->base_item = cdetail_d->base_info_item;
+ elm_genlist_item_update(cdetail_d->base_item);
+}
+
+static void detail_popup_cancel_btn_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;
+}
+
+static void __detail_set_default_name(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+ ct_detail_data *cdetail_d;
+ int contact_id;
+
+ p_retm_if(NULL == record, "parameter(record) is NULL");
+
+ cdetail_d = evas_object_data_get(obj, "cdetail_d");
+ p_retm_if(NULL == cdetail_d, "evas_object_data_get(record) return NULL");
+
+ err = contacts_record_get_int(record, _contacts_contact.id, &contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_person_set_default_property(CONTACTS_PERSON_PROPERTY_NAME_CONTACT, cdetail_d->person_id, contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_person_set_default_property() Failed(%d)", err);
+
+ err = contacts_record_destroy(cdetail_d->person, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy(list_event) Failed(%d)", err);
+
+ err = contacts_db_get_record(_contacts_person._uri, cdetail_d->person_id, &(cdetail_d->person));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ __detail_baseinfo_item_update(cdetail_d);
+
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+}
+
+static void __detail_select_person_name_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *btn;
+ char *person_name;
+ char *contact_name;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ Eina_List *l;
+ ct_detail_data *cdetail_d = data;
+
+ if(2 > eina_list_count(cdetail_d->list_contacts))
+ return;
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ popup = elm_popup_add(cdetail_d->navi);
+ p_retm_if(NULL == popup, "elm_popup_add() return NULL");
+ elm_object_style_set(popup, "liststyle");
+
+ 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", ct_detail_popup_hide_cb, cdetail_d);
+
+ elm_object_part_text_set(popup, "title,text", "Set default name");
+ evas_object_show(popup);
+ cdetail_d->popup = popup;
+
+ genlist = elm_genlist_add(popup);
+ p_retm_if(NULL == genlist, "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);
+ evas_object_data_set(genlist, "cdetail_d", cdetail_d);
+
+
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.display_name, &person_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, record) {
+ err = contacts_record_get_str_p(record, _contacts_contact.display_name, &contact_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+
+ if(strcmp(contact_name, person_name) != 0) {
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_DEFAULT_NAME_POPUP], contact_name,
+ NULL, ELM_GENLIST_ITEM_NONE, __detail_set_default_name, record);
+ }
+ }
+
+ evas_object_show(genlist);
+ elm_object_content_set(popup, genlist);
+
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+}
+
+Elm_Genlist_Item_Class* ct_detail_get_baseinfo_item_class(ct_detail_data *cdetail_d)
+{
+ PH_FN_CALL;
+ int cnt;
+ char *img;
+ char *str_main;
+ char *first = NULL;
+ char *last = NULL;
+ char str_sub1[CT_EDITFIELD_MAX_CHAR*3+1] = {0,};
+ char str_sub2[CT_EDITFIELD_MAX_CHAR*4+1] = {0,};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ str_main = NULL;
+ if (cdetail_d->person) {
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.display_name, &str_main);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ }
+ else if (cdetail_d->contact) {
+ contacts_record_h record_name;
+ err = contacts_record_get_str_p(cdetail_d->contact, _contacts_contact.display_name, &str_main);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if(NULL == str_main){
+ 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);
+ err = contacts_record_get_str_p(record_name, _contacts_name.first, &first);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ PH_DBG("first %s", first);
+ if(strlen(first)>CT_EDITFIELD_MAX_CHAR){
+ first[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+
+ err = contacts_record_get_str_p(record_name, _contacts_name.last, &last);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ PH_DBG("last %s", last);
+ if(strlen(last)>CT_EDITFIELD_MAX_CHAR){
+ last[CT_EDITFIELD_MAX_CHAR] = '\0';
+ }
+ }
+ }
+
+ str_sub1[0] = '\0';
+ ct_detail_person_get_extra_name(cdetail_d->list_contacts, cdetail_d->person, str_sub1, sizeof(str_sub1));
+ if( strlen(str_sub1) > CT_EDITFIELD_MAX_CHAR*3)
+ str_sub1[CT_EDITFIELD_MAX_CHAR*2+2] = '\0';
+
+ str_sub2[0] = '\0';
+ ct_detail_person_get_company_str(cdetail_d->list_contacts, str_sub2, sizeof(str_sub2));
+ if( strlen(str_sub2) > CT_EDITFIELD_MAX_CHAR*4)
+ str_sub2[CT_EDITFIELD_MAX_CHAR*3+4] = '\0';
+
+
+ img = NULL;
+ if (cdetail_d->person) {
+ err = contacts_record_get_str_p(cdetail_d->person, _contacts_person.image_thumbnail_path, &img);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ }
+ else if (cdetail_d->contact) {
+ err = contacts_record_get_str_p(cdetail_d->contact, _contacts_contact.image_thumbnail_path, &img);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ }
+
+ cnt = 0;
+ if (str_main && *str_main)
+ cnt++;
+ if ( (first && *first) || (last && *last) )
+ cnt++;
+ if (*str_sub1)
+ cnt++;
+ if (*str_sub2)
+ cnt++;
+ if (img && *img) cnt += 10;
+
+ switch (cnt) {
+ case 1: return &detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_1ICON];
+ case 2: return &detail_itcs[DETAIL_ITC_BASEINFO_2TEXT_1ICON];
+ case 3: return &detail_itcs[DETAIL_ITC_BASEINFO_3TEXT_1ICON];
+ case 11: return &detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_2ICON];
+ case 12: return &detail_itcs[DETAIL_ITC_BASEINFO_2TEXT_2ICON];
+ case 13: return &detail_itcs[DETAIL_ITC_BASEINFO_3TEXT_2ICON];
+ default:
+ if (10 <= cnt)
+ return &detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_2ICON];
+ else
+ return &detail_itcs[DETAIL_ITC_BASEINFO_1TEXT_1ICON];
+ }
+}
+
+static void __detail_gl_realized(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d;
+
+ Elm_Object_Item *item = event_info;
+ Elm_Genlist_Item_Class *item_class;
+ p_retm_if(NULL == item, "parameter(item) is NULL");
+
+ cdetail_d = (int)elm_object_item_data_get(item);
+ item_class = (Elm_Genlist_Item_Class *)elm_genlist_item_item_class_get(item);
+ p_retm_if(NULL == item_class, "parameter(item_class) is NULL");
+
+ if(item_class == &detail_itcs[DETAIL_ITC_GROUP])
+ elm_object_item_signal_emit(item, "elm,state,top", "");
+ else if(item_class == &detail_itcs[DETAIL_ITC_RINGTONE]){
+ if (!ct_detail_person_get_readonly(cdetail_d->list_contacts) && !cdetail_d->vcard_path)//check if group field exists.
+ elm_object_item_signal_emit(item, "elm,state,center", "");
+ else
+ elm_object_item_signal_emit(item, "elm,state,top", "");
+ }
+ else if(item_class == &detail_itcs[DETAIL_ITC_VIBRATION])
+ elm_object_item_signal_emit(item, "elm,state,bottom", "");
+}
+
+API Evas_Object* ctui_detail_genlist_update(ct_detail_data *cdetail_d)
+{
+ PH_FN_CALL;
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *genlist;
+ Evas_Object *layout;
+ int default_num_id = 0;
+ int default_email_id = 0;
+ bool need_separator;
+
+ Evas_Smart_Cb num_func = ct_detail_gl_number_sel;
+ Evas_Smart_Cb email_func = ct_detail_gl_email_sel;
+ contacts_record_h default_email_record = NULL;
+ contacts_record_h default_number_record = NULL;
+
+ layout = elm_object_part_content_get(cdetail_d->layout, "contents");
+
+ // Create genlist
+ if (NULL == cdetail_d->genlist) {
+ genlist = elm_genlist_add(layout);
+ cdetail_d->genlist = genlist;
+ evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_UP, ct_detail_mouseup, cdetail_d);
+ evas_object_data_set(genlist, "cdetail_d", cdetail_d);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+
+ evas_object_smart_callback_add(genlist, "expanded", detail_gl_link_list_exp, cdetail_d);
+ evas_object_smart_callback_add(genlist, "contracted", detail_gl_link_list_con, NULL);
+ elm_object_theme_set(genlist, cdetail_d->th);
+ }
+ else {
+ genlist = cdetail_d->genlist;
+ elm_genlist_clear(genlist);
+
+ ret = vconf_ignore_key_changed(VCONFKEY_FILEMANAGER_DB_STATUS, detail_filemanager_status_changed_cb);
+ p_warn_if(-1 == ret, "vconf_ignore_key_changed() Failed");
+ }
+ ctui_genlist_append_separator_20px(genlist);
+
+ cdetail_d->base_item = elm_genlist_item_append(genlist, ct_detail_get_baseinfo_item_class(cdetail_d),
+ cdetail_d, NULL, ELM_GENLIST_ITEM_NONE, __detail_select_person_name_cb, cdetail_d);
+ cdetail_d->base_info_item = cdetail_d->base_item;
+
+ cdetail_d->list_number = ctui_person_get_number_list(cdetail_d->list_contacts);
+ err = phone_cts_get_default_number(cdetail_d->person_id, &default_number_record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_default_number() Failed(%d)", err);
+ }
+
+ if (CONTACTS_ERROR_NONE == err && default_number_record) {
+ err = contacts_record_get_int(default_number_record, _contacts_number.id, &default_num_id);
+
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_NUMBER_DEFAULT], default_number_record, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, default_number_record);
+
+ cdetail_d->number_util_item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_NUM_UTIL_BTN], default_number_record, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ detail_fill_number_list(genlist, cdetail_d->list_number, num_func, default_num_id);
+ if (default_num_id)
+ cdetail_d->has_number = true;
+ //check block number info
+
+ // email list
+ cdetail_d->list_email = ctui_person_get_email_list(cdetail_d->list_contacts);
+ err = phone_cts_get_default_email(cdetail_d->person_id, &default_email_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_default_email() Failed(%d)", err);
+
+ if (CONTACTS_ERROR_NONE == err && default_email_record) {
+ ctui_genlist_append_separator_20px_with_line(genlist);
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_FIELD_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_EMAIL),
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ err = contacts_record_get_int(default_email_record, _contacts_email.id, &default_email_id);
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_EMAIL], default_email_record, NULL,
+ ELM_GENLIST_ITEM_NONE, email_func, default_email_record);
+ }
+ detail_fill_email_list(genlist, cdetail_d->list_email, email_func, default_email_id);
+
+ // POSTAL list
+ cdetail_d->list_postal = ct_detail_person_get_postal_list(cdetail_d->list_contacts);
+ if(cdetail_d->list_postal){
+ ctui_genlist_append_separator_20px_with_line(genlist);
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_FIELD_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_POSTAL_ADDRESS),
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_ADDRESS], cdetail_d->list_postal, NULL);
+ }
+
+ evas_object_smart_callback_add(genlist, "realized", __detail_gl_realized, NULL);
+
+ // instant messenger list
+ cdetail_d->list_messenger = ct_detail_person_get_messenger_list(cdetail_d->list_contacts);
+ if (cdetail_d->list_messenger)
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_INSTANT_MESSENGER),
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_MESSENGER], cdetail_d->list_messenger, detail_gl_messenger_sel);
+
+ need_separator = true;
+
+ // website
+ cdetail_d->list_website = ct_detail_person_get_website_list(cdetail_d->list_contacts);
+ if (cdetail_d->list_website) {
+ need_separator = false;
+ ctui_genlist_append_separator_20px_with_line(genlist);
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_FIELD_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_URL),
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ if(!cdetail_d->ug)
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_URL], cdetail_d->list_website, detail_gl_website_sel);
+ else
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_URL], cdetail_d->list_website, NULL);
+ }
+
+ //relationship
+ cdetail_d->list_relationship = ct_detail_person_get_relationship_list(cdetail_d->list_contacts);
+ if(cdetail_d->list_relationship){
+ //elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_FIELD_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_RELATIONSHIP),
+ // NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_RELATIONSHIP], cdetail_d->list_relationship, NULL);
+ }
+
+ // event list
+ cdetail_d->list_event = ct_detail_person_get_event_list(cdetail_d->list_contacts);
+ if (cdetail_d->list_event && need_separator) {
+ need_separator = false;
+ ctui_genlist_append_separator_20px_with_line(genlist);
+ }
+ if(cdetail_d->list_event){
+ //elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_FIELD_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_EVENT),
+ // NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_EVENT], cdetail_d->list_event, NULL);
+ }
+
+ //note list
+ cdetail_d->list_note = ct_detail_person_get_note_list(cdetail_d->list_contacts);
+ if (cdetail_d->list_note && need_separator) {
+ need_separator = false;
+ ctui_genlist_append_separator_20px_with_line(genlist);
+ }
+ if(cdetail_d->list_note){
+ //elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_FIELD_TITLE], T_(CT_GET_TEXT_BASIC ,CTTEXT_NOTE),
+ // NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ detail_fill_list(genlist, &detail_itcs[DETAIL_ITC_NOTE], cdetail_d->list_note, NULL);
+ }
+
+ if (cdetail_d->person_id ) {
+ ctui_genlist_append_separator_20px_with_line(genlist);
+
+ // group
+ if (!ct_detail_person_get_readonly(cdetail_d->list_contacts) && !cdetail_d->vcard_path) {
+ cdetail_d->group_item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_GROUP], cdetail_d, NULL,
+ ELM_GENLIST_ITEM_NONE, detail_group_gl_sel, cdetail_d);
+ }
+
+ // Ringtone
+ cdetail_d->ringtone_item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_RINGTONE], cdetail_d, NULL,
+ ELM_GENLIST_ITEM_NONE, detail_ringtone_gl_sel, cdetail_d);
+
+ ret = vconf_notify_key_changed(VCONFKEY_FILEMANAGER_DB_STATUS, detail_filemanager_status_changed_cb, cdetail_d->ringtone_item);
+ p_warn_if(-1 == ret, "vconf_notify_key_changed() Failed");
+
+ // Vibration
+ cdetail_d->vibration_item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_VIBRATION], cdetail_d, NULL,
+ ELM_GENLIST_ITEM_NONE, detail_vibration_gl_sel, cdetail_d);
+ // Addressbook
+ elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_ADDRBOOK], cdetail_d, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ }
+
+ return genlist;
+}
+
+static void detail_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = (ct_detail_data *)data;
+ p_retm_if(true == cdetail_d->view_destroying, "view is being destroyed.");
+
+ elm_naviframe_item_pop(cdetail_d->navi);
+ cdetail_d->view_destroying = TRUE;
+}
+
+static void __detail_out_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ elm_exit();
+}
+
+static void detail_make_back_btn(ct_detail_data *cdetail_d)
+{
+ Evas_Object *back_btn;
+ Elm_Object_Item *item;
+ back_btn = elm_button_add(cdetail_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(cdetail_d->navi_item, "prev_btn", back_btn);
+ item = elm_naviframe_bottom_item_get(cdetail_d->navi);
+ if (true == cdetail_d->ug_detail)
+ evas_object_smart_callback_add(back_btn, "clicked", phone_ug_destroy_me_cb, cdetail_d->ug);
+ else if (elm_naviframe_top_item_get(cdetail_d->navi) == item)
+ evas_object_smart_callback_add(back_btn, "clicked", __detail_out_btn_cb, cdetail_d);
+ //evas_object_smart_callback_add(back_btn, "clicked", phone_back_btn_clicked_cb, cdetail_d->win);
+ else
+ evas_object_smart_callback_add(back_btn, "clicked", detail_back_btn_cb, cdetail_d);
+}
+
+static void detail_delete_person_response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+
+ p_retm_if(NULL == cdetail_d, "parameter(cdetail_d) is NULL");
+ p_retm_if(cdetail_d->person_id <= 0, "parameter(person_id) is NULL");
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ evas_object_data_set(cdetail_d->navi, "ct_list_update_ui", (void *)1);
+
+ err = contacts_db_delete_record(_contacts_person._uri, cdetail_d->person_id);
+ if (CONTACTS_ERROR_NONE == err) {
+ // FIXME : Improve the logic
+ err = contacts_db_remove_changed_cb(_contacts_contact._uri, ct_detail_contact_changed, cdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ 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 {
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ ERR("contacts_db_delete_record() Failed(%d)", err);
+ }
+
+ PH_FN_END;
+}
+
+static void detail_gl_edit_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ ct_detail_data *cdetail_d;
+ ct_detail_person_data *person_info = data;
+
+ 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);
+
+ err = contacts_db_get_record(_contacts_contact._uri, person_info->contact_id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ ct_input_push_navi_content(cdetail_d, record, person_info->contact_id);
+}
+
+static void detail_edit_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int contact_id;
+ int addressbook_id;
+ int addressbook_mode;
+ Evas_Object *genlist;
+ Evas_Object *popup;
+ Evas_Object *btn;
+ Elm_Object_Item *item;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_addressbook = NULL;
+ Eina_List *l;
+ ct_detail_person_data *person_info;
+ ct_detail_data *cdetail_d = data;
+
+ p_ret_if(NULL == cdetail_d);
+
+ PH_DBG("##### [TSP_TEST] detail->edit start#####");
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ if (1 == eina_list_count(cdetail_d->list_contacts)) {
+ err = contacts_record_clone(cdetail_d->list_contacts->data, &record_contact);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_clone() Failed(%d)", err);
+
+ err = contacts_record_get_int(record_contact, _contacts_contact.id, &contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ ct_input_push_navi_content(cdetail_d, record_contact, contact_id);
+
+ return;
+ }
+
+ popup = elm_popup_add(cdetail_d->navi);
+ p_retm_if(NULL == popup, "elm_popup_add() return NULL");
+ elm_object_style_set(popup, "liststyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_LINKED_CONTACTS));
+ cdetail_d->popup = popup;
+
+ 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", ct_detail_popup_hide_cb, cdetail_d);
+ evas_object_show(popup);
+
+ genlist = elm_genlist_add(popup);
+ p_retm_if(NULL == genlist, "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);
+ evas_object_data_set(genlist, "cdetail_d", cdetail_d);
+
+ EINA_LIST_FOREACH(cdetail_d->list_contacts, l, record_contact) {
+ err = contacts_record_get_int(record_contact, _contacts_contact.id, &contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ 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() 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_int(record_addressbook, _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_addressbook, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY == addressbook_mode)
+ continue;
+
+ person_info = calloc(1, sizeof(ct_detail_person_data));
+ if (NULL == person_info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+ person_info->contact_id = contact_id;
+ person_info->addressbook_id = addressbook_id;
+
+ item = elm_genlist_item_append(genlist, &detail_itcs[DETAIL_ITC_EDIT_POPUP], person_info,
+ NULL, ELM_GENLIST_ITEM_NONE, detail_gl_edit_item_sel, person_info);
+
+ person_info->item = item;
+ }
+
+ evas_object_show(genlist);
+ elm_object_content_set(popup, genlist);
+}
+
+static void detail_delete_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_detail_data *cdetail_d = data;
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ if (cdetail_d->list_contacts && 1 < eina_list_count(cdetail_d->list_contacts))
+ phone_create_confirm_popup(&cdetail_d->popup, cdetail_d->win,
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_ALL_LINKED_CONTACTS_WILL_BE_DELETED),
+ detail_delete_person_response_cb, cdetail_d);
+ else
+ phone_create_confirm_popup(&cdetail_d->popup, cdetail_d->win,
+ S_(PH_SYS_POP_DELETE_Q),
+ detail_delete_person_response_cb, cdetail_d);
+}
+
+
+
+
+static void detail_history_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Theme *th;
+ ct_detail_data *cdetail_d = data;
+
+ ct_history_data *chistory_d= calloc(1, sizeof(ct_history_data));
+ p_retm_if(NULL == chistory_d, "Fail to calloc ct_history_data");
+
+ chistory_d->win = cdetail_d->win;
+ chistory_d->navi = cdetail_d->navi;
+ chistory_d->person_id = cdetail_d->person_id;
+ chistory_d->formatter = cdetail_d->formatter;
+ chistory_d->view_mode = DETAIL_VIEW_MODE_HISTORY;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, DETAIL_THEME_EDJ);
+ chistory_d->th = th;
+
+ ct_detail_history_create_itcs();
+ phone_detail_log_generate_date_format(chistory_d->hformatter);
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ if (!chistory_d->list)
+ ct_detail_history_load_data(chistory_d);
+
+ ct_detail_history_fill_layout(chistory_d);
+}
+
+static char* detail_get_addressbook_icon_path(int addressbook_id)
+{
+ int ret;
+ int account_id;
+ char *icon_path;
+ 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, "contacts_db_get_record() 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;
+ }
+ 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);
+
+ return icon_path;
+}
+
+static void detail_init_account_data(ct_detail_data *cdetail_d, ct_activity_data *cactivity_d)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int i = 0;
+ int addressbook_id = 0;
+ bool addressbook_exist = false;
+ Eina_List *l = NULL;
+ ct_ab_map acc_types[CT_MAX_ADDRBOOK];
+ char *addressbook_ids = NULL;
+ Eina_List *addressbook_id_list;
+ int ret;
+
+ err = contacts_record_get_str(cdetail_d->person, _contacts_person.addressbook_ids, &addressbook_ids);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+ addressbook_id_list = ctui_get_addressbook_id_list(addressbook_ids, " ");
+
+ ret = account_connect();
+ p_retm_if(ACCOUNT_ERROR_NONE != ret, "account_connect() Failed(%d)", ret);
+
+ EINA_LIST_FOREACH(addressbook_id_list, l, addressbook_id) {
+ acc_types[i].icon_path = detail_get_addressbook_icon_path(addressbook_id);
+ acc_types[i].id = addressbook_id;
+ i++;
+ if (i == sizeof(acc_types)/sizeof(*acc_types))
+ break;
+ }
+ cactivity_d->acc_cnt = i;
+ cactivity_d->acc_types = realloc(cactivity_d->acc_types, i * sizeof(ct_ab_map));
+ p_retm_if(NULL == cactivity_d->acc_types, "realloc() return NULL");
+
+ memcpy(cactivity_d->acc_types, acc_types, i * sizeof(ct_ab_map));
+ ret = account_disconnect();
+ p_warn_if(ACCOUNT_ERROR_NONE != ret, "account_disconnect() Failed(%d)", ret);
+}
+
+static void detail_activity_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Theme *th;
+ ct_detail_data *cdetail_d = data;
+
+ ct_activity_data *cactivity_d= calloc(1, sizeof(ct_activity_data));
+ p_retm_if(NULL == cactivity_d, "Fail to calloc ct_activity_data");
+
+ cactivity_d->win = cdetail_d->win;
+ cactivity_d->navi = cdetail_d->navi;
+ cactivity_d->person_id = cdetail_d->person_id;
+ cactivity_d->formatter = cdetail_d->formatter;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, DETAIL_THEME_EDJ);
+ cactivity_d->th = th;
+
+ ct_detail_activity_create_itcs();
+ phone_detail_log_generate_date_format(cactivity_d->hformatter);
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ detail_init_account_data(cdetail_d, cactivity_d);
+ if (!cactivity_d->list)
+ ct_detail_activity_load_data(cactivity_d);
+
+ ct_detail_activity_fill_layout(cactivity_d);
+}
+
+static void detail_more_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list_activity = NULL;
+ contacts_list_h list_history = NULL;
+ unsigned int count;
+ int rotate;
+ ct_detail_data *cdetail_d = data;
+ int x,y,w,h;
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ cdetail_d->popup = elm_ctxpopup_add(cdetail_d->navi);
+ p_retm_if(NULL == cdetail_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(cdetail_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(cdetail_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(cdetail_d->popup, "dismissed", ct_detail_popup_hide_cb, cdetail_d);
+
+ err = phone_cts_get_list(_contacts_person_phone_log._uri, _contacts_person_phone_log.person_id, cdetail_d->person_id, &list_history);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list(list_activity) Failed(%d)", err);
+ contacts_list_get_count(list_history, &count);
+
+ if (CONTACTS_ERROR_NONE == err && 0 < count)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_HISTORY), NULL,
+ detail_history_clicked_cb, cdetail_d);
+
+ err = phone_cts_get_list(_contacts_contact_activity._uri, _contacts_contact_activity.person_id, cdetail_d->person_id, &list_activity);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list(list_activity) Failed(%d)", err);
+ contacts_list_get_count(list_activity, &count);
+
+ if (CONTACTS_ERROR_NONE == err && 0 < count)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_ACTIVITIES), NULL,
+ detail_activity_clicked_cb, cdetail_d);
+
+ //Edit
+ if (!ct_detail_person_get_readonly(cdetail_d->list_contacts)) {
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(PH_SYS_SK_EDIT), NULL,
+ detail_edit_cb, cdetail_d);
+ }
+
+ //Delete
+ elm_ctxpopup_item_append(cdetail_d->popup, S_(PH_SYS_SK_DELETE), NULL,
+ detail_delete_cb, cdetail_d);
+
+ //Link
+ if ( eina_list_count(cdetail_d->list_contacts) < 10 ) {
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASE_OP, CTTEXT_LINK_CONTACTS), NULL,
+ detail_link_cb, cdetail_d);
+ }
+
+ //Unlink
+ if (cdetail_d->list_contacts && 1 < eina_list_count(cdetail_d->list_contacts)) {
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASE_OP, CTTEXT_UNLINK), NULL,
+ detail_unlink_cb, cdetail_d);
+ }
+
+
+ //Send namecard
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY != cdetail_d->base_ab_mode) {
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SEND_NAME_CARD), NULL,
+ detail_send_name_card_cb, cdetail_d);
+ }
+
+ //Default Number
+ if (eina_list_count(cdetail_d->list_number) > 1){
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SET_DEFAULT_NUMBER), NULL,
+ __detail_click_default_number, cdetail_d);
+ }
+
+ //Default Email
+ if (eina_list_count(cdetail_d->list_email) > 1){
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SET_DEFAULT_EMAIL), NULL,
+ __detail_click_default_email, cdetail_d);
+ }
+ evas_object_geometry_get(cdetail_d->ctrl_button, &x, &y, &w, &h);
+ evas_object_move(cdetail_d->popup, w/2, y+h/2);
+ evas_object_show(cdetail_d->popup);
+}
+
+void ct_detail_set_navi(ct_detail_data *cdetail_d, int mode)
+{
+ Evas_Object *toolbar_button = NULL;
+
+ cdetail_d->view_mode = mode;
+ p_retm_if(NULL == cdetail_d->navi_item, "navi item is NULL");
+
+ phone_navi_item_clear(cdetail_d->navi_item);
+
+ switch (mode) {
+ case DETAIL_VIEW_MODE_INFO:
+ detail_make_back_btn(cdetail_d);
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY != cdetail_d->base_ab_mode) {
+ cdetail_d->ctrl_button = ctui_create_more_btn(cdetail_d->navi, detail_more_btn_clicked_cb, cdetail_d);
+ elm_object_item_part_content_set(cdetail_d->navi_item, "toolbar_more_btn", cdetail_d->ctrl_button);
+ }
+ break;
+ case DETAIL_VIEW_MODE_VCARD:
+ detail_make_back_btn(cdetail_d);
+
+ toolbar_button = phone_create_toolbar_btn(cdetail_d->navi, S_(PH_SYS_OPT_ADD_TO_CONTACTS), detail_edit_cb, cdetail_d);
+ elm_object_item_part_content_set(cdetail_d->navi_item, "toolbar_button1", toolbar_button);
+
+ break;
+ case DETAIL_VIEW_MODE_GAL:
+ detail_make_back_btn(cdetail_d);
+ break;
+ default:
+ break;
+ }
+}
+
+Evas_Object* ct_detail_create_content(ct_detail_data *cdetail_d)
+{
+ Elm_Theme *th;
+ Evas_Object *bg;
+ Evas_Object *base;
+ Evas_Object *layout;
+ Evas_Object *genlist;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, DETAIL_THEME_EDJ);
+ cdetail_d->th = th;
+
+ if (cdetail_d->person_id) {
+ err = contacts_db_get_current_version(&(cdetail_d->view_create_version));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_current_version() Failed(%d)", err);
+
+ err = contacts_db_get_record(_contacts_person._uri, cdetail_d->person_id, &(cdetail_d->person));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ cdetail_d->list_contacts = ctui_person_get_contact_list(cdetail_d->person_id);
+
+ err = contacts_db_add_changed_cb(_contacts_contact._uri, ct_detail_contact_changed, cdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ err = contacts_db_add_changed_cb(_contacts_group._uri, detail_group_changed, cdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+ }
+ else if (cdetail_d->contact && NULL == cdetail_d->list_contacts) {
+ cdetail_d->list_contacts = eina_list_append(cdetail_d->list_contacts, cdetail_d->contact);
+ }
+
+ detail_create_itcs();
+ cdetail_d->formatter = ct_detail_init_time_formatter();
+
+ base = elm_layout_add(cdetail_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);
+ cdetail_d->layout = base;
+ bg = phone_create_bg(layout);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ evas_object_del(cdetail_d->layout);
+ return NULL;
+ }
+ elm_object_style_set(bg, "group_list");
+ phone_detail_log_init_time_format();
+ genlist = ctui_detail_genlist_update(cdetail_d);
+ elm_object_part_content_set(layout, "elm.swallow.content", genlist);
+
+ evas_object_data_set(cdetail_d->navi, "cdetail_d", cdetail_d);
+ evas_object_event_callback_add(cdetail_d->layout, EVAS_CALLBACK_DEL, detail_view_delete_cb, cdetail_d);
+ cdetail_d->has_detail = true;
+
+
+ return cdetail_d->layout;
+}
diff --git a/lib/details/ct-detail-view.h b/lib/details/ct-detail-view.h
new file mode 100755
index 0000000..480d2f9
--- /dev/null
+++ b/lib/details/ct-detail-view.h
@@ -0,0 +1,41 @@
+/*
+* 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_VIEW_H__
+#define __CONTACTS_DETAIL_VIEW_H__
+
+enum {
+ DETAIL_VIEW_MODE_INFO = 0,
+ DETAIL_VIEW_MODE_HISTORY,
+ DETAIL_VIEW_MODE_ACTIVITY,
+ DETAIL_VIEW_MODE_CHECK,
+ DETAIL_VIEW_MODE_VCARD,
+ DETAIL_VIEW_MODE_GAL,
+};
+
+void ct_detail_set_navi(ct_detail_data *cdetail_d, int mode);
+void ct_detail_gl_number_sel(void *data, Evas_Object *obj, void *event_info);
+void ct_detail_gl_email_sel(void *data, Evas_Object *obj, void *event_info);
+char* ct_detail_gl_number_label_get(void *data, Evas_Object *obj, const char *part);
+char* ct_detail_gl_email_label_get(void *data, Evas_Object *obj, const char *part);
+
+Evas_Object* ct_detail_create_content(ct_detail_data *cdetail_d);
+Elm_Genlist_Item_Class* ct_detail_get_baseinfo_item_class(ct_detail_data *cdetail_d);
+void ct_detail_create_itcs();
+
+#endif //__CONTACTS_DETAIL_VIEW_H__
+
diff --git a/lib/details/ct-group-assign-view.c b/lib/details/ct-group-assign-view.c
new file mode 100755
index 0000000..bce687e
--- /dev/null
+++ b/lib/details/ct-group-assign-view.c
@@ -0,0 +1,644 @@
+/*
+* 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-list.h"
+#include "ct-input-utils.h"
+#include "ct-detail-utils.h"
+#include "ct-group-assign-view.h"
+
+static Elm_Genlist_Item_Class grp_itc;
+typedef struct{
+ int selected_radio_index;
+ int contact_id;
+}ct_selected_radio_info;
+
+typedef struct {
+ Evas_Object *navi_content;
+ Evas_Object *genlist;
+ Evas_Object *radio_main;
+ Evas_Object *navi;
+ contacts_record_h contact_record;
+ Eina_List *selected_radio_info;
+ bool from_detailview;
+ ct_assign_result_cb assign_cb;
+ void *assign_cb_data;
+ Eina_List *list_contact_id;
+
+ int id_person; //for entry detail view
+ int id_addressbook; //for entry iuput view
+}ct_assign_group_data;
+
+typedef struct {
+ Evas_Object *radio_main;
+ int grp_id;
+ int contact_id;
+ int radio_index;
+ char *name;
+ bool selected;
+ bool radio_list;
+ bool group_index;
+ Elm_Object_Item *item;
+}ct_assign_list;
+
+static void grp_assign_notify_update(ct_assign_group_data *cgassign_d)
+{
+ ct_assign_list *info = NULL;
+ Elm_Object_Item *item;
+ int count = 0;
+ p_retm_if(NULL == cgassign_d, "ct_assign_group_data(cgassign_d) is null");
+
+ item = elm_genlist_first_item_get(cgassign_d->genlist);
+ while (item) {
+ info = elm_object_item_data_get(item);
+ if (info->selected)
+ count++;
+ item = elm_genlist_item_next_get(item);
+ }
+
+ if (0 < count) {
+ char buf[PH_TEXT_SHORT_LEN];
+ snprintf(buf, sizeof(buf), "%s (%d)", S_(PH_SYS_POP_SELECTED), count);
+ phone_show_notify(cgassign_d->navi_content, buf);
+ }
+ else
+ phone_show_notify(cgassign_d->navi_content, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SELECT_GROUP));
+}
+
+static void grp_assign_gl_del(void *data, Evas_Object *obj)
+{
+ ct_assign_list *info = data;
+ p_retm_if(NULL == data, "data is NULL");
+
+ free(info->name);
+ free(info);
+}
+
+static char* grp_assign_gl_label_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ ct_assign_list *info = data;
+ p_retvm_if(NULL == data, NULL, "The parameter(data) is NULL");
+
+ if (!strcmp(part, "elm.text") && info->name)
+ return strdup(info->name);
+ return NULL;
+}
+
+static void grp_assign_check_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_assign_group_data *cgassign_d;
+ ct_assign_list *info = data;
+ p_retm_if(NULL == data, "The parameter(data) is NULL");
+
+ if (EINA_TRUE == elm_check_state_get(obj))
+ info->selected = true;
+ else
+ info->selected = false;
+ cgassign_d = evas_object_data_get(elm_object_item_widget_get(info->item), "cgassign_d");
+ p_retm_if(NULL == cgassign_d, "evas_object_data_get() return NULL");
+ grp_assign_notify_update(cgassign_d);
+}
+
+static Evas_Object* grp_assign_gl_icon_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ ct_assign_list *gl = data;
+ p_retvm_if(NULL == data, NULL, "The parameter(data) is NULL");
+
+ if (!strcmp(part, "elm.icon")) {
+ if(gl->radio_list){
+ Evas_Object *radio = elm_radio_add(obj);
+ elm_radio_state_value_set(radio, gl->radio_index);
+ elm_radio_group_add(radio, gl->radio_main);
+ if(gl->selected)
+ elm_radio_value_set(gl->radio_main, gl->radio_index);
+ evas_object_smart_callback_add(radio, "changed", grp_assign_check_btn_cb, data);
+ return radio;
+ }
+ else{
+ Evas_Object *btn = elm_check_add(obj);
+ elm_check_state_set(btn, gl->selected);
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "changed", grp_assign_check_btn_cb, data);
+ return btn;
+ }
+ }
+ return NULL;
+}
+static void grp_person_assign_done_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+
+ int i;
+ int err;
+ int group_id;
+ int contact_id = 0;
+ unsigned int relation_count = 0;
+ void *eina_data;
+ char display[PH_TEXT_MAX_LEN];
+ Eina_List *l;
+ contacts_record_h grouprel_record = NULL;
+ contacts_record_h contact_record = NULL;
+ Elm_Object_Item *item;
+ ct_assign_group_data *cgassign_d = data;
+
+ display[0]= '\0';
+ //remove relation field
+
+ EINA_LIST_FOREACH(cgassign_d->list_contact_id, l, eina_data) {
+ contact_id = (int)eina_data;
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &contact_record );
+ if(CONTACTS_ERROR_NONE != err){
+ PH_DBG("contacts_db_get_record() is Failed(%d)", err);
+ continue;
+ }
+ err = contacts_record_get_child_record_count(contact_record,_contacts_contact.group_relation,&relation_count);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_count() Failed(%d)", err);
+
+ for (i = relation_count-1; i >= 0; i--) {
+ err = contacts_record_get_child_record_at_p(contact_record, _contacts_contact.group_relation, i, &grouprel_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+
+ err = contacts_record_get_int(grouprel_record,_contacts_group_relation.group_id,&group_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ err = contacts_record_get_int(grouprel_record,_contacts_group_relation.contact_id,&contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ PH_DBG("remove relation group_id=%d, contact_id=%d", group_id,contact_id);
+ err = contacts_group_remove_contact(group_id,contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_group_remove_contact() Failed(%d)", err);
+ }
+ }
+
+ if (NULL == cgassign_d->genlist) {
+ if (cgassign_d->assign_cb)
+ cgassign_d->assign_cb(cgassign_d->assign_cb_data);
+ elm_naviframe_item_pop(cgassign_d->navi);
+ return;
+ }
+
+ item = elm_genlist_first_item_get(cgassign_d->genlist);
+ while(item){
+ ct_assign_list *info = NULL;
+ info = elm_object_item_data_get(item);
+ if(info->group_index == true){
+ item = elm_genlist_item_next_get(item);
+ continue;
+ }
+ ct_selected_radio_info *radio_info;
+ PH_DBG("contact_id = %d ",info->contact_id);
+ PH_DBG("info->selected = %d, info->grp_id = %d ",info->selected,info->grp_id);
+ if(info->selected == true){
+ err = contacts_group_add_contact(info->grp_id, info->contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_group_add_contact() Failed(%d)", err);
+ }
+ item = elm_genlist_item_next_get(item);
+ }
+
+ if (cgassign_d->assign_cb)
+ cgassign_d->assign_cb(cgassign_d->assign_cb_data);
+
+ phone_hide_notify(cgassign_d->navi_content);
+ elm_naviframe_item_pop(cgassign_d->navi);
+}
+
+static void grp_assign_done_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ Elm_Object_Item *item;
+ char display[PH_TEXT_MAX_LEN];
+ ct_assign_group_data *cgassign_d = data;
+ int err,i;
+ int group_id,contact_id = 0;
+ display[0]= '\0';
+ contacts_record_h grouprel_record = NULL;
+ Eina_List *l;
+
+ //remove relation field
+ unsigned int relation_count = 0;
+ err = contacts_record_get_child_record_count(cgassign_d->contact_record, _contacts_contact.group_relation, &relation_count);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_count() Failed(%d)", err);
+ for (i = relation_count-1; i >= 0; i--) {
+ err = contacts_record_get_child_record_at_p(cgassign_d->contact_record, _contacts_contact.group_relation, i, &grouprel_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+
+ err = contacts_record_get_int(grouprel_record, _contacts_group_relation.group_id, &group_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ err = contacts_record_get_int(grouprel_record, _contacts_group_relation.contact_id, &contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_remove_child_record(cgassign_d->contact_record, _contacts_contact.group_relation, grouprel_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(grouprel_record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+
+ if (NULL == cgassign_d->genlist) {
+ if (cgassign_d->assign_cb)
+ cgassign_d->assign_cb(cgassign_d->assign_cb_data);
+ elm_naviframe_item_pop(cgassign_d->navi);
+ return;
+ }
+
+ item = elm_genlist_first_item_get(cgassign_d->genlist);
+
+ while (item) {
+ ct_assign_list *info = elm_object_item_data_get(item);
+ if(info->group_index == true){
+ item = elm_genlist_item_next_get(item);
+ continue;
+ }
+ PH_DBG("info->selected = %d, info->grp_id = %d ",info->selected,info->grp_id);
+ if(info->selected == true){
+ err = contacts_record_create(_contacts_group_relation._uri, &grouprel_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(grouprel_record,_contacts_group_relation.group_id,info->grp_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(cgassign_d->contact_record, _contacts_contact.group_relation, grouprel_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ }
+ item = elm_genlist_item_next_get(item);
+ }
+ if (cgassign_d->assign_cb)
+ cgassign_d->assign_cb(cgassign_d->assign_cb_data);
+
+ phone_hide_notify(cgassign_d->navi_content);
+ elm_naviframe_item_pop(cgassign_d->navi);
+
+}
+
+static inline void grp_assign_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_assign_group_data *cgassign_d = data;
+
+ if (cgassign_d->assign_cb)
+ cgassign_d->assign_cb(cgassign_d->assign_cb_data);
+
+ phone_hide_notify(cgassign_d->navi_content);
+ elm_naviframe_item_pop(cgassign_d->navi);
+}
+
+static void grp_assign_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_assign_group_data *cgassign_d = data;
+ ct_assign_list *info;
+ Elm_Object_Item *item = event_info;
+ p_retm_if(NULL == data, "data is NULL");
+ info = elm_object_item_data_get(item);
+ p_retm_if(NULL == info, "elm_object_item_data_get() return NULL");
+ ct_selected_radio_info *radio_info;
+ Eina_List *l;
+ if(info->radio_list){
+ EINA_LIST_FOREACH(cgassign_d->selected_radio_info,l,radio_info){
+ if(radio_info->contact_id == info->contact_id)
+ radio_info->selected_radio_index = info->radio_index;
+ }
+ PH_DBG("selected_radio_index = %d",info->radio_index);
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ elm_genlist_item_update(item);
+ elm_radio_value_set(info->radio_main, info->radio_index);
+ }
+ else{
+ info->selected = !info->selected;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ elm_genlist_item_update(item);
+ }
+ grp_assign_notify_update(cgassign_d);
+}
+
+static void grp_assign_fill_genlist(ct_assign_group_data *cgassign_d, contacts_list_h list_groups, int contact_id)
+{
+ PH_FN_CALL;
+ contacts_record_h grouprel_record = NULL;
+ contacts_error_e err;
+ ct_assign_list *gl;
+ unsigned int relation_count = 0;
+ int radio_index = 1;
+ int i = 0;
+ int group_id = 0;
+ char *system_id = NULL;
+
+ grp_itc.item_style = "1text.1icon.2";
+ grp_itc.func.text_get = grp_assign_gl_label_get;
+ grp_itc.func.content_get = grp_assign_gl_icon_get;
+ grp_itc.func.state_get = NULL;
+ grp_itc.func.del = grp_assign_gl_del;
+
+ do {
+ gl = calloc(1, sizeof(ct_assign_list));
+
+ err = phone_cts_get_int_from_list(list_groups, _contacts_group.id, &(gl->grp_id));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ PH_DBG("id=%d",gl->grp_id);
+ gl->contact_id = contact_id;
+
+ err = phone_cts_get_str_from_list(list_groups, _contacts_group.system_id, &system_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+ if (NULL != system_id) {
+ if (strcmp(system_id,"friends")==0)
+ gl->name = SAFE_STRDUP(T_(CT_GET_TEXT_BASIC, CTTEXT_FRIENDS));
+ else if (strcmp(system_id,"family")==0)
+ gl->name = SAFE_STRDUP(T_(CT_GET_TEXT_BASIC, CTTEXT_FAMILY));
+ else if (strcmp(system_id,"coworkers")==0)
+ gl->name = SAFE_STRDUP(T_(CT_GET_TEXT_BASIC, CTTEXT_CO_WORKERS));
+ else
+ gl->name = SAFE_STRDUP(T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }
+ else {
+ err = phone_cts_get_str_from_list(list_groups, _contacts_group.name, &(gl->name));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+ PH_DBG("name=%s",gl->name);
+ }
+
+ if(cgassign_d->contact_record) {
+ err = contacts_record_get_child_record_count(cgassign_d->contact_record, _contacts_contact.group_relation, &relation_count);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_count() Failed(%d)", err);
+ for (i = relation_count-1; i >= 0; i--) {
+ err = contacts_record_get_child_record_at_p(cgassign_d->contact_record, _contacts_contact.group_relation, i, &grouprel_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+ err = contacts_record_get_int(grouprel_record, _contacts_group_relation.group_id, &group_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ if (group_id == gl->grp_id) {
+ gl->selected = true;
+ }
+ }
+ }
+ gl->item = elm_genlist_item_append(cgassign_d->genlist, &grp_itc, gl, NULL, ELM_GENLIST_ITEM_NONE, grp_assign_gl_sel, cgassign_d);
+ }while (CONTACTS_ERROR_NONE == contacts_list_next(list_groups));
+}
+static char *_account_group_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_assign_list *gl = data;
+ if (0 == strcmp(part, "elm.text"))
+ return strdup(gl->name);
+ else
+ return NULL;
+}
+static Elm_Genlist_Item_Class group_index =
+{
+ .item_style = "grouptitle",
+ .func.text_get = _account_group_label_get,
+};
+static void grp_person_assign_fill_layout(ct_assign_group_data *cgassign_d)
+{
+ PH_FN_CALL;
+ unsigned int count = 0;
+ contacts_error_e err;
+ contacts_record_h contacts_record;
+ contacts_record_h addressbook_record;
+ contacts_list_h group_list;
+ Eina_List *l;
+ int contact_id = -1;
+ int address_book_id = -1;
+ Elm_Object_Item *item;
+ char *address_name;
+ char *contact_name;
+ char temp[PH_TEXT_MAX_LEN+1] ={0,};
+ ct_assign_list *gl;
+ void *data;
+
+ if (NULL == cgassign_d->genlist) {
+ cgassign_d->genlist = elm_genlist_add(cgassign_d->navi_content);
+ elm_object_part_content_set(cgassign_d->navi_content, "contents", cgassign_d->genlist);
+ evas_object_data_set(cgassign_d->genlist, "cgassign_d", cgassign_d);
+ }
+
+ EINA_LIST_FOREACH(cgassign_d->list_contact_id, l, data) {
+ contact_id = (int)data;
+
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &contacts_record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() is Failed(%d)", err);
+
+ err = contacts_record_get_int(contacts_record, _contacts_contact.address_book_id, &address_book_id);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() is Failed(%d)", err);
+
+ err = contacts_record_get_str_p(contacts_record, _contacts_contact.display_name, &contact_name);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() is Failed(%d)", err);
+
+ err = phone_cts_get_list(_contacts_group._uri, _contacts_group.address_book_id, address_book_id, &group_list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() is Failed(%d)", err);
+
+ err = contacts_list_get_count(group_list, &count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+
+ if (count >0) {
+ err = contacts_db_get_record(_contacts_address_book._uri, address_book_id, &addressbook_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+ contacts_record_get_str_p(addressbook_record, _contacts_address_book.name, &address_name);
+ snprintf(temp, PH_TEXT_MAX_LEN, "%s_%s", address_name, contact_name);
+ gl = calloc(1, sizeof(ct_assign_list));
+ gl->name = strdup(temp);
+ gl->group_index = true;
+ item = elm_genlist_item_append(cgassign_d->genlist, &group_index, gl , NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ cgassign_d->contact_record = contacts_record;
+ grp_assign_fill_genlist(cgassign_d, group_list, contact_id);
+ err = contacts_record_destroy(addressbook_record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+ }
+ err = contacts_list_destroy(group_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+ }
+ grp_assign_notify_update(cgassign_d);
+ evas_object_show(cgassign_d->genlist);
+
+/*
+ Evas_Object *noc;
+ noc = phone_create_nocontents(cgassign_d->navi_content, T_(CT_GET_TEXT_ERR, CTTEXT_NO_GROUP));
+ p_retm_if(NULL == noc, "phone_create_nocontents() return NULL");
+ elm_object_part_content_set(cgassign_d->navi_content, "contents", noc);
+ evas_object_show(noc);
+ cgassign_d->genlist = NULL;
+*/
+}
+
+static void grp_assign_fill_layout(const char *view_uri, void *data)
+{
+ PH_FN_CALL;
+ unsigned int count = 0;
+ contacts_error_e err;
+ contacts_list_h list;
+ int contact_id = 0;
+ ct_assign_group_data *cgassign_d = data;
+
+ err = phone_cts_get_list(_contacts_group._uri, _contacts_group.address_book_id, cgassign_d->id_addressbook, &list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() is Failed(%d)", err);
+
+ err = contacts_list_get_count(list, &count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+
+ if (count) {
+ if (NULL == cgassign_d->genlist) {
+ cgassign_d->genlist = elm_genlist_add(cgassign_d->navi_content);
+ elm_object_part_content_set(cgassign_d->navi_content, "contents", cgassign_d->genlist);
+ evas_object_data_set(cgassign_d->genlist, "cgassign_d", cgassign_d);
+ }
+ else
+ elm_genlist_clear(cgassign_d->genlist);
+ contact_id = (int)eina_list_nth(cgassign_d->list_contact_id,0);//number of contac id is only one at input view
+ grp_assign_fill_genlist(cgassign_d, list,contact_id);
+ grp_assign_notify_update(cgassign_d);
+ evas_object_show(cgassign_d->genlist);
+ }
+ else {
+ Evas_Object *noc;
+ noc = phone_create_nocontents(cgassign_d->navi_content, T_(CT_GET_TEXT_ERR, CTTEXT_NO_GROUP));
+ p_retm_if(NULL == noc, "phone_create_nocontents() return NULL");
+ elm_object_part_content_set(cgassign_d->navi_content, "contents", noc);
+ evas_object_show(noc);
+ cgassign_d->genlist = NULL;
+ }
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+}
+
+static void grp_assign_view_delete_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ int ret;
+ Eina_List* l;
+ ct_selected_radio_info *info;
+ ct_assign_group_data *cgassign_d = data;
+ ret = contacts_db_remove_changed_cb(_contacts_group._uri, grp_assign_fill_layout, cgassign_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", ret);
+
+
+
+
+ EINA_LIST_FOREACH(cgassign_d->selected_radio_info, l, info)
+ if (info) free(info);
+
+ eina_list_free(cgassign_d->selected_radio_info);
+
+ free(cgassign_d);
+}
+
+static void grp_assign_create_layout(ct_assign_group_data *cgassign_d)
+{
+ Evas_Object *base;
+ Evas_Object *l_btn;
+ Evas_Object *layout;
+ Elm_Object_Item *navi_item;
+
+ base = phone_create_base_layout(cgassign_d->navi, false);
+
+ layout = elm_layout_add(base);
+ elm_object_part_content_set(base, "elm.swallow.content", layout);
+
+ p_retm_if(NULL == layout, "elm_layout_add return NULL");
+ elm_layout_file_set(layout, SELECTION_INFO_EDJ, "selectioninfo_layout");
+
+ cgassign_d->navi_content = layout;
+
+ evas_object_show(layout);
+
+ if(cgassign_d->id_person > 0)
+ grp_person_assign_fill_layout(cgassign_d);
+ else
+ grp_assign_fill_layout(_contacts_group._uri, cgassign_d);
+
+
+ navi_item = elm_naviframe_item_push(cgassign_d->navi,
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_SELECT_GROUP), NULL, NULL, layout, NULL);
+
+ if(cgassign_d->from_detailview == true) {
+ Evas_Object *toolbar_btn = phone_create_toolbar_btn(cgassign_d->navi, S_(CT_SYS_SK_DONE), grp_person_assign_done_cb, cgassign_d);
+ elm_object_style_set(toolbar_btn, "naviframe/toolbar/left");
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", toolbar_btn);
+ }
+ else {
+ Evas_Object *toolbar_btn = phone_create_toolbar_btn(cgassign_d->navi, S_(CT_SYS_SK_DONE), grp_assign_done_cb, cgassign_d);
+ elm_object_style_set(toolbar_btn, "naviframe/toolbar/left");
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", toolbar_btn);
+ }
+
+ l_btn = phone_create_toolbar_btn(cgassign_d->navi, S_(PH_SYS_SK_CANCEL), grp_assign_back_cb, cgassign_d);
+ elm_object_style_set(l_btn, "naviframe/toolbar/right");
+ elm_object_item_part_content_set(navi_item, "toolbar_button2", l_btn);
+
+ evas_object_event_callback_add(cgassign_d->navi_content, EVAS_CALLBACK_DEL,
+ grp_assign_view_delete_cb, cgassign_d);
+}
+
+void ct_grp_assign_create_view(Evas_Object *navi, contacts_record_h contact, int id_ab, ct_assign_result_cb assign_cb, void *assign_cb_data)
+{
+ PH_FN_CALL;
+ int ret;
+ int contact_id;
+ ct_assign_group_data *cgassign_d;
+
+ cgassign_d = calloc(1, sizeof(ct_assign_group_data));
+ cgassign_d->navi = navi;
+ cgassign_d->contact_record = contact;
+ cgassign_d->id_addressbook = id_ab;
+ cgassign_d->assign_cb = assign_cb;
+ cgassign_d->assign_cb_data = assign_cb_data;
+ cgassign_d->from_detailview = false;
+
+ ret = contacts_record_get_int(contact,_contacts_contact.id,&contact_id);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_record_get_int() Failed(%d)", ret);
+
+ cgassign_d->list_contact_id = eina_list_append(cgassign_d->list_contact_id,(void*)contact_id);
+ PH_DBG("id_ab = %d,contact_id = %d",id_ab, contact_id);
+ grp_assign_create_layout(cgassign_d);
+
+ contacts_db_add_changed_cb(_contacts_group._uri, grp_assign_fill_layout, cgassign_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_add_changed_cb() Failed(%d)", ret);
+}
+void ct_person_grp_assign_create_view(Evas_Object *navi, int person_id, ct_assign_result_cb assign_cb, void *assign_cb_data)
+{
+ PH_FN_CALL;
+ int ret;
+
+ ct_assign_group_data *cgassign_d;
+ contacts_list_h contact_list = NULL;
+ contacts_record_h record = NULL;
+
+ cgassign_d = calloc(1, sizeof(ct_assign_group_data));
+ cgassign_d->navi = navi;
+ cgassign_d->assign_cb = assign_cb;
+ cgassign_d->assign_cb_data = assign_cb_data;
+ cgassign_d->id_person = person_id;
+ cgassign_d->from_detailview = true;
+
+ ret = phone_cts_get_list(_contacts_simple_contact._uri,_contacts_simple_contact.person_id,person_id,&contact_list);
+ p_warn_if(CONTACTS_ERROR_NONE, "phone_cts_get_list() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(contact_list, &record);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while(record){
+ int contact_id;
+
+ ret = contacts_record_get_int(record,_contacts_simple_contact.id,&contact_id );
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_record_get_int() Failed(%d)", ret);
+ cgassign_d->list_contact_id = eina_list_append(cgassign_d->list_contact_id,(void*)contact_id);
+ ret = contacts_list_next(contact_list);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_list_next() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(contact_list, &record);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ ret = contacts_list_destroy(contact_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_list_destroy() Failed(%d)", ret);
+ grp_assign_create_layout(cgassign_d);
+
+ ret = contacts_db_add_changed_cb(_contacts_group._uri,grp_assign_fill_layout,cgassign_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_add_changed_cb() Failed(%d)", ret);
+}
+
diff --git a/lib/details/ct-group-assign-view.h b/lib/details/ct-group-assign-view.h
new file mode 100755
index 0000000..2b4498c
--- /dev/null
+++ b/lib/details/ct-group-assign-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 __CONTACTS_ASSIGN_GROUP_VIEW_H__
+#define __CONTACTS_ASSIGN_GROUP_VIEW_H__
+
+void ct_grp_assign_create_view(Evas_Object *navi, contacts_record_h contact, int id_ab, ct_assign_result_cb assign_cb, void *assign_cb_data);
+void ct_person_grp_assign_create_view(Evas_Object *navi, int person_id, ct_assign_result_cb assign_cb, void *assign_cb_data);
+
+#endif //__CONTACTS_ASSIGN_GROUP_VIEW_H__
diff --git a/lib/details/ct-image-viewer.c b/lib/details/ct-image-viewer.c
new file mode 100755
index 0000000..7ac4a30
--- /dev/null
+++ b/lib/details/ct-image-viewer.c
@@ -0,0 +1,355 @@
+/*
+* 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-image-viewer.h"
+
+typedef struct {
+ char *image_path;
+ int image_id;
+ int page_id;
+}ct_image_info;
+
+typedef struct {
+ Evas_Object *navi;
+ Evas_Object *box;
+ Evas_Object *layout;
+ Evas_Object *scroller;
+
+ Evas_Object *btn_set;
+
+ ct_person_changed_cb person_changed_cb;
+ void *person_changed_cb_data;
+
+ int width;
+ int height;
+ contacts_record_h person;
+
+ Eina_List *list_img;
+ Eina_List *list_contact;
+ int list_img_count;
+}ct_image_viewer_data;
+
+
+static void __ct_image_rotate_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
+
+static void image_viewer_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_image_info *cimage_info;
+ ct_image_viewer_data *cimage_viewer_d = data;
+ p_retm_if(NULL == cimage_viewer_d, "parameter(cimage_viewer_d) is NULL");
+
+ evas_object_event_callback_del(cimage_viewer_d->layout, EVAS_CALLBACK_RESIZE, __ct_image_rotate_cb);
+
+ EINA_LIST_FREE(cimage_viewer_d->list_img, cimage_info) {
+ free(cimage_info->image_path);
+ free(cimage_info);
+ }
+ free(cimage_viewer_d);
+}
+
+static Eina_List* image_viewer_get_list_image_info(Eina_List *list_contact, ct_image_viewer_data *cimage_viewer_d)
+{
+ Eina_List *l;
+ Eina_List *list_img_info = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ contacts_record_h record_defaut_image = NULL;
+ char *img = NULL;
+ ct_image_info *cimage_info = NULL;
+ int default_image_id = 0;
+ int person_id = 0;
+
+ p_retvm_if(NULL == list_contact, NULL, "parameter(list_contact) is NULL");
+
+ if(cimage_viewer_d->person) {
+ err = contacts_record_get_int(cimage_viewer_d->person, _contacts_person.id, &person_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_record_get_int() Failed(%d)", err);
+ PH_DBG("person id %d", person_id);
+
+ err = contacts_person_get_default_property(CONTACTS_PERSON_PROPERTY_IMAGE, person_id, &default_image_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_person_get_default_property() Failed(%d)", err);
+ PH_DBG("default_image_id %d", default_image_id);
+
+ err = contacts_db_get_record(_contacts_image._uri, default_image_id, &record_defaut_image);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record_defaut_image, _contacts_image.path, &img);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ PH_DBG("default_image_img %s", img);
+
+ cimage_info = calloc(1, sizeof(ct_image_info));
+ cimage_info->image_id = default_image_id;
+ cimage_info->image_path = strdup(img);
+ list_img_info = eina_list_append(list_img_info, cimage_info);
+
+ err = contacts_record_destroy(record_defaut_image, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+
+ EINA_LIST_FOREACH(list_contact, l, record_contact) {
+ contacts_record_h record_image = NULL;
+ int image_id;
+ if (NULL == record_contact)
+ continue;
+
+ err = contacts_record_get_str_p(record_contact, _contacts_contact.image_thumbnail_path, &img);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == img || '\0' == *img)
+ continue;
+
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.image, 0, &record_image);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+
+ err = contacts_record_get_int(record_image, _contacts_image.id, &image_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if(image_id != default_image_id) {
+ cimage_info = calloc(1, sizeof(ct_image_info));
+ cimage_info->image_id = image_id;
+ cimage_info->image_path = strdup(img);
+ list_img_info = eina_list_append(list_img_info, cimage_info);
+ }
+ }
+
+ return list_img_info;
+}
+
+static void image_viewer_fill_layout(Evas_Object *box, Eina_List *list_img, int width, int height)
+{
+ Eina_List *l;
+ Evas_Object *img;
+ ct_image_info *cimage_info;
+ int page = 0;
+
+ p_retm_if(NULL == list_img, "Invalid parameter(list_img is NULL)");
+
+ EINA_LIST_FOREACH(list_img, l, cimage_info) {
+ img = elm_image_add(box);
+ p_retm_if(NULL == img, "elm_image_add() return NULL");
+
+ elm_image_file_set(img, cimage_info->image_path, NULL);
+ evas_object_size_hint_min_set(img, width, height);
+ evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
+
+ elm_box_pack_end(box, img);
+
+ cimage_info->page_id = page++;
+
+ evas_object_show(img);
+ }
+}
+
+static void image_viewer_render_post_cb(void *data, Evas *e, void *even_info)
+{
+ int width;
+ int height;
+
+ Evas_Object *box;
+ Evas_Object *scroller;
+ ct_image_viewer_data* cimage_viewer_d = data;
+
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST, image_viewer_render_post_cb);
+ evas_object_geometry_get(cimage_viewer_d->layout, NULL, NULL, &width, &height);
+
+ cimage_viewer_d->width = width;
+ cimage_viewer_d->height = height;
+
+ scroller = elm_scroller_add(cimage_viewer_d->layout);
+ p_retm_if(NULL == scroller, "elm_scroller_add() return NULL");
+ cimage_viewer_d->scroller = scroller;
+
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+
+ elm_object_part_content_set(cimage_viewer_d->layout, "elm.swallow.content", scroller);
+ elm_scroller_page_size_set(scroller, width, height);
+ elm_object_scroll_lock_y_set(scroller, EINA_TRUE);
+ evas_object_show(scroller);
+
+ box = elm_box_add(scroller);
+ p_retm_if(NULL == box, "elm_box_add() return NULL");
+ cimage_viewer_d->box = box;
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ elm_object_content_set(scroller, box);
+ evas_object_show(box);
+
+ image_viewer_fill_layout(cimage_viewer_d->box, cimage_viewer_d->list_img, cimage_viewer_d->width, cimage_viewer_d->height);
+}
+
+static void image_viewer_set_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int h_page = 0;
+ int v_page = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int person_id = 0;
+ Eina_List *l;
+ ct_image_info *cimage_info;
+ ct_image_viewer_data *cimage_viewer_d = data;
+ p_retm_if(NULL == cimage_viewer_d, "parameter(cimage_viewer_d) is NULL");
+
+ elm_scroller_current_page_get(cimage_viewer_d->scroller, &h_page, &v_page);
+
+ EINA_LIST_FOREACH(cimage_viewer_d->list_img, l, cimage_info) {
+ if(cimage_info) {
+ if(cimage_info->page_id == h_page)
+ break;
+ }
+ else
+ ERR("cimage_info is null");
+ }
+
+ if(cimage_info) {
+ err = contacts_record_get_int(cimage_viewer_d->person, _contacts_person.id, &person_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_person_set_default_property(CONTACTS_PERSON_PROPERTY_IMAGE, person_id, cimage_info->image_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_person_set_default_property() Failed(%d)", err);
+ }
+ else
+ ERR("cimage_info is null");
+
+ elm_naviframe_item_pop(cimage_viewer_d->navi);
+}
+
+static void __ct_image_refresh(ct_image_viewer_data *cimage_viewer_d)
+{
+ Evas_Object *box;
+ Evas_Object *scroller;
+ int h_page = 0;
+ int v_page = 0;
+
+ elm_scroller_current_page_get(cimage_viewer_d->scroller, &h_page, &v_page);
+
+ evas_object_del(cimage_viewer_d->scroller);
+
+ evas_object_geometry_get(cimage_viewer_d->layout, NULL, NULL, &cimage_viewer_d->width, &cimage_viewer_d->height);
+
+ scroller = elm_scroller_add(cimage_viewer_d->layout);
+ p_retm_if(NULL == scroller, "elm_scroller_add() return NULL");
+ cimage_viewer_d->scroller = scroller;
+
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+
+ elm_object_part_content_set(cimage_viewer_d->layout, "elm.swallow.content", scroller);
+ elm_scroller_page_size_set(scroller, cimage_viewer_d->width, cimage_viewer_d->height);
+ elm_object_scroll_lock_y_set(scroller, EINA_TRUE);
+ evas_object_show(scroller);
+
+ box = elm_box_add(scroller);
+ p_retm_if(NULL == box, "elm_box_add() return NULL");
+ cimage_viewer_d->box = box;
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ elm_object_content_set(scroller, box);
+ evas_object_show(box);
+
+ image_viewer_fill_layout(cimage_viewer_d->box, cimage_viewer_d->list_img, cimage_viewer_d->width, cimage_viewer_d->height);
+
+ elm_scroller_page_bring_in(cimage_viewer_d->scroller, h_page, v_page);
+}
+
+
+static void __ct_image_rotate_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ __ct_image_refresh(data);
+}
+
+void ct_image_viewer(Evas_Object *navi, contacts_record_h person, Eina_List *list_contact,
+ ct_person_changed_cb person_changed_cb, void *person_changed_cb_data)
+{
+ char navi_title[PH_TEXT_MAX_LEN+1];
+
+ Evas_Object *bg;
+ Evas_Object *btn;
+ Evas_Object *layout;
+ Elm_Object_Item *navi_item;
+
+ Eina_List *list_img_info;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_contact = NULL;
+ ct_image_info *cimage_info;
+ ct_image_viewer_data *cimage_viewer_d;
+
+ cimage_viewer_d = calloc(1, sizeof(ct_image_viewer_data));
+ p_retm_if(NULL == cimage_viewer_d, "calloc() return NULL");
+
+ cimage_viewer_d->navi = navi;
+ cimage_viewer_d->person = person;
+ cimage_viewer_d->person_changed_cb = person_changed_cb;
+ cimage_viewer_d->person_changed_cb_data = person_changed_cb_data;
+
+ layout = phone_create_base_layout(navi, EINA_FALSE);
+ if (NULL == layout) {
+ ERR("phone_create_base_layout() return NULL");
+ free(cimage_viewer_d);
+ return;
+ }
+ evas_object_show(layout);
+ cimage_viewer_d->layout = layout;
+
+ bg = phone_create_bg(layout);
+ elm_bg_color_set(bg, 0, 0, 0);
+ evas_event_callback_add(evas_object_evas_get(layout), EVAS_CALLBACK_RENDER_FLUSH_POST, image_viewer_render_post_cb, cimage_viewer_d);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, image_viewer_delete_cb, cimage_viewer_d);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_RESIZE, __ct_image_rotate_cb, cimage_viewer_d);
+
+ cimage_viewer_d->list_img = image_viewer_get_list_image_info(list_contact, cimage_viewer_d);
+
+ cimage_viewer_d->list_img_count = eina_list_count(cimage_viewer_d->list_img);
+ if (1 == cimage_viewer_d->list_img_count) {
+ char *display_name;
+ if (person) {
+ err = contacts_record_get_str_p(person, _contacts_person.display_name, &display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL != display_name)
+ snprintf(navi_title, sizeof(navi_title), "%s", display_name);
+ else
+ snprintf(navi_title, sizeof(navi_title), "%s", T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }
+ else {
+ record_contact = (contacts_record_h)list_contact->data;
+ err = contacts_record_get_str_p(record_contact, _contacts_contact.display_name, &display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL != display_name)
+ snprintf(navi_title, sizeof(navi_title), "%s", display_name);
+ else
+ snprintf(navi_title, sizeof(navi_title), "%s", T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }
+ }
+ else
+ snprintf(navi_title, sizeof(navi_title), "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_SET_DEFAULT));
+
+ btn = elm_button_add(navi);
+ elm_object_style_set(btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(btn, "clicked", phone_view_back_btn_cb, navi);
+ navi_item = elm_naviframe_item_push(navi, navi_title, btn, NULL, layout, NULL);
+
+ if(cimage_viewer_d->list_img_count > 1) {
+ cimage_viewer_d->btn_set = phone_create_toolbar_btn(navi, S_(CT_SYS_SK_SET), image_viewer_set_cb, cimage_viewer_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", cimage_viewer_d->btn_set);
+ }
+}
diff --git a/lib/details/ct-image-viewer.h b/lib/details/ct-image-viewer.h
new file mode 100755
index 0000000..a00870c
--- /dev/null
+++ b/lib/details/ct-image-viewer.h
@@ -0,0 +1,25 @@
+/*
+* 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_DETAIL_IMAGE_VIEWER_H__
+#define __CT_DETAIL_IMAGE_VIEWER_H__
+
+#include "phone-common.h"
+
+void ct_image_viewer(Evas_Object *navi, contacts_record_h person, Eina_List *list_contact, ct_person_changed_cb person_changed_cb, void *person_changed_cb_data);
+#endif /* __CT_DETAIL_IMAGE_VIEWER_H__ */
+
diff --git a/lib/details/ct-input-change-name.c b/lib/details/ct-input-change-name.c
new file mode 100755
index 0000000..8bd67ac
--- /dev/null
+++ b/lib/details/ct-input-change-name.c
@@ -0,0 +1,167 @@
+/*
+* 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-input-change-name.h"
+
+typedef struct {
+ Evas_Object *navi;
+ Elm_Object_Item *name_item;
+ Elm_Object_Item *navi_it;
+ ct_change_name_cb change_name_cb;
+ void *cb_data;
+} ct_input_change_name_data;
+
+static void input_change_name_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_change_name_data *changename_d = data;
+ elm_naviframe_item_pop(changename_d->navi);
+}
+
+static void input_change_name_save_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *name = NULL;
+ ct_input_change_name_data *changename_d = data;
+ Evas_Object *editfield = NULL;
+ Evas_Object *entry = NULL;
+
+ p_retm_if(NULL == changename_d, "parameter(changename_d) is NULL");
+
+ if (changename_d->change_name_cb) {
+ editfield = elm_object_item_part_content_get(changename_d->name_item, "elm.icon");
+ p_retm_if(NULL == changename_d, "elm_object_part_content_get() return NULL");
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ p_retm_if(NULL == changename_d, "elm_object_part_content_get() return NULL");
+
+ name = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ changename_d->change_name_cb(changename_d->cb_data, name);
+ free(name);
+ }
+ elm_naviframe_item_pop(changename_d->navi);
+}
+
+static void input_change_name_entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *text;
+ ct_input_change_name_data *changename_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(changename_d->navi_it, EINA_FALSE);
+ else
+ ctui_navi_left_btn_disabled_set(changename_d->navi_it, EINA_TRUE);
+ free(text);
+}
+
+static Evas_Object* input_change_name_gl_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ static Elm_Entry_Filter_Limit_Size limit_filter_data;
+ Evas_Object *edit_field = NULL;
+ Evas_Object *entry = NULL;
+ ct_input_change_name_data *changename_d = data;
+
+ edit_field = ctui_create_editfield(obj, NULL, NULL, false);
+
+ entry = elm_object_part_content_get(edit_field, "elm.swallow.content");
+ elm_object_signal_emit(edit_field, "elm,state,guidetext,hide", "elm");
+
+ 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", input_change_name_entry_changed_cb, changename_d);
+ evas_object_smart_callback_add(entry, "preedit,changed", input_change_name_entry_changed_cb, changename_d);
+
+ evas_object_show(entry);
+ elm_object_focus_set(entry, EINA_TRUE);
+ elm_entry_cursor_end_set(entry);
+
+ return edit_field;
+}
+
+static void __input_change_name_item_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ p_retm_if(NULL == item, "parameter(item) is NULL");
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+}
+
+static Elm_Genlist_Item_Class itc_change_name = { .item_style="dialogue/1icon", .func.content_get=input_change_name_gl_content_get };
+
+static Evas_Object* input_change_name_create_view(ct_input_change_name_data *changename_d)
+{
+ Evas_Object *base, *bg;
+ Evas_Object *genlist;
+
+ base = phone_create_base_layout(changename_d->navi, false);
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ evas_object_del(base);
+ return NULL;
+ }
+ elm_object_style_set(bg, "group_list");
+
+ genlist = elm_genlist_add(base);
+ changename_d->name_item = elm_genlist_item_append(genlist, &itc_change_name, changename_d, NULL, ELM_GENLIST_ITEM_NONE, __input_change_name_item_gl_sel, NULL);
+ elm_genlist_item_select_mode_set(changename_d->name_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ elm_object_part_content_set(base, "elm.swallow.content", genlist);
+
+ return base;
+}
+
+static void input_change_name_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_input_change_name_data *changename_d = data;
+ free(changename_d);
+}
+
+void ct_input_change_name_view(Evas_Object *navi, ct_change_name_cb cb, void *cb_data)
+{
+ Evas_Object *layout;
+ Evas_Object *l_btn;
+ Evas_Object *r_btn;
+ ct_input_change_name_data *changename_d;
+
+ changename_d = calloc(1, sizeof(ct_input_change_name_data));
+ p_retm_if(NULL == changename_d, "calloc() return NULL");
+ changename_d->navi = navi;
+ changename_d->change_name_cb = cb;
+ changename_d->cb_data = cb_data;
+
+ layout = input_change_name_create_view(changename_d);
+ if (NULL == layout) {
+ ERR("input_change_name_create_view() return NULL");
+ free(changename_d);
+ return;
+ }
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, input_change_name_del, changename_d);
+
+ changename_d->navi_it = elm_naviframe_item_push(navi, T_(CT_GET_TEXT_BASIC, CTTEXT_CUSTOM), NULL, NULL, layout, NULL);
+
+ l_btn = phone_create_navi_btn(navi, "plus");
+ evas_object_smart_callback_add(l_btn, "clicked", input_change_name_save_cb, changename_d);
+ elm_object_item_part_content_set(changename_d->navi_it, "title_left_btn", l_btn);
+ ctui_navi_left_btn_disabled_set(changename_d->navi_it, EINA_TRUE);
+
+ r_btn = phone_create_navi_btn(navi, "naviframe/prev_btn/default");
+ evas_object_smart_callback_add(r_btn, "clicked", input_change_name_cancel_cb, changename_d);
+ elm_object_item_part_content_set(changename_d->navi_it, "title_right_btn", r_btn);
+
+}
+
diff --git a/lib/details/ct-input-change-name.h b/lib/details/ct-input-change-name.h
new file mode 100755
index 0000000..357ce39
--- /dev/null
+++ b/lib/details/ct-input-change-name.h
@@ -0,0 +1,26 @@
+/*
+* 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_INPUT_CHANGE_NAME_H__
+#define __CT_INPUT_CHANGE_NAME_H__
+
+#include "phone-common.h"
+
+void ct_input_change_name_view(Evas_Object *navi, ct_change_name_cb cb, void *cb_data);
+
+#endif /* __CT_INPUT_CHANGE_NAME_H__ */
+
diff --git a/lib/details/ct-input-num-email.c b/lib/details/ct-input-num-email.c
new file mode 100755
index 0000000..6c4d9fd
--- /dev/null
+++ b/lib/details/ct-input-num-email.c
@@ -0,0 +1,1090 @@
+/*
+* 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.h"
+#include "ct-detail-utils.h"
+#include "ct-input-utils.h"
+#include "ct-input-view.h"
+
+
+#include "ct-input-num-email.h"
+#include "ct-input-change-name.h"
+
+static Evas_Object* input_fill_layout_number(ct_input_data *cinput_d, contacts_record_h record);
+static Evas_Object* input_fill_layout_email(ct_input_data *cinput_d, contacts_record_h record);
+static Evas_Object* input_new_layout_number(ct_input_data *cinput_d);
+static Evas_Object* input_new_layout_email(ct_input_data *cinput_d);
+
+static void input_email_default_reset(ct_input_data *cinput_d);
+
+static void input_email_del(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ int idx;
+ Eina_List *list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.email, typed_data->record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+
+ if (typed_data->ly_content == cinput_d->ly_email_first) {
+ idx = ct_input_box_idx_get(cinput_d->box, typed_data->ly_content);
+ list = elm_box_children_get(cinput_d->box);
+ cinput_d->ly_email_first = eina_list_nth(list, idx + 1);
+ eina_list_free(list);
+ }
+
+ if (typed_data->ly_content == cinput_d->ly_email_default)
+ input_email_default_reset(cinput_d);
+
+ err = contacts_record_destroy(typed_data->record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ elm_box_unpack(cinput_d->box, typed_data->ly_content);
+ evas_object_del(typed_data->ly_content);
+}
+
+static void input_email_del_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int count;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input_email_del(cinput_d, typed_data);
+
+}
+
+static void input_number_default_reset(ct_input_data *cinput_d)
+{
+ int cnt = 0;
+ int idx;
+ Evas_Object *ly_content;
+ Eina_List *list;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ idx = ct_input_box_idx_get(cinput_d->box, cinput_d->ly_number_first);
+ list = elm_box_children_get(cinput_d->box);
+ ly_content = cinput_d->ly_number_first;
+
+ cinput_d->ly_number_default = NULL;
+
+ while (ly_content != cinput_d->ly_number_last) {
+ typed_data = evas_object_data_get(ly_content, "typed_data");
+ if (NULL == typed_data) {
+ ly_content = eina_list_nth(list, ++cnt);
+ continue;
+ }
+
+ err = contacts_record_set_bool(typed_data->record, _contacts_number.is_default, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_bool() Failed(%d)", err);
+
+ cinput_d->ly_number_default = typed_data->ly_content;
+ edje_object_signal_emit(_EDJ(typed_data->ly_content), "elm,state,contact,default_number,enabled", "elm");
+ break;
+ }
+ eina_list_free(list);
+}
+
+static void input_email_default_reset(ct_input_data *cinput_d)
+{
+ int cnt = 0;
+ int idx;
+ Evas_Object *ly_content;
+ Eina_List *list;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ idx = ct_input_box_idx_get(cinput_d->box, cinput_d->ly_email_first);
+ list = elm_box_children_get(cinput_d->box);
+ ly_content = cinput_d->ly_email_first;
+
+ cinput_d->ly_email_default = NULL;
+
+ while (ly_content != cinput_d->ly_email_last) {
+ typed_data = evas_object_data_get(ly_content, "typed_data");
+ if (NULL == typed_data) {
+ ly_content = eina_list_nth(list, ++cnt);
+ continue;
+ }
+
+ err = contacts_record_set_bool(typed_data->record, _contacts_email.is_default, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_bool() Failed(%d)", err);
+
+ cinput_d->ly_email_default = typed_data->ly_content;
+ edje_object_signal_emit(_EDJ(typed_data->ly_content), "elm,state,contact,default_number,enabled", "elm");
+
+ break;
+ }
+ eina_list_free(list);
+}
+
+static void input_number_del(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ int idx;
+ Eina_List *list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.number, typed_data->record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ cinput_d->cnt_num--;
+
+
+ if (typed_data->ly_content == cinput_d->ly_number_first) {
+ idx = ct_input_box_idx_get(cinput_d->box, typed_data->ly_content);
+ list = elm_box_children_get(cinput_d->box);
+ cinput_d->ly_number_first = eina_list_nth(list, idx + 1);
+ eina_list_free(list);
+ }
+
+ if (typed_data->ly_content == cinput_d->ly_number_default)
+ input_number_default_reset(cinput_d);
+
+ err = contacts_record_destroy(typed_data->record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ elm_box_unpack(cinput_d->box, typed_data->ly_content);
+ evas_object_del(typed_data->ly_content);
+}
+
+static void input_number_del_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int count;
+ ct_input_typed_data *typed_data;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input_number_del(cinput_d, typed_data);
+
+}
+
+static Evas_Object* input_new_layout_email(ct_input_data *cinput_d)
+{
+ contacts_record_h record = NULL;
+ Evas_Object *layout;
+
+ record = ct_input_new_record_email(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record_email() return NULL");
+
+ layout = input_fill_layout_email(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_email() return NULL");
+
+ if (NULL == cinput_d->ly_email_first)
+ cinput_d->ly_email_first = layout;
+ cinput_d->ly_email_last = layout;
+
+ return layout;
+}
+
+static void input_number_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ int num_type;
+ char buf[PH_TEXT_MAX_LEN+1];
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data;
+ Evas_Object *btn_type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ num_type = ct_input_get_number_type(type);
+ if (CONTACTS_NUMBER_TYPE_CUSTOM == num_type){
+ ct_input_change_name_view(cinput_d->cdetail_d->navi, ct_input_custom_type_rename_cb, typed_data);
+ evas_object_del(obj);
+ return;
+ }
+
+ err = contacts_record_set_int(typed_data->record, _contacts_number.type, num_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ ctui_get_number_type_str(typed_data->record, num_type, buf, sizeof(buf));
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+ elm_object_text_set(btn_type, buf);
+ evas_object_del(obj);
+}
+
+static void input_email_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data;
+ Evas_Object *btn_type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (CONTACTS_EMAIL_TYPE_CUSTOM == type){
+ ct_input_change_name_view(cinput_d->cdetail_d->navi, ct_input_custom_type_rename_cb, typed_data);
+ evas_object_del(obj);
+ return;
+ }
+
+ err = contacts_record_set_int(typed_data->record, _contacts_email.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(type)));
+ evas_object_del(obj);
+}
+
+static void input_website_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data;
+ Evas_Object *btn_type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (CONTACTS_URL_TYPE_CUSTOM == type){
+ ct_input_change_name_view(cinput_d->cdetail_d->navi, ct_input_custom_type_rename_cb, typed_data);
+ evas_object_del(obj);
+ return;
+ }
+
+ err = contacts_record_set_int(typed_data->record, _contacts_url.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(type)));
+ evas_object_del(obj);
+}
+
+static void input_messenger_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ ct_input_typed_data *typed_data;
+ Evas_Object *btn_type;
+ ct_input_data *cinput_d;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ if (CONTACTS_MESSENGER_TYPE_CUSTOM == type){
+ ct_input_change_name_view(cinput_d->cdetail_d->navi, ct_input_custom_type_rename_cb, typed_data);
+ evas_object_del(obj);
+ return;
+ }
+
+ err = contacts_record_set_int(typed_data->record, _contacts_messenger.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_IM_TYPE, type));
+ evas_object_del(obj);
+}
+
+static void input_relationship_type_rename_cb(void *data, char *str)
+{
+ Evas_Object *btn_type;
+ ct_input_typed_data *typed_data = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retm_if(NULL == typed_data, "parameter(typed_data)");
+
+ err = contacts_record_set_str(typed_data->record, _contacts_relationship.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ if (str && *str)
+ elm_object_text_set(btn_type, str);
+}
+
+static void input_relationship_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ ct_input_typed_data *typed_data;
+ Evas_Object *btn_type;
+ ct_input_data *cinput_d;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ if (CONTACTS_RELATIONSHIP_TYPE_CUSTOM == type)
+ ct_input_change_name_view(cinput_d->cdetail_d->navi, input_relationship_type_rename_cb, typed_data);
+
+ err = contacts_record_set_int(typed_data->record, _contacts_relationship.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_RELATIONSHIP_TYPE, type));
+ evas_object_del(obj);
+}
+
+static void input_event_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ ct_input_typed_data *typed_data;
+ Evas_Object *btn_type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ err = contacts_record_set_int(typed_data->record, _contacts_event.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_EVENT_TYPE, type));
+ evas_object_del(obj);
+}
+
+void ct_input_data_type_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ bool used_birthday;
+ int i;
+ int type_int;
+ int used = 0;
+ int rotate;
+ int idx;
+ Eina_List *list;
+ Evas_Object *ly_event;
+ Evas_Object *popup;
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data = data;
+ ct_input_typed_data *typed_data_event;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ if (cinput_d->cdetail_d->popup)
+ ct_detail_popup_hide_cb(cinput_d->cdetail_d, NULL, NULL);
+
+ popup = elm_ctxpopup_add(cinput_d->cdetail_d->win);
+ p_retm_if(NULL == popup, "elm_ctxpopup_add() return NULL");
+ cinput_d->cdetail_d->popup = popup;
+
+ rotate = (int)evas_object_data_get(cinput_d->cdetail_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(popup, "dismissed", ct_detail_popup_hide_cb, cinput_d->cdetail_d);
+ evas_object_data_set(popup, "typed_data", typed_data);
+ evas_object_data_set(popup, "cinput_d", cinput_d);
+
+ if (0 == strcmp(typed_data->view_uri, _contacts_number._uri)) {
+ err = contacts_record_get_int(typed_data->record, _contacts_number.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ for (i=CTTEXT_TYPE_MOBILE;i<=CTTEXT_TYPE_OTHER;i++) {
+ if (type_int == ct_input_get_number_type(i)) continue;
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_NUM_TYPE, i), NULL,
+ input_number_type_changed_cb, (void *)i);
+ }
+ if(CONTACTS_NUMBER_TYPE_CUSTOM != type_int){
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_CUSTOM), NULL,
+ input_number_type_changed_cb, (void *)CTTEXT_TYPE_CUSTOM);
+ }
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_email._uri)) {
+ err = contacts_record_get_int(typed_data->record, _contacts_email.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ int temp_type = CONTACTS_EMAIL_TYPE_HOME;
+ while(temp_type<=CONTACTS_EMAIL_TYPE_WORK) {
+ if (type_int == temp_type) {
+ temp_type = temp_type<<1;
+ continue;
+ }
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(temp_type)), NULL,
+ input_email_type_changed_cb, (void *)temp_type);
+ temp_type = temp_type<<1;
+ }
+ if (CONTACTS_EMAIL_TYPE_OTHER != type_int) {
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(CONTACTS_EMAIL_TYPE_OTHER)), NULL,
+ input_email_type_changed_cb, (void *)CONTACTS_EMAIL_TYPE_OTHER);
+ }
+ if (CONTACTS_EMAIL_TYPE_CUSTOM != type_int) {
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(CONTACTS_EMAIL_TYPE_CUSTOM)), NULL,
+ input_email_type_changed_cb, (void *)CONTACTS_EMAIL_TYPE_CUSTOM);
+ }
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_url._uri)) {
+ err = contacts_record_get_int(typed_data->record, _contacts_url.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+
+ for (i=CONTACTS_URL_TYPE_HOME;i<=CONTACTS_URL_TYPE_WORK;i++) {
+ if (type_int == i) continue;
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(i)), NULL,
+ input_website_type_changed_cb, (void *)i);
+ }
+ if (CONTACTS_URL_TYPE_CUSTOM != type_int) {
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(CONTACTS_URL_TYPE_CUSTOM)), NULL,
+ input_website_type_changed_cb, (void *)CONTACTS_URL_TYPE_CUSTOM);
+ }
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_messenger._uri)) {
+ err = contacts_record_get_int(typed_data->record, _contacts_messenger.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ for (i=CONTACTS_MESSENGER_TYPE_GOOGLE;i<=CONTACTS_MESSENGER_TYPE_SKYPE;i++) {
+ if (type_int == i) continue;
+ if(CONTACTS_MESSENGER_TYPE_FACEBOOK == i) continue;//Jira issue S1-4557
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_IM_TYPE, i), NULL,
+ input_messenger_type_changed_cb, (void *)i);
+ }
+ if (type_int != CONTACTS_MESSENGER_TYPE_OTHER) {
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_IM_TYPE, CONTACTS_MESSENGER_TYPE_CUSTOM), NULL,
+ input_messenger_type_changed_cb, (void *)CONTACTS_MESSENGER_TYPE_CUSTOM);
+ }
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_relationship._uri)) {
+ err = contacts_record_get_int(typed_data->record, _contacts_relationship.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ for (i=CONTACTS_RELATIONSHIP_TYPE_ASSISTANT;i<=CONTACTS_RELATIONSHIP_TYPE_SPOUSE;i++) {
+ if (type_int == i) continue;
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_RELATIONSHIP_TYPE, i), NULL,
+ input_relationship_type_changed_cb, (void *)i);
+ }
+ }
+
+ else if (0 == strcmp(typed_data->view_uri, _contacts_event._uri)) {
+ err = contacts_record_get_int(typed_data->record, _contacts_event.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ idx = ct_input_box_idx_get(cinput_d->box, cinput_d->ly_event_first);
+
+ list = elm_box_children_get(cinput_d->box);
+ used_birthday = false;
+ do {
+ int type_event;
+ ly_event = eina_list_nth(list, idx++);
+ typed_data_event = evas_object_data_get(ly_event, "typed_data");
+
+ err = contacts_record_get_int(typed_data_event->record, _contacts_event.type, &type_event);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (CONTACTS_EVENT_TYPE_BIRTH == type_event) {
+ used_birthday = true;
+ break;
+ }
+ } while (ly_event != cinput_d->ly_event_last);
+ eina_list_free(list);
+
+ for (i=CONTACTS_EVENT_TYPE_BIRTH;i<=CONTACTS_EVENT_TYPE_ANNIVERSARY;i++) {
+ if (type_int == i)
+ continue;
+ else if (i == CONTACTS_EVENT_TYPE_BIRTH && used_birthday)
+ continue;
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_EVENT_TYPE, i), NULL,
+ input_event_type_changed_cb, (void *)i);
+ }
+ }
+ else {
+ ERR("Unknown type");
+ return;
+ }
+
+ phone_move_ctxpopup(popup, obj);
+ evas_object_show(popup);
+}
+
+static Evas_Object* input_new_layout_number(ct_input_data *cinput_d)
+{
+ contacts_record_h record = NULL;
+ Evas_Object *layout;
+
+ record = ct_input_new_record_number(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "input_new_number() return NULL");
+
+ layout = input_fill_layout_number(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_number() return NULL");
+
+ if (NULL == cinput_d->ly_number_first)
+ cinput_d->ly_number_first = layout;
+ cinput_d->ly_number_last = layout;
+
+ return layout;
+}
+
+static inline bool input_num_email_check_dirty_number(char digit)
+{
+ switch (digit)
+ {
+ case '0' ... '9':
+ case 'p':
+ case 'w':
+ case 'P':
+ case 'W':
+ case '#':
+ case '*':
+ case '(':
+ case '/':
+ case ')':
+ case 'N':
+ case ',':
+ case '.':
+ case ';':
+ return false;
+ case '+': //only first position
+ default:
+ return true;
+ }
+}
+
+static inline int input_check_utf8(char c)
+{
+ if (c < 128)
+ return 1;
+ else if ((c & (char)0xe0) == (char)0xc0)
+ return 2;
+ else if ((c & (char)0xf0) == (char)0xe0)
+ return 3;
+ else if ((c & (char)0xf8) == (char)0xf0)
+ return 4;
+ else if ((c & (char)0xfc) == (char)0xf8)
+ return 5;
+ else if ((c & (char)0xfe) == (char)0xfc)
+ return 6;
+ else
+ return CONTACTS_ERROR_INTERNAL;
+}
+
+static int input_num_email_clean_number(const char *src, char *dest, int dest_size)
+{
+ int s_pos=0, d_pos=0, char_type;
+
+ if (NULL == src)
+ ERR("The parameter(src) is NULL");
+ else
+ {
+ if ('+' == src[s_pos])
+ dest[d_pos++] = src[s_pos++];
+
+ while (src[s_pos] != 0)
+ {
+ if (d_pos >= dest_size-2) break;
+ char_type = input_check_utf8(src[s_pos]);
+ if (char_type <= 1) {
+ if (input_num_email_check_dirty_number(src[s_pos])) {
+ s_pos++;
+ continue;
+ }
+ dest[d_pos++] = src[s_pos++];
+ }
+ else
+ s_pos += char_type;
+ }
+ }
+
+ dest[d_pos] = 0;
+ return d_pos;
+}
+
+static void input_number_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int len;
+ char *tmp;
+ char buf[PH_TEXT_MAX_LEN];
+ Evas_Object *btn_minus;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+
+ p_retm_if(NULL == cinput_d, "parameter(ct_input_data) is NULL");
+
+ tmp = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ p_retm_if(NULL == tmp, "ctui_entry_markup_to_utf8() return NULL");
+ len = input_num_email_clean_number(tmp, buf, sizeof(buf));
+
+ if (strlen(tmp) != len) {
+ ctui_entry_entry_set(obj, buf);
+ elm_entry_cursor_end_set(obj);
+ phone_show_popup(cinput_d->cdetail_d->win, T_(CT_GET_TEXT_ERR, CTTEXT_INVALID_NUMBER), 2.0);
+ free(tmp);
+ return;
+ }
+ free(tmp);
+ if (0 == len)
+ return;
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+ cinput_d->cnt_num++;
+
+ if (typed_data->ly_content == cinput_d->ly_number_last) {
+ btn_minus = elm_button_add(typed_data->ly_content);
+ p_retm_if(NULL == btn_minus, "elm_button_add() return NULL");
+
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(typed_data->ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_number_del_clicked_cb, cinput_d);
+
+ p_retm_if(NULL == input_new_layout_number(cinput_d), "input_new_layout_number() return NULL");
+
+ return;
+ }
+}
+
+
+static void input_email_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ Evas_Object *btn_minus;
+ ct_input_typed_data *typed_data;
+ const char *tmp;
+
+ tmp = elm_entry_entry_get(obj);
+ p_retm_if(NULL == tmp || '\0' == tmp[0], "elm_entry_entry_get() return NULL");
+
+ evas_object_smart_callback_del(obj, "changed", input_email_changed_cb);
+ p_retm_if(NULL == cinput_d, "parameter(ct_input_data) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (typed_data->ly_content == cinput_d->ly_email_last) {
+ btn_minus = elm_button_add(typed_data->ly_content);
+ p_retm_if(NULL == btn_minus, "elm_button_add() return NULL");
+
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(typed_data->ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_email_del_clicked_cb, cinput_d);
+
+
+ p_retm_if(NULL == input_new_layout_email(cinput_d), "input_new_layout_email() return NULL");
+ }
+}
+
+static void input_number_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *input;
+ Evas_Object *entry = obj;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ typed_data = evas_object_data_get(entry, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == input, "ctui_entry_markup_to_utf8() return NULL");
+
+ if (*input) {
+ err = contacts_record_set_str(typed_data->record, _contacts_number.number, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() failed(%d)", err);
+
+ if (NULL == cinput_d->ly_number_default) {
+ cinput_d->ly_number_default = typed_data->ly_content;
+ edje_object_signal_emit(_EDJ(typed_data->ly_content), "elm,state,contact,default_number,enabled", "elm");
+
+ err = contacts_record_set_bool(typed_data->record, _contacts_number.is_default, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_bool() failed(%d)", err);
+ }
+ }
+ else if (typed_data->ly_content == cinput_d->ly_number_default) {
+ edje_object_signal_emit(_EDJ(typed_data->ly_content), "elm,state,contact,default_number,disabled", "elm");
+ input_number_default_reset(cinput_d);
+ }
+ free(input);
+}
+
+static void input_email_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ char *input = NULL;
+ Evas_Object *entry = obj;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ typed_data = evas_object_data_get(entry, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == input, "ctui_entry_markup_to_utf8() return NULL");
+
+ err = contacts_record_set_str(typed_data->record, _contacts_email.email, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() failed(%d)", err);
+
+ if (NULL == cinput_d->ly_email_default) {
+ cinput_d->ly_email_default = typed_data->ly_content;
+ edje_object_signal_emit(_EDJ(typed_data->ly_content), "elm,state,contact,default_number,enabled", "elm");
+
+ err = contacts_record_set_bool(typed_data->record, _contacts_email.is_default, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_bool() failed(%d)", err);
+ }
+
+ free(input);
+}
+
+
+static Evas_Object *input_number_get_edit_rename(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ char *val_str;
+ Evas_Object *entry;
+ Evas_Object *editfield;
+ Evas_Object *ly_content = typed_data->ly_content;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ editfield = ct_input_add_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_NUMBER),
+ input_number_unfocused_cb, cinput_d);
+ p_retvm_if(NULL == editfield, NULL, "ct_input_add_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ typed_data->data = entry;
+
+ evas_object_data_set(entry, "typed_data", typed_data);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_PHONENUMBER);
+
+ err = contacts_record_get_str_p(typed_data->record, _contacts_number.number, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (val_str && *val_str)
+ ctui_entry_entry_set(entry, val_str);
+ else
+ evas_object_smart_callback_add(entry, "changed", input_number_changed_cb, cinput_d);
+
+ return editfield;
+}
+
+
+static Evas_Object *input_email_get_edit_rename(ct_input_data *cinput_d,
+ ct_input_typed_data *typed_data)
+{
+ char *val_str;
+ Evas_Object *entry;
+ Evas_Object *editfield;
+ Evas_Object *ly_content = typed_data->ly_content;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ editfield = ct_input_add_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_EMAIL),
+ input_email_unfocused_cb, cinput_d);
+ p_retvm_if(NULL == editfield, NULL, "ct_input_add_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ typed_data->data = entry;
+
+ evas_object_data_set(entry, "typed_data", typed_data);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_EMAIL);
+
+ err = contacts_record_get_str_p(typed_data->record, _contacts_email.email, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (val_str && *val_str)
+ ctui_entry_entry_set(entry, val_str);
+ else
+ evas_object_smart_callback_add(entry, "changed", input_email_changed_cb, cinput_d);
+
+ return editfield;
+}
+
+static Evas_Object* input_fill_layout_number(ct_input_data *cinput_d, contacts_record_h record)
+{
+ bool is_default;
+ char *val_str;
+ int type_int;
+ char buf[PH_TEXT_MAX_LEN+1];
+ Evas_Object *ly_content;
+ Evas_Object *ef;
+ Evas_Object *btn_minus;
+ Evas_Object *btn_type = NULL;
+ Evas_Object *ico_check;
+ Evas_Object *box = cinput_d->box;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+
+ evas_object_show(ly_content);
+
+ cinput_d->ly_number_base = ly_content;
+
+ err = contacts_record_get_bool(record, _contacts_number.is_default, &is_default);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+
+ if (is_default) {
+ edje_object_signal_emit(_EDJ(ly_content), "elm,state,contact,default_number,enabled", "elm");
+ cinput_d->ly_number_default = ly_content;
+ }
+
+ err = contacts_record_get_int(record, _contacts_number.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ ctui_get_number_type_str(record, type_int, buf, sizeof(buf));
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_object_text_set(btn_type, buf);
+ evas_object_data_set(btn_type, "cinput_d", cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ ico_check = elm_icon_add(ly_content);
+ if (NULL == ico_check) {
+ ERR("elm_icon_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_icon_file_set(ico_check, CTUI_IMG_CHECK, NULL);
+ evas_object_size_hint_aspect_set(ico_check, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_object_part_content_set(ly_content, "elm.icon", ico_check);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+ typed_data->record = record;
+ typed_data->ly_content = ly_content;
+ typed_data->view_uri = _contacts_number._uri;
+
+ err = contacts_record_get_str_p(record, _contacts_number.number, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (val_str && *val_str) {
+ btn_minus = elm_button_add(ly_content);
+ if (NULL == btn_minus) {
+ ERR("elm_button_add() return NULL");
+ free(typed_data);
+ return NULL;
+ }
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_number_del_clicked_cb, cinput_d);
+ }
+
+ ef = input_number_get_edit_rename(cinput_d, typed_data);
+ if (NULL == ef) {
+ ERR("input_number_get_edit_rename() return NULL");
+ free(typed_data);
+ return NULL;
+ }
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+ ct_input_add_name_field(ef, cinput_d);
+
+ evas_object_smart_callback_add(btn_type, "clicked", ct_input_data_type_clicked_cb, typed_data);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+
+ if (cinput_d->ly_number_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_number_last);
+ else
+ elm_box_pack_end(box, ly_content);
+
+ return ly_content;
+}
+
+void ct_input_fill_layout_numbers(ct_input_data *cinput_d)
+{
+ int index = 0;
+ Evas_Object *ly = NULL;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.number, index++, &record)) {
+ ly = input_fill_layout_number(cinput_d, record);
+ p_retm_if(NULL == ly, "input_fill_layout_number() return NULL");
+
+ cinput_d->cnt_num++;
+ if (NULL == cinput_d->ly_number_first)
+ cinput_d->ly_number_first = ly;
+ }
+
+ if (NULL != ly)
+ cinput_d->ly_number_last = ly;
+
+ p_retm_if(NULL == input_new_layout_number(cinput_d), "input_new_layout_number() return NULL");
+}
+
+static Evas_Object* input_fill_layout_email(ct_input_data *cinput_d, contacts_record_h record)
+{
+ bool is_default;
+ char *val_str;
+ char *custom_type;
+ int type_int;
+ Evas_Object *ly_content, *btn_type;
+ Evas_Object *ef;
+ Evas_Object *btn_minus;
+ Evas_Object *ico_check;
+ Evas_Object *box = cinput_d->box;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ err = contacts_record_get_bool(record, _contacts_email.is_default, &is_default);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+
+ if (is_default) {
+ edje_object_signal_emit(_EDJ(ly_content), "elm,state,contact,default_number,enabled", "elm");
+ cinput_d->ly_email_default = ly_content;
+ }
+
+ err = contacts_record_get_int(record, _contacts_email.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ custom_type = (char *)T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(type_int));
+ if(CONTACTS_EMAIL_TYPE_CUSTOM == type_int){
+ err = contacts_record_get_str_p(record, _contacts_email.label, &custom_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == custom_type || '\0' == custom_type[0])
+ custom_type = (char *)T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(CONTACTS_EMAIL_TYPE_OTHER));
+ }
+
+ elm_object_text_set(btn_type, custom_type);
+ evas_object_data_set(btn_type, "cinput_d", cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ ico_check = elm_icon_add(ly_content);
+ if (NULL == ico_check) {
+ ERR("elm_icon_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_icon_file_set(ico_check, CTUI_IMG_CHECK, NULL);
+ evas_object_size_hint_aspect_set(ico_check, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_object_part_content_set(ly_content, "elm.icon", ico_check);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+ typed_data->record = record;
+ typed_data->ly_content = ly_content;
+ typed_data->view_uri = _contacts_email._uri;
+ evas_object_data_set(ly_content, "typed_data", typed_data);
+
+ err = contacts_record_get_str_p(record, _contacts_email.email, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (val_str && *val_str) {
+ btn_minus = elm_button_add(ly_content);
+ if (NULL == btn_minus) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ free(typed_data);
+ return NULL;
+ }
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_email_del_clicked_cb, cinput_d);
+ }
+
+ ef = input_email_get_edit_rename(cinput_d, typed_data);
+ if (NULL == ef) {
+ ERR("input_email_get_edit_rename() return NULL");
+ evas_object_del(ly_content);
+ free(typed_data);
+ return NULL;
+ }
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+ evas_object_smart_callback_add(btn_type, "clicked", ct_input_data_type_clicked_cb, typed_data);
+
+ if (cinput_d->ly_email_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_email_last);
+ else
+ elm_box_pack_end(box, ly_content);
+
+ ct_input_add_name_field(ef, cinput_d);
+
+ return ly_content;
+}
+
+int ct_input_fill_layout_emails(ct_input_data *cinput_d)
+{
+ int cnt = 0;
+ int index = 0;
+ Evas_Object *ly;
+ contacts_record_h record = NULL;
+
+ ly = NULL;
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.email, index++, &record)) {
+ ly = input_fill_layout_email(cinput_d, record);
+ p_retvm_if(NULL == ly, cnt, "input_fill_layout_email() return NULL");
+
+ if (NULL == cinput_d->ly_email_first)
+ cinput_d->ly_email_first = ly;
+ cnt++;
+ }
+
+ if (NULL != ly)
+ cinput_d->ly_email_last = ly;
+
+ p_retvm_if(NULL == input_new_layout_email(cinput_d), cnt, "input_new_layout_email() return NULL");
+
+ return cnt;
+}
+
diff --git a/lib/details/ct-input-num-email.h b/lib/details/ct-input-num-email.h
new file mode 100755
index 0000000..890397b
--- /dev/null
+++ b/lib/details/ct-input-num-email.h
@@ -0,0 +1,25 @@
+/*
+* 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_INPUT_VIEW_EXT_H__
+#define __CONTACTS_INPUT_VIEW_EXT_H__
+
+void ct_input_fill_layout_numbers(ct_input_data *i_data);
+int ct_input_fill_layout_emails(ct_input_data *i_data);
+void ct_input_data_type_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+
+#endif //__CONTACTS_INPUT_VIEW_EXT_H__
diff --git a/lib/details/ct-input-utils.c b/lib/details/ct-input-utils.c
new file mode 100755
index 0000000..1146631
--- /dev/null
+++ b/lib/details/ct-input-utils.c
@@ -0,0 +1,1487 @@
+/*
+* 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 <regex.h>
+#include <errno.h>
+#include <aul.h>
+#include <ui-gadget-module.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <fcntl.h>
+#include <app_service.h>
+#include <assert.h>
+
+#include "phone.h"
+#include "ct-list.h"
+#include "ct-detail.h"
+#include "ct-detail-utils.h"
+#include "ct-input-utils.h"
+#include "ct-input-view.h"
+
+#define CT_INPUT_BASE_ADDRBOOK UGDATAIDR"/base_addrbook"
+
+static void input_set_base_ab(char* ab_name)
+{
+ int fd;
+ char buf[PH_TEXT_MAX_LEN+1] = {0};
+ p_ret_if (NULL == ab_name);
+ fd = open(CT_INPUT_BASE_ADDRBOOK, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ p_retm_if(fd < 0, "Open(%s) Failed", CT_INPUT_BASE_ADDRBOOK);
+ snprintf(buf, sizeof(buf), "%s", ab_name);
+ if (-1 == write(fd, buf, strlen(buf)))
+ ERR("write()... Failed(%s)", strerror(errno));
+ close(fd);
+}
+
+int ct_input_get_base_ab(void)
+{
+ int fd = 0;
+ int size = 0;
+ char buf[PH_TEXT_MAX_LEN+1] ={0,};
+
+ fd = open(CT_INPUT_BASE_ADDRBOOK, O_RDONLY);
+ p_retvm_if(fd < 0, 0, "Open(%s) Failed", CT_INPUT_BASE_ADDRBOOK);
+ size = read(fd, buf, sizeof(buf));
+ close(fd);
+
+ if (size > 0)
+ return ctui_get_addressbook_id(buf);
+ else
+ return 0;
+}
+
+static void input_change_photo(ct_input_data *cinput_d, const char *normal, const char *full)
+{
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ record = ctui_get_record_image(cinput_d->contact);
+ p_retm_if(NULL == record, "ctui_get_record_image() Failed(%d)");
+
+ err = contacts_record_set_str(record, _contacts_image.path, normal);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)");
+
+ ct_input_update_image(cinput_d);
+}
+
+static void input_img_crop_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *normal = NULL;
+ char *full = NULL;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "crop_image_path", &normal);
+ p_retm_if(!normal, "return value is NULL.\n");
+
+ service_get_extra_data(service, "image_path", &full);
+ input_change_photo(cinput_d, normal, full);
+ free(normal);
+ }
+}
+
+static void input_src_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ ct_input_data *cinput_d = priv;
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ if (cinput_d->src_ug) {
+ ug_destroy(cinput_d->src_ug);
+ cinput_d->src_ug = NULL;
+ }
+
+ elm_object_tree_focus_allow_set(cinput_d->cdetail_d->navi, EINA_TRUE);
+}
+
+static void input_crop_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ PH_FN_CALL;
+ ct_input_data *cinput_d = priv;
+
+ elm_object_tree_focus_allow_set(cinput_d->cdetail_d->navi, EINA_TRUE);
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ if (cinput_d->crop_ug) {
+ ug_destroy(ug);
+ cinput_d->crop_ug = NULL;
+ }
+ if (cinput_d->src_ug) {
+ ug_destroy(cinput_d->src_ug);
+ cinput_d->src_ug = NULL;
+ }
+}
+
+static void input_gallery_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ ct_input_data *cinput_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 = input_img_crop_result;
+ cbs.destroy_cb = input_crop_ug_destroy;
+ cbs.priv = cinput_d;
+ cinput_d->crop_ug = phone_image_crop_ug(cinput_d->cdetail_d->ug, val, &cbs);
+ free(val);
+ }
+}
+
+void ct_input_gallery(ct_input_data *cinput_d)
+{
+ struct ug_cbs cbs = {0};
+ service_h service = NULL;
+
+ elm_object_tree_focus_allow_set(cinput_d->cdetail_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 = input_gallery_result;
+ cbs.destroy_cb = input_src_ug_destroy;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cinput_d;
+
+ cinput_d->src_ug = ug_create(cinput_d->cdetail_d->ug, GALLERY_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cinput_d->src_ug, "ug_create() Failed");
+
+ service_destroy(service);
+
+ if (cinput_d->cdetail_d->popup) {
+ evas_object_del(cinput_d->cdetail_d->popup);
+ cinput_d->cdetail_d->popup = NULL;
+ }
+}
+
+static void input_camera_result(service_h service, service_h reply, service_result_e result, void* user_data)
+{
+ char *normal = NULL;
+ char *full = NULL;
+ ct_input_data *cinput_d = user_data;
+
+ cinput_d->camera_service_launched = false;
+
+ elm_object_tree_focus_allow_set(cinput_d->cdetail_d->navi, EINA_TRUE);
+
+ service_get_extra_data(reply, "crop_image_path", &normal);
+ p_retm_if(!normal, "return value is NULL.\n");
+
+ service_get_extra_data(reply, "image_path", &full);
+ input_change_photo(cinput_d, normal, full);
+
+ free(normal);
+ free(full);
+}
+
+void ct_input_camera(ct_input_data *cinput_d)
+{
+ int ret;
+ service_h service;
+
+ p_retm_if(NULL == cinput_d, "paramter(ct_input_data) is NULL");
+ p_retm_if(NULL == cinput_d->cdetail_d, "cinput_d->cdetail_d is NULL.\n");
+ p_ret_if(true == cinput_d->camera_service_launched);
+
+ if (cinput_d->cdetail_d && cinput_d->cdetail_d->popup)
+ ct_detail_popup_hide_cb(cinput_d->cdetail_d, NULL, NULL);
+
+ service = NULL;
+ ret = service_create(&service);
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_create() Failed(%d)", ret);
+
+ if(NULL == cinput_d->cdetail_d->win) {
+ ERR("cinput_d->cdetail_d->win is NULL.\n");
+ ret = service_destroy(service);
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+ return;
+ }
+
+ ret = service_set_window(service, elm_win_xwindow_get(cinput_d->cdetail_d->win));
+ if (SERVICE_ERROR_NONE != ret) {
+ ERR("service_set_package() Failed(%d)", ret);
+ ret = service_destroy(service);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+ return;
+ }
+
+ ret = service_set_operation(service, SERVICE_OPERATION_CREATE_CONTENT);
+ if (SERVICE_ERROR_NONE != ret) {
+ ERR("service_set_operation() Failed(%d)", ret);
+ ret = service_destroy(service);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+ return;
+ }
+
+ ret = service_set_mime(service, "image/jpg");
+ if (SERVICE_ERROR_NONE != ret) {
+ ERR("service_set_mime() Failed(%d)", ret);
+ ret = service_destroy(service);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+ return;
+ }
+
+ ret = service_add_extra_data(service, "CALLER", "contacts");
+ if (SERVICE_ERROR_NONE != ret) {
+ ERR("service_add_extra_data() Failed(%d)", ret);
+ ret = service_destroy(service);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+ return;
+ }
+
+ ret = service_send_launch_request(service, input_camera_result, cinput_d);
+ if (SERVICE_ERROR_NONE != ret) {
+ ERR("service_send_launch_request() Failed(%d)", ret);
+ ret = service_destroy(service);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+ return;
+ }
+
+ cinput_d->camera_service_launched = true;
+
+ ret = service_destroy(service);
+ p_retm_if(SERVICE_ERROR_NONE != ret, "service_destroy() Failed(%d)", ret);
+}
+
+static void input_myfile_ringtone_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_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.\n");
+
+ err = contacts_record_set_str(cinput_d->contact, _contacts_contact.ringtone_path, val);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(val);
+
+ ct_input_update_ringtone(cinput_d->contact, cinput_d->ly_ringtone);
+ }
+}
+
+static void input_vibration_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ ct_input_data *cinput_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 == cinput_d->contact, "contact is NULL");
+ err = contacts_record_set_str(cinput_d->contact, _contacts_contact.vibration, (const char *)val);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ ct_input_update_vibration(cinput_d->contact, cinput_d->ly_vibration);
+ free(val);
+ }
+}
+
+static inline ui_gadget_h input_myfile_ug(struct ug_cbs cbs,
+ service_h service, ct_input_data *cinput_d)
+{
+ ui_gadget_h ug;
+
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cinput_d;
+
+ ug = ug_create(cinput_d->cdetail_d->ug, MYFILES_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == ug, "ug_create() Failed");
+
+ return ug;
+}
+
+static inline ui_gadget_h input_vibration_ug(struct ug_cbs cbs,
+ service_h service, ct_input_data *cinput_d)
+{
+ ui_gadget_h ug;
+
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cinput_d;
+
+ ug = ug_create(cinput_d->cdetail_d->ug, VIBRATION_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == ug, "ug_create() Failed");
+
+ return ug;
+}
+
+void ct_input_myfile_vibration(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ struct ug_cbs cbs = {0};
+ ct_input_data *cinput_d = data;
+ char *vibration_path = NULL;
+
+ service_h service;
+
+ service_create(&service);
+ service_add_extra_data(service, "caller", "org.tizen.phone");
+
+ err = contacts_record_get_str_p(cinput_d->contact, _contacts_contact.vibration, &vibration_path);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)",err);
+
+ if (vibration_path) {
+ service_add_extra_data(service, "selected", vibration_path);
+ }
+
+ cbs.result_cb = input_vibration_result;
+ cbs.destroy_cb = input_src_ug_destroy;
+ cinput_d->src_ug = input_vibration_ug(cbs, service, cinput_d);
+ p_warn_if(NULL == cinput_d->src_ug, "input_vibration_ug() Failed");
+
+ service_destroy(service);
+
+ if (cinput_d->popup) {
+ evas_object_del(cinput_d->popup);
+ cinput_d->popup = NULL;
+ }
+}
+
+void ct_input_myfile_ringtone(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ struct ug_cbs cbs = {0};
+ ct_input_data *cinput_d = data;
+ const char *ringtone_path = NULL;
+ char *str = NULL;
+ char buf[PH_TEXT_MAX_LEN+1];
+
+ 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");
+
+ err = contacts_record_get_str_p(cinput_d->contact, _contacts_contact.ringtone_path, &str);
+ if(CONTACTS_ERROR_NONE == err)
+ ringtone_path = ct_detail_get_ringtone_display_name(str);
+
+ if (ringtone_path && *ringtone_path) {
+ snprintf(buf, sizeof(buf), "/opt/share/settings/Ringtones/%s", ringtone_path);
+ service_add_extra_data(service, "marked_mode", buf);
+ }
+
+ cbs.result_cb = input_myfile_ringtone_result;
+ cbs.destroy_cb = input_src_ug_destroy;
+ cinput_d->src_ug = input_myfile_ug(cbs, service, cinput_d);
+
+ if (cinput_d->popup) {
+ evas_object_del(cinput_d->popup);
+ cinput_d->popup = NULL;
+ }
+
+ service_destroy(service);
+}
+
+#define ACCOUNT_RGEX "([a-z0-9!#$%&'*+/=?^_`{|}~-]+[.])*[a-z0-9!#$%&'*+/=?^_`{|}~-]+"
+#define DOMAIN_RGEX "([a-z0-9!#$%&'*+/=?^_`{|}~-]+[.])+[a-z0-9!#$%&'*+/=?^_`{|}~-]+"
+#define EMAIL_RGEX ACCOUNT_RGEX"@"DOMAIN_RGEX
+
+int ct_input_valid_email(contacts_record_h record_contact)
+{
+ int len;
+ int index = 0;
+ int result = TRUE;
+ char *email = NULL;
+ regex_t compiled;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.email, index++, &record)) {
+ err = contacts_record_get_str_p(record, _contacts_email.email, &email);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_str_p() Failed(%d)", err);
+ continue;
+ }
+ if (email && strlen(email) >0) {
+ len = strlen(email) + 1;
+ regmatch_t str[len];
+
+ if (regcomp(&compiled, EMAIL_RGEX, REG_ICASE | REG_EXTENDED))
+ result = FALSE;
+ if (regexec(&compiled, email, len, str, 0) == REG_NOMATCH)
+ result = FALSE;
+
+ regfree(&compiled);
+ }
+ if (!result)
+ break;
+ }
+ return result;
+}
+
+static int input_is_name_empty(contacts_record_h record_contact)
+{
+ contacts_record_h record = NULL;
+ char *name = NULL;
+
+ record = ct_input_get_record_name(record_contact);
+ p_retvm_if(NULL == record, TRUE, "ct_input_get_record_name() return NULL");
+
+ contacts_record_get_str_p(record, _contacts_name.first, &name);
+ if (NULL == name || '\0' == *name) {
+ contacts_record_get_str_p(record, _contacts_name.last, &name);
+ if (NULL == name || '\0' == *name) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static int input_is_num_empty(contacts_record_h record_contact)
+{
+ int index = 0;
+ char *number;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.number, index++, &record)) {
+ err = contacts_record_get_str_p(record, _contacts_number.number, &number);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_str_p() Failed(%d)", err);
+ continue;
+ }
+ if (number && *number)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static int input_is_email_empty(contacts_record_h record_contact)
+{
+ int index = 0;
+ char *email;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.email, index++, &record)) {
+ err = contacts_record_get_str_p(record, _contacts_email.email, &email);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_str_p() Failed(%d)", err);
+ continue;
+ }
+ if (email && *email)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void input_btn_popup(ct_detail_data *cdetail_d, const char *desc)
+{
+ Evas_Object *popup;
+ Evas_Object *btn;
+
+ popup = elm_popup_add(cdetail_d->navi);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, desc);
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_SK_OK));
+ elm_object_part_content_set(popup, "button1", btn);
+ elm_object_style_set(btn, "popup_button/default");
+ evas_object_smart_callback_add(btn, "clicked", ct_detail_popup_hide_cb, cdetail_d);
+
+ cdetail_d->popup = popup;
+ evas_object_show(popup);
+}
+
+void ct_input_save_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ int ret_id = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == cinput_d, "cinput_d is NULL");
+
+ cdetail_d = cinput_d->cdetail_d;
+
+ err = contacts_record_set_int(cinput_d->contact, _contacts_contact.address_book_id, cinput_d->base_ab);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+
+ if (TRUE != (ret = ct_input_valid_email(cinput_d->contact))) {
+ input_btn_popup(cdetail_d, T_(CT_GET_TEXT_ERR, CTTEXT_INVALID_EMAIL));
+ return;
+ }
+
+ if (input_is_name_empty(cinput_d->contact)
+ && input_is_num_empty(cinput_d->contact)
+ && input_is_email_empty(cinput_d->contact)) {
+ input_btn_popup(cdetail_d, T_(CT_GET_TEXT_ERR, CTTEXT_SAVE_FAIL));
+ return;
+ }
+
+ if (cinput_d->contact_id) {
+ err = contacts_db_update_record(cinput_d->contact);
+ if (CONTACTS_ERROR_NONE != err) {
+ ctui_create_contacts_error_popup(cdetail_d->navi, err);
+ return;
+ }
+ else {
+ cinput_d->saved = true;
+ }
+ }
+ else {
+ err = contacts_db_insert_record(cinput_d->contact, &ret_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ctui_create_contacts_error_popup(cdetail_d->navi, err);
+ return;
+ }
+ cinput_d->saved = true;
+ input_set_base_ab(cinput_d->base_ab_name);
+ if (NULL == cdetail_d->prev_view_data && cdetail_d->ug)
+ phone_ug_return_id(cdetail_d->ug, ret_id, 0, 0);
+ }
+
+ /* evas_object_smart_callback_del() func will be deleted */
+ evas_object_smart_callback_del(obj, "clicked", ct_input_save_cb);
+
+ if (cdetail_d->prev_view_data && ((CT_UG_REQUEST_UPDATE_CONTACT <= cdetail_d->ug_request &&
+ cdetail_d->ug_request <= CT_UG_REQUEST_SAVE_RINGTONE) ||
+ (PH_UG_REQUEST_SET_WITH_NUM <= cdetail_d->ug_request &&
+ cdetail_d->ug_request <= PH_UG_REQUEST_SET_WITH_RINGTONE))){
+ ug_destroy_me(cdetail_d->ug);
+ }
+ else if (cdetail_d->ug && !cdetail_d->has_detail && NULL == cdetail_d->prev_view_data) {
+ ug_destroy_me(cdetail_d->ug);
+ }
+ else if (cdetail_d->vcard_path)
+ elm_exit();
+ else
+ elm_naviframe_item_pop(cdetail_d->navi);
+}
+
+void ct_input_custom_type_rename_cb(void *data, char *str)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *btn_type;
+ ct_input_typed_data *typed_data = data;
+ p_retm_if(NULL == typed_data, "parameter(typed_data)");
+
+ if (0 == strcmp(typed_data->view_uri, _contacts_number._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_number.type, CONTACTS_NUMBER_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_number.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_email._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_email.type, CONTACTS_EMAIL_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_email.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_address._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_address.type, CONTACTS_ADDRESS_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_address.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_url._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_url.type, CONTACTS_URL_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_url.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_messenger._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_messenger.type, CONTACTS_MESSENGER_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_messenger.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_relationship._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_relationship.type, CONTACTS_RELATIONSHIP_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_relationship.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ else if (0 == strcmp(typed_data->view_uri, _contacts_event._uri)) {
+ err = contacts_record_set_int(typed_data->record, _contacts_event.type, CONTACTS_EVENT_TYPE_CUSTOM);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+ err = contacts_record_set_str(typed_data->record, _contacts_event.label, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ if (str && *str)
+ elm_object_text_set(btn_type, str);
+}
+
+int ct_input_get_number_type(int ct_num_type)
+{
+ int ret_type;
+
+ switch (ct_num_type) {
+ case CTTEXT_TYPE_MOBILE:
+ ret_type = CONTACTS_NUMBER_TYPE_CELL;
+ break;
+ case CTTEXT_TYPE_HOME:
+ ret_type = CONTACTS_NUMBER_TYPE_VOICE | CONTACTS_NUMBER_TYPE_HOME;
+ break;
+ case CTTEXT_TYPE_HOME2:
+ ret_type = CONTACTS_NUMBER_TYPE_CELL | CONTACTS_NUMBER_TYPE_HOME;
+ break;
+ case CTTEXT_TYPE_WORK:
+ ret_type = CONTACTS_NUMBER_TYPE_VOICE | CONTACTS_NUMBER_TYPE_WORK;
+ break;
+ case CTTEXT_TYPE_WORK2:
+ ret_type = CONTACTS_NUMBER_TYPE_CELL | CONTACTS_NUMBER_TYPE_WORK;
+ break;
+ case CTTEXT_TYPE_FAX_HOME:
+ ret_type = CONTACTS_NUMBER_TYPE_FAX | CONTACTS_NUMBER_TYPE_HOME;
+ break;
+ case CTTEXT_TYPE_FAX_WORK:
+ ret_type = CONTACTS_NUMBER_TYPE_FAX | CONTACTS_NUMBER_TYPE_WORK;
+ break;
+ case CTTEXT_TYPE_ASSISTANT:
+ ret_type = CONTACTS_NUMBER_TYPE_ASSISTANT;
+ break;
+ case CTTEXT_TYPE_PAGER:
+ ret_type = CONTACTS_NUMBER_TYPE_PAGER;
+ break;
+ case CTTEXT_TYPE_CAR:
+ ret_type = CONTACTS_NUMBER_TYPE_CAR;
+ break;
+ case CTTEXT_TYPE_CUSTOM:
+ ret_type = CONTACTS_NUMBER_TYPE_CUSTOM;
+ break;
+ case CTTEXT_TYPE_OTHER:
+ default:
+ ret_type = CONTACTS_NUMBER_TYPE_OTHER;
+ break;
+ }
+
+ return ret_type;
+}
+
+void ct_input_entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (elm_object_focus_get(obj)) return;
+ evas_object_smart_callback_call(obj, "unfocused", NULL);
+}
+
+Evas_Object* ct_input_add_editfield(Evas_Object *parent, const char* guide_txt,
+ Evas_Smart_Cb unfocused_cb, void *unfocused_cb_data)
+{
+ Evas_Object *editfield;
+ Evas_Object *entry;
+
+ editfield = ctui_create_editfield(parent, NULL, guide_txt, false);
+ p_retvm_if(NULL == editfield, NULL, "ctui_create_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ evas_object_smart_callback_add(entry, "changed", ct_input_entry_changed_cb, editfield);
+
+ if (unfocused_cb)
+ evas_object_smart_callback_add(entry, "unfocused", unfocused_cb, unfocused_cb_data);
+
+ return editfield;
+}
+
+int ct_input_next_number_type(contacts_record_h record_contact)
+{
+ int i;
+ int used[CTTEXT_TYPE_RADIO+1] = {0};
+ int cts_type;
+ int type;
+ int index = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.number, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_number.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ type = phone_detail_log_get_phonenumber_type(cts_type);
+ used[type] = 1;
+ }
+
+ for (i=CTTEXT_TYPE_MOBILE;i<CTTEXT_TYPE_OTHER;i++) {
+ if (0 == used[i])
+ return ct_input_get_number_type(i);
+ }
+ return CTTEXT_TYPE_OTHER;
+}
+
+int ct_input_next_email_type(contacts_record_h record_contact)
+{
+ int i;
+ int used = 0;
+ int cts_type;
+ int index = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.email, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_email.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ used |= cts_type;
+ }
+ for (i=1;(1<<i)<=CONTACTS_EMAIL_TYPE_WORK;i++) {
+ if (!(used & (1<<i)))
+ return 1<<i;
+ }
+
+ return CONTACTS_EMAIL_TYPE_OTHER;
+}
+
+int ct_input_next_event_type(contacts_record_h record_contact)
+{
+ int index = 0;
+ int cts_type;
+ bool used_birthday = false;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.event, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_event.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ if (CONTACTS_EVENT_TYPE_BIRTH == cts_type) {
+ used_birthday = true;
+ break;
+ }
+ }
+
+ if (used_birthday)
+ return CONTACTS_EVENT_TYPE_ANNIVERSARY;
+
+ return CONTACTS_EVENT_TYPE_BIRTH;
+}
+
+int ct_input_next_address_type(contacts_record_h record_contact)
+{
+ int i;
+ int used = 0;
+ int cts_type;
+ int index = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.address, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_address.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ used |= cts_type;
+ }
+ for (i=1;(1<<i)<=CONTACTS_ADDRESS_TYPE_WORK;i++) {
+ if (!(used & (1<<i)))
+ return 1<<i;
+ }
+
+ return CONTACTS_ADDRESS_TYPE_OTHER;
+}
+
+int ct_input_next_web_type(contacts_record_h record_contact)
+{
+ int i;
+ int index = 0;
+ int cts_type;
+ int used[CONTACTS_URL_TYPE_WORK+1] = {0};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.url, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_url.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ used[cts_type] = 1;
+ }
+
+ for (i=CONTACTS_URL_TYPE_HOME;i<=CONTACTS_URL_TYPE_WORK;i++) {
+ if (0 == used[i])
+ return i;
+ }
+ return CONTACTS_URL_TYPE_OTHER;
+}
+
+int ct_input_next_relationship_type(contacts_record_h record_contact)
+{
+ int i;
+ int index = 0;
+ int cts_type;
+ int used[CONTACTS_RELATIONSHIP_TYPE_SPOUSE+1] = {0};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.relationship, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_relationship.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ used[cts_type] = 1;
+ }
+
+ for (i=CONTACTS_RELATIONSHIP_TYPE_ASSISTANT;i<=CONTACTS_RELATIONSHIP_TYPE_SPOUSE;i++) {
+ if (!used[i])
+ return i;
+ }
+ return CONTACTS_RELATIONSHIP_TYPE_CUSTOM;
+}
+
+int ct_input_next_messenger_type(contacts_record_h record_contact)
+{
+ int i;
+ int index = 0;
+ int cts_type;
+ int used[CONTACTS_MESSENGER_TYPE_IRC+1] = {0};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(record_contact, _contacts_contact.messenger, index++, &record)) {
+ err = contacts_record_get_int(record, _contacts_messenger.type, &cts_type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_int() Failed(%d)", err);
+ continue;
+ }
+ used[cts_type] = 1;
+ }
+
+ for (i=CONTACTS_MESSENGER_TYPE_GOOGLE;i<=CONTACTS_MESSENGER_TYPE_IRC;i++) {
+ if (0 == used[i])
+ return i;
+ }
+
+ return CONTACTS_MESSENGER_TYPE_OTHER;
+}
+
+
+Evas_Object* ct_input_create_dg_layout(Evas_Object *parent, const char *theme)
+{
+ Evas_Object *layout = elm_layout_add(parent);
+ p_retvm_if(NULL == layout, NULL, "elm_layout_add() return NULL");
+
+ elm_layout_theme_set(layout, "layout", "dialogue", theme);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 0.0);
+
+ evas_object_show(layout);
+ return layout;
+}
+
+void ct_input_typed_layout_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_input_typed_data *typed_data = data;
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+ free(typed_data);
+}
+
+void ct_input_update_ringtone(contacts_record_h record_contact, Evas_Object *ly_content)
+{
+ const char *display;
+ char *temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_record_get_str_p(record_contact, _contacts_contact.ringtone_path, &temp);
+ p_retm_if(CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ display = ct_detail_get_ringtone_display_name((const char *)temp);
+
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+}
+
+void ct_input_update_vibration(contacts_record_h record_contact, Evas_Object *ly_content)
+{
+ const char *display;
+ char *temp;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_record_get_str_p(record_contact, _contacts_contact.vibration, &temp);
+ p_retm_if(CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ display = ct_detail_get_vibration_display_name((const char *)temp);
+
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+}
+
+unsigned int ct_input_box_idx_get(Evas_Object *box, Evas_Object *obj)
+{
+ int count = 0;
+ Eina_List *list, *cursor;
+ Evas_Object *data;
+ list = elm_box_children_get(box);
+
+ EINA_LIST_FOREACH(list, cursor, data) {
+ if (data == obj)
+ break;
+ count++;
+ }
+ eina_list_free(list);
+ return count;
+}
+
+void ct_input_update_group(void *data)
+{
+ Evas_Object *ly_content;
+ char display[PH_TEXT_MAX_LEN+1];
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == cinput_d->contact || NULL == cinput_d->ly_group, "parameter is NULL");
+
+ ct_detail_get_group_names(cinput_d->contact, display, sizeof(display));
+ ly_content = cinput_d->ly_group;
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+}
+
+void ct_input_save_button_update(ct_input_data *cinput_d)
+{
+ PH_FN_CALL;
+ Evas_Object *save_btn;
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ save_btn = elm_object_item_part_content_get(cinput_d->navi_item, "title_left_btn");
+ if (save_btn)
+ elm_object_disabled_set(save_btn, cinput_d->save_disable);
+
+ if (cinput_d->save_button)
+ elm_object_disabled_set(cinput_d->save_button, cinput_d->save_disable);
+}
+
+static inline Eina_Bool input_is_editfield_empty(Evas_Object *editfield)
+{
+ const char *val;
+ Evas_Object *entry;
+
+ p_retvm_if(NULL == editfield, EINA_TRUE, "parameter(editfield) is NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ p_retvm_if(NULL == entry, EINA_TRUE, "elm_object_part_content_get() return NULL");
+
+ val = elm_entry_entry_get(entry);
+ if (val && *val)
+ return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
+static bool __input_is_field_filled(Evas_Object *box, Eina_List *list, Evas_Object *first, Evas_Object *last, const char *part)
+{
+ int idx = 0;;
+ Evas_Object *ly_content = NULL;
+ Evas_Object *edit_field = NULL;
+
+ p_retvm_if(NULL == box, false, "parameter(box) is NULL");
+ p_retvm_if(NULL == list, false, "parameter(list) is NULL");
+ p_retvm_if(NULL == first, false, "parameter(first) is NULL");
+ p_retvm_if(NULL == last, false, "parameter(last) is NULL");
+
+ ly_content = first;
+ idx = ct_input_box_idx_get(box, ly_content);
+ while (ly_content) {
+ edit_field = elm_object_part_content_get(ly_content, part);
+ if (EINA_FALSE == input_is_editfield_empty(edit_field))
+ return true;
+
+ if (ly_content == last)
+ break;
+ ly_content = eina_list_nth(list, ++idx);
+ }
+ return false;
+
+}
+
+static void __input_mandatory_field_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ bool exist_valid_field = false;
+ Eina_List *list = NULL;
+ Evas_Object *edit_field = NULL;
+ ct_input_data *cinput_d = data;
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_middle_name, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_last_name, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_suffix, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_nickname, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_job_title, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_department, "elm.icon");
+ if (EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_basic_info_company, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ list = elm_box_children_get(cinput_d->box);
+ exist_valid_field = __input_is_field_filled(cinput_d->box, list, cinput_d->ly_number_first, cinput_d->ly_number_last, "elm.icon");
+ if (exist_valid_field) {
+ PH_DBG("valid field = number");
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ eina_list_free(list);
+ return;
+ }
+
+ exist_valid_field = __input_is_field_filled(cinput_d->box, list, cinput_d->ly_email_first, cinput_d->ly_email_last, "elm.icon");
+ if (exist_valid_field) {
+ PH_DBG("valid field = email");
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ eina_list_free(list);
+ return;
+ }
+
+ exist_valid_field = __input_is_field_filled(cinput_d->box, list, cinput_d->ly_addr_first, cinput_d->ly_addr_last, "elm.icon");
+ if (exist_valid_field) {
+ PH_DBG("valid field = address");
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ eina_list_free(list);
+ return;
+ }
+
+ exist_valid_field = __input_is_field_filled(cinput_d->box, list, cinput_d->ly_messenger_first, cinput_d->ly_messenger_last, "elm.icon");
+ if (exist_valid_field) {
+ PH_DBG("valid field = messenger");
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ eina_list_free(list);
+ return;
+ }
+
+ exist_valid_field = __input_is_field_filled(cinput_d->box, list, cinput_d->ly_url_first, cinput_d->ly_url_last, "elm.icon");
+ if (exist_valid_field) {
+ PH_DBG("valid field = url");
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ eina_list_free(list);
+ return;
+ }
+
+ exist_valid_field = __input_is_field_filled(cinput_d->box, list, cinput_d->ly_relationship_first, cinput_d->ly_relationship_last, "elm.icon");
+ if (exist_valid_field) {
+ PH_DBG("valid field = url");
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ eina_list_free(list);
+ return;
+ }
+
+ eina_list_free(list);
+
+ edit_field = elm_object_part_content_get(cinput_d->ly_note, "elm.icon");
+ if (edit_field && EINA_FALSE == input_is_editfield_empty(edit_field)) {
+ cinput_d->save_disable = EINA_FALSE;
+ ct_input_save_button_update(cinput_d);
+ return;
+ }
+
+ PH_DBG("cinput_d->save_disable=%d",cinput_d->save_disable);
+ if (EINA_TRUE == cinput_d->save_disable)
+ return;
+
+ cinput_d->save_disable = EINA_TRUE;
+ ct_input_save_button_update(cinput_d);
+}
+
+void ct_input_add_name_field(Evas_Object *editfield, ct_input_data *cinput_d)
+{
+ Evas_Object *entry;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == editfield, "parameter(editfield) is NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ p_retm_if(NULL == cinput_d, "elm_object_part_content_get() return NULL");
+
+ evas_object_smart_callback_add(entry, "changed", __input_mandatory_field_changed_cb, cinput_d);
+ evas_object_smart_callback_add(entry, "preedit,changed", __input_mandatory_field_changed_cb, cinput_d);
+}
+
+int ct_input_get_full_address(contacts_record_h record_postal, char *buf, int buf_len)
+{
+ char *code = NULL;
+ char *region = NULL;
+ char *locality = NULL;
+ char *street = NULL;
+ char *extended = NULL;
+ char *country = NULL;
+ char *pobox = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_record_get_str_p(record_postal, _contacts_address.postal_code, &code);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_postal, _contacts_address.extended, &extended);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_postal, _contacts_address.postbox, &pobox);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_postal, _contacts_address.street, &street);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_postal, _contacts_address.locality, &locality);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_postal, _contacts_address.region, &region);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ err = contacts_record_get_str_p(record_postal, _contacts_address.country, &country);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(buf, buf_len, "%s%s%s%s%s%s%s%s%s%s%s%s%s", SAFE_STR(code), STR_BLANK(code, extended), STR_BLANK(extended, pobox),
+ STR_BLANK(pobox, street), STR_BLANK(street, locality), STR_BLANK(locality, region), STR_BLANK(region, country));
+
+ return 0;
+}
+
+static contacts_record_h input_get_record(contacts_record_h record_contact, int property_id)
+{
+ 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, property_id, 0, &record);
+ p_retvm_if (CONTACTS_ERROR_NONE != err, NULL, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record(contacts_record_h contact, int property_id, const char *view_uri)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_record_create(view_uri, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(contact, property_id, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record_relationship(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_relationship_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.relationship, _contacts_relationship._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_relationship.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record_address(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_address_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.address, _contacts_address._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_address.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record_web(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_web_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.url, _contacts_url._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_url.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record_number(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_number_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.number, _contacts_number._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_number.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record_email(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_email_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.email, _contacts_email._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_email.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+
+contacts_record_h ct_input_new_record_messenger(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_messenger_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.messenger, _contacts_messenger._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_messenger.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_new_record_event(contacts_record_h contact)
+{
+ int type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ type = ct_input_next_event_type(contact);
+ PH_DBG("type=%d",type);
+
+ record = ct_input_new_record(contact, _contacts_contact.event, _contacts_event._uri);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ err = contacts_record_set_int(record, _contacts_event.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ return record;
+}
+
+contacts_record_h ct_input_get_record_nickname(contacts_record_h record_contact)
+{
+ PH_FN_CALL;
+ contacts_record_h record = NULL;
+ record = input_get_record(record_contact, _contacts_contact.nickname);
+ if (NULL == record)
+ record = ct_input_new_record(record_contact, _contacts_contact.nickname, _contacts_nickname._uri);
+ return record;
+}
+
+contacts_record_h ct_input_get_record_name(contacts_record_h record_contact)
+{
+ PH_FN_CALL;
+ contacts_record_h record = NULL;
+ record = input_get_record(record_contact, _contacts_contact.name);
+ if (NULL == record) {
+ record = ct_input_new_record(record_contact, _contacts_contact.name, _contacts_name._uri);
+ PH_DBG("record=%p", record);
+ }
+
+ return record;
+}
+
+contacts_record_h ct_input_get_record_company(contacts_record_h record_contact)
+{
+ PH_FN_CALL;
+ contacts_record_h record = NULL;
+ record = input_get_record(record_contact, _contacts_contact.company);
+ if (NULL == record)
+ record = ct_input_new_record(record_contact, _contacts_contact.company, _contacts_company._uri);
+ return record;
+}
+
+contacts_record_h ct_input_get_record_note(contacts_record_h record_contact)
+{
+ PH_FN_CALL;
+ contacts_record_h record = NULL;
+ record = input_get_record(record_contact, _contacts_contact.note);
+ if (NULL == record)
+ record = ct_input_new_record(record_contact, _contacts_contact.note, _contacts_note._uri);
+ return record;
+}
+
+static void input_remove_empty_field(contacts_record_h record_contact, int property_id, int property_id_str)
+{
+ int i;
+ unsigned int count;
+ char *str;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retm_if(NULL == record_contact, "parameter(record_contact) is NULL");
+
+ err = contacts_record_get_child_record_count(record_contact, property_id, &count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_count() Failed(%d)", err);
+
+ for (i=count-1;0<=i;i--) {
+ err = contacts_record_get_child_record_at_p(record_contact, property_id, i, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_child_record_at_p() Failed(%d)", err);
+ continue;
+ }
+
+ err = contacts_record_get_str(record, property_id_str, &str);
+ if (CONTACTS_ERROR_NONE != err || NULL == str || '\0' == *str) {
+ err = contacts_record_remove_child_record(record_contact, property_id, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+ free(str);
+ }
+}
+
+static void input_remove_empty_field_address(contacts_record_h record_contact)
+{
+ int i;
+ unsigned int count;
+ char str[PH_TEXT_MAX_LEN];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retm_if(NULL == record_contact, "parameter(record_contact) is NULL");
+
+ err = contacts_record_get_child_record_count(record_contact, _contacts_contact.address, &count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_count() Failed(%d)", err);
+
+ for (i=count-1;0<=i;i--) {
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.address, i, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_child_record_at_p() Failed(%d)", err);
+ continue;
+ }
+ str[0] = '\0';
+ ct_detail_get_full_addr(record, str, sizeof(str));
+
+ if ('\0' == *str) {
+ err = contacts_record_remove_child_record(record_contact, _contacts_contact.address, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+ }
+
+}
+
+void ct_input_remove_empty_fields(contacts_record_h record_contact)
+{
+ PH_FN_CALL;
+ p_retm_if(NULL == record_contact, "parameter(record_contact) is NULL");
+ input_remove_empty_field(record_contact, _contacts_contact.number, _contacts_number.number);
+ input_remove_empty_field(record_contact, _contacts_contact.email, _contacts_email.email);
+ input_remove_empty_field_address(record_contact);
+ input_remove_empty_field(record_contact, _contacts_contact.url, _contacts_url.url);
+ input_remove_empty_field(record_contact, _contacts_contact.messenger, _contacts_messenger.im_id);
+ input_remove_empty_field(record_contact, _contacts_contact.note, _contacts_note.note);
+ input_remove_empty_field(record_contact, _contacts_contact.relationship, _contacts_relationship.name);
+}
+
+
diff --git a/lib/details/ct-input-utils.h b/lib/details/ct-input-utils.h
new file mode 100755
index 0000000..1cc1771
--- /dev/null
+++ b/lib/details/ct-input-utils.h
@@ -0,0 +1,68 @@
+/*
+* 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_INPUT_UTILS_H__
+#define __CONTACTS_INPUT_UTILS_H__
+
+int ct_input_get_base_ab(void);
+void ct_input_camera(ct_input_data *cinput_d);
+void ct_input_gallery(ct_input_data *cinput_d);
+void ct_input_myfile_ringtone(void *data, Evas_Object *obj, void *event_info);
+void ct_input_myfile_vibration(void *data, Evas_Object *obj, void *event_info);
+void ct_input_save_cb(void *data, Evas_Object *obj, void *event_info);
+int ct_input_get_number_type(int ct_num_type);
+void ct_input_entry_changed_cb(void *data, Evas_Object *obj, void *event_info);
+Evas_Object* ct_input_add_editfield(Evas_Object *parent, const char* guide_txt, Evas_Smart_Cb unfocused_cb, void *unfocused_cb_data);
+int ct_input_next_number_type(contacts_record_h record_contact);
+int ct_input_next_email_type(contacts_record_h record_contact);
+int ct_input_next_address_type(contacts_record_h record_contact);
+int ct_input_next_web_type(contacts_record_h record_contact);
+int ct_input_next_messenger_type(contacts_record_h record_contact);
+int ct_input_next_relationship_type(contacts_record_h record_contact);
+int ct_input_next_event_type(contacts_record_h record_contact);
+void ct_input_custom_type_rename_cb(void *data, char *str);
+
+enum {
+ INPUT_LAYOUT_NONE,
+ INPUT_LAYOUT_RENAME,
+ INPUT_LAYOUT_EDIT,
+};
+Evas_Object* ct_input_create_dg_layout(Evas_Object *parent, const char *theme);
+void ct_input_typed_layout_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+void ct_input_update_ringtone(contacts_record_h record_contact, Evas_Object *layout);
+void ct_input_update_vibration(contacts_record_h record_contact, Evas_Object *layout);
+unsigned int ct_input_box_idx_get(Evas_Object *box, Evas_Object *obj);
+void ct_input_update_group(void *data);
+void ct_input_save_button_update(ct_input_data *cinput_d);
+void ct_input_add_name_field(Evas_Object *editfield, ct_input_data *cinput_d);
+int ct_input_get_full_address(contacts_record_h record_postal, char *buf, int buf_len);
+
+contacts_record_h ct_input_get_record_nickname(contacts_record_h record_contact);
+contacts_record_h ct_input_get_record_name(contacts_record_h record_contact);
+contacts_record_h ct_input_get_record_company(contacts_record_h record_contact);
+contacts_record_h ct_input_get_record_note(contacts_record_h record_contact);
+contacts_record_h ct_input_new_record(contacts_record_h contact, int property_id, const char *view_uri);
+contacts_record_h ct_input_new_record_address(contacts_record_h contact);
+contacts_record_h ct_input_new_record_web(contacts_record_h contact);
+contacts_record_h ct_input_new_record_event(contacts_record_h contact);
+contacts_record_h ct_input_new_record_number(contacts_record_h contact);
+contacts_record_h ct_input_new_record_email(contacts_record_h contact);
+contacts_record_h ct_input_new_record_messenger(contacts_record_h contact);
+contacts_record_h ct_input_new_record_relationship(contacts_record_h contact);
+void ct_input_remove_empty_fields(contacts_record_h record_contact);
+
+#endif //__CONTACTS_INPUT_UTILS_H__
diff --git a/lib/details/ct-input-view.c b/lib/details/ct-input-view.c
new file mode 100755
index 0000000..2e88641
--- /dev/null
+++ b/lib/details/ct-input-view.c
@@ -0,0 +1,3245 @@
+/*
+* 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 <errno.h>
+#include <Ecore_X.h>
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-detail-utils.h"
+#include "ct-detail-view.h"
+#include "ct-list.h"
+#include "ct-input-utils.h"
+#include "ct-input-view.h"
+
+#include "ct-input-num-email.h"
+#include "ct-input-change-name.h"
+#include "ct-group.h"
+#include "ct-group-assign-view.h"
+
+static void input_fill_layout(ct_input_data *cinput_d);
+static void input_update_address(ct_input_data *cinput_d);
+static Evas_Object* input_new_layout_address(ct_input_data *cinput_d);
+static Evas_Object* input_new_layout_website(ct_input_data *cinput_d);
+static Evas_Object* input_new_layout_messenger(ct_input_data *cinput_d);
+static Evas_Object* input_new_layout_relationship(ct_input_data *cinput_d);
+static Evas_Object* input_new_layout_event(ct_input_data *cinput_d);
+static void __input_basic_info_expand_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+
+enum input_items {
+ INPUT_IMAGE = 0,
+ INPUT_BASIC_INFO,
+ INPUT_NUMBER,
+ INPUT_EMAIL,
+ INPUT_ADDRESS,
+
+ INPUT_MESSENGER,
+ INPUT_URL,
+ INPUT_RELATIONSHIP,
+ INPUT_EVENT,
+ INPUT_NOTE,
+
+ INPUT_GROUP,
+ INPUT_RINGTONE,
+ INPUT_VIBRATION,
+ INPUT_ADDRBOOK,
+
+ INPUT_MORE_INFO,
+ INPUT_ITEMS_MAX,
+};
+
+enum input_more_fiels {
+ INPUT_MORE_JOB_TITLE,
+ INPUT_MORE_DEPARTMENT,
+ INPUT_MORE_MESSENGER,
+ INPUT_MORE_URL,
+ INPUT_MORE_RELATIONSHIP,
+ INPUT_MORE_EVENT,
+ INPUT_MORE_NOTE,
+};
+
+#define CT_INPUT_ADDRESS_MAX_CHAR 1000
+#define CT_INPUT_MOREINFO_PORTRAIT_Y 1066
+#define CT_INPUT_MOREINFO_LANDSCAPE_Y 506
+
+static Elm_Genlist_Item_Class input_ringtone_itc, input_vibration_itc;
+
+static void input_layout_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *layout = (Evas_Object *) data;
+ elm_object_signal_emit(layout, "elm,state,unselected", "elm");
+}
+
+static void input_layout_mouse_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Move *ev = (Evas_Event_Mouse_Move *)event_info;
+ Evas_Object *layout = (Evas_Object *) data;
+ if (ev && ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ elm_object_signal_emit(layout, "elm,state,unselected", "elm");
+}
+
+static void input_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *layout = (Evas_Object *) data;
+ elm_object_signal_emit(layout, "elm,state,selected", "elm");
+}
+
+static void input_layout_selectable_set(Evas_Object *layout)
+{
+ p_retm_if(NULL == layout, "parameter(layout) is NULL");
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_UP, input_layout_mouse_up_cb, layout);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_DOWN, input_layout_mouse_down_cb, layout);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_MOVE, input_layout_mouse_move_cb, layout);
+}
+
+static void input_contacts_changed(const char *view_uri, void *user_data)
+{
+ int contact_id;
+ int current_version;
+ int id_ab, type;
+ bool changed = false;
+
+ contacts_list_h list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ ct_input_data *cinput_d = user_data;
+ ct_detail_data *cdetail_d = cinput_d->cdetail_d;
+
+ p_retm_if(NULL == cdetail_d, "ct_detail_data is NULL");
+ p_retm_if(NULL == cinput_d->contact, "Contact is NULL");
+
+ if (cinput_d->saved)
+ return;
+
+ err = contacts_record_get_int(cinput_d->contact, _contacts_contact.address_book_id, &id_ab);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_db_get_changes_by_version(_contacts_contact_updated_info._uri, cinput_d->base_ab, cinput_d->view_create_ver, &list, &current_version);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_changes_by_version() Failed(%d)", err);
+
+ while (CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_int_from_list(list, _contacts_contact_updated_info.contact_id, &contact_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ err = contacts_list_next(list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ continue;
+ }
+
+ if (contact_id == cinput_d->contact_id) {
+ changed = true;
+ err = phone_cts_get_int_from_list(list, _contacts_contact_updated_info.type, &type);
+ break;
+ }
+ 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_destrot() Failed(%d)", err);
+
+ p_ret_if(!changed);
+
+ if (CONTACTS_CHANGE_UPDATED == type || (CONTACTS_CHANGE_DELETED == type && !cdetail_d->has_detail))
+ elm_naviframe_item_pop(cdetail_d->navi);
+}
+
+static void input_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d = data;
+ ct_detail_data *cdetail_d = cinput_d->cdetail_d;
+
+ p_retm_if(NULL == cinput_d, "cinput_d is NULL");
+ p_retm_if(NULL == cdetail_d, "cdetail_d is NULL");
+
+ if (cinput_d->contact_id) {
+ err = contacts_db_remove_changed_cb(_contacts_contact._uri, input_contacts_changed, cinput_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ }
+ if (cinput_d->win_prop_change)
+ ecore_event_handler_del(cinput_d->win_prop_change);
+ err = contacts_record_destroy(cinput_d->contact, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+
+ evas_object_data_del(cdetail_d->navi, KEY_INPUT_DATA);
+
+ if (cdetail_d->has_detail) {
+ cdetail_d->has_input = false;
+ }
+ else {
+ if (cdetail_d->child_ug)
+ ug_destroy(cdetail_d->child_ug);
+
+ if (cdetail_d->popup)
+ evas_object_del(cdetail_d->popup);
+
+ free(cdetail_d->base_ab_name);
+ free(cdetail_d);
+ }
+
+ if (cinput_d->crop_ug)
+ ug_destroy(cinput_d->crop_ug);
+
+ if (cinput_d->src_ug)
+ ug_destroy(cinput_d->src_ug);
+
+ free(cinput_d->name_old);
+ free(cinput_d->base_ab_name);
+ free(cinput_d);
+}
+
+static void input_nick_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *input;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ ct_input_data *cinput_d = data;
+
+ record = ct_input_get_record_nickname(cinput_d->contact);
+ p_retm_if(NULL == record, "ct_input_get_record_nickname() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+
+ err = contacts_record_set_str(record, _contacts_nickname.name, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(input);
+}
+
+static void input_website_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *input;
+ ct_input_data *cinput_d;
+ Evas_Object *entry = obj;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retm_if(NULL == record, "parameter(record) is NULL");
+
+ cinput_d = evas_object_data_get(obj, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == input, "ctui_entry_markup_to_utf8() return NULL");
+
+ err = contacts_record_set_str(record, _contacts_url.url, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(input);
+}
+
+static void input_note_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *input;
+ ct_input_data *cinput_d;
+ Evas_Object *entry = obj;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = data;
+
+ p_retm_if(NULL == record, "parameter(record) is NULL");
+
+ cinput_d = evas_object_data_get(obj, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == input, "ctui_entry_markup_to_utf8() return NULL");
+
+ err = contacts_record_set_str(record, _contacts_note.note, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(input);
+}
+
+static inline char* input_get_contact_image_path(contacts_record_h record)
+{
+ contacts_record_h record_image;
+ char *img_path = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ record_image = ctui_get_record_image(record);
+ err = contacts_record_get_str_p(record_image, _contacts_image.path, &img_path);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_record_get_str_p() failed(%d)", err);
+
+ return img_path;
+}
+
+static void input_set_name_value(Evas_Object *entry, int field, ct_input_data *cinput_d)
+{
+ char *name;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ record = ct_input_get_record_name(cinput_d->contact);
+ p_retm_if(NULL == record, "ct_input_get_record_name() return NULL");
+
+ name = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == name, "ctui_entry_markup_to_utf8() return NULL");
+
+ err = contacts_record_set_str(record, field, name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(name);
+}
+
+static void __input_firstname_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_name_value(obj, _contacts_name.first, data);
+}
+
+static void input_lastname_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_name_value(obj, _contacts_name.last, data);
+}
+
+static void input_middle_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_name_value(obj, _contacts_name.addition, data);
+}
+
+static void input_suffix_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_name_value(obj, _contacts_name.suffix, data);
+}
+
+static void input_set_company_value(Evas_Object *entry, int field, ct_input_data *cinput_d)
+{
+ char *str;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ record = ct_input_get_record_company(cinput_d->contact);
+ p_retm_if(NULL == record, "ct_input_get_record_company() return NULL");
+
+ str = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == str, "ctui_entry_markup_to_utf8() return NULL");
+
+ err = contacts_record_set_str(record, field, str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() failed(%d)", err);
+
+ free(str);
+}
+
+static void input_job_title_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_company_value(obj, _contacts_company.job_title, data);
+}
+
+static void input_department_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_company_value(obj, _contacts_company.department, data);
+}
+
+static void input_company_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ input_set_company_value(obj, _contacts_company.name, data);
+}
+
+static inline Evas_Object* __input_editfield_entry_set(Evas_Object *ef, const char *text)
+{
+ Evas_Object *en = elm_object_part_content_get(ef, "elm.swallow.content");
+ p_retvm_if(NULL == en, NULL, "elm_object_part_content_get() return NULL");
+
+ if (text && *text)
+ elm_entry_entry_set(en, text);
+ return en;
+}
+
+static Evas_Object* __input_fill_layout_basic_info_expand(ct_input_data *cinput_d, const char* guide_text,
+ Evas_Smart_Cb unfocused_cb, const char* view_uri, int property_id)
+{
+ char *display = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ Evas_Object *ly_content = NULL;
+ Evas_Object *editfield = NULL;
+ Evas_Object *box = cinput_d->box;
+
+ ly_content = ct_input_create_dg_layout(box, "1icon");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ elm_object_signal_emit(ly_content, "elm,state,edit,enabled", "");
+
+ editfield = ct_input_add_editfield(ly_content, guide_text, unfocused_cb, cinput_d);
+ ct_input_add_name_field(editfield, cinput_d);
+ p_retvm_if(NULL == editfield, NULL, "ct_input_add_editfield() return NULL");
+ elm_object_part_content_set(ly_content, "elm.icon", editfield);
+
+ if (0 == strcmp(_contacts_nickname._uri,view_uri))
+ record = ct_input_get_record_nickname(cinput_d->contact);
+ else if (0 == strcmp(_contacts_name._uri,view_uri))
+ record = ct_input_get_record_name(cinput_d->contact);
+ else if (0 == strcmp(_contacts_company._uri,view_uri))
+ record = ct_input_get_record_company(cinput_d->contact);
+
+ p_retvm_if(NULL == record, NULL, "record is NULL");
+
+ err = contacts_record_get_str_p(record, property_id, &display);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ __input_editfield_entry_set(editfield, display);
+
+ return ly_content;
+}
+
+static void input_event_del(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ int idx;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *list = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.event, typed_data->record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() failed(%d)", err);
+
+ if (typed_data->ly_content == cinput_d->ly_event_first) {
+ idx = ct_input_box_idx_get(cinput_d->box, typed_data->ly_content);
+ list = elm_box_children_get(cinput_d->box);
+ cinput_d->ly_event_first = eina_list_nth(list, idx + 1);
+ eina_list_free(list);
+ }
+
+ err = contacts_record_destroy(typed_data->record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ elm_box_unpack(cinput_d->box, typed_data->ly_content);
+ evas_object_del(typed_data->ly_content);
+}
+
+
+static void input_event_del_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input_event_del(cinput_d, typed_data);
+}
+
+
+static void input_event_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int year;
+ int month;
+ int day;
+ struct tm currtime;
+ ct_input_data *cinput_d = data;
+ Evas_Object *btn_minus;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ elm_datetime_value_get(obj, &currtime);
+ year = currtime.tm_year + 1900;
+ month = currtime.tm_mon + 1;
+ day = currtime.tm_mday;
+
+ err = contacts_record_set_int(typed_data->record, _contacts_event.date, year * 10000 + month * 100 + day);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ if (typed_data->ly_content == cinput_d->ly_event_last) {
+ btn_minus = elm_button_add(typed_data->ly_content);
+ p_retm_if(NULL == btn_minus, "elm_button_add() return NULL");
+
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(typed_data->ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_event_del_clicked_cb, cinput_d);
+
+ p_retm_if(NULL == input_new_layout_event(cinput_d), "input_new_layout_event() return NULL");
+ }
+}
+
+static void input_ringtone_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d = data;
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ if (cinput_d->popup) {
+ evas_object_del(cinput_d->popup);
+ cinput_d->popup = NULL;
+ }
+
+ err = contacts_record_set_str(cinput_d->contact, _contacts_contact.ringtone_path, NULL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ ct_input_update_ringtone(cinput_d->contact, cinput_d->ly_ringtone);
+}
+
+static void input_addr_editfield_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ char *display;
+ Evas_Object *entry = obj;
+ contacts_record_h record = data;
+
+ p_retm_if(NULL == record, "parameter(record) is NULL");
+
+ display = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == display, "ctui_entry_markup_to_utf8() return NULL");
+
+ ret = contacts_record_set_str(record, _contacts_address.street, display);
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_record_set_str() Failed(%d)", ret);
+
+ free(display);
+}
+
+static void input_addr_type_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type = (int)data;
+ Evas_Object *btn_type;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data;
+
+ cinput_d = evas_object_data_get(obj, "cinput_d");
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (CONTACTS_ADDRESS_TYPE_CUSTOM == type){
+ ct_input_change_name_view(cinput_d->cdetail_d->navi, ct_input_custom_type_rename_cb, typed_data);
+ evas_object_del(obj);
+ return;
+ }
+
+ err = contacts_record_set_int(typed_data->record, _contacts_address.type, type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_object_part_content_get(typed_data->ly_content, "elm.icon.type");
+ p_retm_if(NULL == btn_type, "elm_object_part_content_get() return NULL");
+
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(type)));
+ evas_object_del(obj);
+}
+
+static void input_address_type_mouse_up_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int type;
+ int used;
+ int rotate;
+ Evas_Object *popup;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data = data;
+
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ cinput_d = evas_object_data_get(obj, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ popup = elm_ctxpopup_add(cinput_d->cdetail_d->win);
+ p_retm_if(NULL == popup, "elm_ctxpopup_add() return NULL");
+ cinput_d->cdetail_d->popup = popup;
+
+ rotate = (int)evas_object_data_get(cinput_d->cdetail_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(popup, "dismissed", ct_detail_popup_hide_cb, cinput_d->cdetail_d);
+
+ err = contacts_record_get_int(typed_data->record, _contacts_address.type, &type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ evas_object_data_set(popup, "typed_data", typed_data);
+ evas_object_data_set(popup, "cinput_d", cinput_d);
+
+ int temp_type = CONTACTS_ADDRESS_TYPE_HOME;
+ while(temp_type<=CONTACTS_ADDRESS_TYPE_WORK) {
+ if (type == temp_type) {
+ temp_type = temp_type<<1;
+ continue;
+ }
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(temp_type)), NULL,
+ input_addr_type_changed_cb, (void *)temp_type);
+ temp_type = temp_type<<1;
+ }
+ if (CONTACTS_ADDRESS_TYPE_OTHER != type) {
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(CONTACTS_ADDRESS_TYPE_OTHER)), NULL,
+ input_addr_type_changed_cb, (void *)CONTACTS_ADDRESS_TYPE_OTHER);
+ }
+ if (CONTACTS_ADDRESS_TYPE_CUSTOM != type) {
+ elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(CONTACTS_ADDRESS_TYPE_CUSTOM)), NULL,
+ input_addr_type_changed_cb, (void *)CONTACTS_ADDRESS_TYPE_CUSTOM);
+ }
+
+ phone_move_ctxpopup(popup, obj);
+ evas_object_show(popup);
+}
+
+
+static void input_addr_del_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int idx;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *layout;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.address, typed_data->record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ if (typed_data->ly_content == cinput_d->ly_addr_first) {
+ Eina_List *list;
+ idx = ct_input_box_idx_get(cinput_d->box, cinput_d->ly_addr_first);
+ list = elm_box_children_get(cinput_d->box);
+ layout = eina_list_nth(list, idx + 1);
+ eina_list_free(list);
+ cinput_d->ly_addr_first = layout;
+ }
+
+ err = contacts_record_destroy(typed_data->record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ elm_box_unpack(cinput_d->box, typed_data->ly_content);
+ evas_object_del(typed_data->ly_content);
+
+}
+
+static void input_addr_add_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *layout;
+ ct_input_data *cinput_d = data;
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ layout = input_new_layout_address(data);
+ p_retm_if(NULL == layout, "input_new_layout_address() return");
+
+ input_update_address(data);
+}
+
+static void input_update_address(ct_input_data *cinput_d)
+{
+ int idx;
+ Eina_List *list, *cursor;
+ Evas_Object *btn;
+ Evas_Object *ly_content;
+ ct_input_typed_data *typed_data;
+
+ idx = ct_input_box_idx_get(cinput_d->box, cinput_d->ly_addr_first);
+ list = elm_box_children_get(cinput_d->box);
+ EINA_LIST_FOREACH(eina_list_nth_list(list, idx), cursor, ly_content) {
+ if (NULL == ly_content) continue;
+ btn = elm_object_part_content_get(ly_content, "elm.icon.edit");
+ if (NULL == btn) {
+ ERR("elm_object_part_content_get() return NULL");
+ break;
+ }
+
+ evas_object_smart_callback_del(btn, "clicked", input_addr_add_clicked_cb);
+
+ if (ly_content == cinput_d->ly_addr_last) {
+ elm_object_style_set(btn, "icon_plus");
+ evas_object_smart_callback_add(btn, "clicked", input_addr_add_clicked_cb, cinput_d);
+ break;
+ }
+ else {
+ typed_data = evas_object_data_get(ly_content, "typed_data");
+ if (NULL == typed_data) {
+ ERR("evas_object_data_get() return NULL");
+ break;
+ }
+ elm_object_style_set(btn, "icon_minus");
+ if (EINA_TRUE == elm_object_disabled_get(btn))
+ elm_object_disabled_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "clicked", input_addr_del_clicked_cb, cinput_d);
+ }
+ }
+ eina_list_free(list);
+}
+
+static void __input_image_delete_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_record_h record;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ record = ctui_get_record_image(cinput_d->contact);
+ p_retm_if(NULL == record, "ctui_get_record_image() return NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.image, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ ct_input_update_image(cinput_d);
+
+ evas_object_del(cinput_d->cdetail_d->popup);
+ cinput_d->cdetail_d->popup = NULL;
+}
+
+
+
+static void __input_gallery_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ const char *img_path = NULL;
+ service_h service;
+ ct_input_data *cinput_d = data;
+
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ int x, y, w, h;
+
+ if(ev == NULL)
+ return;
+
+ img_path = input_get_contact_image_path(cinput_d->contact);
+ if (NULL != img_path) {
+ elm_icon_file_set(obj, img_path, 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;
+
+ ct_input_gallery(cinput_d);
+}
+
+static void __input_gallery_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ const char *img_path = NULL;
+
+ img_path = input_get_contact_image_path(cinput_d->contact);
+ if (NULL != img_path) {
+ elm_icon_file_set(obj, img_path, NULL);
+ }
+ else
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_GALLERY_PRESSED, NULL);
+}
+
+static void __input_camera_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ int x, y, w, h;
+ service_h service;
+ if(ev == 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;
+
+ ct_input_camera(cinput_d);
+
+}
+static void __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);
+}
+
+
+void ct_input_update_image(ct_input_data *cinput_d)
+{
+ const char *img_path = NULL;
+ Evas_Object *icon = NULL;
+ Evas_Object *btn_minus = NULL;
+ Evas_Object *ly_content = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ ly_content = cinput_d->ly_image;
+ p_retm_if(NULL == ly_content, "parameter(ly_content) is NULL");
+
+ icon = elm_object_part_content_unset(ly_content, "elm.icon");
+ if (NULL != icon)
+ evas_object_del(icon);
+
+ icon = elm_icon_add(ly_content);
+ p_retm_if(NULL == icon, "elm_icon_add() return NULL");
+ elm_object_part_content_set(ly_content, "elm.icon", icon);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_DOWN, __input_gallery_mouse_down, cinput_d);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP, __input_gallery_mouse_up, cinput_d);
+
+
+ img_path = input_get_contact_image_path(cinput_d->contact);
+ if (NULL != img_path) {
+ elm_icon_file_set(icon, img_path, NULL);
+
+ btn_minus = elm_object_part_content_get(ly_content, "elm.icon4");
+ if (NULL == btn_minus) {
+ btn_minus = elm_button_add(ly_content);
+ elm_object_part_content_set(ly_content, "elm.icon4", btn_minus);
+ elm_object_style_set(btn_minus, "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", __input_image_delete_button_clicked_cb, cinput_d);
+ }
+ }
+ else {
+ elm_icon_file_set(icon, CTUI_IMG_INPUT_GALLERY, NULL);
+ elm_icon_resizable_set(icon, EINA_FALSE, EINA_FALSE);
+
+ btn_minus = elm_object_part_content_unset(ly_content, "elm.icon4");
+ if (NULL != btn_minus)
+ evas_object_del(btn_minus);
+ }
+}
+
+static Evas_Object* __input_fill_layout_image(ct_input_data *cinput_d)
+{
+ Evas_Object *ly_content = NULL;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *btn_camera = NULL;
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+ elm_layout_file_set(ly_content, IMAGE_LAYOUT_EDJ, "dialogue/image_layout");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ly_content);
+
+ btn_camera = elm_icon_add(ly_content);
+ p_retvm_if(NULL == btn_camera, NULL, "elm_button_add() return NULL");
+ elm_icon_file_set(btn_camera, CTUI_IMG_INPUT_CAMERA, NULL);
+ evas_object_size_hint_aspect_set(btn_camera, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(btn_camera, 0.5, EVAS_HINT_FILL);
+ evas_object_propagate_events_set(btn_camera, EINA_FALSE);
+ evas_object_color_set(btn_camera, 255, 255, 255, 255);
+ elm_object_part_content_set(ly_content, "elm.icon3", btn_camera);
+
+ evas_object_event_callback_add(btn_camera, EVAS_CALLBACK_MOUSE_DOWN, __input_camera_mouse_down, cinput_d);
+ evas_object_event_callback_add(btn_camera, EVAS_CALLBACK_MOUSE_UP, __input_camera_mouse_up, cinput_d);
+
+ cinput_d->ly_image = ly_content;
+ ct_input_update_image(cinput_d);
+
+ return ly_content;
+}
+
+static void __input_basic_info_name_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ char *last_name = NULL;
+ char *first_name = NULL;
+ char *name = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ name = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ p_retm_if(NULL == name, "ctui_entry_markup_to_utf8() return NULL");
+
+ if (name && cinput_d->name_old && 0 == strcmp(name, cinput_d->name_old))
+ return;
+
+ record = ct_input_get_record_name(cinput_d->contact);
+ p_retm_if(NULL == record, "ct_input_get_record_name() return NULL");
+
+ first_name = strtok_r(name, " ", &last_name);
+
+ err = contacts_record_set_str(record, _contacts_name.first, first_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_name.last, last_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(name);
+}
+
+
+static void __input_basic_info_name_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ char *name = NULL;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ name = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ p_retm_if(NULL == name, "ctui_entry_markup_to_utf8() return NULL");
+
+ FREEandSTRDUP(cinput_d->name_old, name);
+
+ free(name);
+}
+
+static void __input_basic_info_get_name_str(contacts_record_h record_name, char *buf, int buf_size)
+{
+ char *first_name = NULL;
+ char *last_name = NULL;
+
+ p_retm_if(NULL == record_name, "parameter(record_name) is NULL");
+ contacts_record_get_str_p(record_name, _contacts_name.first, &first_name);
+ contacts_record_get_str_p(record_name, _contacts_name.last, &last_name);
+
+ if (first_name && last_name)
+ snprintf(buf, buf_size, "%s %s", first_name, last_name);
+ else if (first_name)
+ snprintf(buf, buf_size, "%s", first_name);
+ else if (last_name)
+ snprintf(buf, buf_size, "%s", last_name);
+}
+
+static void __input_basic_info_update(ct_input_data *cinput_d)
+{
+ char *name = NULL;
+ char buf[PH_TEXT_MAX_LEN+1] = {0};
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_name = NULL;
+ Evas_Object *editfield = NULL;
+ Evas_Object *entry = NULL;
+ Evas_Object *ly_content = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ ly_content = cinput_d->ly_basic_info;
+ record_name = ct_input_get_record_name(cinput_d->contact);
+
+ if (!cinput_d->ly_basic_info_middle_name) { // contracted
+ editfield = ct_input_add_editfield(ly_content, S_(CT_SYS_BODY_NAME), __input_basic_info_name_unfocused_cb, cinput_d);
+ p_retm_if(NULL == editfield, "ct_input_add_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ evas_object_smart_callback_add(entry, "focused", __input_basic_info_name_focused_cb, cinput_d);
+ elm_entry_input_panel_imdata_set(entry, (void*)"type=name", 9);
+ elm_object_part_content_set(ly_content, "elm.icon", editfield);
+
+ __input_basic_info_get_name_str(record_name, buf, sizeof(buf));
+ if (*buf)
+ __input_editfield_entry_set(editfield, buf);
+ }
+ else { // expanded
+ /* first name */
+ editfield = ct_input_add_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_FIRSTNAME), __input_firstname_unfocused_cb, cinput_d);
+ p_retm_if(NULL == editfield, "ct_input_add_editfield() return NULL");
+
+ elm_object_part_content_set(ly_content, "elm.icon", editfield);
+
+ err = contacts_record_get_str_p(record_name, _contacts_name.first, &name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ __input_editfield_entry_set(editfield, name);
+ }
+}
+
+static void __input_basic_info_expand(ct_input_data *cinput_d)
+{
+ Evas_Object *layout;
+
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_MIDDLE),
+ input_middle_unfocused_cb, _contacts_name._uri, _contacts_name.addition);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info);
+ cinput_d->ly_basic_info_middle_name = layout;
+
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_LASTNAME),
+ input_lastname_unfocused_cb, _contacts_name._uri, _contacts_name.last);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_middle_name);
+ cinput_d->ly_basic_info_last_name = layout;
+
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_SUFFIX),
+ input_suffix_unfocused_cb, _contacts_name._uri, _contacts_name.suffix);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_last_name);
+ cinput_d->ly_basic_info_suffix = layout;
+
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_NICKNAME),
+ input_nick_unfocused_cb, _contacts_nickname._uri, _contacts_nickname.name);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_suffix);
+ cinput_d->ly_basic_info_nickname = layout;
+
+ if (cinput_d->add_job_title) {
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_JOB_TITLE),
+ input_job_title_unfocused_cb, _contacts_company._uri, _contacts_company.job_title);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_nickname);
+ cinput_d->ly_basic_info_job_title = layout;
+ }
+
+ if (cinput_d->add_department) {
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_DEPARTMENT),
+ input_department_unfocused_cb, _contacts_company._uri, _contacts_company.department);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ if (cinput_d->ly_basic_info_job_title)
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_job_title);
+ else
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_nickname);
+ cinput_d->ly_basic_info_department = layout;
+ }
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_COMPANY),
+ input_company_unfocused_cb, _contacts_company._uri, _contacts_company.name);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+
+ if (cinput_d->ly_basic_info_department)
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_department);
+ else if (cinput_d->ly_basic_info_job_title)
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_job_title);
+ else
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_nickname);
+ cinput_d->ly_basic_info_company = layout;
+}
+
+static inline void __input_basic_info_contract(ct_input_data *cinput_d)
+{
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_middle_name);
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_last_name);
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_suffix);
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_nickname);
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_company);
+
+ evas_object_del(cinput_d->ly_basic_info_middle_name);
+ evas_object_del(cinput_d->ly_basic_info_last_name);
+ evas_object_del(cinput_d->ly_basic_info_suffix);
+ evas_object_del(cinput_d->ly_basic_info_nickname);
+ evas_object_del(cinput_d->ly_basic_info_company);
+
+ cinput_d->ly_basic_info_middle_name = NULL;
+ cinput_d->ly_basic_info_last_name = NULL;
+ cinput_d->ly_basic_info_suffix = NULL;
+ cinput_d->ly_basic_info_nickname = NULL;
+ cinput_d->ly_basic_info_company = NULL;
+
+ if (cinput_d->ly_basic_info_job_title) {
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_job_title);
+ evas_object_del(cinput_d->ly_basic_info_job_title);
+ cinput_d->ly_basic_info_job_title = NULL;
+ }
+
+ if (cinput_d->ly_basic_info_department) {
+ elm_box_unpack(cinput_d->box, cinput_d->ly_basic_info_department);
+ evas_object_del(cinput_d->ly_basic_info_department);
+ cinput_d->ly_basic_info_department = NULL;
+ }
+}
+
+static void __input_basic_info_expand_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ Evas_Object *btn_expand = NULL;
+ Evas_Object *ly_content = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ ly_content = cinput_d->ly_basic_info;
+ p_retm_if(NULL == ly_content, "parameter(ly_content) is NULL");
+
+ btn_expand = elm_object_part_content_get(ly_content, "elm.icon.edit");
+ p_retm_if(NULL == btn_expand, "elm_object_part_content_get() return NULL");
+
+ if (cinput_d->ly_basic_info_last_name) {
+ __input_basic_info_contract(cinput_d);
+ elm_object_style_set(btn_expand, "icon_expand_closed");
+ }
+ else {
+ __input_basic_info_expand(cinput_d);
+ elm_object_style_set(btn_expand, "icon_expand_opened");
+ }
+ __input_basic_info_update(cinput_d);
+}
+
+
+static Evas_Object* __input_fill_layout_basic_info(ct_input_data *cinput_d)
+{
+ char buf[PH_TEXT_MAX_LEN + 1] = {0, };
+ Evas_Object *ly_content = NULL;
+ Evas_Object *entry = NULL;
+ Evas_Object *editfield_name = NULL;
+ Evas_Object *btn_expand = NULL;
+ Evas_Object *box = cinput_d->box;
+ contacts_record_h record_name = NULL;
+
+ ly_content = ct_input_create_dg_layout(box, "1icon");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ elm_object_signal_emit(ly_content, "elm,state,edit,enabled", "");
+
+ editfield_name = ct_input_add_editfield(ly_content, S_(CT_SYS_BODY_NAME), __input_basic_info_name_unfocused_cb, cinput_d);
+ ct_input_add_name_field(editfield_name, cinput_d);
+ entry = elm_object_part_content_get(editfield_name, "elm.swallow.content");
+ evas_object_smart_callback_add(entry, "focused", __input_basic_info_name_focused_cb, cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon", editfield_name);
+ record_name = ct_input_get_record_name(cinput_d->contact);
+ elm_entry_input_panel_imdata_set(entry, (void*)"type=name", 9);
+ __input_basic_info_get_name_str(record_name, buf, sizeof(buf));
+ if (*buf)
+ __input_editfield_entry_set(editfield_name, buf);
+
+ btn_expand = elm_button_add(ly_content);
+ p_retvm_if(NULL == btn_expand, NULL, "elm_button_add() return NULL");
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_expand);
+ elm_object_style_set(btn_expand, "icon_expand_closed");
+ evas_object_smart_callback_add(btn_expand, "clicked", __input_basic_info_expand_clicked_cb, cinput_d);
+
+ cinput_d->ly_basic_info = ly_content;
+ return ly_content;
+}
+
+Evas_Object* ct_input_fill_layout_separator(ct_input_data *cinput_d, const char *theme)
+{
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *layout;
+
+ layout = elm_layout_add(box);
+ elm_layout_theme_set(layout, "layout", "dialogue", theme);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 0.0);
+ evas_object_show(layout);
+
+ return layout;
+}
+
+static void input_messenger_del(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ int idx;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *list = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.messenger, typed_data->record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ if (typed_data->ly_content == cinput_d->ly_messenger_first) {
+ idx = ct_input_box_idx_get(cinput_d->box, typed_data->ly_content);
+ list = elm_box_children_get(cinput_d->box);
+ cinput_d->ly_messenger_first = eina_list_nth(list, idx + 1);
+ eina_list_free(list);
+ }
+
+ err = contacts_record_destroy(typed_data->record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ elm_box_unpack(cinput_d->box, typed_data->ly_content);
+ evas_object_del(typed_data->ly_content);
+}
+
+static void input_messenger_del_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int count;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input_messenger_del(data, typed_data);
+
+}
+
+static void input_messenger_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ Evas_Object *btn_minus;
+ ct_input_typed_data *typed_data;
+ const char *tmp;
+
+ tmp = elm_entry_entry_get(obj);
+ p_retm_if(NULL == tmp || '\0' == tmp[0], "elm_entry_entry_get() return NULL");
+
+ evas_object_smart_callback_del(obj, "changed", input_messenger_changed_cb);
+ evas_object_smart_callback_del(obj, "preedit,changed", input_messenger_changed_cb);
+ p_retm_if(NULL == cinput_d, "parameter(ct_input_data) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (typed_data->ly_content == cinput_d->ly_messenger_last) {
+ btn_minus = elm_button_add(typed_data->ly_content);
+ p_retm_if(NULL == btn_minus, "elm_button_add() return NULL");
+
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(typed_data->ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_messenger_del_clicked_cb, cinput_d);
+
+
+ p_retm_if(NULL == input_new_layout_messenger(cinput_d), "input_new_layout_messenger() return NULL");
+ }
+}
+
+static void input_messenger_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *input;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *entry = obj;
+ ct_input_typed_data *typed_data;
+
+ typed_data = evas_object_data_get(entry, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == input, "ctui_entry_markup_to_utf8() return NULL");
+
+ err = contacts_record_set_str(typed_data->record, _contacts_messenger.im_id, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() failed(%d)", err);
+
+ free(input);
+}
+
+static Evas_Object* input_messenger_get_edit_rename(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ char *val_str;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *entry;
+ Evas_Object *editfield;
+ Evas_Object *ly_content = typed_data->ly_content;
+
+ editfield = ct_input_add_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_INSTANT_MESSENGER),
+ input_messenger_unfocused_cb, cinput_d);
+ p_retvm_if(NULL == editfield, NULL, "ct_input_add_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ typed_data->data = entry;
+
+ evas_object_data_set(entry, "typed_data", typed_data);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+
+ err = contacts_record_get_str(typed_data->record, _contacts_messenger.im_id, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() failed(%d)", err);
+
+ if (val_str && *val_str)
+ ctui_entry_entry_set(entry, val_str);
+ else {
+ evas_object_smart_callback_add(entry, "changed", input_messenger_changed_cb, cinput_d);
+ evas_object_smart_callback_add(entry, "preedit,changed", input_messenger_changed_cb, cinput_d);
+ }
+ return editfield;
+}
+
+static Evas_Object* input_fill_layout_messenger(ct_input_data *cinput_d, contacts_record_h record)
+{
+ int type_int;
+ char *val_str;
+ char* messenger_type_str;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *ly_content;
+ Evas_Object *ef;
+ Evas_Object *btn_minus;
+ Evas_Object *btn_type;
+ Evas_Object *box = cinput_d->box;
+ ct_input_typed_data *typed_data;
+
+ if (!cinput_d->ly_seperator_more) {
+ cinput_d->ly_seperator_more = ct_input_fill_layout_separator(cinput_d, "separator/hd33/with_line");
+ p_retvm_if(NULL == cinput_d->ly_seperator_more, EINA_FALSE, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_after(cinput_d->box, cinput_d->ly_seperator_more, cinput_d->ly_addr_last);
+ }
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ err = contacts_record_get_int(record, _contacts_messenger.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() failed(%d)", err);
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ if(CONTACTS_MESSENGER_TYPE_CUSTOM == type_int){
+ err = contacts_record_get_str_p(record, _contacts_messenger.label, &messenger_type_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() failed(%d)", err);
+
+ if (NULL == messenger_type_str || '\0' == messenger_type_str[0])
+ messenger_type_str = (char *)T_(CT_GET_TEXT_IM_TYPE, CONTACTS_MESSENGER_TYPE_OTHER);
+ }
+ else
+ messenger_type_str = (char *)T_(CT_GET_TEXT_IM_TYPE, type_int);
+ elm_object_text_set(btn_type, messenger_type_str);
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_BASIC, CTTEXT_CUSTOM));
+ evas_object_data_set(btn_type, KEY_INPUT_DATA, cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+ typed_data->record = record;
+ typed_data->ly_content = ly_content;
+ typed_data->view_uri = _contacts_messenger._uri;
+ evas_object_data_set(ly_content, "typed_data", typed_data);
+
+ err = contacts_record_get_str_p(record, _contacts_messenger.im_id, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() failed(%d)", err);
+
+ if (val_str && *val_str) {
+ btn_minus = elm_button_add(ly_content);
+ if (NULL == btn_minus) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_messenger_del_clicked_cb, cinput_d);
+ }
+
+ ef = input_messenger_get_edit_rename(cinput_d, typed_data);
+ if (NULL == ef) {
+ ERR("input_messenger_get_edit_rename() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ ct_input_add_name_field(ef, cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+
+ evas_object_smart_callback_add(btn_type, "clicked", ct_input_data_type_clicked_cb, typed_data);
+
+
+ if (cinput_d->ly_messenger_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_messenger_last);
+ else
+ elm_box_pack_after(box, ly_content, cinput_d->ly_seperator_more);
+
+ return ly_content;
+}
+
+static int input_fill_layout_messengers(ct_input_data *cinput_d)
+{
+ int i;
+ unsigned int count = 0;
+ Evas_Object *layout = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_record_get_child_record_count(cinput_d->contact, _contacts_contact.messenger, &count);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, 0, "contacts_record_get_child_record_count() Failed(%d)", err);
+
+ for (i=count-1;i>=0;i--) {
+ err = contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.messenger, i, &record);
+ if(err != CONTACTS_ERROR_NONE) {
+ ERR("contacts_record_get_child_record_at_p() Failed(%d)", err);
+ continue;
+ }
+
+ layout = input_fill_layout_messenger(cinput_d, record);
+ p_retvm_if(NULL == layout, count, "input_fill_layout_messenger() return NULL");
+
+ if (NULL == cinput_d->ly_messenger_first)
+ cinput_d->ly_messenger_first = layout;
+ cinput_d->ly_messenger_last = layout;
+ }
+
+ return count;
+}
+
+static Evas_Object* input_new_layout_messenger(ct_input_data *cinput_d)
+{
+ contacts_record_h record = NULL;
+ Evas_Object *layout;
+
+ record = ct_input_new_record_messenger(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ layout = input_fill_layout_messenger(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_messenger() return NULL");
+
+ if (NULL == cinput_d->ly_messenger_first)
+ cinput_d->ly_messenger_first = layout;
+ cinput_d->ly_messenger_last = layout;
+
+ return layout;
+}
+
+static void input_address_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ Evas_Object *btn_minus;
+ ct_input_typed_data *typed_data;
+ const char *tmp;
+
+ tmp = elm_entry_entry_get(obj);
+ p_retm_if(NULL == tmp || '\0' == tmp[0], "elm_entry_entry_get() return NULL");
+
+ evas_object_smart_callback_del(obj, "changed", input_address_changed_cb);
+ evas_object_smart_callback_del(obj, "preedit,changed", input_address_changed_cb);
+ p_retm_if(NULL == cinput_d, "parameter(ct_input_data) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (typed_data->ly_content == cinput_d->ly_addr_last) {
+ btn_minus = elm_button_add(typed_data->ly_content);
+ p_retm_if(NULL == btn_minus, "elm_button_add() return NULL");
+
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(typed_data->ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_addr_del_clicked_cb, cinput_d);
+ p_retm_if(NULL == input_new_layout_address(cinput_d), "input_new_layout_address() return NULL");
+ }
+}
+
+static Evas_Object* input_fill_layout_address(ct_input_data *cinput_d, contacts_record_h record)
+{
+ int type_int;
+ char *display;
+ Evas_Object *ly_content;
+ Evas_Object *ef, *en;
+ Evas_Object *btn;
+ Evas_Object *btn_type;
+ Evas_Object *box = cinput_d->box;
+ Elm_Entry_Filter_Limit_Size filter;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "elm_layout_add() return NULL");
+
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+ typed_data->ly_content = ly_content;
+ typed_data->record = record;
+ typed_data->view_uri = _contacts_address._uri;
+ evas_object_data_set(ly_content, "typed_data", typed_data);
+
+
+ char address[PH_TEXT_MAX_LEN] = {0, };
+
+ ef = ctui_create_editfield(ly_content, NULL, S_(CT_SYS_POP_ADDRESS), false);
+ p_retvm_if(NULL == ef, NULL, "ctui_create_editfield() return NULL");
+ ct_input_add_name_field(ef, cinput_d);
+
+ en = elm_object_part_content_get(ef, "elm.swallow.content");
+ filter.max_char_count = CT_INPUT_ADDRESS_MAX_CHAR;
+ elm_entry_input_panel_imdata_set(en, (void*)"type=post", 9);
+ elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &filter);
+ evas_object_smart_callback_add(en, "changed", ct_input_entry_changed_cb, ef);
+ evas_object_smart_callback_add(en, "unfocused", input_addr_editfield_unfocused_cb, record);
+
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+ evas_object_data_set(en, "typed_data", typed_data);
+
+ address[0] = '\0';
+ ct_input_get_full_address(record, address, sizeof(address));
+ en = __input_editfield_entry_set(ef, address);
+ if (*address) {
+ Evas_Object *btn_minus;
+ btn_minus = elm_button_add(ly_content);
+ if (NULL == btn_minus) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_addr_del_clicked_cb, cinput_d);
+ }
+ else {
+ evas_object_smart_callback_add(en, "changed", input_address_changed_cb, cinput_d);
+ evas_object_smart_callback_add(en, "preedit,changed", input_address_changed_cb, cinput_d);
+ }
+
+ /* type */
+ err = contacts_record_get_int(record, _contacts_address.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() failed(%d)", err);
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(type_int)));
+
+ evas_object_data_set(btn_type, KEY_INPUT_DATA, cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ evas_object_smart_callback_add(btn_type, "clicked", input_address_type_mouse_up_cb, typed_data);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+
+ if (cinput_d->ly_addr_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_addr_last);
+ else
+ elm_box_pack_end(box, ly_content);
+
+ return ly_content;
+}
+
+static Evas_Object* input_new_layout_address(ct_input_data *cinput_d)
+{
+ contacts_record_h record = NULL;
+ Evas_Object *layout;
+
+ record = ct_input_new_record_address(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record_address() return NULL");
+
+ layout = input_fill_layout_address(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_address() return NULL");
+
+ if (NULL == cinput_d->ly_addr_first)
+ cinput_d->ly_addr_first = layout;
+ cinput_d->ly_addr_last = layout;
+
+ return layout;
+}
+
+static void input_group_add_cb(int grp_id, void *data, bool changed)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ ct_input_data *cinput_d = data;
+
+ if (grp_id < CONTACTS_ERROR_NONE)
+ return;
+
+ err = contacts_record_create(_contacts_group_relation._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() failed(%d)", err);
+
+ err = contacts_record_set_int(record, _contacts_group_relation.group_id, grp_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() failed(%d)", err);
+
+ err = contacts_record_add_child_record(cinput_d->contact, _contacts_contact.group_relation, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() failed(%d)", err);
+
+ //err = contacts_group_add_contact(grp_id,info->contact_id);
+ //p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_group_add_contact() Failed(%d)", err);
+
+ ct_input_update_group(cinput_d);
+}
+
+
+
+static void input_group_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ unsigned int count = 0;
+ int x, y, w, h;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == ev, "ev 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)
+ return;
+ elm_object_focus_set(cinput_d->cdetail_d->navi, EINA_FALSE);
+
+ err = phone_cts_get_list(_contacts_group._uri, _contacts_group.address_book_id, cinput_d->base_ab, &list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() Failed(%d)", err);
+
+ err = contacts_list_get_count(list, &count);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+
+ if (count)
+ ct_grp_assign_create_view(cinput_d->cdetail_d->navi, cinput_d->contact, cinput_d->base_ab, ct_input_update_group, cinput_d);
+ else
+ ctui_create_group_input_view(cinput_d->cdetail_d->win, cinput_d->cdetail_d->navi, NULL, input_group_add_cb, cinput_d);
+}
+
+static char *input_popup_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (0 == strcmp(part, "elm.text"))
+ return strdup(data);
+ return NULL;
+}
+
+static void input_ringtone_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *popup;
+ Elm_Object_Item *item;
+ Evas_Object *genlist;
+ Evas_Object *btn;
+ Evas_Object *box;
+ char *temp;
+ int x, y, w, h;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ ct_input_data *cinput_d = data;
+
+ p_retm_if(NULL == ev, "ev 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)
+ return;
+ elm_object_focus_set(cinput_d->cdetail_d->navi, EINA_FALSE);
+
+ popup = elm_popup_add(cinput_d->cdetail_d->navi);
+ cinput_d->popup = popup;
+ elm_object_style_set(popup, "min_menustyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_RINGTONE));
+ evas_object_smart_callback_add(popup, "block,clicked", ctui_popup_hide_cb, NULL);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", ctui_popup_hide_cb, popup);
+
+ input_ringtone_itc.item_style = "1text";
+ input_ringtone_itc.func.text_get = input_popup_text_get;
+ input_ringtone_itc.func.content_get = NULL;
+ input_ringtone_itc.func.state_get = NULL;
+ input_ringtone_itc.func.del = NULL;
+
+ box = elm_box_add(popup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ genlist = elm_genlist_add(popup);
+ 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);
+ elm_genlist_item_append(genlist, &input_ringtone_itc, S_(CT_SYS_SK_SET), NULL, ELM_GENLIST_ITEM_NONE, ct_input_myfile_ringtone, data);
+
+ err = contacts_record_get_str_p(cinput_d->contact, _contacts_contact.ringtone_path, &temp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_contact_record_get_str_p() Failed(%d)", err);
+
+ if (temp && *temp)
+ elm_genlist_item_append(genlist, &input_ringtone_itc, S_(CT_SYS_SK_RESET), NULL, ELM_GENLIST_ITEM_NONE, input_ringtone_cancel_cb, data);
+ elm_box_pack_end(box, genlist);
+ evas_object_show(genlist);
+ evas_object_size_hint_min_set(box, 600, 200);
+ elm_object_content_set(popup, box);
+ evas_object_show(popup);
+}
+
+static void input_vibration_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d = data;
+ p_retm_if(NULL == cinput_d, "parameter(cdetail_d) is NULL");
+ p_retm_if(NULL == cinput_d->contact, "parameter(contact) is NULL");
+
+ if (cinput_d->popup) {
+ evas_object_del(cinput_d->popup);
+ cinput_d->popup = NULL;
+ }
+
+ err = contacts_record_set_str(cinput_d->contact, _contacts_contact.vibration, NULL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str(vibration) Failed(%d)", err);
+
+ ct_input_update_vibration(cinput_d->contact, cinput_d->ly_vibration);
+}
+
+static void input_vibration_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *btn;
+ Evas_Object *box;
+ char *temp;
+ int x, y, w, h;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ ct_input_data *cinput_d = data;
+
+ if (ev && 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;
+ elm_object_focus_set(cinput_d->cdetail_d->navi, EINA_FALSE);
+
+ popup = elm_popup_add(cinput_d->cdetail_d->navi);
+ cinput_d->popup = popup;
+ elm_object_style_set(popup, "min_menustyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_VIBRATION_PATTERN));
+ evas_object_smart_callback_add(popup, "block,clicked", ctui_popup_hide_cb, NULL);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", ctui_popup_hide_cb, popup);
+
+ input_vibration_itc.item_style = "1text";
+ input_vibration_itc.func.text_get = input_popup_text_get;
+ input_vibration_itc.func.content_get = NULL;
+ input_vibration_itc.func.state_get = NULL;
+ input_vibration_itc.func.del = NULL;
+
+ box = elm_box_add(popup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ genlist = elm_genlist_add(popup);
+ 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);
+ elm_genlist_item_append(genlist, &input_vibration_itc, S_(CT_SYS_SK_SET), NULL, ELM_GENLIST_ITEM_NONE, ct_input_myfile_vibration, data);
+
+ err = contacts_record_get_str_p(cinput_d->contact, _contacts_contact.vibration, &temp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_contact_record_get_str_p() Failed(%d)", err);
+
+ if (temp && *temp)
+ elm_genlist_item_append(genlist, &input_vibration_itc, S_(CT_SYS_SK_RESET), NULL, ELM_GENLIST_ITEM_NONE, input_vibration_cancel_cb, data);
+ elm_box_pack_end(box, genlist);
+ evas_object_show(genlist);
+ evas_object_size_hint_min_set(box, 600, 200);
+ elm_object_content_set(popup, box);
+ evas_object_show(popup);
+}
+
+static void input_del_group_info(ct_input_data *cinput_d)
+{
+ int i;
+ unsigned int count;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_record_get_child_record_count(cinput_d->contact, _contacts_contact.group_relation, &count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_count() Failed(%d)", err);
+
+ for (i=count-1;i>=0;i--) {
+ err = contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.group_relation, i, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_child_record_at_p() Failed(%d)", err);
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.group_relation, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+ }
+
+ if (cinput_d->ly_group)
+ ct_input_update_group(cinput_d);
+}
+
+static Evas_Object* input_fill_layout_group(ct_input_data *cinput_d)
+{
+ char display[PH_TEXT_SHORT_LEN];
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+
+ ly_content = ct_input_create_dg_layout(box, "2text.3");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+
+ cinput_d->ly_group = ly_content;
+ input_layout_selectable_set(ly_content);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_MOUSE_UP, input_group_mouse_up_cb, cinput_d);
+
+ elm_object_part_text_set(ly_content, "elm.text.1", T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP));
+
+ ct_detail_get_group_names(cinput_d->contact, display, sizeof(display));
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+
+ return ly_content;
+}
+
+static Evas_Object* input_fill_layout_ringtone(ct_input_data *cinput_d)
+{
+ char *temp;
+ const char *display;
+
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ ly_content = ct_input_create_dg_layout(box, "2text.3");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+
+ cinput_d->ly_ringtone = ly_content;
+ input_layout_selectable_set(ly_content);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_MOUSE_UP, input_ringtone_mouse_up_cb, cinput_d);
+
+ /* title */
+ elm_object_part_text_set(ly_content, "elm.text.1", T_(CT_GET_TEXT_BASIC, CTTEXT_RINGTONE));
+
+ /* file name */
+ err = contacts_record_get_str_p(cinput_d->contact, _contacts_contact.ringtone_path, &temp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_contact_record_get_str_p() Failed(%d)", err);
+
+ display = ct_detail_get_ringtone_display_name(temp);
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+
+ return ly_content;
+}
+
+static Evas_Object* input_fill_layout_vibration(ct_input_data *cinput_d)
+{
+ char *temp;
+ const char *display;
+
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ ly_content = ct_input_create_dg_layout(box, "2text.3");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+
+ cinput_d->ly_vibration = ly_content;
+ input_layout_selectable_set(ly_content);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_MOUSE_UP, input_vibration_mouse_up_cb, cinput_d);
+
+ /* title */
+ elm_object_part_text_set(ly_content, "elm.text.1", T_(CT_GET_TEXT_BASIC, CTTEXT_VIBRATION_PATTERN));
+
+ /* file name */
+ err = contacts_record_get_str_p(cinput_d->contact, _contacts_contact.vibration, &temp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_contact_record_get_str_p() Failed(%d)", err);
+
+ display = ct_detail_get_vibration_display_name(temp);
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+
+ return ly_content;
+}
+
+static inline void input_refresh_layout(ct_input_data *cinput_d)
+{
+ cinput_d->idx_append = 0;
+ elm_box_clear(cinput_d->box);
+
+ cinput_d->ly_basic_info = NULL;
+ cinput_d->ly_basic_info_last_name = NULL;
+ cinput_d->ly_basic_info_suffix = NULL;
+ cinput_d->ly_basic_info_nickname = NULL;
+ cinput_d->ly_basic_info_job_title = NULL;
+ cinput_d->ly_basic_info_department = NULL;
+ cinput_d->ly_basic_info_company = NULL;
+ cinput_d->ly_number_first = NULL;
+ cinput_d->ly_number_last = NULL;
+ cinput_d->ly_number_default = NULL;
+ cinput_d->ly_number_set_default_separator_before = NULL;
+ cinput_d->ly_number_set_default = NULL;
+ cinput_d->ly_number_set_default_separator_after = NULL;
+ cinput_d->ly_email_first = NULL;
+ cinput_d->ly_email_last = NULL;
+ cinput_d->ly_addr_first = NULL;
+ cinput_d->ly_addr_last = NULL;
+ cinput_d->ly_seperator_more = NULL;
+ cinput_d->ly_messenger_first = NULL;
+ cinput_d->ly_messenger_last = NULL;
+ cinput_d->ly_url_first = NULL;
+ cinput_d->ly_url_last = NULL;
+ cinput_d->ly_relationship_first = NULL;
+ cinput_d->ly_relationship_last = NULL;
+ cinput_d->ly_event_first = NULL;
+ cinput_d->ly_event_last = NULL;
+ cinput_d->ly_note = NULL;
+ cinput_d->ly_group = NULL;
+ cinput_d->ly_ringtone = NULL;
+ cinput_d->ly_address_book = NULL;
+ cinput_d->ly_moreinfo = NULL;
+
+ input_fill_layout(cinput_d);
+}
+
+static void input_addrbook_item_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ char temp[PH_TEXT_SHORT_LEN];
+ ct_input_data *cinput_d = data;
+ ct_ab_popup_data *ab_popup_data;
+ contacts_record_h record_clone = NULL;
+
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+
+ ab_popup_data = elm_object_item_data_get(event_info);
+ p_retm_if(NULL == ab_popup_data, "evas_object_data_get() return NULL");
+
+ if (cinput_d->base_ab != ab_popup_data->id)
+ input_del_group_info(cinput_d);
+
+ cinput_d->base_ab = ab_popup_data->id;
+ cinput_d->base_ab_mode = ab_popup_data->mode;
+
+ free(cinput_d->base_ab_name);
+ cinput_d->base_ab_name = NULL;
+
+ temp[0] = '\0';
+ ctui_get_addressbook_name(ab_popup_data->id, temp, sizeof(temp));
+ if (*temp)
+ cinput_d->base_ab_name = strdup(temp);
+
+
+
+ ct_input_remove_empty_fields(cinput_d->contact);
+ input_refresh_layout(cinput_d);
+ if (cinput_d->ly_address_book) {
+ elm_object_part_text_set(cinput_d->ly_address_book, "elm.text.2", cinput_d->base_ab_name);
+ }
+ ct_detail_popup_hide_cb(cinput_d->cdetail_d, NULL, NULL);
+}
+
+static void input_addrbook_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ int x, y, w, h;
+ Evas_Object *popup;
+ Evas_Object *btn;
+ ct_input_data *cinput_d = data;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+
+ p_retm_if(NULL == ev, "ev 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)
+ return;
+ elm_object_focus_set(cinput_d->cdetail_d->navi, EINA_FALSE);
+
+ popup = ctui_addrbook_popup(cinput_d->cdetail_d->win, input_addrbook_item_sel_cb, cinput_d, CT_AB_POPUP_TYPE_INPUT_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_CONTACT_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", ct_detail_popup_hide_cb, cinput_d->cdetail_d);
+
+ cinput_d->cdetail_d->popup = popup;
+}
+
+
+static Evas_Object* input_fill_layout_addrbook(ct_input_data *cinput_d)
+{
+ const char *display;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+
+ ly_content = ct_input_create_dg_layout(box, "2text.3");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+
+ cinput_d->ly_address_book = ly_content;
+ input_layout_selectable_set(ly_content);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_MOUSE_UP, input_addrbook_mouse_up_cb, cinput_d);
+
+ elm_object_part_text_set(ly_content, "elm.text.1", T_(CT_GET_TEXT_BASE_OP, CTTEXT_SAVE_CONTACT_TO));
+
+ if (0 == cinput_d->base_ab)
+ display = S_(CT_SYS_BODY_PHONE);
+ else if (cinput_d->base_ab_name)
+ display = cinput_d->base_ab_name;
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+
+ elm_object_part_text_set(ly_content, "elm.text.2", display);
+ return ly_content;
+}
+
+static void input_relationship_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *input;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data = data;
+
+ cinput_d = evas_object_data_get(obj, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ input = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ if (input && *input) {
+ err = contacts_record_set_str(typed_data->record, _contacts_relationship.name, input);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ }
+ free(input);
+}
+
+static void input_relationship_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_input_data *cinput_d = data;
+ const char *tmp;
+
+ tmp = elm_entry_entry_get(obj);
+ p_retm_if(NULL == tmp || '\0' == tmp[0], "elm_entry_entry_get() return NULL");
+
+ evas_object_smart_callback_del(obj, "changed", input_relationship_changed_cb);
+ evas_object_smart_callback_del(obj, "preedit,changed", input_relationship_changed_cb);
+ p_retm_if(NULL == cinput_d, "parameter(ct_input_data) is NULL");
+
+ p_retm_if(NULL == input_new_layout_relationship(cinput_d), "input_new_layout_relationship() return NULL");
+}
+
+static Evas_Object* input_relationship_get_edit_rename(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ char *val_str;
+ Evas_Object *entry;
+ Evas_Object *editfield;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *ly_content = typed_data->ly_content;
+
+ editfield = ct_input_add_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_RELATIONSHIP), input_relationship_unfocused_cb, typed_data);
+ p_retvm_if(NULL == editfield, NULL, "ct_input_add_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ typed_data->data = entry;
+
+ evas_object_data_set(entry, KEY_INPUT_DATA, cinput_d);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+
+ err = contacts_record_get_str_p(typed_data->record, _contacts_relationship.name, &val_str);
+ if (val_str && *val_str)
+ ctui_entry_entry_set(entry, val_str);
+ else {
+ evas_object_smart_callback_add(entry, "changed", input_relationship_changed_cb, cinput_d);
+ evas_object_smart_callback_add(entry, "preedit,changed", input_relationship_changed_cb, cinput_d);
+ }
+ return editfield;
+}
+
+static void input_relationship_select_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d;
+ ct_input_typed_data *typed_data = data;
+ ct_person_list *person_info;
+ Elm_Object_Item *item = event_info;
+
+ Evas_Object *editfield;
+ Evas_Object *entry;
+ Evas_Object *btn;
+
+ p_retm_if(!typed_data, "parameter(cinput_d) is NULL");
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() returns NULL");
+
+ editfield = elm_object_part_content_get(typed_data->ly_content, "elm.icon");
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+
+ if (entry && person_info->display && *person_info->display)
+ ctui_entry_entry_set(entry, person_info->display);
+
+ btn = elm_object_part_content_get(typed_data->ly_content, "elm.icon.edit");
+ cinput_d = evas_object_data_get(btn, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+ elm_naviframe_item_pop(cinput_d->cdetail_d->navi);
+}
+
+static void input_relationship_select_contact(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_typed_data *typed_data = data;
+ ct_input_data *cinput_d = evas_object_data_get(obj, KEY_INPUT_DATA);
+ ct_detail_create_list_view(cinput_d->cdetail_d, input_relationship_select_cb, typed_data, 0);
+}
+
+static Evas_Object* input_fill_layout_relationship(ct_input_data *cinput_d, contacts_record_h record)
+{
+ int type_int = 0;
+ char *type_str = NULL;
+ Evas_Object *ly_content;
+ Evas_Object *btn_type;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ef;
+ Evas_Object *btn;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ if (!cinput_d->ly_seperator_more) {
+ cinput_d->ly_seperator_more = ct_input_fill_layout_separator(cinput_d, "separator/hd33/with_line");
+ p_retvm_if(NULL == cinput_d->ly_seperator_more, EINA_FALSE, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_after(cinput_d->box, cinput_d->ly_seperator_more, cinput_d->ly_addr_last);
+ }
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ err = contacts_record_get_int(record, _contacts_relationship.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+
+ if (CONTACTS_RELATIONSHIP_TYPE_CUSTOM == type_int) {
+ err = contacts_record_get_str_p(record, _contacts_relationship.label, &type_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ }
+
+ if (NULL == type_str)
+ type_str = (char *)T_(CT_GET_TEXT_RELATIONSHIP_TYPE, type_int);
+
+ elm_object_text_set(btn_type, type_str);
+ evas_object_data_set(btn_type, KEY_INPUT_DATA, cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+ typed_data->record = record;
+ typed_data->ly_content = ly_content;
+ typed_data->view_uri = _contacts_relationship._uri;
+
+ evas_object_data_set(ly_content, "typed_data", typed_data);
+ ef = input_relationship_get_edit_rename(cinput_d, typed_data);
+ if (NULL == ef) {
+ ERR("input_website_get_edit_rename() return NULL");
+ evas_object_del(ly_content);
+ free(typed_data);
+ return NULL;
+ }
+ ct_input_add_name_field(ef, cinput_d);
+
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+ evas_object_smart_callback_add(btn_type, "clicked", ct_input_data_type_clicked_cb, typed_data);
+
+ btn = elm_button_add(ly_content);
+ if (NULL == btn) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn);
+ evas_object_data_set(btn, KEY_INPUT_DATA, cinput_d);
+ elm_object_style_set(btn, "icon_plus");
+ evas_object_smart_callback_add(btn, "clicked", input_relationship_select_contact, typed_data);
+
+ if (cinput_d->ly_relationship_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_relationship_last);
+ else if (cinput_d->ly_url_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_url_last);
+ else if (cinput_d->ly_messenger_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_messenger_last);
+ else
+ elm_box_pack_after(box, ly_content, cinput_d->ly_seperator_more);
+
+ if (NULL == cinput_d->ly_relationship_first)
+ cinput_d->ly_relationship_first = ly_content;
+ cinput_d->ly_relationship_last = ly_content;
+
+ return ly_content;
+}
+
+static int input_fill_layout_relationship_list(ct_input_data *cinput_d)
+{
+ int count = 0;
+ Evas_Object *ly;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.relationship, count++, &record)) {
+ ly = input_fill_layout_relationship(cinput_d, record);
+ p_retvm_if(NULL == ly, count-1, "input_fill_layout_relationship() return NULL");
+
+ if (NULL == cinput_d->ly_relationship_first)
+ cinput_d->ly_relationship_first = ly;
+ cinput_d->ly_relationship_last = ly;
+ }
+ return count-1;
+}
+
+static Evas_Object* input_new_layout_relationship(ct_input_data *cinput_d)
+{
+ contacts_record_h record = NULL;
+ Evas_Object *layout;
+
+ record = ct_input_new_record_relationship(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record() return NULL");
+
+ layout = input_fill_layout_relationship(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_relationship() return NULL");
+
+ if (NULL == cinput_d->ly_relationship_first)
+ cinput_d->ly_relationship_first = layout;
+ cinput_d->ly_relationship_last = layout;
+
+ return layout;
+}
+
+static Evas_Object* input_fill_layout_event(ct_input_data *cinput_d, contacts_record_h record)
+{
+ int event_date;
+ int type_int;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *ly_content;
+ Evas_Object *btn_minus;
+ Evas_Object *btn_type;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *datetime;
+ ct_input_typed_data *typed_data;
+
+ if (!cinput_d->ly_seperator_more) {
+ cinput_d->ly_seperator_more = ct_input_fill_layout_separator(cinput_d, "separator/hd33/with_line");
+ p_retvm_if(NULL == cinput_d->ly_seperator_more, EINA_FALSE, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_after(cinput_d->box, cinput_d->ly_seperator_more, cinput_d->ly_addr_last);
+ }
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ /* datetime */
+ datetime = elm_datetime_add(ly_content);
+ p_retvm_if(NULL == datetime, NULL, "elm_datetime_add() return NULL");
+
+ elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE);
+ elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE);
+ elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE);
+
+ //elm_object_part_content_set(ly_content, "elm.flip.content", datetime);
+ elm_object_part_content_set(ly_content, "elm.icon", datetime);
+ evas_object_data_set(datetime, KEY_INPUT_DATA, cinput_d);
+
+ err = contacts_record_get_int(record, _contacts_event.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+ elm_object_text_set(btn_type, T_(CT_GET_TEXT_EVENT_TYPE, type_int));
+ evas_object_data_set(btn_type, "cinput_d", cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+ typed_data->record = record;
+ typed_data->ly_content = ly_content;
+ typed_data->view_uri = _contacts_event._uri;
+ evas_object_data_set(ly_content, "typed_data", typed_data);
+ evas_object_data_set(datetime, "typed_data", typed_data);
+
+ err = contacts_record_get_int(record, _contacts_event.date, &event_date);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (0 == event_date) { // new record
+ time_t timer;
+ struct tm *stime = NULL;
+ timer = time(NULL);
+ stime = localtime(&timer);
+ p_retvm_if(NULL == stime, NULL, "localtime() Failed(%d)", errno);
+ elm_datetime_value_set(datetime, stime);
+ }
+ else {
+ struct tm stime;
+ stime.tm_year = event_date/10000 - 1900;
+ stime.tm_mon = (event_date%10000)/100 - 1;
+ stime.tm_mday = event_date%100;
+ elm_datetime_value_set(datetime, &stime);
+
+ btn_minus = elm_button_add(ly_content);
+ if (NULL == btn_minus) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ free(typed_data);
+ return NULL;
+ }
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_event_del_clicked_cb, cinput_d);
+ }
+
+ evas_object_smart_callback_add(datetime, "changed", input_event_changed_cb, cinput_d);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+ evas_object_smart_callback_add(btn_type, "clicked", ct_input_data_type_clicked_cb, typed_data);
+
+ if (cinput_d->ly_event_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_event_last);
+ else if (cinput_d->ly_relationship_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_relationship_last);
+ else if (cinput_d->ly_url_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_url_last);
+ else if (cinput_d->ly_messenger_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_messenger_last);
+ else
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_seperator_more);
+
+ return ly_content;
+}
+
+static int input_fill_layout_event_list(ct_input_data *cinput_d)
+{
+ int count = 0;
+ contacts_record_h record = NULL;
+ Evas_Object *ly;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.event, count++, &record)) {
+ ly = input_fill_layout_event(cinput_d, record);
+ p_retvm_if(NULL == ly, count, "input_fill_layout_event() return NULL");
+
+ if (NULL == cinput_d->ly_event_first)
+ cinput_d->ly_event_first = ly;
+
+ cinput_d->ly_event_last = ly;
+ }
+ return count-1;
+}
+
+static Evas_Object* input_new_layout_event(ct_input_data *cinput_d)
+{
+ Evas_Object *layout;
+ contacts_record_h record = NULL;
+
+ record = ct_input_new_record_event(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record_event() return NULL");
+
+ layout = input_fill_layout_event(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_event() return NULL");
+
+ if (NULL == cinput_d->ly_event_first)
+ cinput_d->ly_event_first = layout;
+ cinput_d->ly_event_last = layout;
+
+ return layout;
+}
+
+static void input_website_del(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ int idx;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *list = NULL;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+ p_retm_if(NULL == typed_data, "parameter(typed_data) is NULL");
+
+ err = contacts_record_remove_child_record(cinput_d->contact, _contacts_contact.url, typed_data->record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+
+ if (typed_data->ly_content == cinput_d->ly_url_first) {
+ idx = ct_input_box_idx_get(cinput_d->box, typed_data->ly_content);
+ list = elm_box_children_get(cinput_d->box);
+ cinput_d->ly_url_first = eina_list_nth(list, idx + 1);
+ eina_list_free(list);
+ }
+
+ err = contacts_record_destroy(typed_data->record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ elm_box_unpack(cinput_d->box, typed_data->ly_content);
+ evas_object_del(typed_data->ly_content);
+}
+
+
+static void input_website_del_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int count;
+ ct_input_data *cinput_d = data;
+ ct_input_typed_data *typed_data;
+
+ p_retm_if(NULL == cinput_d, "parameter(cinput_d) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ input_website_del(cinput_d, typed_data);
+
+}
+
+static void input_website_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_input_data *cinput_d = data;
+ Evas_Object *btn_minus;
+ ct_input_typed_data *typed_data;
+ const char *tmp;
+
+ tmp = elm_entry_entry_get(obj);
+ p_retm_if(NULL == tmp || '\0' == tmp[0], "elm_entry_entry_get() return NULL");
+
+ evas_object_smart_callback_del(obj, "changed", input_website_changed_cb);
+ p_retm_if(NULL == cinput_d, "parameter(ct_input_data) is NULL");
+
+ typed_data = evas_object_data_get(obj, "typed_data");
+ p_retm_if(NULL == typed_data, "evas_object_data_get() return NULL");
+
+ if (typed_data->ly_content == cinput_d->ly_url_last) {
+ btn_minus = elm_button_add(typed_data->ly_content);
+ p_retm_if(NULL == btn_minus, "elm_button_add() return NULL");
+
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(typed_data->ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_website_del_clicked_cb, cinput_d);
+
+ p_retm_if(NULL == input_new_layout_website(cinput_d), "input_new_layout_website() return NULL");
+ }
+
+}
+
+static Evas_Object *input_website_get_edit_rename(ct_input_data *cinput_d, ct_input_typed_data *typed_data)
+{
+ char *val_str;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *entry;
+ Evas_Object *editfield;
+ Evas_Object *ly_content = typed_data->ly_content;
+
+ editfield = ct_input_add_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_URL), input_website_unfocused_cb, typed_data->record);
+ p_retvm_if(NULL == editfield, NULL, "ct_input_add_editfield() return NULL");
+
+ entry = elm_object_part_content_get(editfield, "elm.swallow.content");
+ typed_data->data = entry;
+
+ evas_object_data_set(entry, "typed_data", typed_data);
+ evas_object_data_set(entry, KEY_INPUT_DATA, cinput_d);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_URL);
+
+ err = contacts_record_get_str_p(typed_data->record, _contacts_url.url, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (val_str && *val_str)
+ ctui_entry_entry_set(entry, val_str);
+ else
+ evas_object_smart_callback_add(entry, "changed", input_website_changed_cb, cinput_d);
+ return editfield;
+
+}
+
+static Evas_Object* input_fill_layout_url(ct_input_data *cinput_d, contacts_record_h record)
+{
+ char *custom_type;
+ char *val_str;
+ int type_int;
+ Evas_Object *ly_content;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ef;
+ Evas_Object *btn_type;
+ Evas_Object *btn_minus;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_typed_data *typed_data;
+
+ if (!cinput_d->ly_seperator_more) {
+ cinput_d->ly_seperator_more = ct_input_fill_layout_separator(cinput_d, "separator/hd33/with_line");
+ p_retvm_if(NULL == cinput_d->ly_seperator_more, EINA_FALSE, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_after(cinput_d->box, cinput_d->ly_seperator_more, cinput_d->ly_addr_last);
+ }
+
+ ly_content = elm_layout_add(box);
+ p_retvm_if(NULL == ly_content, NULL, "elm_layout_add() return NULL");
+ elm_layout_file_set(ly_content, CONTACTS_EDJ, "dialogue/1icon.1type.1edit");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ err = contacts_record_get_int(record, _contacts_url.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ btn_type = elm_button_add(ly_content);
+ if (NULL == btn_type) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ return NULL;
+ }
+
+ custom_type = (char *)T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(type_int));
+ if (CONTACTS_URL_TYPE_CUSTOM==type_int) {
+ err = contacts_record_get_str_p(record, _contacts_url.label, &custom_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (NULL == custom_type || '\0' == custom_type[0])
+ custom_type = (char *)T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(CONTACTS_URL_TYPE_OTHER));
+ }
+ elm_object_text_set(btn_type, custom_type);
+
+ evas_object_data_set(btn_type, KEY_INPUT_DATA, cinput_d);
+ elm_object_part_content_set(ly_content, "elm.icon.type", btn_type);
+
+ typed_data = calloc(1, sizeof(ct_input_typed_data));
+ p_retvm_if(NULL == typed_data, NULL, "calloc() return NULL");
+
+ typed_data->record = record;
+ typed_data->ly_content = ly_content;
+ typed_data->view_uri = _contacts_url._uri;
+ evas_object_data_set(ly_content, "typed_data", typed_data);
+
+ err = contacts_record_get_str_p(record, _contacts_url.url, &val_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ if (val_str && *val_str) {
+ btn_minus = elm_button_add(ly_content);
+ if (NULL == btn_minus) {
+ ERR("elm_button_add() return NULL");
+ evas_object_del(ly_content);
+ free(typed_data);
+ return NULL;
+ }
+ elm_object_style_set(btn_minus, "minus");
+ evas_object_data_set(btn_minus, "typed_data", typed_data);
+ elm_object_part_content_set(ly_content, "elm.icon.edit", btn_minus);
+ evas_object_smart_callback_add(btn_minus, "clicked", input_website_del_clicked_cb, cinput_d);
+ }
+
+ ef = input_website_get_edit_rename(cinput_d, typed_data);
+ if (NULL == ef) {
+ ERR("input_website_get_edit_rename() return NULL");
+ evas_object_del(ly_content);
+ free(typed_data);
+ return NULL;
+ }
+ ct_input_add_name_field(ef, cinput_d);
+
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_DEL, ct_input_typed_layout_del_cb, typed_data);
+ evas_object_smart_callback_add(btn_type, "clicked", ct_input_data_type_clicked_cb, typed_data);
+
+ if (cinput_d->ly_url_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_url_last);
+ else {
+ if (cinput_d->ly_messenger_last)
+ elm_box_pack_after(box, ly_content, cinput_d->ly_messenger_last);
+ else
+ elm_box_pack_after(box, ly_content, cinput_d->ly_seperator_more);
+ }
+
+ return ly_content;
+}
+
+static Evas_Object* input_new_layout_website(ct_input_data *cinput_d)
+{
+ contacts_record_h record = NULL;
+ Evas_Object *layout;
+
+ record = ct_input_new_record_web(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_new_record_web() return NULL");
+
+ layout = input_fill_layout_url(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_url() return NULL");
+
+ if (NULL == cinput_d->ly_url_first)
+ cinput_d->ly_url_first = layout;
+ cinput_d->ly_url_last = layout;
+
+ return layout;
+}
+
+
+static int input_fill_layout_websites(ct_input_data *cinput_d)
+{
+ int count = 0;
+ Evas_Object *ly;
+ contacts_record_h record = NULL;
+
+ ly = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.url, count++, &record)) {
+ ly = input_fill_layout_url(cinput_d, record);
+ p_retvm_if(NULL == ly, count-1, "input_fill_layout_url() return NULL");
+
+ if (NULL == cinput_d->ly_url_first)
+ cinput_d->ly_url_first = ly;
+ cinput_d->ly_url_last = ly;
+ }
+ return count-1;
+}
+
+static Evas_Object* input_fill_layout_note(ct_input_data *cinput_d)
+{
+ char *note_str;
+ char *note_str_markup;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+ Evas_Object *ef, *en;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ if (!cinput_d->ly_seperator_more) {
+ cinput_d->ly_seperator_more = ct_input_fill_layout_separator(cinput_d, "separator/hd33/with_line");
+ p_retvm_if(NULL == cinput_d->ly_seperator_more, EINA_FALSE, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_after(cinput_d->box, cinput_d->ly_seperator_more, cinput_d->ly_addr_last);
+ }
+
+ ly_content = ct_input_create_dg_layout(box, "1icon");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+ evas_object_size_hint_align_set(ly_content, EVAS_HINT_FILL, 0.0);
+ evas_object_show(ly_content);
+
+ record = ct_input_get_record_note(cinput_d->contact);
+ p_retvm_if(NULL == record, NULL, "ct_input_get_record_note() return NULL");
+
+ ef = ctui_create_editfield(ly_content, T_(CT_GET_TEXT_BASIC, CTTEXT_NOTE), NULL, true);
+ p_retvm_if(NULL == ef, NULL, "ctui_create_editfield() return NULL");
+ ct_input_add_name_field(ef, cinput_d);
+
+ en = elm_object_part_content_get(ef, "elm.swallow.content");
+ evas_object_smart_callback_add(en, "unfocused", input_note_unfocused_cb, record);
+ evas_object_smart_callback_add(en, "changed", ct_input_entry_changed_cb, ef);
+ elm_object_part_content_set(ly_content, "elm.icon", ef);
+ evas_object_data_set(en, KEY_INPUT_DATA, cinput_d);
+
+ err = contacts_record_get_str_p(record, _contacts_note.note, &note_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ note_str_markup = elm_entry_utf8_to_markup(note_str);
+ __input_editfield_entry_set(ef, note_str_markup);
+ free(note_str_markup);
+
+ if (cinput_d->ly_event_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_event_last);
+ else if (cinput_d->ly_relationship_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_relationship_last);
+ else if (cinput_d->ly_url_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_url_last);
+ else if (cinput_d->ly_messenger_last)
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_messenger_last);
+ else
+ elm_box_pack_after(cinput_d->box, ly_content, cinput_d->ly_seperator_more);
+
+ cinput_d->ly_note = ly_content;
+
+ return ly_content;
+}
+
+
+static Evas_Object* input_fill_layout_addresses(ct_input_data *cinput_d)
+{
+ int count = 0;
+ Evas_Object *layout = NULL;
+ contacts_record_h record = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_record_get_child_record_at_p(cinput_d->contact, _contacts_contact.address, count++, &record)) {
+ layout = input_fill_layout_address(cinput_d, record);
+ p_retvm_if(NULL == layout, NULL, "input_fill_layout_address() return NULL");
+
+ if (NULL == cinput_d->ly_addr_first)
+ cinput_d->ly_addr_first = layout;
+ cinput_d->ly_addr_last = layout;
+ }
+
+ p_retvm_if(NULL == input_new_layout_address(cinput_d), NULL, "input_new_layout_address() return NULL");
+
+ return layout;
+}
+
+static void input_genlist_render_flush_post_cb(void *data, Evas *e, void *event_info)
+{
+ int field;
+ Evas_Coord w,h;
+ ct_input_data *cinput_d = data;
+
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST, input_genlist_render_flush_post_cb);
+ field = (int)evas_object_data_get(cinput_d->scroller, "field");
+ evas_object_data_del(cinput_d->scroller, "field");
+
+ switch (field) {
+ case INPUT_MORE_JOB_TITLE:
+ case INPUT_MORE_DEPARTMENT:
+ elm_scroller_region_bring_in(cinput_d->scroller, 0, 0, 0, 0);
+ break;
+ default:
+ elm_scroller_child_size_get(cinput_d->scroller, &w, &h);
+ elm_scroller_region_bring_in(cinput_d->scroller, 0, h, 0, h);
+ break;
+ }
+
+}
+
+static void input_update_moreinfo(ct_input_data *cinput_d)
+{
+ PH_FN_CALL;
+ p_ret_if(!cinput_d->ly_moreinfo);
+
+ if (cinput_d->ly_event_last && cinput_d->add_department &&
+ cinput_d->add_job_title && cinput_d->ly_messenger_last && cinput_d->ly_note &&
+ cinput_d->ly_url_last) {
+
+ evas_object_del(cinput_d->ly_moreinfo);
+ }
+}
+
+static void input_moreinfo_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int field = (int)data;
+ ct_input_data *cinput_d;
+ Evas_Object *layout;
+ Evas_Object *btn_expand;
+
+ cinput_d = evas_object_data_get(obj, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ ct_detail_popup_hide_cb(cinput_d->cdetail_d, NULL, NULL);
+
+ switch(field) {
+ case INPUT_MORE_JOB_TITLE:
+ cinput_d->add_job_title = true;
+ if (cinput_d->ly_basic_info_last_name) {
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_JOB_TITLE),
+ input_job_title_unfocused_cb, _contacts_company._uri, _contacts_company.job_title);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_nickname);
+ cinput_d->ly_basic_info_job_title = layout;
+ }
+ else {
+ btn_expand = elm_object_part_content_get(cinput_d->ly_basic_info, "elm.edit.icon");
+ __input_basic_info_expand_clicked_cb(cinput_d, btn_expand, NULL);
+ }
+ break;
+ case INPUT_MORE_DEPARTMENT:
+ cinput_d->add_department = true;
+ if (cinput_d->ly_basic_info_last_name) {
+ layout = __input_fill_layout_basic_info_expand(cinput_d, T_(CT_GET_TEXT_BASIC, CTTEXT_DEPARTMENT),
+ input_department_unfocused_cb, _contacts_company._uri, _contacts_company.department);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info_expand() return NULL");
+ if (cinput_d->ly_basic_info_job_title)
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_job_title);
+ else
+ elm_box_pack_after(cinput_d->box, layout, cinput_d->ly_basic_info_nickname);
+ cinput_d->ly_basic_info_department = layout;
+ }
+ else {
+ btn_expand = elm_object_part_content_get(cinput_d->ly_basic_info, "elm.edit.icon");
+ __input_basic_info_expand_clicked_cb(cinput_d, btn_expand, NULL);
+ }
+ break;
+ case INPUT_MORE_MESSENGER:
+ input_new_layout_messenger(cinput_d);
+ break;
+ case INPUT_MORE_URL:
+ input_new_layout_website(cinput_d);
+ break;
+ case INPUT_MORE_RELATIONSHIP:
+ input_new_layout_relationship(cinput_d);
+ break;
+ case INPUT_MORE_EVENT:
+ input_new_layout_event(cinput_d);
+ break;
+ case INPUT_MORE_NOTE:
+ input_fill_layout_note(cinput_d);
+ break;
+ }
+
+ evas_object_data_set(cinput_d->scroller, "field", (void *)field);
+ evas_event_callback_add(evas_object_evas_get(cinput_d->scroller),
+ EVAS_CALLBACK_RENDER_FLUSH_POST, input_genlist_render_flush_post_cb, cinput_d);
+
+ input_update_moreinfo(cinput_d);
+}
+
+//static void input_moreinfo_button_cb(void *data, Evas_Object *obj, void *even_info)
+static void input_moreinfo_button_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ int rotate;
+ ct_input_data *cinput_d = data;
+ ct_detail_data *cdetail_d = cinput_d->cdetail_d;
+ int x,y,w,h;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y)
+ return;
+
+ elm_object_tree_focus_allow_set(cdetail_d->navi, EINA_FALSE);
+
+ if (cdetail_d->popup)
+ ct_detail_popup_hide_cb(cdetail_d, NULL, NULL);
+
+ cdetail_d->popup = elm_ctxpopup_add(cdetail_d->win);
+ p_retm_if(NULL == cdetail_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(cinput_d->cdetail_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(cdetail_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+
+ if (cinput_d->keypad_on == true) {
+ if(rotate == 0 || rotate == 180)
+ evas_object_move(cdetail_d->popup, x+(w/2), CT_INPUT_MOREINFO_PORTRAIT_Y+(h/2));
+ else
+ evas_object_move(cdetail_d->popup, x+(w/2), CT_INPUT_MOREINFO_LANDSCAPE_Y+(h/2));
+ }
+ else
+ evas_object_move(cdetail_d->popup, x+(w/2), y+(h/2));
+
+ evas_object_smart_callback_add(cdetail_d->popup, "dismissed", ct_detail_popup_hide_cb, cdetail_d);
+
+ evas_object_data_set(cdetail_d->popup, KEY_INPUT_DATA, cinput_d);
+
+ if (!cinput_d->add_job_title)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_JOB_TITLE), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_JOB_TITLE);
+ if (!cinput_d->add_department)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_DEPARTMENT), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_DEPARTMENT);
+ if (!cinput_d->ly_messenger_last)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_INSTANT_MESSENGER), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_MESSENGER);
+ if (!cinput_d->ly_url_last)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_URL), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_URL);
+ if (!cinput_d->ly_relationship_last)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_RELATIONSHIP), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_RELATIONSHIP);
+
+ if (!cinput_d->ly_event_last) // TODO: Fixme
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_EVENT), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_EVENT);
+ if (!cinput_d->ly_note)
+ elm_ctxpopup_item_append(cdetail_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_NOTE), NULL,
+ input_moreinfo_cb, (void *)INPUT_MORE_NOTE);
+
+ evas_object_show(cdetail_d->popup);
+}
+
+static Evas_Object* input_fill_layout_moreinfo(ct_input_data *cinput_d)
+{
+ // TODO: Fixme
+ /*
+ Evas_Object *button;
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+
+ ly_content = ct_input_create_dg_layout(box, "bg/1icon");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+
+ button = elm_button_add(box);
+ p_retvm_if(NULL == button, NULL, "elm_button_add() return NULL");
+ elm_object_text_set(button, T_(CT_GET_TEXT_BASIC, CTTEXT_MORE_INFORMATION));
+ elm_object_part_content_set(ly_content, "elm.icon", button);
+ evas_object_smart_callback_add(button, "clicked", input_moreinfo_button_cb, cinput_d);
+
+ cinput_d->ly_moreinfo = ly_content;
+ return ly_content;
+ */
+ Evas_Object *box = cinput_d->box;
+ Evas_Object *ly_content;
+
+ ly_content = ct_input_create_dg_layout(box, "1text");
+ p_retvm_if(NULL == ly_content, NULL, "ct_input_create_dg_layout() return NULL");
+
+ input_layout_selectable_set(ly_content);
+ evas_object_event_callback_add(ly_content, EVAS_CALLBACK_MOUSE_UP, input_moreinfo_button_cb, cinput_d);
+ elm_object_part_text_set(ly_content, "elm.text", T_(CT_GET_TEXT_BASIC, CTTEXT_MORE_INFORMATION));
+
+ cinput_d->ly_moreinfo = ly_content;
+ return ly_content;
+}
+
+static void input_fill_layout(ct_input_data *cinput_d)
+{
+ int i;
+ int cnt;
+ char *str;
+ Evas_Object *layout;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ for (i = cinput_d->idx_append; i < INPUT_ITEMS_MAX; i++) {
+ switch(i) {
+ case INPUT_IMAGE:
+ layout = __input_fill_layout_image(cinput_d);
+ p_retm_if(NULL == layout, "__input_fill_layout_image() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+ break;
+ case INPUT_BASIC_INFO:
+ record = ct_input_get_record_company(cinput_d->contact);
+ if (record) {
+ if (!cinput_d->add_department) {
+ err = contacts_record_get_str_p(record, _contacts_company.department, &str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (str && *str)
+ cinput_d->add_department = true;
+ }
+ if (!cinput_d->add_job_title) {
+ err = contacts_record_get_str_p(record, _contacts_company.job_title, &str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (str && *str)
+ cinput_d->add_job_title = true;
+ }
+ }
+ layout = __input_fill_layout_basic_info(cinput_d);
+ p_retm_if(NULL == layout, "__input_fill_layout_basic_info() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+
+ if (!cinput_d->ly_seperator_basic_info) {
+ cinput_d->ly_seperator_basic_info = ct_input_fill_layout_separator(cinput_d, "separator/hd18/with_line");
+ p_retm_if(NULL == layout, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_end(cinput_d->box, cinput_d->ly_seperator_basic_info);
+ }
+ break;
+
+ case INPUT_NUMBER:
+ ct_input_fill_layout_numbers(cinput_d);
+ break;
+
+ case INPUT_EMAIL:
+ ct_input_fill_layout_emails(cinput_d);
+ break;
+
+ case INPUT_ADDRESS:
+ input_fill_layout_addresses(cinput_d);
+ break;
+
+ case INPUT_MESSENGER:
+ cnt = input_fill_layout_messengers(cinput_d);
+ if (cnt) {
+ input_new_layout_messenger(cinput_d);
+ }
+ break;
+
+ case INPUT_URL:
+ cnt = input_fill_layout_websites(cinput_d);
+ if (cnt) {
+ input_new_layout_website(cinput_d);
+ }
+ break;
+ case INPUT_RELATIONSHIP:
+ cnt = input_fill_layout_relationship_list(cinput_d);
+ if (cnt)
+ input_new_layout_relationship(cinput_d);
+ break;
+ case INPUT_EVENT:
+ cnt = input_fill_layout_event_list(cinput_d);
+ if (cnt)
+ input_new_layout_event(cinput_d);
+ break;
+ case INPUT_NOTE:
+ if(cinput_d->cdetail_d->list_note)
+ input_fill_layout_note(cinput_d);
+ break;
+ case INPUT_GROUP:
+ layout = ct_input_fill_layout_separator(cinput_d, "separator/hd33/with_line");
+ p_retm_if(NULL == layout, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+
+ /* group */
+ layout = input_fill_layout_group(cinput_d);
+ p_retm_if(NULL == layout, "input_fill_layout_group() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+ break;
+
+ case INPUT_RINGTONE:
+ /* ringtone */
+ layout = input_fill_layout_ringtone(cinput_d);
+ p_retm_if(NULL == layout, "input_fill_layout_ringtone() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+ break;
+
+ case INPUT_VIBRATION:
+ /* vibration */
+ layout = input_fill_layout_vibration(cinput_d);
+ p_retm_if(NULL == layout, "input_fill_layout_vibration() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+ break;
+
+ case INPUT_ADDRBOOK:
+ /* address book */
+ if (0 == cinput_d->contact_id) {
+ layout = input_fill_layout_addrbook(cinput_d);
+ p_retm_if(NULL == layout, "input_fill_layout_addrbook() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+
+ }
+ break;
+
+ case INPUT_MORE_INFO:
+ if(cinput_d->add_job_title && cinput_d->add_department && cinput_d->ly_messenger_last
+ && cinput_d->ly_url_last && cinput_d->ly_relationship_last && cinput_d->ly_event_last
+ && cinput_d->ly_note)
+ break;
+
+
+ layout = ct_input_fill_layout_separator(cinput_d, "separator/hd16");
+ p_retm_if(NULL == layout, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+
+ layout = input_fill_layout_moreinfo(cinput_d);
+ p_retm_if(NULL == layout, "input_fill_layout_moreinfo() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+
+ layout = ct_input_fill_layout_separator(cinput_d, "separator/hd16");
+ p_retm_if(NULL == layout, "ct_input_fill_layout_separator() return NULL");
+ elm_box_pack_end(cinput_d->box, layout);
+
+ input_update_moreinfo(cinput_d);
+ break;
+
+ default:
+ ERR("Unknown item(%d)", i);
+ }
+ }
+}
+
+static void input_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_input_data *cinput_d = data;
+ ct_detail_data *cdetail_d = cinput_d->cdetail_d;
+
+ /* evas_object_smart_callback_del() func will be deleted */
+ evas_object_smart_callback_del(obj, "clicked", input_cancel_cb);
+
+ elm_naviframe_item_pop(cdetail_d->navi);
+}
+
+static Eina_Bool input_win_prop_change(void *data, int type, void *event)
+{
+ Evas_Object *l_btn, *r_btn;
+ Ecore_X_Event_Window_Property *ev = event;
+ Ecore_X_Virtual_Keyboard_State state = ecore_x_e_virtual_keyboard_state_get(ev->win);
+ ct_input_data *cinput_d = (ct_input_data *)data;
+
+ p_retvm_if(NULL == cinput_d, ECORE_CALLBACK_PASS_ON, "data is NULL");
+
+ if (ECORE_X_VIRTUAL_KEYBOARD_STATE_ON == state &&
+ NULL == elm_object_item_part_content_get(cinput_d->navi_item, "title_left_btn")) {
+ r_btn = phone_create_navi_btn(cinput_d->cdetail_d->navi, "naviframe/prev_btn/default");
+ if (cinput_d->cdetail_d->ug && NULL == cinput_d->pre_item)
+ evas_object_smart_callback_add(r_btn, "clicked", phone_ug_destroy_me_cb, cinput_d->cdetail_d->ug);
+ else
+ evas_object_smart_callback_add(r_btn, "clicked", input_cancel_cb, cinput_d);
+ elm_object_item_part_content_set(cinput_d->navi_item, "title_right_btn",r_btn);
+
+ l_btn = phone_create_navi_btn(cinput_d->cdetail_d->navi, "plus");
+ evas_object_smart_callback_add(l_btn, "clicked", ct_input_save_cb, cinput_d);
+ elm_object_item_part_content_set(cinput_d->navi_item, "title_left_btn", l_btn);
+
+ ct_input_save_button_update(cinput_d);
+ cinput_d->keypad_on = true;
+ }
+ else if (ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF == state &&
+ NULL != elm_object_item_part_content_get(cinput_d->navi_item, "title_left_btn")) {
+ elm_object_item_part_content_set(cinput_d->navi_item, "title_left_btn", NULL);
+ elm_object_item_part_content_set(cinput_d->navi_item, "title_right_btn", NULL);
+ cinput_d->keypad_on = false;
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+
+static Evas_Object* input_create_layout(ct_input_data *cinput_d)
+{
+ char temp[PH_TEXT_MAX_LEN];
+ Evas_Object *box;
+ Evas_Object *scroller;
+ Evas_Object *layout;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_addressbook = NULL;
+ ct_detail_data *cdetail_d = cinput_d->cdetail_d;
+
+ layout = phone_create_base_layout(cdetail_d->navi, false);
+ p_retvm_if(NULL == layout, NULL, "elm_layout_add() return NULL");
+ evas_object_data_set(layout, KEY_INPUT_DATA, cinput_d);
+ cinput_d->win_prop_change = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, input_win_prop_change, cinput_d);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(layout);
+
+ scroller = elm_scroller_add(layout);
+ p_retvm_if(NULL == scroller, NULL, "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);
+ elm_object_part_content_set(layout, "elm.swallow.content", scroller);
+ cinput_d->scroller = scroller;
+
+ box = elm_box_add(scroller);
+ p_retvm_if(NULL == box, NULL, "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);
+ cinput_d->box = box;
+
+ cdetail_d->has_input = true;
+ if (!cinput_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cinput_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d))", err);
+
+ if (cdetail_d->base_grp) {
+ contacts_record_h record_group_relation = NULL;
+ err = contacts_record_create(_contacts_group_relation._uri, &(record_group_relation));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record_group_relation, _contacts_group_relation.group_id, cdetail_d->base_grp);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(cinput_d->contact, _contacts_contact.group_relation, record_group_relation);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(record_group_relation, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+
+ if (cinput_d->base_ab < 0)
+ cinput_d->base_ab = ct_input_get_base_ab();
+
+ err = contacts_db_get_record(_contacts_address_book._uri, cinput_d->base_ab, &record_addressbook);
+ if (CONTACTS_ERROR_NONE == err) {
+ free(cinput_d->base_ab_name);
+ cinput_d->base_ab_name = NULL;
+
+ temp[0] = '\0';
+ ctui_get_addressbook_name(cinput_d->base_ab, temp, sizeof(temp));
+ if (*temp)
+ cinput_d->base_ab_name = strdup(temp);
+ err = contacts_record_get_int(record_addressbook, _contacts_address_book.mode, &(cinput_d->base_ab_mode));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_destroy(record_addressbook, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ }
+ else {
+ cinput_d->base_ab = 0;
+ cinput_d->base_ab_mode = CONTACTS_ADDRESS_BOOK_MODE_NONE;
+ cinput_d->base_ab_name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+
+ }
+ else if (cinput_d->contact_id) {
+ err = contacts_record_get_int(cinput_d->contact, _contacts_contact.address_book_id, &(cinput_d->base_ab));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ if (cinput_d->base_ab) {
+ err = contacts_db_get_record(_contacts_address_book._uri, cinput_d->base_ab, &record_addressbook);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_int(record_addressbook, _contacts_address_book.mode, &(cinput_d->base_ab_mode));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+
+ free(cinput_d->base_ab_name);
+
+ temp[0] = '\0';
+ ctui_get_addressbook_name(cinput_d->base_ab, temp, sizeof(temp));
+ if (*temp)
+ cinput_d->base_ab_name = strdup(temp);
+
+ err = contacts_record_destroy(record_addressbook, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+ }
+ if (cinput_d->base_ab < 0){
+ cinput_d->base_ab = ct_input_get_base_ab();
+ temp[0] = '\0';
+ ctui_get_addressbook_name(cinput_d->base_ab, temp, sizeof(temp));
+ if (*temp)
+ cinput_d->base_ab_name = SAFE_STRDUP(temp);
+ }
+ input_fill_layout(cinput_d);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, input_view_delete_cb, cinput_d);
+
+ return layout;
+}
+
+void ct_input_language_changed(Evas_Object *navi)
+{
+ PH_FN_CALL;
+ ct_input_data *cinput_d;
+
+ cinput_d = evas_object_data_get(navi, KEY_INPUT_DATA);
+ p_retm_if(NULL == cinput_d, "evas_object_data_get() return NULL");
+
+ // update title
+ if (cinput_d->navi_item) {
+ if (!cinput_d->contact_id)
+ elm_object_item_text_set(cinput_d->navi_item, S_(CT_SYS_BODY_CREATE));
+ else
+ elm_object_item_text_set(cinput_d->navi_item, S_(PH_SYS_SK_EDIT));
+ }
+
+ // update content
+ ct_input_remove_empty_fields(cinput_d->contact);
+ input_refresh_layout(cinput_d);
+}
+
+void ct_input_push_navi_content(ct_detail_data *cdetail_d, contacts_record_h contact, int contact_id)
+{
+ PH_FN_CALL;
+ int ret;
+ const char *navi_title;
+ Evas_Object *content;
+ Elm_Object_Item *navi_item;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_input_data *cinput_d;
+
+ cinput_d = calloc(1, sizeof(ct_input_data));
+ p_retm_if(NULL == cinput_d, "calloc() return NULL");
+ cinput_d->cdetail_d = cdetail_d;
+ cinput_d->contact = contact;
+ cinput_d->contact_id = contact_id;
+ if(cdetail_d->base_ab < 0)
+ cinput_d->base_ab = 0;
+ else
+ cinput_d->base_ab = cdetail_d->base_ab;
+ cinput_d->base_ab_mode = cdetail_d->base_ab_mode;
+ cinput_d->base_ab_name = SAFE_STRDUP(cdetail_d->base_ab_name);
+ cinput_d->pre_item = elm_naviframe_top_item_get(cdetail_d->navi);
+ cinput_d->save_disable = EINA_FALSE;
+ evas_object_data_set(cdetail_d->navi, KEY_INPUT_DATA, cinput_d);
+
+ if (cdetail_d->has_detail) {
+ ct_detail_delete_namecards(cdetail_d);
+ }
+
+ content = input_create_layout(cinput_d);
+ p_retm_if(NULL == content, "input_create_layout() Failed");
+ cinput_d->layout = content;
+
+ if (cinput_d->contact_id) {
+ navi_title = S_(PH_SYS_SK_EDIT);
+ err = contacts_db_get_current_version(&(cinput_d->view_create_ver));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_current_version() Failed(%d)", err);
+
+ ret = contacts_db_add_changed_cb(_contacts_contact._uri, input_contacts_changed, cinput_d);
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_db_add_changed_cb() Failed(%d)", ret);
+ }
+ else
+ navi_title = S_(CT_SYS_BODY_CREATE);
+
+ navi_item = elm_naviframe_item_push(cdetail_d->navi, navi_title, NULL, NULL, content, NULL);
+ cinput_d->navi_item = navi_item;
+
+ cinput_d->save_button = phone_create_toolbar_btn(cinput_d->cdetail_d->navi, S_(CT_SYS_SK_DONE), ct_input_save_cb, cinput_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", cinput_d->save_button);
+
+ ct_input_save_button_update(cinput_d);
+
+ if (cinput_d->cdetail_d->ug && NULL == cinput_d->pre_item) {
+ Evas_Object *close_button = elm_button_add(cinput_d->cdetail_d->navi);
+ evas_object_smart_callback_add(close_button, "clicked", phone_ug_destroy_me_cb, cinput_d->cdetail_d->ug);
+ elm_object_style_set(close_button, "naviframe/back_btn/default");
+ elm_object_item_part_content_set(cinput_d->navi_item, "prev_btn", close_button);
+ }
+ else {
+ Evas_Object *cancel_button = phone_create_toolbar_btn(cinput_d->cdetail_d->navi, S_(PH_SYS_SK_CANCEL), input_cancel_cb, cinput_d);
+ elm_object_item_part_content_set(cinput_d->navi_item, "toolbar_button2", cancel_button);
+ elm_object_style_set(cinput_d->save_button, "naviframe/toolbar/left");
+ elm_object_style_set(cancel_button, "naviframe/toolbar/right");
+ }
+
+
+ PH_DBG("##### [TSP_TEST] detail->edit end.#####");
+}
diff --git a/lib/details/ct-input-view.h b/lib/details/ct-input-view.h
new file mode 100755
index 0000000..0ed6f1d
--- /dev/null
+++ b/lib/details/ct-input-view.h
@@ -0,0 +1,28 @@
+/*
+* 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_INPUT_VIEW_H__
+#define __CONTACTS_INPUT_VIEW_H__
+
+#define KEY_INPUT_DATA "cinput_d"
+
+void ct_input_push_navi_content(ct_detail_data *cdetail_d, contacts_record_h contact, int contact_id);
+void ct_input_language_changed(Evas_Object *navi);
+void ct_input_update_image(ct_input_data *i_data);
+Evas_Object* ct_input_fill_layout_separator(ct_input_data *i_data, const char *theme);
+
+#endif //__CONTACTS_INPUT_VIEW_H__
diff --git a/lib/details/ct-share-info-ug.c b/lib/details/ct-share-info-ug.c
new file mode 100755
index 0000000..11d43c8
--- /dev/null
+++ b/lib/details/ct-share-info-ug.c
@@ -0,0 +1,857 @@
+/*
+* 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 <unicode/udatpg.h>
+#include <unicode/ucal.h>
+#include <unicode/ustring.h>
+#include <ui-gadget-module.h>
+#include <bundle.h>
+
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-detail-utils.h"
+
+#define KEY_SHARE_INFO_UG_DATA "cshare_info_d"
+
+typedef struct {
+ int person_id;
+ ui_gadget_h ug;
+
+ Evas_Object *navi;
+ Evas_Object *genlist;
+ Evas_Object *select_all_layout;
+
+ UDateFormat* formatter;
+
+ Eina_List *list_contacts;
+}ct_share_info_ug_data;
+
+typedef struct {
+ contacts_record_h record;
+ const char *view_uri;
+ Eina_Bool checked;
+}ct_value_info;
+
+enum DETAIL_ITC_TYPE {
+ CT_SHARE_INFO_UG_ITC_GROUP_TITLE,
+ CT_SHARE_INFO_UG_ITC_NUMBER,
+ CT_SHARE_INFO_UG_ITC_EMAIL,
+ CT_SHARE_INFO_UG_ITC_ADDRESS,
+ CT_SHARE_INFO_UG_ITC_MESSENGER,
+ CT_SHARE_INFO_UG_ITC_WEBSITE,
+ CT_SHARE_INFO_UG_ITC_EVENT,
+ CT_SHARE_INFO_UG_ITC_NOTE,
+};
+
+static Elm_Genlist_Item_Class share_info_ug_itcs[] = {
+ {.item_style="grouptitle"},
+ {.item_style="2text.3"},
+ {.item_style="2text.3"},
+ {.item_style="2text.3"},
+ {.item_style="2text.3"},
+ {.item_style="2text.3"},
+ {.item_style="2text.3"},
+ {.item_style="2text.3"},
+};
+
+static char* share_info_ug_gl_group_title_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 char* share_info_ug_gl_number_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type_int;
+ char *number = NULL;
+ char buf[PH_TEXT_MAX_LEN];
+ ct_value_info *value_info = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retv_if(NULL == value_info, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(value_info->record, _contacts_number.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ ctui_get_number_type_str(value_info->record, type_int, buf, sizeof(buf));
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(value_info->record, _contacts_number.number, &number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ return SAFE_STRDUP(number);
+ }
+ return NULL;
+}
+
+static char* share_info_ug_gl_email_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type_int;
+ char *email = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_value_info *value_info = data;
+ p_retv_if(NULL == value_info, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(value_info->record, _contacts_email.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ return strdup(T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(type_int)));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(value_info->record, _contacts_email.email, &email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(email);
+ }
+ return NULL;
+}
+
+static char* share_info_ug_gl_address_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type_int;
+ char buf[PH_TEXT_MAX_LEN];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_value_info *value_info = data;
+ p_retv_if(NULL == value_info, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(value_info->record, _contacts_address.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ return strdup(T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(type_int)));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ buf[0] = '\0';
+ ct_detail_get_full_addr(value_info->record, buf, sizeof(buf));
+ return elm_entry_utf8_to_markup(buf);
+ }
+ return NULL;
+}
+
+static char* share_info_ug_gl_messenger_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type_int;
+ char *im_id;
+ ct_value_info *value_info = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retv_if(NULL == value_info, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(value_info->record, _contacts_messenger.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ return strdup(T_(CT_GET_TEXT_IM_TYPE, type_int));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(value_info->record, _contacts_messenger.im_id, &im_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(im_id);
+ }
+ return NULL;
+}
+
+static char* share_info_ug_gl_website_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type_int;
+ char *url;
+ ct_value_info *value_info = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retv_if(NULL == value_info, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(value_info->record, _contacts_url.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ return strdup(T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(type_int)));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(value_info->record, _contacts_url.url, &url);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(url);
+ }
+ return NULL;
+}
+
+static char* share_info_ug_gl_event_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type_int;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_value_info *value_info = data;
+ ct_share_info_ug_data *cshare_info_d;
+ p_retv_if(NULL == value_info, NULL);
+
+ cshare_info_d = evas_object_data_get(obj, KEY_SHARE_INFO_UG_DATA);
+ p_retvm_if(NULL == cshare_info_d, NULL, "evas_object_data_get() return NULL");
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_record_get_int(value_info->record, _contacts_url.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ return strdup(T_(CT_GET_TEXT_EVENT_TYPE, type_int));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ int date;
+ int day;
+ int mon;
+ int year;
+
+ err = contacts_record_get_int(value_info->record, _contacts_event.date, &date);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ day = date%100;
+ mon = (date%10000)/100;
+ year = date/10000;
+
+ p_retvm_if(mon < 1 || 12 < mon || day < 1 || 31 < day, NULL, "Invalid date(mon=%d,day=%d)",mon,day);
+ return ct_detail_get_datetime_str(cshare_info_d->formatter, year, mon, day);
+ }
+ return NULL;
+}
+
+static char* share_info_ug_gl_note_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *note;
+ ct_value_info *value_info = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retv_if(NULL == value_info, NULL);
+
+ if (0 == strcmp(part, "elm.text.2")) {
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_NOTE));
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ err = contacts_record_get_str_p(value_info->record, _contacts_note.note, &note);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ return SAFE_STRDUP(note);
+ }
+ return NULL;
+}
+static void share_info_ug_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ bool check_all;
+ Evas_Object *check;
+ Elm_Object_Item *item;
+ Elm_Genlist_Item_Type type;
+ ct_value_info *value_info;
+ ct_share_info_ug_data *cshare_info_d = data;
+ p_retm_if(NULL == cshare_info_d, "parameter(cshare_info_d) is NULL");
+
+ check = elm_object_part_content_get(cshare_info_d->select_all_layout, "elm.icon");
+ p_retm_if(NULL == check, "elm_object_part_content_get() return NULL");
+
+ check_all = true;
+ item = elm_genlist_first_item_get(cshare_info_d->genlist);
+ while (item) {
+ value_info = elm_object_item_data_get(item);
+ type = elm_genlist_item_type_get(item);
+
+ item = elm_genlist_item_next_get(item);
+ if (ELM_GENLIST_ITEM_GROUP == type) continue;
+
+ if (NULL == value_info) {
+ ERR("elm_object_item_data_get() return NULL");
+ continue;
+ }
+ if (!value_info->checked) {
+ check_all = false;
+ break;
+ }
+ }
+ elm_check_state_set(check, check_all);
+}
+
+static Evas_Object* share_info_ug_gl_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *check;
+ ct_value_info *value_info = data;
+ ct_share_info_ug_data *cshare_info_d;
+
+ cshare_info_d = evas_object_data_get(obj, KEY_SHARE_INFO_UG_DATA);
+ p_retvm_if(NULL == cshare_info_d, NULL, "evas_object_data_get() return NULL");
+
+ if (0 == strcmp(part, "elm.edit.icon.1")) {
+ check = elm_check_add(obj);
+ elm_check_state_pointer_set(check, &value_info->checked);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ evas_object_smart_callback_add(check, "changed", share_info_ug_check_changed_cb, cshare_info_d);
+ return check;
+ }
+ return NULL;
+}
+
+static void share_info_ug_gl_del(void *data, Evas_Object *obj)
+{
+ ct_value_info *value_info = data;
+ free(value_info);
+}
+
+
+static void share_info_ug_create_itcs()
+{
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE].func.text_get = share_info_ug_gl_group_title_label_get;
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NUMBER].func.text_get = share_info_ug_gl_number_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NUMBER].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NUMBER].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NUMBER].decorate_all_item_style = "edit_default";
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EMAIL].func.text_get = share_info_ug_gl_email_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EMAIL].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EMAIL].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EMAIL].decorate_all_item_style = "edit_default";
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_ADDRESS].func.text_get = share_info_ug_gl_address_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_ADDRESS].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_ADDRESS].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_ADDRESS].decorate_all_item_style = "edit_default";
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_MESSENGER].func.text_get = share_info_ug_gl_messenger_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_MESSENGER].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_MESSENGER].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_MESSENGER].decorate_all_item_style = "edit_default";
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_WEBSITE].func.text_get = share_info_ug_gl_website_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_WEBSITE].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_WEBSITE].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_WEBSITE].decorate_all_item_style = "edit_default";
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EVENT].func.text_get = share_info_ug_gl_event_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EVENT].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EVENT].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EVENT].decorate_all_item_style = "edit_default";
+
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NOTE].func.text_get = share_info_ug_gl_note_label_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NOTE].func.content_get = share_info_ug_gl_content_get;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NOTE].func.del = share_info_ug_gl_del;
+ share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NOTE].decorate_all_item_style = "edit_default";
+
+}
+
+static void share_info_ug_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ ct_value_info *value_info = data;
+ ct_share_info_ug_data *cshare_info_d;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ value_info->checked = !value_info->checked;
+ elm_genlist_item_fields_update(item, "elm.edit.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT);
+
+ cshare_info_d = evas_object_data_get(obj, KEY_SHARE_INFO_UG_DATA);
+ share_info_ug_check_changed_cb(cshare_info_d, obj, NULL);
+}
+
+static void share_info_ug_fill_number_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ Eina_List *l;
+ Eina_List *list;
+ contacts_record_h record = NULL;
+ ct_value_info *value_info;
+
+ list = ctui_person_get_number_list(list_contacts);
+ p_retm_if(NULL == list, "ctui_person_get_number_list() return NULL");
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_NUMBER), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+
+ EINA_LIST_FOREACH(list, l, record) {
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_number._uri;
+ value_info->record = record;
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NUMBER],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+ eina_list_free(list);
+}
+
+static void share_info_ug_fill_email_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ Eina_List *l;
+ Eina_List *list;
+ contacts_record_h record = NULL;
+ ct_value_info *value_info;
+
+ list = ctui_person_get_email_list(list_contacts);
+ p_retm_if(NULL == list, "ctui_person_get_email_list() return NULL");
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_EMAIL), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+
+ EINA_LIST_FOREACH(list, l, record) {
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_email._uri;
+ value_info->record = record;
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EMAIL],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+ eina_list_free(list);
+}
+
+static void share_info_ug_fill_address_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ Eina_List *l;
+ Eina_List *list;
+ contacts_record_h record = NULL;
+ ct_value_info *value_info;
+
+ list = ct_detail_person_get_postal_list(list_contacts);
+ p_retm_if(NULL == list, "ct_detail_person_get_postal_list() return NULL");
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_POSTAL_ADDRESS), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+
+ EINA_LIST_FOREACH(list, l, record) {
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_address._uri;
+ value_info->record = record;
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_ADDRESS],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+ eina_list_free(list);
+}
+
+static void share_info_ug_fill_messenger_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ Eina_List *l;
+ Eina_List *list;
+ contacts_record_h record = NULL;
+ ct_value_info *value_info;
+
+ list = ct_detail_person_get_messenger_list(list_contacts);
+ p_retm_if(NULL == list, "ct_detail_person_get_messenger_list() return NULL");
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_INSTANT_MESSENGER), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+
+ EINA_LIST_FOREACH(list, l, record) {
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_messenger._uri;
+ value_info->record = record;
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_MESSENGER],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+ eina_list_free(list);
+}
+
+static void share_info_ug_fill_website_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ Eina_List *l;
+ Eina_List *list;
+ contacts_record_h record = NULL;
+ ct_value_info *value_info;
+
+ list = ct_detail_person_get_website_list(list_contacts);
+ p_retm_if(NULL == list, "ct_detail_person_get_website_list() return NULL");
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_URL), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+
+ EINA_LIST_FOREACH(list, l, record) {
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_url._uri;
+ value_info->record = record;
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_WEBSITE],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+ eina_list_free(list);
+}
+
+
+static void share_info_ug_fill_event_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ Eina_List *l;
+ Eina_List *list;
+ contacts_record_h record = NULL;
+ ct_value_info *value_info;
+
+ list = ct_detail_person_get_event_list(list_contacts);
+ p_retm_if(NULL == list, "ct_detail_person_get_event_list() return NULL");
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_EVENT), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+
+ EINA_LIST_FOREACH(list, l, record) {
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_event._uri;
+ value_info->record = record;
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_EVENT],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+ eina_list_free(list);
+}
+
+static void share_info_ug_fill_note_list(Evas_Object *genlist, Eina_List *list_contacts)
+{
+ bool group_title_added = false;
+ Eina_List *l;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_record_h record_contact = NULL;
+ ct_value_info *value_info;
+
+ EINA_LIST_FOREACH(list_contacts, l, record_contact) {
+ if (NULL == record_contact) continue;
+
+ err = contacts_record_get_child_record_at_p(record_contact, _contacts_contact.note, 0, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_child_record_at_p() Failed(%d)", err);
+ continue;
+ }
+
+ value_info = calloc(1, sizeof(ct_value_info));
+ if (NULL == value_info) {
+ ERR("calloc() return NULL");
+ continue;
+ }
+ value_info->view_uri = _contacts_note._uri;
+ value_info->record = record;
+
+ if (!group_title_added) {
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_GROUP_TITLE],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_NOTE), NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ group_title_added = true;
+ }
+
+ elm_genlist_item_append(genlist, &share_info_ug_itcs[CT_SHARE_INFO_UG_ITC_NOTE],
+ value_info, NULL, ELM_GENLIST_ITEM_NONE, share_info_ug_sel, value_info);
+ }
+}
+
+static void share_info_ug_fill_layout(ct_share_info_ug_data *cshare_info_d, int person_id)
+{
+ Eina_List *list_contacts;
+ Evas_Object *genlist;
+
+ p_retm_if(NULL == cshare_info_d, "parameter(cshare_info_d) is NULL");
+ genlist = cshare_info_d->genlist;
+
+ cshare_info_d->person_id = person_id;
+ cshare_info_d->formatter = ct_detail_init_time_formatter();
+
+ list_contacts = ctui_person_get_contact_list(person_id);
+ p_retm_if(NULL == list_contacts, "ctui_person_get_contact_list() return NULL");
+ cshare_info_d->list_contacts = list_contacts;
+
+ share_info_ug_create_itcs();
+ share_info_ug_fill_number_list(genlist, list_contacts);
+ share_info_ug_fill_email_list(genlist, list_contacts);
+ share_info_ug_fill_address_list(genlist, list_contacts);
+ share_info_ug_fill_messenger_list(genlist, list_contacts);
+ share_info_ug_fill_website_list(genlist, list_contacts);
+ share_info_ug_fill_event_list(genlist, list_contacts);
+ share_info_ug_fill_note_list(genlist, list_contacts);
+}
+
+static void share_info_ug_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_share_info_ug_data *cshare_info_d = data;
+ p_retm_if(NULL == cshare_info_d, "paramter(cshare_info_d) is NULL");
+
+ if (cshare_info_d->formatter)
+ udat_close(cshare_info_d->formatter);
+
+ ctui_free_record_list(cshare_info_d->list_contacts);
+
+ free(cshare_info_d);
+}
+
+static void share_info_ug_append_value_str(ct_value_info *value_info, UDateFormat* formatter, char *buf, int buf_len)
+{
+ int date;
+ int day;
+ int mon;
+ int year;
+ int type_int;
+ char *text;
+ char *date_str;
+ char temp[PH_TEXT_MAX_LEN];
+ char temp_str[PH_TEXT_MAX_LEN];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == value_info, "parameter(value_info) is NULL");
+
+ if (0 == strcmp(value_info->view_uri, _contacts_number._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_int(value_info->record, _contacts_number.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ ctui_get_number_type_str(value_info->record, type_int, temp_str, sizeof(temp_str));
+
+ err = contacts_record_get_str_p(value_info->record, _contacts_number.number, &text);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, temp_str, SAFE_STR(text));
+ snprintf(buf, buf_len, "%s", temp);
+ }
+ else if (0 == strcmp(value_info->view_uri, _contacts_email._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_int(value_info->record, _contacts_email.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(value_info->record, _contacts_email.email, &text);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(type_int)), SAFE_STR(text));
+ snprintf(buf, buf_len, "%s", temp);
+ }
+ else if (0 == strcmp(value_info->view_uri, _contacts_address._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_int(value_info->record, _contacts_address.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ ct_detail_get_full_addr(value_info->record, temp_str, sizeof(temp_str));
+
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, T_(CT_GET_TEXT_POSTAL_TYPE, ct_detail_get_address_type_index(type_int)), temp_str);
+ snprintf(buf, buf_len, "%s", temp);
+ }
+ else if (0 == strcmp(value_info->view_uri, _contacts_messenger._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_int(value_info->record, _contacts_messenger.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(value_info->record, _contacts_messenger.im_id, &text);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, T_(CT_GET_TEXT_IM_TYPE, type_int), SAFE_STR(text));
+ snprintf(buf, buf_len, "%s", temp);
+ }
+ else if (0 == strcmp(value_info->view_uri, _contacts_url._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_int(value_info->record, _contacts_url.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(value_info->record, _contacts_url.url, &text);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, T_(CT_GET_TEXT_WEBSITE_TYPE, ct_detail_get_website_type_index(type_int)), SAFE_STR(text));
+ snprintf(buf, buf_len, "%s", temp);
+ }
+ else if (0 == strcmp(value_info->view_uri, _contacts_event._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_int(value_info->record, _contacts_event.type, &type_int);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_int(value_info->record, _contacts_event.date, &date);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ day = date%100;
+ mon = (date%10000)/100;
+ year = date/10000;
+
+ date_str = ct_detail_get_datetime_str(formatter, year, mon, day);
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, T_(CT_GET_TEXT_EVENT_TYPE, type_int), SAFE_STR(date_str));
+ snprintf(buf, buf_len, "%s", temp);
+ free(date_str);
+ }
+ else if (0 == strcmp(value_info->view_uri, _contacts_note._uri)) {
+ temp_str[0] = '\0';
+
+ err = contacts_record_get_str_p(value_info->record, _contacts_note.note, &text);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(temp, sizeof(temp), "%s%s\n%s\n", buf, T_(CT_GET_TEXT_BASIC, CTTEXT_NOTE), SAFE_STR(text));
+ snprintf(buf, buf_len, "%s", temp);
+ }
+}
+
+static void share_info_ug_get_person_str(Evas_Object *genlist, UDateFormat* formatter, char *buf, int buf_len)
+{
+ Elm_Object_Item *item;
+ Elm_Genlist_Item_Type type;
+ ct_value_info *value_info;
+
+ p_retm_if(NULL == genlist, "parameter(genlist) is NULL");
+ p_retm_if(NULL == buf, "parameter(buf) is NULL");
+
+ item = elm_genlist_first_item_get(genlist);
+ while (item) {
+ value_info = elm_object_item_data_get(item);
+ type = elm_genlist_item_type_get(item);
+
+ item = elm_genlist_item_next_get(item);
+ if (ELM_GENLIST_ITEM_GROUP == type) continue;
+
+ if (NULL == value_info) {
+ ERR("elm_object_item_data_get() return NULL");
+ continue;
+ }
+
+ if (value_info->checked)
+ share_info_ug_append_value_str(value_info, formatter, buf, buf_len);
+ }
+ return;
+}
+
+static void share_info_ug_get_person_display_name(int person_id, char *buf, int buf_len)
+{
+ char *display_name;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_record(_contacts_person._uri, person_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.display_name, &display_name);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ snprintf(buf, buf_len, "%s\n", SAFE_STR(display_name));
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+}
+
+static void share_info_ug_save_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char buf[PH_TEXT_MAX_LEN*10];
+ service_h service;
+ ct_share_info_ug_data *cshare_info_d = data;
+ p_retm_if(NULL == cshare_info_d, "parameter(ct_share_info_ug_data) is NULL");
+ service_create(&service);
+
+ buf[0] = '\0';
+ share_info_ug_get_person_display_name(cshare_info_d->person_id, buf, sizeof(buf));
+ share_info_ug_get_person_str(cshare_info_d->genlist, cshare_info_d->formatter, buf, sizeof(buf));
+ if (*buf)
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_PERSON_INFO, buf);
+ ug_send_result(cshare_info_d->ug, service);
+ service_destroy(service);
+ ug_destroy_me(cshare_info_d->ug);
+}
+
+static void share_info_ug_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *navi = data;
+ elm_naviframe_item_pop(navi);
+}
+
+static void share_info_ug_select_all_changed_cb(void *data, Eina_Bool checked)
+{
+ Elm_Object_Item *item;
+ Elm_Genlist_Item_Type type;
+ ct_value_info *value_info;
+ ct_share_info_ug_data *cshare_info_d = data;
+
+ item = elm_genlist_first_item_get(cshare_info_d->genlist);
+ while (item) {
+ value_info = elm_object_item_data_get(item);
+ type = elm_genlist_item_type_get(item);
+
+ item = elm_genlist_item_next_get(item);
+ if (ELM_GENLIST_ITEM_GROUP == type) continue;
+
+ if (NULL == value_info) {
+ ERR("elm_object_item_data_get() return NULL");
+ continue;
+ }
+ value_info->checked = checked;
+ }
+ elm_genlist_realized_items_update(cshare_info_d->genlist);
+}
+
+API void ctui_create_share_info_ug_layout(Evas_Object *navi, int person_id, ui_gadget_h ug)
+{
+ Evas_Object *btn;
+ Evas_Object *base;
+ Evas_Object *box;
+ Evas_Object *genlist;
+ Evas_Object *toolbar;
+ Evas_Object *select_all_layout;
+ Evas_Object *done_button;
+ Elm_Object_Item *navi_item;
+ ct_share_info_ug_data *cshare_info_d;
+
+ base = phone_create_base_layout(navi, false);
+ evas_object_show(base);
+
+ box = elm_box_add(base);
+ p_retm_if(NULL == box, "elm_box_add() return NULL");
+ evas_object_show(box);
+
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(base, "elm.swallow.content", box);
+
+ genlist = elm_genlist_add(box);
+ p_retm_if(NULL == genlist, "elm_genlist_add() return NULL");
+ evas_object_show(genlist);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ 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);
+ elm_box_pack_end(box, genlist);
+ elm_genlist_decorate_mode_set(genlist, EINA_TRUE);
+
+ cshare_info_d = calloc(1, sizeof(ct_share_info_ug_data));
+ p_retm_if(NULL == cshare_info_d, "calloc() return NULL");
+ cshare_info_d->ug = ug;
+ cshare_info_d->navi = navi;
+ cshare_info_d->genlist = genlist;
+ evas_object_data_set(genlist, KEY_SHARE_INFO_UG_DATA, cshare_info_d);
+
+ share_info_ug_fill_layout(cshare_info_d, person_id);
+ evas_object_event_callback_add(base, EVAS_CALLBACK_DEL, share_info_ug_delete_cb, cshare_info_d);
+
+ select_all_layout = phone_create_select_all(box, S_(PH_SYS_BODY_SELECT_ALL), share_info_ug_select_all_changed_cb, cshare_info_d);
+ elm_box_pack_start(box, select_all_layout);
+ cshare_info_d->select_all_layout = select_all_layout;
+
+ navi_item = elm_naviframe_item_push(navi, T_(CT_GET_TEXT_BASIC, CTTEXT_SHARE_CONTACT_INFO), NULL, NULL, base, NULL);
+ toolbar = elm_toolbar_add(navi);
+ elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+ elm_object_item_part_content_set(navi_item , "controlbar", toolbar);
+
+ btn = elm_button_add(navi);
+ elm_object_style_set(btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(btn, "clicked", share_info_ug_cancel_cb, cshare_info_d->navi);
+ elm_object_item_part_content_set(navi_item, "prev_btn", btn);
+
+ done_button = phone_create_toolbar_btn(navi, S_(CT_SYS_SK_DONE), share_info_ug_save_cb, cshare_info_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", done_button);
+}
+
diff --git a/lib/details/include/ct-detail.h b/lib/details/include/ct-detail.h
new file mode 100755
index 0000000..d620901
--- /dev/null
+++ b/lib/details/include/ct-detail.h
@@ -0,0 +1,39 @@
+/*
+* 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_H__
+#define __CONTACTS_DETAIL_H__
+
+#include "phone-common.h"
+
+#define CT_DETAIL_DEFAULT_NUM_COLOR 213, 129, 31, 255
+#define CT_DETAIL_IMAGE_SIZE 128
+#define CT_DETAIL_RESET_BUTTON_SIZE 32
+#define CT_VCARD_FILE_MAX_SIZE 1024*1024
+
+int ctui_create_detail_view(ct_list_data *clist_d, ct_person_list *person_info);
+void ct_detail_view_language_changed(ct_detail_data *cdetail_d);
+int ctui_create_input_view(ct_detail_data *cdetail_d);
+int ctui_create_detail_view_from_phone(Evas_Object *win, Evas_Object *navi, ui_gadget_h ug, int id);
+void ctui_create_share_info_ug_layout(Evas_Object *navi, int person_id, ui_gadget_h ug);
+
+Evas_Object* ctui_contacts_viewer(Evas_Object *win, Evas_Object *navi, int personid_vcardidx, const char *vcard_path);
+Evas_Object* ctui_detail_genlist_update(ct_detail_data *cdetail_d);
+
+
+
+#endif //__CONTACTS_DETAIL_H__
diff --git a/lib/dialer/CMakeLists.txt b/lib/dialer/CMakeLists.txt
new file mode 100755
index 0000000..01eee54
--- /dev/null
+++ b/lib/dialer/CMakeLists.txt
@@ -0,0 +1,23 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${PH_DIALER})
+
+FILE(GLOB SRCS *.c)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(dialer_pkgs REQUIRED tapi feedback)
+
+FOREACH(flag ${dialer_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+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} ${ug_pkgs_LDFLAGS} ${SPEEDDIAL} ${dialer_pkgs_LDFLAGS})
+
+ADD_DEPENDENCIES(${TARGET} dialer_edj_build dialer_theme_build)
+
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/dialer/dialer-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/dialer/dialer-efl.desktop.in b/lib/dialer/dialer-efl.desktop.in
new file mode 100644
index 0000000..ea965ed
--- /dev/null
+++ b/lib/dialer/dialer-efl.desktop.in
@@ -0,0 +1,10 @@
+Name=dialer-efl
+Exec=/opt/ug/bin/dialer-efl
+Icon=
+Type=Application
+Version=0.1.0-0
+NoDisplay=true
+X-TIZEN-Multiple=true
+X-TIZEN-TaskManage=false
+X-TIZEN-Removable=true
+X-TIZEN-SVC=http://tizen.org/appsvc/operation/test|NULL|NULL
diff --git a/lib/dialer/dialer-efl.xml b/lib/dialer/dialer-efl.xml
new file mode 100644
index 0000000..e663033
--- /dev/null
+++ b/lib/dialer/dialer-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="dialer-efl" version="0.1.0-0" install-location="internal-only">
+ <label>dialer</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>dialer-efl Application</description>
+ <ui-application appid="dialer-efl" exec="/usr/ug/bin/dialer-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.phone.png</icon>
+ <label>dialer</label>
+ <label xml:lang="en-us">dialer</label>
+ <label xml:lang="nl-nl">dialer</label>
+ <label xml:lang="de-de">dialer</label>
+ <label xml:lang="en-gb">dialer</label>
+ <label xml:lang="zh-hk">dialer</label>
+ <label xml:lang="zh-cn">dialer</label>
+ <label xml:lang="ru-ru">dialer</label>
+ <label xml:lang="zh-tw">dialer</label>
+ <label xml:lang="ja-jp">dialer</label>
+ <label xml:lang="es-es">dialer</label>
+ <label xml:lang="el-gr">dialer</label>
+ <label xml:lang="it-it">dialer</label>
+ <label xml:lang="tr-tr">dialer</label>
+ <label xml:lang="pt-pt">dialer</label>
+ <label xml:lang="fr-fr">dialer</label>
+ <label xml:lang="ko-kr">dialer</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/lib/dialer/include/phone-dialer.h b/lib/dialer/include/phone-dialer.h
new file mode 100755
index 0000000..5326e4b
--- /dev/null
+++ b/lib/dialer/include/phone-dialer.h
@@ -0,0 +1,138 @@
+/*
+* 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_DIALER_H__
+#define __PHONE_DIALER_H__
+
+#include "phone-common.h"
+
+#define MAX_DIAL_NUMBER_FONT_SIZE 100
+#define MIN_DIAL_NUMBER_FONT_SIZE 67
+
+#define CURSOR_BEGIN -1
+#define CURSOR_END -2
+
+#define PH_TAG_TEXT_MAX_LEN (PH_TEXT_MAX_LEN*2)
+
+
+enum PH_DAILER_TYPES {
+ PH_DAILER_NORMAL = 0,
+ PH_DAILER_DURING_CALL,
+ PH_DAILER_EMERGENCY
+};
+
+enum {
+ CONTACT_DATA_CHAGNED = 1 << 0,
+ LOG_DATA_CHAGNED = 1 << 1,
+ SPEEDDIAL_DATA_CHAGNED = 1 << 2,
+};
+
+typedef enum {
+ MODE_DIAL_NUMBER = 0,
+ MODE_COUNTRY_CODE
+} ListMode;
+
+typedef enum {
+ DASH_REAL = 1,
+ DASH_PREVIEW = DASH_REAL
+} DashMode;
+
+typedef struct _InputNumber {
+ char num;
+
+ struct _InputNumber *prev;
+ struct _InputNumber *next;
+} InputNumber;
+
+typedef struct {
+ bool alive;
+ bool success;
+ bool completed;
+ pthread_t thread;
+ Ecore_Pipe *epipe;
+} ph_thread_info;
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *layout;
+ Evas_Object *entry;
+ Evas_Object *navi;
+ Evas_Object *genlist;
+ Evas_Object *fast_index;
+ Evas_Object *count_button;
+ Evas_Object *count_layout;
+ Evas_Object *popup;
+ Ecore_Timer *search_timer;
+ Ecore_Timer *dash_timer;
+ Ecore_Timer *longpress_timer;
+ Ecore_Timer *update_timer;
+ Ecore_Timer *slide_timer;
+ Ecore_Job *job;
+ Ecore_Idler *search_idler;
+ Ecore_Event_Handler *key_press;
+ Ecore_Event_Handler *key_release;
+ char *longpress_source;
+ char *searched_text;
+ char* selected_text;
+ InputNumber number_head;
+ InputNumber *number_cursor;
+ int cur_mcc;
+ int cur_sim_mcc;
+ int cur_cc_index;
+ int roaming;
+ int entry_font_size;
+ int count_button_status;
+ int run_mode;
+ int compare_N;
+ int show_N;
+ int searched_speed_id;
+ int data_dirty_flag;
+ int touch_x;
+ int touch_y;
+ ListMode list_mode;
+ bool is_background;
+ bool is_emergency;
+ bool cursor_changed;
+ bool is_show_items;
+ bool has_focus;
+ bool initialized;
+ bool searching;
+ bool loading;
+ bool slide;
+ ph_thread_info *t_info; // load contact
+ Eina_List *search_list;
+ Eina_List *contact_list;
+ Eina_List *speeddial_list;
+ Eina_List *log_list;
+ Eina_List *cc_list;
+ Eina_List *cc_list_sorted;
+ void *ug;
+ void *child_ug;
+ Elm_Theme *th;
+}ph_dialer_data;
+
+Evas_Object* phone_create_dialer_view(ph_view_info *view_info);
+void phone_dialer_set_navi(Evas_Object *layout);
+void phone_dialer_check_focus(Evas_Object *base);
+void phone_dialer_view_reset(Evas_Object *base);
+void phone_dialer_view_language_changed(Evas_Object *layout);
+void phone_dialer_view_resume(Evas_Object *base);
+void phone_dialer_set_background(Evas_Object *obj, bool is_background);
+void phone_dialer_view_set_num(Evas_Object *layout, char *number);
+void phone_dialer_view_send_key(Evas_Object *layout);
+
+#endif /* __PHONE_DIALER_H__ */
diff --git a/lib/dialer/ph-dialer-main.c b/lib/dialer/ph-dialer-main.c
new file mode 100755
index 0000000..b0b19a8
--- /dev/null
+++ b/lib/dialer/ph-dialer-main.c
@@ -0,0 +1,216 @@
+/*
+* 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 <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-dialer.h"
+
+#include "ph-dialer-view.h"
+#include "ph-dialer-utils.h"
+
+static bool is_ug_exist = false;
+
+// for removing build warning ////////////////////////////////////
+int service_export_as_bundle(service_h service, bundle **data);
+////////////////////////////////////////////////////////
+
+static bool dialer_create_ug_view(ph_dialer_data *dial_d, Evas_Object *base)
+{
+ int ret;
+ const char *title;
+ p_retvm_if(NULL == dial_d, false, "Parameter is null");
+
+ if (NULL == dial_d->navi) {
+ dial_d->navi = elm_naviframe_add(base);
+ p_retvm_if(NULL == dial_d->navi, false, "elm_naviframe_add is failed");
+ elm_object_part_content_set(base, "elm.swallow.content", dial_d->navi);
+ evas_object_show(dial_d->navi);
+ }
+
+ ret = ph_dialer_create_content(dial_d);
+ p_retvm_if(ret < 0, false, "Fail to ph_dialer_create_content");
+ if (dial_d->is_emergency)
+ title = T_(PH_GET_TEXT_BASIC, PHTEXT_EMERGENCY_CALL);
+ else
+ title = T_(PH_GET_TEXT_BASIC, PHTEXT_KEYPAD);
+
+ elm_naviframe_item_push(dial_d->navi, title, NULL, NULL, dial_d->layout, NULL);
+
+ return true;
+}
+
+void* dialer_on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ int ret;
+ char *val = NULL;
+ Evas_Object *bg;
+ Evas_Object *parent;
+ Evas_Object *base;
+ ph_dialer_data *dial_d = priv;
+ bundle *data;
+
+ p_retvm_if(true == is_ug_exist, NULL, "dialer_emergency ug already exist");
+ is_ug_exist = true;
+
+ p_retvm_if(NULL == ug || NULL == priv, NULL,
+ "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
+
+ parent = ug_get_parent_layout(ug);
+ p_retvm_if(NULL == parent, NULL, "ug_get_parent_layout() return NULL");
+ dial_d->ug = ug;
+ dial_d->win = ug_get_window();
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ service_export_as_bundle(service, &data);
+ ret = contacts_connect2();
+ if (CONTACTS_ERROR_NONE != ret)
+ {
+ bundle_free(data);
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_connect2() Failed(%d)", ret);
+ return NULL;
+ }
+
+ val = (char*)bundle_get_val(data, "emergency_dialer");
+ if (val && 0 == strcmp(val, "emergency"))
+ dial_d->is_emergency = true;
+ else
+ dial_d->is_emergency = false;
+ bundle_free(data);
+
+ if (UG_MODE_FULLVIEW == mode)
+ base = phone_create_base_layout(parent, true);
+ else
+ base = phone_create_base_layout(parent, false);
+
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ PH_DBG("phone_create_bg() return NULL");
+ evas_object_del(base);
+ ret = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_disconnect2() Failed(%d)", ret);
+ return NULL;
+ }
+
+ if (!dialer_create_ug_view(dial_d, base)) {
+ evas_object_del(base);
+ ret = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_disconnect2() Failed(%d)", ret);
+ base = NULL;
+ }
+ return base;
+}
+
+static void dialer_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ ph_dialer_data *dial_d = priv;
+
+ switch (event) {
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ phone_dialer_view_language_changed(dial_d->layout);
+ break;
+ default:
+ break;
+ }
+}
+
+static void dialer_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ ph_dialer_data *dial_d = priv;
+ dial_d->is_background = true;
+}
+
+static void dialer_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ ph_dialer_data *dial_d = priv;
+ dial_d->is_background = false;
+ if (dial_d->update_timer) {
+ ecore_timer_del(dial_d->update_timer);
+ dial_d->update_timer = NULL;
+ ph_dialer_reload_data(dial_d);
+ }
+}
+
+static void dialer_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ if (!ug)
+ return;
+
+ evas_object_del(ug_get_layout(ug));
+ contacts_disconnect2();
+}
+
+static void dialer_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ph_dialer_data *dial_d;
+ p_retvm_if(NULL == ops, -1, "ops is NULL");
+
+ dial_d = calloc(1, sizeof(ph_dialer_data));
+ p_retvm_if(NULL == dial_d, -1, "dial_d is NULL, Not enough memory");
+
+ ops->create = dialer_on_create;
+ ops->start = NULL;
+ ops->pause = dialer_on_pause;
+ ops->resume = dialer_on_resume;
+ ops->destroy = dialer_on_destroy;
+ ops->message = dialer_on_message;
+ ops->event = dialer_on_event;
+ ops->priv = dial_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 Evas_Object* phone_create_dialer_view(ph_view_info *view_info)
+{
+ ph_dialer_data *dial_d;
+ p_retvm_if(NULL == view_info, NULL, "The parameter(view_info) is NULL");
+
+ dial_d = calloc(1, sizeof(ph_dialer_data));
+ p_retvm_if(NULL == dial_d, NULL, "dial_d is NULL, Not enough memory");
+ dial_d->ug = view_info->ug;
+ dial_d->win = view_info->win;
+ dial_d->navi = view_info->navi;
+ dial_d->is_emergency = false;
+ dial_d->is_background = true;
+
+ if (!ph_dialer_create_content(dial_d)) {
+ free(dial_d);
+ return NULL;
+ }
+ return dial_d->layout;
+}
+
diff --git a/lib/dialer/ph-dialer-search.c b/lib/dialer/ph-dialer-search.c
new file mode 100755
index 0000000..3f6804d
--- /dev/null
+++ b/lib/dialer/ph-dialer-search.c
@@ -0,0 +1,38 @@
+/*
+* 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 <feedback.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include <app_manager.h>
+
+#include "phone.h"
+#include "phone-dialer.h"
+#include "ph-dialer-utils.h"
+#include "ph-dialer-view.h"
+#include "ph-dialer-search.h"
+#include "ph-dialer-tapi.h"
+
+
+void ph_dialer_search_request(void *data, int force_search)
+{
+ PH_FN_CALL;
+ return;
+}
+
diff --git a/lib/dialer/ph-dialer-search.h b/lib/dialer/ph-dialer-search.h
new file mode 100755
index 0000000..6ab89de
--- /dev/null
+++ b/lib/dialer/ph-dialer-search.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 __PH_DIALER_SEARCH_H__
+#define __PH_DIALER_SEARCH_H__
+
+void ph_dialer_search_request(void *data, int force_search);
+void ph_dialer_search_result_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
+void ph_dialer_search_free_search_data(ph_dialer_data *dial_d);
+void ph_dialer_search_free_log_data(ph_dialer_data *dial_d);
+void ph_dialer_search_free_cc_data(ph_dialer_data *dial_d);
+void ph_dialer_search_find_cur_sim_cc(ph_dialer_data *dial_d);
+void ph_dialer_search_fill_genlist_by_list(ph_dialer_data *dial_d);
+void ph_dialer_search_fill_genlist_by_cc_list(ph_dialer_data *dial_d);
+void ph_dialer_search_set_genlist_item_style();
+
+#endif /* __PH_DIALER_SEARCH_H__ */
diff --git a/lib/dialer/ph-dialer-tapi.c b/lib/dialer/ph-dialer-tapi.c
new file mode 100755
index 0000000..5aa5a64
--- /dev/null
+++ b/lib/dialer/ph-dialer-tapi.c
@@ -0,0 +1,503 @@
+/*
+* 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 <tapi_common.h>
+#include <ITapiSim.h>
+#include <ITapiPhonebook.h>
+#include <TapiUtility.h>
+#include <regex.h>
+
+#include "phone.h"
+#include "phone-dialer.h"
+#include "ph-dialer-utils.h"
+
+#ifdef Status
+ #undef Status
+#endif
+
+static TapiHandle *handle = NULL;
+
+typedef enum {
+ SIM_INCORRECT_PIN1_CODE,
+ SIM_INCORRECT_PIN2_CODE,
+ SIM_PIN1_CHANGE_SUCCESS,
+ SIM_PIN2_CHANGE_SUCCESS,
+ SIM_PIN1_BLOCKED,
+ SIM_PIN2_BLOCKED,
+} sim_stat_value;
+
+typedef enum {
+ TYPE_PIN1 = 0,
+ TYPE_PIN2,
+} pin_type_value;
+typedef struct _tapi_receive_info {
+ sim_stat_value stat;
+ int retry_cnt;
+} tapi_receive_info;
+
+#define PIN1_REGEX "^\\*\\*04\\*[0-9]{4}\\*[0-9]{4}\\*[0-9]{4}#$"
+#define PIN2_REGEX "^\\*\\*042\\*[0-9]{4}\\*[0-9]{4}\\*[0-9]{4}#$"
+#define PUK_REGEX "\\*\\*05\\*[0-9]{8}\\*[0-9]{4}\\*[0-9]{4}#$"
+
+
+int dialer_tapi_init()
+{
+ handle = tel_init(NULL);
+ if (NULL == handle)
+ return FALSE;
+ return TRUE;
+}
+
+int dialer_tapi_deinit()
+{
+ int ret = tel_deinit(handle);
+ handle = NULL;
+ return ret;
+}
+
+int dialer_check_pin_str(const char* number, char **old_pin, char **new_pin, char **com_pin, int* pin_type)
+{
+ PH_FN_CALL;
+ regex_t fsm;
+ regmatch_t str[strlen(number)+1];
+ char* origin_string;
+ char * str_temp;
+
+ if(regcomp(&fsm, PIN1_REGEX, REG_EXTENDED))
+ {
+ PH_DBG("regular expression fail");
+ regfree(&fsm);
+ return FALSE;
+ }
+ else {
+ if(regexec(&fsm, number, strlen(number)+1, str, 0) == REG_NOMATCH)
+ {
+ PH_DBG("regular expression 1 matching fail");
+ regfree(&fsm);
+ }
+ else
+ {
+ PH_DBG("regular expression 1 matching success");
+ origin_string = strdup(number);
+ str_temp = origin_string + 5;
+ *old_pin = strdup(strtok(str_temp, "*"));
+ *new_pin = strdup(strtok(NULL, "*"));
+ *com_pin = strdup(strtok(NULL, "#"));
+ *pin_type = TYPE_PIN1;
+ free(origin_string);
+ regfree(&fsm);
+ return TRUE;
+ }
+ }
+
+ if(regcomp(&fsm, PIN2_REGEX, REG_EXTENDED))
+ {
+ PH_DBG("regular expression fail");
+ regfree(&fsm);
+ return FALSE;
+ }
+ else
+ {
+ if(regexec(&fsm, number, strlen(number)+1, str, 0) == REG_NOMATCH)
+ {
+ PH_DBG("regular expression 2 matching fail");
+ regfree(&fsm);
+ }
+ else
+ {
+ PH_DBG("regular expression 2 matching success");
+ origin_string = strdup(number);
+ str_temp = origin_string + 5;
+ *old_pin = strdup(strtok(str_temp, "*"));
+ *new_pin = strdup(strtok(NULL, "*"));
+ *com_pin = strdup(strtok(NULL, "#"));
+ *pin_type = TYPE_PIN2;
+ free(origin_string);
+ regfree(&fsm);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void dialer_pin_result_popup (tapi_receive_info* result, void* data)
+{
+ PH_FN_CALL;
+ Evas_Object *popup;
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+
+ popup = elm_popup_add(dial_d->win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ switch(result->stat)
+ {
+ case SIM_PIN1_CHANGE_SUCCESS :
+ case SIM_PIN2_CHANGE_SUCCESS :
+ phone_show_popup(dial_d->navi, S_(CT_SYS_POP_SUCCESS), 2.0);
+ break;
+ case SIM_INCORRECT_PIN1_CODE :
+ case SIM_INCORRECT_PIN2_CODE :
+ phone_show_popup(dial_d->navi, S_(PH_SYS_POP_INCORRECT_PASSWORD), 2.0);
+ break;
+ case SIM_PIN1_BLOCKED :
+ case SIM_PIN2_BLOCKED :
+ phone_show_popup(dial_d->navi, S_(PH_SYS_SK3_BLOCK), 2.0);
+ break;
+ default:
+ elm_object_text_set(popup, "dafault case called");
+ break;
+ }
+}
+
+
+void dialer_sim_change_pins_cb(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ PH_FN_CALL;
+ TelSimPinOperationResult_t sec_rt = result;
+ TelSimSecResult_t *sim_event_data = (TelSimSecResult_t *) data;
+ tapi_receive_info result_info = { 0, };
+
+ PH_DBG("sec_rt[%d]", sec_rt);
+ PH_DBG("sim_event_data->type:%d", sim_event_data->type);
+ PH_DBG("sim_event_data->retry_count[%d]", sim_event_data->retry_count);
+
+ if(sec_rt == TAPI_SIM_PIN_OPERATION_SUCCESS)
+ {
+ if(sim_event_data->type == TAPI_SIM_PTYPE_PIN1)
+ result_info.stat = SIM_PIN1_CHANGE_SUCCESS;
+ else if ( sim_event_data->type == TAPI_SIM_PTYPE_PIN2)
+ result_info.stat = SIM_PIN2_CHANGE_SUCCESS;
+ }
+ else if (sec_rt ==TAPI_SIM_PIN_INCORRECT_PASSWORD)
+ {
+ if (sim_event_data->type == TAPI_SIM_PTYPE_PIN1)
+ {
+ result_info.stat = SIM_INCORRECT_PIN1_CODE;
+ result_info.retry_cnt = sim_event_data->retry_count;
+ }
+ else if (sim_event_data->type == TAPI_SIM_PTYPE_PIN2)
+ {
+ result_info.stat = SIM_INCORRECT_PIN2_CODE;
+ result_info.retry_cnt = sim_event_data->retry_count;
+ }
+ }
+ else if (sec_rt == TAPI_SIM_PUK_REQUIRED)
+ {
+ if (sim_event_data->type == TAPI_SIM_PTYPE_PIN1)
+ result_info.stat = SIM_PIN1_BLOCKED;
+ else if (sim_event_data->type == TAPI_SIM_PTYPE_PIN2)
+ result_info.stat = SIM_PIN2_BLOCKED;
+ }
+ else {
+ ERR("INCORRECTED");
+ return;
+ }
+ dialer_pin_result_popup(&result_info, user_data);
+}
+
+
+void dialer_pin_operation(int type, const char *old_pin, const char *new_pin, void* data)
+{
+ PH_FN_CALL;
+ int tapi_ret = -100;
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+
+ char old_pw[PH_TEXT_MAX_LEN] = {0};
+ char new_pw[PH_TEXT_MAX_LEN]={0};
+
+ TelSimSecPw_t sim_old_sec_data = {0, };
+ TelSimSecPw_t sim_new_sec_data = {0, };
+
+ if(handle == NULL)
+ PH_DBG("tapi handle is null");
+
+ snprintf(old_pw, sizeof(old_pw), "%s", old_pin);
+ snprintf(new_pw, sizeof(new_pw), "%s", new_pin);
+
+ switch(type)
+ {
+ case TYPE_PIN1:
+ sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN1;
+ sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN1;
+ sim_old_sec_data.pw_len = STRLEN(old_pw);
+ sim_old_sec_data.pw = (unsigned char *)calloc(1, sim_old_sec_data.pw_len);
+ memcpy(sim_old_sec_data.pw, old_pw, sim_old_sec_data.pw_len);
+ sim_new_sec_data.pw_len = STRLEN(new_pw);
+ sim_new_sec_data.pw = (unsigned char *)calloc(1, sim_new_sec_data.pw_len);
+ memcpy(sim_new_sec_data.pw, new_pw, sim_new_sec_data.pw_len);
+ break;
+ case TYPE_PIN2:
+ sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN2;
+ sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN2;
+ sim_old_sec_data.pw_len = STRLEN(old_pw);
+ sim_old_sec_data.pw = (unsigned char *)calloc(1, sim_old_sec_data.pw_len);
+ memcpy(sim_old_sec_data.pw, old_pw, sim_old_sec_data.pw_len);
+ sim_new_sec_data.pw_len = STRLEN(new_pw);
+ sim_new_sec_data.pw = (unsigned char *)calloc(1, sim_new_sec_data.pw_len);
+ memcpy(sim_new_sec_data.pw, new_pw, sim_new_sec_data.pw_len);
+ break;
+ default:
+ ERR("Never get here(type: %d)", type);
+ break;
+ }
+
+ tapi_ret = tel_change_sim_pins(handle,&sim_old_sec_data,&sim_new_sec_data, dialer_sim_change_pins_cb, data);
+ PH_DBG("return_num:%d", tapi_ret);
+
+ if(tapi_ret != TAPI_API_SUCCESS)
+ {
+ ERR("TelTapiSimChangePIN err=%d ", tapi_ret);
+ phone_show_popup(dial_d->navi, S_(CT_SYS_POP_ERROR), 2.0);
+ }
+ free(sim_old_sec_data.pw);
+ free(sim_new_sec_data.pw);
+}
+
+
+int GCF_tapi_init()
+{
+ int status;
+ int ret;
+ TelSimPbList_t pb_list;
+
+ handle = tel_init(NULL);
+ if (NULL == handle)
+ return FALSE;
+
+ ret = tel_get_sim_pb_init_info(handle, &status, &pb_list);
+ if (TAPI_API_SUCCESS != ret)
+ {
+ ERR("tel_get_sim_pb_init_info() is failed(%d)", ret);
+ tel_deinit(handle);
+ handle = NULL;
+ return FALSE;
+ }
+
+ if (!status)
+ {
+ ERR("SIM is not available");
+ tel_deinit(handle);
+ handle = NULL;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int GCF_tapi_deinit()
+{
+ int ret = tel_deinit(handle);
+ handle = NULL;
+ return ret;
+}
+
+static void sim_async_response_verify_puk(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ PH_FN_CALL;
+ TelSimPinOperationResult_t sec_rt = result;
+ TelSimSecResult_t *pPinInfo = data;
+
+ if (sec_rt == TAPI_SIM_PIN_OPERATION_SUCCESS)
+ {
+ if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
+ {
+ ph_dialer_data *dial_d = user_data;
+ phone_show_popup(dial_d->navi, T_(PH_GET_TEXT_BASIC, PHTEXT_REQUEST_SUCCESS), 2.0);
+ }
+ else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
+ PH_DBG("Unblock PIN2 Success!");
+ }
+ else
+ {
+ if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
+ {
+ ph_dialer_data *dial_d = user_data;
+ phone_show_popup(dial_d->navi, T_(PH_GET_TEXT_BASIC, PHTEXT_REQUEST_FAIL), 2.0);
+ }
+ else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1 || pPinInfo->type == TAPI_SIM_PTYPE_PIN2 || pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
+ {
+ ERR("%d Verification Failed! - PIN Required", pPinInfo->type);
+ PH_DBG("Remainint attempts [%d]", pPinInfo->retry_count);
+ }
+ }
+
+ GCF_tapi_deinit();
+}
+
+void GCF_test_puk_operation(const char *puk1, const char *pin1, void *user_data)
+{
+ PH_FN_CALL;
+ char init_pin_val[PH_TEXT_MAX_LEN] = {0};
+ char init_puk_val[PH_TEXT_MAX_LEN]={0};
+
+ TelSimSecPw_t puk_data;
+ TelSimSecPw_t new_pin_data;
+ int ret;
+
+ memset(&puk_data, 0, sizeof(TelSimSecPw_t));
+ memset(&new_pin_data, 0, sizeof(TelSimSecPw_t));
+
+ PH_DBG("puk1:%s", puk1 );
+ PH_DBG("pin1: %s", pin1 );
+
+
+ snprintf(init_puk_val, sizeof(init_puk_val), "%s", puk1);
+ snprintf(init_pin_val, sizeof(init_pin_val), "%s", pin1);
+
+ puk_data.type = TAPI_SIM_PTYPE_PUK1; // 0x00
+ puk_data.pw_len = strlen(init_puk_val);
+ puk_data.pw = (unsigned char*)calloc(1, puk_data.pw_len);
+ memcpy(puk_data.pw, init_puk_val, puk_data.pw_len);
+
+ new_pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
+ new_pin_data.pw_len = strlen(init_pin_val);
+ new_pin_data.pw = (unsigned char*)calloc(1, new_pin_data.pw_len);
+ memcpy(new_pin_data.pw, init_pin_val, new_pin_data.pw_len);
+
+ ret = tel_verify_sim_puks(handle, &puk_data, &new_pin_data, sim_async_response_verify_puk, user_data);
+ if (ret != TAPI_API_SUCCESS)
+ {
+ ERR("TAPI API FAIL: Error Code [0x%x]", ret);
+ GCF_tapi_deinit();
+ }
+
+ free(puk_data.pw);
+ free(new_pin_data.pw);
+}
+
+static void sim_async_response_read_contact(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ PH_FN_CALL;
+ TelSimPbAccessResult_t sec_rt = result;
+ TelSimPbRecord_t *sim_acces_info = data;
+
+ if (sec_rt != TAPI_SIM_PB_SUCCESS)
+ {
+ ERR("SIM phone book access error [%d]", sec_rt);
+ GCF_tapi_deinit();
+ return;
+ }
+
+ if (sim_acces_info->phonebook_type == TAPI_SIM_PB_ADN) //KKC - ADN number value!
+ ph_dialer_util_show_matched_one_number(user_data, (char *)sim_acces_info->name, (char *)sim_acces_info->number);
+ else if (sim_acces_info->phonebook_type == TAPI_SIM_PB_3GSIM)
+ {
+ if(strlen(sim_acces_info->number) > 0)
+ ph_dialer_util_show_matched_one_number(user_data, (char *)sim_acces_info->name, (char*)(sim_acces_info->number));
+ if (sim_acces_info->anr1_ton == TAPI_SIM_TON_ABBREVIATED_NUMBER) //KKC - USIM ADN number value!
+ ph_dialer_util_show_matched_one_number(user_data, NULL, (char*)(sim_acces_info->anr1));
+ if (sim_acces_info->anr2_ton == TAPI_SIM_TON_ABBREVIATED_NUMBER) //KKC - USIM ADN number value!
+ ph_dialer_util_show_matched_one_number(user_data, NULL, (char*)(sim_acces_info->anr2));
+ if (sim_acces_info->anr3_ton == TAPI_SIM_TON_ABBREVIATED_NUMBER) //KKC - USIM ADN number value!
+ ph_dialer_util_show_matched_one_number(user_data, NULL, (char*)(sim_acces_info->anr3));
+ }
+ GCF_tapi_deinit();
+}
+
+void GCF_test_read_contact(int index, void *user_data)
+{
+ TelSimPbType_t pb_type = 0;
+ TelSimCardType_t card_type = 0;
+ int ret;
+
+ tel_get_sim_type(handle, &card_type);
+ if (card_type == TAPI_SIM_CARD_TYPE_GSM)
+ pb_type = TAPI_SIM_PB_ADN;
+ else if (card_type == TAPI_SIM_CARD_TYPE_USIM)
+ pb_type = TAPI_SIM_PB_3GSIM;
+
+ ret = tel_read_sim_pb_record(handle, pb_type, index, sim_async_response_read_contact, user_data);
+ if (ret != TAPI_API_SUCCESS) {
+ ERR("TAPI API FAIL: Error Code [0x%x]", ret);
+ GCF_tapi_deinit();
+ }
+}
+
+/* Gcf Puk1*/
+#define GCF_PUK1_PRE_VALUE "**05*"
+
+int GCF_check_puk_str(const char* number, char **dest_puk, char **dest_pin1, char **dest_pin2, int size_dest)
+{
+ PH_FN_CALL;
+ regex_t fsm;
+ regmatch_t str[strlen(number)+1];
+ char* origin_string;
+ char * str_temp;
+
+ if(regcomp(&fsm, PUK_REGEX, REG_EXTENDED))
+ {
+ PH_DBG("regular expression fail");
+ regfree(&fsm);
+ return FALSE;
+ }
+ else
+ {
+ if(regexec(&fsm, number, strlen(number)+1, str, 0) == REG_NOMATCH)
+ {
+ PH_DBG("matching fail");
+ regfree(&fsm);
+ }
+ else
+ {
+ PH_DBG("matching success");
+ origin_string = strdup(number);
+ str_temp = origin_string + 5;
+ *dest_puk = strdup(strtok(str_temp, "*"));
+ *dest_pin1 = strdup(strtok(NULL, "*"));
+ *dest_pin2 = strdup(strtok(NULL, "#"));
+ free(origin_string);
+ regfree(&fsm);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+bool GCF_check_admin_sim(const char *number, int *ret_index)
+{
+ int count;
+ char *dest;
+ bool success;
+ p_retvm_if(number==NULL || ret_index==NULL, FALSE, "Parameter is null");
+
+ count = strlen(number);
+ p_retvm_if(count < 2, FALSE, "number length is too short");
+ dest = (char*)calloc(1, count);
+
+ success = true;
+ if (number[count-1]=='#')
+ {
+ int i=0;
+ for (;i<count-1;i++)
+ {
+ if ('0' <= number[i] && number[i] <= '9')
+ dest[i] = number[i];
+ else
+ {
+ success = false;
+ break;
+ }
+ }
+ if (success)
+ *ret_index = atoi(dest);
+ }
+ else
+ success = false;
+ free(dest);
+
+ return success;
+}
+
diff --git a/lib/dialer/ph-dialer-tapi.h b/lib/dialer/ph-dialer-tapi.h
new file mode 100755
index 0000000..5b6d98f
--- /dev/null
+++ b/lib/dialer/ph-dialer-tapi.h
@@ -0,0 +1,28 @@
+/*
+* 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 __PH_DIALER_TAPI_H__
+#define __PH_DIALER_TAPI_H__
+
+int GCF_tapi_init();
+int GCF_tapi_deinit();
+void GCF_test_puk_operation(const char *puk1, const char *pin1, void *user_data);
+void GCF_test_read_contact(int index, void *user_data);
+int GCF_check_puk1_str(const char *number, char *dest_puk, char *dest_pin1, char *dest_pin2, int size_dest);
+bool GCF_check_admin_sim(const char *number, int *ret_index);
+
+#endif /* __PH_DIALER_TAPI_H__ */
diff --git a/lib/dialer/ph-dialer-utils.c b/lib/dialer/ph-dialer-utils.c
new file mode 100755
index 0000000..515fbab
--- /dev/null
+++ b/lib/dialer/ph-dialer-utils.c
@@ -0,0 +1,780 @@
+/*
+* 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
+#include <string.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <bundle.h>
+#include <aul.h>
+#include <tapi_common.h>
+#include <ITapiSim.h>
+#include <TapiUtility.h>
+#include <feedback.h>
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-dialer.h"
+#include "phone-speed.h"
+
+#include "ph-dialer-utils.h"
+#include "ph-dialer-view.h"
+#include "ph-dialer-search.h"
+
+#define PH_DIALER_KEY_MAX_LEN 256
+
+ph_speeddial_info* ph_dialer_util_get_speeddial_by_number(void *data, int number)
+{
+ ph_speeddial_info * find_sd = NULL;
+ ph_dialer_data *dial_d = data;
+ Eina_List *l;
+
+ p_retvm_if(NULL == dial_d->speeddial_list, NULL, "There is no speeddial list");
+
+ EINA_LIST_FOREACH(dial_d->speeddial_list, l, find_sd) {
+ if (!find_sd) continue;
+ if (number == find_sd->dial_number && find_sd->ph_number)
+ {
+ if (number == 1)
+ {
+ free(find_sd->ph_number);
+ find_sd->ph_number = phone_get_voice_mail_number();
+ }
+ break;
+ }
+ }
+ return find_sd;
+}
+
+void ph_dialer_util_entry_clear(ph_dialer_data *dial_d)
+{
+ ph_dialer_util_del_all_number(dial_d);
+ ph_dialer_entry_set_number(dial_d, "", 0);
+ if (dial_d->has_focus) {
+ elm_object_focus_set(dial_d->entry, EINA_FALSE);
+ dial_d->has_focus = false;
+ }
+ ph_dialer_search_request(dial_d, FALSE);
+}
+
+void ph_dialer_util_launch_call(ph_dialer_data *dial_d)
+{
+ char num[PH_TEXT_MAX_LEN] = {0};
+ int text_len;
+ bundle* kb;
+
+ p_retm_if(dial_d == NULL, "Invalid argument: ph_dialer_data *is NULL");
+
+ text_len = ph_dialer_util_get_pure_numstr_with_plus(dial_d, num);
+ if (0 < text_len) {
+ if (PH_DAILER_EMERGENCY == dial_d->run_mode) {
+ kb = bundle_create();
+ p_retm_if(NULL == kb, "bundle_create() Failed");
+ bundle_add(kb, "launch-type", "EMERGENCY");
+ bundle_add(kb, "number", num);
+ aul_launch_app(VOICECALL_PKG, kb);
+ bundle_free(kb);
+ }
+ else
+ phone_launch_voice_call(-1, num);
+ }
+
+ ph_dialer_util_entry_clear(dial_d);
+}
+
+int ph_dialer_util_get_cursor_pos(ph_dialer_data *dial_d)
+{
+ InputNumber *node;
+ int pos = 0;
+ p_retvm_if(NULL == dial_d->number_cursor, 0, "cursor of number is null");
+
+ node = &dial_d->number_head;
+ while (dial_d->number_cursor != node) {
+ node = node->next;
+ if (!node) break;
+ pos++;
+ }
+ return pos;
+}
+
+int ph_dialer_util_is_dash(char ch)
+{
+ if (ch == '-' || ch == '(' || ch == ')' || ch == ' ')
+ return TRUE;
+ return FALSE;
+}
+
+static int dialer_util_is_dash_and_plus(char ch)
+{
+ if (ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == ' ')
+ return TRUE;
+ return FALSE;
+}
+
+int ph_dialer_util_get_pure_numstr(ph_dialer_data *dial_d, char *dest)
+{
+ InputNumber *node;
+ int cnt = 0;
+ p_retvm_if(NULL == dest, 0, "dest is null");
+
+ node = dial_d->number_head.next;
+ while (1) {
+ if (!node) break;
+ if (dialer_util_is_dash_and_plus(node->num) == FALSE)
+ dest[cnt++] = node->num;
+ node = node->next;
+ }
+ dest[cnt] = '\0';
+ return cnt;
+}
+
+InputNumber *ph_dialer_util_get_node_by_index(ph_dialer_data *dial_d, int index)
+{
+ InputNumber *node;
+ int i = 0;
+
+ node = &dial_d->number_head;
+ for (; i<index; i++) {
+ if (node->next)
+ node = node->next;
+ }
+ return node;
+}
+
+int ph_dialer_util_get_pure_numstr_with_plus(ph_dialer_data *dial_d, char *dest)
+{
+ InputNumber *node;
+ int cnt = 0;
+ p_retvm_if(NULL == dest, 0, "dest is null");
+
+ node = dial_d->number_head.next;
+ while (node) {
+ if (ph_dialer_util_is_dash(node->num) == FALSE)
+ dest[cnt++] = node->num;
+ node = node->next;
+ }
+ dest[cnt] = '\0';
+ return cnt;
+}
+
+int ph_dialer_util_get_numstr_from_node(ph_dialer_data *dial_d, char *dest)
+{
+ InputNumber *node;
+ int cnt = 0;
+ p_retvm_if(NULL == dest, 0, "dest is null");
+
+ node = dial_d->number_head.next;
+ while (node) {
+ dest[cnt++] = node->num;
+ node = node->next;
+ }
+ dest[cnt] = '\0';
+ return cnt;
+}
+
+int ph_dialer_util_del_all_number(ph_dialer_data *dial_d)
+{
+ int len = 0;
+ InputNumber *node = NULL;
+ InputNumber *tmp_node = NULL;
+ p_retvm_if(NULL == dial_d, 0, "dialer data is null");
+
+ node = dial_d->number_head.next;
+ while (node) {
+ tmp_node = node;
+
+ if (node->next)
+ node->next->prev = node->prev;
+ if (node->prev)
+ node->prev->next = node->next;
+
+ node = node->next;
+ len++;
+
+ free(tmp_node);
+ }
+ dial_d->number_cursor = &dial_d->number_head;
+ dial_d->entry_font_size = MAX_DIAL_NUMBER_FONT_SIZE;
+
+ return len;
+}
+
+static int dialer_util_is_num_length_over(int len)
+{
+ if (len >= PH_DIALER_KEY_MAX_LEN)
+ return TRUE;
+ return FALSE;
+}
+
+int ph_dialer_util_append_node_from_numstr(ph_dialer_data *dial_d, char *string)
+{
+ int i = 0;
+ int j = 0;
+ int len = 0;
+ InputNumber *node;
+ InputNumber *tmp_node = NULL;
+ char* tmp_string = NULL;
+
+ ph_dialer_util_del_all_number(dial_d);
+
+ p_retvm_if(NULL == string, 0, "string data is null");
+
+ node = &dial_d->number_head;
+
+ len = strlen(string);
+ if (dialer_util_is_num_length_over(len-1) == TRUE) {
+ phone_show_popup(dial_d->navi, T_(PH_GET_TEXT_BASIC, PHTEXT_EXCEED_NUM_MAX_LENGTH), 2.0);
+ len = PH_DIALER_KEY_MAX_LEN;
+ string[len] = '\0';
+ }
+
+ tmp_string = calloc(1, len+1);
+ memset(tmp_string, 0x00, len+1);
+
+ for(i = 0; i<len; i++) {
+ if((string[i] >= '0' && string[i] <= '9')
+ ||string[i]=='*'
+ ||string[i]=='#'
+ ||string[i]=='+')
+ {
+ tmp_string[j++] = string[i];
+ }
+ }
+
+ len = strlen(tmp_string);
+ for (i = 0; i<len; i++) {
+ tmp_node = calloc(1, sizeof(InputNumber));
+ tmp_node->next = NULL;
+ tmp_node->prev = node;
+ tmp_node->num = tmp_string[i];
+
+ node->next = tmp_node;
+ node = node->next;
+ }
+ dial_d->number_cursor = tmp_node;
+ free(tmp_string);
+
+ return len;
+}
+
+int ph_dialer_util_append_node_from_numstr_with_strip(ph_dialer_data *dial_d, char *string)
+{
+ int i = 0, cnt = 0, len = 0;
+ InputNumber *node;
+ InputNumber *tmp_node = NULL;
+ p_retvm_if(NULL == string, 0, "Number string is null");
+ ph_dialer_util_del_all_number(dial_d);
+
+ node = &dial_d->number_head;
+ len = strlen(string);
+ if (dialer_util_is_num_length_over(len-1) == TRUE) {
+ phone_show_popup(dial_d->navi, T_(PH_GET_TEXT_BASIC, PHTEXT_EXCEED_NUM_MAX_LENGTH), 2.0);
+ len = PH_DIALER_KEY_MAX_LEN;
+ string[len] = '\0';
+ }
+
+ for (; i<len; i++) {
+ if (ph_dialer_util_is_dash(string[i]) == TRUE)
+ continue;
+
+ tmp_node = calloc(1, sizeof(InputNumber));
+ tmp_node->next = NULL;
+ tmp_node->prev = node;
+ tmp_node->num = string[i];
+ node->next = tmp_node;
+
+ node = node->next;
+ cnt++;
+ }
+ dial_d->number_cursor = tmp_node;
+ return cnt;
+}
+
+char ph_dialer_util_get_value_word(char in)
+{
+ switch (in) {
+ case '2':
+ return 'a';
+ case '3':
+ return 'd';
+ case '4':
+ return 'g';
+ case '5':
+ return 'j';
+ case '6':
+ return 'm';
+ case '7':
+ return 'p';
+ case '8':
+ return 't';
+ case '9':
+ return 'w';
+ default:
+ return ' ';
+ }
+}
+
+char ph_dialer_util_get_next_value_abcmode(char in)
+{
+ switch (in) {
+ case 'a':
+ return 'b';
+ case 'b':
+ return 'c';
+ case 'c':
+ return 'a';
+ case 'd':
+ return 'e';
+ case 'e':
+ return 'f';
+ case 'f':
+ return 'd';
+ case 'g':
+ return 'h';
+ case 'h':
+ return 'i';
+ case 'i':
+ return 'g';
+ case 'j':
+ return 'k';
+ case 'k':
+ return 'l';
+ case 'l':
+ return 'j';
+ case 'm':
+ return 'n';
+ case 'n':
+ return 'o';
+ case 'o':
+ return 'm';
+ case 'p':
+ return 'q';
+ case 'q':
+ return 'r';
+ case 'r':
+ return 's';
+ case 's':
+ return 'p';
+ case 't':
+ return 'u';
+ case 'u':
+ return 'v';
+ case 'v':
+ return 't';
+ case 'w':
+ return 'x';
+ case 'x':
+ return 'y';
+ case 'y':
+ return 'z';
+ case 'z':
+ return 'w';
+ default:
+ return ' ';
+ }
+}
+
+static InputNumber* dialer_util_insert_number_after(InputNumber *node, char num)
+{
+ InputNumber *tmp;
+ p_retvm_if(NULL == node, NULL, "number node is null");
+
+ tmp = calloc(1, sizeof(InputNumber));
+ tmp->next = node->next;
+ tmp->prev = node;
+ tmp->num = num;
+
+ if (node->next)
+ node->next->prev = tmp;
+ node->next = tmp;
+
+ return tmp;
+}
+
+void ph_dialer_util_insert_number_at_cursor(ph_dialer_data *dial_d, char num)
+{
+ InputNumber *cursor;
+ InputNumber *tmp;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ int len;
+
+ if (dial_d->number_cursor)
+ cursor = dial_d->number_cursor;
+ else
+ cursor = &dial_d->number_head;
+
+ /* check length */
+ len = ph_dialer_util_get_numstr_from_node(dial_d, buf);
+ if (dialer_util_is_num_length_over(len) == TRUE) {
+ phone_show_popup(dial_d->navi, T_(PH_GET_TEXT_BASIC, PHTEXT_EXCEED_NUM_MAX_LENGTH), 2.0);
+ return;
+ }
+
+ tmp = dialer_util_insert_number_after(cursor, num);
+ dial_d->number_cursor = tmp;
+}
+
+char ph_dialer_util_get_number_at_cursor(ph_dialer_data *dial_d)
+{
+ if (dial_d->number_cursor == NULL)
+ return '\0';
+
+ return dial_d->number_cursor->num;
+}
+
+int ph_dialer_util_remove_node_at_cursor(ph_dialer_data *dial_d)
+{
+ InputNumber *cursor = NULL;
+ InputNumber *node_prev = NULL;
+ p_retvm_if(NULL == dial_d->number_cursor, 0, "current cursor is null");
+ cursor = dial_d->number_cursor;
+
+ if (cursor == &dial_d->number_head)
+ return 0;
+
+ if (cursor)
+ node_prev = cursor->prev;
+
+ if (node_prev)
+ node_prev->next = cursor->next;
+
+ if (cursor->next)
+ cursor->next->prev = node_prev;
+
+ free(cursor);
+ dial_d->number_cursor = node_prev;
+ return ph_dialer_util_get_cursor_pos(dial_d);
+}
+
+void ph_dialer_util_strip_from_number_node(ph_dialer_data *dial_d)
+{
+ InputNumber *node, *tmp_node;
+ node = dial_d->number_head.next;
+
+ while (node) {
+ if (ph_dialer_util_is_dash(node->num) == TRUE) {
+ if (dial_d->number_cursor == node)
+ dial_d->number_cursor = node->prev;
+ tmp_node = node;
+
+ if (node->next)
+ node->next->prev = node->prev;
+ if (node->prev)
+ node->prev->next = node->next;
+
+ node = node->next;
+ free(tmp_node);
+ }
+ else
+ node = node->next;
+ }
+}
+
+void ph_dialer_util_add_dashes(ph_dialer_data *dial_d, DashMode kMode)
+{
+ InputNumber *cursor, *node;
+ int len = 0;
+ int remain = 0;
+ char numstr[PH_TEXT_MAX_LEN] = {0};
+
+ cursor = dial_d->number_cursor;
+ node = dial_d->number_head.next;
+
+ len = ph_dialer_util_get_numstr_from_node(dial_d, numstr);
+ p_retm_if(len < 2, "number is too short");
+ p_retm_if(numstr[0] == '*' || numstr[0] == '#', "the character is reserved string");
+
+ remain = len;
+ /* 123 ~ 12345678901(123-4567-8901) */
+ if (len > (2-kMode) && len < (12+kMode) && node) { /* 02, 010, 011, ... 0xx */
+ if (node->num == '0') { /* 02, +cc 2 */
+ remain--;
+ node = node->next;
+ remain--;
+
+ if (node->num == '2') { /* 02-, +cc 2- */
+ node = dialer_util_insert_number_after(node, '-');
+ if (node) {
+ if (kMode) {
+ if (dial_d->number_cursor == node->prev) {
+ dial_d->number_cursor = node;
+ }
+ }
+ if (node->next)
+ node = node->next;
+ }
+ }
+ else { /* 0xx, +cc xx */
+ if (node->next) {
+ node = node->next;
+ remain--;
+ }
+
+ if (len > 3-kMode) { /* 0xx-, +cc xx- */
+ node = dialer_util_insert_number_after(node, '-');
+ if (node) {
+ if (kMode) {
+ if (dial_d->number_cursor == node->prev) {
+ dial_d->number_cursor = node;
+ }
+ }
+ if (node->next)
+ node = node->next;
+ }
+ }
+ }
+
+ if (remain == 8) { /* xxx-1234-1234, +cc xx-1234-1234 */
+ node = node->next;
+ p_ret_if(node == NULL);
+ node = node->next;
+ p_ret_if(node == NULL);
+ node = node->next;
+ dialer_util_insert_number_after(node, '-');
+ }
+ else if (remain > (int)(3-kMode) && remain < 8) { /* xxx-123-1234, +cc xx-123-1234 */
+ node = node->next;
+ p_ret_if(node == NULL);
+ node = node->next;
+ node = dialer_util_insert_number_after(node, '-');
+ if (node && kMode) {
+ if (dial_d->number_cursor == node->prev) {
+ dial_d->number_cursor = node;
+ }
+ }
+ }
+ else if (remain > 8) { /* not match rule */
+ ph_dialer_util_strip_from_number_node(dial_d);
+ }
+ }
+
+ else { /* 02, +cc 2 */ /* 1234-1234 */
+ if (len > 4-kMode && len < 9+kMode) {
+ node = node->next;
+ p_ret_if(node == NULL);
+ node = node->next;
+ p_ret_if(node == NULL);
+ node = node->next;
+ node = dialer_util_insert_number_after(node, '-');
+ if (node && kMode) {
+ if (dial_d->number_cursor == node->prev) {
+ dial_d->number_cursor = node;
+ }
+ }
+ }
+ }
+ }
+}
+
+void ph_dialer_util_highlight_substring(char *dest, int dest_len, char *string,
+ char *substr)
+{
+ char middle[PH_TAG_TEXT_MAX_LEN] = {0};
+ char first[PH_TAG_TEXT_MAX_LEN] = {0};
+
+ p_retm_if(NULL == string, "string is null");
+
+ if (substr && *substr) {
+ int len = strlen(substr);
+ snprintf(first, sizeof(first), "%s", string);
+ char *last = strcasestr(first, substr);
+ if (last) {
+ snprintf(middle, strlen(substr)+1, "%s", last);
+ *(last) = '\0';
+ snprintf(dest, dest_len, "%s<match>%s</>%s",first, middle, last+len);
+ }
+ else
+ snprintf(dest, dest_len, "%s", string);
+ }
+ else
+ snprintf(dest, dest_len, "%s", string);
+}
+
+void ph_dialer_util_highlight_substring_with_pos(char *dest, int dest_len, char *string,
+ int position, int length)
+{
+ char middle[PH_TEXT_MAX_LEN] = {0};
+ char first[PH_TEXT_MAX_LEN] = {0};
+
+ p_retm_if(NULL == string, "string is null");
+
+ if (0 < length) {
+ snprintf(first, sizeof(first), "%s", string);
+ snprintf(middle, length+1, "%s", string + position);
+ first[position] = '\0';
+ snprintf(dest, dest_len, "%s<match>%s</>%s",first, middle, string + position + length);
+ }
+ else
+ snprintf(dest, dest_len, "%s", string);
+}
+
+int ph_dialer_util_show_matched_one_number(ph_dialer_data *dial_d, char *name, char *number)
+{
+ PH_FN_CALL;
+ p_retvm_if(dial_d==NULL, 0, "dialer data is null");
+
+ if (dial_d->slide) {
+ edje_object_signal_emit(_EDJ(dial_d->layout), "elm,state,slide,stop", "elm");
+ dial_d->slide = false;
+ }
+
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewcontrol/search_result", "viewcontrol");
+ edje_object_part_text_set(_EDJ(dial_d->layout), "search_result/item/number/textblock", number);
+
+ if (name && *name) {
+ edje_object_part_text_set(_EDJ(dial_d->layout), "search_result/item/name/text", name);
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/search_result/search_number", "viewobject/search_result");
+ }
+ else
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/search_result/noname", "viewobject/search_result");
+
+
+ ph_dialer_update_cnt_btn(dial_d, 1);
+ dial_d->is_show_items = true;
+ return 0;
+}
+
+
+static void __ph_dialer_speed_dial_view_ug_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ if (ug)
+ ug_destroy(ug);
+}
+
+static void __ph_dialer_speed_dial_view_ug_result_cb(ui_gadget_h ug, service_h service, void *priv)
+{
+ ug_destroy(ug);
+}
+
+static void __ph_dialer_speed_dial_view_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+{
+ Evas_Object *base = ug_get_layout(ug);
+ p_retm_if(base == NULL, "base == NULL");
+
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(base);
+}
+
+
+void ph_dialer_util_speeddial_show_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+
+ //phone_create_speeddial_view(dial_d->ug, dial_d->win, dial_d->navi);
+
+ struct ug_cbs cbs = { 0, };
+ ui_gadget_h ug;
+
+ cbs.priv = (void *)dial_d;
+ cbs.layout_cb = __ph_dialer_speed_dial_view_ug_layout_cb;
+ cbs.result_cb = __ph_dialer_speed_dial_view_ug_result_cb;
+ cbs.destroy_cb = __ph_dialer_speed_dial_view_ug_destroy_cb;
+
+ dial_d->child_ug = ug_create((ui_gadget_h)dial_d->ug, "speeddial-efl", UG_MODE_FULLVIEW, NULL, &cbs);
+
+ evas_object_del(dial_d->popup);
+ dial_d->popup = NULL;
+}
+
+void ph_dialer_util_show_speeddial_msg(ph_dialer_data *dial_d, const char *msg)
+{
+ char dest[PH_TEXT_MAX_LEN] = {0};
+ snprintf(dest, sizeof(dest), "%s", msg);
+ phone_create_confirm_popup(&dial_d->popup, dial_d->win, msg, ph_dialer_util_speeddial_show_cb, dial_d);
+}
+
+void ph_dialer_util_setup_run_mode(ph_dialer_data *dial_d)
+{
+ int ret = 0;
+ int value = 0;
+
+ /* Check call state */
+ ret = vconf_get_int(VCONFKEY_CALL_STATE, &value);
+ if (ret < 0)
+ ERR("vconf_get_int is failed(%d)", ret);
+ else {
+ if (value == VCONFKEY_CALL_OFF
+ || value == VCONFKEY_CALL_VOICE_CONNECTING
+ || value == VCONFKEY_CALL_VIDEO_CONNECTING) {
+ if (dial_d->run_mode == PH_DAILER_EMERGENCY)
+ {
+ edje_object_signal_emit(_EDJ(dial_d->layout), "softkey/emergency", "softkey");
+ }
+ else {
+ if (dial_d->run_mode == PH_DAILER_NORMAL)
+ return;
+ dial_d->run_mode = PH_DAILER_NORMAL;
+ edje_object_signal_emit(_EDJ(dial_d->layout), "softkey/normal", "softkey");
+ }
+ }
+ else { // VCONFKEY_CALL_VOICE_ACTIVE, VCONFKEY_CALL_VIDEO_ACTIVE
+ if (dial_d->run_mode == PH_DAILER_DURING_CALL)
+ return;
+ dial_d->run_mode = PH_DAILER_DURING_CALL;
+ edje_object_signal_emit(_EDJ(dial_d->layout), "softkey/dc", "softkey");
+ }
+ PH_DBG("run_mode:%d", dial_d->run_mode);
+ }
+}
+
+void ph_dialer_util_init_sim_value(ph_dialer_data *dial_d)
+{
+ /* Network MCC */
+ int value = 0;
+ int ret;
+ TelSimImsiInfo_t sim_imsi_info;
+ TapiHandle *handle;
+ ret = vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &value);
+ if (ret < 0)
+ dial_d->cur_mcc = -1;
+ else
+ dial_d->cur_mcc = value / 1000;
+
+ /* SIM MCC/MNC */
+ dial_d->cur_sim_mcc = -1;
+ handle = tel_init(NULL);
+ if (NULL == handle) {
+ ERR("tel_init() Failed");
+ }
+ else {
+ ret = tel_get_sim_imsi(handle, &sim_imsi_info);
+ if (0 == ret)
+ dial_d->cur_sim_mcc = atoi(sim_imsi_info.szMcc);
+ else
+ ERR("tel_get_sim_imsi() Failed(%d)", ret);
+ tel_deinit(handle);
+ }
+ dial_d->cur_cc_index = -1;
+
+ ret = vconf_get_int(VCONFKEY_TELEPHONY_SVC_ROAM, &value);
+ if (ret < 0)
+ dial_d->roaming = 0;
+ else
+ dial_d->roaming = value;
+}
+
+void ph_dialer_util_svi_play(int vibration_key, int sound_key)
+{
+ int effect_status = FALSE;
+ vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &effect_status);
+ if (effect_status)
+ feedback_play_type(FEEDBACK_TYPE_SOUND, sound_key);
+
+ vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &effect_status);
+ if (effect_status)
+ feedback_play_type(FEEDBACK_TYPE_VIBRATION, vibration_key);
+}
diff --git a/lib/dialer/ph-dialer-utils.h b/lib/dialer/ph-dialer-utils.h
new file mode 100755
index 0000000..68e06a9
--- /dev/null
+++ b/lib/dialer/ph-dialer-utils.h
@@ -0,0 +1,86 @@
+/*
+* 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 __PH_DIALER_UTIL_H__
+#define __PH_DIALER_UTIL_H__
+
+#include <stdio.h>
+
+typedef struct
+{
+ char *plog_number;
+}ph_dial_log_d;
+
+typedef struct
+{
+ char *display;
+ char *number;
+ char *find_number;
+ char *img_path;
+ char *numtype_label;
+
+ int number_type;
+ int type;
+ int contact_id;
+ int position;
+ int len;
+}ph_dial_search_d;
+
+typedef struct{
+ char *cc;
+ char *name;
+ int mcc;
+}ph_cc_name_mcc_info;
+
+void ph_dialer_util_launch_call(ph_dialer_data *dial_d);
+
+int ph_dialer_util_get_pure_numstr_with_plus(ph_dialer_data *dial_d, char *dest);
+int ph_dialer_util_get_pure_numstr(ph_dialer_data *dial_d, char *dest);
+int ph_dialer_util_get_numstr_from_node(ph_dialer_data *dial_d, char *dest);
+int ph_dialer_util_del_all_number(ph_dialer_data *dial_d);
+
+int ph_dialer_util_append_node_from_numstr(ph_dialer_data *dial_d, char *string);
+int ph_dialer_util_append_node_from_numstr_with_strip(ph_dialer_data *dial_d, char *string);
+int ph_dialer_util_remove_node_at_cursor(ph_dialer_data *dial_d);
+
+void ph_dialer_util_insert_number_at_cursor(ph_dialer_data *dial_d, char num);
+char ph_dialer_util_get_number_at_cursor(ph_dialer_data *dial_d);
+int ph_dialer_util_get_cursor_pos(ph_dialer_data *dial_d);
+
+char ph_dialer_util_get_next_value_abcmode(char in);
+char ph_dialer_util_get_value_word(char in);
+InputNumber *ph_dialer_util_get_node_by_index(ph_dialer_data *dial_d, int index);
+void ph_dialer_util_strip_from_number_node(ph_dialer_data *dial_d);
+int ph_dialer_util_is_dash(char ch);
+void ph_dialer_util_add_dashes(ph_dialer_data *dial_d, DashMode kMode);
+void ph_dialer_util_entry_clear(ph_dialer_data *dial_d);
+
+void ph_dialer_util_highlight_substring(char *dest, int dest_len, char *allpart, char *part);
+void ph_dialer_util_highlight_substring_with_pos(char *dest, int dest_len, char *string,
+ int position, int length);
+
+ph_speeddial_info* ph_dialer_util_get_speeddial_by_number(void *data, int speednumber);
+
+int ph_dialer_util_show_matched_one_number(ph_dialer_data *dial_d, char *name, char *number);
+void ph_dialer_util_show_speeddial_msg(ph_dialer_data *dial_d, const char *msg);
+void ph_dialer_util_speeddial_show_cb(void *data, Evas_Object *obj, void *event_info);
+
+void ph_dialer_util_init_sim_value(ph_dialer_data *dial_d);
+void ph_dialer_util_setup_run_mode(ph_dialer_data *dial_d);
+void ph_dialer_util_svi_play(int vibration_key, int sound_key);
+
+#endif //__PH_DIALER_UTIL_H__
diff --git a/lib/dialer/ph-dialer-view.c b/lib/dialer/ph-dialer-view.c
new file mode 100755
index 0000000..0a0d2e0
--- /dev/null
+++ b/lib/dialer/ph-dialer-view.c
@@ -0,0 +1,1826 @@
+/*
+* 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 <string.h>
+#include <feedback.h>
+#include <Ecore_X.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <Evas.h>
+#include <Ecore_X.h>
+
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "ph-front.h"
+#include "phone-dialer.h"
+
+#include "ph-dialer-view.h"
+#include "ph-dialer-utils.h"
+#include "ph-dialer-search.h"
+
+
+#define PH_DIALER_ENTRY_DEFAULT_STYLE "<align=left font=Tizen:style=Thin text_class=tizen font_size=%d color=#FFFFFF>%s</>"
+#define PH_DIALER_ENTRY_EMPTY_STYLE ""
+#define PH_PAUSE_CHAR ';'
+#define PH_WAIT_CHAR ','
+
+#define PH_DIALER_ENTRY_STYLE_END_TAG "</>"
+#define START_KEYPAD_RESET_TIMER 0.3
+static dial_multiTouch_info* dialMultitouchInfo = NULL;
+
+static void dialer_entry_selection_changed(void *data, Evas_Object *entry, void *event_info)
+{
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ dial_d->selected_text = elm_entry_selection_get(entry);
+}
+
+static void dialer_entry_cursor_changed(void *data, Evas_Object *entry, void *event_info)
+{
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ dial_d->cursor_changed = true;
+}
+
+static void dialer_show_search_list_toggle(ph_dialer_data *dial_d, bool show)
+{
+ PH_FN_CALL;
+ if (show)
+ {
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_list/show", "viewobject/search_list");
+ dial_d->count_button_status = COUNT_BUTTON_OPEN;
+ edje_object_signal_emit(_EDJ(dial_d->count_layout), "count_button/closed", "count_button");
+ }
+ else
+ {
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_list/hide", "viewobject/search_list");
+ dial_d->count_button_status = COUNT_BUTTON_CLOSE;
+ edje_object_signal_emit(_EDJ(dial_d->count_layout), "count_button/opened", "count_button");
+ }
+
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_list/index/hide", "viewobject/search_list/index");
+
+}
+
+static void dialer_entry_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+
+ if (dial_d->list_mode == MODE_DIAL_NUMBER) {
+ if (NULL == dial_d->search_list || eina_list_count(dial_d->search_list) < 2 || !dial_d->is_show_items)
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_result/count/hide", "viewobject/search_result/count");
+ else
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_result/count/show", "viewobject/search_result/count");
+ }
+ else {
+ if (NULL == dial_d->cc_list_sorted || eina_list_count(dial_d->cc_list_sorted) < 2 || !dial_d->is_show_items)
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_result/count/hide", "viewobject/search_result/count");
+ else
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_result/count/show", "viewobject/search_result/count");
+ }
+
+ dialer_show_search_list_toggle(dial_d, false);
+}
+
+static void dialer_entry_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ if (dial_d->cursor_changed) {
+ int pos = 0;
+ dial_d->cursor_changed = false;
+ pos = elm_entry_cursor_pos_get(dial_d->entry);
+ dial_d->number_cursor = ph_dialer_util_get_node_by_index(data, pos);
+ }
+ dial_d->has_focus = true;
+}
+
+static void dialer_softkey_longpress(char *source, ph_dialer_data *dial_d)
+{
+ int pos = 0;
+ char dest[PH_TEXT_MAX_LEN] = {0};
+
+
+ if (strcmp(source, "star") == 0 || strcmp(source, "*") == 0) {
+ if (ph_dialer_util_get_number_at_cursor(dial_d) == '*') {
+ pos = ph_dialer_util_remove_node_at_cursor(dial_d);
+ dialer_pw_popup(dial_d);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+ }
+ }
+ else if (strcmp(source, "sharp") == 0 || strcmp(source, "#") == 0) {
+
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ if(strlen(dest) > 1) /* '#' longpress disable after number typed */
+ return;
+
+ int value = 1;
+ vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &value);
+
+ if(!value) {
+ vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE);
+ phone_show_popup(dial_d->win, T_(PH_GET_TEXT_BASIC, PHTEXT_SOUND_ON), 2.0);
+ }
+ else {
+ feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_HW_TAP);
+ vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE);
+ phone_show_popup(dial_d->win, T_(PH_GET_TEXT_BASIC, PHTEXT_SOUND_OFF), 2.0);
+ }
+
+ if(ph_dialer_util_get_number_at_cursor(dial_d) == '#') {
+ pos = ph_dialer_util_remove_node_at_cursor(dial_d);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+ ph_dialer_search_request(dial_d, FALSE);
+ }
+ }
+ else if (strcmp(source, "input_del") == 0)
+ {
+ ph_dialer_util_entry_clear(dial_d);
+ }
+}
+
+static Eina_Bool dialer_keypad_longpress(void *data)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ int text_len = 0;
+ int pos = 0;
+ char dest[PH_TEXT_MAX_LEN] = {0};
+ char *source;
+
+ p_retv_if(NULL == dial_d, -1);
+
+ source = dial_d->longpress_source;
+ text_len = ph_dialer_util_get_pure_numstr_with_plus(dial_d, dest);
+
+ switch (source[0]) {
+ case '0' ... '9':
+ PH_DBG("number(len=%d):[%s]", text_len, dest);
+ if (source[0] == '0') {
+ pos = ph_dialer_util_remove_node_at_cursor(dial_d);
+ edje_object_signal_emit(_EDJ(dial_d->layout), "pad_clicked", "+");
+ break;
+ }
+ /* speed dial: 2 ~ 9 */
+ if (0 < text_len && text_len <= 2) {
+ if ('0' <= dest[0] && dest[0] <= '9' && atoi(dest) < 10) {
+ ph_speeddial_info * speed_info = NULL;
+ if ((speed_info = ph_dialer_util_get_speeddial_by_number(dial_d, atoi(dest))) != NULL) {
+ ph_dialer_util_append_node_from_numstr_with_strip(dial_d, speed_info->ph_number);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, CURSOR_END);
+ ph_dialer_util_launch_call(dial_d);
+ }
+ else
+ ph_dialer_util_show_speeddial_msg(dial_d, T_(PH_GET_TEXT_BASIC, PHTEXT_SPEED_DIAL_REQUEST));
+ }
+ }
+ break;
+ default:
+ dialer_softkey_longpress(source, dial_d);
+ break;
+ }
+ if (dial_d->longpress_source) {
+ free(dial_d->longpress_source);
+ dial_d->longpress_source = NULL;
+ }
+ dial_d->longpress_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void dialer_popup_del_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+
+ evas_object_del(dial_d->popup);
+ dial_d->popup = NULL;
+}
+
+static void dialer_add_pause_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+
+ char dest[PH_TEXT_MAX_LEN] = {0};
+
+ dialer_show_search_list_toggle(dial_d, false);
+ ph_dialer_util_strip_from_number_node(dial_d);
+ ph_dialer_util_insert_number_at_cursor(dial_d, PH_PAUSE_CHAR);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+ ph_dialer_search_request(dial_d, FALSE);
+ dialer_popup_del_cb(dial_d, NULL, NULL);
+}
+
+static void dialer_add_wait_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+
+ char dest[PH_TEXT_MAX_LEN] = {0};
+
+ dialer_show_search_list_toggle(dial_d, false);
+ ph_dialer_util_strip_from_number_node(dial_d);
+ ph_dialer_util_insert_number_at_cursor(dial_d, PH_WAIT_CHAR);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+ ph_dialer_search_request(dial_d, FALSE);
+ dialer_popup_del_cb(dial_d, NULL, NULL);
+}
+void dialer_pw_popup(void *data)
+{
+ PH_FN_CALL;
+
+ char buf[PH_TEXT_SHORT_LEN] = {0};
+ ph_dialer_data *dial_d = (ph_dialer_data*)data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+
+ if (dial_d->popup)
+ evas_object_del(dial_d->popup);
+
+ dial_d->popup = elm_ctxpopup_add(dial_d->navi);
+ p_retm_if(NULL == dial_d->popup, "elm_ctxpopup_add() return NULL");
+
+
+ elm_ctxpopup_direction_priority_set(dial_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+
+ ph_dialer_util_get_pure_numstr_with_plus(dial_d, buf);
+
+ evas_object_smart_callback_add(dial_d->popup, "dismissed", dialer_popup_del_cb, dial_d);
+
+ snprintf(buf, sizeof(buf), T_(PH_GET_TEXT_BASE_OP, PHTEXT_ADD_PAUSE), 2);
+ elm_ctxpopup_item_append(dial_d->popup, buf, NULL, dialer_add_pause_cb, dial_d);
+ elm_ctxpopup_item_append(dial_d->popup, T_(PH_GET_TEXT_BASE_OP, PHTEXT_ADD_WAIT), NULL, dialer_add_wait_cb, dial_d);
+
+ int x, y, w, h;
+ edje_object_part_geometry_get(_EDJ(dial_d->layout), "star_BG", &x, &y, &w, &h);
+
+ evas_object_move(dial_d->popup, x+(w/2), (y+167)+(h/2));
+ evas_object_show(dial_d->popup);
+
+}
+
+static void dialer_keypad_down(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ PH_FN_CALL;
+ char dest[PH_TEXT_MAX_LEN] = {0};
+ int snd_id = 0;
+ ph_dialer_data *dial_d = data;
+
+ p_retm_if(dial_d == NULL, "Invalid argument: ph_dialer_data *is NULL");
+ p_retm_if(source == NULL, "source is NULL");
+
+ if (dial_d->count_button_status == COUNT_BUTTON_OPEN) {
+ dialer_show_search_list_toggle(dial_d, false);
+ }
+
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer = NULL;
+ }
+
+ if (dial_d->dash_timer) {
+ ecore_timer_del(dial_d->dash_timer);
+ dial_d->dash_timer = NULL;
+ }
+
+ switch (source[0]) {
+ case '0' ... '9':
+ snd_id = FEEDBACK_PATTERN_KEY0 + (source[0] - '0');
+ break;
+ default:
+ if (0 == strcmp(source, "star")) {
+ source = "*";
+ snd_id = FEEDBACK_PATTERN_KEY_STAR;
+ }
+ else if (0 == strcmp(source, "sharp")) {
+ source = "#";
+ snd_id = FEEDBACK_PATTERN_KEY_SHARP;
+ }
+ else {
+ snd_id = FEEDBACK_PATTERN_TOUCH_KEY;
+ }
+ break;
+ }
+
+ if (PH_DAILER_DURING_CALL != dial_d->run_mode)
+ ph_dialer_util_svi_play(FEEDBACK_PATTERN_TOUCH_TAP , snd_id);
+
+ ph_dialer_util_strip_from_number_node(dial_d);
+ ph_dialer_util_insert_number_at_cursor(dial_d, source[0]);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+
+ /* create new longpress timer */
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer = NULL;
+ }
+ FREEandSTRDUP(dial_d->longpress_source, source);
+ dial_d->longpress_timer = ecore_timer_add(elm_config_longpress_timeout_get(), dialer_keypad_longpress, dial_d);
+ ph_dialer_search_request(dial_d, FALSE);
+}
+
+static Eina_Bool dialer_dash_add_timer(void *data)
+{
+ char dest[PH_TEXT_MAX_LEN] = {0};
+ ph_dialer_data *dial_d = data;
+
+ ph_dialer_util_strip_from_number_node(dial_d);
+ ph_dialer_util_add_dashes(dial_d, DASH_PREVIEW);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+
+ dial_d->dash_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void dialer_keypad_up(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ ph_dialer_data *dial_d = data;
+ p_retm_if(data == NULL, "Invalid argument: ph_dialer_data *is NULL");
+ PH_DBG("(source=%s)", source);
+
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer = NULL;
+ }
+
+ if (dial_d->dash_timer) {
+ ecore_timer_del(dial_d->dash_timer);
+ dial_d->dash_timer = NULL;
+ }
+ dial_d->dash_timer = ecore_timer_add(0.7, dialer_dash_add_timer, dial_d);
+}
+
+static void dialer_keypad_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ char dest[PH_TEXT_MAX_LEN] = {0};
+
+ p_retm_if(NULL == source, "source is null");
+ p_retm_if(NULL == data, "Invalid argument: ph_dialer_data is NULL");
+
+ if (0 != strcmp(source, "+") && 0 != strcmp(source, "P") && 0 != strcmp(source, "W"))
+ return;
+
+ if (dial_d->dash_timer) {
+ ecore_timer_del(dial_d->dash_timer);
+ dial_d->dash_timer = NULL;
+ }
+
+ ph_dialer_util_strip_from_number_node(dial_d);
+ ph_dialer_util_insert_number_at_cursor(dial_d, source[0]);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+ ph_dialer_search_request(dial_d, FALSE);
+}
+
+static void dialer_softkey_down(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ PH_FN_CALL;
+ char dest[PH_TEXT_MAX_LEN] = {0};
+ ph_dialer_data *dial_d = data;
+ p_retm_if(data == NULL, "Invalid argument: ph_dialer_data *is NULL");
+
+ if (0 == strcmp(source, "back_btn") || 0 == strcmp(source, "option_btn"))
+ return;
+
+ ph_dialer_util_svi_play(FEEDBACK_PATTERN_TOUCH_TAP , FEEDBACK_PATTERN_TOUCH_TAP);
+ if (0 != strcmp(source, "input_del"))
+ return;
+
+ if (dial_d->dash_timer) {
+ ecore_timer_del(dial_d->dash_timer);
+ dial_d->dash_timer = NULL;
+ }
+
+ char* entry_raw = strdup(elm_entry_entry_get(dial_d->entry));
+ char* tok = strstr(entry_raw, PH_DIALER_ENTRY_STYLE_END_TAG);
+ if (tok)
+ tok[0] = '\0';
+
+ if (dial_d->selected_text && strcmp(dial_d->selected_text, entry_raw) == 0)
+ {
+ ph_dialer_util_entry_clear(dial_d);
+ free(entry_raw);
+ return;
+ }
+
+ ph_dialer_util_strip_from_number_node(dial_d);
+ ph_dialer_util_remove_node_at_cursor(dial_d);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, 0);
+
+ if (!*dest && dial_d->has_focus) {
+ elm_object_focus_set(dial_d->entry, EINA_FALSE);
+ dial_d->has_focus = false;
+ }
+
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer = NULL;
+ }
+ FREEandSTRDUP(dial_d->longpress_source, source);
+ dial_d->longpress_timer = ecore_timer_add(elm_config_longpress_timeout_get(), dialer_keypad_longpress, dial_d);
+
+ ph_dialer_search_request(dial_d, FALSE);
+}
+
+static void dialer_softkey_up(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == data, "Invalid argument: ph_dialer_data *is NULL");
+
+ if (0 != strcmp(source, "input_del"))
+ return;
+
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer = NULL;
+ }
+
+ if (dial_d->dash_timer) {
+ ecore_timer_del(dial_d->dash_timer);
+ dial_d->dash_timer = NULL;
+ }
+ dial_d->dash_timer = ecore_timer_add(0.7, dialer_dash_add_timer, dial_d);
+}
+
+static void dialer_destroy_child_ug(void *data)
+{
+ ph_dialer_data *dial_d = data;
+ dial_d->child_ug = NULL;
+}
+
+static void dialer_cnt_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ p_retm_if(dial_d == NULL, "Invalid argument: dial_d is NULL");
+
+ if (dial_d->count_button_status == COUNT_BUTTON_CLOSE)
+ {
+ if (dial_d->list_mode == MODE_DIAL_NUMBER)
+ {
+ p_retm_if((int)eina_list_count(dial_d->search_list) < 2, "lack of item to make drop down list (searched result: %d)", (int)eina_list_count(dial_d->search_list));
+ ph_dialer_search_fill_genlist_by_list(dial_d);
+ }
+ else
+ {
+ p_retm_if((int)eina_list_count(dial_d->cc_list_sorted) < 2, "lack of item to make drop down list (country code found: %d)", (int)eina_list_count(dial_d->cc_list_sorted));
+ ph_dialer_search_fill_genlist_by_cc_list(dial_d);
+ }
+ dialer_show_search_list_toggle(dial_d, true);
+ }
+ else
+ {
+ dialer_show_search_list_toggle(dial_d, false);
+ }
+
+ return;
+}
+
+static bool dialer_get_recent_log_number(char** get_str)
+{
+ PH_FN_CALL;
+ contacts_list_h cts_list = NULL;
+ contacts_query_h query = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+
+ do {
+ if((err = contacts_query_create(_contacts_person_phone_log._uri, &query)) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_filter_create( _contacts_person_phone_log._uri, &filter)) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_filter_add_int(filter, _contacts_person_phone_log.log_type, CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, CONTACTS_PLOG_TYPE_VOICE_INCOMMING )) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND)) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_filter_add_int(filter, _contacts_person_phone_log.log_type, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, CONTACTS_PLOG_TYPE_VIDEO_BLOCKED )) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_query_set_filter(query, filter)) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_query_set_sort(query, _contacts_person_phone_log.log_time, false)) != CONTACTS_ERROR_NONE) break;
+ if((err = contacts_db_get_records_with_query(query, 0, 1, &cts_list)) != CONTACTS_ERROR_NONE) break;
+
+ unsigned int record_cnt = 0;
+ contacts_list_get_count( cts_list, &record_cnt );
+ PH_DBG("get _contacts_person_phone_log table records(%d)", record_cnt);
+
+ err = phone_cts_get_str_from_list(cts_list, _contacts_person_phone_log.address, get_str);
+ PH_DBG("recent number : %s", *get_str);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+
+ contacts_list_destroy(cts_list, true);
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ return true;
+ } while(0);
+
+ //error case
+ ERR("contacts_db_query Failed(%d)", err);
+ if(query != NULL)
+ contacts_query_destroy(query);
+ if(filter != NULL)
+ contacts_filter_destroy(filter);
+
+ return false;
+}
+
+static void dialer_softkey_call_clicked(void *data, int type)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ int len;
+
+ p_retm_if(data == NULL, "Invalid argument: ph_dialer_data *is NULL");
+
+ len = ph_dialer_util_get_numstr_from_node(dial_d, buf);
+ if (len == 0) {
+ PH_DBG("text is NULL so input recent number ");
+ char* get_str = NULL;
+ if(dialer_get_recent_log_number(&get_str))
+ {
+ if (get_str && strlen(get_str) > 0) {
+ ph_dialer_util_append_node_from_numstr(dial_d, get_str);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, buf);
+ ph_dialer_entry_set_number(dial_d, buf, CURSOR_END);
+ ph_dialer_search_request(dial_d, FALSE);
+ free(get_str);
+ }
+ }
+ return;
+ }
+ if (0 == type)
+ ph_dialer_util_launch_call(dial_d);
+}
+
+static void dialer_back_btn_cb(ph_dialer_data *dial_d)
+{
+ dial_d->initialized = FALSE;
+ ph_dialer_util_entry_clear(dial_d);
+}
+
+static void dialer_softkey_msg_clicked(void *data)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ p_retm_if(dial_d == NULL, "Invalid argument: ph_dialer_data *is NULL");
+ char num[PH_TEXT_SHORT_LEN] = {0};
+ ph_dialer_util_get_pure_numstr_with_plus(dial_d, num);
+ dial_d->child_ug = phone_launch_msg_composer_ug(dial_d->ug, num, 0,
+ dialer_destroy_child_ug, dial_d);
+ dialer_popup_del_cb(dial_d, NULL, NULL);
+}
+
+static void dialer_ctx_message_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ char num[PH_TEXT_SHORT_LEN] = {0};
+ ph_dialer_util_get_pure_numstr_with_plus(dial_d, num);
+ dial_d->child_ug = phone_launch_msg_composer_ug(dial_d->ug, num, 0,
+ dialer_destroy_child_ug, dial_d);
+ dialer_popup_del_cb(dial_d, NULL, NULL);
+}
+
+static void dialer_exit_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+ dialer_back_btn_cb(dial_d);
+ phone_back_btn_clicked_cb(dial_d->win, NULL, NULL);
+ dialer_popup_del_cb(dial_d, NULL, NULL);
+}
+
+static void dialer_contactsearch_btn_cb(void *data)
+{
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ ph_phoneui_data *phoneui_d = evas_object_data_get(dial_d->layout, "phoneui_d");
+ phone_front_view_show_sub_view(phoneui_d); //temp : need to fix as embedding contact search list into dialer layout. (kc.jun)
+ return;
+}
+
+static void dialer_option_btn_cb(ph_dialer_data *dial_d)
+{
+ PH_FN_CALL;
+ char buf[PH_TEXT_SHORT_LEN] = {0};
+
+ if (dial_d->popup)
+ evas_object_del(dial_d->popup);
+
+ dial_d->popup = elm_ctxpopup_add(dial_d->navi);
+ p_retm_if(NULL == dial_d->popup, "elm_ctxpopup_add() return NULL");
+ elm_ctxpopup_direction_priority_set(dial_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+
+ ph_dialer_util_get_pure_numstr_with_plus(dial_d, buf);
+
+ evas_object_smart_callback_add(dial_d->popup, "dismissed", dialer_popup_del_cb, dial_d);
+
+ if (!dial_d->ug)
+ elm_ctxpopup_item_append(dial_d->popup, S_(PH_SYS_BODY_MESSAGE), NULL,
+ dialer_ctx_message_cb, dial_d);
+ elm_ctxpopup_item_append(dial_d->popup, T_(PH_GET_TEXT_BASIC, PHTEXT_SPEEDDIAL), NULL,
+ ph_dialer_util_speeddial_show_cb, dial_d);
+ snprintf(buf, sizeof(buf), T_(PH_GET_TEXT_BASE_OP, PHTEXT_ADD_PAUSE), 2);
+ elm_ctxpopup_item_append(dial_d->popup, buf, NULL,
+ dialer_add_pause_cb, dial_d);
+ elm_ctxpopup_item_append(dial_d->popup, T_(PH_GET_TEXT_BASE_OP, PHTEXT_ADD_WAIT), NULL,
+ dialer_add_wait_cb, dial_d);
+
+ if (!dial_d->ug)
+ elm_ctxpopup_item_append(dial_d->popup, T_(PH_GET_TEXT_BASE_OP, PHTEXT_EXIT), NULL,
+ dialer_exit_cb, dial_d);
+
+ int x, y, w, h;
+ edje_object_part_geometry_get(_EDJ(dial_d->layout), "option_btn", &x, &y, &w, &h);
+
+ evas_object_move(dial_d->popup, x+(w/2), (y+167)+(h/2));
+ evas_object_show(dial_d->popup);
+}
+
+static void dialer_softkey_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ p_retm_if(data == NULL, "Invalid argument: ph_dialer_data *is NULL");
+
+ PH_DBG("source:[%s]", source);
+
+ /* defense code for long-press */
+ /* remove longpress timer */
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer=NULL;
+ }
+
+ if (strstr(source, "call") != NULL) /* normal/call, dc/call */
+ dialer_softkey_call_clicked(dial_d, 0);
+ else if (strcmp(source, "normal/message") == 0)
+ dialer_softkey_msg_clicked(dial_d);
+ else if (0 == strcmp(source, "return_btn")) {
+ if (dial_d->ug)
+ phone_ug_destroy_me_cb(dial_d->ug, NULL, NULL);
+ return;
+ }
+ else if (0 == strcmp(source, "option_btn")) {
+ dialer_option_btn_cb(dial_d);
+ return;
+ }
+ else if (0 == strcmp(source, "search/inputarea/image"))
+ {
+ dialer_contactsearch_btn_cb(dial_d);
+ return;
+ }
+
+ ph_dialer_util_get_numstr_from_node(dial_d, buf);
+ if (strcmp(source, "input_del") != 0)
+ ph_dialer_entry_set_number(dial_d, buf, CURSOR_END);
+ else
+ ph_dialer_entry_set_number(dial_d, buf, 0);
+}
+
+static char* dialer_gl_cc_label_get(ph_dialer_data *dial_d, ph_cc_name_mcc_info *item, Evas_Object *obj, const char *part)
+{
+ char buf[PH_TAG_TEXT_MAX_LEN] = {0};
+ char text[PH_TAG_TEXT_MAX_LEN] = {0};
+ int text_len;
+ p_retvm_if(NULL == dial_d, NULL, "dial data is null");
+
+ if (0 == strcmp(part, "elm.text.left.name")) {
+ return strdup(item->name);
+ }
+ else if (0 == strcmp(part, "elm.text.left.number")) {
+ text_len = ph_dialer_util_get_pure_numstr(dial_d, text);
+ ph_dialer_util_highlight_substring(buf, sizeof(buf), item->cc, text);
+ return strdup(buf);
+ }
+ else
+ return NULL;
+}
+
+Evas_Object* ph_dialer_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ p_retvm_if(NULL == data, NULL, "data is null");
+
+ ph_dialer_data *dial_d = evas_object_data_get(obj, KEY_DIALER_DATA);
+ p_retvm_if(NULL == dial_d, NULL, "ph_dialer_data dial_d is null");
+ if (dial_d->list_mode == MODE_COUNTRY_CODE)
+ return NULL;
+
+ ph_dial_search_d *sd = data;
+ Evas_Object *ic;
+
+ if (0 == strcmp(part, "elm.icon.1")) {
+ if (sd->img_path && *sd->img_path) {
+ ic = elm_icon_add(obj);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add is failed");
+ elm_icon_file_set(ic, sd->img_path, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return ic;
+ }
+ }
+
+ return NULL;
+}
+
+char* ph_dialer_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ p_retvm_if(NULL == data, NULL, "dialer data is null");
+ ph_dial_search_d *sd = data;
+
+ ph_dialer_data *dial_d = evas_object_data_get(obj, KEY_DIALER_DATA);
+ p_retvm_if(NULL == dial_d, NULL, "dialer data is null");
+
+ char buf[PH_TAG_TEXT_MAX_LEN] = {0};
+ char resultbuf[PH_TAG_TEXT_MAX_LEN] = {0};
+
+ if (dial_d->list_mode == MODE_COUNTRY_CODE)
+ return dialer_gl_cc_label_get(dial_d, data, obj, part);
+
+ if (0 == strcmp(part, "elm.text.left.name")) {
+ if (sd->display && *sd->display) {
+ if (sd->type == SEARCH_CONTACT_NAME_TYPE) {
+ ph_dialer_util_highlight_substring_with_pos(buf, sizeof(buf), sd->display, sd->position, sd->len);
+ return strdup(buf);
+ }
+ else
+ return strdup(sd->display);
+ }
+ return NULL;
+ }
+ else if (0 == strcmp(part, "elm.text.left.number")) {
+ if (sd->type == SEARCH_LOG_TYPE)
+ {
+ ph_dialer_util_highlight_substring(buf, sizeof(buf), sd->number, sd->find_number);
+ return strdup(buf);
+ }
+ else
+ {
+ if (sd->number_type & CONTACTS_NUMBER_TYPE_CUSTOM && sd->numtype_label && sd->numtype_label[0])
+ snprintf(resultbuf, sizeof(resultbuf), "%s %s", sd->numtype_label, sd->number);
+ else
+ snprintf(resultbuf, sizeof(resultbuf), "%s %s", T_(CT_GET_TEXT_NUM_TYPE, phone_detail_log_get_phonenumber_type(sd->number_type)), sd->number);
+ if (sd->type == SEARCH_CONTACT_NAME_TYPE)
+ return strdup(resultbuf);
+ else {
+ ph_dialer_util_highlight_substring(buf, sizeof(buf), resultbuf, sd->find_number);
+ return strdup(buf);
+ }
+ }
+ }
+ else
+ return NULL;
+}
+
+static void dialer_fastscroll_level_up(void *data, Evas_Object *obj, void *event_info)
+{
+ int level = elm_index_item_level_get(obj);
+ const Elm_Object_Item *it;
+ const Elm_Object_Item *index;
+ ph_cc_name_mcc_info *item;
+ char prev_ch[4] = {0};
+ char prev_ch_first[2] = {0};
+ p_retm_if(1 != level, "level is not 1");
+
+ index = elm_index_selected_item_get(obj, level - 1);
+ elm_index_item_clear(obj);
+
+ it= elm_object_item_data_get(index);
+ p_retm_if(NULL == it, "elm_object_item_data_get(%p) returns NULL", index);
+
+ item = elm_object_item_data_get(it);
+ prev_ch_first[0]=item->name[0];
+
+ while (it) {
+ item = elm_object_item_data_get(it);
+
+ if (prev_ch_first[0] != item->name[0])
+ break;
+
+ if (prev_ch[0] != item->name[1]) {
+ prev_ch[0] = item->name[1];
+ elm_index_item_append(obj, prev_ch, NULL, it);
+ }
+ it = elm_genlist_item_next_get(it);
+ }
+ elm_index_level_go(obj, level);
+}
+
+static void dialer_fastscroll_level_down(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+}
+
+static void dialer_fastscroll_index_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_DBG("obj:%x, level:%d", (unsigned int)obj, elm_index_item_level_get(obj));
+ elm_genlist_item_bring_in(elm_object_item_data_get(event_info),
+ ELM_GENLIST_ITEM_SCROLLTO_TOP);
+}
+
+static Evas_Object* dialer_create_genlist(ph_dialer_data *dial_d)
+{
+ Evas_Object *genlist;
+ Elm_Theme *th;
+
+ genlist = elm_genlist_add(dial_d->layout);
+ p_retvm_if(NULL == genlist, NULL, "elm_genlist_add is failed");
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, DIALER_THEME_EDJ);
+ dial_d->th = th;
+ elm_object_theme_set(genlist, dial_d->th);
+ evas_object_data_set(genlist, KEY_DIALER_DATA, dial_d);
+
+ return genlist;
+}
+
+static void dialer_create_index(ph_dialer_data *dial_d)
+{
+ dial_d->fast_index = elm_index_add(dial_d->layout);
+ elm_object_part_content_set(dial_d->layout, "search_list/index", dial_d->fast_index);
+ edje_object_signal_emit(_EDJ(dial_d->layout),
+ "viewobject/search_list/index/hide", "viewobject/search_list/index");
+
+ evas_object_smart_callback_add(dial_d->fast_index, "level,up", dialer_fastscroll_level_up, NULL);
+ evas_object_smart_callback_add(dial_d->fast_index, "level,down", dialer_fastscroll_level_down, NULL);
+ evas_object_smart_callback_add(dial_d->fast_index, "delay,changed", dialer_fastscroll_index_changed, NULL);
+ evas_object_smart_callback_add(dial_d->fast_index, "selected", dialer_fastscroll_index_changed, NULL);
+ elm_index_level_go(dial_d->fast_index, 0);
+}
+
+void ph_dialer_update_cnt_btn(ph_dialer_data *dial_d, int count)
+{
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ if (count < 2) {
+ elm_object_part_text_set(dial_d->count_layout, "btn_style/number", NULL);
+// elm_object_disabled_set(dial_d->count_button, EINA_TRUE);
+ edje_object_signal_emit(_EDJ(dial_d->count_layout),"count_button/hide", "count_button");
+ }
+ else {
+ snprintf(buf, sizeof(buf), "%d", count);
+ elm_object_part_text_set(dial_d->count_layout, "btn_style/number", buf);
+ elm_object_disabled_set(dial_d->count_button, EINA_FALSE);
+ edje_object_signal_emit(_EDJ(dial_d->count_layout),"count_button/opened", "count_button");
+ }
+}
+
+static void dialer_entry_set_number_noresize(ph_dialer_data *dial_d, char *text)
+{
+ PH_FN_CALL;
+ int size = MAX_DIAL_NUMBER_FONT_SIZE;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ int pos;
+
+ snprintf(buf, sizeof(buf), "DEFAULT='align=left font=Tizen:style=Thin text_class=tizen font_size=%d color=#FFFFFF'", size);
+ elm_entry_text_style_user_push(dial_d->entry, buf);
+
+ if (text && *text)
+ snprintf(buf, sizeof(buf), PH_DIALER_ENTRY_DEFAULT_STYLE, size, text);
+ else
+ snprintf(buf, sizeof(buf), PH_DIALER_ENTRY_EMPTY_STYLE, size);
+ elm_entry_entry_set(dial_d->entry, buf);
+
+ pos = ph_dialer_util_get_cursor_pos(dial_d);
+ elm_entry_cursor_pos_set(dial_d->entry, pos);
+}
+
+void ph_dialer_entry_set_number(ph_dialer_data *dial_d, char *orig, int cursor)
+{
+ PH_FN_CALL;
+ char text[PH_TEXT_MAX_LEN] = {0};
+ if (orig && *orig)
+ {
+ snprintf(text, sizeof(text), PH_DIALER_ENTRY_DEFAULT_STYLE, dial_d->entry_font_size, orig);
+ if (dial_d->run_mode != PH_DAILER_EMERGENCY && strcmp("hide",edje_object_part_state_get(_EDJ(dial_d->layout), "textblock/textarea", NULL)))
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/entry/show", "viewobject/entry");
+ }
+ else
+ {
+ snprintf(text, sizeof(text), PH_DIALER_ENTRY_EMPTY_STYLE, dial_d->entry_font_size);
+// if (dial_d->run_mode != PH_DAILER_EMERGENCY)
+// edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/entry/hide", "viewobject/entry");//temporalily HIDE for contact search implmentation (kc.jun)
+ }
+ elm_entry_entry_set(dial_d->entry, text);
+
+ if (cursor == CURSOR_END)
+ cursor = STRLEN(orig);
+ else if (cursor == CURSOR_BEGIN)
+ cursor = 0;
+ else if (cursor == 0)
+ cursor = ph_dialer_util_get_cursor_pos(dial_d);
+
+ dial_d->number_cursor = ph_dialer_util_get_node_by_index(dial_d, cursor);
+ elm_entry_cursor_pos_set(dial_d->entry, cursor);
+ PH_FN_END;
+}
+
+static void dialer_clear_thread(ph_dialer_data *dial_d)
+{
+ dial_d->t_info->alive = false;
+ if (dial_d->t_info->epipe) {
+ ecore_pipe_write_close(dial_d->t_info->epipe);
+ ecore_pipe_read_close(dial_d->t_info->epipe);
+ ecore_pipe_del(dial_d->t_info->epipe);
+ dial_d->t_info->epipe = NULL;
+ }
+ pthread_join(dial_d->t_info->thread, NULL);
+ free(dial_d->t_info);
+ dial_d->t_info = NULL;
+}
+
+Eina_Bool ph_dialer_reload_data(void *data)
+{
+ PH_FN_CALL;
+ int count = 0;
+ ph_dialer_data *dial_d = data;
+ p_retvm_if(NULL == data, ECORE_CALLBACK_CANCEL, "data is null");
+ p_retvm_if(!dial_d->data_dirty_flag, ECORE_CALLBACK_CANCEL, "data is not changed");
+
+ if (dial_d->data_dirty_flag & CONTACT_DATA_CHAGNED) {
+ phone_free_speeddial_data(dial_d->speeddial_list);
+ dial_d->speeddial_list = phone_load_speeddial_data(&count);
+
+ if (dial_d->t_info)
+ dialer_clear_thread(dial_d);
+ dial_d->loading = false;
+
+ if (dial_d->contact_list) {
+ phone_free_contacts(dial_d->contact_list);
+ dial_d->contact_list = NULL;
+ }
+ }
+ else if (dial_d->data_dirty_flag & SPEEDDIAL_DATA_CHAGNED) {
+ phone_free_speeddial_data(dial_d->speeddial_list);
+ dial_d->speeddial_list = phone_load_speeddial_data(&count);
+ }
+ dial_d->data_dirty_flag = 0;
+ ph_dialer_search_request(dial_d, TRUE);
+ dial_d->update_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void dialer_contact_data_changed_cb(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == data, "data is null");
+
+ if (dial_d->update_timer) {
+ ecore_timer_del(dial_d->update_timer);
+ dial_d->update_timer = NULL;
+ }
+
+ if (dial_d->is_background) {
+ dial_d->data_dirty_flag |= CONTACT_DATA_CHAGNED;
+ dial_d->update_timer = ecore_timer_add(3.0, ph_dialer_reload_data, dial_d);
+ }
+ else {
+ int count = 0;
+ phone_free_speeddial_data(dial_d->speeddial_list);
+ dial_d->speeddial_list = phone_load_speeddial_data(&count);
+
+ if (dial_d->t_info)
+ dialer_clear_thread(dial_d);
+ dial_d->loading = false;
+
+ if (dial_d->contact_list) {
+ phone_free_contacts(dial_d->contact_list);
+ dial_d->contact_list = NULL;
+ }
+
+ ph_dialer_search_request(dial_d, TRUE);
+ }
+ PH_FN_END;
+}
+
+static void dialer_speeddial_data_changed_cb(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ p_retm_if(NULL == data, "data is null");
+
+ if (dial_d->update_timer) {
+ ecore_timer_del(dial_d->update_timer);
+ dial_d->update_timer = NULL;
+ }
+
+ if (dial_d->is_background) {
+ dial_d->data_dirty_flag |= SPEEDDIAL_DATA_CHAGNED;
+ dial_d->update_timer = ecore_timer_add(3.0, ph_dialer_reload_data, dial_d);
+ }
+ else {
+ int count = 0;
+ phone_free_speeddial_data(dial_d->speeddial_list);
+ dial_d->speeddial_list = phone_load_speeddial_data(&count);
+ ph_dialer_search_request(dial_d, TRUE);
+ }
+}
+
+static void dialer_log_data_changed_cb(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+
+ if (dial_d->update_timer) {
+ ecore_timer_del(dial_d->update_timer);
+ dial_d->update_timer = NULL;
+ }
+
+ if (dial_d->is_background) {
+ dial_d->data_dirty_flag |= LOG_DATA_CHAGNED;
+ dial_d->update_timer = ecore_timer_add(3.0, ph_dialer_reload_data, dial_d);
+ }
+ else
+ ph_dialer_search_request(dial_d, TRUE);
+}
+
+static void dialer_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = (ph_dialer_data *)data;
+ p_retm_if(NULL == dial_d, "dial_d is null");
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_db_remove_changed_cb(_contacts_person._uri, dialer_contact_data_changed_cb, dial_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ err = contacts_db_remove_changed_cb(_contacts_phone_log._uri, dialer_log_data_changed_cb, dial_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ err = contacts_db_remove_changed_cb(_contacts_speeddial._uri, dialer_speeddial_data_changed_cb, dial_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ ph_dialer_util_del_all_number(dial_d);
+
+ if (dial_d->t_info)
+ dialer_clear_thread(dial_d);
+
+ if (dial_d->search_idler)
+ ecore_idler_del(dial_d->search_idler);
+
+ if (dial_d->popup)
+ evas_object_del(dial_d->popup);
+
+ if (dial_d->job)
+ ecore_job_del(dial_d->job);
+
+ if (dial_d->search_timer)
+ ecore_timer_del(dial_d->search_timer);
+
+ if (dial_d->dash_timer)
+ ecore_timer_del(dial_d->dash_timer);
+
+ if (dial_d->longpress_timer)
+ ecore_timer_del(dial_d->longpress_timer);
+
+ if (dial_d->update_timer)
+ ecore_timer_del(dial_d->update_timer);
+
+ if (dial_d->slide_timer)
+ ecore_timer_del(dial_d->slide_timer);
+
+ if(dialMultitouchInfo && dialMultitouchInfo->keypad_reset_timer)
+ ecore_timer_del(dialMultitouchInfo->keypad_reset_timer);
+
+ if (dial_d->key_press)
+ ecore_event_handler_del(dial_d->key_press);
+
+ if (dial_d->key_release)
+ ecore_event_handler_del(dial_d->key_release);
+
+ feedback_deinitialize();
+
+ if (dial_d->th) {
+ elm_theme_extension_del(dial_d->th, DIALER_THEME_EDJ);
+ elm_theme_free(dial_d->th);
+ }
+
+ phone_free_speeddial_data(dial_d->speeddial_list);
+ phone_free_contacts(dial_d->contact_list);
+
+ free(dial_d->longpress_source);
+ free(dial_d->searched_text);
+ free(dial_d);
+}
+
+static void dialer_entry_font_check(Evas_Object *entry, ph_dialer_data *dial_d, char *text, int pos)
+{
+ PH_FN_CALL;
+ static int status = 0;
+ Ecore_X_Window win;
+ int size;
+ int win_width;
+ int max_width;
+ int entry_width;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ int size_interval = 3;
+
+ win = ecore_x_window_root_get(ecore_x_window_focus_get());
+ ecore_x_window_size_get(win, &win_width, NULL);
+ evas_object_size_hint_min_get(entry, &entry_width, NULL);
+ max_width = win_width-142;
+
+ size = dial_d->entry_font_size;
+// PH_DBG("BEFORE: fontsize : %d, max_width : %d, entry_width : %d", size, max_width, entry_width);
+ if (max_width < entry_width) {
+ if (MIN_DIAL_NUMBER_FONT_SIZE < size) {
+ size-=size_interval;
+ snprintf(buf, sizeof(buf), PH_DIALER_ENTRY_DEFAULT_STYLE, size, text);
+ status = -1;
+ dial_d->entry_font_size = size;
+ elm_entry_entry_set(dial_d->entry, buf);
+// PH_DBG("####### elm_entry_entry_set, %s", buf);
+ elm_entry_cursor_pos_set(dial_d->entry, pos);
+ }
+ }
+ else if (entry_width < max_width) {
+ if (status == -1) {
+ status = 0;
+ return;
+ }
+ if (size < MAX_DIAL_NUMBER_FONT_SIZE) {
+ size+=size_interval;
+ snprintf(buf, sizeof(buf), PH_DIALER_ENTRY_DEFAULT_STYLE, size, text);
+ status = 1;
+ dial_d->entry_font_size = size;
+ elm_entry_entry_set(dial_d->entry, buf);
+ elm_entry_cursor_pos_set(dial_d->entry, pos);
+ }
+ }
+ else
+ status = 0;
+// evas_object_size_hint_min_get(entry, &entry_width, NULL);
+// PH_DBG("AFTER: fontsize : %d, max_width : %d, entry_width : %d", size, max_width, entry_width);
+}
+
+static int dialer_include_zero_space(char *text)
+{
+ int len;
+ int i;
+
+ p_retv_if(NULL == text, -1);
+
+ len = strlen(text);
+ for (i = 0;i<len-2;i++) {
+ if (text[i] == (char)0xe2 && text[i+1] == (char)0x80 && text[i+2] == (char)0x8b)
+ return i;
+ }
+ return -1;
+}
+
+static int dialer_trim_dash_from_numstr(char *src, char *dest_buf, int buf_size, int cursor)
+{
+ int number_index= 0;
+ int scan_index = 0;
+ int zero_pos;
+
+ p_retvm_if(NULL == src || '\0' == *src, -1, "src is NULL");
+ p_retvm_if(NULL == dest_buf, -1, "dest_buf is NULL");
+
+ zero_pos = dialer_include_zero_space(src);
+
+ while (src[scan_index] && number_index < buf_size) {
+ if (scan_index == zero_pos) {
+ scan_index += 3;
+ if (number_index < cursor)
+ cursor--;
+ continue;
+ }
+ if (!ph_dialer_util_is_dash(src[scan_index]))
+ dest_buf[number_index++] = src[scan_index];
+ else if (number_index < cursor)
+ cursor--;
+ scan_index++;
+ }
+ dest_buf[number_index] = '\0';
+ return cursor;
+}
+
+static void dialer_entry_text_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ int pos, cursor;
+ char node_text[PH_TEXT_MAX_LEN] = {0};
+ char entry_text[PH_TEXT_MAX_LEN] = {0};
+ const char *org;
+ char *text;
+ int differ = 0;
+
+ org = elm_entry_entry_get(obj);
+ p_retm_if(NULL == org , "entry text is null");
+ text = elm_entry_markup_to_utf8(org);
+
+ // set text when cut/copy/paste
+ ph_dialer_util_get_pure_numstr_with_plus(dial_d, node_text);
+ pos = elm_entry_cursor_pos_get(dial_d->entry);
+ cursor = dialer_trim_dash_from_numstr(text, entry_text, sizeof(entry_text), pos);
+ differ = strcmp(node_text, entry_text);
+
+ if (0 <= dialer_include_zero_space(text) && strlen(text) == 3 && 0 == differ) {
+ free(text);
+ return;
+ }
+
+ const char* endtag = strstr(org, PH_DIALER_ENTRY_STYLE_END_TAG);
+ if (0 != differ
+ || (endtag && endtag[3] != '\0')) {
+ PH_DBG("update entry");
+ ph_dialer_util_append_node_from_numstr(dial_d, entry_text);
+ dial_d->number_cursor = ph_dialer_util_get_node_by_index(dial_d, cursor);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, node_text);
+ ph_dialer_entry_set_number(dial_d, node_text, 0);
+ ph_dialer_search_request(dial_d, FALSE);
+ free(text);
+ return;
+ }
+
+#ifdef _ADJUST_FONTSIZE
+ if (NULL == strstr(org, "font_size")) {
+ if (MAX_DIAL_NUMBER_FONT_SIZE == dial_d->entry_font_size)
+ dial_d->entry_font_size--;
+ else if (MIN_DIAL_NUMBER_FONT_SIZE == dial_d->entry_font_size)
+ dial_d->entry_font_size++;
+ }
+ PH_DBG("dial_d->entry_font_size : %d", dial_d->entry_font_size);
+ dialer_entry_font_check(obj, dial_d, text, pos);
+#endif
+
+ free(text);
+ PH_FN_END;
+ return;
+}
+
+static void dialer_create_entry(ph_dialer_data *dial_d)
+{
+ Evas_Object *scroller;
+ Evas_Object *entry;
+
+ scroller = elm_scroller_add(dial_d->layout);
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_scroller_content_min_limit(scroller, EINA_FALSE, EINA_TRUE);
+ elm_object_part_content_set(dial_d->layout, "textblock/textarea", scroller);
+
+ entry = elm_entry_add(dial_d->layout);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_editable_set(entry, EINA_TRUE);
+ elm_entry_magnifier_disabled_set(entry, EINA_TRUE);
+ elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(scroller, entry);
+ dial_d->entry = entry;
+
+ evas_object_smart_callback_add(entry, "selection,changed", dialer_entry_selection_changed, dial_d);
+ evas_object_smart_callback_add(entry, "cursor,changed", dialer_entry_cursor_changed, dial_d);
+ evas_object_smart_callback_add(entry, "changed", dialer_entry_text_changed, dial_d);
+ evas_object_event_callback_add(entry, EVAS_CALLBACK_MOUSE_DOWN, dialer_entry_mouse_down, dial_d);
+ evas_object_event_callback_add(entry, EVAS_CALLBACK_MOUSE_UP, dialer_entry_mouse_up, dial_d);
+}
+
+static void dialer_entry_number_init(void *data)
+{
+ PH_FN_CALL;
+ int ret;
+ char *buf;
+ int value;
+ char num[PH_TEXT_MAX_LEN] = {0};
+ ph_dialer_data *dial_d = data;
+
+ p_retm_if(PH_DAILER_EMERGENCY == dial_d->run_mode, "It is Emergency mode");
+
+ value = FALSE;
+ ret = vconf_get_bool(VCONFKEY_CISSAPPL_PREFIX_DIAL_BOOL, &value);
+ if(dial_d->searched_text) {
+ ph_dialer_util_append_node_from_numstr_with_strip(dial_d, dial_d->searched_text);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, num);
+ ph_dialer_entry_set_number(dial_d, num, CURSOR_END);
+ ph_dialer_search_request(dial_d, TRUE);
+ }
+ else if (value == TRUE) {
+ ret = vconf_get_int(VCONFKEY_CISSAPPL_PREFIX_DIAL_VALUE_INT, &value);
+ PH_DBG("prefix dial index: %d", value);
+ buf = NULL;
+ switch (value) {
+ case 0:
+ buf = vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM1_STR);
+ break;
+ case 1:
+ buf = vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM2_STR);
+ break;
+ case 2:
+ buf = vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM3_STR);
+ break;
+ case 3:
+ buf = vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM4_STR);
+ break;
+ case 4:
+ buf = vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM5_STR);
+ break;
+ default:
+ PH_DBG("wrong prefix index(%d)", value);
+ break;
+ }
+
+ if (buf && *buf) {
+ ph_dialer_util_append_node_from_numstr_with_strip(dial_d, buf);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, num);
+ ph_dialer_entry_set_number(dial_d, num, CURSOR_END);
+ ph_dialer_search_request(dial_d, FALSE);
+ free(buf);
+ }
+ }
+ else
+ dialer_entry_set_number_noresize(dial_d, "");
+ dial_d->initialized = TRUE;
+}
+
+static void __keypad_bg_handler(ph_dialer_data *dial_d, int x, int y, char* signal)
+{
+ PH_FN_CALL;
+ int i;
+
+ for(i=0;i<MULTI_TOUCH_SUPPORT_KEY_COUNT;i++)
+ {
+ Evas_Coord_Rectangle* rect = &dialMultitouchInfo->dial_btn[i];
+
+ if( x >= rect->x && y >= rect->y && x <= rect->x + rect->w && y <= rect->y+rect->h)
+ {
+ PH_DBG("%s, %s", signal, dialMultitouchInfo->dial_btn_name[i]);
+ edje_object_signal_emit(_EDJ(dial_d->layout), signal, dialMultitouchInfo->dial_btn_name[i]);
+ break;
+ }
+ }
+}
+
+static void __keypad_reset_timer_cb(ph_dialer_data *dial_d)
+{
+ p_retm_if(NULL == dial_d, "dialer data is null");
+ p_retm_if(NULL == dialMultitouchInfo, "dialMultitouchInfo data is null");
+
+ int i;
+ for(i=0;i<MULTI_TOUCH_SUPPORT_KEY_COUNT;i++)
+ {
+ //Evas_Coord_Rectangle* rect = &dialMultitouchInfo->dial_btn[i];
+ edje_object_signal_emit(_EDJ(dial_d->layout), "mouse,up,1", dialMultitouchInfo->dial_btn_name[i]);
+ }
+ dialMultitouchInfo->keypad_reset_timer = NULL;
+}
+
+static void dialer_keypad_bg_up(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ PH_FN_CALL;
+ Evas_Event_Mouse_Up *ev = event_info;
+ ph_dialer_data *dial_d = data;
+
+ //PH_DBG("dialer_keypad_bg_up : x %d y %d", ev->output.x, ev->output.y);
+
+ // Multi-key pressed sceanario should reset all dial key
+ if(dialMultitouchInfo->lastMultiDown == TRUE)
+ {
+ if(dialMultitouchInfo->keypad_reset_timer)
+ {
+ ecore_timer_del(dialMultitouchInfo->keypad_reset_timer);
+ dialMultitouchInfo->keypad_reset_timer = NULL;
+ }
+ dialMultitouchInfo->keypad_reset_timer = ecore_timer_add(START_KEYPAD_RESET_TIMER, __keypad_reset_timer_cb, dial_d);
+ }
+ // normal scenario for touch & drag + release
+ else if(dialMultitouchInfo->lastDown == TRUE &&
+ (dialMultitouchInfo->lastDownX != ev->output.x || dialMultitouchInfo->lastDownY != ev->output.y))
+ {
+ __keypad_bg_handler(dial_d, dialMultitouchInfo->lastDownX, dialMultitouchInfo->lastDownY, "mouse,up,1");
+ }
+
+ dialMultitouchInfo->lastDown = FALSE;
+ dialMultitouchInfo->lastMultiDown = FALSE;
+
+ __keypad_bg_handler(dial_d, ev->output.x , ev->output.y, "mouse,up,1");
+}
+
+static void dialer_keypad_bg_down(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ PH_FN_CALL;
+ Evas_Event_Mouse_Down *ev = event_info;
+ ph_dialer_data *dial_d = data;
+
+ //PH_DBG("dialer_keypad_bg_down : x %d y %d", ev->output.x, ev->output.y);
+ dialMultitouchInfo->lastDownX = ev->output.x;
+ dialMultitouchInfo->lastDownY = ev->output.y;
+ dialMultitouchInfo->lastDown = TRUE;
+
+ __keypad_bg_handler(dial_d, ev->output.x , ev->output.y, "mouse,down,1");
+}
+
+static void dialer_keypad_bg_multi_up(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ PH_FN_CALL;
+ Evas_Event_Multi_Up *ev = event_info;
+ ph_dialer_data *dial_d = data;
+
+ PH_DBG("dialer_keypad_bg_multi_up : x %d y %d", ev->output.x, ev->output.y);
+
+ __keypad_bg_handler(dial_d, ev->output.x , ev->output.y, "mouse,up,1");
+}
+static void dialer_keypad_bg_multi_down(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ PH_FN_CALL;
+ Evas_Event_Multi_Down *ev = event_info;
+ ph_dialer_data *dial_d = data;
+
+ PH_DBG("dialer_keypad_bg_multi_down : x %d y %d", ev->output.x, ev->output.y);
+ dialMultitouchInfo->lastMultiDown = TRUE;
+ if(dialMultitouchInfo->lastDown == TRUE)
+ {
+ __keypad_bg_handler(dial_d, dialMultitouchInfo->lastDownX, dialMultitouchInfo->lastDownY, "mouse,up,1");
+
+ dialMultitouchInfo->lastDownX = ev->output.x;
+ dialMultitouchInfo->lastDownY = ev->output.y;
+ dialMultitouchInfo->lastDown = TRUE;
+ }
+
+ __keypad_bg_handler(dial_d, ev->output.x , ev->output.y, "mouse,down,1");
+}
+
+static void dialer_multi_touch_init (ph_dialer_data *dial_d)
+{
+ PH_FN_CALL;
+ Evas_Coord h, w, x, y;
+ Evas_Coord_Rectangle* rect = NULL;
+ int i;
+ Evas_Object *evasKpdArea, *evasKeyArea, *kpdArea;
+ Evas* evas;
+ const char* btn_name[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "star", "sharp" };
+
+ p_retm_if(NULL != dialMultitouchInfo, "dialer_multi_touch_init aleady done!");
+ dialMultitouchInfo = calloc(1, sizeof(dial_multiTouch_info));
+
+ for(i=0;i<MULTI_TOUCH_SUPPORT_KEY_COUNT;i++)
+ {
+ rect = &dialMultitouchInfo->dial_btn[i];
+ dialMultitouchInfo->dial_btn_name[i] = btn_name[i];
+ evasKeyArea = (Evas_Object *)edje_object_part_object_get(_EDJ(dial_d->layout), btn_name[i]);
+ evas_object_geometry_get(evasKeyArea, &rect->x,&rect->y,&rect->w,&rect->h);
+ PH_DBG("edje_object_part_geometry_get : [%s]x %d y %d w %d h %d", btn_name[i], rect->x, rect->y, rect->w, rect->h);
+ }
+
+ rect = &dialMultitouchInfo->background;
+ evasKpdArea = (Evas_Object *)edje_object_part_object_get(_EDJ(dial_d->layout), "keypad/swallow");
+ evas_object_geometry_get(evasKpdArea, &rect->x,&rect->y,&rect->w,&rect->h);
+ PH_DBG("edje_object_part_geometry_get : x %d y %d w %d h %d", rect->x, rect->y, rect->w, rect->h);
+
+ // remove bottom line btn area from layout geometry value
+ rect->h-= dialMultitouchInfo->dial_btn[0].h;
+
+ evas = evas_object_evas_get(dial_d->layout);
+ kpdArea = evas_object_rectangle_add(evas);
+
+ // Temporary patch for UG slide effect problem
+ evas_output_viewport_get(evas, &x, &y, &w, &h);
+ #define DIALER_PADDING_SIZE 3
+ if(dialMultitouchInfo->background.x >= w-DIALER_PADDING_SIZE)
+ {
+ PH_DBG("evas_output_viewport_get : x %d y %d w %d h %d", x, y, w, h);
+ w-=DIALER_PADDING_SIZE;
+ dialMultitouchInfo->background.x-=w;
+ for(i=0;i<MULTI_TOUCH_SUPPORT_KEY_COUNT;i++)
+ {
+ rect = &dialMultitouchInfo->dial_btn[i];
+ rect->x-=w;
+ }
+ }
+ ////////////////////////////////////////////
+
+ evas_object_color_set(kpdArea, 0, 0, 0, 0);
+ elm_object_part_content_set(dial_d->layout, "keypad/swallow", kpdArea);
+ evas_object_show(kpdArea);
+
+ evas_object_event_callback_add(kpdArea, EVAS_CALLBACK_MOUSE_DOWN, dialer_keypad_bg_down, dial_d);
+ evas_object_event_callback_add(kpdArea, EVAS_CALLBACK_MOUSE_UP, dialer_keypad_bg_up, dial_d);
+ evas_object_event_callback_add(kpdArea, EVAS_CALLBACK_MULTI_DOWN, dialer_keypad_bg_multi_down, dial_d);
+ evas_object_event_callback_add(kpdArea, EVAS_CALLBACK_MULTI_UP, dialer_keypad_bg_multi_up, dial_d);
+
+}
+static void dialer_lazy_init(void *data)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d = data;
+ Evas_Object *genlist;
+ int count;
+
+ dialer_create_index(dial_d);
+ dialer_create_entry(dial_d);
+ dial_d->entry_font_size = MAX_DIAL_NUMBER_FONT_SIZE;
+ dial_d->number_cursor = &(dial_d->number_head);
+
+ feedback_initialize();
+
+ edje_object_signal_callback_add(_EDJ(dial_d->layout), "pad_clicked", "*", dialer_keypad_clicked, dial_d);
+ edje_object_signal_callback_add(_EDJ(dial_d->layout), "pad_down", "*", dialer_keypad_down, dial_d);
+ edje_object_signal_callback_add(_EDJ(dial_d->layout), "pad_up", "*", dialer_keypad_up, dial_d);
+ edje_object_signal_callback_add(_EDJ(dial_d->layout), "softkey_clicked", "*", dialer_softkey_clicked, dial_d);
+ edje_object_signal_callback_add(_EDJ(dial_d->layout), "softkey_up", "*", dialer_softkey_up, dial_d);
+ edje_object_signal_callback_add(_EDJ(dial_d->layout), "softkey_down", "*", dialer_softkey_down, dial_d);
+
+ dialer_multi_touch_init(dial_d);
+
+ count = 0;
+ dial_d->speeddial_list = phone_load_speeddial_data(&count);
+ dial_d->job = ecore_job_add(dialer_entry_number_init, dial_d);
+}
+
+static void dialer_layout_flush_post_cb(void *data, Evas *e, void *event_info)
+{
+ ph_dialer_data *dial_d = data;
+ evas_event_callback_del(evas_object_evas_get(dial_d->layout),
+ EVAS_CALLBACK_RENDER_FLUSH_POST, dialer_layout_flush_post_cb);
+ dial_d->job = ecore_job_add(dialer_lazy_init, dial_d);
+}
+
+static void dialer_mousedown(void *data, Evas *evas, Evas_Object *obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ ph_dialer_data *dial_d = data;
+ dial_d->touch_x = ev->canvas.x;
+ dial_d->touch_y = ev->canvas.y;
+}
+
+static Eina_Bool _key_release_cb(void *data, int type, void *event)
+{
+ ph_dialer_data *dial_d = data;
+ p_retvm_if(dial_d == NULL, false, "dial_d is NULL");
+ p_retvm_if(dial_d->is_background == TRUE, false, "Dialer is not on top");
+ p_retvm_if(dial_d->child_ug != NULL, false, "child UG is exist.");
+ p_retvm_if(elm_object_focus_get(dial_d->entry)== TRUE, false, "Focus already has been set on entry.");
+
+ Evas_Event_Key_Up *ev = event;
+ if (!ev) {
+ PH_DBG("Invalid event object");
+ return ECORE_CALLBACK_RENEW;
+ }
+ PH_DBG("%d type / %s released.", type, ev->keyname);
+
+ if (dial_d->longpress_timer) {
+ ecore_timer_del(dial_d->longpress_timer);
+ dial_d->longpress_timer = NULL;
+ }
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool _key_press_cb(void* data, int type, void* event)
+{
+ ph_dialer_data *dial_d = data;
+ p_retvm_if(dial_d == NULL, false, "dial_d is NULL");
+ p_retvm_if(dial_d->is_background == TRUE, false, "Dialer is not on top");
+ p_retvm_if(dial_d->child_ug != NULL, false, "child UG is exist.");
+ p_retvm_if(elm_object_focus_get(dial_d->entry)== TRUE, false, "Focus already has been set on entry.");
+
+ Evas_Event_Key_Down *ev = event;
+ if (!ev) {
+ PH_DBG("Invalid event object");
+ return ECORE_CALLBACK_RENEW;
+ }
+ PH_DBG("%d type / %s pressed", type, ev->keyname);
+
+ if (!strcmp(ev->keyname, "Return") || !strcmp(ev->keyname, "Phone")) {
+ edje_object_signal_emit(_EDJ(dial_d->layout), "softkey_clicked", "call");
+ } else if (!strcmp(ev->keyname, "BackSpace")) {
+ edje_object_signal_emit(_EDJ(dial_d->layout), "softkey_down", "input_del");
+ } else if (ev->keyname[0] >= '0' && ev->keyname[0] <= '9') {
+ const Evas_Modifier *mods = evas_key_modifier_get(evas_object_evas_get(dial_d->layout));
+ if (evas_key_modifier_is_set(mods, "Shift"))
+ {
+ if (ev->keyname[0] == '3')
+ edje_object_signal_emit(_EDJ(dial_d->layout), "pad_down", "#");
+ else if (ev->keyname[0] == '8')
+ edje_object_signal_emit(_EDJ(dial_d->layout), "pad_down", "*");
+ }
+ else
+ edje_object_signal_emit(_EDJ(dial_d->layout), "pad_down", ev->keyname);
+ }
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+int ph_dialer_create_content(ph_dialer_data *dial_d)
+{
+ PH_FN_CALL;
+
+ dial_d->layout = elm_layout_add(dial_d->navi);
+ p_retvm_if(NULL == dial_d->layout, 0, "elm_layout_add() Failed");
+ elm_layout_file_set(dial_d->layout, DIALER_EDJ, "dialer/main");
+ evas_object_size_hint_weight_set(dial_d->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_event_callback_add(dial_d->layout, EVAS_CALLBACK_MOUSE_DOWN, dialer_mousedown, dial_d);
+
+ if (dial_d->is_emergency)
+ dial_d->run_mode = PH_DAILER_EMERGENCY;
+ else
+ dial_d->run_mode = PH_DAILER_NORMAL;
+ ph_dialer_util_setup_run_mode(dial_d);
+
+ edje_object_signal_emit(_EDJ(dial_d->layout), "main/default", "main");
+
+ evas_object_data_set(dial_d->layout, KEY_DIALER_DATA, dial_d);
+
+ PH_DBG("run_mode(before emit):%d", dial_d->run_mode);
+ if (PH_DAILER_NORMAL != dial_d->run_mode)
+ {
+ if (PH_DAILER_EMERGENCY == dial_d->run_mode)
+ {
+ edje_object_part_text_set(_EDJ(dial_d->layout), "return_btn/text", T_(PH_GET_TEXT_BASIC, PHTEXT_PREVIOUS_SCREEN_ABB));
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/entry/show", "viewobject/entry");
+ }
+ else if (PH_DAILER_DURING_CALL == dial_d->run_mode)
+ {
+ edje_object_part_text_set(_EDJ(dial_d->layout), "return_btn/text", T_(PH_GET_TEXT_BASIC, PHTEXT_BACK_TO_CALL));
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/entry/show", "viewobject/entry");//temporalily HIDE for contact search implmentation (kc.jun)
+ }
+ edje_object_signal_emit(_EDJ(dial_d->layout), "return_btn/default", "return_btn");
+ }
+ else
+ {
+ edje_object_signal_emit(_EDJ(dial_d->layout), "return_btn/hide", "return_btn");
+ edje_object_signal_emit(_EDJ(dial_d->layout), "softkey/normal", "softkey");
+ edje_object_signal_emit(_EDJ(dial_d->layout), "viewobject/entry/show", "viewobject/entry");//temporalily HIDE for contact search implmentation (kc.jun)
+ }
+
+ evas_object_event_callback_add(dial_d->layout, EVAS_CALLBACK_DEL,
+ dialer_view_delete_cb, dial_d);
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_db_add_changed_cb(_contacts_person._uri, dialer_contact_data_changed_cb, dial_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+ err = contacts_db_add_changed_cb(_contacts_phone_log._uri, dialer_log_data_changed_cb, dial_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+ err = contacts_db_add_changed_cb(_contacts_speeddial._uri, dialer_speeddial_data_changed_cb, dial_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+
+ evas_event_callback_add(evas_object_evas_get(dial_d->layout),
+ EVAS_CALLBACK_RENDER_FLUSH_POST, dialer_layout_flush_post_cb, dial_d);
+
+ dial_d->key_press = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, dial_d);
+ if (!dial_d->key_press)
+ PH_DBG("Failed to register a key down event handler");
+ dial_d->key_release = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, dial_d);
+ if (!dial_d->key_release)
+ PH_DBG("Failed to register a key up event handler");
+
+ return 1;
+}
+
+API void phone_dialer_set_navi(Evas_Object *layout)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ Elm_Object_Item *navi_it;
+
+ dial_d = evas_object_data_get(layout, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "dialer data is null");
+ navi_it = elm_naviframe_bottom_item_get(dial_d->navi);
+
+ phone_navi_item_clear(navi_it);
+
+ elm_object_item_part_content_set(navi_it, "prev_btn", NULL);
+}
+
+API void phone_dialer_view_reset(Evas_Object *layout)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ Elm_Object_Item *item;
+
+ dial_d = evas_object_data_get(layout, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "dialer data is null");
+
+ if (dial_d->child_ug) {
+ ug_destroy(dial_d->child_ug);
+ dial_d->child_ug = NULL;
+ }
+
+ item = elm_naviframe_bottom_item_get(dial_d->navi);
+ if (elm_naviframe_top_item_get(dial_d->navi) != item)
+ elm_naviframe_item_pop_to(item);
+}
+API void phone_dialer_view_language_changed(Evas_Object *layout)
+{
+ // TODO: Fixme
+}
+
+API void phone_dialer_check_focus(Evas_Object *layout)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ char *text;
+
+ dial_d = evas_object_data_get(layout, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "dialer data is null");
+
+ text = elm_entry_markup_to_utf8(elm_entry_entry_get(dial_d->entry));
+
+ if (dial_d->has_focus && text && dialer_include_zero_space(text) == -1)
+ elm_object_focus_set(dial_d->entry, EINA_TRUE);
+ else {
+ elm_object_focus_set(dial_d->entry, EINA_FALSE);
+ dial_d->has_focus = false;
+ }
+ free(text);
+}
+
+API void phone_dialer_view_resume(Evas_Object *layout)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ dial_d = evas_object_data_get(layout, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "dialer data is null");
+
+ if (!dial_d->initialized)
+ dialer_entry_number_init(dial_d);
+}
+
+API void phone_dialer_view_set_num(Evas_Object *layout, char *number)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ char dest[PH_TEXT_MAX_LEN] = {0};
+ dial_d = evas_object_data_get(layout, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "dialer data is null");
+
+ if (number != NULL)
+ {
+ if(dial_d->entry) {
+ ph_dialer_util_append_node_from_numstr_with_strip(dial_d, number);
+ ph_dialer_util_add_dashes(dial_d, DASH_REAL);
+ ph_dialer_util_get_numstr_from_node(dial_d, dest);
+ ph_dialer_entry_set_number(dial_d, dest, CURSOR_END);
+ ph_dialer_search_request(dial_d, FALSE);
+ }
+ else
+ dial_d->searched_text = SAFE_STRDUP(number);
+ }
+ else
+ ph_dialer_util_entry_clear(dial_d);
+}
+
+API void phone_dialer_view_send_key(Evas_Object *layout)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ dial_d = evas_object_data_get(layout, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "dialer data is null");
+
+ dialer_softkey_call_clicked(dial_d, 0);
+}
+
+API void phone_dialer_set_background(Evas_Object *obj, bool is_background)
+{
+ PH_FN_CALL;
+ ph_dialer_data *dial_d;
+ dial_d = evas_object_data_get(obj, KEY_DIALER_DATA);
+ p_retm_if(NULL == dial_d, "log data is null");
+
+ dial_d->is_background = is_background;
+ if (dial_d->update_timer) {
+ ecore_timer_del(dial_d->update_timer);
+ dial_d->update_timer = NULL;
+ ph_dialer_reload_data(dial_d);
+ }
+}
diff --git a/lib/dialer/ph-dialer-view.h b/lib/dialer/ph-dialer-view.h
new file mode 100755
index 0000000..76ea5ca
--- /dev/null
+++ b/lib/dialer/ph-dialer-view.h
@@ -0,0 +1,56 @@
+/*
+* 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 __PH_DIALER_VIEW_H__
+#define __PH_DIALER_VIEW_H__
+
+enum {
+ COUNT_BUTTON_CLOSE,
+ COUNT_BUTTON_OPEN
+};
+
+typedef enum {
+ SEARCH_LOG_TYPE,
+ SEARCH_SPEEDDIAL_TYPE,
+ SEARCH_CONTACT_NUM_TYPE,
+ SEARCH_CONTACT_NAME_TYPE,
+} search_type;
+
+#define KEY_DIALER_DATA "dialer_data"
+#define MULTI_TOUCH_SUPPORT_KEY_COUNT 12
+
+typedef struct {
+ Evas_Coord_Rectangle dial_btn[MULTI_TOUCH_SUPPORT_KEY_COUNT];
+ Evas_Coord_Rectangle background;
+ const char* dial_btn_name[MULTI_TOUCH_SUPPORT_KEY_COUNT];
+
+ Evas_Coord lastDownX, lastDownY;
+ Eina_Bool lastDown;
+ Eina_Bool lastMultiDown;
+ Ecore_Timer *keypad_reset_timer;
+} dial_multiTouch_info;
+
+
+int ph_dialer_create_content(ph_dialer_data *dial_d);
+void ph_dialer_entry_set_number(ph_dialer_data *dial_d, char *orig, int cursor);
+void ph_dialer_update_cnt_btn(ph_dialer_data *dial_d, int count);
+char* ph_dialer_gl_label_get(void *data, Evas_Object *obj, const char *part);
+Evas_Object* ph_dialer_gl_icon_get(void *data, Evas_Object *obj, const char *part);
+Eina_Bool ph_dialer_reload_data(void *data);
+
+
+#endif /* __PH_DIALER_VIEW_H__ */
diff --git a/lib/edc/contact_button.edc b/lib/edc/contact_button.edc
new file mode 100755
index 0000000..f887f44
--- /dev/null
+++ b/lib/edc/contact_button.edc
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+collections {
+ group {
+ name: "elm/button/base/transparency";
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ }
+ }
+}
diff --git a/lib/edc/contacts.edc b/lib/edc/contacts.edc
new file mode 100755
index 0000000..306b46e
--- /dev/null
+++ b/lib/edc/contacts.edc
@@ -0,0 +1,19 @@
+/*
+* 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 "list.edc"
+#include "input_theme.edc"
diff --git a/lib/edc/detail_theme.edc b/lib/edc/detail_theme.edc
new file mode 100644
index 0000000..3d3e626
--- /dev/null
+++ b/lib/edc/detail_theme.edc
@@ -0,0 +1,1732 @@
+/*
+* 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 GENLIST_PART_BG_COLOR_INC 248 246 239 255
+#define GENLIST_PART_LIST_LINE_COLOR_INC 169 169 169 255
+#define GENLIST_DIALOGUE_FONT_SUB_TITLE_COLOR_INC 102 102 102 255
+#define GENLIST_PART_LIST_TEXT_DEFAULT 0 0 0 255
+
+#define IMAGE_PATH "../images/contact_images/"
+#define BUTTON_CIRCLE_STYLE_BG_MIN_MAX_INC 138 138
+#define BUTTON_CIRCLE_STYLE_CONTENT_MIN_MAX_INC 138 138
+
+#define GENLIST_BASEINFO_PART_BASE(height) \
+part { \
+ name: "base"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 height; \
+ color: GENLIST_PART_BG_COLOR_INC; \
+ } \
+}
+
+#define GENLIST_PART_BASE( param_item_height ) \
+part { \
+ name: "base"; \
+ type: RECT; \
+ repeat_events: 1; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 param_item_height; \
+ color: GENLIST_PART_BG_COLOR_INC; \
+ } \
+}
+#define GENLIST_PART_BOTTOM_LINE \
+part { \
+ name: "bottom_line"; \
+ type: RECT; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ min: 0 1; \
+ fixed: 0 1; \
+ visible: 1; \
+ color: GENLIST_PART_LIST_LINE_COLOR_INC; \
+ rel1 { \
+ relative: 0.0 1.0; \
+ offset: 0 -1; \
+ } \
+ } \
+}
+
+#define GENLIST_PART_PADDING_TOP( param_padding_size ) \
+part { \
+ name: "elm.padding.top"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 param_padding_size; \
+ fixed: 0 1; \
+ visible: 0; \
+ rel2.relative: 1.0 0.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_BOTTOM( param_padding_size ) \
+part { \
+ name: "elm.padding.bottom"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 param_padding_size; \
+ fixed: 0 1; \
+ visible: 0; \
+ rel1.relative: 0.0 1.0; \
+ align: 0.0 1.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_LEFT( param_padding_size ) \
+part { \
+ name: "elm.padding.left"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel2.relative: 0.0 1.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
+part { \
+ name: "elm.padding.right"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel1.relative: 1.0 0.0; \
+ align: 1.0 0.0; \
+ } \
+}
+
+styles {
+ style {
+ name: "baseinfo_defaultnumber_textblock_style";
+ base: "font=Tizen:style=Bold text_class=tizen color=#000000 ellipsis=0.0 font_size=44 wrap=char";
+ }
+ style {
+ name: "baseinfo_name_textblock_style";
+ base: "font=Tizen:style=Bold text_class=tizen color=#3B73B6 ellipsis=1.0 font_size=56";
+ }
+ style {
+ name: "baseinfo_subname_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen color=#000000 ellipsis=1.0 font_size=32";
+ }
+ style {
+ name: "activity_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen color=#000000 ellipsis=0.0 font_size=32 wrap=char";
+ }
+ style {
+ name: "detail_fieldtitle_textblock_style";
+ base: "font=Tizen:style=Bold text_class=tizen color=#3B73B6 ellipsis=1.0 font_size=32";
+ }
+ style {
+ name: "detail_field_textblock_style";
+ base: "font=Tizen:style=Regular text_class=tizen color=#000000 ellipsis=1.0 font_size=44";
+ }
+ style {
+ name: "detail_fieldtype_textblock_style";
+ base: "font=Tizen:style=Bold text_class=tizen color=#808080 ellipsis=1.0 font_size=32";
+ }
+}
+collections
+{
+ group {
+ name: "elm/genlist/item/baseinfo.1text/default";
+ alias: "elm/genlist/item_odd/baseinfo.1text/default";
+ alias: "elm/genlist/item_compress/baseinfo.1text/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.1text/default";
+ alias: "elm/genlist/tree/baseinfo.1text/default";
+ alias: "elm/genlist/tree_odd/baseinfo.1text/default";
+ alias: "elm/genlist/tree_compress/baseinfo.1text/default";
+ alias: "elm/genlist/tree_compress_odd/baseinfo.1text/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+
+ parts {
+ GENLIST_BASEINFO_PART_BASE(50)
+ part {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 1.0; offset: -26 0 ; to: "base"; }
+ text { style: "baseinfo_defaultnumber_textblock_style";}
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/item_odd/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/item_compress/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/item_compress_odd/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/tree/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/tree_odd/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/tree_compress/detail.fieldtitle.1text/default";
+ alias: "elm/genlist/tree_compress_odd/detail.fieldtitle.1text/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+
+ parts {
+ GENLIST_BASEINFO_PART_BASE(32)
+ part {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 1.0; offset: -26 0 ; to: "base"; }
+ text { style: "detail_fieldtitle_textblock_style";}
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/detail.field.2text/default";
+ alias: "elm/genlist/item_odd/detail.field.2text/default";
+ alias: "elm/genlist/item_compress/detail.field.2text/default";
+ alias: "elm/genlist/item_compress_odd/detail.field.2text/default";
+ alias: "elm/genlist/tree/detail.field.2text/default";
+ alias: "elm/genlist/tree_odd/detail.field.2text/default";
+ alias: "elm/genlist/tree_compress/detail.field.2text/default";
+ alias: "elm/genlist/tree_compress_odd/detail.field.2text/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2";
+
+ parts {
+ GENLIST_BASEINFO_PART_BASE(113)
+ part {
+ name: "elm.text.2";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; offset: -176 0; to: "base"; }
+ rel2 { relative: 1.0 1.0; offset: -26 0 ; to: "base"; }
+ text {
+ style: "detail_fieldtype_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.1";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 1.0; offset: -26 0; to: "elm.text.2"; }
+ text {
+ style: "detail_field_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.1text.1icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.1text.1icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.1text.1icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.1text.1icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name";
+ data.item: "contents" "elm.icon.favorite elm.icon.block";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(110)
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 55.0/110.0; offset: -76 0; to: "base"; }
+ rel2 { relative: 1.0 105.0/110.0; offset: -26 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.icon.block.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 1.0;
+ color: 0 0 0 0;
+ rel2 { relative: 0.0 1.0; offset:-1 0; to: "elm.icon.favorite"; }
+ }
+ }
+ part {
+ name: "elm.icon.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.block.rect";
+ rel2.to: "elm.icon.block.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 42.0/110.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 110.0/110.0; offset: -16 0 ; to: "elm.icon.block"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.1text.2icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.1text.2icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.1text.2icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.1text.2icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name";
+ data.item: "contents" "elm.icon.image elm.icon.favorite elm.icon.block";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(520)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 180 0;
+ max: 360 360;
+ fixed: 1 0;
+ align: 0.5 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; offset: 0 50; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 465.0/520.0; offset: -76 0; to: "base"; }
+ rel2 { relative: 1.0 515.0/520.0; offset: -26 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.icon.block.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 1.0;
+ color: 0 0 0 0;
+ rel2 { relative: 0.0 1.0; offset:-1 0; to: "elm.icon.favorite"; }
+ }
+ }
+ part {
+ name: "elm.icon.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.block.rect";
+ rel2.to: "elm.icon.block.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 452.0/520.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 1.0; offset: -16 0 ; to: "elm.icon.block"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.2text.1icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.2text.1icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.2text.1icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.2text.1icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname";
+ data.item: "contents" "elm.icon.favorite elm.icon.block";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(160)
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 55.0/160.0; offset: -76 0; to: "base"; }
+ rel2 { relative: 1.0 105.0/160.0; offset: -26 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.icon.block.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 1.0;
+ color: 0 0 0 0;
+ rel2 { relative: 0.0 1.0; offset:-1 0; to: "elm.icon.favorite"; }
+ }
+ }
+ part {
+ name: "elm.icon.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.block.rect";
+ rel2.to: "elm.icon.block.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 42.0/160.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 1.0; offset: -16 0 ; to: "elm.icon.block"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 120.0/160.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 160.0/160.0; offset: -26 0; to: "base"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.2text.2icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.2text.2icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.2text.2icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.2text.2icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname";
+ data.item: "contents" "elm.icon.image elm.icon.favorite elm.icon.block";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(570)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 180 0;
+ max: 360 360;
+ fixed: 1 0;
+ align: 0.5 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; offset: 0 50; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 465.0/570.0; offset: -76 0; to: "base"; }
+ rel2 { relative: 1.0 515.0/570.0; offset: -26 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.icon.block.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 1.0;
+ color: 0 0 0 0;
+ rel2 { relative: 0.0 1.0; offset:-1 0; to: "elm.icon.favorite"; }
+ }
+ }
+ part {
+ name: "elm.icon.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.block.rect";
+ rel2.to: "elm.icon.block.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 452.0/570.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 1.0; offset: -16 0 ; to: "elm.icon.block"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 530.0/570.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 570.0/570.0; offset: -26 0; to: "base"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.3text.1icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.3text.1icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.3text.1icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.3text.1icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname elm.text.subname2";
+ data.item: "contents" "elm.icon.favorite elm.icon.block";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(210)
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 55.0/210.0; offset: -76 0; to: "base"; }
+ rel2 { relative: 1.0 105.0/210.0; offset: -26 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.icon.block.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 1.0;
+ color: 0 0 0 0;
+ rel2 { relative: 0.0 1.0; offset:-1 0; to: "elm.icon.favorite"; }
+ }
+ }
+ part {
+ name: "elm.icon.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.block.rect";
+ rel2.to: "elm.icon.block.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 42.0/210.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 1.0; offset: -16 0 ; to: "elm.icon.block"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 120.0/210.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 160.0/210.0; offset: -26 0; to: "base"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname2";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 160.0/210.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 210.0/210.0; offset: -26 0; to: "base"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.3text.2icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.3text.2icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.3text.2icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.3text.2icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname elm.text.subname2";
+ data.item: "contents" "elm.icon.image elm.icon.favorite elm.icon.block";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(620)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 180 0;
+ max: 360 360;
+ fixed: 1 0;
+ align: 0.5 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; offset: 0 50; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 465.0/620.0; offset: -76 0; to: "base"; }
+ rel2 { relative: 1.0 515.0/620.0; offset: -26 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.icon.block.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 50 50 ;
+ fixed: 1 0;
+ align: 1.0 1.0;
+ color: 0 0 0 0;
+ rel2 { relative: 0.0 1.0; offset:-1 0; to: "elm.icon.favorite"; }
+ }
+ }
+ part {
+ name: "elm.icon.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 50;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1.to: "elm.icon.block.rect";
+ rel2.to: "elm.icon.block.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 452.0/620.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 0.0 1.0; offset: -16 0 ; to: "elm.icon.block"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 530.0/620.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 570.0/620.0; offset: -26 0; to: "base"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname2";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 570.0/620.0; offset: 26 0; to: "base"; }
+ rel2 { relative: 1.0 620.0/620.0; offset: -26 0; to: "base"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/detail.title/default";
+ alias: "elm/genlist/item_odd/detail.title/default";
+ alias: "elm/genlist/item_compress/detail.title/default";
+ alias: "elm/genlist/item_compress_odd/detail.title/default";
+ data.item: "stacking" "above";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(77);
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_DIALOGUE_FONT_SUB_TITLE_COLOR_INC;
+ text {
+ font: "Tizen:style=Medium";
+ text_class: "tizen";
+ size: 28;
+ min: 0 1;
+ align: 0.0 1.0;
+ }
+ rel1 { offset: 10 0; }
+ rel2 { offset: -10 -10; }
+ }
+ }
+ }
+ }
+
+ group {
+ name: "elm/genlist/item/detail.3icon/default";
+ alias: "elm/genlist/item_odd/detail.3icon/default";
+ alias: "elm/genlist/item_compress/detail.3icon/default";
+ alias: "elm/genlist/item_compress_odd/detail.3icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "contents" "elm.icon.1.bg elm.icon.2.bg elm.icon.3.bg elm.icon.1 elm.icon.2 elm.icon.3";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(222);
+ part {
+ name: "elm.icon.1.bg";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min:0 0;
+ max:138 138;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 { relative: 0.0 0.0; offset: 38 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.2.bg";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 69 0;
+ max:138 138;
+ fixed: 1 0;
+ align: 0.5 0.5;
+ rel1 { relative: 0.0 0.0; offset: 0 0; to: "base"; }
+ }
+ }
+ part {
+ type: SWALLOW;
+ name: "elm.icon.3.bg";
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ max: 138 138;
+ fixed:1 0;
+ align: 1.0 0.0;
+ rel1 { relative: 1.0 42.0/222.0; offset: -176 0; to: "base"; }
+ rel2 { relative: 1.0 180.0/222.0; offset: -38 0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min:138 138;
+ max:138 138;
+ fixed: 1 1;
+ align: 0.5 1.0;
+ rel1 { relative: 0.0 1.0;to: "elm.icon.1.bg"; }
+ rel2 { relative: 1.0 1.0;to: "elm.icon.1.bg"; }
+ }
+ }
+ part {
+ name: "elm.icon.2";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min:138 138;
+ max:138 138;
+ fixed: 1 1;
+ align: 0.5 1.0;
+ rel1 { relative: 0.0 1.0;to: "elm.icon.2.bg"; }
+ rel2 { relative: 1.0 1.0;to: "elm.icon.2.bg"; }
+ }
+ }
+ part {
+ type: SWALLOW;
+ name: "elm.icon.3";
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min:138 138;
+ max:138 138;
+ fixed: 1 1;
+ align: 0.5 1.0;
+ rel1 { relative: 0.0 1.0;to: "elm.icon.3.bg"; }
+ rel2 { relative: 1.0 1.0;to: "elm.icon.3.bg"; }
+ }
+ }
+ }
+ }
+
+ group {
+ name: "elm/genlist/item/history_list/default";
+ alias: "elm/genlist/item_odd/history_list/default";
+ alias: "elm/genlist/item_compress/history_list/default";
+ alias: "elm/genlist/item_compress_odd/history_list/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2 elm.text.3";
+ data.item: "contents" "elm.icon.1 elm.icon.2";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BASE(128)
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_TOP(10)
+ GENLIST_PART_PADDING_BOTTOM(10)
+ GENLIST_PART_PADDING_LEFT(16)
+ GENLIST_PART_PADDING_RIGHT(16)
+ part {
+ name: "elm.icon.1";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.right";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.icon.1";
+ }
+ rel2.to_x: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.icon.2";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.text.1";
+ }
+ align: 1.0 0.5;
+ }
+ }
+ part {
+ name: "elm.padding.icon2.left";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ to_x: "elm.icon.2";
+ }
+ rel2.to_x: "elm.icon.2";
+ align: 1.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text.1";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 60;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.icon2.left";
+ to_y: "elm.padding.top";
+ }
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ font: "Tizen:style=Roman";
+ size: 44;
+ min: 0 1;
+ align: 0.0 0.5;
+ text_class: "list_item";
+ }
+ }
+ }
+ part {
+ name: "elm.text.2";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.icon1.right";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.8 0.0;
+ to_x: "elm.text.1";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 0.5;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.text.3";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.text.2";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ offset: 5 0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 1.0 0.5;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/activity_list/default";
+ alias: "elm/genlist/item_odd/activity_list/default";
+ alias: "elm/genlist/item_compress/activity_list/default";
+ alias: "elm/genlist/item_compress_odd/activity_list/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2";
+ data.item: "contents" "elm.icon.1 elm.icon.2";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_TOP(10)
+ GENLIST_PART_PADDING_BOTTOM(10)
+ GENLIST_PART_PADDING_LEFT(16)
+ GENLIST_PART_PADDING_RIGHT(16)
+ part {
+ name: "elm.icon.1";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ align: 0.0 1.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.right";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.icon.1";
+ }
+ rel2.to_x: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.top";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 16;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ }
+ rel2.to_y: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.icon.2";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 321 321;
+ max: 321 321;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text.2";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.icon1.right";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 1.0;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.text.1";
+ clip_to: "disclip";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.icon.2";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.icon.2";
+ }
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ style: "activity_textblock_style";
+ min: 0 1;
+ align: 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/activity_list_no_img/default";
+ alias: "elm/genlist/item_odd/activity_list_no_img/default";
+ alias: "elm/genlist/item_compress/activity_list_no_img/default";
+ alias: "elm/genlist/item_compress_odd/activity_list_no_img/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2";
+ data.item: "contents" "elm.icon.1";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_TOP(10)
+ GENLIST_PART_PADDING_BOTTOM(10)
+ GENLIST_PART_PADDING_LEFT(16)
+ GENLIST_PART_PADDING_RIGHT(16)
+ part {
+ name: "elm.icon.1";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ align: 0.0 1.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.right";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.icon.1";
+ }
+ rel2.to_x: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text.2";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.icon1.right";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 1.0;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.text.1";
+ clip_to: "disclip";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.icon.1";
+ }
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ style: "activity_textblock_style";
+ min: 0 1;
+ align: 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/detail.5icon/default";
+ alias: "elm/genlist/item_odd/detail.5icon/default";
+ alias: "elm/genlist/item_compress/detail.5icon/default";
+ alias: "elm/genlist/item_compress_odd/detail.5icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "contents" "elm.icon.1 elm.icon.2 elm.icon.3 elm.icon.4 elm.icon.5";
+
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ repeat_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 112;
+ }
+ }
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min:0 74;
+ fixed: 0 1;
+ rel1.relative: 0.021 0.5;
+ rel2.relative: 0.196 0.5;
+ align: 0.5 0.5;
+ }
+ }
+
+ part {
+ name: "elm.icon.2";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.218 0.5;
+ rel2.relative: 0.392 0.5;
+ align: 0.5 0.5;
+ }
+ }
+
+ part {
+ name: "elm.icon.3";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.414 0.5;
+ rel2.relative: 0.588 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ part {
+ name: "elm.icon.4";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.61 0.5;
+ rel2.relative: 0.783 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ part {
+ name: "elm.icon.5";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.806 0.5;
+ rel2.relative: 0.979 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ }
+ group { name: "elm/button/base/detail.circle/empty";
+ alias: "elm/button/base/detail.circle/empty";
+ images {
+ image: IMAGE_PATH"C02_circle_button.png" COMP;
+ image: IMAGE_PATH"C02_circle_button_press.png" COMP;
+ }
+ parts {
+ part { name: "button_image";
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_CIRCLE_STYLE_BG_MIN_MAX_INC;
+ max: BUTTON_CIRCLE_STYLE_BG_MIN_MAX_INC;
+ fixed: 1 1;
+ image.normal: IMAGE_PATH"C02_circle_button.png";
+ }
+ description { state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C02_circle_button_press.png";
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C02_circle_button.png";
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ clip_to: "icon_clipper";
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_CIRCLE_STYLE_CONTENT_MIN_MAX_INC;
+ max: BUTTON_CIRCLE_STYLE_CONTENT_MIN_MAX_INC;
+ fixed: 1 1;
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "visible" 0.0;
+ }
+ }
+ part { name: "icon_clipper";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ }
+ description { state: "visible" 0.0;
+ }
+ description { state: "disabled" 0.0;
+ }
+ }
+ part { name: "over1";
+ type: RECT;
+ ignore_flags: ON_HOLD;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "over2";
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "disabler";
+ type: RECT;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program { name: "button_click";
+ signal: "mouse,down,1";
+ source: "over1";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ after: "button_click_anim";
+ }
+ program { name: "button_click_anim";
+ action: STATE_SET "clicked" 0.0;
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "touch_snd";
+ signal: "mouse,clicked,1";
+ source: "over1";
+// action: PLAY_SAMPLE "touch_sound" 1.0;
+ after: button_unclick2;
+ }
+ program { name: "button_unclick2";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program { name: "button_unclick";
+ signal: "mouse,up,1";
+ source: "over2";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ after: "button_unclick_anim";
+ }
+ program { name: "button_unclick_anim";
+ action: STATE_SET "default" 0.0;
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disabler";
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disabler";
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "icon_show";
+ signal: "elm,state,icon,visible";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "elm.swallow.content";
+ }
+ program { name: "icon_hide";
+ signal: "elm,state,icon,hidden";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.swallow.content";
+ }
+ }
+ }
+}
diff --git a/lib/edc/dialer.edc b/lib/edc/dialer.edc
new file mode 100755
index 0000000..9026c4d
--- /dev/null
+++ b/lib/edc/dialer.edc
@@ -0,0 +1,1297 @@
+/*
+* 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 MAIN_H (1280)
+#define MAIN_W (720)
+
+#define INDICATOR_H (50)
+#define TABBAR_H (121)
+#define MAIN_H_PURE (MAIN_H-INDICATOR_H-TABBAR_H)
+
+#define KEYPAD_H (785)
+#define KEYPAD_START (MAIN_H_PURE-KEYPAD_H)
+
+#define TEXT_AREA_H (KEYPAD_START)
+#define TEXT_AREA_W (630)
+#define TEXT_ENTRY_H (156)
+
+#define PSEARCH_ITEM_H (140)
+
+#define BUTTON_W (218)
+#define BUTTON_W_PAD (19)
+#define BUTTON_H (130)
+#define BUTTON_H_PRESSED (150)
+#define BUTTON_H_PAD (24)
+#define BTN_1_COL_X (10)
+#define BTN_2_COL_X (BTN_1_COL_X+BUTTON_W+BUTTON_W_PAD)
+#define BTN_3_COL_X (BTN_1_COL_X+(BUTTON_W*2)+(BUTTON_W_PAD*2))
+#define BTN_1_ROW_Y (43)
+#define BTN_2_ROW_Y (BTN_1_ROW_Y+BUTTON_H+BUTTON_H_PAD)
+#define BTN_3_ROW_Y (BTN_2_ROW_Y+BUTTON_H+BUTTON_H_PAD)
+#define BTN_4_ROW_Y (BTN_3_ROW_Y+BUTTON_H+BUTTON_H_PAD)
+#define BTN_5_ROW_Y (BTN_4_ROW_Y+BUTTON_H+23)
+#define KEYPAD_TOP_ICON_W (218)
+#define KEYPAD_TOP_ICON_H (90)
+#define KEYPAD_BTM_ICON_W (50)
+#define KEYPAD_BTM_ICON_H (40)
+#define SOFTKEY_ICON_W (64)
+#define SOFTKEY_ICON_H (64)
+#define SOFTKEY_BTN_H (104)
+#define SOFTKEY_BTN_PAD (24)
+#define SOFTKEY_BTN1_X (36)
+#define SOFTKEY_BTN1_W (180)
+#define SOFTKEY_BTN2_X (SOFTKEY_BTN1_X+SOFTKEY_BTN1_W+SOFTKEY_BTN_PAD)
+#define SOFTKEY_BTN2_W (240)
+#define SOFTKEY_BTN3_X (SOFTKEY_BTN1_X+SOFTKEY_BTN1_W+SOFTKEY_BTN_PAD+SOFTKEY_BTN2_W+SOFTKEY_BTN_PAD)
+#define SOFTKEY_BTN3_W (SOFTKEY_BTN1_W)
+
+#define IMAGE_PATH "../images/dialer_images/"
+#define IMAGES "../images/phoneug_images/"
+#define KEYPAD_ANI_TIME 0.03
+
+#define _DBG_OPA (30)
+
+images {
+//NUMBER KEY BUTTON
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_00.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_01.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_02.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_03.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_04.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_05.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_06.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_07.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_08.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_09.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_asterisk.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_auto_answer.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_mute.png" COMP;
+ image: IMAGE_PATH"keypad/C01-3_keypad_number_sharp.png" COMP;
+ image: IMAGE_PATH"C01-3_keypad_bg.png" COMP;
+ image: IMAGE_PATH"C01-3_keypad_press.png" COMP;
+ image: IMAGE_PATH"C01-3_keypad_bg_reduction.png" COMP;
+
+//SOFT KEY BUTTON
+ image: IMAGE_PATH"C01-3_button_01.png" COMP;
+ image: IMAGE_PATH"C01-3_button_01_dim.png" COMP;
+ image: IMAGE_PATH"C01-3_button_02.png" COMP;
+ image: IMAGE_PATH"C01-3_button_02_dim.png" COMP;
+ image: IMAGE_PATH"C01-3_dialer_button_01_press.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_call.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_call_dim.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_call_press.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_delete.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_expand_01.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_expand_02.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_message.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_message_dim.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_message_press.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_video_call.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_video_call_dim.png" COMP;
+ image: IMAGE_PATH"C01-3_icon_video_call_press.png" COMP;
+
+//SEARCH BAR
+ image: IMAGE_PATH"C01-3_search_bg_01.png" COMP;
+ image: IMAGE_PATH"C01-3_search_bg_02.png" COMP;
+ image: IMAGE_PATH"C01-3_search_field.png" COMP;
+ image: IMAGE_PATH"C01-3_search_icon.png" COMP;
+
+// image: IMAGE_PATH"C01-3_thumbnail_bg.png" COMP; //CONTACT SEARCH LIST
+// image: IMAGE_PATH"C01-3_title_divider.png" COMP; //TABBAR DIVIDER
+}
+
+color_classes {
+ color_class {
+ name: "color/textblock/bg";
+ color: 177 164 150 255;
+ }
+}
+
+collections {
+ #include "dialer_btn.edc"
+ /*****************************************************************************
+ * dialer main edc group
+ *****************************************************************************/
+ group {
+ name: "dialer/main";
+ parts {
+ /*****************************************************************************
+ * Main background
+ *****************************************************************************/
+ part {
+ name: "background";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color_class: "color/textblock/bg"; //right below input_field to the end
+ }
+ }
+
+ /*****************************************************************************
+ * Entry area
+ *****************************************************************************/
+ part {
+ name: "entry/bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "background";}
+ rel2 { relative: 1.0 KEYPAD_START/MAIN_H_PURE; to: "background";}
+ }
+ }
+ part {
+ name: "entry/bg/image";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "entry/bg";}
+ rel2 { relative: 1.0 1.0; to: "entry/bg";}
+ image.normal: IMAGE_PATH"C01-3_search_bg_01.png";
+ }
+ }
+
+ /*****************************************************************************
+ * Number Keypad bg
+ *****************************************************************************/
+ part {
+ name: "keypad/bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 KEYPAD_START/MAIN_H_PURE; to: "background";}
+ rel2 { relative: 1.0 1.0; to: "background";}
+ }
+ }
+ part {
+ name: "keypad/bg/image";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "keypad/bg";}
+ rel2 { relative: 1.0 1.0; to: "keypad/bg";}
+ image.normal: IMAGE_PATH"C01-3_keypad_bg.png";
+ }
+ }
+ //Number Keypad swallow
+ part {
+ name: "keypad/swallow";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "keypad/bg"; }
+ rel2 { relative: 1.0 1.0; to: "keypad/bg"; }
+ }
+ }
+
+
+ /*****************************************************************************
+ * Softkey button
+ *****************************************************************************/
+/***************/
+/**** call btn ****/
+/***************/
+ part {
+ name: "normal/call";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: (SOFTKEY_BTN2_X)/MAIN_W BTN_5_ROW_Y/KEYPAD_H; to:"keypad/bg";}
+ rel2 { relative: (SOFTKEY_BTN2_X+SOFTKEY_BTN2_W)/MAIN_W (BTN_5_ROW_Y+SOFTKEY_BTN_H)/KEYPAD_H; to:"keypad/bg";}
+ image {
+ normal: IMAGE_PATH"C01-3_button_01.png";
+ border: 52 52 52 52;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C01-3_dialer_button_01_press.png";
+ }
+ description {
+ state: "expand_R" 0.0;
+ rel1 { relative: (SOFTKEY_BTN2_X)/MAIN_W BTN_5_ROW_Y/KEYPAD_H; to:"keypad/bg";}
+ rel2 { relative: (SOFTKEY_BTN3_X+SOFTKEY_BTN3_W)/MAIN_W (BTN_5_ROW_Y+SOFTKEY_BTN_H)/KEYPAD_H; to:"keypad/bg";}
+ image {
+ normal: IMAGE_PATH"C01-3_button_01.png";
+ border: 52 52 52 52;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "expand_R_pressed" 0.0;
+ inherit: "expand_R" 0.0;
+ image.normal: IMAGE_PATH"C01-3_dialer_button_01_press.png";
+ }
+ description {
+ state: "expand_L" 0.0;
+ rel1 { relative: SOFTKEY_BTN1_X/MAIN_W BTN_5_ROW_Y/KEYPAD_H; to:"keypad/bg";}
+ rel2 { relative: (SOFTKEY_BTN2_X+SOFTKEY_BTN2_W)/MAIN_W (BTN_5_ROW_Y+SOFTKEY_BTN_H)/KEYPAD_H; to:"keypad/bg";}
+ image {
+ normal: IMAGE_PATH"C01-3_button_01.png";
+ border: 52 52 52 52;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "expand_L_pressed" 0.0;
+ inherit: "expand_L" 0.0;
+ image.normal: IMAGE_PATH"C01-3_dialer_button_01_press.png";
+ }
+ }
+ part {
+ name: "normal/call_icon";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: SOFTKEY_ICON_W SOFTKEY_ICON_H;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to: "normal/call";}
+ rel2 { relative: 0.5 0.5; to: "normal/call";}
+ align: 0.5 0.5;
+ image.normal: IMAGE_PATH"C01-3_icon_call.png";
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C01-3_icon_call_press.png";
+ }
+ }
+/********************/
+/**** MESSAGE btn ****/
+/********************/
+ part {
+ name: "normal/message";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: SOFTKEY_BTN3_X/MAIN_W BTN_5_ROW_Y/KEYPAD_H; to:"keypad/bg";}
+ rel2 { relative: (SOFTKEY_BTN3_X+SOFTKEY_BTN3_W)/MAIN_W (BTN_5_ROW_Y+SOFTKEY_BTN_H)/KEYPAD_H; to:"keypad/bg";}
+ image {
+ normal: IMAGE_PATH"C01-3_button_02.png";
+ border: 52 52 52 52;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C01-3_dialer_button_01_press.png";
+ }
+ description {
+ state: "hide" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "normal/message_icon";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: SOFTKEY_ICON_W SOFTKEY_ICON_H;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to: "normal/message";}
+ rel2 { relative: 0.5 0.5; to: "normal/message";}
+ align: 0.5 0.5;
+ image.normal: IMAGE_PATH"C01-3_icon_message.png";
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C01-3_icon_message_press.png";
+ }
+ description {
+ state: "hide" 0.0;
+ visible: 0;
+ }
+ }
+
+/*******************/
+/**** RETURN btn ****/
+/*******************/
+#define PART_KEYPAD_RETURN_BTN \
+ part { \
+ name: "return_btn"; \
+ type: IMAGE; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: SOFTKEY_BTN1_X/MAIN_W BTN_5_ROW_Y/KEYPAD_H; to:"keypad/bg";} \
+ rel2 { relative: (SOFTKEY_BTN1_X+SOFTKEY_BTN1_W)/MAIN_W (BTN_5_ROW_Y+SOFTKEY_BTN_H)/KEYPAD_H; to:"keypad/bg";} \
+ image { \
+ normal: IMAGE_PATH"C01-3_button_02.png"; \
+ border: 52 52 52 52; \
+ border_scale: 1; \
+ } \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ image.normal: IMAGE_PATH"C01-3_dialer_button_01_press.png"; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ visible: 0; \
+ } \
+ } \
+ part { \
+ name: "return_btn/text"; \
+ type: TEXT; \
+ scale: 1; \
+ effect: SHADOW; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: 0.05 0.0; to: "return_btn";} \
+ rel2 { relative: 0.95 1.0; to: "return_btn";} \
+ fixed: 1 1; \
+ align: 0.5 0.5; \
+ color: 145 135 114 255; \
+ text { \
+ font: "Tizen:style=Regular"; \
+ text_class: "tizen"; \
+ size: 35; \
+ min: 1 1; \
+ fit: 1 1; \
+ } \
+ visible: 1; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 0; \
+ } \
+ }
+ PART_KEYPAD_RETURN_BTN
+
+/*****************************************************************************
+* Number Keypad button
+*****************************************************************************/
+#define PART_KEYPAD_TWO_ICON(_TXT, _X_POS, _Y_POS, _TOP_ICON, _BOTTOM_ICON) \
+ part { \
+ name: _TXT; \
+ type: RECT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: _X_POS/MAIN_W _Y_POS/KEYPAD_H; to:"keypad/bg";} \
+ rel2 { relative: (_X_POS+BUTTON_W)/MAIN_W (_Y_POS+BUTTON_H)/KEYPAD_H; to:"keypad/bg"; } \
+ fixed: 1 1; \
+ align: 0.5 0.5; \
+ color: 255 0 0 0; \
+ visible: 1; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ } \
+ } \
+ part { \
+ name: _TXT"_TOP"; \
+ type: IMAGE; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: 218 90; \
+ fixed: 1 1; \
+ rel1 { relative: 0.0 0.0; to: _TXT;} \
+ rel2 { relative: 1.0 90/BUTTON_H; to: _TXT;} \
+ align: 0.5 0.5; \
+ image.normal: _TOP_ICON; \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ image.normal: _TOP_ICON; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ visible: 0; \
+ } \
+ } \
+ part { \
+ name: _TXT"_BOTTOM"; \
+ type: IMAGE; \
+ scale: 0; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: 50 40; \
+ fixed: 1 1; \
+ rel1 { relative: 0.5 90/BUTTON_H; to: _TXT;} \
+ rel2 { relative: 0.5 1.0; to: _TXT;} \
+ align: 0.5 0.5; \
+ image.normal: _BOTTOM_ICON; \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ image.normal: _BOTTOM_ICON; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ visible: 0; \
+ } \
+ } \
+ part { \
+ name: _TXT"_BG"; \
+ type: IMAGE; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: BUTTON_W BUTTON_H_PRESSED; \
+ fixed: 1 1; \
+ align: 0.5 0.5; \
+ rel1 { relative: 0.5 0.5; to:_TXT;} \
+ rel2 { relative: 0.5 0.5; to:_TXT;} \
+ image { \
+ normal: IMAGE_PATH"C01-3_keypad_press.png"; \
+ } \
+ visible: 0; \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 1; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ visible: 0; \
+ } \
+ }
+
+#define PART_KEYPAD_ONE_ICON_ONE_LABEL(_TXT, _X_POS, _Y_POS, _TOP_ICON, _BOTTOM_TEXT) \
+ part { \
+ name: _TXT; \
+ type: RECT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ fixed: 1 1; \
+ rel1 { relative: _X_POS/MAIN_W _Y_POS/KEYPAD_H; to:"keypad/bg";} \
+ rel2 { relative: (_X_POS+BUTTON_W)/MAIN_W (_Y_POS+BUTTON_H)/KEYPAD_H; to:"keypad/bg"; } \
+ align: 0.5 0.5; \
+ color: 0 255 0 0; \
+ visible: 1; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ } \
+ } \
+ part { \
+ name: _TXT"_TOP"; \
+ type: IMAGE; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: 218 90; \
+ fixed: 1 1; \
+ rel1 { relative: 0.0 0.0; to: _TXT;} \
+ rel2 { relative: 1.0 90/BUTTON_H; to: _TXT;} \
+ align: 0.5 0.5; \
+ image.normal: _TOP_ICON; \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ image.normal: _TOP_ICON; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ visible: 0; \
+ } \
+ } \
+ part { \
+ name: _TXT"_BOTTOM"; \
+ type: TEXT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ fixed: 1 1; \
+ rel1 { relative: 0.0 90/BUTTON_H; to: _TXT;} \
+ rel2 { relative: 1.0 1.0; to: _TXT;} \
+ align: 0.5 0.5; \
+ color: 145 135 114 255; \
+ text { \
+ text: _BOTTOM_TEXT; \
+ font: "Tizen:style=Regular"; \
+ text_class: "tizen"; \
+ size: 28; \
+ min: 1 1; \
+ fit: 1 1; \
+ } \
+ visible: 1; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 0; \
+ } \
+ } \
+ part { \
+ name: _TXT"_BG"; \
+ type: IMAGE; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: BUTTON_W BUTTON_H_PRESSED; \
+ fixed: 1 1; \
+ align: 0.5 0.5; \
+ rel1 { relative: 0.5 0.5; to:_TXT;} \
+ rel2 { relative: 0.5 0.5; to:_TXT;} \
+ image { \
+ normal: IMAGE_PATH"C01-3_keypad_press.png"; \
+ } \
+ visible: 0; \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 1; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ visible: 0; \
+ } \
+ }
+
+ PART_KEYPAD_TWO_ICON("1",BTN_1_COL_X, BTN_1_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_01.png", IMAGE_PATH"keypad/C01-3_keypad_number_auto_answer.png")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("2",BTN_2_COL_X, BTN_1_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_02.png", "ABC")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("3",BTN_3_COL_X, BTN_1_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_03.png", "DEF")
+
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("4",BTN_1_COL_X, BTN_2_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_04.png", "GHI")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("5",BTN_2_COL_X, BTN_2_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_05.png", "JKL")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("6",BTN_3_COL_X, BTN_2_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_06.png", "MNO")
+
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("7",BTN_1_COL_X, BTN_3_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_07.png", "PQRS")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("8",BTN_2_COL_X, BTN_3_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_08.png", "TUV")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("9",BTN_3_COL_X, BTN_3_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_09.png", "WXYZ")
+
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("star", BTN_1_COL_X, BTN_4_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_asterisk.png", "P")
+ PART_KEYPAD_ONE_ICON_ONE_LABEL("0", BTN_2_COL_X, BTN_4_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_00.png", "+")
+ PART_KEYPAD_TWO_ICON("sharp",BTN_3_COL_X, BTN_4_ROW_Y, IMAGE_PATH"keypad/C01-3_keypad_number_sharp.png", IMAGE_PATH"keypad/C01-3_keypad_number_mute.png")
+
+
+/*****************************************************************************
+* "Contact Search" input field
+*****************************************************************************/
+ part {
+ name: "search/bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "entry/bg";}
+ rel2 { relative: 1.0 TEXT_ENTRY_H/TEXT_AREA_H; to: "entry/bg";}
+ align: 0.5 1.0;
+ color: 255 0 0 0;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "search/inputarea/image";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 66;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.5; offset: 26+74+10 0; to: "search/bg"; }
+ rel2 { relative: 1.0 0.5; offset: -26 0; to: "search/bg"; }
+ image{
+ border: 8 8 33 33;
+ border_scale: 1;
+ normal: IMAGE_PATH"C01-3_search_field.png";
+ }
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+/* part {
+ name: "search/inputarea";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "search/inputarea/image"; }
+ rel2 { relative: 1.0 1.0; to: "search/inputarea/image"; }
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+*/
+ part {
+ name: "search/icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 74 74;
+ fixed: 1 1;
+ rel1 { relative: 26/MAIN_W 0.5; to: "search/bg";}
+ rel2 { relative: (26+74)/MAIN_W 0.5; to: "search/bg";}
+ image.normal: IMAGE_PATH"C01-3_search_icon.png";
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "search/defaulttext";
+ type: TEXT;
+ scale: 1;
+ effect: SHADOW;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 16 0; to: "search/inputarea/image";}
+ rel2 { relative: 1.0 1.0; offset: -16 0; to: "search/inputarea/image";}
+ fixed: 1 1;
+ align: 0.0 0.5;
+ color: 156 159 162 153;
+ text {
+ text: "Contact Search";
+ font: "Tizen:style=Regular";
+ text_class: "tizen";
+ size: 36;
+ min: 1 1;
+ fit: 1 1;
+ align: 0.0 0.5;
+ }
+ visible: 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+/*****************************************************************************
+* Entry area
+*****************************************************************************/
+ part {
+ name: "textblock/bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "entry/bg";}
+ rel2 { relative: 1.0 TEXT_ENTRY_H/TEXT_AREA_H; to: "entry/bg";}
+ align: 0.5 1.0;
+ color: 0 255 0 0;
+ visible: 0;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "textblock/bg/image";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "textblock/bg";}
+ rel2 { relative: 1.0 1.0; to: "textblock/bg";}
+ image.normal: IMAGE_PATH"C01-3_search_bg_02.png";
+ visible: 0;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "textblock/textarea";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.5; offset: 26 0; to: "textblock/bg"; }
+ rel2 { relative: 1.0 0.5; offset: -26-26-64 0; to: "textblock/bg"; }
+ color: 0 0 255 100;
+ visible: 0;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "input_del";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: TEXT_AREA_W/MAIN_W 0.0; to: "textblock/bg";}
+ rel2 { relative: 1.0 1.0; to: "textblock/bg";}
+ color: 255 0 0 0;
+ visible: 0;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "show" 0.0;
+ }
+ }
+ part {
+ name: "input_del_icon";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min : 64 38;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to:"input_del";}
+ rel2 { relative: 0.5 0.5; offset: -32 0; to:"input_del";}
+ image.normal: IMAGE_PATH"C01-3_icon_delete.png";
+ visible: 0;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+
+
+
+ /*****************************************************************************
+ * Programs
+ *****************************************************************************/
+ programs {
+ program {
+ name: "click_exit";
+ source: "background";
+ signal: "mouse,clicked,1";
+ action: SIGNAL_EMIT "EXIT" "EDJ";
+ }
+ program {
+ name: "prog/viewobject/entry/hide";
+ source: "viewobject/entry";
+ signal: "viewobject/entry/hide";
+ script {
+ set_state (PART:"textblock/bg", "default", 0.0);
+ set_state (PART:"textblock/bg/image", "default", 0.0);
+ set_state (PART:"textblock/textarea", "default", 0.0);
+ set_state (PART:"input_del", "default", 0.0);
+ set_state (PART:"input_del_icon", "default", 0.0);
+ set_state (PART:"search/bg", "default", 0.0);
+ set_state (PART:"search/inputarea/image", "default", 0.0);
+// set_state (PART:"search/inputarea", "default", 0.0);
+ set_state (PART:"search/icon", "default", 0.0);
+ set_state (PART:"search/defaulttext", "default", 0.0);
+ }
+ }
+
+ program {
+ name: "prog/viewobject/entry/show";
+ source: "viewobject/entry";
+ signal: "viewobject/entry/show";
+ script {
+ set_state (PART:"search/bg", "hide", 0.0);
+ set_state (PART:"search/inputarea/image", "hide", 0.0);
+// set_state (PART:"search/inputarea", "hide", 0.0);
+ set_state (PART:"search/icon", "hide", 0.0);
+ set_state (PART:"search/defaulttext", "hide", 0.0);
+ set_state (PART:"textblock/bg", "show", 0.0);
+ set_state (PART:"textblock/bg/image", "show", 0.0);
+ set_state (PART:"textblock/textarea", "show", 0.0);
+ set_state (PART:"input_del", "show", 0.0);
+ set_state (PART:"input_del_icon", "show", 0.0);
+ }
+ }
+
+ /*****************************************************************************
+ * Program: Keypad button
+ *****************************************************************************/
+#define PROG_KEYPAD(txt) \
+ program { \
+ name: "down_"txt; \
+ signal: "mouse,down,*"; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_BG", "pressed", 0.0); \
+ emit("pad_down", txt); \
+ } \
+ } \
+ program { \
+ name: "ani_"txt; \
+ signal: "ani"; \
+ source: txt; \
+ action: STATE_SET "default" 0.0; \
+ transition: SINUSOIDAL KEYPAD_ANI_TIME; \
+ target: txt; \
+ } \
+ program { \
+ name: "up_"txt; \
+ signal: "mouse,up,1"; \
+ source: txt; \
+ script { \
+ emit("pad_up", txt); \
+ emit("ani", txt); \
+ set_state(PART:txt"_BG", "default", 0.0); \
+ } \
+ } \
+ program { \
+ name: "clicked_"txt; \
+ signal: "mouse,clicked,1"; \
+ source: txt; \
+ script { \
+ emit("pad_clicked", txt); \
+ } \
+ } \
+ program { \
+ name: "hide_"txt; \
+ signal: "hide_"txt; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_TOP", "hide", 0.0); \
+ set_state(PART:txt"_BOTTOM", "hide", 0.0); \
+ set_state(PART:txt, "hide", 0.0); \
+ } \
+ } \
+ program { \
+ name: "show_"txt; \
+ signal: "show_"txt; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_TOP", "default", 0.0); \
+ set_state(PART:txt"_BOTTOM", "default", 0.0); \
+ set_state(PART:txt, "default", 0.0); \
+ } \
+ }
+
+#define PROG_KEYPAD_BOTTOM_EFFECT(txt) \
+ program { \
+ name: "down_"txt; \
+ signal: "mouse,down,*"; \
+ source: txt; \
+ script { \
+ set_state(PART:txt, "pressed", 0.0); \
+ set_state(PART:txt"_BOTTOM", "pressed", 0.0); \
+ emit("pad_down", txt); \
+ } \
+ } \
+ program { \
+ name: "ani_"txt; \
+ signal: "ani"; \
+ source: txt; \
+ action: STATE_SET "default" 0.0; \
+ transition: SINUSOIDAL KEYPAD_ANI_TIME; \
+ target: txt; \
+ } \
+ program { \
+ name: "up_"txt; \
+ signal: "mouse,up,1"; \
+ source: txt; \
+ script { \
+ emit("pad_up", txt); \
+ emit("ani", txt); \
+ set_state(PART:txt"_BOTTOM", "default", 0.0); \
+ } \
+ } \
+ program { \
+ name: "clicked_"txt; \
+ signal: "mouse,clicked,1"; \
+ source: txt; \
+ script { \
+ emit("pad_clicked", txt); \
+ } \
+ } \
+ program { \
+ name: "hide_"txt; \
+ signal: "hide_"txt; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_TOP", "hide", 0.0); \
+ set_state(PART:txt"_BOTTOM", "hide", 0.0); \
+ set_state(PART:txt, "hide", 0.0); \
+ } \
+ } \
+ program { \
+ name: "show_"txt; \
+ signal: "show_"txt; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_TOP", "default", 0.0); \
+ set_state(PART:txt"_BOTTOM", "default", 0.0); \
+ set_state(PART:txt, "default", 0.0); \
+ } \
+ }
+
+#define PROG_KEYPAD_TOP_EFFECT(txt) \
+ program { \
+ name: "down_"txt; \
+ signal: "mouse,down,*"; \
+ source: txt; \
+ script { \
+ set_state(PART:txt, "pressed", 0.0); \
+ set_state(PART:txt"_TOP", "pressed", 0.0); \
+ set_state(PART:txt"_BOTTOM", "pressed", 0.0); \
+ emit("pad_down", txt); \
+ } \
+ } \
+ program { \
+ name: "ani_"txt; \
+ signal: "ani"; \
+ source: txt; \
+ action: STATE_SET "default" 0.0; \
+ transition: SINUSOIDAL KEYPAD_ANI_TIME; \
+ target: txt; \
+ } \
+ program { \
+ name: "up_"txt; \
+ signal: "mouse,up,1"; \
+ source: txt; \
+ script { \
+ emit("pad_up", txt); \
+ emit("ani", txt); \
+ set_state(PART:txt"_TOP", "default", 0.0); \
+ set_state(PART:txt"_BOTTOM", "default", 0.0); \
+ } \
+ } \
+ program { \
+ name: "clicked_"txt; \
+ signal: "mouse,clicked,1"; \
+ source: txt; \
+ script { \
+ emit("pad_clicked", txt); \
+ } \
+ } \
+ program { \
+ name: "hide_"txt; \
+ signal: "hide_"txt; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_TOP", "hide", 0.0); \
+ set_state(PART:txt"_BOTTOM", "hide", 0.0); \
+ set_state(PART:txt, "hide", 0.0); \
+ } \
+ } \
+ program { \
+ name: "show_"txt; \
+ signal: "show_"txt; \
+ source: txt; \
+ script { \
+ set_state(PART:txt"_TOP", "default", 0.0); \
+ set_state(PART:txt"_BOTTOM", "default", 0.0); \
+ set_state(PART:txt, "default", 0.0); \
+ } \
+ }
+
+ PROG_KEYPAD("1")
+ PROG_KEYPAD("2")
+ PROG_KEYPAD("3")
+ PROG_KEYPAD("4")
+ PROG_KEYPAD("5")
+ PROG_KEYPAD("6")
+ PROG_KEYPAD("7")
+ PROG_KEYPAD("8")
+ PROG_KEYPAD("9")
+ PROG_KEYPAD("star")
+ PROG_KEYPAD("0")
+ PROG_KEYPAD("sharp")
+
+ /*****************************************************************************
+ * Program: Softkey button
+ *****************************************************************************/
+ // call //////////////////////////////////////////////////////////////////////////
+ program {
+ name: "down_normal/call";
+ signal: "mouse,down,*";
+ source: "normal/call";
+ script {
+ new st[30];
+ new Float:vl;
+ get_state (PART:"normal/call", st, 30, vl);
+ if (strcmp(st, "default") == 0) {
+ set_state(PART:"normal/call", "pressed", 0.0);
+ emit("softkey_down", "normal/call");
+ }
+ else if (strcmp(st, "expand_R") == 0) {
+ set_state(PART:"normal/call", "expand_R_pressed", 0.0);
+ emit("softkey_down", "normal/call");
+ }
+ else if (strcmp(st, "expand_L") == 0) {
+ set_state(PART:"normal/call", "expand_L_pressed", 0.0);
+ emit("softkey_down", "normal/call");
+ }
+ set_state(PART:"normal/call_icon", "pressed", 0.0);
+ }
+ }
+ program {
+ name: "up_normal/call";
+ signal: "mouse,up,1";
+ source: "normal/call";
+ script {
+ new st[30];
+ new Float:vl;
+ get_state (PART:"normal/call", st, 30, vl);
+ if (strcmp(st, "pressed") == 0) {
+ set_state(PART:"normal/call", "default", 0.0);
+ emit("softkey_up", "normal/call");
+ }
+ else if (strcmp(st, "expand_R_pressed") == 0) {
+ set_state(PART:"normal/call", "expand_R", 0.0);
+ emit("softkey_up", "normal/call");
+ }
+ else if (strcmp(st, "expand_L_pressed") == 0) {
+ set_state(PART:"normal/call", "expand_L", 0.0);
+ emit("softkey_up", "normal/call");
+ }
+ set_state(PART:"normal/call_icon", "default", 0.0);
+ }
+ }
+ program {
+ name: "clicked_normal/call";
+ signal: "mouse,clicked,1";
+ source: "normal/call";
+ script {
+ emit ("viewobject/entry/show", "viewobject/entry");
+ emit("softkey_clicked", "normal/call");
+ }
+ }
+
+ // message //////////////////////////////////////////////////////////////////////////
+ program {
+ name: "down_normal/message";
+ signal: "mouse,down,*";
+ source: "normal/message";
+ script {
+ set_state(PART:"normal/message", "pressed", 0.0);
+ set_state(PART:"normal/message_icon", "pressed", 0.0);
+ emit("softkey_down", "normal/message");
+ }
+ }
+ program {
+ name: "up_normal/message";
+ signal: "mouse,up,1";
+ source: "normal/message";
+ script {
+ set_state(PART:"normal/message", "default", 0.0);
+ set_state(PART:"normal/message_icon", "default", 0.0);
+ emit("softkey_up", "normal/message");
+ }
+ }
+ program {
+ name: "clicked_normal/message";
+ signal: "mouse,clicked,1";
+ source: "normal/message";
+ script {
+ emit("softkey_clicked", "normal/message");
+ }
+ }
+
+
+ // return_btn //////////////////////////////////////////////////////////////////////////
+ program {
+ name: "down_normal/return_btn";
+ signal: "mouse,down,*";
+ source: "return_btn";
+ script {
+ set_state(PART:"return_btn", "pressed", 0.0);
+ emit("softkey_down", "return_btn");
+ }
+ }
+ program {
+ name: "up_normal/return_btn";
+ signal: "mouse,up,1";
+ source: "return_btn";
+ script {
+ set_state(PART:"return_btn", "default", 0.0);
+ emit("softkey_up", "return_btn");
+ }
+ }
+ program {
+ name: "clicked_normal/return_btn";
+ signal: "mouse,clicked,1";
+ source: "return_btn";
+ script {
+ emit("softkey_clicked", "return_btn");
+ }
+ }
+ program {
+ name: "hide/return_btn";
+ signal: "return_btn/hide";
+ source: "return_btn";
+ script {
+ set_state(PART:"return_btn", "hide", 0.0);
+ set_state(PART:"return_btn/text", "hide", 0.0);
+ }
+ }
+ program {
+ name: "show/return_btn";
+ signal: "return_btn/default";
+ source: "return_btn";
+ script {
+ set_state(PART:"return_btn", "default", 0.0);
+ set_state(PART:"return_btn/text", "default", 0.0);
+ }
+ }
+
+ // input_del ////////////////////////////////////////////////////
+ program {
+ name: "down_input_del";
+ signal: "mouse,down,*";
+ source: "input_del";
+ script {
+ set_state(PART:"input_del", "pressed", 0.0);
+ emit("softkey_down", "input_del");
+ }
+ }
+ program {
+ name: "up_input_del";
+ signal: "mouse,up,1";
+ source: "input_del";
+ script {
+ set_state(PART:"input_del", "show", 0.0);
+ emit("softkey_up", "input_del");
+ }
+ }
+
+ program {
+ name: "clicked_input_del";
+ signal: "mouse,clicked,1";
+ source: "input_del";
+ script {
+ emit("softkey_clicked", "input_del");
+ }
+ }
+
+ // PROG: contactsearch input field ////////////////////////////////////////////////////
+ program {
+ name: "clicked_contactsearch";
+ signal: "mouse,clicked,1";
+ source: "search/inputarea/image";
+ script {
+ emit("softkey_clicked", "search/inputarea/image");
+ }
+ }
+
+ /*****************************************************************************
+ * Program: Softkey - normal mode
+ *****************************************************************************/
+ program {
+ name: "prog_softkey_normal";
+ source: "softkey";
+ signal: "softkey/normal";
+ script {
+ set_state (PART:"normal/call", "expand_L", 0.0);
+ set_state (PART:"normal/call_icon", "default", 0.0);
+ set_state (PART:"normal/message", "default", 0.0);
+ set_state (PART:"normal/message_icon", "default", 0.0);
+
+ }
+ }
+
+ /*****************************************************************************
+ * Program: Softkey - during call mode
+ *****************************************************************************/
+ program {
+ name: "prog_softkey_dc";
+ source: "softkey";
+ signal: "softkey/dc";
+ script {
+ set_state (PART:"normal/call", "default", 0.0);
+ set_state (PART:"normal/call_icon", "default", 0.0);
+ set_state (PART:"normal/message", "default", 0.0);
+ set_state (PART:"normal/message_icon", "default", 0.0);
+ }
+ }
+
+ /*****************************************************************************
+ * Program: Softkey - emergency mode
+ *****************************************************************************/
+ program {
+ name: "prog_softkey_emergency";
+ source: "softkey";
+ signal: "softkey/emergency";
+ script {
+ set_state (PART:"normal/call", "expand_R", 0.0);
+ set_state (PART:"normal/call_icon", "default", 0.0);
+ set_state (PART:"normal/message", "hide", 0.0);
+ set_state (PART:"normal/message_icon", "hide", 0.0);
+ }
+ }
+
+ /*****************************************************************************
+ * Program: Dialer default
+ *****************************************************************************/
+ program {
+ name: "prog/main";
+ source: "main";
+ signal: "main/default";
+ script {
+ emit ("viewcontrol/button", "viewcontrol");
+// emit ("viewobject/entry/hide", "viewobject/entry");
+ }
+ }
+ } // programs end
+ } // end of group
+}
diff --git a/lib/edc/dialer_btn.edc b/lib/edc/dialer_btn.edc
new file mode 100755
index 0000000..6551957
--- /dev/null
+++ b/lib/edc/dialer_btn.edc
@@ -0,0 +1,113 @@
+/*
+* 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.
+*/
+
+
+group {
+ name: "dialer/btn_style";
+ styles {
+ style {
+ name: "Expand_text";
+ base: "font=Tizen:style=Regular text_class=tizen font_size=38 color=#999999 align=center";
+ }
+ }
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "btn_style/number";
+ type: TEXTBLOCK;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; }
+ rel2 { relative: 1.0 0.5; to: "base"; }
+ text {
+ style: "Expand_text";
+ align: 0.5 1.0;
+ }
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "btn_style/icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ min: 38 26;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.75; to: "base"; }
+ rel2 { relative: 0.5 0.75; to: "base"; }
+ image.normal : IMAGE_PATH"C01-3_icon_expand_01.png";
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_PATH"C01-3_icon_expand_02.png";
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "prog/dialer/count_button/opened";
+ source: "count_button";
+ signal: "count_button/opened";
+ script {
+ set_state (PART:"btn_style/icon", "default", 0.0);
+ }
+ }
+ program {
+ name: "prog/dialer/count_button/closed";
+ source: "count_button";
+ signal: "count_button/closed";
+ script {
+ set_state (PART:"btn_style/icon", "pressed", 0.0);
+ }
+ }
+ program {
+ name: "prog/dialer/count_button/hide";
+ source: "count_button";
+ signal: "count_button/hide";
+ script {
+ set_state (PART:"btn_style/icon", "hide", 0.0);
+ }
+ }
+ }
+}
diff --git a/lib/edc/dialer_theme.edc b/lib/edc/dialer_theme.edc
new file mode 100755
index 0000000..65de8f2
--- /dev/null
+++ b/lib/edc/dialer_theme.edc
@@ -0,0 +1,387 @@
+/*
+* 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 MAIN_W (720)
+#define ITEM_H (140)
+#define DIALER_TEXTBLOCK_TEXT_SIZE_MAIN (44)
+#define DIALER_TEXTBLOCK_TEXT_SIZE_SUB (32)
+
+
+collections {
+ styles {
+ style {
+ name: "dialer_textblock_style_main";
+ base: "font=Tizen:style=Roman text_class=list_item font_size=44 align=left color=#000000 wrap=word ellipsis=1.0";
+ tag: "match" "+ color=#3b73b6";
+ }
+ style {
+ name: "dialer_textblock_style_main_selected";
+ base: "font=Tizen:style=Roman text_class=list_item font_size=44 align=left color=#F9F9F9FF wrap=word ellipsis=1.0";
+ tag: "match" "+ color=#F9F9F9FF";
+ }
+ style {
+ name: "dialer_textblock_style_sub";
+ base: "font=Tizen:style=Roman text_class=list_item font_size=32 align=left color=#999999 wrap=word ellipsis=1.0";
+ tag: "match" "+ color=#3b73b6";
+ }
+ style {
+ name: "dialer_textblock_style_sub_selected";
+ base: "font=Tizen:style=Roman text_class=list_item font_size=32 align=left color=#F9F9F9FF wrap=word ellipsis=1.0";
+ tag: "match" "+ color=#F9F9F9FF";
+ }
+ }
+
+#define COMMON_BASE_STYLE\
+ part { \
+ name: "base"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 ITEM_H; \
+ color: 31 31 31 255; \
+ rel1 { relative: 0.0 0.0; } \
+ rel2 { relative: 1.0 1.0; } \
+ } \
+ }
+
+#define COMMON_BG \
+ part { \
+ name: "bg"; \
+ clip_to: "disclip"; \
+ type: RECT; \
+ description { \
+ state: "default" 0.0; \
+ visible: 1; \
+ rel1 { relative: 0.0 0.0; } \
+ rel2 { relative: 1.0 1.0; } \
+ color: 255 255 255 255; \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 1; \
+ rel1 { relative: 0.0 0.0; } \
+ rel2 { relative: 1.0 1.0; } \
+ color: 73 137 174 255; \
+ } \
+ }
+
+#define COMMON_BOTTOM_LINE \
+ part { \
+ name: "bottom_line"; \
+ type: RECT; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 1; \
+ fixed: 0 1; \
+ visible: 1; \
+ color: 81 81 81 255; \
+ rel1 { relative: 0.0 1.0; to: "base";} \
+ rel2 { relative: 1.0 1.0; to: "base";} \
+ align: 0.5 1.0; \
+ } \
+ }
+
+#define COMMON_DISCLIP \
+ part { \
+ name: "disclip"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { to: "bg"; } \
+ rel2 { to: "bg"; } \
+ } \
+ description { \
+ state: "disabled" 0.0; \
+ inherit: "default" 0.0; \
+ color: 255 255 255 64; \
+ } \
+ }
+
+#define COMMON_NAME_TEXTBLOCK\
+ part { \
+ name: "elm.text.left.name"; \
+ type: TEXTBLOCK; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: 0.0 0.0; offset: 26 22; to: "bg"; } \
+ rel2 { relative: 1.0 76/ITEM_H; offset: -26 0; to: "bg"; } \
+ fixed: 1 1; \
+ color: 255 255 255 255; \
+ text { min: 0 1; style: "dialer_textblock_style_main"; } \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: 255 255 255 255; \
+ text.style: "dialer_textblock_style_main_selected"; \
+ } \
+ } \
+ part { \
+ name: "elm.text.left.number"; \
+ type: TEXT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: 0.0 76/ITEM_H; offset: 26 0; to: "bg"; } \
+ rel2 { relative: 1.0 1.0; offset: -26 -22; to: "bg"; } \
+ color: 153 153 153 255; \
+ text { \
+ font: "SLP:style=Regular"; \
+ text_class: "slp"; \
+ size: DIALER_TEXTBLOCK_TEXT_SIZE_SUB; \
+ min: 0 1; \
+ align: 0.0 0.5; \
+ } \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: 255 255 255 255; \
+ } \
+ }
+
+#define COMMON_NUM_TEXTBLOCK\
+ part { \
+ name: "elm.text.left.name"; \
+ type: TEXT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: 0.0 0.0; offset: 26 22; to: "bg"; } \
+ rel2 { relative: 1.0 76/ITEM_H; offset: -26 0; to: "bg"; } \
+ fixed: 1 1; \
+ color: 0 0 0 255; \
+ text { \
+ font: "SLP:style=Regular"; \
+ text_class: "slp"; \
+ size: DIALER_TEXTBLOCK_TEXT_SIZE_MAIN; \
+ min: 0 1; \
+ align: 0.0 0.5; \
+ } \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: 255 255 255 255; \
+ } \
+ } \
+ part { \
+ name: "elm.text.left.number"; \
+ type: TEXTBLOCK; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: 0.0 76/ITEM_H; offset: 26 0; to: "bg"; } \
+ rel2 { relative: 1.0 1.0; offset: -26 -22; to: "bg"; } \
+ color: 255 255 255 255; \
+ text { min: 0 1; style: "dialer_textblock_style_sub"; } \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ text.style: "dialer_textblock_style_sub_selected"; \
+ } \
+ }
+
+#define COMMON_CALLERID_ICON\
+ part { \
+ name: "elm.icon.1"; \
+ type: SWALLOW; \
+ clip_to: "disclip"; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 96 96; \
+ max: 96 96; \
+ fixed: 1 1; \
+ rel1 { \
+ relative: 1.0 0.0; offset: -16 16; \
+ to_x: "bg"; \
+ } \
+ rel2 { \
+ relative: 1.0 1.0; offset: -16 -16; \
+ to_x: "bg"; \
+ } \
+ align: 1.0 0.5; \
+ } \
+ }
+
+#define COMMON_NONAME_TEXTBLOCK\
+ part { \
+ name: "elm.text.left.number"; \
+ type: TEXTBLOCK; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ rel1 { relative: 0.0 0.25; offset: 26 0; to: "bg"; } \
+ rel2 { relative: 1.0 0.75; offset: -26 0; to: "bg"; } \
+ color: 255 255 255 255; \
+ text { min: 0 1; style: "dialer_textblock_style_main"; } \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ text.style: "dialer_textblock_style_main_selected"; \
+ } \
+ }
+
+#define NAME_PROGRAM \
+ program { \
+ name: "name_selected"; \
+ signal: "elm,state,selected"; \
+ source: "elm"; \
+ action: STATE_SET "selected" 0.0; \
+ target: "elm.text.left.name"; \
+ } \
+ program { \
+ name: "name_unselected"; \
+ signal: "elm,state,unselected"; \
+ source: "elm"; \
+ action: STATE_SET "default" 0.0; \
+ target: "elm.text.left.name"; \
+ transition: LINEAR 0.1; \
+ }
+
+
+#define NUMBER_PROGRAM \
+ program { \
+ name: "number_selected"; \
+ signal: "elm,state,selected"; \
+ source: "elm"; \
+ action: STATE_SET "selected" 0.0; \
+ target: "elm.text.left.number"; \
+ } \
+ program { \
+ name: "number_unselected"; \
+ signal: "elm,state,unselected"; \
+ source: "elm"; \
+ action: STATE_SET "default" 0.0; \
+ target: "elm.text.left.number"; \
+ transition: LINEAR 0.1; \
+ }
+
+#define COMMON_PROGRAM \
+ program { \
+ name: "go_active"; \
+ signal: "elm,state,selected"; \
+ source: "elm"; \
+ action: STATE_SET "selected" 0.0; \
+ target: "bg"; \
+ } \
+ program { \
+ name: "go_passive"; \
+ signal: "elm,state,unselected"; \
+ source: "elm"; \
+ action: STATE_SET "default" 0.0; \
+ target: "bg"; \
+ transition: LINEAR 0.1; \
+ } \
+ program { \
+ name: "go_disabled"; \
+ signal: "elm,state,disabled"; \
+ source: "elm"; \
+ action: STATE_SET "disabled" 0.0; \
+ target: "disclip"; \
+ } \
+ program { \
+ name: "go_enabled"; \
+ signal: "elm,state,enabled"; \
+ source: "elm"; \
+ action: STATE_SET "default" 0.0; \
+ target: "disclip"; \
+ }
+
+
+ /* Genlist */
+ group {
+ name: "elm/genlist/item/number_textblock/default";
+ alias: "elm/genlist/item_odd/number_textblock/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.left.name elm.text.left.number";
+ data.item: "contents" "elm.icon.1";
+ data.item: "treesize" "20";
+ parts {
+ COMMON_BASE_STYLE
+ COMMON_BG
+ COMMON_NUM_TEXTBLOCK
+// COMMON_CALLERID_ICON
+ COMMON_DISCLIP
+ COMMON_BOTTOM_LINE
+ }
+ programs {
+ COMMON_PROGRAM
+ NAME_PROGRAM
+ NUMBER_PROGRAM
+ }
+ }
+
+ /* Genlist */
+ group {
+ name: "elm/genlist/item/name_textblock/default";
+ alias: "elm/genlist/item_odd/name_textblock/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.left.name elm.text.left.number";
+ data.item: "contents" "elm.icon.1";
+ data.item: "treesize" "20";
+ parts {
+ COMMON_BASE_STYLE
+ COMMON_BG
+ COMMON_NAME_TEXTBLOCK
+// COMMON_CALLERID_ICON
+ COMMON_DISCLIP
+ COMMON_BOTTOM_LINE
+ }
+ programs {
+ COMMON_PROGRAM
+ NAME_PROGRAM
+ NUMBER_PROGRAM
+ }
+ }
+
+ /* Genlist */
+ group {
+ name: "elm/genlist/item/noname_textblock/default";
+ alias: "elm/genlist/item_odd/noname_textblock/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.left.number";
+ data.item: "treesize" "20";
+ parts {
+ COMMON_BASE_STYLE
+ COMMON_BG
+ COMMON_NONAME_TEXTBLOCK
+ COMMON_DISCLIP
+ COMMON_BOTTOM_LINE
+ }
+ programs {
+ COMMON_PROGRAM
+ NUMBER_PROGRAM
+ }
+ }
+}
+
diff --git a/lib/edc/favorites_theme.edc b/lib/edc/favorites_theme.edc
new file mode 100755
index 0000000..895cd80
--- /dev/null
+++ b/lib/edc/favorites_theme.edc
@@ -0,0 +1,570 @@
+/*
+* 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 WIDTH 720
+#define MIN_SIZE (WIDTH/3)
+#define FAVORITE_ITEM_BG_COLOR 151 151 151 255
+#define FAVORITE_INDEX_TEXT_COLOR 255 255 255 255
+
+// Group Index
+#define GENLIST_INDEX_LIST_SIZE 32
+#define GENLIST_INDEX_LIST_COLOR 59 115 182 255
+#define GENLIST_INDEX_LIST_FOCUS_COLOR 255 255 255 255
+
+#define GENLIST_INDEX_LIST_BG_COLOR 248 246 239 255
+#define GENLIST_INDEX_LIST_PRESS_COLOR 87 135 194 255
+#define GENLIST_INDEX_LINE_COLOR 59 115 182 255
+#define GENLIST_INDEX_LINE_FOCUS_COLOR 255 255 255 255
+
+#define GENLIST_PADDING_SIZE_RIGHT 26
+#define DIALOGUE_PADDING_SIZE_RIGHT 36
+#define GENLIST_ICON_BIG_SIZE 74
+
+
+#define GENLIST_PART_PERSPECTIVE_POINT \
+ part { name: "point"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ color: 0 0 0 0; \
+ rel1 { relative: 0.0 0.0; } \
+ rel2 { relative: 1.0 0.0; } \
+ } \
+ }
+
+#define GENLIST_PART_BASE \
+ part { name: "base"; \
+ type: RECT; \
+ repeat_events: 1; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ align: 0.5 0.5; \
+ color: 0 0 0 0; \
+ } \
+ } \
+ GENLIST_PART_PERSPECTIVE_POINT
+
+#define GENLIST_PART_INDEX_BG_IMAGE \
+ part { name: "bg_image"; \
+ type: RECT; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ color: GENLIST_INDEX_LIST_BG_COLOR; \
+ } \
+ description { state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: GENLIST_INDEX_LIST_PRESS_COLOR; \
+ } \
+ GENLIST_DESCRIPTION_FADEOUT \
+ }
+
+#define GENLIST_PART_EXPANDED_PAD \
+ part { name: "elm.swallow.pad"; \
+ type: SWALLOW; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ visible: 0; \
+ min: 0 0; \
+ fixed: 1 0; \
+ align: 0.0 0.5; \
+ rel1.to: "base"; \
+ rel2.to: "base"; \
+ rel2.relative: 0.0 1.0; \
+ } \
+ }
+
+
+#define GENLIST_PART_SPACER(NAME, DESCRIPION) \
+ part { name: NAME; \
+ scale: 1; \
+ mouse_events: 0; \
+ type: SPACER; \
+ DESCRIPION \
+ }
+
+#define GENLIST_DESCRIPTION_L( left, param ) \
+ description { state: "default" 0.0; \
+ align: 0 0.5; \
+ fixed: 1 0; \
+ rel1 { \
+ relative: 1 0; \
+ to_x: left; \
+ to_y: "base"; \
+ }\
+ rel2 { \
+ relative: 1 1;\
+ to_x: left; \
+ to_y: "base"; \
+ }\
+ param \
+ }
+
+#define GENLIST_PART_PADDING_LEFT_SIZE( SIZE ) \
+ GENLIST_PART_EXPANDED_PAD \
+ GENLIST_PART_SPACER("elm.padding.left", \
+ GENLIST_DESCRIPTION_L("elm.swallow.pad", \
+ min: SIZE 0; \
+ max: SIZE 0; \
+ fixed: 1 0; \
+ ) \
+ )
+
+#define GENLIST_PART_PADDING_RIGHT \
+ GENLIST_PART_SPACER("elm.padding.right", \
+ description { state: "default" 0.0; \
+ min: GENLIST_PADDING_SIZE_RIGHT 0; \
+ max: GENLIST_PADDING_SIZE_RIGHT -1; \
+ fixed: 1 0; \
+ align: 1.0 0.5; \
+ rel1.to: "base"; \
+ rel2.to: "base"; \
+ rel1.relative: 1 0; \
+ } \
+ description { state: "decorate" 0.0; \
+ inherit: "default" 0.0; \
+ min: 0 0; \
+ max: 0 0; \
+ } \
+ )
+
+#define GENLIST_PART_PADDING_TOP_SIZE( SIZE ) \
+ GENLIST_PART_SPACER("elm.padding.top", \
+ description { \
+ state: "default" 0.0; \
+ min: 0 SIZE; \
+ max: -1 SIZE; \
+ fixed: 0 1; \
+ rel1.to: "base"; \
+ rel2.to: "base"; \
+ rel2.relative: 1.0 0.0; \
+ align: 0.5 0.0; \
+ } \
+ )
+
+#define GENLIST_PART_PADDING_RIGHT_SIZE( SIZE ) \
+ GENLIST_PART_SPACER("elm.padding.right", \
+ description { state: "default" 0.0; \
+ min: SIZE 0; \
+ max: SIZE -1; \
+ fixed: 1 0; \
+ align: 1.0 0.5; \
+ rel1.to: "base"; \
+ rel2.to: "base"; \
+ rel1.relative: 1 0; \
+ } \
+ description { state: "decorate" 0.0; \
+ inherit: "default" 0.0; \
+ min: 0 0; \
+ max: 0 0; \
+ } \
+ )
+
+#define GENLIST_PART_PADDING_BOTTOM_SIZE( SIZE ) \
+ GENLIST_PART_SPACER("elm.padding.bottom", \
+ description { state: "default" 0.0; \
+ min: 0 SIZE; \
+ max: -1 SIZE; \
+ fixed: 0 1; \
+ rel1.to: "base"; \
+ rel2.to: "base"; \
+ rel1.relative: 0.0 1.0; \
+ align: 0.5 1.0; \
+ } \
+ )
+
+#define GENLIST_DESCRIPTION( left, right, top, bottom, param ) \
+ description { state: "default" 0.0;\
+ rel1 { \
+ relative: 1 1; \
+ to_x: left; \
+ to_y: top; \
+ }\
+ rel2 {\
+ relative: 0 0;\
+ to_x: right;\
+ to_y: bottom;\
+ }\
+ param\
+ }
+
+#define GENLIST_DESCRIPTION_FADEOUT \
+ description { state: "fadeout" 0.0; \
+ inherit: "default" 0.0; \
+ color: 255 255 255 50; \
+ visible: 0; \
+ } \
+ description { state: "fadein" 0.0; \
+ inherit: "default" 0.0; \
+ } \
+
+#define GENLIST_DESCRIPTION_INDEX_LIST \
+ description { state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: GENLIST_INDEX_LIST_FOCUS_COLOR; \
+ }
+
+#define GENLIST_PARAM_INDEX_LIST \
+ color: GENLIST_INDEX_LIST_COLOR; \
+ align: 0 0.5; \
+ text { \
+ align: 0 0.5; \
+ min: 0 1; \
+ max: 1 0; \
+ font: "Tizen:style=Bold"; \
+ size: GENLIST_INDEX_LIST_SIZE; \
+ text_class: "list_item"; \
+ }
+
+#define GENLIST_DESCRIPTION_LRT( left, right, top, param ) \
+ description { state: "default" 0.0;\
+ align: 0.5 0;\
+ rel1 { \
+ relative: 1 1; \
+ to_x: left; \
+ to_y: top; \
+ }\
+ rel2 {\
+ relative: 0 1;\
+ to_x: right;\
+ to_y: top;\
+ }\
+ param\
+ }
+
+#define GENLIST_PART_TEXT(NAME, DESCRIPION) \
+ part { name: NAME; \
+ scale: 1; \
+ mouse_events: 0; \
+ type: TEXT; \
+ DESCRIPION \
+ GENLIST_DESCRIPTION_FADEOUT \
+ }
+
+#define GENLIST_DESCRIPTION_FADEOUT_RECT \
+ description { state: "fadeout" 0.0; \
+ inherit: "default" 0.0; \
+ color: 0 0 0 50; \
+ visible: 0; \
+ } \
+ description { state: "fadein" 0.0; \
+ inherit: "default" 0.0; \
+ } \
+
+#define GENLIST_PART_RECT(NAME, DESCRIPION) \
+ part { name: NAME; \
+ scale: 1; \
+ type: RECT; \
+ DESCRIPION \
+ GENLIST_DESCRIPTION_FADEOUT_RECT \
+ }
+
+#define GENLIST_PART_INDEX_LINE(LEFT, RIGHT, TOP, BOTTOM) \
+ GENLIST_PART_RECT("index_line", \
+ GENLIST_DESCRIPTION(LEFT, RIGHT, TOP, BOTTOM, \
+ color: GENLIST_INDEX_LINE_COLOR; \
+ min: 0 4; \
+ max: -1 4;) \
+ description { state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: GENLIST_INDEX_LINE_FOCUS_COLOR; \
+ } \
+ )
+
+styles {
+ style {
+ name: "gengrid_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen font_size=24 color=#F9F9F9 wrap=char ellipsis=1.0";
+ }
+ style {
+ name: "gengrid_noid_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen font_size=40 color=#FFFFFF wrap=char align=center ellipsis=0.0";
+ }
+}
+
+collections {
+ group {
+ name: "elm/gengrid/item/group_index/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ parts {
+ GENLIST_PART_BASE
+ GENLIST_PART_INDEX_BG_IMAGE
+ GENLIST_PART_PADDING_LEFT_SIZE(26)
+ GENLIST_PART_PADDING_RIGHT_SIZE(26)
+ GENLIST_PART_PADDING_TOP_SIZE(20)
+ GENLIST_PART_PADDING_BOTTOM_SIZE(14)
+ GENLIST_PART_TEXT("elm.text",
+ GENLIST_DESCRIPTION_LRT("elm.padding.left", "elm.padding.right", "elm.padding.top",
+ GENLIST_PARAM_INDEX_LIST
+ min: 0 38; fixed: 1 1;)
+ GENLIST_DESCRIPTION_INDEX_LIST
+ )
+ GENLIST_PART_INDEX_LINE("elm.padding.left", "elm.padding.right", "elm.text", "elm.padding.bottom")
+ }
+ }
+
+ group{
+ name: "elm/gengrid/item/gridtext_favorites/default";
+ data.item: "texts" "elm.text";
+ data.item: "contents" "elm.swallow.icon elm.swallow.expand.icon elm.swallow.end";
+
+ parts{
+ part{
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 248 246 239 255;
+ }
+ }
+ part {
+ name: "item_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 248 246 239 255;
+ min: MIN_SIZE MIN_SIZE;
+ fixed: 1 1;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ }
+ }
+ part {
+ name: "elm.icon.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 248 246 239 255;
+ rel1 { relative: 0.0 0.0; to: "item_bg"; }
+ rel2 { relative: 1.0 1.0; offset: -2 -2; to: "item_bg"; }
+ }
+ description {
+ state: "edit" 0.0;
+ color: 248 246 239 255;
+ rel1 { relative: 0.05 0.05; to: "item_bg"; }
+ rel2 { relative: 0.95 0.95; offset: -2 -2; to: "item_bg"; }
+ }
+ }
+ part{
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "elm.icon.bg"; }
+ rel2 { relative: 1.0 1.0; to: "elm.icon.bg"; }
+ }
+ }
+ part {
+ name: "label_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 78;
+ min: 0 72;
+ fixed: 0 1;
+ align: 0.0 1.0;
+ rel1 { relative: 0.0 1.0; to: "elm.icon.bg"; }
+ rel2 { relative: 1.0 1.0; to: "elm.icon.bg"; }
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 16 6; to: "label_bg"; }
+ rel2 { relative: 0.75 1.0; offset: -20 0; to: "label_bg"; }
+ text {
+ style: "gengrid_textblock_style";
+ align: 0.5 0.5;
+ }
+ }
+ description {
+ state: "edit" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 18 6; to: "label_bg"; }
+ rel2 { relative: 0.75 1.0; offset: -22 0; to: "label_bg"; }
+ }
+ }
+ part {
+ name: "elm.swallow.expand.icon";
+ type: SWALLOW;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ min: 50 40;
+ fixed: 1 1;
+ rel1 { relative: 1.0 0.5; to: "label_bg"; }
+ rel2 { relative: 1.0 0.5; to: "label_bg"; }
+ align: 1.0 0.5;
+ }
+ }
+ part {
+ name: "elm.swallow.end";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1.to: "elm.swallow.icon";
+ rel2.to: "elm.swallow.icon";
+ }
+ }
+ }
+ programs {
+ program {
+ name: "prog/favorites_theme/edit";
+ source: "favorites_theme";
+ signal: "favorites_theme/edit";
+ action: STATE_SET "edit" 0.0;
+ transition: DECELERATE 0.7;
+ target: "elm.icon.bg";
+ target: "elm.text";
+ }
+ program {
+ name: "prog/favorites_theme/edit_no_effect";
+ source: "favorites_theme";
+ signal: "favorites_theme/edit_no_effect";
+ action: STATE_SET "edit" 0.0;
+ target: "elm.icon.bg";
+ target: "elm.text";
+ }
+ }
+ }
+ group{
+ name: "elm/gengrid/item/gridtext_favorites_no_id/default";
+ data.item: "texts" "elm.text";
+ data.item: "contents" "elm.swallow.expand.icon elm.swallow.end";
+
+ parts{
+ part {
+ name: "item_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 248 246 239 255;
+ min: MIN_SIZE MIN_SIZE;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "item_icon_bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: FAVORITE_ITEM_BG_COLOR;
+ rel1 { relative: 0.0 0.0; to: "item_bg"; }
+ rel2 { relative: 1.0 1.0; offset: -2 -2; to: "item_bg"; }
+ }
+ description {
+ state: "edit" 0.0;
+ color: FAVORITE_ITEM_BG_COLOR;
+ rel1 { relative: 0.05 0.05; to: "item_bg"; }
+ rel2 { relative: 0.95 0.95; offset: -2 -2; to: "item_bg"; }
+ }
+ }
+ part {
+ name: "label_bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 90;
+ rel1 { relative: 0.0 64/240; to: "item_icon_bg"; }
+ rel2 { relative: 1.0 176/240; to: "item_icon_bg"; }
+ }
+ description {
+ state: "edit" 0.0;
+ color: 0 0 0 90;
+ rel1 { relative: 0.0 52/216; to: "item_icon_bg"; }
+ rel2 { relative: 1.0 164/216; to: "item_icon_bg"; }
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 96;
+ fixed: 0 1;
+ rel1 { relative: 0.0 64/240; offset: 20 0; to: "label_bg"; }
+ rel2 { relative: 1.0 176/240; offset: -20 0; to: "label_bg"; }
+ text {
+ style: "gengrid_noid_textblock_style";
+ align: 0.5 0.5;
+ }
+ }
+ description {
+ state: "edit" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.0 52/216; offset: 18 0; to: "label_bg"; }
+ rel2 { relative: 1.0 164/216; offset: -22 0; to: "label_bg"; }
+ }
+ }
+ part {
+ name: "elm.swallow.expand.icon";
+ type: SWALLOW;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ min: 54 64;
+ fixed: 1 1;
+ rel1 { relative: 1.0 1.0; to: "item_icon_bg"; }
+ rel2 { relative: 1.0 1.0; to: "item_icon_bg"; }
+ align: 1.0 1.0;
+ }
+ }
+ part {
+ name: "elm.swallow.end";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1.to: "item_icon_bg";
+ rel2.to: "item_icon_bg";
+ }
+ }
+ }
+ programs {
+ program {
+ name: "prog/favorites_theme/edit";
+ source: "favorites_theme";
+ signal: "favorites_theme/edit";
+ action: STATE_SET "edit" 0.0;
+ transition: DECELERATE 0.7;
+ target: "item_icon_bg";
+ target: "elm.text";
+ }
+ program {
+ name: "prog/favorites_theme/edit_no_effect";
+ source: "favorites_theme";
+ signal: "favorites_theme/edit_no_effect";
+ action: STATE_SET "edit" 0.0;
+ target: "item_icon_bg";
+ target: "elm.text";
+ }
+ }
+ }
+}
diff --git a/lib/edc/group_theme.edc b/lib/edc/group_theme.edc
new file mode 100755
index 0000000..a538fa2
--- /dev/null
+++ b/lib/edc/group_theme.edc
@@ -0,0 +1,901 @@
+/*
+* 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 GROUP_TITLE_BG_COLOR 74 119 149 255
+#define GROUP_BG_COLOR 209 209 209 255
+#define GROUP_TEXT_COLOR 255 255 255 255
+#define GROUP_INDEX_TEXT_COLOR 49 49 49 255
+
+#define WIDTH 330
+#define HEIGHT 312
+#define INFO_HEIGHT 90
+
+#define PADDING 3
+#define ITEM_SIZE 110
+#define CT_SIZE 106
+
+#define PART_BG(NAME) \
+
+#define PART_SWALLOW(NAME) \
+part { \
+ name: "rect."NAME".bg"; \
+ type: RECT; \
+ description { \
+ state: "default" 0.0; \
+ color: GROUP_BG_COLOR; \
+ rel1.to: "rect."NAME; \
+ rel2.to: "rect."NAME; \
+ } \
+}\
+part { \
+ name: "disclip."NAME; \
+ type: RECT; \
+ description { \
+ state: "default" 0.0; \
+ color: GROUP_TEXT_COLOR; \
+ rel1.to: "rect."NAME; \
+ rel2.to: "rect."NAME; \
+ } \
+}\
+part { \
+ name: "swallow."NAME; \
+ type: SWALLOW; \
+ clip_to: "disclip."NAME; \
+ description { \
+ state: "default" 0.0; \
+ rel1.to: "rect."NAME; \
+ rel2.to: "rect."NAME; \
+ }\
+}
+
+#define PART_TEXT(NAME) \
+part { \
+ name: "text."NAME; \
+ type: TEXT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ align: 0.0 0.5; \
+ color: GROUP_TEXT_COLOR; \
+ rel1 { relative: 0.0 0.0; to: "rect."NAME".bg"; } \
+ rel2 { relative: 1.0 1.0; to: "rect."NAME".bg"; } \
+ text { \
+ font: "Tizen:style=Medium"; \
+ text_class: "tizen"; \
+ size: 30; \
+ align: 0.0 0.5; \
+ ellipsis: 0.0; \
+ } \
+ } \
+}
+
+collections {
+ group {
+ name: "elm/gengrid/item/group_index/default";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ min: 0 80;
+ fixed: 0 1;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GROUP_INDEX_TEXT_COLOR;
+ rel1 { offset: 24 0; }
+ align: 0.0 1.0;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 1.0;
+ text_class: "tizen";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/gengrid/item/groupitem.1image/default";
+ data.item: "texts" "text.name text.count text.edit.name text.edit.count";
+ data.item: "contents" "swallow.content1 swallow.icon swallow.edit.icon";
+
+ parts{
+ part {
+ name: "base";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "rect.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GROUP_BG_COLOR;
+ min: WIDTH HEIGHT;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ rel2 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ }
+ }
+ part {
+ name: "rect.info";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 INFO_HEIGHT-PADDING;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GROUP_TITLE_BG_COLOR;
+ rel1 { relative: 0.0 0.0; to: "rect.bg"; offset: PADDING PADDING; }
+ rel2 { relative: 1.0 0.0; to: "rect.bg"; offset: -PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 1.0 0.5;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.info"; offset: -PADDING*3 PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.info"; offset: -PADDING*3 -PADDING*2; }
+ }
+ }
+ part {
+ name: "rect.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: 10 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.5; to: "rect.info"; offset: 10 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ rel2 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.image";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: ITEM_SIZE ITEM_SIZE);
+ fixed: 1 1;
+ align: 1.0 1.0;
+ color: 255 0 0 0;
+ rel1 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.edit.icon"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.edit.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.5; to: "rect.edit.icon"; offset: 0 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.content1";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: (CT_SIZE*3)+(PADDING*2) (CT_SIZE*2)+(PADDING*2);
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ }
+ }
+ PART_SWALLOW("content1")
+ part {
+ name: "swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "rect.icon";
+ rel2.to: "rect.icon";
+ }
+ }
+ part {
+ name: "swallow.edit.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 60 60;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ rel2 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ }
+ }
+ PART_TEXT("name")
+ PART_TEXT("count")
+ PART_TEXT("edit.name")
+ PART_TEXT("edit.count")
+ }
+ }
+ group {
+ name: "elm/gengrid/item/groupitem.2image/default";
+ data.item: "texts" "text.name text.count text.edit.name text.edit.count";
+ data.item: "contents" "swallow.content1 swallow.content2 swallow.icon swallow.edit.icon";
+ parts{
+ part {
+ name: "base";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "rect.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GROUP_BG_COLOR;
+ min: WIDTH HEIGHT;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ rel2 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ }
+ }
+ part {
+ name: "rect.info";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 INFO_HEIGHT-PADDING;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GROUP_TITLE_BG_COLOR;
+ rel1 { relative: 0.0 0.0; to: "rect.bg"; offset: PADDING PADDING; }
+ rel2 { relative: 1.0 0.0; to: "rect.bg"; offset: -PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 1.0 0.5;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.info"; offset: -PADDING*3 PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.info"; offset: -PADDING*3 -PADDING*2; }
+ }
+ }
+ part {
+ name: "rect.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: 10 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.5; to: "rect.info"; offset: 10 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ rel2 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.image";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: ITEM_SIZE ITEM_SIZE);
+ fixed: 1 1;
+ align: 1.0 1.0;
+ color: 255 0 0 0;
+ rel1 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.edit.icon"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.edit.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.5; to: "rect.edit.icon"; offset: 0 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.content1";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: (CT_SIZE*2)+PADDING (CT_SIZE*2)+PADDING;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ }
+ }
+ part {
+ name: "rect.content2";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE (CT_SIZE*2)+PADDING;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.content1.bg"; offset: PADDING 0; }
+ rel2 { relative: 1.0 0.0; to: "rect.content1.bg"; offset: PADDING 0; }
+ }
+ }
+ PART_SWALLOW("content1")
+ PART_SWALLOW("content2")
+ part {
+ name: "swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "rect.icon";
+ rel2.to: "rect.icon";
+ }
+ }
+ part {
+ name: "swallow.edit.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 60 60;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ rel2 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ }
+ }
+ PART_TEXT("name")
+ PART_TEXT("count")
+ PART_TEXT("edit.name")
+ PART_TEXT("edit.count")
+ }
+ }
+ group {
+ name: "elm/gengrid/item/groupitem.3image/default";
+ data.item: "texts" "text.name text.count text.edit.name text.edit.count";
+ data.item: "contents" "swallow.content1 swallow.content2 swallow.content3 swallow.icon swallow.edit.icon";
+
+ parts{
+ part {
+ name: "base";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "rect.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GROUP_BG_COLOR;
+ min: WIDTH HEIGHT;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ rel2 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ }
+ }
+ part {
+ name: "rect.info";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 INFO_HEIGHT-PADDING;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GROUP_TITLE_BG_COLOR;
+ rel1 { relative: 0.0 0.0; to: "rect.bg"; offset: PADDING PADDING; }
+ rel2 { relative: 1.0 0.0; to: "rect.bg"; offset: -PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 1.0 0.5;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.info"; offset: -PADDING*3 PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.info"; offset: -PADDING*3 -PADDING*2; }
+ }
+ }
+ part {
+ name: "rect.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: 10 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.5; to: "rect.info"; offset: 10 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ rel2 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.image";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: ITEM_SIZE ITEM_SIZE);
+ fixed: 1 1;
+ align: 1.0 1.0;
+ color: 255 0 0 0;
+ rel1 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.edit.icon"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.edit.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.5; to: "rect.edit.icon"; offset: 0 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.content1";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: (CT_SIZE*2)+PADDING (CT_SIZE*2)+PADDING;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ }
+ }
+ part {
+ name: "rect.content2";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.content1.bg"; offset: PADDING 0; }
+ rel2 { relative: 1.0 0.0; to: "rect.content1.bg"; offset: PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.content3";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.content2.bg"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.content2.bg"; offset: 0 PADDING; }
+ }
+ }
+ PART_SWALLOW("content1")
+ PART_SWALLOW("content2")
+ PART_SWALLOW("content3")
+ part {
+ name: "swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "rect.icon";
+ rel2.to: "rect.icon";
+ }
+ }
+ part {
+ name: "swallow.edit.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 60 60;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ rel2 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ }
+ }
+ PART_TEXT("name")
+ PART_TEXT("count")
+ PART_TEXT("edit.name")
+ PART_TEXT("edit.count")
+ }
+ }
+ group {
+ name: "elm/gengrid/item/groupitem.6image/default";
+ data.item: "texts" "text.name text.count text.edit.name text.edit.count";
+ data.item: "contents" "swallow.content0 swallow.content1 swallow.content2 swallow.content3 swallow.content4 swallow.content5 swallow.content6 swallow.icon swallow.edit.icon";
+
+ parts{
+ part {
+ name: "base";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "rect.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GROUP_BG_COLOR;
+ min: WIDTH HEIGHT;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ rel2 { relative: 0.0 0.0; to: "base"; offset: 15 15; }
+ }
+ }
+ part {
+ name: "rect.info";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 INFO_HEIGHT-PADDING;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GROUP_TITLE_BG_COLOR;
+ rel1 { relative: 0.0 0.0; to: "rect.bg"; offset: PADDING PADDING; }
+ rel2 { relative: 1.0 0.0; to: "rect.bg"; offset: -PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 1.0 0.5;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.info"; offset: -PADDING*3 PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.info"; offset: -PADDING*3 -PADDING*2; }
+ }
+ }
+ part {
+ name: "rect.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: 10 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.5; to: "rect.info"; offset: 10 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: INFO_HEIGHT-(PADDING*2) INFO_HEIGHT-(PADDING*2);
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ rel2 { relative: 0.0 0.0; to: "rect.info"; offset: PADDING PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.image";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: ITEM_SIZE ITEM_SIZE);
+ fixed: 1 1;
+ align: 1.0 1.0;
+ color: 255 0 0 0;
+ rel1 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ rel2 { relative: 1.0 1.0; to: "rect.bg"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.edit.name.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.edit.icon"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 0.5; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.edit.count.bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.5; to: "rect.edit.icon"; offset: 0 0; }
+ rel2 { relative: 0.0 1.0; to_x: "rect.icon"; to_y: "rect.info"; offset: -PADDING -PADDING; }
+ }
+ }
+ part {
+ name: "rect.content1";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.info"; offset: 0 PADDING; }
+ }
+ }
+ part {
+ name: "rect.content2";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.content1.bg"; offset: PADDING 0; }
+ rel2 { relative: 1.0 0.0; to: "rect.content1.bg"; offset: PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.content3";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "rect.content2.bg"; offset: PADDING 0; }
+ rel2 { relative: 1.0 0.0; to: "rect.content2.bg"; offset: PADDING 0; }
+ }
+ }
+ part {
+ name: "rect.content4";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.content1.bg"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.content1.bg"; offset: 0 PADDING; }
+ }
+ }
+ part {
+ name: "rect.content5";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.content2.bg"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.content2.bg"; offset: 0 PADDING; }
+ }
+ }
+ part {
+ name: "rect.content6";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CT_SIZE CT_SIZE;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 1.0; to: "rect.content3.bg"; offset: 0 PADDING; }
+ rel2 { relative: 0.0 1.0; to: "rect.content3.bg"; offset: 0 PADDING; }
+ }
+ }
+ PART_SWALLOW("content1")
+ PART_SWALLOW("content2")
+ PART_SWALLOW("content3")
+ PART_SWALLOW("content4")
+ PART_SWALLOW("content5")
+ PART_SWALLOW("content6")
+ part {
+ name: "swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "rect.icon";
+ rel2.to: "rect.icon";
+ }
+ }
+ part {
+ name: "swallow.edit.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 60 60;
+ fixed: 1 1;
+ rel1 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ rel2 { relative: 0.5 0.5; to: "rect.edit.icon"; }
+ }
+ }
+ PART_TEXT("name")
+ PART_TEXT("count")
+ PART_TEXT("edit.name")
+ PART_TEXT("edit.count")
+ }
+ }
+}
diff --git a/lib/edc/image_layout.edc b/lib/edc/image_layout.edc
new file mode 100755
index 0000000..2ef7e38
--- /dev/null
+++ b/lib/edc/image_layout.edc
@@ -0,0 +1,115 @@
+/*
+* 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.
+*/
+
+
+ collections {
+ group {
+ name: "elm/genlist/item/image_layout/default";
+ alias: "elm/genlist/item_odd/image_layout/default";
+ alias: "dialogue/image_layout";
+ data.item: "selectraise" "on";
+ data.item: "stacking" "above";
+ data.item: "contents" "elm.icon elm.icon2 elm.icon3 elm.icon4";
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 479;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "elm.rect.icon";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 1.0;
+ min: 360 360;
+ max: 360 360;
+ fixed: 1 1;
+ color: 239 237 229 255;
+ rel1 { relative: 0.0 417.0/479.0; }
+ rel2 { relative: 1.0 417.0/479.0; }
+ }
+ }
+ part {
+ name: "elm.icon";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 1.0;
+ min: 360 360;
+ max: 360 360;
+ fixed: 1 1;
+ rel1 { relative: 0.0 417.0/479.0; }
+ rel2 { relative: 1.0 417.0/479.0; }
+ }
+ }
+ part {
+ name: "elm.icon2";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ min: 128 128;
+ max: 128 128;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "elm.icon"; }
+ rel2 { relative: 1.0 417.0/479.0; to: "elm.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon3";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 128 128;
+ max: 128 128;
+ fixed: 1 1;
+ rel1 { relative: 1.0 1.0; to: "elm.icon"; offset: 16 0; }
+ rel2 { relative: 1.0 1.0; to: "elm.icon"; offset: 16 0; }
+ }
+ }
+ part {
+ name: "elm.icon4";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ min: 45 45;
+ max: 45 45;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "elm.icon"; }
+ rel2 { relative: 0.0 0.0; to: "elm.icon"; }
+ }
+ }
+ }
+ }
+}
diff --git a/lib/edc/input_theme.edc b/lib/edc/input_theme.edc
new file mode 100755
index 0000000..2ab6470
--- /dev/null
+++ b/lib/edc/input_theme.edc
@@ -0,0 +1,767 @@
+/*
+* 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 GENLIST_HEIGHT_1LINE 112
+#define GENLIST_LIST_LINE1_COLOR 211 209 203 255
+#define GENLIST_PADDING_32_INC 32
+#define GENLIST_PART_BG_COLOR 249 249 249 255
+#define INPUT_DIALOGUE_COLOR 108 168 199 255
+#define INPUT_DIALOGUE_BG_COLOR 236 240 242 255
+#define GENLIST_INDEX_LIST_BG_COLOR 248 246 239 255
+
+#define GENLIST_FONT_32_INC 32
+#define GENLIST_FONT_44_INC 44
+#define GENLIST_PADDING_12_INC 12
+#define GENLIST_PADDING_16_INC 16
+#define GENLIST_PADDING_27_INC 27
+#define GENLIST_SIZE_163_INC 163
+#define GENLIST_PART_LIST_LINE_COLOR_INC 169 169 169 255
+#define GENLIST_DIALOGUE_FONT_EDIT_MODE_TEXT_01_COLOR_INC 100 100 100 255
+#define GENLIST_PART_FONT_LIST_MAIN_TEXT_UNREAD_COLOR_INC 0 0 0 255
+#define GENLIST_DIALOGUE_GROUP_LEFT_BG_COLOR_INC 108 168 199 255
+#define GENLIST_PART_DISCLIP_COLOR_INC 255 255 255 10
+#define GENLIST_PART_BG_COLOR_INC 236 240 242 255
+#define GENLIST_DIALOGUE_BG_IMAGE_COLOR_INC 236 240 242 255
+#define GENLIST_PART_LIST_PRESS_COLOR_INC 42 137 194 255
+
+
+#define GENLIST_PART_BASE( param_item_height ) \
+ part { name: "base"; \
+ type: RECT; \
+ repeat_events: 1; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ min: 0 param_item_height; \
+ color: GENLIST_PART_BG_COLOR_INC; \
+ } \
+ }
+
+#define GENLIST_PART_DIALOGUE_BG_IMAGE \
+ part { name: "bg_image"; \
+ type: RECT; \
+ clip_to: "disclip"; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ color: GENLIST_DIALOGUE_BG_IMAGE_COLOR_INC; \
+ } \
+ description { state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: GENLIST_PART_LIST_PRESS_COLOR_INC; \
+ } \
+ }
+
+#define GENLIST_PART_BOTTOM_LINE \
+part { name: "bottom_line"; \
+ type: RECT; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ min: 0 1; \
+ fixed: 0 1; \
+ visible: 1; \
+ color: GENLIST_PART_LIST_LINE_COLOR_INC; \
+ rel1 { \
+ relative: 0.0 1.0; \
+ offset: 0 -1; \
+ } \
+ } \
+}
+
+#define GENLIST_PART_PADDING_LEFT( param_padding_size ) \
+part { name: "elm.padding.left"; \
+ type: RECT; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel2.relative: 0.0 1.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
+part { name: "elm.padding.right"; \
+ type: RECT; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel1.relative: 1.0 0.0; \
+ align: 1.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_DIALOGUE_ITEM \
+part { name: "elm.rect.dialogue"; \
+ type: RECT; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ min: GENLIST_PADDING_12_INC 0; \
+ fixed: 1 0; \
+ color: GENLIST_DIALOGUE_GROUP_LEFT_BG_COLOR_INC; \
+ rel2.relative: 0.0 1.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_DIALOGUE_RIGHT_LINE \
+part { name: "elm.rect.dialogue.right.line"; \
+ type: RECT; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ min: 1 0; \
+ fixed: 1 0; \
+ visible: 1; \
+ rel1.relative: 1.0 0.0; \
+ align: 1.0 0.0; \
+ color: GENLIST_PART_LIST_LINE_COLOR_INC; \
+ } \
+}
+
+#define GENLIST_PART_DISCLIP \
+part { name: "disclip"; \
+ type: RECT; \
+ description { state: "default" 0.0; \
+ } \
+ description { state: "disabled" 0.0; \
+ inherit: "default" 0.0; \
+ color: GENLIST_PART_DISCLIP_COLOR_INC; \
+ } \
+}
+
+#define GENLIST_DESCRIPTION_FLIP_ENABLED \
+description { state: "flip_enabled" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 0; \
+}
+
+collections
+{
+ /* Genlist Item */
+ group {
+ name: "dialogue/baseinfo.3icon";
+ data.item: "contents" "elm.icon.name1 elm.icon.name2 elm.icon.image";
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 267;
+ }
+ }
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_PART_BG_COLOR;
+ }
+ }
+ part {
+ name: "elm.rect.top_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ min: 0 40;
+ fixed: 0 1;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 0.0; }
+ }
+ }
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1.0 0.0;
+ min: 141 141;
+ fixed: 1 1;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 1.0; to: "elm.rect.top_padding"; }
+ rel2 { relative: 1.0 1.0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.expand.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1.0 1.0;
+ min: 74 74;
+ fixed: 1 1;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 1.0; to: "base"; }
+ rel2 { relative: 1.0 1.0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.rect.right_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1.0 0.0;
+ min: 15 0;
+ fixed: 1 0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "elm.icon.image.rect"; }
+ rel2 { relative: 0.0 1.0; to: "elm.icon.image.rect"; }
+ }
+ }
+ part {
+ name: "elm.rect.top_line";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 0 1;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_LINE_COLOR_INC;
+ rel1 { relative: 0.0 1.0; to: "elm.rect.top_padding"; }
+ rel2 { relative: 0.0 0.0; to: "elm.rect.right_padding"; }
+ }
+ }
+ part {
+ name: "elm.rect.dialogue";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 12 0;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ color: INPUT_DIALOGUE_COLOR;
+ rel1 { relative: 0.0 1.0; to: "elm.rect.top_padding"; }
+ rel2 { relative: 0.0 1.0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.icon.name1.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ color: INPUT_DIALOGUE_BG_COLOR;
+ rel1 { relative: 1.0 1.0; to_x: "elm.rect.dialogue"; to_y: "elm.rect.top_line"; }
+ rel2 { relative: 1.0 0.0; to: "elm.rect.middle_line"; }
+ }
+ }
+ part {
+ name: "elm.rect.middle_line";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 0 1;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_LINE_COLOR_INC;
+ rel1 { relative: 0.0 0.5; to: "elm.rect.dialogue"; }
+ rel2 { relative: 0.0 0.5 ; to_x: "elm.rect.right_padding"; to_y: "elm.rect.dialogue"; }
+ }
+ }
+ part {
+ name: "elm.icon.name2.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ color: INPUT_DIALOGUE_BG_COLOR;
+ rel1 { relative: 1.0 1.0; to_x: "elm.rect.dialogue"; to_y: "elm.rect.middle_line"; }
+ rel2 { relative: 1.0 0.0; to: "elm.rect.bottom_line"; }
+ }
+ }
+ part {
+ name: "elm.rect.bottom_line";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 0 1;
+ fixed: 0 1;
+ align: 0.0 1.0;
+ color: GENLIST_PART_LIST_LINE_COLOR_INC;
+ rel1 { relative: 0.0 1.0; to: "elm.rect.dialogue"; to_y: "base" ;}
+ rel2 { relative: 0.0 1.0; to_x: "elm.rect.right_padding"; to_y: "base"; }
+ }
+ }
+ part {
+ name: "elm.rect.right_line";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 1 0;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_LINE_COLOR_INC;
+ rel1 { relative: 1.0 1.0; to: "elm.rect.top_line"; }
+ rel2 { relative: 0.0 1.0; to: "elm.rect.bottom_line"; }
+ }
+ }
+ part {
+ name: "elm.icon.name1";
+ type: SWALLOW;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ rel1 { relative: 0.0 0.0; offset: 16 0; to: "elm.icon.name1.rect"; }
+ rel2 { relative: 1.0 1.0; offset: -16 0; to: "elm.icon.name1.rect"; }
+ }
+ }
+ part {
+ name: "elm.icon.name2";
+ type: SWALLOW;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ rel1 { relative: 0.0 0.0; offset: 16 0; to: "elm.icon.name2.rect"; }
+ rel2 { relative: 1.0 1.0; offset: -16 0; to: "elm.icon.name2.rect"; }
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.expand";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ rel1.to: "elm.icon.expand.rect";
+ rel2.to: "elm.icon.expand.rect";
+ }
+ }
+ }
+ }
+ /* Genlist Item */
+ group {
+ name: "dialogue/baseinfo.expand.1icon";
+ data.item: "contents" "elm.icon.name elm.icon.expand";
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 113;
+ }
+ }
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_PART_BG_COLOR;
+ }
+ }
+ part {
+ name: "elm.rect.right_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1.0 0.0;
+ min: 156 0;
+ fixed: 1 0;
+ color: 0 0 0 0;
+ rel1 { relative: 1.0 0.0; to: "base"; }
+ rel2 { relative: 1.0 1.0; to: "base"; }
+ }
+ }
+ part {
+ name: "elm.rect.dialogue";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 12 0;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ color: INPUT_DIALOGUE_COLOR;
+ rel2.relative: 0.0 1.0;
+ }
+ }
+ part {
+ name: "elm.icon.name.rect";
+ type: RECT;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ color: INPUT_DIALOGUE_BG_COLOR;
+ rel1 { relative: 1.0 0.0; to_x: "elm.rect.dialogue"; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.rect.right_padding"; }
+ }
+ }
+ part {
+ name: "elm.rect.bottom_line";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 0 1;
+ fixed: 0 1;
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_LINE_COLOR_INC;
+ rel1 { relative: 0.0 1.0; offset: 0 -1; to: "elm.icon.name.rect"; }
+ rel2 { relative: 1.0 1.0; offset: 0 -1; to: "elm.icon.name.rect"; }
+ }
+ }
+ part {
+ name: "elm.rect.right_line";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 1 0;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_LINE_COLOR_INC;
+ rel1 { relative: 0.0 0.0; to: "elm.rect.right_padding"; }
+ rel2 { relative: 0.0 1.0; to: "elm.rect.right_padding"; }
+ }
+ }
+ part {
+ name: "elm.icon.name";
+ type: SWALLOW;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ rel1 { relative: 0.0 0.0; offset: 16 0; to: "elm.icon.name.rect"; }
+ rel2 { relative: 1.0 1.0; offset: -16 0; to: "elm.icon.name.rect"; }
+ }
+ }
+ }
+ }
+ group {
+ name: "dialogue/1icon.1type.1edit";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "contents" "elm.icon elm.icon.type elm.icon.edit";
+ images {
+ image: "00_list_group_bg.png" COMP;
+ }
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_INDEX_LIST_BG_COLOR;
+ min: 0 113;
+ }
+ }
+ part {
+ name: "elm.icon.bg_image";
+ type: IMAGE;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ rel1 { relative: 0.0 0.0; offset: 16 0; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.icon.type"; }
+ image {
+ normal: "00_list_group_bg.png";
+ border: 14 14 10 10;
+ border_scale: 1;
+ }
+ }
+ }
+ part {
+ name: "elm.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 36 0; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.icon.type"; offset: -20 0; }
+ }
+ }
+ part {
+ name: "elm.icon.type";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 160 74;
+ max: 160 74;
+ fixed: 1 1;
+ align: 1.0 0.5;
+ rel1 { relative: 0.0 0.0; to_x: "elm.icon.edit"; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.icon.edit"; }
+ }
+ }
+ part {
+ name: "elm.icon.edit";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 106 74;
+ max: 106 74;
+ fixed: 1 1;
+ align: 1.0 0.5;
+ rel1 { relative: 1.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ }
+ }
+ group {
+ name: "dialogue/7icon.1type.1edit";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "contents" "elm.icon.1 elm.icon.2 elm.icon.3 elm.icon.4 elm.icon.5 elm.icon.6 elm.icon.7 elm.icon.type elm.icon.edit";
+ images {
+ image: "00_list_group_bg.png" COMP;
+ }
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_INDEX_LIST_BG_COLOR;
+ min: 0 784;
+ }
+ }
+ part {
+ name: "elm.icon.bg_image";
+ type: IMAGE;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ rel1 { relative: 0.0 0.0; offset: 16 0; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.icon.type"; }
+ image {
+ normal: "00_list_group_bg.png";
+ border: 14 14 10 10;
+ border_scale: 1;
+ }
+ }
+ }
+ part {
+ name: "elm.rect.icon";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; offset: 16 0; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.icon.type"; }
+ }
+ }
+ part {
+ name: "elm.rect.icon.line1";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_LIST_LINE1_COLOR;
+ min: 0 1;
+ max: -1 1;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1/7; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 1/7; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.rect.icon.line2";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_LIST_LINE1_COLOR;
+ min: 0 1;
+ max: -1 1;
+ fixed: 0 1;
+ rel1 { relative: 0.0 2/7; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 2/7; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.rect.icon.line3";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_LIST_LINE1_COLOR;
+ min: 0 1;
+ max: -1 1;
+ fixed: 0 1;
+ rel1 { relative: 0.0 3/7; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 3/7; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.rect.icon.line4";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_LIST_LINE1_COLOR;
+ min: 0 1;
+ max: -1 1;
+ fixed: 0 1;
+ rel1 { relative: 0.0 4/7; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 4/7; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.rect.icon.line5";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_LIST_LINE1_COLOR;
+ min: 0 1;
+ max: -1 1;
+ fixed: 0 1;
+ rel1 { relative: 0.0 5/7; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 5/7; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.rect.icon.line6";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_LIST_LINE1_COLOR;
+ min: 0 1;
+ max: -1 1;
+ fixed: 0 1;
+ rel1 { relative: 0.0 6/7; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 6/7; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 1/7; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.2";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 1/7; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 2/7; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.3";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 2/7; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 3/7; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.4";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 3/7; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 4/7; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.5";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 4/7; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 5/7; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.6";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 5/7; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 6/7; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.7";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 6/7; offset: 20 0; to: "elm.rect.icon"; }
+ rel2 { relative: 1.0 1.0; offset: -20 0; to: "elm.rect.icon"; }
+ }
+ }
+ part {
+ name: "elm.icon.type";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 160 74;
+ max: 160 74;
+ fixed: 1 1;
+ align: 1.0 0.5;
+ rel1 { relative: 0.0 0.0; to_x: "elm.icon.edit"; }
+ rel2 { relative: 0.0 1.0; to_x: "elm.icon.edit"; }
+ }
+ }
+ part {
+ name: "elm.icon.edit";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 106 74;
+ max: 106 74;
+ fixed: 1 1;
+ align: 1.0 0.5;
+ rel1 { relative: 1.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ }
+ }
+}
diff --git a/lib/edc/list.edc b/lib/edc/list.edc
new file mode 100755
index 0000000..834072b
--- /dev/null
+++ b/lib/edc/list.edc
@@ -0,0 +1,102 @@
+/*
+* 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.
+*/
+
+
+collections
+{
+ group {
+ name: "genlist";
+ parts
+ {
+ part {
+ name: "bg";
+ type: RECT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "searchbar";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ min: 0 106;
+ fixed: 0 1;
+ rel2 { relative: 1.0 0.0; }
+ }
+ }
+ part {
+ name: "content";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 1.0; to: "searchbar"; }
+ rel2.to: "bg";
+ }
+ }
+ part {
+ name: "fastscroll";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ fixed: 0 1;
+ rel1.to: "content";
+ rel2.to: "content";
+ }
+ }
+ }
+ }
+ group {
+ name: "genlist_no_searchbar";
+ parts
+ {
+ part {
+ name: "bg";
+ type: RECT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "content";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ }
+ }
+ part {
+ name: "fastscroll";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ fixed: 0 1;
+ rel1.to: "content";
+ rel2.to: "content";
+ }
+ }
+ }
+ }
+}
diff --git a/lib/edc/list_theme.edc b/lib/edc/list_theme.edc
new file mode 100755
index 0000000..f16c857
--- /dev/null
+++ b/lib/edc/list_theme.edc
@@ -0,0 +1,766 @@
+/*
+* 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 GENLIST_PART_BG_COLOR_INC 248 246 239 255
+#define GENLIST_PART_LIST_LINE_COLOR_INC 211 209 203 255
+#define GENLIST_PART_LIST_PRESS_COLOR_INC 87 135 194 255
+#define GENLIST_PART_LIST_COUNT_COLOR_INC 124 124 124 255
+#define GENLIST_PART_LIST_TEXT_DEFAULT 0 0 0 255
+#define GENLIST_PART_TEXT_PRESS_COLOR 250 250 250 255
+#define GENLIST_PART_LIST_TEXT_SUB_DEFAULT 0 0 0 128
+
+#define GENLIST_PART_BASE( param_item_height ) \
+part { \
+ name: "base"; \
+ type: RECT; \
+ repeat_events: 1; \
+ scale: 1; \
+ description { state: "default" 0.0; \
+ min: 0 param_item_height; \
+ color: GENLIST_PART_BG_COLOR_INC; \
+ } \
+}
+
+#define GENLIST_PART_BOTTOM_LINE \
+part { name: "bottom_line"; \
+ type: RECT; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ min: 0 1; \
+ fixed: 0 1; \
+ visible: 1; \
+ color: GENLIST_PART_LIST_LINE_COLOR_INC; \
+ rel1 { \
+ relative: 0.0 1.0; \
+ offset: 0 -1; \
+ } \
+ } \
+}
+
+#define GENLIST_PART_PADDING_LEFT( param_padding_size ) \
+part { \
+ name: "elm.padding.left"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel2.relative: 0.0 1.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
+part { \
+ name: "elm.padding.right"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel1.relative: 1.0 0.0; \
+ align: 1.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_BG_IMAGE \
+part { \
+ name: "bg_image"; \
+ type: RECT; \
+ clip_to: "disclip"; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ color: GENLIST_PART_BG_COLOR_INC; \
+ } \
+ description { \
+ state: "selected" 0.0; \
+ inherit: "default" 0.0; \
+ color: GENLIST_PART_LIST_PRESS_COLOR_INC; \
+ } \
+}
+
+#define GENLIST_DESCRIPTION_FLIP_ENABLED \
+description { \
+ state: "flip_enabled" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 0; \
+}
+
+collections
+{
+ styles {
+ style {
+ name: "genlist_default_textblock_style";
+ base: "font=Tizen:style=Roman text_class=list_item font_size=44 align=left color=#000000FF wrap=word ellipsis=1.0";
+ tag: "br" "\n";
+ tag: "ps" "ps";
+ tag: "tab" "\t";
+ tag: "b" "+ font=Tizen:style=Bold";
+ tag: "match" "+ color=#2A89C2";
+ }
+ style {
+ name: "genlist_default_textblock_selected_style";
+ base: "font=Tizen:style=Roman text_class=list_item font_size=44 align=left color=#F9F9F9FF wrap=word ellipsis=1.0";
+ tag: "br" "\n";
+ tag: "ps" "ps";
+ tag: "tab" "\t";
+ tag: "b" "+ font=Tizen:style=Bold";
+ tag: "match" "+ color=#F9F9F9FF";
+ }
+ }
+ /* Genlist Item */
+ group {
+ name: "elm/genlist/item/1text_center/default";
+ alias: "elm/genlist/item_odd/1text_center/default";
+ alias: "elm/genlist/item_compress/1text_center/default";
+ alias: "elm/genlist/item_compress_odd/1text_center/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ parts {
+ GENLIST_PART_BASE(130);
+ GENLIST_PART_BOTTOM_LINE
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ clip_to: "disclip";
+ description {
+ state: "default" 0.0;
+ color: GENLIST_PART_LIST_COUNT_COLOR_INC;
+ text {
+ font: "Tizen:style=Roman";
+ text_class: "tizen";
+ size: 44;
+ min: 0 1;
+ align: 0.5 0.5;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 248 246 239 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/link_list/default";
+ alias: "elm/genlist/item_odd/link_list/default";
+ alias: "elm/genlist/item_compress/link_list/default";
+ alias: "elm/genlist/item_compress_odd/link_list/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text elm.text.1 elm.text.2";
+ data.item: "contents" "elm.icon.1";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BASE(130)
+ GENLIST_PART_BG_IMAGE
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_LEFT(26)
+ GENLIST_PART_PADDING_RIGHT(24)
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 104 104;
+ max: 104 104;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ }
+ align: 1.0 0.5;
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.padding.icon1.text1right";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 4 0;
+ fixed: 1 0;
+ visible: 0;
+ rel1.to_x: "elm.icon.1";
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.icon.1";
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ clip_to: "disclip";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.icon1.text1right";
+ }
+ align: 0.0 0.5;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ font: "Tizen:style=Roman";
+ size: 44;
+ min: 0 1;
+ max: 1 0;
+ align: 0.0 0.5;
+ text_class: "list_item";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: GENLIST_PART_TEXT_PRESS_COLOR;
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.text.1";
+ type: TEXT;
+ clip_to: "disclip";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 0.7;
+ to_x: "elm.padding.icon1.text1right";
+ }
+ align: 0.0 0.5;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ font: "Tizen:style=Roman";
+ size: 44;
+ min: 0 1;
+ max: 1 0;
+ align: 0.0 0.5;
+ text_class: "list_item";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: GENLIST_PART_TEXT_PRESS_COLOR;
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.text.2";
+ type: TEXT;
+ clip_to: "disclip";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.5;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.icon1.text1right";
+ }
+ align: 0.0 0.5;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ font: "Tizen:style=Roman";
+ size: 32;
+ min: 0 1;
+ max: 1 0;
+ align: 0.0 0.5;
+ text_class: "list_item";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: GENLIST_PART_TEXT_PRESS_COLOR;
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.padding.text.right";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.text";
+ }
+ rel2.to_x: "elm.text";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 110;
+ }
+ }
+ part {
+ name: "elm.flip.content";
+ clip_to: "disclip";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.5;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 0.5;
+ to_x: "elm.padding.right";
+ }
+ }
+ description {
+ state: "flip_enabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,selected";
+ source: "elm";
+ action: STATE_SET "selected" 0.0;
+ target: "bg_image";
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unselected";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg_image";
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ transition: LINEAR 0.1;
+ }
+ program {
+ name: "go_disabled";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "go_enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "flip_enabled";
+ signal: "elm,state,flip,enabled";
+ source: "elm";
+ action: STATE_SET "flip_enabled" 0.0;
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ target: "elm.icon.1";
+ target: "elm.flip.content";
+ }
+ program {
+ name: "flip_disabled";
+ signal: "elm,state,flip,disabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ target: "elm.icon.1";
+ target: "elm.flip.content";
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item_compress/link_list.tb/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text elm.text.1 elm.text.2";
+ data.item: "contents" "elm.icon.1";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BASE(130)
+ GENLIST_PART_BG_IMAGE
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_LEFT(26)
+ GENLIST_PART_PADDING_RIGHT(24)
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 104 104;
+ max: 104 104;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ }
+ align: 1.0 0.5;
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.padding.icon1.left";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 64 0;
+ fixed: 1 0;
+ visible: 0;
+ rel1.to_x: "elm.icon.1";
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.icon.1";
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.left2";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 134 0;
+ fixed: 1 0;
+ visible: 0;
+ rel1.to_x: "elm.icon.1";
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.icon.1";
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.left3";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 51 0;
+ fixed: 1 0;
+ visible: 0;
+ rel1.to_x: "elm.icon.1";
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.icon.1";
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.text1right";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 4 0;
+ fixed: 1 0;
+ visible: 0;
+ rel1.to_x: "elm.icon.1";
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.icon.1";
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ clip_to: "disclip";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.icon1.text1right";
+ }
+ align: 0.0 0.5;
+ text {
+ style: "genlist_default_textblock_style";
+ min: 0 1;
+ max: 1 0;
+ align: 0.0 0.5;
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ text.style: "genlist_default_textblock_selected_style";
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.text.1";
+ type: TEXTBLOCK;
+ clip_to: "disclip";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 0.7;
+ to_x: "elm.padding.icon1.text1right";
+ }
+ align: 0.0 0.5;
+ text {
+ style: "genlist_default_textblock_style";
+ min: 0 1;
+ max: 1 0;
+ align: 0.0 0.5;
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ text.style: "genlist_default_textblock_selected_style";
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.text.2";
+ type: TEXT;
+ clip_to: "disclip";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.5;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.icon1.text1right";
+ }
+ align: 0.0 0.5;
+ color: GENLIST_PART_LIST_TEXT_SUB_DEFAULT;
+ text {
+ font: "Tizen:style=Roman";
+ size: 32;
+ min: 0 1;
+ max: 1 0;
+ align: 0.0 0.5;
+ text_class: "list_item";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: GENLIST_PART_TEXT_PRESS_COLOR;
+ }
+ GENLIST_DESCRIPTION_FLIP_ENABLED
+ }
+ part {
+ name: "elm.padding.text.right";
+ type: RECT;
+ clip_to: "disclip";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.text";
+ }
+ rel2.to_x: "elm.text";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 110;
+ }
+ }
+ part {
+ name: "elm.flip.content";
+ clip_to: "disclip";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.5;
+ to_x: "elm.padding.left";
+ }
+ rel2 {
+ relative: 0.0 0.5;
+ to_x: "elm.padding.right";
+ }
+ }
+ description {
+ state: "flip_enabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,selected";
+ source: "elm";
+ action: STATE_SET "selected" 0.0;
+ target: "bg_image";
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unselected";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg_image";
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ transition: LINEAR 0.1;
+ }
+ program {
+ name: "go_disabled";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "go_enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "flip_enabled";
+ signal: "elm,state,flip,enabled";
+ source: "elm";
+ action: STATE_SET "flip_enabled" 0.0;
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ target: "elm.icon.1";
+ target: "elm.flip.content";
+ }
+ program {
+ name: "flip_disabled";
+ signal: "elm,state,flip,disabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ target: "elm.text.1";
+ target: "elm.text.2";
+ target: "elm.icon.1";
+ target: "elm.flip.content";
+ }
+ }
+ }
+}
diff --git a/lib/edc/logdetail_theme.edc b/lib/edc/logdetail_theme.edc
new file mode 100755
index 0000000..c980b8b
--- /dev/null
+++ b/lib/edc/logdetail_theme.edc
@@ -0,0 +1,1434 @@
+/*
+* 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 GENLIST_PART_BG_COLOR_INC 249 249 249 255
+#define GENLIST_PART_LIST_LINE_COLOR_INC 169 169 169 255
+#define GENLIST_DIALOGUE_FONT_SUB_TITLE_COLOR_INC 102 102 102 255
+#define GENLIST_PART_LIST_TEXT_DEFAULT 0 0 0 255
+
+#define PHUG_IMAGES "../images/phoneug_images/"
+#define BUTTON_CIRCLE_STYLE_BG_MIN_MAX_INC 138 138
+#define BUTTON_CIRCLE_STYLE_CONTENT_MIN_MAX_INC 138 138
+
+#define GENLIST_BASEINFO_PART_BASE(height) \
+part { \
+ name: "base"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 height; \
+ } \
+}
+
+#define GENLIST_PART_BASE( param_item_height ) \
+part { \
+ name: "base"; \
+ type: RECT; \
+ repeat_events: 1; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 param_item_height; \
+ color: GENLIST_PART_BG_COLOR_INC; \
+ } \
+}
+#define GENLIST_PART_BOTTOM_LINE \
+part { \
+ name: "bottom_line"; \
+ type: RECT; \
+ mouse_events: 0; \
+ description { state: "default" 0.0; \
+ min: 0 1; \
+ fixed: 0 1; \
+ visible: 1; \
+ color: GENLIST_PART_LIST_LINE_COLOR_INC; \
+ rel1 { \
+ relative: 0.0 1.0; \
+ offset: 0 -1; \
+ } \
+ } \
+}
+
+#define GENLIST_PART_PADDING_TOP( param_padding_size ) \
+part { \
+ name: "elm.padding.top"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 param_padding_size; \
+ fixed: 0 1; \
+ visible: 0; \
+ rel2.relative: 1.0 0.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_BOTTOM( param_padding_size ) \
+part { \
+ name: "elm.padding.bottom"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: 0 param_padding_size; \
+ fixed: 0 1; \
+ visible: 0; \
+ rel1.relative: 0.0 1.0; \
+ align: 0.0 1.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_LEFT( param_padding_size ) \
+part { \
+ name: "elm.padding.left"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel2.relative: 0.0 1.0; \
+ align: 0.0 0.0; \
+ } \
+}
+
+#define GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
+part { \
+ name: "elm.padding.right"; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: param_padding_size 0; \
+ fixed: 1 0; \
+ visible: 0; \
+ rel1.relative: 1.0 0.0; \
+ align: 1.0 0.0; \
+ } \
+}
+
+styles {
+ style {
+ name: "baseinfo_name_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen color=#000000 ellipsis=1.0 font_size=50";
+ }
+ style {
+ name: "baseinfo_subname_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen color=#727272 ellipsis=1.0 font_size=32";
+ }
+ style {
+ name: "activity_textblock_style";
+ base: "font=Tizen:style=Medium text_class=tizen color=#000000 ellipsis=0.0 font_size=32 wrap=char";
+ }
+}
+collections
+{
+ group {
+ name: "elm/genlist/item/baseinfo.1text.1icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.1text.1icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.1text.1icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.1text.1icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name";
+ data.item: "contents" "elm.icon.favorite";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(142)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 88 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 56 56;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.5; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 0.5; offset: -16 0; to: "elm.icon.image.rect"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.1text.2icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.1text.2icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.1text.2icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.1text.2icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name";
+ data.item: "contents" "elm.icon.image elm.icon.favorite";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(142)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 141 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 88 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "elm.icon.image.rect"; }
+ rel2 { relative: 0.0 1.0; to: "elm.icon.image.rect"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 56 56;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.5; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 0.5; offset: -16 0; to: "elm.icon.favorite.rect"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.2text.1icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.2text.1icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.2text.1icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.2text.1icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname";
+ data.item: "contents" "elm.icon.favorite";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(142)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 88 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 56 56;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 50.0/142.0; offset: 16 0; }
+ rel2 { relative: 0.0 50.0/142.0; offset: -16 0; to_x: "elm.icon.image.rect"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 101.0/142.0; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 101.0/142.0; offset: -16 0; to_x: "elm.icon.image.rect"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.2text.2icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.2text.2icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.2text.2icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.2text.2icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname";
+ data.item: "contents" "elm.icon.image elm.icon.favorite";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(142)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 141 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 88 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "elm.icon.image.rect"; }
+ rel2 { relative: 0.0 1.0; to: "elm.icon.image.rect"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 56 56;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 50.0/142.0; offset: 16 0; }
+ rel2 { relative: 0.0 50.0/142.0; offset: -16 0; to_x: "elm.icon.favorite.rect"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 101.0/142.0; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 101.0/142.0; offset: -16 0; to_x: "elm.icon.favorite.rect"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.3text.1icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.3text.1icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.3text.1icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.3text.1icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname elm.text.subname2";
+ data.item: "contents" "elm.icon.favorite";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(142)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 88 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 56 56;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 34.0/142.0; offset: 16 0; }
+ rel2 { relative: 0.0 34.0/142.0; offset: -16 0; to_x: "elm.icon.image.rect"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 79.0/142.0; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 79.0/142.0; offset: -16 0; to_x: "elm.icon.image.rect"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname2";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 117.0/142.0; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 117.0/142.0; offset: -16 0; to_x: "elm.icon.image.rect"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/baseinfo.3text.2icon/default";
+ alias: "elm/genlist/item_odd/baseinfo.3text.2icon/default";
+ alias: "elm/genlist/item_compress/baseinfo.3text.2icon/default";
+ alias: "elm/genlist/item_compress_odd/baseinfo.3text.2icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.name elm.text.subname elm.text.subname2";
+ data.item: "contents" "elm.icon.image elm.icon.favorite";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(142)
+ part {
+ name: "elm.icon.image.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 141 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.icon.image";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.icon.image.rect";
+ rel2.to: "elm.icon.image.rect";
+ }
+ }
+ part {
+ name: "elm.icon.favorite.rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 88 0;
+ fixed: 1 1;
+ align: 1.0 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; to: "elm.icon.image.rect"; }
+ rel2 { relative: 0.0 1.0; to: "elm.icon.image.rect"; }
+ }
+ }
+ part {
+ name: "elm.icon.favorite";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 56 56;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1.to: "elm.icon.favorite.rect";
+ rel2.to: "elm.icon.favorite.rect";
+ }
+ }
+ part {
+ name: "elm.text.name";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 34.0/142.0; offset: 16 0; }
+ rel2 { relative: 0.0 34.0/142.0; offset: -16 0; to_x: "elm.icon.favorite.rect"; }
+ text {
+ style: "baseinfo_name_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 79.0/142.0; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 79.0/142.0; offset: -16 0; to_x: "elm.icon.favorite.rect"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ part {
+ name: "elm.text.subname2";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 117.0/142.0; offset: 16 0; to: "base"; }
+ rel2 { relative: 0.0 117.0/142.0; offset: -16 0; to_x: "elm.icon.favorite.rect"; }
+ text {
+ style: "baseinfo_subname_textblock_style";
+ min: 0 1;
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/logdetail.title/default";
+ alias: "elm/genlist/item_odd/logdetail.title/default";
+ alias: "elm/genlist/item_compress/logdetail.title/default";
+ alias: "elm/genlist/item_compress_odd/logdetail.title/default";
+ data.item: "stacking" "above";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ parts {
+ GENLIST_BASEINFO_PART_BASE(77);
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: GENLIST_DIALOGUE_FONT_SUB_TITLE_COLOR_INC;
+ text {
+ font: "Tizen:style=Medium";
+ text_class: "tizen";
+ size: 28;
+ min: 0 1;
+ align: 0.0 1.0;
+ }
+ rel1 { offset: 10 0; }
+ rel2 { offset: -10 -10; }
+ }
+ }
+ }
+ }
+
+ group {
+ name: "elm/genlist/item/logdetail.3icon/default";
+ alias: "elm/genlist/item_odd/logdetail.3icon/default";
+ alias: "elm/genlist/item_compress/logdetail.3icon/default";
+ alias: "elm/genlist/item_compress_odd/logdetail.3icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "contents" "elm.icon.1 elm.icon.2 elm.icon.3";
+
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ repeat_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 200;
+ }
+ }
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min:0 138;
+ fixed: 0 1;
+ rel1.relative: 38/720 0.5;
+ rel2.relative: (38+138)/720 0.5;
+ align: 0.5 0.5;
+ }
+ }
+
+ part {
+ name: "elm.icon.2";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 138;
+ fixed: 0 1;
+ rel1.relative: (38+138+115)/720 0.5;
+ rel2.relative: (38+138+115+138)/720 0.5;
+ align: 0.5 0.5;
+ }
+ }
+
+ part {
+ name: "elm.icon.3";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 138;
+ fixed: 0 1;
+ rel1.relative: (38+138+115+138+115)/720 0.5;
+ rel2.relative: (38+138+115+138+115+138)/720 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ }
+
+ group {
+ name: "elm/genlist/item/history_list/default";
+ alias: "elm/genlist/item_odd/history_list/default";
+ alias: "elm/genlist/item_compress/history_list/default";
+ alias: "elm/genlist/item_compress_odd/history_list/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2 elm.text.3";
+ data.item: "contents" "elm.icon.1 elm.icon.2";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BASE(128)
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_TOP(10)
+ GENLIST_PART_PADDING_BOTTOM(10)
+ GENLIST_PART_PADDING_LEFT(16)
+ GENLIST_PART_PADDING_RIGHT(16)
+ part {
+ name: "elm.icon.1";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.right";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.icon.1";
+ }
+ rel2.to_x: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.icon.2";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.text.1";
+ }
+ align: 1.0 0.5;
+ }
+ }
+ part {
+ name: "elm.padding.icon2.left";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ to_x: "elm.icon.2";
+ }
+ rel2.to_x: "elm.icon.2";
+ align: 1.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text.1";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 60;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.icon2.left";
+ to_y: "elm.padding.top";
+ }
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ font: "Tizen:style=Roman";
+ size: 44;
+ min: 0 1;
+ align: 0.0 0.5;
+ text_class: "list_item";
+ }
+ }
+ }
+ part {
+ name: "elm.text.2";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.icon1.right";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.8 0.0;
+ to_x: "elm.text.1";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 0.5;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.text.3";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.text.2";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ offset: 5 0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 1.0 0.5;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/activity_list/default";
+ alias: "elm/genlist/item_odd/activity_list/default";
+ alias: "elm/genlist/item_compress/activity_list/default";
+ alias: "elm/genlist/item_compress_odd/activity_list/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2";
+ data.item: "contents" "elm.icon.1 elm.icon.2";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_TOP(10)
+ GENLIST_PART_PADDING_BOTTOM(10)
+ GENLIST_PART_PADDING_LEFT(16)
+ GENLIST_PART_PADDING_RIGHT(16)
+ part {
+ name: "elm.icon.1";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ align: 0.0 1.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.right";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.icon.1";
+ }
+ rel2.to_x: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.top";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 16;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ }
+ rel2.to_y: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.icon.2";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 321 321;
+ max: 321 321;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text.2";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.icon1.right";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 1.0;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.text.1";
+ clip_to: "disclip";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.icon.2";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.icon.2";
+ }
+ align: 0.0 0.0;
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ style: "activity_textblock_style";
+ min: 0 1;
+ align: 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/activity_list_no_img/default";
+ alias: "elm/genlist/item_odd/activity_list_no_img/default";
+ alias: "elm/genlist/item_compress/activity_list_no_img/default";
+ alias: "elm/genlist/item_compress_odd/activity_list_no_img/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text.1 elm.text.2";
+ data.item: "contents" "elm.icon.1";
+ data.item: "flips" "elm.flip.content";
+ parts {
+ GENLIST_PART_BOTTOM_LINE
+ GENLIST_PART_PADDING_TOP(10)
+ GENLIST_PART_PADDING_BOTTOM(10)
+ GENLIST_PART_PADDING_LEFT(16)
+ GENLIST_PART_PADDING_RIGHT(16)
+ part {
+ name: "elm.icon.1";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ align: 0.0 1.0;
+ }
+ }
+ part {
+ name: "elm.padding.icon1.right";
+ clip_to: "disclip";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "elm.icon.1";
+ }
+ rel2.to_x: "elm.icon.1";
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text.2";
+ clip_to: "disclip";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.icon1.right";
+ to_y: "elm.text.1";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ color: 68 68 68 255;
+ text {
+ font: "Tizen:style=Medium";
+ size: 32;
+ min: 0 1;
+ align: 0.0 1.0;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.text.1";
+ clip_to: "disclip";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "elm.padding.right";
+ to_y: "elm.icon.1";
+ }
+ color: GENLIST_PART_LIST_TEXT_DEFAULT;
+ text {
+ style: "activity_textblock_style";
+ min: 0 1;
+ align: 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+ group {
+ name: "elm/genlist/item/logdetail.5icon/default";
+ alias: "elm/genlist/item_odd/logdetail.5icon/default";
+ alias: "elm/genlist/item_compress/logdetail.5icon/default";
+ alias: "elm/genlist/item_compress_odd/logdetail.5icon/default";
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "contents" "elm.icon.1 elm.icon.2 elm.icon.3 elm.icon.4 elm.icon.5";
+
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ repeat_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 112;
+ }
+ }
+ part {
+ name: "elm.icon.1";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min:0 74;
+ fixed: 0 1;
+ rel1.relative: 0.021 0.5;
+ rel2.relative: 0.196 0.5;
+ align: 0.5 0.5;
+ }
+ }
+
+ part {
+ name: "elm.icon.2";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.218 0.5;
+ rel2.relative: 0.392 0.5;
+ align: 0.5 0.5;
+ }
+ }
+
+ part {
+ name: "elm.icon.3";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.414 0.5;
+ rel2.relative: 0.588 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ part {
+ name: "elm.icon.4";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.61 0.5;
+ rel2.relative: 0.783 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ part {
+ name: "elm.icon.5";
+ type: SWALLOW;
+ scale:1 ;
+ description {
+ state: "default" 0.0;
+ min: 0 74;
+ fixed: 0 1;
+ rel1.relative: 0.806 0.5;
+ rel2.relative: 0.979 0.5;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ }
+ group { name: "elm/button/base/logdetail.circle/empty";
+ alias: "elm/button/base/logdetail.circle/empty";
+ images {
+ image: PHUG_IMAGES"C01-4_circle_button.png" COMP;
+ image: PHUG_IMAGES"C01-4_circle_button_press.png" COMP;
+ }
+ parts {
+ part { name: "button_image";
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_CIRCLE_STYLE_BG_MIN_MAX_INC;
+ max: BUTTON_CIRCLE_STYLE_BG_MIN_MAX_INC;
+ fixed: 1 1;
+ image.normal: PHUG_IMAGES"C01-4_circle_button.png";
+ }
+ description { state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ image.normal: PHUG_IMAGES"C01-4_circle_button_press.png";
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: PHUG_IMAGES"C01-4_circle_button.png";
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ clip_to: "icon_clipper";
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_CIRCLE_STYLE_CONTENT_MIN_MAX_INC;
+ max: BUTTON_CIRCLE_STYLE_CONTENT_MIN_MAX_INC;
+ fixed: 1 1;
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "visible" 0.0;
+ }
+ }
+ part { name: "icon_clipper";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ color: 101 101 101 255;
+ }
+ description { state: "visible" 0.0;
+ color: 248 246 239 255;
+ }
+ description { state: "disabled" 0.0;
+ color: 101 101 101 76;
+ }
+ }
+ part { name: "over1";
+ type: RECT;
+ ignore_flags: ON_HOLD;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "over2";
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "disabler";
+ type: RECT;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program { name: "button_click";
+ signal: "mouse,down,1";
+ source: "over1";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ after: "button_click_anim";
+ }
+ program { name: "button_click_anim";
+ action: STATE_SET "clicked" 0.0;
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "touch_snd";
+ signal: "mouse,clicked,1";
+ source: "over1";
+// action: PLAY_SAMPLE "touch_sound" 1.0;
+ after: button_unclick2;
+ }
+ program { name: "button_unclick2";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program { name: "button_unclick";
+ signal: "mouse,up,1";
+ source: "over2";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ after: "button_unclick_anim";
+ }
+ program { name: "button_unclick_anim";
+ action: STATE_SET "default" 0.0;
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disabler";
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disabler";
+ target: "button_image";
+ target: "icon_clipper";
+ }
+ program { name: "icon_show";
+ signal: "elm,state,icon,visible";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "elm.swallow.content";
+ }
+ program { name: "icon_hide";
+ signal: "elm,state,icon,hidden";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.swallow.content";
+ }
+ }
+ }
+}
diff --git a/lib/edc/nocontent_layout.edc b/lib/edc/nocontent_layout.edc
new file mode 100755
index 0000000..84ad504
--- /dev/null
+++ b/lib/edc/nocontent_layout.edc
@@ -0,0 +1,109 @@
+/*
+* 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 IMAGE_PATH "../images/contact_images/"
+
+styles {
+ style {
+ name: "layout_textblock_style";
+ base: "font=Tizen:style=Regular text_class=tizen_medium font_size=32 color=#ffffff align=center wrap=mixed";
+ }
+}
+collections {
+ group {
+ images {
+ image: IMAGE_PATH"00_Nocontents_picture.png" COMP;
+ }
+ name: "nocontent_layout";
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "top.padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 0 1;
+ min: 0 215;
+ align: 0.5 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; }
+ rel2 { relative: 1.0 0.0; to: "base"; }
+ }
+ }
+ part {
+ name: "image";
+ type: IMAGE;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 280 280;
+ rel1 { relative: 0.0 1.0; to: "top.padding"; }
+ rel2 { relative: 1.0 1.0; to: "top.padding"; }
+ align: 0.5 0.5;
+ image {
+ normal: IMAGE_PATH"00_Nocontents_picture.png";
+ }
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ }
+ }
+ part {
+ name: "middle.padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 0 1;
+ min: 0 38;
+ align: 0.5 0.0;
+ rel1 { relative: 0.0 1.0; to: "image"; }
+ rel2 { relative: 1.0 1.0; to: "image"; }
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ min: 0 165;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1.0; to_x: "base"; to_y: "middle.padding"; }
+ rel2 { relative: 1.0 1.0; to_x: "base"; to_y: "middle.padding"; }
+ color: 128 128 128 255;
+ text {
+ min: 0 0;
+ max: 0 1;
+ style: "layout_textblock_style";
+ align: 0.5 0.5;
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/lib/edc/progress.edc b/lib/edc/progress.edc
new file mode 100755
index 0000000..bf1de45
--- /dev/null
+++ b/lib/edc/progress.edc
@@ -0,0 +1,192 @@
+/*
+ * 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.
+ */
+
+
+collections {
+ group { name: "popup_center_text_progressview";
+ parts{
+ part {
+ name: "pad_t";
+ scale : 1;
+ mouse_events: 0;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ min: 0 0;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "pad_l";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ }
+ }
+ }
+ part {
+ name: "pad_l";
+ scale: 1;
+ description { state: "default" 0.0;
+ min : 0 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part { name: "pad_r";
+ scale: 1;
+ description { state: "default" 0.0;
+ min : 0 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part{ name:"elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 648 0;
+ align: 0.5 0.5;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to: "pad_t";
+ }
+ rel2 {
+ relative: 0.5 0.0;
+ to: "pad_b";
+ }
+ }
+ }
+ part { name: "pad_b";
+ scale : 1;
+ mouse_events: 0;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ align: 0.5 1.0;
+ min: 0 90;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "pad_l";
+ to_y: "pad_bm";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_bm";
+ }
+ }
+ }
+ part { name: "elm.swallow.end";
+ type: SWALLOW;
+ scale : 1;
+ mouse_events: 1;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ align: 0.5 0.5;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "pad_b";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "pad_b";
+ }
+ }
+ }
+ part { name: "pad_bm";
+
+ scale : 1;
+ mouse_events: 0;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 0;
+ fixed: 0 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_x: "pad_l";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_x: "pad_r";
+ }
+ }
+ }
+ part { name: "elm.text.subtext1";
+ type: TEXT;
+ scale : 1;
+ description { state: "default" 0.0;
+ text {
+ font: "Tizen:style=Medium";
+ size: 30;
+ min: 0 0;
+ align: 0.0 0.5;
+ text_class: "tizen";
+ }
+ color: 128 128 128 255;
+ align: 0.0 0.5;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "pad_bm";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "pad_bm";
+ }
+ }
+ }
+ part { name: "elm.text.subtext2";
+ type: TEXT;
+ scale : 1;
+ description { state: "default" 0.0;
+ text {
+ font: "Tizen:style=Medium";
+ size: 30;
+ min: 0 0;
+ align: 1.0 0.5;
+ text_class: "tizen";
+ }
+ color: 128 128 128 255;
+ align: 1.0 0.5;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "pad_bm";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "pad_bm";
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/lib/edc/selectioninfo.edc b/lib/edc/selectioninfo.edc
new file mode 100755
index 0000000..5b275b2
--- /dev/null
+++ b/lib/edc/selectioninfo.edc
@@ -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.
+*/
+
+
+collections {
+ group {
+ name: "selectioninfo_layout";
+ parts {
+ part {
+ name: "contents";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ }
+ }
+ part {
+ name: "selectioninfo";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ fixed: 0 1;
+ align: 0.5 1.0;
+ rel1 {
+ relative: 0.0 1.0;
+ to:"contents";
+ }
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "show";
+ signal: "show,selection,info";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "selectioninfo";
+ }
+ program {
+ name: "hide";
+ signal: "hide,selection,info";
+ source: "elm";
+ action: STATE_SET "hide" 0.0;
+ target: "selectioninfo";
+ }
+ }
+ }
+}
diff --git a/lib/edc/speeddial_theme.edc b/lib/edc/speeddial_theme.edc
new file mode 100755
index 0000000..e6fb8e0
--- /dev/null
+++ b/lib/edc/speeddial_theme.edc
@@ -0,0 +1,157 @@
+/*
+* 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 WIDTH 720
+#define MIN_SIZE (WIDTH/3)
+#define MAX_SIZE (217)
+
+collections {
+ group{
+ name: "elm/gengrid/item/gridtext_speeddial/default";
+ data.item: "texts" "elm.text elm.text.number";
+ data.item: "contents" "elm.swallow.icon elm.swallow.check.icon";
+
+ parts{
+ part{
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ part {
+ name: "icon_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: MAX_SIZE MAX_SIZE;
+ fixed: 1 1;
+ visible: 1;
+// color: 51 51 51 200;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ }
+ }
+ part {
+ name: "elm.swallow.icon.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ color: 190 189 189 255;
+ rel1 { relative: 0.0 0.0; to: "icon_bg"; }
+ rel2 { relative: 1.0 1.0; offset: 0 0; to: "icon_bg"; }
+ }
+ }
+ part{
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "elm.swallow.icon.bg"; }
+ rel2 { relative: 1.0 1.0; to: "elm.swallow.icon.bg"; }
+ }
+ }
+ part {
+ name: "label_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: MAX_SIZE 37;
+ fixed: 1 1;
+ align: 0.0 1.0;
+ visible: 1;
+ color: 0 0 0 77;
+ rel1 { relative: 0.0 1.0; offset: 0 0; to: "elm.swallow.icon.bg"; }
+ rel2 { relative: 1.0 1.0; offset: 0 0; to: "elm.swallow.icon.bg"; }
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "label_bg"; }
+ rel2 { relative: 1.0 1.0; to: "label_bg"; }
+ color: 255 255 255 255;
+ color2: 0 0 0 185;
+ color3: 0 0 0 185;
+ text {
+ font: "Tizen:style=Medium";
+ text_class: "tizen";
+ size: 26;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "number_label_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 40 40;
+ fixed: 1 1;
+ align: 1.0 0.0;
+ visible: 0;
+ rel1 { relative: 1.0 0.0; offset: -8 +5; to: "elm.swallow.icon.bg"; }
+ rel2 { relative: 1.0 0.0; offset: -8 +5; to: "elm.swallow.icon.bg"; }
+ }
+ }
+ part {
+ name: "elm.text.number";
+ type: TEXT;
+ effect: SHADOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 { relative: 0.0 0.0; to: "number_label_bg"; }
+ rel2 { relative: 1.0 1.0; to: "number_label_bg"; }
+ color: 255 255 255 255;
+ color2: 0 0 0 185;
+ color3: 0 0 0 185;
+ text {
+ font: "Tizen:style=Medium";
+ text_class: "tizen";
+ size: 40;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "elm.swallow.check.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 { relative: 0.0 0.0; to: "elm.swallow.icon";}
+ rel2 { relative: 1.0 1.0; to: "elm.swallow.icon";}
+ }
+ }
+ }
+ }
+}
diff --git a/lib/favor/CMakeLists.txt b/lib/favor/CMakeLists.txt
new file mode 100755
index 0000000..5bfec25
--- /dev/null
+++ b/lib/favor/CMakeLists.txt
@@ -0,0 +1,9 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+FILE(GLOB FAVOR_SRCS *.c)
+
+ADD_LIBRARY(${FAVOR_LIB} STATIC ${FAVOR_SRCS})
+SET_TARGET_PROPERTIES(${FAVOR_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
+TARGET_LINK_LIBRARIES(${FAVOR_LIB} ${COMMON_LIB} ${ug_pkgs_LDFLAGS} ${CT_DETAILS} ${CT_LIST})
+ADD_DEPENDENCIES(${FAVOR_LIB} favorites_theme_build)
+ADD_DEPENDENCIES(${TARGET} favorites_theme_build contact_button_edj_build)
diff --git a/lib/favor/include/ct-favor.h b/lib/favor/include/ct-favor.h
new file mode 100755
index 0000000..e9e6f12
--- /dev/null
+++ b/lib/favor/include/ct-favor.h
@@ -0,0 +1,80 @@
+/*
+* 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_FAVOR_H__
+#define __CT_FAVOR_H__
+
+#include "phone-common.h"
+
+
+enum {
+ PH_FAVOR_MODE_DEFAULT,
+ PH_FAVOR_MODE_EDIT,
+};
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *mf_layout;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *box;
+ Evas_Object *favor_gengrid;
+ Evas_Object *mf_gengrid;
+ Evas_Object *popup;
+ Evas_Object *ctx_popup;
+ Elm_Theme *th;
+ Elm_Object_Item *navi_item;
+ Evas_Object *navi_button;
+ Eina_List *favor_list;
+ Eina_List *mf_list;
+ Eina_Bool longpressed;
+ Ecore_Timer *update_timer_contact;
+ Ecore_Timer *update_timer_favor;
+ Ecore_Timer *update_timer_log;
+ int list_mode;
+ int selected_person_id;
+ int checked_cnt;
+ int favor_list_count;
+ int mf_list_count;
+ int readed_n;
+ int version;
+ int ug_request;
+ int ug_cnt_max;
+ int touch_x;
+ int touch_y;
+ int mfc_option;
+ bool is_background;
+ bool is_mf_changed;
+ bool favor_move;
+ bool updating;
+ char *ug_data;
+ Ecore_Idler *list_idler;
+ void *ug;
+ void *child_ug;
+ ph_progress_info *p_info;
+}ph_favorite_data;
+
+Evas_Object* phone_favor_create_view(ph_view_info *view_info);
+void phone_favor_set_navi(Evas_Object *base, int mode);
+void phone_favor_view_reset(Evas_Object *base);
+void phone_favor_view_language_changed(Evas_Object *base);
+void phone_favor_set_background(Evas_Object *obj, bool is_background);
+void phone_favor_edit_mode_start(ph_favorite_data *favor_d);
+
+#endif /* __CT_FAVOR_H__ */
+
diff --git a/lib/favor/ph-favorite-edit-view.c b/lib/favor/ph-favorite-edit-view.c
new file mode 100755
index 0000000..ed7126b
--- /dev/null
+++ b/lib/favor/ph-favorite-edit-view.c
@@ -0,0 +1,430 @@
+/*
+* 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 "ct-favor.h"
+#include "ph-favorite-view.h"
+#include "ph-favorite-edit-view.h"
+#include "ct-list.h"
+
+static void favor_edit_del(ph_favorite_data *favor_d);
+
+static void favor_edit_del_cb(int err, void *data)
+{
+ ph_favorite_data *favor_d = data;
+ ph_progress_info *p_info = NULL;
+
+ p_retm_if(NULL == favor_d, "Invalid parameter(favor_d is NULL)");
+ p_info = favor_d->p_info;
+ p_retm_if(NULL == p_info, "Invalid parameter(p_info is NULL)");
+
+ if (p_info->update_list) {
+ contacts_list_destroy(p_info->update_list, true);
+ p_info->update_list = 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);
+ favor_d->p_info = NULL;
+ favor_d->updating = false;
+ ph_favor_data_lazy_update(_contacts_person._uri, favor_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);
+ favor_d->p_info = NULL;
+ favor_d->updating = false;
+ ph_favor_edit_mode_end(favor_d, true);
+ ph_favor_data_lazy_update(_contacts_person._uri, favor_d);
+ return;
+ }
+ else {
+ favor_edit_del(favor_d);
+ }
+}
+
+static void favor_edit_del(ph_favorite_data *favor_d)
+{
+ const int FAVOR_BULK_LENGTH = 50;
+ char percent_total[PH_TEXT_MAX_LEN+1] = {0, };
+ char percent[PH_TEXT_MAX_LEN+1] = {0, };
+ int count = 0;
+ int base_count = 0;
+ double value = 0.0;
+
+ Eina_List *l = NULL;
+ ph_favor_info *f_info = NULL;
+ ph_progress_info *p_info = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_list_h list = NULL;
+
+ p_retm_if(NULL == favor_d, "parameter(favor_d) is NULL");
+ p_info = favor_d->p_info;
+ p_retm_if(NULL == p_info, "parameter(p_info) is NULL");
+
+ err = contacts_list_create(&list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_create() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ if (NULL == f_info) continue;
+
+ if (TRUE == f_info->checked) {
+ if (base_count < p_info->cnt) {
+ base_count++;
+ continue;
+ }
+
+ if (CONTACTS_ERROR_NONE != contacts_db_get_record(_contacts_person._uri, f_info->person_id, &record)) {
+ ERR("contacts_db_get_record() Failed()");
+ p_info->completed = true;
+ p_info->result = FALSE;
+ break;
+ }
+ err = contacts_record_set_bool(record, _contacts_person.is_favorite, false);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_ercord_set_bool() Failed(%d)", err);
+
+ contacts_list_add(list, record);
+ count++;
+ if (FAVOR_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_list = list;
+ contacts_db_update_records_async(list, favor_edit_del_cb, favor_d);
+}
+
+void ph_favor_edit_del_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ ph_progress_info *p_info;
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc return NULL");
+
+ favor_d->p_info = p_info;
+ favor_d->updating = true;
+ p_info->cnt_checked_total = favor_d->checked_cnt;
+ p_info->alive = true;
+ p_info->popup = phone_progressbar_popup(favor_d->win, p_info, T_(PH_GET_TEXT_BASIC, PHTEXT_DELETING_FAVORITES));
+ favor_edit_del(favor_d);
+}
+
+void ph_favor_edit_check_for_number(Elm_Object_Item *item, ph_favorite_data *favor_d)
+{
+ ph_favor_info *f_info;
+ Evas_Object *list_nums;
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ if (NULL == f_info->number_list) {
+ ERR("f_info->number_list is NULL");
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_NUMBER), 1.5);
+
+ f_info->checked = EINA_FALSE;
+ favor_d->checked_cnt--;
+
+ elm_gengrid_item_update(item);
+ return;
+ }
+
+ if (1 == eina_list_count(f_info->number_list)) {
+ record = (contacts_record_h)f_info->number_list->data;
+ f_info->id_ret_type = 1;
+ err = contacts_record_get_int(record, _contacts_number.id, &f_info->id_ret);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ ph_favor_edit_set_selection_info(favor_d);
+ }
+ else {
+ list_nums = ph_favor_create_value_list_popup(favor_d, f_info);
+ p_retm_if(NULL == list_nums, "ph_favor_create_value_list_popup() return NULL");
+ evas_object_data_set(list_nums, "item", item);
+ }
+}
+
+void ph_favor_edit_check_for_email(Elm_Object_Item *item, ph_favorite_data *favor_d)
+{
+ Evas_Object *list_emails;
+ ph_favor_info *f_info;
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ if (NULL == f_info->email_list) {
+ ERR("f_info->number_list is NULL");
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+
+ f_info->checked = EINA_FALSE;
+ favor_d->checked_cnt--;
+
+ elm_gengrid_item_update(item);
+ return;
+ }
+
+ if (1 == eina_list_count(f_info->email_list)) {
+ record = (contacts_record_h)f_info->email_list->data;
+ f_info->id_ret_type = 2;
+ err = contacts_record_get_int(record, _contacts_email.id, &f_info->id_ret);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ ph_favor_edit_set_selection_info(favor_d);
+ }
+ else {
+ list_emails = ph_favor_create_value_list_popup(favor_d, f_info);
+ p_retm_if(NULL == list_emails, "ph_favor_create_value_list_popup() return NULL");
+ evas_object_data_set(list_emails, "item", item);
+ }
+}
+
+void ph_favor_edit_check_for_number_or_email(Elm_Object_Item *item, ph_favorite_data *favor_d)
+{
+ int number_list_count = 0;
+ int email_list_count = 0;
+ Eina_List *list_contact;
+ Evas_Object *list;
+ ph_favor_info *f_info;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ list_contact = ctui_person_get_contact_list(f_info->person_id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if (NULL == f_info->email_list)
+ f_info->email_list = ctui_person_get_email_list(list_contact);
+ if (NULL == f_info->number_list)
+ f_info->number_list = ctui_person_get_number_list(list_contact);
+
+ if (f_info->number_list)
+ number_list_count = eina_list_count(f_info->number_list);
+ if (f_info->email_list)
+ email_list_count = eina_list_count(f_info->email_list);
+
+ if (0 == number_list_count && 0 == email_list_count) {
+ ctui_free_record_list(list_contact);
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+ f_info->checked = EINA_FALSE;
+ favor_d->checked_cnt--;
+ elm_genlist_item_update(item);
+ return;
+ }
+
+ if (1 == number_list_count && 0 == email_list_count) {
+ record = (contacts_record_h)f_info->number_list->data;
+ err = contacts_record_get_int(record, _contacts_number.id, &(f_info->id_ret));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ f_info->id_ret_type = 1;
+ ph_favor_edit_set_selection_info(favor_d);
+ }
+ else if (0 == number_list_count && 1 == email_list_count) {
+ record = (contacts_record_h)f_info->email_list->data;
+ err = contacts_record_get_int(record, _contacts_email.id, &(f_info->id_ret));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ f_info->id_ret_type = 2;
+ ph_favor_edit_set_selection_info(favor_d);
+ }
+ else {
+ list = ph_favor_create_value_list_popup(favor_d, f_info);
+ if (list)
+ evas_object_data_set(list, "item", item);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+
+void ph_favor_edit_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = evas_object_data_get(obj, "favor_d");
+ Elm_Object_Item *item;
+ Eina_Bool checked = elm_check_state_get(obj);
+
+ ph_favor_info *f_info = data;
+ p_retm_if(NULL == f_info, "favor info is NULL");
+ item = f_info->item;
+
+ if (favor_d->longpressed) {
+ checked = !checked;
+ elm_check_state_set(obj, checked);
+ favor_d->longpressed = EINA_FALSE;
+ return;
+ }
+
+ if (checked) {
+ if (favor_d->ug_cnt_max) {
+ if (favor_d->ug_cnt_max <= favor_d->checked_cnt) {
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_EXCEED_LIMIT), 2.0);
+ checked = !checked;
+ elm_check_state_set(obj, checked);
+ return;
+ }
+ }
+ favor_d->checked_cnt++;
+ }
+ else {
+ favor_d->checked_cnt--;
+ ph_favor_edit_set_selection_info(favor_d);
+ return;
+ }
+
+ if (PH_UG_REQUEST_CHECK_FOR_NUMBER == favor_d->ug_request)
+ ph_favor_edit_check_for_number(item, favor_d);
+ else if (PH_UG_REQUEST_CHECK_FOR_EMAIL== favor_d->ug_request)
+ ph_favor_edit_check_for_email(item, favor_d);
+ else if (PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == favor_d->ug_request)
+ ph_favor_edit_check_for_number_or_email(item, favor_d);
+ else
+ ph_favor_edit_set_selection_info(favor_d);
+}
+
+void ph_favor_edit_set_selection_info(ph_favorite_data * favor_d)
+{
+ p_retm_if(NULL == favor_d, "Selection info is null");
+
+ if (0 == favor_d->checked_cnt)
+ phone_show_notify(favor_d->layout, T_(CT_GET_TEXT_BASIC, CTTEXT_SELECT_CONTACTS));
+ else {
+ char info_text[PH_TEXT_SHORT_LEN]={0};
+
+ if (favor_d->ug_cnt_max)
+ snprintf(info_text, sizeof(info_text), "%s (%d/%d)", S_(PH_SYS_POP_SELECTED),
+ favor_d->checked_cnt, favor_d->ug_cnt_max);
+ else
+ snprintf(info_text, sizeof(info_text), "%s (%d)", S_(PH_SYS_POP_SELECTED),
+ favor_d->checked_cnt);
+ phone_show_notify(favor_d->layout, info_text);
+ }
+
+ ph_favor_update_button_status(favor_d);
+}
+
+static void favor_gengrid_realized(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favor_info *f_info;
+ Elm_Object_Item *it = event_info;
+ ph_favorite_data *favor_d = data;
+ f_info = elm_object_item_data_get(it);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ if (favor_d->list_mode == PH_FAVOR_MODE_EDIT)
+ elm_object_item_signal_emit(f_info->item, "favorites_theme/edit_no_effect", "favorites_theme");
+}
+
+API void phone_favor_edit_mode_start(ph_favorite_data *favor_d)
+{
+ PH_FN_CALL;
+ Eina_List *list;
+ Eina_List *cursor;
+ Elm_Object_Item *it;
+ ph_favor_info *f_info;
+ p_retm_if(NULL == favor_d, "Favorite data is null");
+ favor_d->list_mode = PH_FAVOR_MODE_EDIT;
+ phone_favor_set_navi(favor_d->layout, PH_FAVOR_MODE_EDIT);
+ if(favor_d->favor_list)
+ phone_show_notify(favor_d->layout, T_(CT_GET_TEXT_BASIC, CTTEXT_SELECT_CONTACTS));
+ elm_gengrid_reorder_mode_set(favor_d->favor_gengrid, EINA_TRUE);
+ elm_gengrid_clear(favor_d->favor_gengrid);
+ ph_favor_fill_favor_gengrid(favor_d);
+
+ evas_object_smart_callback_add(favor_d->favor_gengrid, "realized", favor_gengrid_realized, favor_d);
+ list = elm_gengrid_realized_items_get(favor_d->favor_gengrid);
+ EINA_LIST_FOREACH(list, cursor, it) {
+ f_info = elm_object_item_data_get(it);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+ elm_object_item_signal_emit(f_info->item, "favorites_theme/edit", "favorites_theme");
+ }
+}
+
+static void favor_all_item_check_false(Eina_List *list)
+{
+ Eina_List *l;
+ ph_favor_info *f_info;
+ p_retm_if(NULL == list, "List is null");
+
+ EINA_LIST_FOREACH(list, l, f_info) {
+ if (NULL == f_info)
+ continue;
+
+ if (EINA_TRUE == f_info->checked)
+ f_info->checked = EINA_FALSE;
+ }
+}
+
+void ph_favor_edit_mode_end(ph_favorite_data *favor_d, bool redraw)
+{
+ Evas_Object *bg;
+ Evas_Object *layout;
+
+ favor_d->list_mode = PH_FAVOR_MODE_DEFAULT;
+
+ layout = elm_object_part_content_get(favor_d->layout, "contents");
+ bg = elm_object_part_content_unset(layout, "elm.swallow.bg");
+ if (bg)
+ evas_object_del(bg);
+
+ phone_hide_notify(favor_d->layout);
+
+ if (favor_d->checked_cnt)
+ favor_d->checked_cnt = 0;
+
+ if (favor_d->favor_gengrid) {
+ elm_gengrid_clear(favor_d->favor_gengrid);
+ if (true == favor_d->favor_move)
+ ph_favor_load_favor_list(favor_d);
+
+ ph_favor_fill_favor_gengrid(favor_d);
+ if (0 == ctui_get_mfc_option()) {
+ ph_favor_load_mf_list(favor_d);
+ ph_favor_fill_mf_gengrid(favor_d);
+ }
+ }
+ favor_all_item_check_false(favor_d->favor_list);
+ elm_gengrid_reorder_mode_set(favor_d->favor_gengrid, EINA_FALSE);
+ if (redraw)
+ phone_favor_set_navi(favor_d->layout, PH_FAVOR_MODE_DEFAULT);
+}
+
+void ph_favor_edit_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ ph_favor_edit_mode_end(favor_d, true);
+}
diff --git a/lib/favor/ph-favorite-edit-view.h b/lib/favor/ph-favorite-edit-view.h
new file mode 100755
index 0000000..12f0606
--- /dev/null
+++ b/lib/favor/ph-favorite-edit-view.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 __PH_FAVORITE_EDIT_H__
+#define __PH_FAVORITE_EDIT_H__
+
+void ph_favor_edit_mode_end(ph_favorite_data *favor_d, bool redraw);
+void ph_favor_edit_set_selection_info(ph_favorite_data *favor_d);
+void ph_favor_edit_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
+void ph_frequent_edit_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
+void ph_favor_edit_del_btn_cb(void *data, Evas_Object *obj, void *event_info);
+void ph_favor_edit_cancel_cb(void *data, Evas_Object *obj, void *event_info);
+void ph_favor_edit_check_for_number(Elm_Object_Item *item, ph_favorite_data *favor_d);
+void ph_favor_edit_check_for_email(Elm_Object_Item *item, ph_favorite_data *favor_d);
+void ph_favor_edit_check_for_number_or_email(Elm_Object_Item *item, ph_favorite_data *favor_d);
+
+#endif /* __PH_FAVORITE_EDIT_H__ */
diff --git a/lib/favor/ph-favorite-view.c b/lib/favor/ph-favorite-view.c
new file mode 100755
index 0000000..e380894
--- /dev/null
+++ b/lib/favor/ph-favorite-view.c
@@ -0,0 +1,2180 @@
+/*
+* 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 <Ecore_X.h>
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-common.h"
+
+#include "ct-favor.h"
+#include "ct-list.h"
+#include "ct-detail.h"
+#include "ph-favorite-view.h"
+#include "ph-favorite-edit-view.h"
+
+#define KEY_FAVOR_DATA "favor_d"
+#define PH_FAVOR_LIST_ICON_SIZE 70
+
+static Elm_Gengrid_Item_Class grid_itc_favor, grid_itc_favor_no_id, grid_itc_mf, grid_itc_mf_no_id, grid_itc_index, grid_itc_mf_index;
+
+enum favor_item_type {
+ FAVOR_ITEM_MFC = 0,
+ FAVOR_ITEM_FAVOR,
+};
+
+
+static char* favor_get_contact_number(int person_id)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ char *number;
+
+ err = contacts_db_get_record( _contacts_person_number._uri, person_id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record(%d) Failed(%d)", person_id, err);
+
+ err = contacts_record_get_str(record, _contacts_person_number.number, &number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ return number;
+}
+
+static contacts_filter_h favor_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;
+}
+
+static void favor_load_favorite_data(ph_favorite_data *favor_d)
+{
+ int count = 0;
+ int ret = 0;
+ Eina_List *list = NULL;
+ contacts_list_h person_list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+ contacts_filter_h filter2 = NULL;
+ contacts_query_h query = NULL;
+
+ err = contacts_query_create(_contacts_person._uri, &query);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ switch (favor_d->ug_request) {
+ //case PH_UG_REQUEST_SELECT_NUMBER:
+ //case PH_UG_REQUEST_CHECK_FOR_NUMBER:
+ case CT_UG_REQUEST_SELECT_NUMBER:
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER:
+ do {
+ filter = favor_create_filter_bool(filter, _contacts_person._uri, _contacts_person.is_favorite, CONTACTS_MATCH_EQUAL, true);
+ filter = favor_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_sort(query, _contacts_person.favorite_priority, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &person_list))) break;
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+
+ break;
+ //case PH_UG_REQUEST_SELECT_EMAIL:
+ //case PH_UG_REQUEST_CHECK_FOR_EMAIL:
+ case CT_UG_REQUEST_SELECT_EMAIL:
+ case CT_UG_REQUEST_CHECK_FOR_EMAIL:
+ do {
+ filter = favor_create_filter_bool(filter, _contacts_person._uri, _contacts_person.is_favorite, CONTACTS_MATCH_EQUAL, true);
+ filter = favor_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_sort(query, _contacts_person.favorite_priority, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &person_list))) break;
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+
+ break;
+
+ case CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL:
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ do {
+ filter = favor_create_filter_bool(filter, _contacts_person._uri, _contacts_person.is_favorite, CONTACTS_MATCH_EQUAL, true);
+ filter2 = favor_create_filter_bool(NULL, _contacts_person._uri, _contacts_person.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.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_sort(query, _contacts_person.favorite_priority, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &person_list))) break;
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ contacts_filter_destroy(filter2);
+
+ break;
+ default :
+ do {
+ filter = favor_create_filter_bool(filter, _contacts_person._uri, _contacts_person.is_favorite, CONTACTS_MATCH_EQUAL, true);
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_sort(query, _contacts_person.favorite_priority, true))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &person_list))) break;
+ } while (0);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+
+ break;
+ }
+ if (CONTACTS_ERROR_NONE != ret) {
+ ERR("contacts_db_get_records_with_query() Failed(%d)");
+ favor_d->favor_list_count = 0;
+ return;
+ }
+
+ contacts_db_get_current_version(&favor_d->version);
+
+ while (CONTACTS_ERROR_NONE == err) {
+ ph_favor_info *f_info;
+ f_info = calloc(1, sizeof(ph_favor_info));
+
+ err = phone_cts_get_int_from_list(person_list, _contacts_person.id, &f_info->person_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ err = phone_cts_get_str_from_list(person_list, _contacts_person.display_name, &f_info->display);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ SAFE_STRDUP(f_info->display);
+ err = phone_cts_get_str_from_list(person_list, _contacts_person.image_thumbnail_path, &f_info->img_path);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ SAFE_STRDUP(f_info->img_path);
+
+ if (CT_UG_REQUEST_SELECT_NUMBER == favor_d->ug_request ||CT_UG_REQUEST_CHECK_FOR_NUMBER == favor_d->ug_request) {
+ f_info->contact_list = ctui_person_get_contact_list(f_info->person_id);
+ p_warn_if(NULL == f_info->contact_list, "ctui_person_get_contact_list() return NULL");
+
+ f_info->number_list= ctui_person_get_number_list(f_info->contact_list);
+ p_warn_if(NULL == f_info->number_list, "ctui_person_get_contact_list() return NULL");
+ }
+ else if (CT_UG_REQUEST_SELECT_EMAIL == favor_d->ug_request || CT_UG_REQUEST_CHECK_FOR_EMAIL == favor_d->ug_request) {
+ f_info->contact_list = ctui_person_get_contact_list(f_info->person_id);
+ p_warn_if(NULL == f_info->contact_list, "ctui_person_get_contact_list() return NULL");
+
+ f_info->email_list= ctui_person_get_email_list(f_info->contact_list);
+ p_warn_if(NULL == f_info->email_list, "ctui_person_get_contact_list() return NULL");
+
+ }
+ else if (CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL == favor_d->ug_request || CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == favor_d->ug_request) {
+ f_info->contact_list = ctui_person_get_contact_list(f_info->person_id);
+ p_warn_if(NULL == f_info->contact_list, "ctui_person_get_contact_list() return NULL");
+
+ f_info->email_list= ctui_person_get_email_list(f_info->contact_list);
+ p_warn_if(NULL == f_info->email_list, "ctui_person_get_contact_list() return NULL");
+
+ f_info->number_list= ctui_person_get_number_list(f_info->contact_list);
+ p_warn_if(NULL == f_info->number_list, "ctui_person_get_contact_list() return NULL");
+ }
+
+ list = eina_list_append(list, (void*)f_info);
+ count++;
+ err = contacts_list_next(person_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ err = contacts_list_destroy(person_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+
+ favor_d->favor_list_count = count;
+ favor_d->favor_list = list;
+}
+
+static void favor_free_data(Eina_List *list)
+{
+ Eina_List *l;
+ ph_favor_info *f_info;
+ p_retm_if(NULL == list, "List is null");
+
+ EINA_LIST_FOREACH(list, l, f_info) {
+ if (NULL == f_info)
+ continue;
+ free(f_info->display);
+ free(f_info->img_path);
+ free(f_info->number);
+ if (f_info->contact_list)
+ ctui_free_record_list(f_info->contact_list);
+
+ if (f_info->number_list)
+ ctui_free_record_list(f_info->number_list);
+
+ if (f_info->email_list)
+ ctui_free_record_list(f_info->email_list);
+ free(f_info);
+ }
+ eina_list_free(list);
+}
+
+static void favor_destroy_child_ug(void *data)
+{
+ ph_favorite_data *favor_d = data;
+ favor_d->child_ug = NULL;
+}
+
+static void favor_ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon;
+ Evas_Object *btn;
+ ph_favorite_data *favor_d = data;
+ btn = evas_object_data_get(obj, "expand_btn");
+ icon = elm_object_part_content_get(btn, "icon");
+ elm_icon_file_set(icon, CTUI_IMG_ICON_EXPAND_OPENED, NULL);
+ elm_object_part_content_set(btn, "icon", icon);
+ evas_object_del(favor_d->ctx_popup);
+ favor_d->ctx_popup = NULL;
+}
+
+static void favor_ctxpopup_hide_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon;
+ Evas_Object *btn;
+ btn = (Evas_Object *)data;
+ icon = elm_object_part_content_get(btn, "icon");
+ elm_icon_file_set(icon, CTUI_IMG_ICON_EXPAND_OPENED, NULL);
+ elm_object_part_content_set(btn, "icon", icon);
+}
+
+static void favor_msg_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favor_info *f_info;
+ ph_favorite_data *favor_d = data;
+
+ f_info = evas_object_data_get(obj, "f_info");
+ p_retm_if(NULL == f_info, "evas_object_data_get() return NULL");
+
+ favor_ctxpopup_dismissed_cb(favor_d, favor_d->ctx_popup, NULL);
+
+ favor_d->child_ug = phone_launch_msg_composer_ug(favor_d->ug, f_info->number, 0,
+ favor_destroy_child_ug, favor_d);
+}
+
+static void favor_call_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favor_info *f_info;
+ ph_favorite_data *favor_d = data;
+
+ f_info = evas_object_data_get(obj, "f_info");
+ p_retm_if(NULL == f_info, "evas_object_data_get() return NULL");
+
+ favor_ctxpopup_dismissed_cb(favor_d, favor_d->ctx_popup, NULL);
+ phone_launch_voice_call(f_info->person_id, f_info->number);
+}
+
+void ph_favor_load_favor_list(ph_favorite_data *favor_d)
+{
+ p_retm_if(NULL == favor_d, "Parameter is null");
+
+ favor_free_data(favor_d->favor_list);
+ favor_d->favor_list = NULL;
+ favor_load_favorite_data(favor_d);
+}
+
+static void favor_img_crop_result(ui_gadget_h ug, service_h service, void *data)
+{
+ PH_FN_CALL;
+ Eina_List *list_writable_contact;
+ ph_favorite_data *favor_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ char *normal = NULL;
+ char *full = NULL;
+ Eina_List *l;
+ contacts_record_h record = NULL;
+ contacts_record_h record_image = NULL;
+
+ service_get_extra_data(service, "crop_image_path", &normal);
+ p_retm_if(NULL == normal, "return value is NULL.");
+ service_get_extra_data(service, "image_path", &full);
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ list_writable_contact = NULL;
+ list_writable_contact = ctui_person_get_writable_contact_list(favor_d->selected_person_id);
+
+ if (list_writable_contact) {
+ EINA_LIST_FOREACH(list_writable_contact, l, data) {
+ record = (contacts_record_h)data;
+ if (NULL == record) continue;
+
+ record_image = ctui_get_record_image(record);
+ if (NULL == record_image) {
+ ERR("ctui_get_record_image() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_set_str(record_image, _contacts_image.path, normal);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_db_update_record(record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ ctui_create_contacts_error_popup(favor_d->navi, err);
+ }
+ ctui_free_record_list(list_writable_contact);
+ }
+
+ free(normal);
+ free(full);
+ }
+}
+
+static void favor_popup_response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ if (PH_UG_REQUEST_SET_WITH_RINGTONE == favor_d->ug_request)
+ ug_destroy_me(favor_d->ug);
+}
+
+static void favor_value_list_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d;
+ Elm_Object_Item *item;
+ ph_favor_info *f_info;
+
+ favor_d = evas_object_data_get(data, "favor_d");
+ p_retm_if(NULL == favor_d, "evas_object_data_get() return NULL");
+
+ evas_object_del(favor_d->popup);
+ favor_d->popup = NULL;
+
+ if (NULL!= obj) {
+ item = evas_object_data_get(data, "item");
+ p_retm_if(NULL == item, "evas_object_data_get() return NULL");
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ f_info->checked = EINA_FALSE;
+ favor_d->checked_cnt--;
+ elm_genlist_item_update(item);
+ }
+}
+
+static void favor_del_response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_favor_info *f_info = data;
+ ph_favorite_data *favor_d;
+ contacts_record_h record = NULL;
+
+ favor_d = evas_object_data_get(obj, KEY_FAVOR_DATA);
+
+ evas_object_del(favor_d->popup);
+ favor_d->popup = NULL;
+
+ err = contacts_db_get_record(_contacts_person._uri, f_info->person_id, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed");
+
+ err = contacts_record_set_bool(record, _contacts_person.is_favorite, false);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_bool() Failed(%d)", err);
+
+ err = contacts_db_update_record(record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_set_bool() Failed(%d)", err);
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ }
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+}
+
+static void favor_mf_del_response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_favor_info *f_info = data;
+ ph_favorite_data *favor_d;
+
+ favor_d = evas_object_data_get(obj, KEY_FAVOR_DATA);
+
+ evas_object_del(favor_d->popup);
+ favor_d->popup = NULL;
+
+ err = contacts_person_reset_usage(f_info->person_id, CONTACTS_USAGE_STAT_TYPE_OUTGOING_CALL);
+
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_person_reset_usage() Failed(%d)", err);
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ }
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ ph_favor_data_lazy_update(NULL, favor_d);
+}
+
+static void favor_delete_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ ph_favor_info *f_info;
+ Evas_Object *btn;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+
+ f_info = evas_object_data_get(obj, "f_info");
+ p_retm_if(NULL == f_info, "evas_object_data_get() return NULL");
+
+ favor_ctxpopup_dismissed_cb(favor_d, favor_d->ctx_popup, NULL);
+
+ snprintf(buf, sizeof(buf), "%s?", S_(PH_SYS_SK_DELETE));
+ btn = phone_create_confirm_popup(&favor_d->popup, favor_d->win, buf, favor_del_response_cb, f_info);
+ evas_object_data_set(btn, KEY_FAVOR_DATA, favor_d);
+}
+
+static void favor_mf_delete_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ ph_favor_info *f_info;
+ Evas_Object *btn;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+
+ f_info = evas_object_data_get(obj, "f_info");
+ p_retm_if(NULL == f_info, "evas_object_data_get() return NULL");
+
+ favor_ctxpopup_dismissed_cb(favor_d, favor_d->ctx_popup, NULL);
+
+ snprintf(buf, sizeof(buf), "%s?", S_(PH_SYS_SK_DELETE));
+ btn = phone_create_confirm_popup(&favor_d->popup, favor_d->win, buf, favor_mf_del_response_cb, f_info);
+ evas_object_data_set(btn, KEY_FAVOR_DATA, favor_d);
+}
+
+static Evas_Object *favor_create_button(Evas_Object *box, char *fullpath, ph_favor_info *f_info)
+{
+ const int PH_FAVOR_BTN_WIDTH = 160;
+ const int PH_FAVOR_BTN_HEIGHT = 74;
+ const int PH_FAVOR_1BTN_WIDTH = 326;
+ Evas_Object *btn;
+ double scale;
+ scale = elm_config_scale_get();
+ btn = phone_create_list_sweep_btn(box, fullpath);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn is failed");
+
+ if(strcmp(fullpath, PH_IMG_ICON_DELETE) == 0)
+ elm_object_style_set(btn, "sweep/delete");
+ evas_object_data_set(btn, "f_info", f_info);
+ if (f_info->number) {
+ evas_object_size_hint_min_set(btn, (int)(PH_FAVOR_BTN_WIDTH*scale), (int)(PH_FAVOR_BTN_HEIGHT*scale));
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5);
+ }
+ else {
+ evas_object_size_hint_min_set(btn, (int)(PH_FAVOR_1BTN_WIDTH*scale), (int)(PH_FAVOR_BTN_HEIGHT*scale));
+ evas_object_size_hint_align_set(btn, 0.5, 0.5);
+ }
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+ return btn;
+}
+
+static void __favor_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ if (favor_d->popup) {
+ evas_object_del(favor_d->popup);
+ favor_d->popup = NULL;
+ }
+
+}
+
+
+
+static void favor_call_btn_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_CALL_PRESS, NULL);
+}
+
+static void favor_call_btn_unpressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_CALL, NULL);
+}
+
+static void favor_msg_btn_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_MESSAGE_PRESS, NULL);
+}
+
+static void favor_msg_btn_unpressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_MESSAGE, NULL);
+}
+
+static Evas_Object *favor_create_popup_button(Evas_Object *parent, ph_favorite_data *favor_d, ph_favor_info *f_info, int item_type)
+{
+ Evas_Object *btn1, *btn2, *btn3, *btn4;
+ Evas_Object *box;
+
+ box = elm_box_add(parent);
+ elm_box_padding_set(box, 16, 0);
+
+ if (f_info->number) {
+ elm_box_horizontal_set(box, EINA_TRUE);
+ btn1 = favor_create_button(box, PH_IMG_ICON_CALL, f_info);
+ evas_object_smart_callback_add(btn1, "clicked", favor_call_btn_cb, favor_d);
+ evas_object_event_callback_add(btn1, EVAS_CALLBACK_MOUSE_DOWN, favor_call_btn_pressed_cb, btn1);
+ evas_object_event_callback_add(btn1, EVAS_CALLBACK_MOUSE_UP, favor_call_btn_unpressed_cb, btn1);
+
+ btn2 = favor_create_button(box, PH_IMG_ICON_MESSAGE, f_info);
+ evas_object_smart_callback_add(btn2, "clicked", favor_msg_btn_cb, favor_d);
+ evas_object_event_callback_add(btn2, EVAS_CALLBACK_MOUSE_DOWN, favor_msg_btn_pressed_cb, btn2);
+ evas_object_event_callback_add(btn2, EVAS_CALLBACK_MOUSE_UP, favor_msg_btn_unpressed_cb, btn2);
+
+ btn4 = favor_create_button(box, PH_IMG_ICON_DELETE, f_info);
+ if (FAVOR_ITEM_MFC == item_type)
+ evas_object_smart_callback_add(btn4, "clicked", favor_mf_delete_btn_cb, favor_d);
+ else if (FAVOR_ITEM_FAVOR == item_type)
+ evas_object_smart_callback_add(btn4, "clicked", favor_delete_btn_cb, favor_d);
+
+ }
+ else {
+ btn4 = favor_create_button(box, PH_IMG_ICON_DELETE, f_info);
+
+ if (FAVOR_ITEM_MFC == item_type)
+ evas_object_smart_callback_add(btn4, "clicked", favor_mf_delete_btn_cb, favor_d);
+ else if (FAVOR_ITEM_FAVOR == item_type)
+ evas_object_smart_callback_add(btn4, "clicked", favor_delete_btn_cb, favor_d);
+
+ }
+
+ return box;
+}
+
+static void favor_expand_btn_clicked_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ const char *file_icon;
+ const char *file_group;
+ const int PH_CTX_POPUP_HEIGHT = 112;
+ Evas_Object *ctx_popup;
+ Evas_Object *box;
+ Evas_Object *icon;
+ Evas_Object *layout;
+ ph_favor_info *f_info;
+ ph_favorite_data *favor_d = data;
+ Ecore_X_Window win;
+ int win_width;
+ int item_type;
+ double scale;
+
+ icon = elm_object_part_content_get(obj, "icon");
+
+ elm_icon_file_get(icon, &file_icon, &file_group);
+ p_retm_if(NULL == file_icon, "elm_icon_file_set() return NULL");
+
+ if (0 == strcmp(file_icon, CTUI_IMG_ICON_EXPAND_CLOSED)) { // OPENED
+ elm_icon_file_set(icon, CTUI_IMG_ICON_EXPAND_OPENED, NULL);
+ elm_object_part_content_set(obj, "icon", icon);
+ }
+ else {
+ win = ecore_x_window_root_get(ecore_x_window_focus_get());
+ ecore_x_window_size_get(win, &win_width, NULL);
+
+ scale = elm_config_scale_get();
+ elm_icon_file_set(icon, CTUI_IMG_ICON_EXPAND_CLOSED, NULL);
+ elm_object_part_content_set(obj, "icon", icon);
+
+ if (favor_d->ctx_popup) {
+ evas_object_del(favor_d->ctx_popup);
+ favor_d->ctx_popup = NULL;
+ }
+
+ ctx_popup = elm_ctxpopup_add(favor_d->navi);
+ evas_object_size_hint_min_set(ctx_popup, win_width, (int)(PH_CTX_POPUP_HEIGHT*scale));
+ elm_ctxpopup_horizontal_set(ctx_popup, EINA_TRUE);
+ evas_object_data_set(ctx_popup, "expand_btn", obj);
+ favor_d->ctx_popup = ctx_popup;
+
+ elm_ctxpopup_direction_priority_set(ctx_popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(ctx_popup, "dismissed", favor_ctxpopup_dismissed_cb, favor_d);
+ evas_object_event_callback_add(ctx_popup, EVAS_CALLBACK_HIDE, favor_ctxpopup_hide_cb, obj);
+
+ f_info = evas_object_data_get(obj, "f_info");
+ p_retm_if(NULL == f_info, "evas_object_data_get() return NULL");
+ item_type = (int)evas_object_data_get(obj, "item_type");
+
+ f_info->number = SAFE_STRDUP(favor_get_contact_number(f_info->person_id));
+ layout = elm_object_part_content_get(favor_d->layout, "contents");
+
+ box = favor_create_popup_button(layout, favor_d, f_info, item_type);
+ evas_object_show(box);
+ elm_object_content_set(ctx_popup, box);
+ phone_move_ctxpopup(favor_d->ctx_popup, obj);
+ evas_object_show(ctx_popup);
+ }
+}
+
+
+static void favor_nums_popup_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d = evas_object_data_get(obj, "favor_d");
+ int contact_id = (int)evas_object_data_get(obj, "person_id");
+
+ if (PH_UG_REQUEST_CHECK_FOR_NUMBER == favor_d->ug_request || PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == favor_d->ug_request) {
+ Elm_Object_Item *item;
+ ph_favor_info *f_info;
+
+ item = evas_object_data_get(obj, "item");
+ p_retm_if(NULL == item, "evas_object_data_get() return NULL");
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ f_info->id_ret = (int)data;
+ f_info->id_ret_type = 1;
+ ph_favor_edit_set_selection_info(favor_d);
+ favor_value_list_popup_hide_cb(obj, NULL, NULL);
+ }
+ else if (PH_UG_REQUEST_LAUNCH_VOICECALL == favor_d->ug_request) {
+ char *num_info = (char *)elm_object_item_text_get(event_info);
+ char *number;
+ strtok(num_info, " ");
+ number = strtok(NULL, " ");
+ favor_value_list_popup_hide_cb(obj, NULL, NULL);
+ phone_launch_voice_call(contact_id, number);
+ }
+ else {
+ phone_ug_return_id(favor_d->ug, contact_id, (int)data, 0);
+ ug_destroy_me(favor_d->ug);
+ }
+}
+
+static inline void favor_handle_select_email(ph_favorite_data *favor_d, ph_favor_info *f_info)
+{
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int email_id;
+
+ if (f_info->email_list) {
+ if (1 == eina_list_count(f_info->email_list)) {
+ record = (contacts_record_h)f_info->email_list->data;
+ err = contacts_record_get_int(record, _contacts_email.id, &email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(favor_d->ug, f_info->person_id, 0, email_id);
+ ug_destroy_me(favor_d->ug);
+ }
+ else
+ ph_favor_create_value_list_popup(favor_d, f_info);
+ }
+ else
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+}
+
+static void favor_emails_popup_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = evas_object_data_get(obj, "favor_d");
+ int contact_id = (int)evas_object_data_get(obj, "person_id");
+
+ if (CT_UG_REQUEST_CHECK_FOR_EMAIL == favor_d->ug_request || PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == favor_d->ug_request) {
+ Elm_Object_Item *item;
+ ph_favor_info *f_info;
+
+ item = evas_object_data_get(obj, "item");
+ p_retm_if(NULL == item, "evas_object_data_get() return NULL");
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ f_info->id_ret = (int)data;
+ f_info->id_ret_type = 2;
+ ph_favor_edit_set_selection_info(favor_d);
+ favor_value_list_popup_hide_cb(obj, NULL, NULL);
+ }
+ else {
+ phone_ug_return_id(favor_d->ug, contact_id, 0, (int)data);
+ ug_destroy_me(favor_d->ug);
+ }
+}
+
+static inline void favor_handle_select_number(ph_favorite_data *favor_d, ph_favor_info *f_info)
+{
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ char *number_str_p = NULL;
+ int num_id;
+
+ if (f_info->number_list) {
+ if (1 == eina_list_count(f_info->number_list)) {
+ record = (contacts_record_h)f_info->number_list->data;
+ if (PH_UG_REQUEST_LAUNCH_VOICECALL == favor_d->ug_request) {
+ err = contacts_record_get_str_p(record, _contacts_number.number, &number_str_p);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ phone_launch_voice_call(f_info->person_id, number_str_p);
+ }
+ else {
+ err = contacts_record_get_int(record, _contacts_number.id, &num_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(favor_d->ug, f_info->person_id, num_id, 0);
+ ug_destroy_me(favor_d->ug);
+ }
+ }
+ else
+ ph_favor_create_value_list_popup(favor_d, f_info);
+ }
+ else
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_NUMBER), 1.5);
+}
+
+static inline void favor_handle_select_number_or_email(ph_favorite_data *favor_d, ph_favor_info *f_info)
+{
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int num_id;
+ int email_id;
+
+ int number_list_count = 0;
+ int email_list_count = 0;
+
+ if (f_info->number_list)
+ number_list_count = eina_list_count(f_info->number_list);
+ if (f_info->email_list)
+ email_list_count = eina_list_count(f_info->email_list);
+
+ if (number_list_count == 0 && email_list_count == 0) {
+ phone_show_popup(favor_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_NUMBER), 1.5);
+ ug_destroy_me(favor_d->ug);
+ }
+ else if (number_list_count == 1 && email_list_count == 0) {
+ record = (contacts_record_h)f_info->number_list->data;
+ err = contacts_record_get_int(record, _contacts_number.id, &num_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(favor_d->ug, f_info->person_id, num_id, 0);
+ ug_destroy_me(favor_d->ug);
+ }
+ else if (number_list_count == 0 && email_list_count == 1) {
+ record = (contacts_record_h)f_info->email_list->data;
+ err = contacts_record_get_int(record, _contacts_email.id, &email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(favor_d->ug, f_info->person_id, 0, email_id);
+ ug_destroy_me(favor_d->ug);
+ }
+ else {
+ ph_favor_create_value_list_popup(favor_d, f_info);
+ }
+}
+
+Evas_Object* ph_favor_create_value_list_popup(ph_favorite_data *favor_d, ph_favor_info *f_info)
+{
+ Evas_Object *popup;
+ Evas_Object *list = NULL;
+ Evas_Object *btn;
+
+ popup = elm_popup_add(favor_d->navi);
+ elm_object_style_set(popup, "min_liststyle");
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ if (f_info->number_list)
+ list = ctui_list_create_values_list(_contacts_number._uri, popup, list, f_info->number_list, favor_nums_popup_sel);
+
+ if (f_info->email_list)
+ list = ctui_list_create_values_list(_contacts_email._uri, popup, list, f_info->email_list, favor_emails_popup_sel);
+
+ elm_object_content_set(popup, list);
+ evas_object_data_set(list, "favor_d", favor_d);
+ evas_object_data_set(list, "person_id", (void *)f_info->person_id);
+
+ 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", favor_value_list_popup_hide_cb, list);
+
+ favor_d->popup = popup;
+ evas_object_show(popup);
+ return list;
+}
+
+static void favor_destory_child_ug(ui_gadget_h ug, void *priv)
+{
+ ph_favorite_data *favor_d = priv;
+ p_retm_if(NULL == ug, "ug is NULL");
+ ug_destroy(ug);
+
+ p_retm_if(NULL == priv, "priv is NULL");
+ favor_d->child_ug = NULL;
+ ug_destroy_me(favor_d->ug);
+
+}
+
+static void favor_ug_check(ph_favorite_data *favor_d, ph_favor_info *f_info)
+{
+ Evas_Object *popup;
+ ph_view_info *view_info;
+ struct ug_cbs cbs = {0};
+ const char *err_msg;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+
+ switch (favor_d->ug_request) {
+ case PH_UG_REQUEST_SELECT:
+ phone_ug_return_id(favor_d->ug, f_info->person_id, 0, 0);
+ ug_destroy_me(favor_d->ug);
+ break;
+ case PH_UG_REQUEST_SELECT_EMAIL:
+ favor_handle_select_email(favor_d, f_info);
+ break;
+ case PH_UG_REQUEST_SELECT_NUMBER:
+ case PH_UG_REQUEST_LAUNCH_VOICECALL:
+ //FIXME : send selection info to caller
+ favor_handle_select_number(favor_d, f_info);
+ break;
+ case PH_UG_REQUEST_SELECT_NUMBER_OR_EMAIL:
+ favor_handle_select_number_or_email(favor_d, f_info);
+ break;
+ case PH_UG_REQUEST_SET_WITH_NUM:
+ case PH_UG_REQUEST_SET_WITH_EMAIL:
+ case PH_UG_REQUEST_SET_WITH_WEB:
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, favor_d->win, favor_d->navi, favor_d->ug, favor_d->ug_request, favor_d->ug_cnt_max, favor_d->ug_data);
+ ctui_list_update_with_data(view_info, favor_d, f_info->person_id, -1, -1);
+ free(view_info);
+ break;
+ case PH_UG_REQUEST_SET_WITH_IMG:
+ favor_d->selected_person_id = f_info->person_id;
+
+ cbs.result_cb = favor_img_crop_result;
+ cbs.destroy_cb = favor_destory_child_ug;
+ cbs.priv = favor_d;
+ favor_d->child_ug = phone_image_crop_ug(favor_d->ug, favor_d->ug_data, &cbs);
+ break;
+ case PH_UG_REQUEST_SET_WITH_RINGTONE:
+ err = contacts_db_get_record(_contacts_person._uri, f_info->person_id, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed");
+
+ err = contacts_record_set_str(record, _contacts_person.ringtone_path, favor_d->ug_data);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed");
+
+ err = contacts_db_update_record(record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_update_record() Failed(%d)", err);
+ ctui_create_contacts_error_popup(favor_d->navi, err);
+ }
+ else {
+ err_msg = S_(CT_SYS_POP_SUCCESS);
+ popup = phone_show_popup(favor_d->navi, err_msg, 1.5);
+ evas_object_smart_callback_add(popup, "timeout", favor_popup_response_cb, favor_d);
+ }
+ break;
+ default:
+ ctui_create_detail_view_from_phone(favor_d->win, favor_d->navi, favor_d->ug, f_info->person_id);
+ break;
+ }
+
+}
+
+static void favor_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favor_info *f_info;
+ ph_favorite_data *favor_d = data;
+ Elm_Object_Item *item = event_info;
+
+ elm_gengrid_item_selected_set(item, EINA_FALSE);
+
+ f_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+
+ if (PH_FAVOR_MODE_EDIT != favor_d->list_mode)
+ favor_ug_check(favor_d, f_info);
+}
+
+#define N 20
+
+static Eina_Bool favor_append_item_part(void *data)
+{
+ int count;
+ Eina_List *l;
+ ph_favor_info *fd;
+ ph_favorite_data *favor_d = data;
+
+ count = 0;
+ l = eina_list_nth_list(favor_d->favor_list, favor_d->readed_n);
+ EINA_LIST_FOREACH(l, l, fd) {
+ if (N == count) break;
+ if (!fd) continue;
+ if (fd->img_path)
+ fd->item = elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_favor, fd, favor_item_sel, favor_d);
+ else
+ fd->item = elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_favor_no_id, fd, favor_item_sel, favor_d);
+ count ++;
+ }
+ if (N <= count) {
+ favor_d->readed_n += N;
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ favor_d->list_idler = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+void ph_favor_fill_favor_gengrid(ph_favorite_data *favor_d)
+{
+ PH_FN_CALL;
+ int count;
+ Eina_List *l;
+ ph_favor_info *f_info;
+ p_retm_if(NULL == favor_d->favor_gengrid, "Parameter is null");
+
+ if (favor_d->list_idler) {
+ ecore_idler_del(favor_d->list_idler);
+ favor_d->list_idler = NULL;
+ }
+
+ if (favor_d->favor_gengrid)
+ elm_gengrid_clear(favor_d->favor_gengrid);
+
+ favor_d->readed_n = 0;
+ count = 0;
+ if (favor_d->favor_list && PH_FAVOR_MODE_DEFAULT == favor_d->list_mode)
+ elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_index, T_(PH_GET_TEXT_BASIC, PHTEXT_FAVORITES), NULL, NULL);
+
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ if (N == count) break;
+ if (!f_info) continue;
+ if (f_info->img_path && *f_info->img_path)
+ f_info->item = elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_favor, f_info, favor_item_sel, favor_d);
+ else
+ f_info->item = elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_favor_no_id, f_info, favor_item_sel, favor_d);
+
+ if (favor_d->list_mode == PH_FAVOR_MODE_EDIT)
+ elm_object_item_signal_emit(f_info->item, "favorites_theme/edit_no_effect", "favorites_theme");
+ count++;
+ }
+
+ if (N == count) {
+ favor_d->readed_n = N;
+ favor_d->list_idler = ecore_idler_add(favor_append_item_part, favor_d);
+ }
+}
+
+void ph_favor_fill_mf_gengrid(ph_favorite_data *favor_d)
+{
+ PH_FN_CALL;
+ Eina_List *l;
+ ph_favor_info *f_info;
+ p_retm_if(NULL == favor_d->favor_gengrid, "Parameter is null");
+
+ if (favor_d->mf_list) {
+ elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_mf_index, T_(CT_GET_TEXT_BASIC, CTTEXT_MOST_FREQUENT_CONTACTS), NULL, NULL);
+
+ EINA_LIST_FOREACH(favor_d->mf_list, l, f_info) {
+ if (!f_info) continue;
+ if (f_info->img_path && *f_info->img_path)
+ f_info->item = elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_mf, f_info, favor_item_sel, favor_d);
+ else
+ f_info->item = elm_gengrid_item_append(favor_d->favor_gengrid, &grid_itc_mf_no_id, f_info, favor_item_sel, favor_d);
+ }
+ }
+}
+
+void ph_favor_update_button_status(ph_favorite_data *favor_d)
+{
+ p_retm_if(NULL == favor_d || NULL == favor_d->navi_button, "Navi button is null");
+
+ if (favor_d->checked_cnt == 0 && PH_FAVOR_MODE_EDIT == favor_d->list_mode)
+ elm_object_disabled_set(favor_d->navi_button, EINA_TRUE);
+ else if (favor_d->favor_list_count == 0)
+ elm_object_disabled_set(favor_d->navi_button, EINA_TRUE);
+ else
+ elm_object_disabled_set(favor_d->navi_button, EINA_FALSE);
+}
+
+static char *favor_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_favor_info * f_info = data;
+ char buf[PATH_MAX];
+
+ if (0 == strcmp(part, "elm.text")) {
+ if (f_info->display && *f_info->display)
+ snprintf(buf, sizeof(buf), "%s", f_info->display);
+ else {
+ if (!f_info->number_loaded) {
+ f_info->number = SAFE_STRDUP(favor_get_contact_number(f_info->person_id));
+ f_info->number_loaded = true;
+ }
+
+ if (!f_info->number || !*f_info->number)
+ return strdup(S_(PH_SYS_BODY_NONAME));
+ else
+ snprintf(buf, sizeof(buf), "%s", f_info->number);
+ }
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static char *favor_mf_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PATH_MAX];
+ ph_favor_info *f_info = data;
+
+ if (0 == strcmp(part, "elm.text")) {
+ if (f_info->display && *f_info->display)
+ snprintf(buf, sizeof(buf), "%s", f_info->display);
+ else {
+ if (!f_info->number_loaded) {
+ f_info->number = SAFE_STRDUP(favor_get_contact_number(f_info->person_id));
+ f_info->number_loaded = true;
+ }
+
+ if (!f_info->number || !*f_info->number)
+ return strdup(S_(PH_SYS_BODY_NONAME));
+ else
+ snprintf(buf, sizeof(buf), "%s", f_info->number);
+ }
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static Evas_Object *favor_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_favor_info * f_info = data;
+ ph_favorite_data *favor_d = evas_object_data_get(obj, KEY_FAVOR_DATA);
+ if (0 == strcmp(part, "elm.swallow.icon")) {
+ Evas_Object *ic;
+ char buf[PATH_MAX]={0};
+ if (f_info->img_path && *f_info->img_path) {
+ snprintf(buf, sizeof(buf), "%s", f_info->img_path);
+
+ ic = elm_icon_add(obj);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add is failed");
+
+ 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.swallow.expand.icon") && favor_d->list_mode == PH_FAVOR_MODE_DEFAULT) {
+ Evas_Object *exp_icon;
+ Evas_Object *btn;
+ btn = elm_button_add(obj);
+ evas_object_propagate_events_set(btn , EINA_FALSE);
+ evas_object_data_set(btn, "f_info", f_info);
+ evas_object_data_set(btn, "item_type", (void *)FAVOR_ITEM_FAVOR);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, favor_expand_btn_clicked_cb, favor_d);
+ elm_object_style_set(btn, "transparency");
+ exp_icon = elm_icon_add(btn);
+ elm_icon_file_set(exp_icon, CTUI_IMG_ICON_EXPAND_OPENED, NULL);
+ elm_object_part_content_set(btn, "icon", exp_icon);
+ evas_object_show(btn);
+ return btn;
+ }
+ else if (0 == strcmp(part, "elm.swallow.end") && favor_d->list_mode == PH_FAVOR_MODE_EDIT) {
+ Evas_Object *check;
+ check = elm_check_add(obj);
+ elm_object_style_set(check, "grid");
+ elm_check_state_pointer_set(check, &(f_info->checked));
+ evas_object_data_set(check, KEY_FAVOR_DATA, favor_d);
+ evas_object_smart_callback_add(check, "changed", ph_favor_edit_check_changed_cb, f_info);
+ return check;
+ }
+ return NULL;
+}
+
+static char* favor_group_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ char* title = data;
+ if (title && *title)
+ return strdup((const char *)data);
+
+ return NULL;
+}
+
+static Evas_Object *favor_mf_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_favor_info *f_info = data;
+ ph_favorite_data *favor_d = evas_object_data_get(obj, KEY_FAVOR_DATA);
+ if (0 == strcmp(part, "elm.swallow.icon")) {
+ Evas_Object *ic;
+ char buf[PATH_MAX];
+
+ if (f_info->img_path && *f_info->img_path) {
+ snprintf(buf, sizeof(buf), "%s", f_info->img_path);
+ ic = elm_icon_add(obj);
+ 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.swallow.expand.icon")) {
+ Evas_Object *exp_icon;
+ Evas_Object *btn;
+ btn = elm_button_add(obj);
+ elm_object_style_set(btn, "transparency");
+ exp_icon = elm_icon_add(btn);
+ elm_icon_file_set(exp_icon, CTUI_IMG_ICON_EXPAND_OPENED, NULL);
+ elm_object_part_content_set(btn, "icon", exp_icon);
+ evas_object_propagate_events_set(btn , EINA_FALSE);
+ evas_object_data_set(btn, "f_info", f_info);
+ evas_object_data_set(btn, "item_type", (void *)FAVOR_ITEM_MFC);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, favor_expand_btn_clicked_cb, favor_d);
+ evas_object_show(btn);
+ return btn;
+ }
+
+ return NULL;
+}
+
+static void favor_grid_longpress(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ favor_d->longpressed = (PH_FAVOR_MODE_EDIT == favor_d->list_mode ? EINA_TRUE : EINA_FALSE);
+}
+
+static void favor_grid_move(void *data, Evas_Object *obj, void *event_info)
+{
+ int ori_favor_id = -1;
+ int front_favor_id = -1;
+ int back_favor_id = -1;
+ ph_favor_info *f_info;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Elm_Object_Item *prev_item;
+ Elm_Object_Item *next_item;
+ Elm_Object_Item *it = event_info;
+ ph_favorite_data *favor_d = (ph_favorite_data *)data;
+
+ favor_d->favor_move = false;
+ f_info = elm_object_item_data_get(it);
+ p_retm_if(NULL == f_info, "elm_object_item_data_get() return NULL");
+ ori_favor_id = f_info->person_id;
+
+ prev_item = elm_gengrid_item_prev_get(it);
+ if (prev_item) {
+ f_info = elm_object_item_data_get(prev_item);
+ if (f_info)
+ front_favor_id = f_info->person_id;
+ }
+
+ next_item = elm_gengrid_item_next_get(it);
+ if (next_item) {
+ f_info = elm_object_item_data_get(next_item);
+ if (f_info)
+ back_favor_id = f_info->person_id;
+ }
+
+ p_ret_if(-1 == back_favor_id && -1 == front_favor_id);
+ if (-1 == back_favor_id)
+ back_favor_id = 0;
+ if (-1 == front_favor_id)
+ front_favor_id = 0;
+
+ PH_DBG("ori %d front %d back %d ", ori_favor_id, front_favor_id, back_favor_id);
+
+ if (-1 != ori_favor_id && -1 != front_favor_id && -1 != back_favor_id) {
+ err = contacts_person_set_favorite_order(ori_favor_id, front_favor_id, back_favor_id);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_person_set_favorite_order() Failed(%d)", err);
+ favor_d->favor_move = true;
+ }
+}
+
+static void favor_edit_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ p_retm_if(NULL == favor_d, "parameter(favor_d) is NULL");
+
+ if (favor_d->popup)
+ __favor_popup_hide_cb(favor_d, NULL, NULL);
+
+ phone_favor_edit_mode_start(favor_d);
+}
+
+static void favor_done_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ 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;
+ ph_favor_info *f_info;
+ ph_favorite_data *favor_d = data;
+ p_retm_if(NULL == favor_d, "parameter(favor_d) is NULL");
+
+ if (PH_UG_REQUEST_CHECK_FOR_NUMBER == favor_d->ug_request) {
+ result_list_number = calloc(favor_d->checked_cnt, sizeof(int));
+ EINA_LIST_FOREACH(favor_d->mf_list, l, f_info) {
+ if (NULL == f_info || !f_info->checked) continue;
+ if (1 != f_info->id_ret_type) {
+ ERR("Invalid f_info->id_ret_type(%d)", f_info->id_ret_type);
+ continue;
+ }
+ result_list_number[number_count++] = f_info->id_ret;
+ }
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ if (NULL == f_info || !f_info->checked) continue;
+ if (1 != f_info->id_ret_type) {
+ ERR("Invalid f_info->id_ret_type(%d)", f_info->id_ret_type);
+ continue;
+ }
+ result_list_number[number_count++] = f_info->id_ret;
+ }
+ phone_list_ug_return_ids(favor_d->ug, result_list_number, number_count, CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST);
+ free(result_list_number);
+ }
+ else if (PH_UG_REQUEST_CHECK_FOR_EMAIL == favor_d->ug_request) {
+ result_list_email = calloc(favor_d->checked_cnt, sizeof(int));
+ EINA_LIST_FOREACH(favor_d->mf_list, l, f_info) {
+ if (NULL == f_info || !f_info->checked) continue;
+ if (2 != f_info->id_ret_type) {
+ ERR("Invalid f_info->id_ret_type(%d)", f_info->id_ret_type);
+ continue;
+ }
+ result_list_email[email_count++] = f_info->id_ret;
+ }
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ if (NULL == f_info || !f_info->checked) continue;
+ if (2 != f_info->id_ret_type) {
+ ERR("Invalid f_info->id_ret_type(%d)", f_info->id_ret_type);
+ continue;
+ }
+ result_list_email[email_count++] = f_info->id_ret;
+ }
+ phone_list_ug_return_ids(favor_d->ug, result_list_email, email_count, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST);
+ free(result_list_email);
+ }
+ else if (PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == favor_d->ug_request) {
+ result_list_number = calloc(favor_d->checked_cnt, sizeof(int));
+ result_list_email = calloc(favor_d->checked_cnt, sizeof(int));
+
+ EINA_LIST_FOREACH(favor_d->mf_list, l, f_info) {
+ if (NULL == f_info || !f_info->checked) continue;
+ if (1 == f_info->id_ret_type)
+ result_list_number[number_count++] = f_info->id_ret;
+ else if (2 == f_info->id_ret_type)
+ result_list_email[email_count++] = f_info->id_ret;
+ else {
+ ERR("Invalid f_info->id_ret_type(%d)", f_info->id_ret_type);
+ continue;
+ }
+ }
+
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ if (NULL == f_info || !f_info->checked) continue;
+ if (1 == f_info->id_ret_type)
+ result_list_number[number_count++] = f_info->id_ret;
+ else if (2 == f_info->id_ret_type)
+ result_list_email[email_count++] = f_info->id_ret;
+ else {
+ ERR("Invalid f_info->id_ret_type(%d)", f_info->id_ret_type);
+ continue;
+ }
+ }
+ phone_list_ug_return_number_email_ids(favor_d->ug, result_list_number, number_count, result_list_email, email_count);
+ free(result_list_number);
+ free(result_list_email);
+ }
+ else {
+ result_list_person = calloc(favor_d->checked_cnt, sizeof(int));
+ EINA_LIST_FOREACH(favor_d->mf_list, l, f_info) {
+ result_list_person[person_count++] = f_info->person_id;
+ }
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ result_list_person[person_count++] = f_info->person_id;
+ }
+ phone_list_ug_return_ids(favor_d->ug, result_list_person, person_count, CT_UG_BUNDLE_RESULT_PERSON_ID_LIST);
+ free(result_list_person);
+ }
+
+ ug_destroy_me(favor_d->ug);
+}
+
+static Eina_List* favor_get_contact(Eina_List *favor_list)
+{
+ int person_id;
+ Eina_List *result = NULL;
+ Eina_List *cursor;
+ ct_person_list *person_info;
+ ph_favor_info *f_info;
+ int is_exist = false;
+ contacts_list_h person_list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_db_get_all_records(_contacts_person._uri, 0,0, &person_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_db_get_all_records...() Failed(%d)", err);
+
+
+ while (CONTACTS_ERROR_NONE == err) {
+ is_exist = false;
+
+ err = phone_cts_get_int_from_list(person_list, _contacts_person.id, &person_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+
+ EINA_LIST_FOREACH(favor_list, cursor, f_info) {
+ if (!f_info)
+ continue;
+ if (f_info->person_id == person_id) {
+ is_exist = true;
+ break;
+ }
+ }
+ if (false == is_exist) {
+ char *addressbook_ids;
+ person_info = calloc(1, sizeof(ct_person_list));
+ if (NULL == person_info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+ person_info->id = person_id;
+ err = phone_cts_get_str_from_list(person_list, _contacts_person.display_name, &person_info->display);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ SAFE_STRDUP(person_info->display);
+ err = phone_cts_get_int_from_list(person_list, _contacts_person.link_count, &person_info->link_count);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+ err = phone_cts_get_str_from_list(person_list, _contacts_person.display_name_index, &(person_info->display_index));
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ break;
+ }
+ err = phone_cts_get_str_from_list(person_list, _contacts_person_contact.addressbook_ids, &addressbook_ids);
+ 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(addressbook_ids, " ");
+
+ err = phone_cts_get_str_from_list(person_list, _contacts_person.status, &(person_info->status_str));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+
+ result = eina_list_append(result, person_info);
+ }
+ err = contacts_list_next(person_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ return result;
+}
+
+static void favor_add_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ Eina_List *ct_list;
+ evas_object_data_set(favor_d->navi, "navi_it_pop", favor_d->navi_item);
+ ct_list = favor_get_contact(favor_d->favor_list);
+ ctui_create_favorite_list_select_view(favor_d->win, favor_d->navi, ct_list);
+}
+
+static int favor_get_mf_list(contacts_list_h *list)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+
+ err = contacts_filter_create(_contacts_person_usage._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, _contacts_person_usage.times_used, CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, 1))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_create(_contacts_person_usage._uri, &query))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_filter(query, filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_set_sort(query, _contacts_person_usage.times_used, false))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, list))) break;
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ return CONTACTS_ERROR_NONE;
+ } while (0);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ return err;
+}
+void ph_favor_load_mf_list(void *data)
+{
+ PH_FN_CALL;
+ int count = 0;
+ Eina_List *list = NULL;
+ ph_favorite_data *favor_d = data;
+ contacts_list_h mf_list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ favor_free_data(favor_d->mf_list);
+ favor_d->mf_list = NULL;
+ favor_d->mf_list_count = 0;
+
+ err = favor_get_mf_list(&mf_list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "favor_get_mf_list() Failed()");
+
+ while (CONTACTS_ERROR_NONE == err) {
+ ph_favor_info *f_info;
+ bool is_favorite;
+
+ if (3 <= count)
+ break;
+
+ f_info = calloc(1, sizeof(ph_favor_info));
+ if (NULL == f_info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+
+ err = phone_cts_get_bool_from_list(mf_list, _contacts_person_usage.is_favorite, &is_favorite);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_bool_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ if (true == is_favorite) {
+ err = contacts_list_next(mf_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ continue;
+ }
+ err = phone_cts_get_int_from_list(mf_list, _contacts_person_usage.person_id, &f_info->person_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ err = phone_cts_get_str_from_list(mf_list, _contacts_person_usage.display_name, &f_info->display);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ err = phone_cts_get_str_from_list(mf_list, _contacts_person_usage.image_thumbnail_path, &f_info->img_path);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_str_from_list() Failed(%d)", err);
+ free(f_info);
+ break;
+ }
+ if (CT_UG_REQUEST_SELECT_NUMBER == favor_d->ug_request) {
+ f_info->contact_list = ctui_person_get_contact_list(f_info->person_id);
+ p_warn_if(NULL == f_info->contact_list, "ctui_person_get_contact_list() return NULL");
+ f_info->number_list= ctui_person_get_number_list(f_info->contact_list);
+ p_warn_if(NULL == f_info->number_list, "ctui_person_get_contact_list() return NULL");
+ }
+ else if (CT_UG_REQUEST_SELECT_EMAIL == favor_d->ug_request) {
+ f_info->contact_list = ctui_person_get_contact_list(f_info->person_id);
+ p_warn_if(NULL == f_info->contact_list, "ctui_person_get_contact_list() return NULL");
+ f_info->email_list= ctui_person_get_email_list(f_info->contact_list);
+ p_warn_if(NULL == f_info->email_list, "ctui_person_get_contact_list() return NULL");
+
+ }
+
+ list = eina_list_append(list, (void*)f_info);
+ count ++;
+ err = contacts_list_next(mf_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ err = contacts_list_destroy(mf_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+
+ favor_d->mf_list = list;
+ favor_d->mf_list_count = count;
+}
+
+static void favor_create_favorite(ph_favorite_data *favor_d)
+{
+ PH_FN_CALL;
+ Evas_Object *gengrid;
+ int wx = 0;
+ int hy = 0;
+
+ favor_d->box = elm_box_add(favor_d->layout);
+ evas_object_size_hint_weight_set(favor_d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(favor_d->layout, "contents", favor_d->box);
+ evas_object_show(favor_d->box);
+
+ gengrid = elm_gengrid_add(favor_d->box);
+ elm_object_theme_set(gengrid, favor_d->th);
+ evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ ecore_x_window_size_get(ecore_x_window_root_get(ecore_x_window_focus_get()), &wx, &hy);
+
+ elm_gengrid_item_size_set(gengrid, wx/3, wx/3);
+ elm_gengrid_align_set(gengrid, 0.0, 0.0);
+ elm_gengrid_horizontal_set(gengrid, EINA_FALSE);
+ elm_gengrid_multi_select_set(gengrid, EINA_TRUE);
+
+ evas_object_smart_callback_add(gengrid, "moved", favor_grid_move, favor_d);
+ evas_object_smart_callback_add(gengrid, "longpressed", favor_grid_longpress, favor_d);
+
+ favor_d->favor_gengrid = gengrid;
+ elm_gengrid_reorder_mode_set(favor_d->favor_gengrid, EINA_FALSE);
+ evas_object_data_set(gengrid, KEY_FAVOR_DATA, favor_d);
+ evas_object_show(favor_d->favor_gengrid);
+ elm_box_pack_end(favor_d->box, favor_d->favor_gengrid);
+}
+
+static void favor_fill_layout(ph_favorite_data *favor_d)
+{
+ if (favor_d->ctx_popup) {
+ evas_object_del(favor_d->ctx_popup);
+ favor_d->ctx_popup = NULL;
+ }
+
+ if ( 0 == favor_d->favor_list_count && 0 < favor_d->mf_list_count && 0 == ctui_get_mfc_option())
+ {
+ if (NULL == favor_d->favor_gengrid)
+ favor_create_favorite(favor_d);
+ else
+ elm_gengrid_clear(favor_d->favor_gengrid);
+ if (favor_d->list_mode == CT_LIST_MODE_DEFAULT)
+ ph_favor_fill_mf_gengrid(favor_d);
+ }
+ else if (0 < favor_d->favor_list_count || (0 < favor_d->mf_list_count && 0 == ctui_get_mfc_option())) {
+ if (NULL == favor_d->favor_gengrid)
+ favor_create_favorite(favor_d);
+ else
+ elm_gengrid_clear(favor_d->favor_gengrid);
+ ph_favor_fill_favor_gengrid(favor_d);
+ if (0 == ctui_get_mfc_option() && favor_d->list_mode == CT_LIST_MODE_DEFAULT)
+ ph_favor_fill_mf_gengrid(favor_d);
+ }
+ else if (0 == favor_d->favor_list_count && (0 == favor_d->mf_list_count || 1 == ctui_get_mfc_option())) {
+ if (favor_d->favor_gengrid) {
+ elm_gengrid_clear(favor_d->favor_gengrid);
+ evas_object_del(favor_d->favor_gengrid);
+ evas_object_del(favor_d->box);
+ favor_d->favor_gengrid = NULL;
+ favor_d->box = NULL;
+ }
+ Evas_Object *base;
+ base = phone_create_nocontents(favor_d->layout, T_(PH_GET_TEXT_BASIC, PHTEXT_NO_FAVORITES));
+ p_retm_if(NULL == base, "elm_layout_add() return NULL");
+ elm_object_part_content_set(favor_d->layout, "contents", base);
+ evas_object_show(base);
+ }
+}
+
+static Eina_Bool favor_data_changed_cb(void *data)
+{
+ ph_favorite_data *favor_d = data;
+ p_retvm_if(NULL == favor_d, ECORE_CALLBACK_CANCEL, "favor_d is null");
+
+ if (favor_d->update_timer_favor) {
+ ecore_timer_del(favor_d->update_timer_favor);
+ favor_d->update_timer_favor = NULL;
+ }
+
+ ph_favor_load_mf_list(favor_d);
+ ph_favor_load_favor_list(favor_d);
+ favor_fill_layout(favor_d);
+ ph_favor_update_button_status(favor_d);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void ph_favor_data_lazy_update(const char *view_uri, void *data)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d = data;
+
+ if (favor_d->updating)
+ return;
+
+ if (favor_d->update_timer_favor) {
+ ecore_timer_del(favor_d->update_timer_favor);
+ favor_d->update_timer_favor = NULL;
+ }
+
+ PH_DBG("favor_d->is_background=%d",favor_d->is_background);
+
+ if (favor_d->is_background)
+ favor_d->update_timer_favor = ecore_timer_add(3.0, favor_data_changed_cb, favor_d);
+ else
+ favor_data_changed_cb(favor_d);
+}
+
+static Eina_Bool favor_log_data_changed_cb(void *data)
+{
+ ph_favorite_data *favor_d = data;
+ p_retvm_if(NULL == favor_d, ECORE_CALLBACK_CANCEL, "favor_d is null");
+
+ if (favor_d->update_timer_log) {
+ ecore_timer_del(favor_d->update_timer_log);
+ favor_d->update_timer_log = NULL;
+ }
+
+ ph_favor_load_mf_list(favor_d);
+ favor_fill_layout(favor_d);
+ ph_favor_update_button_status(favor_d);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void favor_log_data_lazy_update(const char *view_uri, void *data)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d = data;
+
+ if (favor_d->update_timer_log) {
+ ecore_timer_del(favor_d->update_timer_log);
+ favor_d->update_timer_log = NULL;
+ }
+
+ PH_DBG("favor_d->is_background=%d",favor_d->is_background);
+
+ if (favor_d->is_background)
+ favor_d->update_timer_log = ecore_timer_add(3.0, favor_log_data_changed_cb, favor_d);
+ else
+ favor_log_data_changed_cb(favor_d);
+}
+
+static int favor_get_person_id_by_contact_id(int contact_id)
+{
+ int person_id = 0;
+ contacts_record_h record = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, err, "contacts_db_get_record() Failed()");
+
+ err = contacts_record_get_int(record, _contacts_contact.person_id, &person_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);
+ }
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ return person_id;
+}
+
+static ph_favor_info* favor_find_info_by_contact_id(ph_favorite_data *favor_d, int contact_id)
+{
+ int person_id;
+ ph_favor_info *f_info;
+ Eina_List *l;
+
+ person_id = favor_get_person_id_by_contact_id(contact_id);
+ EINA_LIST_FOREACH(favor_d->favor_list, l, f_info) {
+ if (!f_info) continue;
+ if (f_info->person_id == person_id)
+ return f_info;
+ }
+ return NULL;
+}
+
+static int favor_set_updated_data(ph_favorite_data *favor_d, int ab_id)
+{
+ int contact_id;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+ int ver;
+ int type;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_changes_by_version(_contacts_contact_updated_info._uri, ab_id, favor_d->version, &list, &ver);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, FALSE, "contacts_db_get_changes_by_version() Failed(%d)", err);
+
+ if (!list)
+ return TRUE;
+
+ while (CONTACTS_ERROR_NONE == err) {
+ ph_favor_info *f_info;
+ err = phone_cts_get_int_from_list(list, _contacts_contact_updated_info.contact_id, &contact_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_contact_updated_info.type, &type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+
+ if (favor_d->version < ver)
+ favor_d->version = ver;
+
+ switch (type) {
+ case CONTACTS_CHANGE_UPDATED :
+ f_info = favor_find_info_by_contact_id(favor_d, contact_id);
+
+ if (f_info) {
+ favor_d->is_mf_changed = true;
+ err = contacts_db_get_record(_contacts_person._uri, f_info->person_id, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() is failed");
+ f_info->img_path = NULL;
+ break;
+ }
+ else {
+ free(f_info->display);
+ err = contacts_record_get_str(record, _contacts_person.display_name, &f_info->display);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_str() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ break;
+ }
+ f_info->number_loaded = false;
+ free(f_info->number);
+ f_info->number = NULL;
+ free(f_info->img_path);
+ err = contacts_record_get_str(record, _contacts_person.image_thumbnail_path, &f_info->img_path);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_get_str() Failed(%d)", err);
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ break;
+ }
+ }
+ if (f_info->img_path && *f_info->img_path)
+ elm_gengrid_item_item_class_update(f_info->item, &grid_itc_favor);
+ else
+ elm_gengrid_item_item_class_update(f_info->item, &grid_itc_favor_no_id);
+ }
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ break;
+ case CONTACTS_CHANGE_DELETED:
+ favor_free_data(favor_d->favor_list);
+ favor_d->favor_list = NULL;
+ favor_load_favorite_data(favor_d);
+ break;
+ case CONTACTS_CHANGE_INSERTED :
+ default :
+ break;
+ }
+ err = contacts_list_next(list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ }
+ phone_cts_free_list(list);
+ return TRUE;
+}
+
+static Eina_Bool favor_contact_data_changed_cb(void *data)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d = data;
+ contacts_list_h ab_list = NULL;
+ int ab_id;
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retvm_if(NULL == favor_d, ECORE_CALLBACK_CANCEL, "favor_d is null");
+
+ favor_d->is_mf_changed = false;
+
+ if (favor_d->update_timer_contact) {
+ ecore_timer_del(favor_d->update_timer_contact);
+ favor_d->update_timer_contact = NULL;
+ }
+
+ ret = favor_set_updated_data(favor_d, 0);
+ if (!ret) {
+ ERR("favor_set_updated_data is failed(%d)", ret);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ err = contacts_db_get_all_records(_contacts_address_book._uri, 0, 0, &ab_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_all_records is failed(%d)", err);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ while (CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_int_from_list(ab_list, _contacts_address_book.id, &ab_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("phone_cts_get_int_from_list() Failed(%d)", err);
+ break;
+ }
+ ret = favor_set_updated_data(favor_d, ab_id);
+ if (!ret) {
+ ERR("favor_set_updated_data is failed");
+ break;
+ }
+ err = contacts_list_next(ab_list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ }
+ phone_cts_free_list(ab_list);
+
+ ph_favor_load_mf_list(favor_d);
+ favor_fill_layout(favor_d);
+
+ ph_favor_update_button_status(favor_d);
+ return ECORE_CALLBACK_CANCEL;
+ PH_FN_END;
+}
+
+static void favor_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ph_favorite_data *favor_d = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retm_if(NULL == favor_d, "favor_d is null");
+
+ if (favor_d->p_info) {
+ free(favor_d->p_info);
+ }
+ // TODO: Fixme - person_changed
+
+ err = contacts_db_remove_changed_cb(_contacts_person._uri, ph_favor_data_lazy_update, favor_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ err = contacts_db_remove_changed_cb(_contacts_phone_log._uri, favor_log_data_lazy_update, favor_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+
+ if (favor_d->th) {
+ elm_theme_extension_del(favor_d->th, FAVORITES_THEME_EDJ);
+ elm_theme_extension_del(favor_d->th, CONTACT_BUTTON_THEME_EDJ);
+ elm_theme_free(favor_d->th);
+ }
+
+ if (favor_d->favor_list)
+ favor_free_data(favor_d->favor_list);
+
+ if (favor_d->mf_list)
+ favor_free_data(favor_d->mf_list);
+
+ if (favor_d->popup)
+ evas_object_del(favor_d->popup);
+
+ if (favor_d->update_timer_contact)
+ ecore_timer_del(favor_d->update_timer_contact);
+
+ if (favor_d->update_timer_log)
+ ecore_timer_del(favor_d->update_timer_log);
+
+ if (favor_d->update_timer_favor)
+ ecore_timer_del(favor_d->update_timer_favor);
+
+ free(favor_d);
+}
+
+static void favor_set_gengrid_item_style()
+{
+ grid_itc_favor.item_style = "gridtext_favorites";
+ grid_itc_favor.func.text_get = favor_label_get;
+ grid_itc_favor.func.content_get = favor_icon_get;
+ grid_itc_favor.func.state_get = NULL;
+ grid_itc_favor.func.del = NULL;
+
+ grid_itc_mf.item_style = "gridtext_favorites";
+ grid_itc_mf.func.text_get = favor_mf_label_get;
+ grid_itc_mf.func.content_get = favor_mf_icon_get;
+ grid_itc_mf.func.state_get = NULL;
+ grid_itc_mf.func.del = NULL;
+
+ grid_itc_favor_no_id.item_style = "gridtext_favorites_no_id";
+ grid_itc_favor_no_id.func.text_get = favor_label_get;
+ grid_itc_favor_no_id.func.content_get = favor_icon_get;
+ grid_itc_favor_no_id.func.state_get = NULL;
+ grid_itc_favor_no_id.func.del = NULL;
+
+ grid_itc_mf_no_id.item_style = "gridtext_favorites_no_id";
+ grid_itc_mf_no_id.func.text_get = favor_mf_label_get;
+ grid_itc_mf_no_id.func.content_get = favor_mf_icon_get;
+ grid_itc_mf_no_id.func.state_get = NULL;
+ grid_itc_mf_no_id.func.del = NULL;
+
+ grid_itc_index.item_style = "group_index";
+ grid_itc_index.func.text_get = favor_group_label_get;
+
+ grid_itc_mf_index.item_style = "group_index";
+ grid_itc_mf_index.func.text_get = favor_group_label_get;
+}
+
+static int favor_create_layout(ph_favorite_data *favor_d, Evas_Object *parent)
+{
+ PH_FN_CALL;
+ Evas_Object *base;
+ Evas_Object *layout;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ favor_d->navi = parent;
+ base = phone_create_base_layout(favor_d->navi, false);
+
+ layout = elm_layout_add(base);
+ elm_object_part_content_set(base, "elm.swallow.content", layout);
+
+ p_retvm_if(NULL == layout, -1, "elm_layout_add return NULL");
+ elm_layout_file_set(layout, SELECTION_INFO_EDJ, "selectioninfo_layout");
+
+ favor_d->layout = layout;
+ evas_object_show(layout);
+
+ favor_set_gengrid_item_style();
+
+ if (0 == ctui_get_mfc_option()) {
+ ph_favor_load_mf_list(favor_d);
+ }
+
+ ph_favor_load_favor_list(favor_d);
+ favor_fill_layout(favor_d);
+
+ evas_object_event_callback_add(favor_d->layout, EVAS_CALLBACK_DEL,
+ favor_view_delete_cb, favor_d);
+
+ // TODO: Fixme - person_changed
+ err = contacts_db_add_changed_cb(_contacts_person._uri, ph_favor_data_lazy_update, favor_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ err = contacts_db_add_changed_cb(_contacts_phone_log._uri, favor_log_data_lazy_update, favor_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ return 0;
+}
+
+static void favor_more_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d = data;
+ Evas_Object *popup = NULL;
+ int x, y, w, h;
+
+ if (favor_d->popup)
+ __favor_popup_hide_cb(favor_d, NULL, NULL);
+
+ popup = elm_ctxpopup_add(favor_d->navi);
+ p_retm_if(NULL == popup, "elm_ctxpopup_add() return NULL");
+
+ elm_ctxpopup_item_append(popup, S_(PH_SYS_SK_EDIT), NULL, favor_edit_btn_cb, favor_d);
+
+ elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+
+ evas_object_smart_callback_add(popup, "dismissed", __favor_popup_hide_cb, favor_d);
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+ evas_object_move(popup, x+(w/2), y+(h/2));
+ evas_object_show(popup);
+
+ favor_d->popup = popup;
+
+}
+
+API void phone_favor_set_navi(Evas_Object *layout, int mode)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d = evas_object_data_get(layout, KEY_FAVOR_DATA);
+ Elm_Object_Item *navi_item;
+ Evas_Object *l_btn;
+
+ p_retm_if(NULL == favor_d, "favor data is NULL");
+ navi_item = elm_naviframe_bottom_item_get(favor_d->navi);
+ p_retm_if(NULL == navi_item, "navi item is NULL");
+
+ phone_navi_item_clear(navi_item);
+ if (favor_d->ug) {
+ if (mode == PH_FAVOR_MODE_EDIT) {
+ favor_d->navi_button = phone_create_toolbar_btn(favor_d->navi, S_(CT_SYS_SK_DONE), favor_done_btn_cb, favor_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", favor_d->navi_button);
+ elm_object_style_set(favor_d->navi_button, "naviframe/toolbar/left");
+
+ l_btn = phone_create_toolbar_btn(favor_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, favor_d->ug);
+ elm_object_item_part_content_set(navi_item, "toolbar_button2", l_btn);
+ elm_object_style_set(l_btn, "naviframe/toolbar/right");
+ }
+ else {
+ l_btn = phone_create_toolbar_btn(favor_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, favor_d->ug);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", l_btn);
+ }
+ }
+ else {
+ if (mode == PH_FAVOR_MODE_DEFAULT) {
+ Evas_Object *add_button = NULL;
+
+ favor_d->navi_button = ctui_create_more_btn(favor_d->navi, favor_more_btn_clicked_cb, favor_d);
+ elm_object_item_part_content_set(favor_d->navi_item, "toolbar_more_btn", favor_d->navi_button);
+
+ add_button = phone_create_toolbar_btn(favor_d->navi, S_(CT_SYS_SK_ADD), favor_add_btn_cb, favor_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", add_button);
+
+ l_btn = elm_button_add(favor_d->navi);
+ evas_object_smart_callback_add(l_btn, "clicked", phone_back_btn_clicked_cb, favor_d->win);
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+ elm_object_item_part_content_set(favor_d->navi_item, "prev_btn", l_btn);
+ }
+ else { // edit mode
+ favor_d->navi_button = phone_create_toolbar_btn(favor_d->navi, S_(PH_SYS_SK_DELETE), ph_favor_edit_del_btn_cb, favor_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button1", favor_d->navi_button);
+ elm_object_style_set(favor_d->navi_button, "naviframe/toolbar/left");
+
+ l_btn = phone_create_toolbar_btn(favor_d->navi, S_(PH_SYS_SK_CANCEL), ph_favor_edit_cancel_cb, favor_d);
+ elm_object_item_part_content_set(navi_item, "toolbar_button2", l_btn);
+ elm_object_style_set(l_btn, "naviframe/toolbar/right");
+ }
+ }
+ ph_favor_update_button_status(favor_d);
+}
+
+Evas_Object* phone_favor_create_view(ph_view_info *view_info)
+{
+ int ret;
+ Elm_Theme *th;
+ ph_favorite_data *favor_d = calloc(1, sizeof(ph_favorite_data));
+ p_retvm_if(NULL == favor_d, NULL, "Fail to calloc ph_favorite_data");
+ favor_d->ug = view_info->ug;
+ favor_d->win = view_info->win;
+ favor_d->navi_item = elm_naviframe_bottom_item_get(view_info->navi);
+ favor_d->ug_request = view_info->ug_request;
+ favor_d->ug_data = view_info->ug_data;
+ favor_d->ug_cnt_max = view_info->ug_cnt_max;
+ favor_d->is_background = true;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, FAVORITES_THEME_EDJ);
+ elm_theme_extension_add(th, CONTACT_BUTTON_THEME_EDJ);
+
+ favor_d->th = th;
+
+ ret = favor_create_layout(favor_d, view_info->navi);
+ if (ret < 0) {
+ free(favor_d);
+ return NULL;
+ }
+
+ evas_object_data_set(favor_d->layout, KEY_FAVOR_DATA, favor_d);
+ return favor_d->layout;
+}
+
+API void phone_favor_view_language_changed(Evas_Object *base)
+{
+ ph_favorite_data *favor_d;
+ favor_d = evas_object_data_get(base, KEY_FAVOR_DATA);
+ p_retm_if(NULL == favor_d, "favor_d is null");
+ favor_data_changed_cb(favor_d);
+
+ if (PH_FAVOR_MODE_EDIT == favor_d->list_mode)
+ ph_favor_edit_set_selection_info(favor_d);
+}
+
+void phone_favor_view_reset(Evas_Object *base)
+{
+ PH_FN_CALL;
+ ph_favorite_data *favor_d;
+ Elm_Object_Item *item;
+
+ favor_d = evas_object_data_get(base, KEY_FAVOR_DATA);
+ p_retm_if(NULL == favor_d, "favor_d is null");
+
+ if (favor_d->child_ug) {
+ ug_destroy(favor_d->child_ug);
+ favor_d->child_ug = NULL;
+ }
+
+ if (PH_UG_REQUEST_CHECK != favor_d->ug_request &&
+ PH_UG_REQUEST_CHECK_FOR_NUMBER != favor_d->ug_request &&
+ PH_UG_REQUEST_CHECK_FOR_EMAIL != favor_d->ug_request)
+ if (PH_FAVOR_MODE_EDIT == favor_d->list_mode)
+ ph_favor_edit_mode_end(favor_d, false);
+
+ item = elm_naviframe_bottom_item_get(favor_d->navi);
+ if (elm_naviframe_top_item_get(favor_d->navi) != item)
+ elm_naviframe_item_pop_to(item);
+
+ favor_d->navi_button = NULL;
+}
+
+void phone_favor_set_background(Evas_Object *obj, bool is_background)
+{
+ ph_favorite_data *favor_d;
+ favor_d = evas_object_data_get(obj, KEY_FAVOR_DATA);
+ p_retm_if(NULL == favor_d, "favor data is null");
+
+ favor_d->is_background = is_background;
+
+ if (favor_d->update_timer_contact) {
+ ecore_timer_del(favor_d->update_timer_contact);
+ favor_d->update_timer_contact = NULL;
+ favor_contact_data_changed_cb(favor_d);
+ }
+
+ if (favor_d->update_timer_favor) {
+ ecore_timer_del(favor_d->update_timer_favor);
+ favor_d->update_timer_favor = NULL;
+ favor_data_changed_cb(favor_d);
+ }
+
+ if (favor_d->update_timer_log) {
+ ecore_timer_del(favor_d->update_timer_log);
+ favor_d->update_timer_log = NULL;
+ favor_log_data_changed_cb(favor_d);
+ }
+
+ if (true == is_background)
+ favor_d->mfc_option = ctui_get_mfc_option();
+ else
+ favor_fill_layout(favor_d);
+}
+
diff --git a/lib/favor/ph-favorite-view.h b/lib/favor/ph-favorite-view.h
new file mode 100755
index 0000000..830d6c3
--- /dev/null
+++ b/lib/favor/ph-favorite-view.h
@@ -0,0 +1,30 @@
+/*
+* 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 __PH_FAVORTIE_VIEW_H__
+#define __PH_FAVORTIE_VIEW_H__
+
+void ph_favor_update_button_status(ph_favorite_data *favor_d);
+Evas_Object* ph_favor_create_value_list_popup(ph_favorite_data *favor_d, ph_favor_info *f_info);
+void ph_favor_load_mf_list(void *data);
+void ph_favor_fill_mf_gengrid(ph_favorite_data *favor_d);
+void ph_favor_fill_favor_gengrid(ph_favorite_data *favor_d);
+void ph_favor_load_favor_list(ph_favorite_data *favor_d);
+void ph_favor_data_lazy_update(const char *view_uri, void *data);
+
+#endif /* __PH_FAVORTIE_VIEW_H__ */
+
diff --git a/lib/images/contact_images/00_Nocontents_picture.png b/lib/images/contact_images/00_Nocontents_picture.png
new file mode 100755
index 0000000..2c5687b
--- /dev/null
+++ b/lib/images/contact_images/00_Nocontents_picture.png
Binary files differ
diff --git a/lib/images/contact_images/00_check_checking.png b/lib/images/contact_images/00_check_checking.png
new file mode 100755
index 0000000..c6ce824
--- /dev/null
+++ b/lib/images/contact_images/00_check_checking.png
Binary files differ
diff --git a/lib/images/contact_images/00_list_group_bg.png b/lib/images/contact_images/00_list_group_bg.png
new file mode 100644
index 0000000..1260007
--- /dev/null
+++ b/lib/images/contact_images/00_list_group_bg.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_add-to-bookmarks.png b/lib/images/contact_images/01_controlbar_icon_add-to-bookmarks.png
new file mode 100644
index 0000000..bc2e48b
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_add-to-bookmarks.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_add_account.png b/lib/images/contact_images/01_controlbar_icon_add_account.png
new file mode 100644
index 0000000..e5803cd
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_add_account.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_add_to_contact.png b/lib/images/contact_images/01_controlbar_icon_add_to_contact.png
new file mode 100644
index 0000000..65d47e4
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_add_to_contact.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_bluetooth_preview.png b/lib/images/contact_images/01_controlbar_icon_bluetooth_preview.png
new file mode 100644
index 0000000..99946bb
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_bluetooth_preview.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_close.png b/lib/images/contact_images/01_controlbar_icon_close.png
new file mode 100644
index 0000000..91b04e5
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_close.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_exchangs_register.png b/lib/images/contact_images/01_controlbar_icon_exchangs_register.png
new file mode 100644
index 0000000..58c6e27
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_exchangs_register.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_groups.png b/lib/images/contact_images/01_controlbar_icon_groups.png
new file mode 100644
index 0000000..e793512
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_groups.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_more.png b/lib/images/contact_images/01_controlbar_icon_more.png
new file mode 100644
index 0000000..651c8e1
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_more.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_next.png b/lib/images/contact_images/01_controlbar_icon_next.png
new file mode 100644
index 0000000..4a0505e
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_next.png
Binary files differ
diff --git a/lib/images/contact_images/01_controlbar_icon_previous.png b/lib/images/contact_images/01_controlbar_icon_previous.png
new file mode 100644
index 0000000..066f51c
--- /dev/null
+++ b/lib/images/contact_images/01_controlbar_icon_previous.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_00.png b/lib/images/contact_images/C02_account_00.png
new file mode 100644
index 0000000..e0b5b0c
--- /dev/null
+++ b/lib/images/contact_images/C02_account_00.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_01.png b/lib/images/contact_images/C02_account_01.png
new file mode 100644
index 0000000..f58f271
--- /dev/null
+++ b/lib/images/contact_images/C02_account_01.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_02.png b/lib/images/contact_images/C02_account_02.png
new file mode 100644
index 0000000..f90a630
--- /dev/null
+++ b/lib/images/contact_images/C02_account_02.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_03.png b/lib/images/contact_images/C02_account_03.png
new file mode 100644
index 0000000..85af61a
--- /dev/null
+++ b/lib/images/contact_images/C02_account_03.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_04.png b/lib/images/contact_images/C02_account_04.png
new file mode 100644
index 0000000..fb8a161
--- /dev/null
+++ b/lib/images/contact_images/C02_account_04.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_default.png b/lib/images/contact_images/C02_account_default.png
new file mode 100644
index 0000000..900dcde
--- /dev/null
+++ b/lib/images/contact_images/C02_account_default.png
Binary files differ
diff --git a/lib/images/contact_images/C02_account_sim.png b/lib/images/contact_images/C02_account_sim.png
new file mode 100644
index 0000000..4337a93
--- /dev/null
+++ b/lib/images/contact_images/C02_account_sim.png
Binary files differ
diff --git a/lib/images/contact_images/C02_caller_id_icon_camera.png b/lib/images/contact_images/C02_caller_id_icon_camera.png
new file mode 100755
index 0000000..f693362
--- /dev/null
+++ b/lib/images/contact_images/C02_caller_id_icon_camera.png
Binary files differ
diff --git a/lib/images/contact_images/C02_caller_id_icon_camera_dim.png b/lib/images/contact_images/C02_caller_id_icon_camera_dim.png
new file mode 100755
index 0000000..04dc3e5
--- /dev/null
+++ b/lib/images/contact_images/C02_caller_id_icon_camera_dim.png
Binary files differ
diff --git a/lib/images/contact_images/C02_caller_id_icon_camera_press.png b/lib/images/contact_images/C02_caller_id_icon_camera_press.png
new file mode 100755
index 0000000..3768438
--- /dev/null
+++ b/lib/images/contact_images/C02_caller_id_icon_camera_press.png
Binary files differ
diff --git a/lib/images/contact_images/C02_caller_id_icon_gallery.png b/lib/images/contact_images/C02_caller_id_icon_gallery.png
new file mode 100755
index 0000000..7fab4bd
--- /dev/null
+++ b/lib/images/contact_images/C02_caller_id_icon_gallery.png
Binary files differ
diff --git a/lib/images/contact_images/C02_caller_id_icon_gallery_dim.png b/lib/images/contact_images/C02_caller_id_icon_gallery_dim.png
new file mode 100755
index 0000000..b05d4ca
--- /dev/null
+++ b/lib/images/contact_images/C02_caller_id_icon_gallery_dim.png
Binary files differ
diff --git a/lib/images/contact_images/C02_caller_id_icon_gallery_press.png b/lib/images/contact_images/C02_caller_id_icon_gallery_press.png
new file mode 100755
index 0000000..bb0fac3
--- /dev/null
+++ b/lib/images/contact_images/C02_caller_id_icon_gallery_press.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_button.png b/lib/images/contact_images/C02_circle_button.png
new file mode 100755
index 0000000..5e58d0d
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_button.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_button_press.png b/lib/images/contact_images/C02_circle_button_press.png
new file mode 100755
index 0000000..8ea6881
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_button_press.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_icon_call.png b/lib/images/contact_images/C02_circle_icon_call.png
new file mode 100755
index 0000000..ef1bcea
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_icon_call.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_icon_call_press.png b/lib/images/contact_images/C02_circle_icon_call_press.png
new file mode 100755
index 0000000..c1bed80
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_icon_call_press.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_icon_sms.png b/lib/images/contact_images/C02_circle_icon_sms.png
new file mode 100755
index 0000000..6744857
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_icon_sms.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_icon_sms_press.png b/lib/images/contact_images/C02_circle_icon_sms_press.png
new file mode 100755
index 0000000..ff6b712
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_icon_sms_press.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_icon_vt-call.png b/lib/images/contact_images/C02_circle_icon_vt-call.png
new file mode 100755
index 0000000..8a60957
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_icon_vt-call.png
Binary files differ
diff --git a/lib/images/contact_images/C02_circle_icon_vt-call_press.png b/lib/images/contact_images/C02_circle_icon_vt-call_press.png
new file mode 100755
index 0000000..8a8a2d2
--- /dev/null
+++ b/lib/images/contact_images/C02_circle_icon_vt-call_press.png
Binary files differ
diff --git a/lib/images/contact_images/C02_favorite_icon.png b/lib/images/contact_images/C02_favorite_icon.png
new file mode 100755
index 0000000..25e68fe
--- /dev/null
+++ b/lib/images/contact_images/C02_favorite_icon.png
Binary files differ
diff --git a/lib/images/contact_images/C02_icon_add_group.png b/lib/images/contact_images/C02_icon_add_group.png
new file mode 100644
index 0000000..2e5e5b6
--- /dev/null
+++ b/lib/images/contact_images/C02_icon_add_group.png
Binary files differ
diff --git a/lib/images/contact_images/C02_icon_favorite.png b/lib/images/contact_images/C02_icon_favorite.png
new file mode 100644
index 0000000..3792de0
--- /dev/null
+++ b/lib/images/contact_images/C02_icon_favorite.png
Binary files differ
diff --git a/lib/images/contact_images/C02_icon_favorite_on.png b/lib/images/contact_images/C02_icon_favorite_on.png
new file mode 100644
index 0000000..69608a3
--- /dev/null
+++ b/lib/images/contact_images/C02_icon_favorite_on.png
Binary files differ
diff --git a/lib/images/contact_images/C02_icon_reset.png b/lib/images/contact_images/C02_icon_reset.png
new file mode 100644
index 0000000..af4e43a
--- /dev/null
+++ b/lib/images/contact_images/C02_icon_reset.png
Binary files differ
diff --git a/lib/images/contact_images/C04_icon_joyn.png b/lib/images/contact_images/C04_icon_joyn.png
new file mode 100644
index 0000000..4a22f31
--- /dev/null
+++ b/lib/images/contact_images/C04_icon_joyn.png
Binary files differ
diff --git a/lib/images/contact_images/caller_ID_default_128x128.png b/lib/images/contact_images/caller_ID_default_128x128.png
new file mode 100644
index 0000000..40ebebb
--- /dev/null
+++ b/lib/images/contact_images/caller_ID_default_128x128.png
Binary files differ
diff --git a/lib/images/contact_images/caller_ID_default_96x96.png b/lib/images/contact_images/caller_ID_default_96x96.png
new file mode 100644
index 0000000..271c3bf
--- /dev/null
+++ b/lib/images/contact_images/caller_ID_default_96x96.png
Binary files differ
diff --git a/lib/images/contact_images/caller_ID_edit.png b/lib/images/contact_images/caller_ID_edit.png
new file mode 100644
index 0000000..90999b9
--- /dev/null
+++ b/lib/images/contact_images/caller_ID_edit.png
Binary files differ
diff --git a/lib/images/contact_images/email.png b/lib/images/contact_images/email.png
new file mode 100755
index 0000000..b2c38ee
--- /dev/null
+++ b/lib/images/contact_images/email.png
Binary files differ
diff --git a/lib/images/contact_images/message.png b/lib/images/contact_images/message.png
new file mode 100644
index 0000000..8bf4018
--- /dev/null
+++ b/lib/images/contact_images/message.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_button_01.png b/lib/images/dialer_images/C01-3_button_01.png
new file mode 100755
index 0000000..c09e6c7
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_button_01.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_button_01_dim.png b/lib/images/dialer_images/C01-3_button_01_dim.png
new file mode 100755
index 0000000..c09e6c7
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_button_01_dim.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_button_01_press.png b/lib/images/dialer_images/C01-3_button_01_press.png
new file mode 100755
index 0000000..1d16c04
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_button_01_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_button_02.png b/lib/images/dialer_images/C01-3_button_02.png
new file mode 100755
index 0000000..2efd47b
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_button_02.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_button_02_dim.png b/lib/images/dialer_images/C01-3_button_02_dim.png
new file mode 100755
index 0000000..160ea8c
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_button_02_dim.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_button_02_press.png b/lib/images/dialer_images/C01-3_button_02_press.png
new file mode 100755
index 0000000..01a7a09
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_button_02_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_dialer_button_01_press.png b/lib/images/dialer_images/C01-3_dialer_button_01_press.png
new file mode 100755
index 0000000..8e3828c
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_dialer_button_01_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_call.png b/lib/images/dialer_images/C01-3_icon_call.png
new file mode 100755
index 0000000..99d1106
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_call.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_call_dim.png b/lib/images/dialer_images/C01-3_icon_call_dim.png
new file mode 100755
index 0000000..a842230
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_call_dim.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_call_press.png b/lib/images/dialer_images/C01-3_icon_call_press.png
new file mode 100755
index 0000000..99d1106
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_call_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_delete.png b/lib/images/dialer_images/C01-3_icon_delete.png
new file mode 100755
index 0000000..bd28860
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_delete.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_expand_01.png b/lib/images/dialer_images/C01-3_icon_expand_01.png
new file mode 100755
index 0000000..3dd2f42
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_expand_01.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_expand_02.png b/lib/images/dialer_images/C01-3_icon_expand_02.png
new file mode 100755
index 0000000..26f2392
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_expand_02.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_message.png b/lib/images/dialer_images/C01-3_icon_message.png
new file mode 100755
index 0000000..708d2fb
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_message.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_message_dim.png b/lib/images/dialer_images/C01-3_icon_message_dim.png
new file mode 100755
index 0000000..0bd3a62
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_message_dim.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_message_press.png b/lib/images/dialer_images/C01-3_icon_message_press.png
new file mode 100755
index 0000000..38a1170
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_message_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_video_call.png b/lib/images/dialer_images/C01-3_icon_video_call.png
new file mode 100755
index 0000000..fbd7ed5
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_video_call.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_video_call_dim.png b/lib/images/dialer_images/C01-3_icon_video_call_dim.png
new file mode 100755
index 0000000..4381a10
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_video_call_dim.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_icon_video_call_press.png b/lib/images/dialer_images/C01-3_icon_video_call_press.png
new file mode 100755
index 0000000..451989b
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_icon_video_call_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_keypad_bg.png b/lib/images/dialer_images/C01-3_keypad_bg.png
new file mode 100755
index 0000000..4fe7f55
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_keypad_bg.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_keypad_bg_reduction.png b/lib/images/dialer_images/C01-3_keypad_bg_reduction.png
new file mode 100755
index 0000000..f73eda7
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_keypad_bg_reduction.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_keypad_press.png b/lib/images/dialer_images/C01-3_keypad_press.png
new file mode 100755
index 0000000..8a285a4
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_keypad_press.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_search_bg_01.png b/lib/images/dialer_images/C01-3_search_bg_01.png
new file mode 100755
index 0000000..a26b028
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_search_bg_01.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_search_bg_02.png b/lib/images/dialer_images/C01-3_search_bg_02.png
new file mode 100755
index 0000000..7390011
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_search_bg_02.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_search_field.png b/lib/images/dialer_images/C01-3_search_field.png
new file mode 100755
index 0000000..910a7ad
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_search_field.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_search_icon.png b/lib/images/dialer_images/C01-3_search_icon.png
new file mode 100755
index 0000000..9620613
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_search_icon.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_thumbnail_bg.png b/lib/images/dialer_images/C01-3_thumbnail_bg.png
new file mode 100755
index 0000000..7864c2a
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_thumbnail_bg.png
Binary files differ
diff --git a/lib/images/dialer_images/C01-3_title_divider.png b/lib/images/dialer_images/C01-3_title_divider.png
new file mode 100755
index 0000000..165505e
--- /dev/null
+++ b/lib/images/dialer_images/C01-3_title_divider.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_00.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_00.png
new file mode 100755
index 0000000..db81ec0
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_00.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_01.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_01.png
new file mode 100755
index 0000000..0f06a05
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_01.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_02.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_02.png
new file mode 100755
index 0000000..eef7198
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_02.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_03.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_03.png
new file mode 100755
index 0000000..c7381c8
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_03.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_04.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_04.png
new file mode 100755
index 0000000..cbc9274
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_04.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_05.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_05.png
new file mode 100755
index 0000000..91a8ee6
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_05.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_06.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_06.png
new file mode 100755
index 0000000..a8cba0e
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_06.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_07.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_07.png
new file mode 100755
index 0000000..faaf57a
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_07.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_08.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_08.png
new file mode 100755
index 0000000..c7f7db3
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_08.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_09.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_09.png
new file mode 100755
index 0000000..acbcaa1
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_09.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_asterisk.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_asterisk.png
new file mode 100755
index 0000000..96b4d38
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_asterisk.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_auto_answer.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_auto_answer.png
new file mode 100755
index 0000000..7d2329e
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_auto_answer.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_mute.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_mute.png
new file mode 100755
index 0000000..ac24879
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_mute.png
Binary files differ
diff --git a/lib/images/dialer_images/keypad/C01-3_keypad_number_sharp.png b/lib/images/dialer_images/keypad/C01-3_keypad_number_sharp.png
new file mode 100755
index 0000000..76f9120
--- /dev/null
+++ b/lib/images/dialer_images/keypad/C01-3_keypad_number_sharp.png
Binary files differ
diff --git a/lib/images/phoneug_images/00_button_icon_expand_closed.png b/lib/images/phoneug_images/00_button_icon_expand_closed.png
new file mode 100644
index 0000000..acca071
--- /dev/null
+++ b/lib/images/phoneug_images/00_button_icon_expand_closed.png
Binary files differ
diff --git a/lib/images/phoneug_images/00_button_icon_expand_opened.png b/lib/images/phoneug_images/00_button_icon_expand_opened.png
new file mode 100644
index 0000000..cd36ac1
--- /dev/null
+++ b/lib/images/phoneug_images/00_button_icon_expand_opened.png
Binary files differ
diff --git a/lib/images/phoneug_images/00_button_plus.png b/lib/images/phoneug_images/00_button_plus.png
new file mode 100755
index 0000000..f5b3445
--- /dev/null
+++ b/lib/images/phoneug_images/00_button_plus.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_contacts.png b/lib/images/phoneug_images/01_controlbar_icon_contacts.png
new file mode 100644
index 0000000..a376989
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_contacts.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_create.png b/lib/images/phoneug_images/01_controlbar_icon_create.png
new file mode 100644
index 0000000..0dc1144
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_create.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_dialer.png b/lib/images/phoneug_images/01_controlbar_icon_dialer.png
new file mode 100644
index 0000000..1ad19c7
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_dialer.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_edit.png b/lib/images/phoneug_images/01_controlbar_icon_edit.png
new file mode 100644
index 0000000..4ddc598
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_edit.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_favorite.png b/lib/images/phoneug_images/01_controlbar_icon_favorite.png
new file mode 100644
index 0000000..aa13cf9
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_favorite.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_logs.png b/lib/images/phoneug_images/01_controlbar_icon_logs.png
new file mode 100644
index 0000000..384341b
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_logs.png
Binary files differ
diff --git a/lib/images/phoneug_images/01_controlbar_icon_save.png b/lib/images/phoneug_images/01_controlbar_icon_save.png
new file mode 100644
index 0000000..f8a9278
--- /dev/null
+++ b/lib/images/phoneug_images/01_controlbar_icon_save.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_btn_icon_call_dim.png b/lib/images/phoneug_images/C01-4_btn_icon_call_dim.png
new file mode 100644
index 0000000..d2a68f6
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_btn_icon_call_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_btn_icon_message_dim.png b/lib/images/phoneug_images/C01-4_btn_icon_message_dim.png
new file mode 100644
index 0000000..485ff79
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_btn_icon_message_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_btn_icon_video_call_dim.png b/lib/images/phoneug_images/C01-4_btn_icon_video_call_dim.png
new file mode 100644
index 0000000..29ce012
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_btn_icon_video_call_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_circle_button.png b/lib/images/phoneug_images/C01-4_circle_button.png
new file mode 100755
index 0000000..5e58d0d
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_circle_button.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_circle_button_press.png b/lib/images/phoneug_images/C01-4_circle_button_press.png
new file mode 100755
index 0000000..8ea6881
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_circle_button_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_controlbar_icon_all.png b/lib/images/phoneug_images/C01-4_controlbar_icon_all.png
new file mode 100755
index 0000000..68528a2
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_controlbar_icon_all.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_controlbar_icon_create.png b/lib/images/phoneug_images/C01-4_controlbar_icon_create.png
new file mode 100755
index 0000000..85b897d
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_controlbar_icon_create.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_controlbar_icon_delete.png b/lib/images/phoneug_images/C01-4_controlbar_icon_delete.png
new file mode 100755
index 0000000..33a6bc7
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_controlbar_icon_delete.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_controlbar_icon_missed_call.png b/lib/images/phoneug_images/C01-4_controlbar_icon_missed_call.png
new file mode 100755
index 0000000..88aeafa
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_controlbar_icon_missed_call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_controlbar_icon_view_block.png b/lib/images/phoneug_images/C01-4_controlbar_icon_view_block.png
new file mode 100755
index 0000000..7ac55b9
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_controlbar_icon_view_block.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_controlbar_icon_view_contacts.png b/lib/images/phoneug_images/C01-4_controlbar_icon_view_contacts.png
new file mode 100755
index 0000000..a376989
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_controlbar_icon_view_contacts.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_Blocked(Auto-rejected).png b/lib/images/phoneug_images/C01-4_icon_Blocked(Auto-rejected).png
new file mode 100644
index 0000000..7f2cf70
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_Blocked(Auto-rejected).png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_Blocked.png b/lib/images/phoneug_images/C01-4_icon_Blocked.png
new file mode 100755
index 0000000..a1cefa4
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_Blocked.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_call_blocked.png b/lib/images/phoneug_images/C01-4_icon_call_blocked.png
new file mode 100755
index 0000000..f3934be
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_call_blocked.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_dialed.png b/lib/images/phoneug_images/C01-4_icon_dialed.png
new file mode 100644
index 0000000..42de25c
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_dialed.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_message_blocked.png b/lib/images/phoneug_images/C01-4_icon_message_blocked.png
new file mode 100755
index 0000000..e665864
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_message_blocked.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_missed-call.png b/lib/images/phoneug_images/C01-4_icon_missed-call.png
new file mode 100644
index 0000000..e55863e
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_missed-call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_received.png b/lib/images/phoneug_images/C01-4_icon_received.png
new file mode 100644
index 0000000..08643a9
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_received.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_icon_rejected.png b/lib/images/phoneug_images/C01-4_icon_rejected.png
new file mode 100644
index 0000000..340e373
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_icon_rejected.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_list_icon_call.png b/lib/images/phoneug_images/C01-4_list_icon_call.png
new file mode 100755
index 0000000..576ecab
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_list_icon_call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_list_icon_mms.png b/lib/images/phoneug_images/C01-4_list_icon_mms.png
new file mode 100644
index 0000000..aef7f9c
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_list_icon_mms.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_list_icon_sms.png b/lib/images/phoneug_images/C01-4_list_icon_sms.png
new file mode 100644
index 0000000..399733d
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_list_icon_sms.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-4_list_icon_vt-call.png b/lib/images/phoneug_images/C01-4_list_icon_vt-call.png
new file mode 100644
index 0000000..2e9f301
--- /dev/null
+++ b/lib/images/phoneug_images/C01-4_list_icon_vt-call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C01-5_icon_voicecall.png b/lib/images/phoneug_images/C01-5_icon_voicecall.png
new file mode 100755
index 0000000..73f06db
--- /dev/null
+++ b/lib/images/phoneug_images/C01-5_icon_voicecall.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_call.png b/lib/images/phoneug_images/C02_button_icon_call.png
new file mode 100755
index 0000000..cbb910e
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_call_dim.png b/lib/images/phoneug_images/C02_button_icon_call_dim.png
new file mode 100755
index 0000000..31c0684
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_call_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_call_press.png b/lib/images/phoneug_images/C02_button_icon_call_press.png
new file mode 100755
index 0000000..07fe96d
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_call_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_delete.png b/lib/images/phoneug_images/C02_button_icon_delete.png
new file mode 100755
index 0000000..aac7f53
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_delete.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_delete_dim.png b/lib/images/phoneug_images/C02_button_icon_delete_dim.png
new file mode 100755
index 0000000..58ce082
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_delete_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_delete_press.png b/lib/images/phoneug_images/C02_button_icon_delete_press.png
new file mode 100755
index 0000000..aac7f53
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_delete_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_message.png b/lib/images/phoneug_images/C02_button_icon_message.png
new file mode 100755
index 0000000..456b1fb
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_message.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_message_dim.png b/lib/images/phoneug_images/C02_button_icon_message_dim.png
new file mode 100755
index 0000000..7a6ce6f
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_message_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_message_press.png b/lib/images/phoneug_images/C02_button_icon_message_press.png
new file mode 100755
index 0000000..96297a4
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_message_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_videocall.png b/lib/images/phoneug_images/C02_button_icon_videocall.png
new file mode 100755
index 0000000..f7b2208
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_videocall.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_videocall_dim.png b/lib/images/phoneug_images/C02_button_icon_videocall_dim.png
new file mode 100755
index 0000000..77d4fb9
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_videocall_dim.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_button_icon_videocall_press.png b/lib/images/phoneug_images/C02_button_icon_videocall_press.png
new file mode 100755
index 0000000..6596599
--- /dev/null
+++ b/lib/images/phoneug_images/C02_button_icon_videocall_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_circle_icon_call.png b/lib/images/phoneug_images/C02_circle_icon_call.png
new file mode 100755
index 0000000..3df40d6
--- /dev/null
+++ b/lib/images/phoneug_images/C02_circle_icon_call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_circle_icon_call_press.png b/lib/images/phoneug_images/C02_circle_icon_call_press.png
new file mode 100755
index 0000000..c1bed80
--- /dev/null
+++ b/lib/images/phoneug_images/C02_circle_icon_call_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_circle_icon_sms.png b/lib/images/phoneug_images/C02_circle_icon_sms.png
new file mode 100755
index 0000000..a9d0ad6
--- /dev/null
+++ b/lib/images/phoneug_images/C02_circle_icon_sms.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_circle_icon_sms_press.png b/lib/images/phoneug_images/C02_circle_icon_sms_press.png
new file mode 100755
index 0000000..ff6b712
--- /dev/null
+++ b/lib/images/phoneug_images/C02_circle_icon_sms_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_circle_icon_vt-call.png b/lib/images/phoneug_images/C02_circle_icon_vt-call.png
new file mode 100755
index 0000000..0acd851
--- /dev/null
+++ b/lib/images/phoneug_images/C02_circle_icon_vt-call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_circle_icon_vt-call_press.png b/lib/images/phoneug_images/C02_circle_icon_vt-call_press.png
new file mode 100755
index 0000000..8a8a2d2
--- /dev/null
+++ b/lib/images/phoneug_images/C02_circle_icon_vt-call_press.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_icon_call.png b/lib/images/phoneug_images/C02_icon_call.png
new file mode 100644
index 0000000..0b1038e
--- /dev/null
+++ b/lib/images/phoneug_images/C02_icon_call.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_icon_chat_on.png b/lib/images/phoneug_images/C02_icon_chat_on.png
new file mode 100644
index 0000000..290857a
--- /dev/null
+++ b/lib/images/phoneug_images/C02_icon_chat_on.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_icon_filetransfer.png b/lib/images/phoneug_images/C02_icon_filetransfer.png
new file mode 100644
index 0000000..ad235c7
--- /dev/null
+++ b/lib/images/phoneug_images/C02_icon_filetransfer.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_icon_message.png b/lib/images/phoneug_images/C02_icon_message.png
new file mode 100644
index 0000000..1eddabc
--- /dev/null
+++ b/lib/images/phoneug_images/C02_icon_message.png
Binary files differ
diff --git a/lib/images/phoneug_images/C02_icon_video_call.png b/lib/images/phoneug_images/C02_icon_video_call.png
new file mode 100644
index 0000000..6c928ce
--- /dev/null
+++ b/lib/images/phoneug_images/C02_icon_video_call.png
Binary files differ
diff --git a/lib/images/phoneug_images/caller_ID_default_70x70_man.png b/lib/images/phoneug_images/caller_ID_default_70x70_man.png
new file mode 100644
index 0000000..b8e9ed9
--- /dev/null
+++ b/lib/images/phoneug_images/caller_ID_default_70x70_man.png
Binary files differ
diff --git a/lib/images/phoneug_images/camera_mode_shutter_icon.png b/lib/images/phoneug_images/camera_mode_shutter_icon.png
new file mode 100755
index 0000000..10b2004
--- /dev/null
+++ b/lib/images/phoneug_images/camera_mode_shutter_icon.png
Binary files differ
diff --git a/lib/images/phoneug_images/phone.png b/lib/images/phoneug_images/phone.png
new file mode 100644
index 0000000..d0f4eae
--- /dev/null
+++ b/lib/images/phoneug_images/phone.png
Binary files differ
diff --git a/lib/list/CMakeLists.txt b/lib/list/CMakeLists.txt
new file mode 100755
index 0000000..9eedbca
--- /dev/null
+++ b/lib/list/CMakeLists.txt
@@ -0,0 +1,18 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${CT_LIST})
+
+FILE(GLOB SRCS *.c)
+
+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} ${CT_DETAILS})
+
+ADD_DEPENDENCIES(${TARGET} contacts_edj_build contacts_theme_build group_theme_edj_build image_layout_edj_build list_theme_edj_build contact_button_edj_build)
+
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/list/contacts-list-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/list/contacts-list-efl.xml b/lib/list/contacts-list-efl.xml
new file mode 100644
index 0000000..8da8ff5
--- /dev/null
+++ b/lib/list/contacts-list-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="contacts-list-efl" version="0.1.0-0" install-location="internal-only">
+ <label>contacts-list</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>contacts-list-efl Application</description>
+ <ui-application appid="contacts-list-efl" exec="/usr/ug/bin/contacts-list-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.contacts.png</icon>
+ <label>contacts-list</label>
+ <label xml:lang="en-us">contacts-list</label>
+ <label xml:lang="nl-nl">contacts-list</label>
+ <label xml:lang="de-de">contacts-list</label>
+ <label xml:lang="en-gb">contacts-list</label>
+ <label xml:lang="zh-hk">contacts-list</label>
+ <label xml:lang="zh-cn">contacts-list</label>
+ <label xml:lang="ru-ru">contacts-list</label>
+ <label xml:lang="zh-tw">contacts-list</label>
+ <label xml:lang="ja-jp">contacts-list</label>
+ <label xml:lang="es-es">contacts-list</label>
+ <label xml:lang="el-gr">contacts-list</label>
+ <label xml:lang="it-it">contacts-list</label>
+ <label xml:lang="tr-tr">contacts-list</label>
+ <label xml:lang="pt-pt">contacts-list</label>
+ <label xml:lang="fr-fr">contacts-list</label>
+ <label xml:lang="ko-kr">contacts-list</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/lib/list/ct-group-edit-view.h b/lib/list/ct-group-edit-view.h
new file mode 100755
index 0000000..10f6120
--- /dev/null
+++ b/lib/list/ct-group-edit-view.h
@@ -0,0 +1,23 @@
+/*
+* 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_EDIT_VIEW_H__
+#define __CT_GROUP_EDIT_VIEW_H__
+
+void ctui_gedit_push_view(Evas_Object *win, Evas_Object *navi, ct_group_list *info, ct_group_rename_update_cb fn, void *fn_data);
+
+#endif /* __CT_GROUP_EDIT_VIEW_H__ */
diff --git a/lib/list/ct-group-view.c b/lib/list/ct-group-view.c
new file mode 100755
index 0000000..c6abf9c
--- /dev/null
+++ b/lib/list/ct-group-view.c
@@ -0,0 +1,1270 @@
+/*
+ * 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 <vconf.h>
+#include <vconf-keys.h>
+#include <fcntl.h>
+#include <app_service.h>
+#include <Ecore_X.h>
+#include <ui-gadget-module.h>
+#include <account.h>
+#include "phone.h"
+#include "ct-list.h"
+#include "ct-group.h"
+#include "ct-list-utils.h"
+#include "ct-list-contact-view.h"
+
+#define KEY_GROUP_DATA "cgroup_d"
+
+enum {
+ GROUP_MODE_NORMAL,
+ GROUP_MODE_EDIT,
+};
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *popup;
+ Evas_Object *gengrid;
+ Ecore_Timer *update_timer;
+ Ecore_Timer *waiting_timer;
+ Evas_Object *ctrl_button;
+ Evas_Object *delete_button;
+ Elm_Object_Item *navi_item;
+ Elm_Theme *th;
+ bool is_background;
+ int count;
+ int ug_request;
+ int ug_cnt_max;
+ int group_mode;
+ void *ug;
+ void *child_ug;
+ void *crop_ug;
+ void *src_ug;
+ char *ug_data;
+ bool need_update;
+} ct_group_data;
+
+enum GROUP_ITC_TYPE{
+ GROUP_ITC_1IMAGE,
+ GROUP_ITC_2IMAGE,
+ GROUP_ITC_3IMAGE,
+ GROUP_ITC_6IMAGE,
+ GROUP_ITC_GROUP_TITLE,
+ GROUP_ITC_MAX,
+};
+
+static Elm_Gengrid_Item_Class group_itcs[] = {
+ {.item_style="groupitem.1image"},
+ {.item_style="groupitem.2image"},
+ {.item_style="groupitem.3image"},
+ {.item_style="groupitem.6image"},
+ {.item_style="group_index"},
+};
+
+
+static Eina_Bool group_changed(void *user_data);
+
+static void group_gl_del(void *data, Evas_Object *obj)
+{
+ int i;
+ ct_group_list *info = data;
+ p_retm_if(NULL == info, "data is NULL");
+
+ for (i=0;i<6;i++)
+ free(info->img_list[i]);
+ free(info->img);
+ free(info->name);
+ free(info);
+}
+
+static char* group_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PH_TEXT_MAX_LEN];
+ ct_group_list *info = data;
+ ct_group_data *cgroup_d;
+
+ p_retvm_if(NULL == data, NULL, "The parameter(data) is NULL");
+
+ cgroup_d = evas_object_data_get(obj, KEY_GROUP_DATA);
+ p_retvm_if(NULL == cgroup_d, NULL, "evas_object_data_get() return NULL");
+
+ if ((0 == strcmp(part, "text.name") && cgroup_d->group_mode == GROUP_MODE_NORMAL) ||
+ (0 == strcmp(part, "text.edit.name") && cgroup_d->group_mode == GROUP_MODE_EDIT)) {
+ if (info->name)
+ return strdup(info->name);
+ else
+ return strdup("Noname");
+ }
+ else if ((0 == strcmp(part, "text.count") && cgroup_d->group_mode == GROUP_MODE_NORMAL) ||
+ (0 == strcmp(part, "text.edit.count") && cgroup_d->group_mode == GROUP_MODE_EDIT)) {
+ snprintf(buf, sizeof(buf), "%d", info->count);
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static char* group_gl_index_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ char* title = data;
+
+ if (title && *title)
+ return strdup((const char *)data);
+
+ return NULL;
+}
+
+static void group_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon;
+ Evas_Object *btn;
+ ct_group_data *cgroup_d = data;
+ btn = evas_object_data_get(obj, "expand_btn");
+ if (btn)
+ {
+ icon = elm_object_part_content_get(btn, "icon");
+ elm_icon_file_set(icon, CTUI_IMG_ICON_EXPAND_OPENED, NULL);
+ elm_object_part_content_set(btn, "icon", icon);
+ }
+ evas_object_del(cgroup_d->popup);
+ cgroup_d->popup = NULL;
+}
+
+static void group_destroy_child_ug(void *data)
+{
+ ct_group_data *cgroup_d = data;
+ cgroup_d->child_ug = NULL;
+}
+
+API void phone_group_message_result_cb(void *data, int *list, int cnt)
+{
+ service_h service;
+ ui_gadget_h ug;
+ struct ug_cbs cbs = {0};
+ struct ug_priv_data *priv_data;
+ ct_group_data *cgroup_d = data;
+ char buf[PH_TEXT_MAX_LEN] = {'\0'};
+ char temp[PH_TEXT_MAX_LEN+1] = {'\0'};
+ int ret,i;
+ contacts_record_h number_record = NULL;
+ char *number;
+
+ p_retm_if(NULL == cgroup_d, "parameter(cgroup_d) is NULL");
+ p_retm_if(0 == cnt || NULL == list, "parameter(list) is NULL");
+
+ priv_data = calloc(1, sizeof(struct ug_priv_data));
+ p_retm_if(NULL == priv_data, "calloc is failed");
+
+ priv_data->destroy_cb = group_destroy_child_ug;
+ priv_data->cb_param = cgroup_d;
+
+ service_create(&service);
+
+ for(i = 0; i < cnt; i++){
+ ret = contacts_db_get_record(_contacts_number._uri,list[i],&number_record);
+ if(CONTACTS_ERROR_NONE != ret) {
+ ERR("contacts_db_get_record() Failed(%d)", ret);
+ continue;
+ }
+
+ contacts_record_get_str_p(number_record,_contacts_number.number,&number);
+ if (number && *number) {
+ if (*buf)
+ snprintf(temp, sizeof(temp), "%s", buf);
+ if (*temp)
+ snprintf(buf, sizeof(buf), "%s,%s", temp, number);
+ else
+ snprintf(buf, sizeof(buf), "%s", number);
+ }
+ contacts_record_destroy(number_record, true);
+ }
+ if(*buf){
+ PH_DBG("number %s", buf);
+ service_add_extra_data(service, "TO", 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(cgroup_d->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);
+ }
+ evas_object_smart_callback_del(cgroup_d->navi, "transition,finished", ctui_list_edit_navi_pop);
+ cgroup_d->child_ug = ug;
+}
+
+
+API void phone_group_email_result_cb(void *data, int *list, int cnt)
+{
+ service_h service;
+ Ecore_X_Window win_id;
+ ct_group_data *cgroup_d = data;
+ int ret,i;
+ char *email;
+ contacts_record_h email_record = NULL;
+ char buf[PH_TEXT_MAX_LEN+1] = {'\0'};
+ char temp[PH_TEXT_MAX_LEN+1] = {'\0'};
+
+ p_retm_if(NULL == cgroup_d, "parameter(cgroup_d) is NULL");
+ p_retm_if(0 == cnt || NULL == list, "parameter(list) is NULL");
+
+ win_id = elm_win_xwindow_get(cgroup_d->win);
+ service_create(&service);
+ service_set_app_id(service, EMAIL_COMPOSER_PKG);
+ service_set_window(service, win_id);
+
+ for(i = 0; i < cnt; i++){
+ ret = contacts_db_get_record(_contacts_email._uri,list[i],&email_record);
+ if (CONTACTS_ERROR_NONE != ret) {
+ ERR("contacts_db_get_record() Failed(%d)", ret);
+ continue;
+ }
+ contacts_record_get_str_p(email_record,_contacts_email.email,&email);
+ if (email && *email) {
+ if (*buf)
+ snprintf(temp, sizeof(temp), "%s", buf);
+
+ if (*temp)
+ snprintf(buf, sizeof(buf), "%s;%s", temp, email);
+ else
+ snprintf(buf, sizeof(buf), "%s", email);
+ }
+ contacts_record_destroy(email_record, true);
+ }
+ if(*buf){
+ PH_DBG("email %s", buf);
+ service_add_extra_data(service, SERVICE_DATA_TO, buf);
+ }
+
+ service_send_launch_request(service, NULL, NULL);
+ service_destroy(service);
+}
+
+static void group_notify_update(ct_group_data *cgroup_d)
+{
+ if (GROUP_MODE_NORMAL == cgroup_d->group_mode)
+ phone_hide_notify(cgroup_d->layout);
+ else {
+ if (0 < cgroup_d->count) {
+ char buf[PH_TEXT_MAX_LEN+1];
+ snprintf(buf, sizeof(buf), "%s (%d)", S_(PH_SYS_POP_SELECTED), cgroup_d->count);
+ phone_show_notify(cgroup_d->layout, buf);
+ }
+ else
+ phone_show_notify(cgroup_d->layout, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SELECT_GROUP));
+ }
+}
+
+static void group_edit_result_cb(int grp_id,void *data, bool changed)
+{
+ ct_group_data *cgroup_d = data;
+ group_notify_update(data);
+
+ if (changed) {
+ cgroup_d->group_mode = GROUP_MODE_NORMAL;
+ phone_hide_notify(cgroup_d->layout);
+ phone_group_set_navi(cgroup_d->layout);
+ }
+}
+
+static void group_edit_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_data *cgroup_d;
+ ct_group_list *info = data;
+
+ cgroup_d = evas_object_data_get(elm_object_item_widget_get(info->item), "cgroup_d");
+ p_retm_if(NULL == cgroup_d, "evas_object_data_get() return NULL");
+
+ phone_hide_notify(cgroup_d->layout);
+ ctui_create_group_input_view(cgroup_d->win, cgroup_d->navi, data, group_edit_result_cb, cgroup_d);
+}
+
+static void group_navi_item_update(ct_group_data *cgroup_d)
+{
+ if (0 < cgroup_d->count)
+ elm_object_disabled_set(cgroup_d->delete_button, EINA_FALSE);
+ else
+ elm_object_disabled_set(cgroup_d->delete_button, EINA_TRUE);
+}
+
+static void group_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_list *info = data;
+ ct_group_data *cgroup_d;
+ p_retm_if(NULL == data, "data is NULL");
+
+ cgroup_d = evas_object_data_get(elm_object_item_widget_get(info->item), "cgroup_d");
+ p_retm_if(NULL == cgroup_d, "evas_object_data_get() return NULL");
+
+ if (EINA_TRUE == info->selected && false == info->is_read_only)
+ cgroup_d->count++;
+ else
+ cgroup_d->count--;
+ group_navi_item_update(cgroup_d);
+ group_notify_update(cgroup_d);
+}
+
+static Evas_Object* group_gl_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *icon;
+ Evas_Object *button;
+ Evas_Object *check;
+ ct_group_data *cgroup_d;
+ ct_group_list *info = data;
+
+ cgroup_d = evas_object_data_get(obj, "cgroup_d");
+ p_retvm_if(NULL == cgroup_d, NULL, "evas_object_data_get() return NULL");
+
+ if (0 == strcmp(part, "swallow.icon")) {
+ if (CT_UG_REQUEST_SELECT_GROUP == cgroup_d->ug_request ||
+ CT_UG_REQUEST_SELECT_GROUP_ADD_TO_HOME == cgroup_d->ug_request)
+ return NULL;
+ if (GROUP_MODE_NORMAL == cgroup_d->group_mode)
+ return NULL;
+ else if (info->id_grp) {
+ button = elm_button_add(obj);
+ p_retvm_if(NULL == button, NULL, "elm_button_add() return NULL");
+ evas_object_propagate_events_set(button, EINA_FALSE);
+ elm_object_style_set(button, "rename");
+ evas_object_smart_callback_add(button, "clicked", group_edit_btn_cb, info);
+ return button;
+ }
+ }
+ else if (0 == strncmp(part, "swallow.content", 15)) {
+ int index = -1;
+ sscanf(part, "swallow.content%d", &index);
+ p_retvm_if(index<1 || 6<index, NULL, "index(%d) is out of range", index);
+
+ if (info->img && *info->img) {
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, info->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);
+ return icon;
+ }
+ else if (info->img_list[index-1] && *info->img_list[index-1]) {
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, info->img_list[index-1], 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);
+ return icon;
+ }
+ }
+ else if(0 == strcmp(part, "swallow.edit.icon") && GROUP_MODE_EDIT == cgroup_d->group_mode){
+ if (CT_UG_REQUEST_SELECT_GROUP == cgroup_d->ug_request)
+ return NULL;
+ if(info->is_read_only == true){
+ check = elm_check_add(obj);
+ p_retvm_if(NULL == check, NULL, "elm_check_add() return NULL");
+ evas_object_show(check);
+ elm_object_disabled_set(check,EINA_TRUE);
+ return check;
+ }
+
+ check = elm_check_add(obj);
+ p_retvm_if(NULL == check, NULL, "elm_check_add() return NULL");
+ evas_object_show(check);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ elm_check_state_pointer_set(check, &info->selected);
+ elm_check_state_set(check, info->selected);
+ evas_object_smart_callback_add(check, "changed", group_check_changed_cb, info);
+ return check;
+ }
+ return NULL;
+}
+
+static void __group_return_id(ui_gadget_h ug, int group_id)
+{
+ PH_FN_CALL;
+ service_h service = NULL;
+ char buf[16] = {0, };
+
+ service_create(&service);
+
+ if (group_id) {
+ snprintf(buf, sizeof(buf), "%d", group_id);
+ service_add_extra_data(service, CT_UG_BUNDLE_RESULT_GROUP_ID, buf);
+ }
+
+ PH_DBG("group_id=%d", group_id);
+ ug_send_result(ug, service);
+
+ service_destroy(service);
+}
+
+
+static void group_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ Elm_Object_Item *item = event_info;
+ ct_group_data *cgroup_d = data;
+ ct_group_list *info = elm_object_item_data_get(item);
+ ph_view_info *view_info;
+ p_retm_if(NULL == info, "elm_object_item_data_get() return NULL");
+
+ elm_gengrid_item_selected_set(item, EINA_FALSE);
+
+ if (CT_UG_REQUEST_SELECT_GROUP == cgroup_d->ug_request) {
+ __group_return_id(cgroup_d->ug, info->id_grp);
+ ug_destroy_me(cgroup_d->ug);
+ cgroup_d->ug = NULL;
+ }
+ else if (GROUP_MODE_NORMAL == cgroup_d->group_mode) {
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, cgroup_d->win, cgroup_d->navi, cgroup_d->ug, cgroup_d->ug_request,
+ cgroup_d->ug_cnt_max, cgroup_d->ug_data);
+
+ if (0 < info->id_grp)
+ ctui_list_create_contact_view_with_info(view_info, CT_GET_LIST_PERSON_OF_GROUP_ID, info);
+ else // not assigned
+ ctui_list_create_contact_view_with_info(view_info, CT_GET_LIST_PERSON_NOT_ASSIGNED_OF_ADDRBOOK_ID, info);
+ free(view_info);
+ }
+ else {
+
+ if(info->is_read_only == true)return; //skip default group
+
+ info->selected = !info->selected;
+ elm_gengrid_item_update(info->item);
+
+ if (EINA_TRUE == info->selected)
+ cgroup_d->count++;
+ else
+ cgroup_d->count--;
+
+ group_navi_item_update(cgroup_d);
+ group_notify_update(cgroup_d);
+ }
+}
+
+static void group_create_itcs()
+{
+ group_itcs[GROUP_ITC_GROUP_TITLE].func.text_get = group_gl_index_label_get;
+
+ group_itcs[GROUP_ITC_1IMAGE].func.text_get = group_gl_label_get;
+ group_itcs[GROUP_ITC_1IMAGE].func.content_get = group_gl_content_get;
+ group_itcs[GROUP_ITC_1IMAGE].func.del = group_gl_del;
+
+ group_itcs[GROUP_ITC_2IMAGE].func.text_get = group_gl_label_get;
+ group_itcs[GROUP_ITC_2IMAGE].func.content_get = group_gl_content_get;
+ group_itcs[GROUP_ITC_2IMAGE].func.del = group_gl_del;
+
+ group_itcs[GROUP_ITC_3IMAGE].func.text_get = group_gl_label_get;
+ group_itcs[GROUP_ITC_3IMAGE].func.content_get = group_gl_content_get;
+ group_itcs[GROUP_ITC_3IMAGE].func.del = group_gl_del;
+
+ group_itcs[GROUP_ITC_6IMAGE].func.text_get = group_gl_label_get;
+ group_itcs[GROUP_ITC_6IMAGE].func.content_get = group_gl_content_get;
+ group_itcs[GROUP_ITC_6IMAGE].func.del = group_gl_del;
+}
+
+static Elm_Gengrid_Item_Class* group_get_gengrid_item_class(const char *img, int count)
+{
+ PH_FN_CALL;
+ if ((img && *img) || count < 2)
+ return &group_itcs[GROUP_ITC_1IMAGE];
+ else if (2 == count)
+ return &group_itcs[GROUP_ITC_2IMAGE];
+ else if (3 == count)
+ return &group_itcs[GROUP_ITC_3IMAGE];
+ else
+ return &group_itcs[GROUP_ITC_6IMAGE];
+}
+
+static contacts_filter_h group_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 void __group_get_images(ct_group_list *info, contacts_list_h person_list)
+{
+ int cnt=0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ if(person_list == NULL) {
+ ERR("person list is null");
+ return;
+ }
+
+ err = contacts_list_get_current_record_p(person_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() Failed(%d)", err);
+ while(record)
+ {
+ char *path = NULL;
+ contacts_record_get_str_p(record,_contacts_person_grouprel.image_thumbnail_path, &path);
+ info->img_list[cnt++] = SAFE_STRDUP(path);
+ err = contacts_list_next(person_list);
+ if (CONTACTS_ERROR_NONE != err)
+ break;
+ contacts_list_get_current_record_p(person_list, &record);
+ if (5 < cnt) break;
+ }
+
+}
+
+
+static void __group_append_gengrid_of_ab(ct_group_data *cgroup_d, int ab_id, int ab_mode)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ unsigned int count = 0;
+ ct_group_list *info;
+ contacts_record_h record = NULL;
+ contacts_list_h group_list = NULL;
+ contacts_list_h person_list = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = 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 = phone_cts_get_list(_contacts_group._uri, _contacts_group.address_book_id, ab_id, &group_list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() Failed(%d)", err);
+
+ err = contacts_list_get_current_record_p(group_list, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+ while(record){
+ int grp_id;
+ char* img = NULL;
+ char* gname = NULL;
+ char* group_system_id = NULL;
+ bool is_read_only = false;
+
+ err = contacts_record_get_int(record,_contacts_group.id, &grp_id);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ info = calloc(1, sizeof(ct_group_list));
+ if (NULL == info) {
+ ERR("calloc() return NULL");
+ break;
+ }
+ info->id_ab = ab_id;
+ info->mode = ab_mode;
+ info->id_grp = grp_id;
+ 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);
+ info->img = SAFE_STRDUP(img);
+
+ contacts_record_get_str_p(record, _contacts_group.system_id, &group_system_id);
+ if (NULL != group_system_id) {
+ if (strcmp(group_system_id,"friends")==0)
+ info->name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_FRIENDS));
+ else if (strcmp(group_system_id,"family")==0)
+ info->name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_FAMILY));
+ else if (strcmp(group_system_id,"coworkers")==0)
+ info->name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_CO_WORKERS));
+ else
+ info->name = strdup(T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }
+ else {
+ 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);
+ info->name = SAFE_STRDUP(gname);
+ }
+
+ err = phone_cts_get_list(_contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, grp_id, &person_list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_list() Failed(%d)", err);
+
+ 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);
+ info->is_read_only = is_read_only;
+
+ err = contacts_list_get_count(person_list,&count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+ info->count = count;
+ __group_get_images(info, person_list);
+
+ info->item = elm_gengrid_item_append(cgroup_d->gengrid, group_get_gengrid_item_class(info->img, info->count), info, group_gl_sel, cgroup_d);
+
+ err = contacts_list_next(group_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ err = contacts_list_get_current_record_p(group_list, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_get_current_record_p() Failed(%d)", err);
+ break;
+ }
+ }
+ err = contacts_list_destroy(group_list, true);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+
+ err = contacts_query_create(_contacts_person_grouprel._uri, &query);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_query_create() Failed(%d)", err);
+
+ filter = group_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.address_book_id, CONTACTS_MATCH_EQUAL, ab_id);
+ filter = group_create_filter_int(filter, _contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, CONTACTS_MATCH_NONE, 0);
+
+ do {
+ 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 (CONTACTS_ERROR_NONE != (err = contacts_db_get_records_with_query(query, 0, 0, &person_list))) break;
+
+ err = contacts_list_get_count(person_list, &count);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+
+ if (0 < count && cgroup_d->group_mode == GROUP_MODE_NORMAL ) {
+ info = calloc(1, sizeof(ct_group_list));
+ p_retm_if(NULL == info, "calloc() return NULL");
+ info->id_ab = ab_id;
+ info->count = count;
+ info->mode = ab_mode;
+ if (0 == ab_id)
+ info->name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_NOT_ASSIGNED));
+ else
+ info->name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_ALL_CONTACTS));
+ __group_get_images(info, person_list);
+ info->item = elm_gengrid_item_append(cgroup_d->gengrid, group_get_gengrid_item_class(info->img, info->count), info, group_gl_sel, cgroup_d);
+ }
+ } while (0);
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+}
+
+static void __group_fill_layout(ct_group_data *cgroup_d)
+{
+ int ret;
+ contacts_record_h record = NULL;
+ contacts_list_h addressbook_list = NULL;
+
+ ret = contacts_db_get_all_records(_contacts_address_book._uri, 0,0, &addressbook_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_db_get_all_records() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(addressbook_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while(record){
+ int ab_id;
+ int ab_mode;
+ char *name;
+
+ ret = contacts_record_get_int(record,_contacts_address_book.id,&ab_id);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_get_int() Failed(%d)", ret);
+ if (0 == ab_id)
+ name = (char *)T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE);
+ else {
+ ret = contacts_record_get_str_p(record,_contacts_address_book.name,&name);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_get_str() Failed(%d)", ret);
+ }
+ ret = contacts_record_get_int(record,_contacts_address_book.mode,&ab_mode);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_get_int() Failed(%d)", ret);
+
+ if (GROUP_MODE_NORMAL == cgroup_d->group_mode || CONTACTS_ADDRESS_BOOK_MODE_READONLY != ab_mode) {
+ elm_gengrid_item_append(cgroup_d->gengrid, &group_itcs[GROUP_ITC_GROUP_TITLE], name, NULL, NULL);
+ __group_append_gengrid_of_ab(cgroup_d, ab_id, ab_mode);
+ }
+ ret = contacts_list_next(addressbook_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_next() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(addressbook_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ ret = contacts_list_destroy(addressbook_list, true);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_destroy() Failed(%d)", ret);
+}
+
+static void group_edit_mode_end(ct_group_data *cgroup_d, bool redraw)
+{
+ p_retm_if(NULL == cgroup_d, "parameter(cgroup_d) is NULL");
+ cgroup_d->count = 0;
+ phone_hide_notify(cgroup_d->layout);
+ cgroup_d->group_mode = GROUP_MODE_NORMAL;
+ if (redraw)
+ phone_group_set_navi(cgroup_d->layout);
+ elm_gengrid_clear(cgroup_d->gengrid);
+ __group_fill_layout(cgroup_d);
+}
+
+static Eina_Bool group_wait_changed(void *user_data)
+{
+ ct_group_data *cgroup_d = user_data;
+ ecore_timer_del(cgroup_d->waiting_timer);
+ cgroup_d->waiting_timer = NULL;
+ if(cgroup_d->need_update) {
+ PH_DBG("need to update");
+ cgroup_d->need_update = false;
+ group_changed(cgroup_d);
+ }
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+static Eina_Bool group_changed(void *user_data)
+{
+ ct_group_data *cgroup_d = user_data;
+ PH_DBG("group_changed");
+ if(cgroup_d->update_timer) {
+ ecore_timer_del(cgroup_d->update_timer);
+ cgroup_d->update_timer = NULL;
+ }
+
+ if(cgroup_d->waiting_timer) {
+ PH_DBG("waiting 3 seconds for group change");
+ cgroup_d->need_update = true;
+ return ECORE_CALLBACK_RENEW;;
+ }
+ else {
+ cgroup_d->waiting_timer = ecore_timer_add(3.0, group_wait_changed, cgroup_d);
+ }
+
+ elm_gengrid_clear(cgroup_d->gengrid);
+ __group_fill_layout(cgroup_d);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void group_data_lazy_update(const char* view_uri,void *data)
+{
+ PH_FN_CALL;
+ ct_group_data *cgroup_d = data;
+
+ if (cgroup_d->update_timer) {
+ ecore_timer_del(cgroup_d->update_timer);
+ cgroup_d->update_timer = NULL;
+ }
+
+ PH_DBG("cgroup_d->is_background = %d", cgroup_d->is_background);
+
+ if (cgroup_d->is_background)
+ cgroup_d->update_timer = ecore_timer_add(3.0, group_changed, cgroup_d);
+ else
+ group_changed(cgroup_d);
+
+ if(cgroup_d->group_mode == GROUP_MODE_EDIT)
+ group_edit_mode_end(cgroup_d, true);
+}
+
+static void group_delete_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ bool completed = true;
+ Elm_Object_Item *item;
+ const Elm_Gengrid_Item_Class *itc_temp;
+ ct_group_data *cgroup_d = data;
+
+ group_popup_hide_cb(cgroup_d, NULL, NULL);
+
+ item = elm_gengrid_first_item_get(cgroup_d->gengrid);
+
+ while (item) {
+ itc_temp = elm_gengrid_item_item_class_get(item);
+ if (0 == strcmp(itc_temp->item_style, group_itcs[GROUP_ITC_GROUP_TITLE].item_style)) {
+ item = elm_gengrid_item_next_get(item);
+ continue;
+ }
+
+ ct_group_list *info = elm_object_item_data_get(item);
+ if (info && info->selected) {
+ ret = contacts_db_delete_record(_contacts_group._uri,info->id_grp);
+ if (CONTACTS_ERROR_NONE != ret) {
+ ERR("Error : contacts_db_delete_record() Failed(%d)", ret);
+ completed = false;
+ break;
+ }
+ }
+ item = elm_gengrid_item_next_get(item);
+ }
+ if (completed)
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+
+ group_edit_mode_end(cgroup_d, true);
+}
+
+
+static void group_cacnel_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item;
+ ct_group_data *cgroup_d = data;
+ ct_group_list *info;
+ const Elm_Gengrid_Item_Class *itc_temp;
+
+ item = elm_gengrid_first_item_get(cgroup_d->gengrid);
+ while (item) {
+ itc_temp = elm_gengrid_item_item_class_get(item);
+ if (0 == strcmp(itc_temp->item_style, group_itcs[GROUP_ITC_GROUP_TITLE].item_style)) {
+ item = elm_gengrid_item_next_get(item);
+ continue;
+ }
+
+ info = elm_object_item_data_get(item);
+ if (NULL == info) continue;
+ info->selected = EINA_FALSE;
+ item = elm_gengrid_item_next_get(item);
+ }
+ group_edit_mode_end(cgroup_d, true);
+}
+
+static void group_edit_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_data *cgroup_d = data;
+ if (cgroup_d->popup){
+ evas_object_del(cgroup_d->popup);
+ cgroup_d->popup = NULL;
+ }
+
+ cgroup_d->group_mode = GROUP_MODE_EDIT;
+ phone_group_set_navi(cgroup_d->layout);
+ elm_gengrid_clear(cgroup_d->gengrid);
+ __group_fill_layout(cgroup_d);
+ phone_show_notify(cgroup_d->layout, T_(CT_GET_TEXT_BASE_OP, CTTEXT_SELECT_GROUP));
+
+}
+
+static void group_account_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_data *cgroup_d = data;
+ if (cgroup_d->popup){
+ evas_object_del(cgroup_d->popup);
+ cgroup_d->popup = NULL;
+ }
+
+ cgroup_d->child_ug = ctui_account_ug(cgroup_d->ug, NULL, NULL,
+ ctui_destroy_child_ug, &cgroup_d->child_ug);
+}
+
+static void group_more_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int rotate;
+ int x,y,w,h;
+ ct_group_data *cgroup_d = data;
+
+ if (cgroup_d->popup){
+ evas_object_del(cgroup_d->popup);
+ cgroup_d->popup = NULL;
+ }
+
+ cgroup_d->popup = elm_ctxpopup_add(cgroup_d->navi);
+ p_retm_if(NULL == cgroup_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(cgroup_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(cgroup_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(cgroup_d->popup, "dismissed", group_popup_hide_cb, cgroup_d);
+
+ elm_ctxpopup_item_append(cgroup_d->popup, S_(PH_SYS_SK_EDIT), NULL,
+ group_edit_cb, cgroup_d);
+
+ evas_object_geometry_get(cgroup_d->ctrl_button, &x, &y, &w, &h);
+ evas_object_move(cgroup_d->popup, w/2, y+h/2);
+ evas_object_show(cgroup_d->popup);
+}
+
+static void group_add_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_data *cgroup_d = data;
+ evas_object_data_set(cgroup_d->navi, "navi_it_pop_to", cgroup_d->navi_item);
+ ctui_create_group_input_view(cgroup_d->win, cgroup_d->navi,NULL, NULL, NULL);
+}
+
+#ifdef _CT_GROUP_DEFAULT_GROUP_UPDATE_DB
+static void group_update_default_group_name(keynode_t *key, void *data)
+{
+ PH_FN_CALL;
+ int ret;
+ int text_index= -1;
+ contacts_record_h record = NULL;
+ contacts_record_h group_record = NULL;
+ contacts_list_h group_list = NULL;
+
+ group_list = NULL;
+ ret = contacts_db_get_all_records( _contacts_group._uri,0,0,&group_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_db_get_all_records() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while(record){
+ int grp_id;
+ char* group_sysid;
+ char* group_name;
+
+ ret = contacts_record_get_int(record,_contacts_group.id,&grp_id);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_get_int() Failed(%d)", ret);
+ ret = contacts_record_get_str_p(record,_contacts_group.system_id,&group_sysid);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_get_str_p() Failed(%d)", ret);
+ ret = contacts_record_get_str_p(record,_contacts_group.name,&group_name);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_get_str_p() Failed(%d)", ret);
+ if(group_sysid == NULL){
+ PH_DBG("sysid null ,group_name__ = %s ", group_name);
+
+ ret = contacts_list_next(group_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_next() Failed(%d)", ret);
+
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ continue;
+ }
+ PH_DBG("group_sysid = %s",group_sysid);
+ if(strcmp(group_sysid,"friends")==0)
+ text_index = CTTEXT_FRIENDS;
+ else if(strcmp(group_sysid,"family")==0)
+ text_index = CTTEXT_FRIENDS+1;
+ else if(strcmp(group_sysid,"coworkers")==0)
+ text_index = CTTEXT_FRIENDS+2;
+ else {
+ ret = contacts_list_next(group_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_next() Failed(%d)", ret);
+
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ continue;
+ }
+
+ if(text_index == -1){
+ ret = contacts_list_next(group_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_next() Failed(%d)", ret);
+
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ ERR("text_index is -1, failed");
+ continue;
+ }
+ else
+ PH_DBG("text_index = %d",text_index);
+
+ PH_DBG("group = %s , %s", group_name,T_(CT_GET_TEXT_BASIC, text_index));
+
+ if(strcmp(group_name,T_(CT_GET_TEXT_BASIC, text_index)) != 0){
+ ret = contacts_db_get_record(_contacts_group._uri,grp_id,&group_record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_db_get_record() Failed(%d)", ret);
+
+ ret = contacts_record_set_str(group_record,_contacts_group.name,T_(CT_GET_TEXT_BASIC, text_index));
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_set_str() Failed(%d)", ret);
+
+ ret = contacts_db_update_record(group_record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_db_update_record() Failed(%d)", ret);
+
+ ret = contacts_record_destroy(group_record, true);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_record_destroy() Failed(%d)", ret);
+ }
+ ret = contacts_list_next(group_list);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_next() Failed(%d)", ret);
+
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ ret = contacts_list_destroy(group_list, true);
+ p_retm_if(CONTACTS_ERROR_NONE != ret, "contacts_list_destroy() Failed(%d)", ret);
+
+}
+#endif
+
+static void __group_pop_as_topmost(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_data *cgroup_d = data;
+ if(cgroup_d->navi_item == elm_naviframe_top_item_get(obj)) {
+ group_notify_update(cgroup_d);
+ }
+}
+
+static void group_view_delete_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ int ret;
+ ct_group_data *cgroup_d = data;
+ p_retm_if(NULL == cgroup_d, "parameter(cgroup_d) is NULL");
+
+
+ ret = contacts_db_remove_changed_cb(_contacts_contact._uri,group_data_lazy_update,cgroup_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", ret);
+ ret = contacts_db_remove_changed_cb(_contacts_group._uri,group_data_lazy_update,cgroup_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", ret);
+ ret = contacts_db_remove_changed_cb(_contacts_person._uri, group_data_lazy_update, cgroup_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_remove_changed_cb() Failed(%d)", ret);
+
+#ifdef _CT_GROUP_DEFAULT_GROUP_UPDATE_DB
+ ret = vconf_ignore_key_changed(VCONFKEY_LANGSET, group_update_default_group_name);
+ p_warn_if(-1 == ret, "vconf_ignore_key_changed() Failed");
+#endif
+
+ if (cgroup_d->th) {
+ elm_theme_extension_del(cgroup_d->th, GROUP_THEME_EDJ);
+ elm_theme_extension_del(cgroup_d->th, CONTACT_BUTTON_THEME_EDJ);
+ elm_theme_free(cgroup_d->th);
+ }
+
+ if (cgroup_d->child_ug)
+ ug_destroy(cgroup_d->child_ug);
+
+ if (cgroup_d->crop_ug)
+ ug_destroy(cgroup_d->crop_ug);
+
+ if (cgroup_d->src_ug)
+ ug_destroy(cgroup_d->src_ug);
+
+ if (cgroup_d->popup)
+ evas_object_del(cgroup_d->popup);
+
+ if (cgroup_d->update_timer)
+ ecore_timer_del(cgroup_d->update_timer);
+
+ if (cgroup_d->waiting_timer)
+ ecore_timer_del(cgroup_d->waiting_timer);
+
+ evas_object_smart_callback_del(cgroup_d->navi, "transition,finished", __group_pop_as_topmost);
+
+ free(cgroup_d);
+}
+
+static int group_create_layout(ct_group_data *cgroup_d, Evas_Object *parent)
+{
+ PH_FN_CALL;
+ int ret;
+ const int CT_GROUP_ITEM_WIDTH = 360;
+ const int CT_GROUP_ITEM_HEIGHT = 340;
+ double scale;
+ Evas_Object *layout;
+ Evas_Object *base;
+ Evas_Object *gengrid;
+ cgroup_d->navi = parent;
+
+ base = elm_layout_add(cgroup_d->navi);
+ p_retvm_if(NULL == base, -1, "elm_layout_add() return NULL");
+ elm_layout_file_set(base, SELECTION_INFO_EDJ, "selectioninfo_layout");
+ layout = phone_create_base_layout(base, false);
+ p_retvm_if(NULL == layout, -1, "phone_create_base_layout() return NULL");
+ elm_object_part_content_set(base, "contents", layout);
+ cgroup_d->layout = base;
+
+ gengrid = elm_gengrid_add(layout);
+ p_retvm_if(NULL == gengrid, -1, "elm_gengrid_add() return NULL");
+ elm_object_theme_set(gengrid, cgroup_d->th);
+ evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_gengrid_align_set(gengrid, 0.5, 0.0);
+ evas_object_data_set(gengrid, "cgroup_d", cgroup_d);
+
+ scale = elm_config_scale_get();
+ elm_gengrid_group_item_size_set(gengrid, (int)(720*scale), (int)(50*scale));
+ elm_gengrid_item_size_set(gengrid, (int)(CT_GROUP_ITEM_WIDTH*scale), (int)(CT_GROUP_ITEM_HEIGHT*scale));
+ elm_gengrid_horizontal_set(gengrid, EINA_FALSE);
+
+ elm_gengrid_scroller_policy_set(gengrid, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ elm_object_part_content_set(layout, "elm.swallow.content", gengrid);
+ cgroup_d->gengrid = gengrid;
+
+#ifdef _CT_GROUP_DEFAULT_GROUP_UPDATE_DB
+ group_update_default_group_name(NULL, NULL);
+ ret = vconf_notify_key_changed(VCONFKEY_LANGSET, group_update_default_group_name, NULL);
+ p_warn_if(-1 == ret, "vconf_notify_key_changed() Failed");
+#endif
+
+ group_create_itcs();
+ __group_fill_layout(cgroup_d);
+
+ evas_object_event_callback_add(cgroup_d->layout, EVAS_CALLBACK_DEL, group_view_delete_cb, cgroup_d);
+
+ ret = contacts_db_add_changed_cb(_contacts_contact._uri, group_data_lazy_update, cgroup_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_add_changed_cb() Failed(%d)", ret);
+
+ ret = contacts_db_add_changed_cb(_contacts_group._uri, group_data_lazy_update, cgroup_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_add_changed_cb() Failed(%d)", ret);
+
+ ret = contacts_db_add_changed_cb(_contacts_person._uri, group_data_lazy_update, cgroup_d);
+ p_warn_if(CONTACTS_ERROR_NONE, "contacts_db_add_changed_cb() Failed(%d)", ret);
+
+ return 0;
+
+}
+
+API void phone_group_set_navi(Evas_Object *layout)
+{
+ ct_group_data *cgroup_d;
+ Elm_Object_Item *navi_it;
+ Evas_Object *r_btn;
+
+ cgroup_d = evas_object_data_get(layout, KEY_GROUP_DATA);
+ p_retm_if(NULL == cgroup_d, "cgroup_d is NULL");
+ navi_it = elm_naviframe_bottom_item_get(cgroup_d->navi);
+ p_retm_if(NULL == navi_it, "navi item is NULL");
+
+ phone_navi_item_clear(cgroup_d->navi_item);
+
+ if (cgroup_d->ug) {
+ r_btn = phone_create_toolbar_btn(cgroup_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, cgroup_d->ug);
+ elm_object_item_part_content_set(cgroup_d->navi_item, "toolbar_button1", r_btn);
+ }
+ else {
+ if (GROUP_MODE_NORMAL == cgroup_d->group_mode) {
+ Evas_Object *group_button;
+
+ cgroup_d->ctrl_button = ctui_create_more_btn(cgroup_d->navi, group_more_cb, cgroup_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_more_btn", cgroup_d->ctrl_button);
+
+ group_button = phone_create_toolbar_btn(cgroup_d->navi, S_(CT_SYS_BODY_CREATE), group_add_cb, cgroup_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", group_button);
+
+ r_btn = elm_button_add(cgroup_d->navi);
+ elm_object_style_set(r_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(r_btn, "clicked", phone_back_btn_clicked_cb, cgroup_d->win);
+ elm_object_item_part_content_set(navi_it, "prev_btn", r_btn);
+ }
+ else {
+ phone_navi_item_clear(navi_it);
+ cgroup_d->delete_button = phone_create_toolbar_btn(cgroup_d->navi, S_(PH_SYS_SK_DELETE), group_delete_btn_cb, cgroup_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", cgroup_d->delete_button);
+ elm_object_disabled_set(cgroup_d->delete_button, EINA_TRUE);
+
+ r_btn = phone_create_toolbar_btn(cgroup_d->navi, S_(PH_SYS_SK_CANCEL), group_cacnel_btn_cb, cgroup_d);
+ elm_object_item_part_content_set(cgroup_d->navi_item, "toolbar_button2", r_btn);
+ }
+ }
+}
+
+API Evas_Object* phone_create_group_view(ph_view_info *view_info)
+{
+ int ret;
+ Elm_Theme *th;
+ ct_group_data *cgroup_d= calloc(1, sizeof(ct_group_data));
+ p_retvm_if(NULL == cgroup_d, NULL, "Fail to calloc ct_group_data");
+ cgroup_d->ug = view_info->ug;
+ cgroup_d->ug_request = view_info->ug_request;
+ cgroup_d->ug_cnt_max = view_info->ug_cnt_max;
+ cgroup_d->ug_data = view_info->ug_data;
+ cgroup_d->win = view_info->win;
+ cgroup_d->navi_item = elm_naviframe_bottom_item_get(view_info->navi);
+ cgroup_d->is_background = true;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, GROUP_THEME_EDJ);
+ elm_theme_extension_add(th, CONTACT_BUTTON_THEME_EDJ);
+ cgroup_d->th = th;
+
+ ret = group_create_layout(cgroup_d, view_info->navi);
+ if (ret < 0) {
+ free(cgroup_d);
+ return NULL;
+ }
+
+ evas_object_data_set(cgroup_d->layout, KEY_GROUP_DATA, cgroup_d);
+ evas_object_data_set(cgroup_d->navi, KEY_GROUP_DATA, cgroup_d);
+
+ evas_object_smart_callback_add(view_info->navi, "transition,finished", __group_pop_as_topmost, cgroup_d);
+
+ return cgroup_d->layout;
+}
+
+API void phone_group_view_reset(Evas_Object *base)
+{
+ PH_FN_CALL;
+ ct_group_data *cgroup_d;
+ Elm_Object_Item *item;
+
+ cgroup_d = evas_object_data_get(base, KEY_GROUP_DATA);
+ p_retm_if(NULL == cgroup_d, "cgroup_d is null");
+
+ if (cgroup_d->child_ug) {
+ ug_destroy(cgroup_d->child_ug);
+ cgroup_d->child_ug = NULL;
+ }
+
+ item = elm_naviframe_bottom_item_get(cgroup_d->navi);
+ if (elm_naviframe_top_item_get(cgroup_d->navi) != item)
+ elm_naviframe_item_pop_to(item);
+
+ if (GROUP_MODE_EDIT == cgroup_d->group_mode)
+ group_edit_mode_end(cgroup_d, false);
+}
+
+API void phone_group_view_language_changed(Evas_Object *base)
+{
+ ct_group_data *cgroup_d;
+ cgroup_d = evas_object_data_get(base, KEY_GROUP_DATA);
+ p_retm_if(NULL == cgroup_d, "evas_object_data_get() return NULL");
+ group_changed(cgroup_d);
+
+ if(cgroup_d->group_mode == GROUP_MODE_EDIT)
+ group_notify_update(cgroup_d);
+}
+
+API void phone_group_set_background(Evas_Object *obj, bool is_background)
+{
+ ct_group_data *cgroup_d;
+ cgroup_d = evas_object_data_get(obj, KEY_GROUP_DATA);
+ p_retm_if(NULL == cgroup_d, "group data is null");
+
+ cgroup_d->is_background = is_background;
+ if (cgroup_d->update_timer) {
+ ecore_timer_del(cgroup_d->update_timer);
+ cgroup_d->update_timer = NULL;
+ group_changed(cgroup_d);
+ }
+}
+
+API Evas_Object* phone_create_group_view_ug(ui_gadget_h ug, Evas_Object *parent, int ug_request)
+{
+ int ret;
+ Elm_Theme *th;
+ ct_group_data *cgroup_d= calloc(1, sizeof(ct_group_data));
+ p_retvm_if(NULL == cgroup_d, NULL, "Fail to calloc ct_group_data");
+ cgroup_d->ug = ug;
+ cgroup_d->ug_request = ug_request;
+ cgroup_d->navi = elm_naviframe_add(parent);
+ p_retvm_if(NULL == cgroup_d->navi, FALSE, "elm_naviframe_add() return NULL");
+ elm_object_part_content_set(parent, "elm.swallow.content", cgroup_d->navi);
+ evas_object_show(cgroup_d->navi);
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, GROUP_THEME_EDJ);
+ elm_theme_extension_add(th, CONTACT_BUTTON_THEME_EDJ);
+ cgroup_d->th = th;
+
+ ret = group_create_layout(cgroup_d, cgroup_d->navi);
+ if (ret < 0) {
+ free(cgroup_d);
+ return NULL;
+ }
+ cgroup_d->navi_item = elm_naviframe_item_push(cgroup_d->navi, T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP), NULL, NULL, cgroup_d->layout, NULL);
+ evas_object_data_set(cgroup_d->layout, KEY_GROUP_DATA, cgroup_d);
+ return cgroup_d->layout;
+}
+
diff --git a/lib/list/ct-list-contact-view.c b/lib/list/ct-list-contact-view.c
new file mode 100755
index 0000000..d97ccb7
--- /dev/null
+++ b/lib/list/ct-list-contact-view.c
@@ -0,0 +1,995 @@
+/*
+* 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
+#include <string.h>
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-list.h"
+#include "ct-list-utils.h"
+#include "ct-list-view-ug.h"
+#include "ct-list-edit-view.h"
+#include "ct-list-contact-view.h"
+#include "ct-group.h"
+
+static void __list_insert_records(ct_list_data *clist_d);
+
+API void ctui_list_new_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ ct_detail_data *cdetail_d;
+ ph_view_info *view_info;
+
+ switch (clist_d->ug_request)
+ {
+ //case PH_UG_REQUEST_SET_WITH_NUM:
+ //case PH_UG_REQUEST_SET_WITH_EMAIL:
+ //case PH_UG_REQUEST_SET_WITH_WEB:
+ case PH_UG_REQUEST_SET_WITH_IMG:
+ case PH_UG_REQUEST_SET_WITH_RINGTONE:
+ case CT_UG_REQUEST_UPDATE_CONTACT:
+ case CT_UG_REQUEST_UPDATE_WITH_NUM:
+ case CT_UG_REQUEST_UPDATE_WITH_EMAIL:
+ case CT_UG_REQUEST_UPDATE_WITH_WEB:
+ case CT_UG_REQUEST_SAVE_IMG:
+ case CT_UG_REQUEST_SAVE_RINGTONE:
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, clist_d->win, clist_d->navi, clist_d->ug, clist_d->ug_request, clist_d->cnt_max_check, clist_d->ug_data);
+ ctui_list_update_with_data(view_info, clist_d, 0, clist_d->base_grp, clist_d->base_ab);
+ free(view_info);
+ break;
+ default:
+ cdetail_d = calloc(1, sizeof(ct_detail_data));
+ p_retm_if(!cdetail_d, "cdetail_d is NULL, Not enough memory");
+
+ ctui_ld_to_dd(clist_d, cdetail_d);
+
+ if (0 < cdetail_d->base_ab) {
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ char temp[PH_TEXT_MAX_LEN+1];
+
+ err = contacts_db_get_record(_contacts_address_book._uri, cdetail_d->base_ab, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_record_get() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_address_book.mode, &(cdetail_d->base_ab_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);
+
+ temp[0] = '\0';
+ ctui_get_addressbook_name(cdetail_d->base_ab, temp, sizeof(temp));
+ if (*temp)
+ cdetail_d->base_ab_name = strdup(temp);
+ }
+ else if (0 == cdetail_d->base_ab) {
+ cdetail_d->base_ab_mode = CONTACTS_ADDRESS_BOOK_MODE_NONE;
+ cdetail_d->base_ab_name = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+ cdetail_d->only_input = true;
+ ctui_create_input_view(cdetail_d);
+
+ break;
+ }
+}
+static void list_remove_member_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ p_retm_if(NULL == clist_d->navi_item, "parameter(navi_item) is NULL");
+
+ if (clist_d->popup){
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+ clist_d->view_id = CT_LIST_MULTI_REMOVE_MEMBER;
+
+ if(clist_d->genlist)
+ elm_object_focus_set(clist_d->genlist, EINA_TRUE);
+ if(!clist_d->ug)
+ ctui_list_edit_mode_start(clist_d);
+}
+
+static void list_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ elm_object_tree_focus_allow_set(clist_d->navi, EINA_TRUE);
+}
+
+static void list_ab_popup_view_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int selected_id;
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *radio_main;
+ ct_list_data *clist_d = data;
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+
+ popup = clist_d->popup;
+ p_retm_if(NULL == clist_d, "popup is NULL");
+
+ genlist = elm_object_content_get(popup);
+ p_retm_if(NULL == genlist, "elm_object_content_get() is NULL");
+
+ radio_main = evas_object_data_get(genlist, "radio_main");
+ p_retm_if(NULL == radio_main, "evas_object_data_get() is NULL");
+
+ selected_id = elm_radio_value_get(radio_main);
+
+ if (clist_d->list_op != CT_GET_LIST_ALL_PERSON && selected_id == -1) {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON;
+ clist_d->base_ab = -1;
+ }
+ else if (clist_d->base_ab != selected_id) {
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ clist_d->base_ab = selected_id;
+ }
+
+ ctui_set_view_mode(clist_d->base_ab);
+ ctui_list_genlist_update(clist_d);
+
+ evas_object_del(popup);
+ clist_d->popup = NULL;
+}
+
+static void list_ab_popup_cancel_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup;
+ ct_list_data *clist_d = data;
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+
+ popup = clist_d->popup;
+ p_retm_if(NULL == popup, "popup is NULL");
+
+ evas_object_del(popup);
+ clist_d->popup = NULL;
+}
+
+static void list_ab_popup_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *genlist;
+ Evas_Object *radio_main;
+ Elm_Object_Item *item = event_info;
+ ct_ab_popup_data *ab_popup_data;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ genlist = elm_object_item_widget_get(item);
+ p_retm_if(NULL == genlist, "elm_object_item_widget_get() return NULL");
+
+ ab_popup_data = elm_object_item_data_get(item);
+ p_retm_if(NULL == ab_popup_data, "elm_object_item_data_get() return NULL");
+
+ radio_main = evas_object_data_get(genlist, "radio_main");
+ p_retm_if(NULL == radio_main, "evas_object_data_get() return NULL");
+
+ elm_radio_value_set(radio_main, ab_popup_data->id);
+}
+
+
+static void list_view_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup;
+ Evas_Object *btn_view, *btn_cancel;
+ ct_list_data *clist_d = data;
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+
+ if (clist_d->popup){
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ popup = ctui_addrbook_popup(clist_d->win, list_ab_popup_sel, clist_d, CT_AB_POPUP_TYPE_LIST_VIEW);
+ p_retm_if(NULL == popup, "ctui_addrbook_popup() return NULL");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW));
+ clist_d->popup = popup;
+
+ btn_view = elm_button_add(popup);
+ p_retm_if(NULL == btn_view, "elm_button_add() return NULL");
+ elm_object_text_set(btn_view, T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW));
+ elm_object_part_content_set(popup, "button1", btn_view);
+ elm_object_style_set(btn_view, "popup_button/default");
+ evas_object_smart_callback_add(btn_view, "clicked", list_ab_popup_view_button_cb, clist_d);
+
+ btn_cancel = elm_button_add(popup);
+ p_retm_if(NULL == btn_cancel, "elm_button_add() return NULL");
+ elm_object_text_set(btn_cancel, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button2", btn_cancel);
+ elm_object_style_set(btn_cancel, "popup_button/default");
+ evas_object_smart_callback_add(btn_cancel, "clicked", list_ab_popup_cancel_button_cb, clist_d);
+}
+
+static void list_account_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+
+ if (clist_d->popup){
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ clist_d->child_ug = ctui_account_ug(clist_d->ug, NULL, NULL,
+ ct_list_destroy_child_ug, clist_d);
+
+}
+
+static void list_add_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+
+ evas_object_data_set(clist_d->navi, "navi_it_pop", clist_d->navi_item);
+ ctui_create_gadd_list_select_view(clist_d->win, clist_d->navi, clist_d->base_grp, clist_d->base_ab, clist_d->list);
+}
+
+static bool list_load_vcard_foreach_cb(contacts_record_h record, void *data)
+{
+ contacts_error_e err;
+ ph_progress_info *p_info;
+ ct_list_data *clist_d = data;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(NULL == clist_d, -1, "parameter(clist_d) is NULL");
+
+ p_info = clist_d->p_info;
+ p_retvm_if(NULL == p_info, -1, "clist_d->p_info is NULL");
+
+ PH_DBG("list_load_vcard_foreach_cb total_cnt %d", clist_d->cnt_import_total);
+
+ if (!p_info->alive) {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ return false;
+ }
+
+ err = contacts_record_clone(record, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ return false;
+ }
+ clist_d->list_import_records = eina_list_append(clist_d->list_import_records, record_clone);
+ clist_d->cnt_import_total++;
+
+ return true;
+}
+
+static PTHREAD_FN list_load_vcard_contacts_thread_fn(void* data)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_list_data *clist_d = data;
+ char *last = NULL;
+ const char *path = NULL;
+ ph_progress_info *p_info = clist_d->p_info;
+
+ err = contacts_connect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
+
+ path = strtok_r(clist_d->vcard_path, "?", &last);
+ while (path) {
+ err = contacts_vcard_parse_to_contact_foreach(path, list_load_vcard_foreach_cb, clist_d);
+ if (CONTACTS_ERROR_NONE != err) {
+ p_info->result = FALSE;
+ ERR("contacts_svc_vcard_foreach() Failed(%d)", p_info->result);
+ break;
+ }
+ path = strtok_r(NULL, "?", &last);
+ }
+
+ p_info->next_job = true;
+
+ contacts_disconnect2();
+
+ pthread_exit(NULL);
+}
+
+static void __list_insert_records_cb(int err, int *ids, unsigned int count, void *data)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d = data;
+ contacts_error_e _err = CONTACTS_ERROR_NONE;
+
+ PH_DBG("err %d", err);
+
+ if(CONTACTS_ERROR_NONE != err) {
+ if(clist_d->p_info) {
+ clist_d->p_info->completed = true;
+ clist_d->p_info->alive = false;
+ clist_d->p_info->result = false;
+ }
+ return;
+ }
+
+ _err = contacts_list_destroy(clist_d->import_list, true);
+ p_retm_if(CONTACTS_ERROR_NONE != _err, "contacts_list_destroy() Failed(%d)", _err);
+
+ PH_DBG("__list_insert_records_cb total count %d, count %d", clist_d->cnt_import_total, clist_d->cnt_import);
+
+ if(clist_d->p_info) {
+ if(!clist_d->p_info->alive) {
+ clist_d->p_info->result = FALSE;
+ clist_d->p_info->completed = true;
+ return;
+ }
+ }
+ else
+ return;
+
+ if(clist_d->cnt_import == clist_d->cnt_import_total) {
+ if(clist_d->p_info) {
+ clist_d->p_info->completed = true;
+ clist_d->p_info->alive = false;
+ clist_d->p_info->result = true;
+ }
+ return;
+ }
+
+ __list_insert_records(clist_d);
+}
+
+static void __list_insert_records(ct_list_data *clist_d)
+{
+ const int LIST_BULK_LENGTH = 50;
+ Eina_List *l;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ err = contacts_list_create(&clist_d->import_list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_create() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(clist_d->list_import_records, l, record_temp) {
+ err = contacts_list_add(clist_d->import_list, record_temp);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_add() Failed(%d) count %d", err, clist_d->cnt_import);
+ clist_d->list_import_records = eina_list_remove_list(clist_d->list_import_records, l);
+
+ clist_d->cnt_import++;
+
+ if((clist_d->cnt_import % LIST_BULK_LENGTH) == 0)
+ break;
+ }
+ err = contacts_db_insert_records_async(clist_d->import_list, __list_insert_records_cb, clist_d);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_insert_records_async() Failed(%d)", err);
+ ctui_create_contacts_error_popup(clist_d->navi, err);
+}
+
+static Eina_Bool list_load_vcard_timer_cb(void *data)
+{
+ ct_list_data *clist_d = data;
+ ph_progress_info *p_info;
+
+ p_retvm_if(NULL == clist_d, ECORE_CALLBACK_CANCEL, "parameter(clist_d) is NULL");
+ p_info = clist_d->p_info;
+
+ if(p_info->next_job) {
+ pthread_join(p_info->thread, NULL);
+ __list_insert_records(clist_d);
+ p_info->next_job = false;
+ }
+
+ if (!p_info->alive && !p_info->completed) {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ }
+
+ if (!p_info->completed) {
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ Eina_List *l;
+ contacts_record_h record = NULL;
+ const char *message;
+
+ pthread_join(p_info->thread, NULL);
+
+ if (p_info->result)
+ message = T_(CT_GET_TEXT_BASIC, CTTEXT_IMPORTED);
+ else
+ message = S_(PH_SYS_POP_FAILED);
+
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ phone_show_tickernoti(message);
+
+ EINA_LIST_FOREACH(clist_d->list_import_records, l, record) {
+ contacts_record_destroy(record, true);
+ }
+ eina_list_free(clist_d->list_import_records);
+
+ free(p_info);
+ clist_d->p_info = NULL;
+
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+static void list_add_all_contacts_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret;
+ ct_list_data *clist_d = data;
+ ph_progress_info *p_info;
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ if (NULL == p_info) {
+ ERR("calloc() return NULL");
+ elm_exit();
+ }
+
+ clist_d->p_info = p_info;
+ clist_d->list = NULL;
+ clist_d->cnt_import_total = 0;
+ clist_d->cnt_import = 0;
+
+ p_info->cnt = 0;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->completed = false;
+
+ ret = pthread_create(&p_info->thread, NULL, list_load_vcard_contacts_thread_fn, clist_d);
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ clist_d->p_info = NULL;
+ elm_exit();
+ }
+ p_info->timer = ecore_timer_add(0.5, list_load_vcard_timer_cb, clist_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);
+ clist_d->p_info = NULL;
+ elm_exit();
+ }
+ clist_d->popup = phone_progressbar_popup(clist_d->win, p_info, T_(CT_GET_TEXT_BASIC, CTTEXT_IMPORTING_SD_CONTACTS));
+}
+
+static void ctui_list_more_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ unsigned int acc_cnt = 0;
+ int rotate;
+ int x,y,w,h;
+ ct_list_data *clist_d = data;
+ contacts_list_h list = NULL;
+
+ if (clist_d->popup){
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ clist_d->popup = elm_ctxpopup_add(clist_d->navi);
+ p_retm_if(NULL == clist_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(clist_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(clist_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(clist_d->popup, "dismissed", list_popup_hide_cb, clist_d);
+
+ if (clist_d->list) {
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY != clist_d->base_ab_mode)
+ elm_ctxpopup_item_append(clist_d->popup, S_(PH_SYS_SK_DELETE), NULL,
+ ct_list_edit_cb, clist_d);
+ }
+
+ acc_cnt = 1;
+ err = contacts_db_get_all_records(_contacts_address_book._uri, 0, 0, &list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_all_records() Failed(%d)", err);
+ err = contacts_list_get_count(list, &acc_cnt);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_count() Failed(%d)", err);
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+ if (2 <= acc_cnt) {
+ elm_ctxpopup_item_append(clist_d->popup, T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW), NULL,
+ list_view_button_cb, clist_d);
+ }
+
+ evas_object_geometry_get(clist_d->ctrl_button, &x, &y, &w, &h);
+ evas_object_move(clist_d->popup, w/2, y+h/2);
+ evas_object_show(clist_d->popup);
+}
+
+static void list_navi_item_update(void *data)
+{
+ Evas_Object *new_button;
+ ct_list_data *clist_d = data;
+
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+ new_button = evas_object_data_get(clist_d->navi, "new_button");
+
+ if (!clist_d->ug) {
+ if(new_button) {
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY == clist_d->base_ab_mode)
+ elm_object_disabled_set(new_button, EINA_TRUE);
+ else
+ elm_object_disabled_set(new_button, EINA_FALSE);
+ }
+ if (NULL == clist_d->list)
+ elm_object_disabled_set(clist_d->ctrl_button, EINA_TRUE);
+ else
+ elm_object_disabled_set(clist_d->ctrl_button, EINA_FALSE);
+ }
+}
+
+static void list_message_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int list_op;
+ ct_list_data *clist_d = data;
+
+ list_popup_hide_cb(clist_d, NULL, NULL);
+
+ p_retm_if(NULL == evas_object_data_get(clist_d->navi, "cgroup_d"), "evas_object_data_get() return NULL");
+
+ if (-1 == clist_d->base_grp)
+ list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID;
+ else if (clist_d->base_grp)
+ 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(clist_d->navi, phone_group_message_result_cb, evas_object_data_get(clist_d->navi, "cgroup_d"), list_op, clist_d->base_ab, clist_d->base_grp, 0);
+}
+
+static void list_email_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int list_op;
+ ct_list_data *clist_d = data;
+
+ list_popup_hide_cb(clist_d, NULL, NULL);
+
+ p_retm_if(NULL == evas_object_data_get(clist_d->navi, "cgroup_d"), "evas_object_data_get() return NULL");
+
+ if (-1 == clist_d->base_grp)
+ list_op = CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID;
+ else if (clist_d->base_grp)
+ 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(clist_d->navi, phone_group_email_result_cb, evas_object_data_get(clist_d->navi, "cgroup_d"), list_op, clist_d->base_ab, clist_d->base_grp, 0);
+}
+
+static void list_more_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int rotate;
+ int x,y,w,h;
+ ct_list_data *clist_d = data;
+
+ if (clist_d->popup){
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ clist_d->popup = elm_ctxpopup_add(clist_d->navi);
+ p_retm_if(NULL == clist_d->popup, "elm_ctxpopup_add() return NULL");
+
+ rotate = (int)evas_object_data_get(clist_d->navi, "phone_rotate");
+ if (0 == rotate || 180 == rotate)
+ elm_ctxpopup_direction_priority_set(clist_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP,
+ ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+
+ evas_object_smart_callback_add(clist_d->popup, "dismissed", list_popup_hide_cb, clist_d);
+
+ elm_ctxpopup_item_append(clist_d->popup, S_(PH_SYS_BODY_MESSAGE), NULL,
+ list_message_btn_cb, clist_d);
+ elm_ctxpopup_item_append(clist_d->popup, T_(CT_GET_TEXT_BASIC ,CTTEXT_EMAIL), NULL,
+ list_email_btn_cb, clist_d);
+ elm_ctxpopup_item_append(clist_d->popup, S_(PH_SYS_BODY_REMOVE), NULL,
+ list_remove_member_button_cb, clist_d);
+
+ evas_object_geometry_get(clist_d->ctrl_button, &x, &y, &w, &h);
+ evas_object_move(clist_d->popup, w/2, y+h/2);
+ evas_object_show(clist_d->popup);
+}
+
+static void list_make_navi(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ Evas_Object *l_btn;
+
+ if (NULL == clist_d->list_navi_item_update_fn)
+ clist_d->list_navi_item_update_fn = list_navi_item_update;
+
+ phone_navi_item_clear(clist_d->navi_item);
+
+ // FIXME : should be rearragned accoring to new UX
+ if (CT_GET_LIST_VCARD == clist_d->list_op) {
+ Evas_Object *add_button = NULL;
+ add_button = phone_create_toolbar_btn(clist_d->navi, S_(CT_SYS_SK_ADD), list_add_all_contacts_button_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button1", add_button);
+
+ l_btn = elm_button_add(clist_d->navi);
+ p_retm_if(NULL == l_btn, "elm_button_add() return NULL");
+
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(l_btn, "clicked", phone_back_btn_clicked_cb, clist_d->win);
+ elm_object_item_part_content_set(clist_d->navi_item, "prev_btn", l_btn);
+ }
+ else if (clist_d->navi_item != elm_naviframe_bottom_item_get(clist_d->navi)) { // from group view
+ l_btn = elm_button_add(clist_d->navi);
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(l_btn, "clicked", phone_view_back_btn_cb, clist_d->navi);
+ elm_object_item_part_content_set(clist_d->navi_item, "prev_btn", l_btn);
+
+ if (!clist_d->ug) {
+ if (clist_d->base_grp) {
+ Evas_Object *add_button = NULL;
+ add_button = elm_button_add(clist_d->navi);
+ elm_object_text_set(add_button, S_(CT_SYS_SK_ADD));
+ evas_object_smart_callback_add(add_button, "clicked", list_add_button_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button1", add_button);
+ elm_object_style_set(add_button, "naviframe/toolbar/default");
+ evas_object_data_set(clist_d->navi, "add_button", add_button);
+
+ if (CONTACTS_ADDRESS_BOOK_MODE_READONLY == clist_d->base_ab_mode)
+ elm_object_disabled_set(add_button, EINA_TRUE);
+
+ if (clist_d->list) {
+ Evas_Object *more_button = NULL;
+ more_button = elm_button_add(clist_d->navi);
+ elm_object_style_set(more_button, "naviframe/more/default");
+ evas_object_smart_callback_add(more_button, "clicked", list_more_button_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_more_btn", more_button);
+ clist_d->ctrl_button = more_button;
+ }
+ }
+ }
+ }
+ else if (clist_d->ug && (PH_UG_REQUEST_LAUNCH_VOICECALL == clist_d->ug_request ||
+ CT_UG_REQUEST_LIST_WITH_BACK >= clist_d->ug_request || CT_UG_REQUEST_SELECT_CONTACT_ADD_TO_HOME == clist_d->ug_request
+ || CT_UG_REQUEST_SELECT_GROUP_ADD_TO_HOME == clist_d->ug_request)) {
+ l_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, clist_d->ug);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button1", l_btn);
+ }
+ else {
+ Evas_Object *create_button = NULL;
+ /* more button */
+ if (!clist_d->ug) {
+ clist_d->ctrl_button = ctui_create_more_btn(clist_d->navi, ctui_list_more_btn_clicked_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_more_btn", clist_d->ctrl_button);
+ if (NULL == clist_d->list)
+ elm_object_disabled_set(clist_d->ctrl_button, EINA_TRUE);
+ else
+ elm_object_disabled_set(clist_d->ctrl_button, EINA_FALSE);
+
+ }
+ /* create button */
+ create_button = phone_create_toolbar_btn(clist_d->navi, S_(CT_SYS_BODY_CREATE), ctui_list_new_btn_clicked_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button1", create_button);
+ evas_object_data_set(clist_d->navi, "new_button", create_button);
+
+ /* back or cancel button */
+ if (NULL == clist_d->ug || clist_d->ug_request < CT_UG_REQUEST_SELECT_PERSON ||
+ (CT_UG_REQUEST_UPDATE_CONTACT<=clist_d->ug_request && clist_d->ug_request<= CT_UG_REQUEST_UPDATE_WITH_WEB) ||
+ (CT_UG_REQUEST_SAVE_IMG<=clist_d->ug_request && clist_d->ug_request<= CT_UG_REQUEST_SAVE_RINGTONE)) {
+ l_btn = elm_button_add(clist_d->navi);
+ p_retm_if(NULL == l_btn, "elm_button_add() return NULL");
+
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+ if (clist_d->ug_request) {
+ evas_object_smart_callback_add(l_btn, "clicked", phone_ug_destroy_me_cb, clist_d->ug);
+ }
+ else
+ evas_object_smart_callback_add(l_btn, "clicked", phone_back_btn_clicked_cb, clist_d->win);
+ elm_object_item_part_content_set(clist_d->navi_item, "prev_btn", l_btn);
+ }
+ else {
+ Evas_Object *cancel_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, clist_d->ug);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button2", cancel_btn);
+ elm_object_style_set(cancel_btn, "naviframe/toolbar/right");
+ elm_object_style_set(create_button, "naviframe/toolbar/left");
+ }
+ }
+}
+
+static void __list_ctxpopup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+}
+
+
+static void list_call_btn_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_CALL_PRESS, NULL);
+}
+
+static void list_call_btn_unpressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_CALL, NULL);
+}
+
+static void list_msg_btn_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_MESSAGE_PRESS, NULL);
+}
+
+static void list_msg_btn_unpressed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *icon = NULL;
+ p_retm_if(NULL == data, "data is NULL");
+ icon = elm_object_part_content_get(data, "icon");
+ elm_icon_file_set(icon, PH_IMG_ICON_MESSAGE, NULL);
+}
+
+static Evas_Object* list_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_person_list* person_info = data;
+ ct_list_data *clist_d = evas_object_data_get(obj, "clist_d");
+
+ p_retvm_if(NULL == person_info, NULL, "person_info is NULL");
+
+ if (strcmp(part, "elm.slide.swallow.1") == 0) {
+ Evas_Object *btn;
+
+ if (NULL == person_info->number || '\0' == *person_info->number) {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_DELETE);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn() return NULL");
+
+ elm_object_style_set(btn, "sweep/delete");
+ evas_object_data_set(btn, "clist_d", clist_d);
+ evas_object_smart_callback_add(btn, "clicked", ct_list_sweep_del_cb, (void *)person_info->id);
+
+ if (0 == person_info->id)
+ elm_object_disabled_set(btn, EINA_TRUE);
+ }
+ else {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_CALL);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn() return NULL");
+ evas_object_data_set(btn, "clist_d", clist_d);
+ evas_object_smart_callback_add(btn, "clicked", ct_list_call, person_info);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN, list_call_btn_pressed_cb, btn);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, list_call_btn_unpressed_cb, btn);
+ }
+ return btn;
+ }
+ else if (strcmp(part, "elm.slide.swallow.2") == 0) {
+ Evas_Object *btn;
+
+ if (NULL == person_info->number || '\0' == *person_info->number)
+ return NULL;
+
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_MESSAGE);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn() return NULL");
+
+ evas_object_data_set(btn, "clist_d", clist_d);
+ evas_object_smart_callback_add(btn, "clicked", ct_list_msg, person_info);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN, list_msg_btn_pressed_cb, btn);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, list_msg_btn_unpressed_cb, btn);
+
+ return btn;
+ }
+ else if (strcmp(part, "elm.slide.swallow.4") == 0) {
+ Evas_Object *btn;
+
+
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_DELETE);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn() return NULL");
+
+ elm_object_style_set(btn, "sweep/delete");
+ evas_object_data_set(btn, "clist_d", clist_d);
+ evas_object_smart_callback_add(btn, "clicked", ct_list_sweep_del_cb, (void *)person_info->id);
+
+ if (0 == person_info->id)
+ elm_object_disabled_set(btn, EINA_TRUE);
+
+ return btn;
+ }
+ else if (0 == strcmp(part, "elm.icon.1")) {
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ Evas_Object *icon;
+
+ if (!person_info->img_loaded) {
+ if (person_info->id) {
+ err = contacts_db_get_record(_contacts_person._uri, person_info->id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str(record, _contacts_person.image_thumbnail_path, &(person_info->img_path));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ }
+ person_info->img_loaded = true;
+ }
+
+ if (NULL == person_info->img_path)
+ return NULL;
+
+ icon = elm_icon_add(obj);
+ if (icon) {
+ elm_icon_prescale_set(icon, CT_LIST_ICON_SIZE);
+ elm_icon_file_set(icon, person_info->img_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.edit.icon.1")) {
+ Evas_Object *check;
+ check = ct_list_edit_add_check(obj, &person_info->checked, clist_d);
+ p_retvm_if(NULL == check, NULL, "ct_list_edit_add_check() return NULL");
+ evas_object_data_set(check, "person_info", person_info);
+ return check;
+ }
+ return NULL;
+}
+
+
+static void 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].decorate_item_style = "mode/slide4";
+ 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 = list_gl_icon_get;
+ clist_d->itcs[CT_LIST_ITEM_NO_NUMBER].decorate_all_item_style = "edit_default";
+
+ clist_d->itcs[CT_LIST_ITEM].item_style = "link_list";
+ clist_d->itcs[CT_LIST_ITEM].decorate_item_style = "mode/slide";
+ clist_d->itcs[CT_LIST_ITEM].func.text_get = ct_list_gl_label_get;
+ clist_d->itcs[CT_LIST_ITEM].func.content_get = list_gl_icon_get;
+ clist_d->itcs[CT_LIST_ITEM].decorate_all_item_style = "edit_default";
+
+ clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER].item_style = "link_list.tb";
+ clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER].decorate_item_style = "mode/slide4";
+ 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 = list_gl_icon_get;
+ clist_d->itcs[CT_LIST_ITEM_SEARCH_NO_NUMBER].decorate_all_item_style = "edit_default";
+
+ clist_d->itcs[CT_LIST_ITEM_SEARCH].item_style = "link_list.tb";
+ clist_d->itcs[CT_LIST_ITEM_SEARCH].decorate_item_style = "mode/slide";
+ 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 = list_gl_icon_get;
+ clist_d->itcs[CT_LIST_ITEM_SEARCH].decorate_all_item_style = "edit_default";
+
+ 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;
+
+}
+
+API void ctui_list_navi_set(int mode, ct_list_data *clist_d)
+{
+ evas_object_data_del(clist_d->navi, "delete_button");
+ evas_object_data_del(clist_d->navi, "new_button");
+ evas_object_data_del(clist_d->navi, "add_button");
+ phone_navi_item_clear(clist_d->navi_item);
+
+ switch (mode) {
+ case CT_LIST_MODE_DEFAULT:
+ list_make_navi(clist_d);
+ break;
+ case CT_LIST_MODE_EDIT:
+ ct_list_edit_make_edit_navi(clist_d);
+ if(CT_LIST_MULTI_ADD_MEMBER != clist_d->view_id)
+ ctui_navi_btn_disabled_set(clist_d->navi, EINA_TRUE);
+ ctui_list_update_selection_info(clist_d);
+ break;
+ default:
+ return;
+ }
+}
+
+Evas_Object* ct_list_create_contact_view(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ list_create_itcs(clist_d);
+ clist_d->gl_sel = ct_list_ug_gl_sel;
+ clist_d->gl_sel_data = clist_d;
+ clist_d->edit_sel_update = ctui_list_update_selection_info;
+ return ct_list_create_contact_layout(clist_d);
+}
+
+// Group > Group detail view : In case of UG, it can be check view
+API Evas_Object* ctui_list_create_contact_view_with_info(ph_view_info *view_info,
+ int list_op, ct_group_list *info)
+{
+ ct_list_data *clist_d;
+ const char *ab_name = NULL;
+ char temp[PH_TEXT_MAX_LEN];
+
+ p_retv_if(CT_GET_LIST_VCARD == list_op, NULL);
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, NULL, "clist_d is NULL, Not enough memory");
+
+ clist_d->win = view_info->win;
+ clist_d->navi = view_info->navi;
+ clist_d->ug = view_info->ug;
+ clist_d->ug_data = view_info->ug_data;
+ clist_d->ug_request = view_info->ug_request;
+ clist_d->base_ab = -1;
+
+ switch (clist_d->ug_request) {
+ //case PH_UG_REQUEST_SELECT_NUMBER:
+ //case PH_UG_REQUEST_CHECK_FOR_NUMBER:
+ case CT_UG_REQUEST_SELECT_NUMBER:
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER:
+ clist_d->list_op = list_op+1;
+ break;
+ //case PH_UG_REQUEST_SELECT_EMAIL:
+ //case PH_UG_REQUEST_CHECK_FOR_EMAIL:
+ case CT_UG_REQUEST_SELECT_EMAIL:
+ case CT_UG_REQUEST_CHECK_FOR_EMAIL:
+ clist_d->list_op = list_op+2;
+ break;
+ case CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL:
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ clist_d->list_op = list_op+3;
+ break;
+ default:
+ clist_d->list_op = list_op;
+ break;
+ }
+
+ clist_d->base_ab = info->id_ab;
+ clist_d->base_grp = info->id_grp;
+ clist_d->base_ab_mode = info->mode;
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+ clist_d->title = SAFE_STRDUP(info->name);
+ clist_d->navi_item = elm_naviframe_item_push(clist_d->navi, clist_d->title, NULL, NULL, clist_d->base_layout, NULL);
+ if (0 < clist_d->base_ab) {
+ temp[0] = '\0';
+ ctui_get_addressbook_name(clist_d->base_ab, temp, sizeof(temp));
+ ab_name = temp;
+ }
+ else
+ ab_name = T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE);
+
+ elm_object_item_part_text_set(clist_d->navi_item, "subtitle", ab_name);
+ clist_d->sub_title = strdup(ab_name);
+
+ switch (clist_d->ug_request) {
+ case CT_UG_REQUEST_CHECK:
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER:
+ case CT_UG_REQUEST_CHECK_FOR_EMAIL:
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ ctui_list_edit_mode_start(clist_d);
+ break;
+ default :
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, clist_d);
+ break;
+ }
+ return clist_d->navi;
+}
+
+API void ctui_list_set_search_text(ct_list_data *clist_d, const char *text)
+{
+ p_retm_if(!clist_d, "clist_d is NULL");
+ if (clist_d->searchbar) {
+ Evas_Object *en;
+ en = elm_object_part_content_get(clist_d->searchbar, "elm.swallow.content");
+ elm_entry_entry_set(en, text);
+ }
+}
+
+
diff --git a/lib/list/ct-list-contact-view.h b/lib/list/ct-list-contact-view.h
new file mode 100755
index 0000000..0694af8
--- /dev/null
+++ b/lib/list/ct-list-contact-view.h
@@ -0,0 +1,23 @@
+/*
+* 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_LIST_CONTACT_VIEW_H__
+#define __CONTACTS_LIST_CONTACT_VIEW_H__
+
+Evas_Object* ct_list_create_contact_view(ct_list_data *clist_d);
+
+#endif //__CONTACTS_LIST_CONTACT_VIEW_H__
diff --git a/lib/list/ct-list-edit-view.c b/lib/list/ct-list-edit-view.c
new file mode 100755
index 0000000..12de228
--- /dev/null
+++ b/lib/list/ct-list-edit-view.c
@@ -0,0 +1,656 @@
+/*
+* 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 <app.h>
+#include <fcntl.h>
+
+#include "phone.h"
+#include "ct-list.h"
+#include "ct-list-utils.h"
+#include "ct-list-view-ug.h"
+#include "ct-list-contact-view.h"
+
+#define TIMER_DURATION 0.2
+
+
+static Eina_List* list_edit_update_person_check_list(Eina_List *check_list, int person_id, Eina_Bool checked)
+{
+ if (EINA_TRUE == checked) {
+ if (!eina_list_data_find(check_list, (void *)person_id))
+ check_list = eina_list_append(check_list, (void *)person_id);
+ }
+ else {
+ if (eina_list_data_find(check_list, (void *)person_id))
+ check_list = eina_list_remove(check_list, (void *)person_id);
+ }
+ return check_list;
+}
+
+static inline void list_edit_items_checked_set(ct_list_data *clist_d, Eina_Bool checked)
+{
+ Eina_List *l;
+ ct_person_list *person_info = NULL;
+
+ EINA_LIST_FOREACH(clist_d->list, l, person_info) {
+ if (NULL == person_info) {
+ ERR("elm_object_item_data_get() return NULL");
+ continue;
+ }
+ person_info->checked = checked;
+ clist_d->list_check = list_edit_update_person_check_list(clist_d->list_check, person_info->id, checked);
+ }
+}
+
+static inline void list_edit_all_items_checked_set(Eina_List *list,
+ Eina_Bool checked)
+{
+ Eina_List *l;
+ ct_person_list *person_info;
+
+ EINA_LIST_FOREACH(list, l, person_info) {
+ if (NULL == person_info) {
+ ERR("elm_object_item_data_get() return NULL");
+ continue;
+ }
+ person_info->checked = checked;
+ }
+}
+
+void ct_list_edit_mode_end(ct_list_data *clist_d)
+{
+ Evas_Object *en;
+ char buf[PH_TEXT_MAX_LEN+1];
+
+ clist_d->list_mode = CT_LIST_MODE_DEFAULT;
+ ct_list_clear_pdata(clist_d);
+
+ if (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;
+ }
+ clist_d->cnt_checked = 0;
+ list_edit_all_items_checked_set(clist_d->list, EINA_FALSE);
+ if (clist_d->list_check) {
+ eina_list_free(clist_d->list_check);
+ clist_d->list_check = NULL;
+ }
+
+ if (NULL == clist_d->count_item && clist_d->cnt_list_total && !(clist_d->search_str && *clist_d->search_str)) {
+ 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->genlist)
+ elm_object_focus_set(clist_d->genlist, EINA_TRUE);
+
+ if (clist_d->search_str && *clist_d->search_str)
+ ctui_list_searchbar_cancel_cb(clist_d->searchbar, NULL, NULL);
+
+ elm_genlist_decorate_mode_set(clist_d->genlist, EINA_FALSE);
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, clist_d);
+
+ 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);
+ }
+
+ en = elm_object_part_content_get(clist_d->searchbar, "elm.swallow.content");
+ elm_entry_entry_set(en, NULL);
+
+ phone_hide_notify(clist_d->base_layout);
+}
+
+static void list_edit_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ ct_list_edit_mode_end(clist_d);
+}
+
+
+static void list_edit_delete_persons(ct_list_data *clist_d);
+
+static void list_edit_remove_record_cb(int err, void *data)
+{
+ ct_list_data *clist_d = data;
+ ph_progress_info *p_info = NULL;
+
+ p_retm_if(NULL == clist_d, "Invalid parameter(clist_d is NULL)");
+ p_info = clist_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 (p_info->update_list) {
+ contacts_list_destroy(p_info->update_list, true);
+ p_info->update_list = 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);
+ clist_d->p_info = NULL;
+ clist_d->updating = false;
+ ct_list_edit_mode_end(clist_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;
+ }
+ if (clist_d->base_grp)
+ phone_show_tickernoti(S_(PH_SYS_POP_REMOVED));
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ free(p_info);
+ clist_d->p_info = NULL;
+ clist_d->updating = false;
+ ct_list_edit_mode_end(clist_d);
+ return;
+ }
+ else {
+ list_edit_delete_persons(clist_d);
+ }
+}
+
+static void list_edit_remove_group_relation(int group_id, int person_id, contacts_list_h list_result)
+{
+ contacts_list_h list = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(group_id <= 0, "Invalid parameter(group_id is %d)", group_id);
+ p_retm_if(person_id <= 0, "Invalid parameter(person_id is %d)", person_id);
+ p_retm_if(NULL == list_result, "Invalid parameter(list is NULL)");
+
+ do {
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_create(_contacts_contact_grouprel._uri, &query))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_create(_contacts_contact_grouprel._uri, &filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_int(filter, _contacts_contact_grouprel.group_id, CONTACTS_MATCH_EQUAL, group_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_int(filter, _contacts_contact_grouprel.person_id, CONTACTS_MATCH_EQUAL, person_id))) 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;
+
+ while (CONTACTS_ERROR_NONE == err) {
+ contacts_record_h record = NULL;
+ int temp = 0;
+ int contact_id = 0;
+ contacts_record_h record_group_relation = NULL;
+ phone_cts_get_int_from_list(list, _contacts_contact_grouprel.contact_id, &contact_id);
+ err = contacts_db_get_record(_contacts_contact._uri, contact_id, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ while (CONTACTS_ERROR_NONE == (contacts_record_get_child_record_at_p(record, _contacts_contact.group_relation, temp++, &record_group_relation))) {
+ int group_relation_group_id = 0;
+ contacts_record_get_int(record_group_relation, _contacts_group_relation.group_id, &group_relation_group_id);
+ if (group_id == group_relation_group_id) {
+ err = contacts_record_remove_child_record(record, _contacts_contact.group_relation, record_group_relation);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_remove_child_record() Failed(%d)", err);
+ contacts_list_add(list_result, record);
+ break;
+ }
+ }
+ err = contacts_list_next(list);
+ }
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ contacts_list_destroy(list, true);
+ return;
+ }while (0);
+ ERR("update_group_relation Failed(%d)", err);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ contacts_list_destroy(list, true);
+ return;
+}
+
+static void list_edit_delete_persons(ct_list_data *clist_d)
+{
+ const int LIST_BULK_LENGTH = 50;
+ int count = 0;
+ int *ids = NULL;
+ double value = 0.0;
+ char percent_total[PH_TEXT_MAX_LEN+1] = {0, };
+ char percent[PH_TEXT_MAX_LEN+1] = {0, };
+ ph_progress_info *p_info = NULL;
+ ct_person_list *person_info = NULL;
+ Eina_List *l = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+ p_info = clist_d->p_info;
+ p_retm_if(NULL == p_info, "parameter(p_info) is NULL");
+
+ if (p_info->update_ids) {
+ free(p_info->update_ids);
+ p_info->update_ids = NULL;
+ }
+
+ if (clist_d->base_grp) {
+ err = contacts_list_create(&list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_create() Failed(%d)", err);
+ }
+ else {
+ if (p_info->cnt_checked_total - p_info->cnt < LIST_BULK_LENGTH)
+ ids = calloc(1, sizeof(int) * (p_info->cnt_checked_total - p_info->cnt));
+ else
+ ids = calloc(1, sizeof(int) * LIST_BULK_LENGTH);
+ p_retm_if(NULL == ids, "calloc() return NULL");
+ }
+
+ if(p_info->cnt == 0 && p_info->cnt_checked_total > 0) {
+ EINA_LIST_FOREACH(clist_d->list, l, person_info) {
+ if (NULL == person_info) continue;
+ if (person_info->checked){
+ clist_d->list_delete_records = eina_list_append(clist_d->list_delete_records, (void*)person_info->id);
+ }
+ }
+ }
+
+ void *person_id;
+ l = NULL;
+ EINA_LIST_FOREACH(clist_d->list_delete_records, l, person_id) {
+ if (clist_d->base_grp > 0)
+ list_edit_remove_group_relation(clist_d->base_grp, (int)person_id, list);
+ else{
+ if(ids)
+ ids[count] = (int)person_id;
+ }
+
+ clist_d->list_delete_records = eina_list_remove_list(clist_d->list_delete_records, l);
+ count++;
+ p_info->cnt++;
+
+ if(LIST_BULK_LENGTH == count || p_info->cnt == p_info->cnt_checked_total)
+ break;
+ }
+
+ if (clist_d->base_grp) {
+ p_info->update_list = list;
+ err = contacts_db_update_records_async(list, list_edit_remove_record_cb, clist_d);
+ p_retm_if(err != CONTACTS_ERROR_NONE, "contacts_db_update_records_async() fail(%d)",err);
+ }
+ else {
+ p_info->update_ids = ids;
+ err = contacts_db_delete_records_async(_contacts_person._uri, ids, count, list_edit_remove_record_cb, clist_d);
+ p_retm_if(err != CONTACTS_ERROR_NONE, "contacts_db_delete_records_async() fail(%d)",err);
+ }
+
+ 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);
+
+ PH_DBG("list_edit_delete_persons %d", count);
+}
+
+static Eina_Bool __list_edit_delete_start_timer_cb(void *data)
+{
+ ct_list_data *clist_d = data;
+ list_edit_delete_persons(clist_d);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void list_edit_del_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ ph_progress_info *p_info;
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc return NULL");
+
+ clist_d->updating = true;
+
+ clist_d->p_info = p_info;
+ p_info->cnt_checked_total = clist_d->cnt_checked;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->popup = phone_progressbar_popup(clist_d->win, p_info, T_(CT_GET_TEXT_BASIC, CTTEXT_DELETING_CONTACTS));
+ p_info->timer = ecore_timer_add(0.5, __list_edit_delete_start_timer_cb, clist_d );
+}
+
+static void list_edit_check_done(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;
+
+ // called by setting - import contacts (list - vcard contacts)
+ if (CT_GET_LIST_VCARD == clist_d->list_op) {
+ clist_d->select_result_cb(clist_d->select_result_cb_data, NULL, 0);
+ phone_hide_notify(clist_d->base_layout);
+ return;
+ }
+ 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){
+ if(result_list_email)
+ result_list_email[email_count++] = person_info->id_ret;
+ }
+ else{
+ if(result_list_person)
+ 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 (CT_UG_REQUEST_CHECK_FOR_NUMBER != clist_d->ug_request)
+ ctui_list_edit_navi_pop(clist_d, NULL, NULL);
+ elm_naviframe_item_pop(clist_d->navi);
+ }
+ if (clist_d->contact_add_cb) { // called by group,favorite view - check person_info
+ if (0 < cnt_checked) {
+ clist_d->contact_add_cb(clist_d->win, clist_d->navi, cnt_checked);
+ phone_hide_notify(clist_d->base_layout);
+ }
+ else
+ elm_naviframe_item_pop_to(evas_object_data_get(clist_d->navi, "navi_it_pop"));
+ if(result_list_person)
+ free(result_list_person);
+ if(result_list_number)
+ free(result_list_number);
+ if(result_list_email)
+ free(result_list_email);
+ return;
+ }
+
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request)
+ phone_list_ug_return_ids(clist_d->ug, result_list_number, cnt_checked, CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST);
+ else if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request)
+ phone_list_ug_return_ids(clist_d->ug, result_list_email, cnt_checked, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST);
+ else if (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request)
+ phone_list_ug_return_number_email_ids(clist_d->ug, result_list_number, number_count, result_list_email, email_count);
+ else
+ phone_list_ug_return_ids(clist_d->ug, result_list_person, cnt_checked, CT_UG_BUNDLE_RESULT_PERSON_ID_LIST);
+
+ if(result_list_person)
+ free(result_list_person);
+ if(result_list_number)
+ free(result_list_number);
+ if(result_list_email)
+ free(result_list_email);
+
+ ug_destroy_me(clist_d->ug);
+}
+
+static void list_gadd_view_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_smart_callback_del(obj, "clicked", list_gadd_view_cancel_btn_cb);
+ phone_hide_notify(data);
+ elm_naviframe_item_pop_to(evas_object_data_get(data, "navi_it_pop"));
+}
+
+void ct_list_edit_make_edit_navi(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ Evas_Object *delete_button = NULL;// used for delete button or remove button
+ Evas_Object *done_button = NULL;
+ Evas_Object *l_btn;
+
+ phone_navi_item_clear(clist_d->navi_item);
+
+ if (CT_UG_REQUEST_CHECK == clist_d->ug_request ||
+ CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request ||
+ CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request ||
+ CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request) {
+ done_button = elm_button_add(clist_d->navi);
+ elm_object_text_set(done_button, S_(CT_SYS_SK_DONE));
+ evas_object_smart_callback_add(done_button, "clicked", list_edit_check_done, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button1", done_button);
+ evas_object_data_set(clist_d->navi, "done_button", done_button);
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request)
+ evas_object_smart_callback_add(clist_d->navi, "transition,finished", ctui_list_edit_navi_pop, clist_d);
+
+ if (clist_d->navi_item != elm_naviframe_bottom_item_get(clist_d->navi)) { // group view, setting view : CHECK MODE
+ if (clist_d->select_result_cb || clist_d->ug) {
+ elm_object_style_set(done_button, "naviframe/toolbar/default");
+ l_btn = elm_button_add(clist_d->navi);
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(l_btn, "clicked", phone_view_back_btn_cb, clist_d->navi);
+ elm_object_item_part_content_set(clist_d->navi_item, "prev_btn", l_btn);
+ }
+ else {
+ l_btn = elm_button_add(clist_d->navi);
+ elm_object_text_set(l_btn, S_(PH_SYS_SK_CANCEL));
+ evas_object_smart_callback_add(l_btn, "clicked", list_gadd_view_cancel_btn_cb, clist_d->navi);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button2", l_btn);
+ elm_object_style_set(done_button, "naviframe/toolbar/left");
+ elm_object_style_set(l_btn, "naviframe/toolbar/right");
+ }
+ }
+ else { // check UG
+ l_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, clist_d->ug);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button2", l_btn);
+ elm_object_style_set(done_button, "naviframe/toolbar/left");
+ elm_object_style_set(l_btn, "naviframe/toolbar/right");
+ }
+ }
+ else if (!clist_d->ug) {
+ // group detail : all or not assign, do not dispaly del button
+ if (clist_d->navi_item == elm_naviframe_bottom_item_get(clist_d->navi) || clist_d->base_grp) {
+ delete_button = elm_button_add(clist_d->navi);
+ if(CT_LIST_MULTI_REMOVE_MEMBER == clist_d->view_id)
+ elm_object_text_set(delete_button, S_(PH_SYS_BODY_REMOVE));
+ else
+ elm_object_text_set(delete_button, S_(PH_SYS_SK_DELETE));
+ evas_object_smart_callback_add(delete_button, "clicked", list_edit_del_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button1", delete_button);
+ elm_object_style_set(delete_button, "naviframe/toolbar/left");
+ evas_object_data_set(clist_d->navi, "delete_button", delete_button);
+ }
+ Evas_Object *cancel_btn = elm_button_add(clist_d->navi);
+ elm_object_text_set(cancel_btn, S_(PH_SYS_SK_CANCEL));
+ evas_object_smart_callback_add(cancel_btn, "clicked", list_edit_cancel_cb, clist_d);
+ elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button2", cancel_btn);
+ elm_object_style_set(cancel_btn, "naviframe/toolbar/right");
+ }
+}
+
+static void list_edit_select_all(void *data, Eina_Bool checked)
+{
+ ct_list_data *clist_d = data;
+
+ list_edit_items_checked_set(clist_d, checked);
+ elm_genlist_realized_items_update(clist_d->genlist);
+
+ if (checked)
+ clist_d->cnt_checked = clist_d->cnt_list_total;
+ else
+ clist_d->cnt_checked = 0;
+
+ ctui_list_update_selection_info(clist_d);
+}
+
+
+void ct_list_item_checked_set(Elm_Object_Item *item, ct_list_data *clist_d)
+{
+ ct_person_list *person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() returns NULL");
+
+ if (person_info->checked) {
+ if (clist_d->cnt_max_check) {
+ if (clist_d->cnt_max_check <= clist_d->cnt_checked) {
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_EXCEED_LIMIT), 2.0);
+ person_info->checked = EINA_FALSE;
+ return;
+ }
+ }
+ clist_d->cnt_checked++;
+ }
+ else
+ clist_d->cnt_checked--;
+ elm_genlist_item_update(item);
+ clist_d->list_check = list_edit_update_person_check_list(clist_d->list_check, person_info->id, person_info->checked);
+}
+
+static void list_edit_item_check_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ Elm_Object_Item *item;
+ ct_person_list *person_info;
+ ct_list_data *clist_d = data;
+
+ person_info = evas_object_data_get(obj, "person_info");
+ p_retm_if(NULL == person_info, "evas_object_data_get() return NULL");
+
+ item = person_info->item;
+ p_retm_if(NULL == item, "person_info->item is NULL");
+
+ if (person_info->checked) {
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ return;
+ }
+
+ elm_genlist_item_update(item);
+
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request)
+ ct_list_ug_handle_check_for_number(item, clist_d);
+ else if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request)
+ ct_list_ug_handle_check_for_email(item, clist_d);
+ else if (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request)
+ ct_list_ug_handle_check_for_number_or_email(item, clist_d);
+ else {
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ }
+
+}
+
+Evas_Object* ct_list_edit_add_check(Evas_Object *parent, Eina_Bool *checked,
+ ct_list_data *clist_d)
+{
+ Evas_Object *check = elm_check_add(parent);
+ elm_check_state_set(check, *checked);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ evas_object_smart_callback_add(check, "changed", list_edit_item_check_cb, clist_d);
+ return check;
+}
+
+API void ctui_list_edit_mode_start(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+
+ //Sweep Off in Edit mode
+ ctui_list_set_unsweep(clist_d);
+
+ clist_d->list_mode = CT_LIST_MODE_EDIT;
+
+
+ // Append 'Select All' layout
+ if ((CT_UG_REQUEST_CHECK_FOR_NUMBER != clist_d->ug_request) &&
+ (CT_UG_REQUEST_CHECK_FOR_EMAIL != clist_d->ug_request) &&
+ (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL != clist_d->ug_request) &&
+ (CT_LIST_MULTI_ADD_MEMBER != clist_d->view_id))
+ if (((!clist_d->ug_request || clist_d->select_result_cb) || (clist_d->base_grp > 0 && clist_d->contact_add_cb)) &&
+ (0 == clist_d->cnt_max_check || clist_d->cnt_list_total <= clist_d->cnt_max_check)) {
+ clist_d->select_all_layout = phone_create_select_all(clist_d->box, S_(PH_SYS_BODY_SELECT_ALL), list_edit_select_all, clist_d);
+ elm_box_pack_start(clist_d->box, clist_d->select_all_layout);
+ }
+
+ if (clist_d->count_item) {
+ elm_object_item_del(clist_d->count_item);
+ clist_d->count_item = NULL;
+ }
+ elm_genlist_decorate_mode_set(clist_d->genlist, EINA_TRUE);
+
+ if (CT_LIST_IN_MULTI_TAB != clist_d->tab_mode && !clist_d->title
+ && CT_UG_REQUEST_SELECT_PERSON <= clist_d->ug_request) {
+ elm_object_item_text_set(clist_d->navi_item, T_(CT_GET_TEXT_BASIC, CTTEXT_SELECT_CONTACTS));
+ }
+ if (0 < clist_d->cnt_list_total)
+ phone_show_notify(clist_d->base_layout, T_(CT_GET_TEXT_BASIC, CTTEXT_SELECT_CONTACTS));
+
+ ctui_list_navi_set(CT_LIST_MODE_EDIT, clist_d);
+
+ if(clist_d->genlist)
+ elm_object_focus_set(clist_d->genlist, EINA_TRUE);
+}
+
+void ct_list_edit_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+ p_retm_if(NULL == clist_d->navi_item, "parameter(navi_item) is NULL");
+
+ if (clist_d->popup){
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+ }
+
+ ctui_list_edit_mode_start(clist_d);
+}
+
+API void ctui_list_set_selectall(ct_list_data *clist_d)
+{
+ PH_DBG("ctui_list_set_selectall view_id %d", clist_d->view_id);
+ if(NULL!=clist_d->select_all_layout
+ || CT_LIST_MODE_DEFAULT== clist_d->list_mode
+ || CT_LIST_MULTI_ADD_MEMBER == clist_d->view_id )
+ return;
+ // Append 'Select All' layout
+ if((CT_UG_REQUEST_CHECK_FOR_NUMBER != clist_d->ug_request) &&
+ (CT_UG_REQUEST_CHECK_FOR_EMAIL != clist_d->ug_request) &&
+ (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL != clist_d->ug_request))
+ if (((!clist_d->ug_request || clist_d->select_result_cb) || (clist_d->base_grp > 0 && clist_d->contact_add_cb)) &&
+ (0 == clist_d->cnt_max_check || clist_d->cnt_list_total <= clist_d->cnt_max_check)) {
+ clist_d->select_all_layout = phone_create_select_all(clist_d->box, S_(PH_SYS_BODY_SELECT_ALL), list_edit_select_all, clist_d);
+ elm_box_pack_start(clist_d->box, clist_d->select_all_layout);
+ }
+
+}
+
diff --git a/lib/list/ct-list-edit-view.h b/lib/list/ct-list-edit-view.h
new file mode 100755
index 0000000..577fb00
--- /dev/null
+++ b/lib/list/ct-list-edit-view.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_LIST_EDIT_VIEW_H__
+#define __CONTACTS_LIST_EDIT_VIEW_H__
+
+void ct_list_edit_mode_end(ct_list_data *clist_d);
+void ct_list_edit_cb(void *data, Evas_Object *obj, void *event_info);
+void ct_list_edit_make_edit_navi(ct_list_data *clist_d);
+Evas_Object* ct_list_edit_add_check(Evas_Object *parent, Eina_Bool *checked, ct_list_data *clist_d);
+void ct_list_item_checked_set(Elm_Object_Item *item, ct_list_data *clist_d);
+
+
+#endif //__CONTACTS_LIST_EDIT_VIEW_H__
+
diff --git a/lib/list/ct-list-main.c b/lib/list/ct-list-main.c
new file mode 100755
index 0000000..6d42602
--- /dev/null
+++ b/lib/list/ct-list-main.c
@@ -0,0 +1,608 @@
+/*
+* 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 <ui-gadget-module.h>
+#include "phone.h"
+#include "ct-list.h"
+#include "ct-group.h"
+#include "ct-detail.h"
+#include "ct-list-utils.h"
+#include "ct-list-view-ug.h"
+#include "ct-list-contact-view.h"
+#include "ct-list-edit-view.h"
+
+API void ctui_list_view_reset(ct_list_data *clist_d)
+{
+ evas_object_data_del(clist_d->navi, "done_button");
+ evas_object_data_del(clist_d->navi, "edit_button");
+ evas_object_data_del(clist_d->navi, "new_button");
+ evas_object_data_del(clist_d->navi, "view_button");
+ evas_object_data_del(clist_d->navi, "account_button");
+
+ if (CT_UG_REQUEST_CHECK != clist_d->ug_request &&
+ CT_UG_REQUEST_CHECK_FOR_NUMBER != clist_d->ug_request &&
+ CT_UG_REQUEST_CHECK_FOR_EMAIL != clist_d->ug_request &&
+ CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL != clist_d->ug_request)
+ if (CT_LIST_MODE_EDIT == clist_d->list_mode)
+ ct_list_edit_mode_end(clist_d);
+
+ if (elm_naviframe_top_item_get(clist_d->navi) != clist_d->navi_item)
+ elm_naviframe_item_pop_to(clist_d->navi_item);
+ else
+ ctui_list_set_unsweep(clist_d);
+
+ if (clist_d->child_ug) {
+ ug_destroy(clist_d->child_ug);
+ clist_d->child_ug = NULL;
+ }
+}
+
+API void ctui_list_view_language_changed(Evas_Object *navi)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d;
+ void *cdetail_d;
+ clist_d = evas_object_data_get(navi, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+ ctui_list_genlist_update(clist_d);
+ if (clist_d->searchbar)
+ elm_object_part_text_set(clist_d->searchbar, "elm.guidetext", S_(CT_SYS_BODY_SEARCH));
+
+ ctui_list_update_selection_info(clist_d);
+
+ cdetail_d = evas_object_data_get(navi, "cdetail_d");
+ if (cdetail_d)
+ ct_detail_view_language_changed(cdetail_d);
+}
+
+static int create_list_view(Evas_Object *base, ct_list_data *clist_d)
+{
+ char buf[PH_TEXT_SHORT_LEN];
+
+ if (NULL == clist_d->navi) {
+ p_retvm_if(NULL == base, FALSE, "base is NULL");
+ clist_d->navi = elm_naviframe_add(base);
+ p_retvm_if(NULL == clist_d->navi, FALSE, "navi is NULL");
+ elm_naviframe_prev_btn_auto_pushed_set(clist_d->navi, EINA_FALSE);
+ elm_object_part_content_set(base, "elm.swallow.content", clist_d->navi);
+ evas_object_show(clist_d->navi);
+ }
+ ct_list_init_account_data(clist_d);
+ if (CT_GET_LIST_VCARD != clist_d->list_op)
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ clist_d->base_layout = ct_list_create_contact_view(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);
+
+ return TRUE;
+}
+
+static Evas_Object* list_create_vcard_list_view(Evas_Object *base, ct_list_data *clist_d)
+{
+ char buf[PH_TEXT_SHORT_LEN];
+
+ p_retvm_if(NULL == base, FALSE, "base is NULL");
+
+ clist_d->navi = elm_naviframe_add(base);
+ p_retvm_if(NULL == clist_d->navi, FALSE, "navi is NULL");
+ elm_naviframe_prev_btn_auto_pushed_set(clist_d->navi, EINA_FALSE);
+ evas_object_show(clist_d->navi);
+
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+
+ clist_d->title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_VCARD_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);
+ if (clist_d->select_result_cb)
+ ctui_list_edit_mode_start(clist_d);
+ else
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, clist_d);
+
+ elm_object_part_content_set(base, "elm.swallow.content", clist_d->navi);
+
+ return clist_d->navi;
+}
+
+static void *list_on_create(ui_gadget_h ug, enum ug_mode mode,
+ service_h service, void *priv)
+{
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *bg, *base;
+ Evas_Object *parent;
+ ct_list_data *clist_d = priv;
+
+ p_retvm_if(NULL == ug || NULL == priv, NULL,
+ "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
+
+ clist_d->win = ug_get_window();
+ parent = ug_get_parent_layout(ug);
+ p_retvm_if(NULL == parent, NULL, "ug_get_parent_layout() return NULL");
+ clist_d->ug = ug;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ err = contacts_connect2();
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_connect2() Failed(%d)", err);
+
+ if (UG_MODE_FULLVIEW == mode)
+ base = phone_create_base_layout(parent, true);
+ else
+ base = phone_create_base_layout(parent, false);
+
+ ret = ct_list_parse_bundle(service, clist_d);
+ 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_(CT_SYS_POP_FILE_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, clist_d->ug);
+ return base;
+ }
+ p_retvm_if(-1 == ret, NULL, "ct_list_parse_bundle() Failed");
+ clist_d->base_ab = -1;
+
+ 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 (clist_d->ug_request == CT_UG_REQUEST_SELECT_GROUP ||
+ clist_d->ug_request == CT_UG_REQUEST_SELECT_GROUP_ADD_TO_HOME) {
+ Evas_Object *layout = phone_create_group_view_ug(clist_d->ug, base, clist_d->ug_request);
+ phone_group_set_navi(layout);
+ }
+ else if (FALSE == create_list_view(base, clist_d)) {
+ evas_object_del(base);
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ }
+ else {
+ if (CT_UG_REQUEST_CHECK == clist_d->ug_request ||
+ CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request ||
+ CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request ||
+ CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request)
+ ctui_list_edit_mode_start(clist_d);
+ else
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, clist_d);
+ }
+
+ return base;
+}
+
+static void list_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+static void list_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_list_data *clist_d = priv;
+ err = contacts_setting_get_name_display_order(&(clist_d->order_display));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_setting_get_name_display_order() Failed(%d)", err);
+ clist_d->is_background = true;
+}
+
+static void list_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ ct_list_data *clist_d = priv;
+ ct_detail_data *cdetail_d;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_name_display_order_e order_display;
+
+ clist_d->is_background = false;
+
+ err = contacts_setting_get_name_display_order(&order_display);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_setting_get_name_display_order() Failed(%d)", err);
+
+ if (clist_d->order_display != order_display) {
+ ctui_list_genlist_update(clist_d);
+ cdetail_d = evas_object_data_get(clist_d->navi, "cdetail_d");
+ if (cdetail_d)
+ ctui_detail_genlist_update(cdetail_d);
+ }
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ ctui_list_genlist_update(clist_d);
+ }
+}
+
+static void list_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ ct_list_data *clist_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:
+ ctui_list_view_language_changed(clist_d->navi);
+ break;
+ default:
+ break;
+ }
+}
+
+static void list_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_list_data *clist_d =priv;
+ p_retm_if(NULL == priv, "The parameter is invalid(priv=%p)", priv);
+ p_retm_if(NULL == ug, "The parameter is invalid(ug=%p)", ug);
+
+ free(clist_d->ug_data);
+
+ if(clist_d->ug) {
+ evas_object_del(ug_get_layout(ug));
+ }
+
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ct_list_data *clist_d;
+
+ p_retvm_if(!ops, -1, "ops is NULL");
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, -1, "UG data is NULL, Not enough memory");
+
+ ops->create = list_on_create;
+ ops->start = NULL;
+ ops->pause = list_on_pause;
+ ops->resume = list_on_resume;
+ ops->destroy = list_on_destroy;
+ ops->message = list_on_message;
+ ops->event = list_on_event;
+ ops->key_event = NULL;
+ ops->priv = clist_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");
+
+ free(ops->priv);
+ ops->priv = NULL;
+}
+
+// Setting - export,import / Group - Message,Email,Share,ChatOn
+API Evas_Object* ctui_create_list_select_view(Evas_Object *navi,
+ ct_select_result_cb result_cb, void *result_cb_data, int list_op, int id_ab, int id_grp, int cnt_max)
+{
+ PH_DBG("list_op = %d, id_ab = %d, id_grp = %d", list_op, id_ab, id_grp);
+
+ ct_list_data *clist_d;
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, NULL, "clist_d is NULL, Not enough memory");
+
+ clist_d->navi = navi;
+ clist_d->select_result_cb = result_cb;
+ clist_d->select_result_cb_data = result_cb_data;
+ clist_d->list_op = list_op;
+ clist_d->base_ab = id_ab;
+ clist_d->base_grp = id_grp;
+
+ if(cnt_max > 0)
+ {
+ clist_d->cnt_max_check = cnt_max;
+ }
+
+ switch(list_op) {
+ case CT_GET_LIST_ALL_PERSON_HAD_NUMBER:
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OF_GROUP_ID:
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OF_ADDRBOOK_ID:
+ clist_d->ug_request = CT_UG_REQUEST_CHECK_FOR_NUMBER;
+ break;
+ case CT_GET_LIST_ALL_PERSON_HAD_EMAIL:
+ case CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_HAD_EMAIL_OF_GROUP_ID:
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_EMAIL_OF_ADDRBOOK_ID:
+ clist_d->ug_request = CT_UG_REQUEST_CHECK_FOR_EMAIL;
+ break;
+ case CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL:
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_GROUP_ID:
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID:
+ clist_d->ug_request = CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL;
+ break;
+ default:
+ clist_d->ug_request = CT_UG_REQUEST_CHECK;
+ break;
+ }
+
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+
+ ct_list_get_title(clist_d, list_op, id_ab, id_grp);
+
+ if (clist_d->sub_title) {
+ clist_d->navi_item = elm_naviframe_item_push(clist_d->navi, clist_d->title, NULL,
+ NULL, clist_d->base_layout, NULL);
+ elm_object_item_part_text_set(clist_d->navi_item, "subtitle", clist_d->sub_title);
+ }
+ else
+ clist_d->navi_item = elm_naviframe_item_push(clist_d->navi, clist_d->title, NULL,
+ NULL, clist_d->base_layout, NULL);
+ ctui_list_edit_mode_start(clist_d);
+
+ return clist_d->navi;
+}
+
+API void ctui_create_favorite_list_select_view(Evas_Object *win, Evas_Object *navi, Eina_List *list)
+{
+ ct_list_data *clist_d;
+ char buf[PH_TEXT_SHORT_LEN];
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retm_if(!clist_d, "clist_d is NULL, Not enough memory");
+
+ clist_d->win = win;
+ clist_d->navi = navi;
+ clist_d->contact_add_cb = ct_list_add_contacts_to_favorite;
+ clist_d->ug_request = CT_UG_REQUEST_CHECK;
+ clist_d->list = list;
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+ clist_d->title = strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_ADD_TO_FAVOURITES));
+ clist_d->cnt_list_total = eina_list_count(list);
+ clist_d->base_ab = -1;
+
+ 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);
+ ctui_list_edit_mode_start(clist_d);
+ evas_object_data_set(clist_d->navi, "favor_list_d", clist_d);
+}
+
+API Evas_Object* ctui_create_gadd_list_select_view(Evas_Object *win, Evas_Object *navi, int group_id, int ab_id, Eina_List *list)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d;
+ char buf[PH_TEXT_SHORT_LEN];
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, NULL, "clist_d is NULL, Not enough memory");
+
+ clist_d->win = win;
+ clist_d->navi = navi;
+ clist_d->contact_add_cb = ct_list_add_contacts_to_group;
+ clist_d->view_id = CT_LIST_MULTI_ADD_MEMBER;
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ clist_d->ug_request = CT_UG_REQUEST_CHECK;
+ clist_d->base_grp = group_id;
+ clist_d->base_ab = ab_id;
+ clist_d->list_grp_person = list;
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+ clist_d->title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_SELECT_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);
+ ctui_list_edit_mode_start(clist_d);
+ evas_object_data_set(clist_d->navi, "gadd_list_d", clist_d);
+
+ return clist_d->navi;
+}
+
+// Show vcard contact list check view to importing contacts from vcf file
+API Evas_Object* ctui_create_vcard_list_select_view(Evas_Object *navi, Eina_List *list, const char *path,
+ ct_select_result_cb result_cb, void *result_cb_data)
+{
+ ct_list_data *clist_d;
+ char buf[PH_TEXT_SHORT_LEN];
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, NULL, "clist_d is NULL, Not enough memory");
+
+ clist_d->navi = navi;
+ clist_d->list = list;
+ clist_d->cnt_list_total = eina_list_count(list);
+ clist_d->vcard_path = path;
+ clist_d->select_result_cb = result_cb;
+ clist_d->select_result_cb_data = result_cb_data;
+ clist_d->list_op = CT_GET_LIST_VCARD;
+ clist_d->ug_request = CT_UG_REQUEST_CHECK;
+ clist_d->base_ab = -1;
+
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+ clist_d->title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_VCARD_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);
+ ctui_list_edit_mode_start(clist_d);
+
+ evas_object_data_set(clist_d->navi, "clist_d", clist_d);
+ return clist_d->navi;
+}
+
+// Show contact list view from vcf file
+API Evas_Object* ctui_create_vcard_list_view(Evas_Object *win, Eina_List *list, const char *path)
+{
+ ct_list_data *clist_d;
+ Evas_Object *bg, *base, *conform, *navi;
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, NULL, "clist_d is NULL, Not enough memory");
+
+ clist_d->win = win;
+ clist_d->list = list;
+ clist_d->cnt_list_total = eina_list_count(list);
+ clist_d->vcard_path = path;
+ clist_d->base_ab = -1;
+
+ conform = elm_conformant_add(win);
+ p_retvm_if(NULL == conform, NULL, "elm_conformant_add() Failed");
+ evas_object_show(conform);
+
+ base = phone_create_base_layout(win, true);
+ if (base) {
+ clist_d->list_op = CT_GET_LIST_VCARD;
+ navi = list_create_vcard_list_view(base, clist_d);
+
+ evas_object_data_set(win, "naviframe", (void *)navi);
+
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ evas_object_del(base);
+ free(clist_d);
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(conform, 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);
+ evas_object_data_set(clist_d->navi, "clist_d", clist_d);
+
+ return base;
+ }
+ else {
+ free(clist_d);
+ return NULL;
+ }
+}
+
+API Evas_Object* ctui_create_phone_list_view(ph_view_info *view_info)
+{
+ ct_list_data *clist_d;
+
+ clist_d = calloc(1, sizeof(ct_list_data));
+ p_retvm_if(!clist_d, NULL, "clist_d is NULL, Not enough memory");
+
+ clist_d->ug = view_info->ug;
+ clist_d->win = view_info->win;
+ clist_d->navi = view_info->navi;
+ clist_d->tab_mode = CT_LIST_IN_MULTI_TAB;
+ clist_d->navi_item = elm_naviframe_bottom_item_get(view_info->navi);
+
+ switch (view_info->ug_request) {
+ case PH_UG_REQUEST_CHECK_FOR_EMAIL:
+ case PH_UG_REQUEST_SELECT_EMAIL:
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_EMAIL;
+ break;
+ case PH_UG_REQUEST_CHECK_FOR_NUMBER:
+ case PH_UG_REQUEST_SELECT_NUMBER:
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER;
+ break;
+ case PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ case PH_UG_REQUEST_SELECT_NUMBER_OR_EMAIL:
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL;
+ break;
+ default:
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON;
+ break;
+ }
+
+ clist_d->base_ab = ctui_get_view_mode();
+ if(clist_d->base_ab > -1) {
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ }
+ else
+ clist_d->base_ab = -1;
+
+ clist_d->ug_request = view_info->ug_request;
+ clist_d->ug_data = view_info->ug_data;
+ clist_d->cnt_max_check = view_info->ug_cnt_max;
+
+ ct_list_init_account_data(clist_d);
+
+ ct_list_get_contacts(clist_d, &clist_d->list);
+ clist_d->base_layout = ct_list_create_contact_view(clist_d);
+ evas_object_data_set(clist_d->navi, "clist_d", clist_d);
+
+ return clist_d->base_layout;
+}
+
+API void ctui_list_view_resume(Evas_Object *navi)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d;
+ ct_detail_data *cdetail_d;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_name_display_order_e order_display;
+
+ clist_d = evas_object_data_get(navi, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+
+ clist_d->is_background = false;
+
+ err = contacts_setting_get_name_display_order(&order_display);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_setting_get_name_display_order() Failed(%d)", err);
+
+ if (clist_d->order_display != order_display)
+ ctui_list_genlist_update(clist_d);
+
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ ctui_list_genlist_update(clist_d);
+ }
+}
+
+API void ctui_list_set_background(Evas_Object *obj, bool is_background)
+{
+ ct_list_data *clist_d;
+ clist_d = evas_object_data_get(obj, "clist_d");
+ p_retm_if(NULL == clist_d, "log data is null");
+
+ clist_d->is_background = is_background;
+ if (clist_d->update_timer) {
+ ecore_timer_del(clist_d->update_timer);
+ clist_d->update_timer = NULL;
+ ctui_list_lazy_update(_contacts_person._uri, clist_d);
+ }
+}
+
+API void ctui_list_view_pause(Evas_Object *navi)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_list_data *clist_d;
+ ct_detail_data *cdetail_d;
+ clist_d = evas_object_data_get(navi, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+
+ err = contacts_setting_get_name_display_order(&(clist_d->order_display));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_setting_get_name_display_order() Failed(%d)", err);
+
+}
+
diff --git a/lib/list/ct-list-utils.c b/lib/list/ct-list-utils.c
new file mode 100755
index 0000000..d5bccc5
--- /dev/null
+++ b/lib/list/ct-list-utils.c
@@ -0,0 +1,866 @@
+/*
+* 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 <errno.h>
+#include <fcntl.h>
+#include <ui-gadget-module.h>
+#include "phone.h"
+#include "ct-detail.h"
+#include "ct-list.h"
+#include "ct-list-contact-view.h"
+#include "ct-list-utils.h"
+
+int ct_list_parse_bundle(service_h service, ct_list_data* clist_d)
+{
+ char* val = NULL;
+
+ if (service) {
+ service_get_extra_data(service, CT_UG_BUNDLE_TYPE, &val);
+ if (val) clist_d->ug_request = atoi(val);
+ PH_DBG("type = %d", clist_d->ug_request);
+ free(val);
+
+ switch (clist_d->ug_request) {
+ case CT_UG_REQUEST_SELECT_GROUP:
+ case CT_UG_REQUEST_SELECT_GROUP_ADD_TO_HOME:
+ return 0;
+ case CT_UG_REQUEST_LIST:
+ case CT_UG_REQUEST_LIST_WITH_BACK:
+ case CT_UG_REQUEST_SELECT_PERSON:
+ case CT_UG_REQUEST_SHARE_CONTACT_INFO:
+ case CT_UG_REQUEST_SELECT_VCARD:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+
+ break;
+ case CT_UG_REQUEST_SELECT_NUMBER:
+ case CT_UG_REQUEST_SELECT_CONTACT_ADD_TO_HOME:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER;
+ }
+ break;
+ case CT_UG_REQUEST_SELECT_EMAIL:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_EMAIL;
+ }
+ break;
+ case CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL;
+ }
+ break;
+ case CT_UG_REQUEST_UPDATE_CONTACT:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ service_get_extra_data(service, CT_UG_BUNDLE_NUM, &clist_d->ug_data);
+ if(clist_d->ug_data)
+ break;
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &clist_d->ug_data);
+ if(clist_d->ug_data)
+ break;
+ service_get_extra_data(service, CT_UG_BUNDLE_WEB, &clist_d->ug_data);
+ if(clist_d->ug_data)
+ break;
+ break;
+ case CT_UG_REQUEST_UPDATE_WITH_NUM:
+ service_get_extra_data(service, CT_UG_BUNDLE_NUM, &clist_d->ug_data);
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID;
+ break;
+ case CT_UG_REQUEST_UPDATE_WITH_EMAIL:
+ service_get_extra_data(service, CT_UG_BUNDLE_EMAIL, &clist_d->ug_data);
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID;
+ break;
+ case CT_UG_REQUEST_UPDATE_WITH_WEB:
+ service_get_extra_data(service, CT_UG_BUNDLE_WEB, &clist_d->ug_data);
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID;
+ break;
+ case CT_UG_REQUEST_CHECK:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ service_get_extra_data(service, CT_UG_BUNDLE_MAX, &val);
+ if (val) {
+ clist_d->cnt_max_check = atoi(val);
+ free(val);
+ }
+ }
+ break;
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if (val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER;
+ service_get_extra_data(service, CT_UG_BUNDLE_MAX, &val);
+ if (val)
+ clist_d->cnt_max_check = atoi(val);
+ free(val);
+ }
+ break;
+ case CT_UG_REQUEST_CHECK_FOR_EMAIL:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if(val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_EMAIL;
+ service_get_extra_data(service, CT_UG_BUNDLE_MAX, &val);
+ if (val)
+ clist_d->cnt_max_check = atoi(val);
+ free(val);
+ }
+ break;
+ case CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ val = NULL;
+ service_get_extra_data(service, CT_UG_BUNDLE_ACCOUNTID, &val);
+ if (val) {
+ clist_d->list_op = CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID;
+ clist_d->base_ab = atoi(val);
+ free(val);
+ }
+ else {
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL;
+ service_get_extra_data(service, CT_UG_BUNDLE_MAX, &val);
+ if (val)
+ clist_d->cnt_max_check = atoi(val);
+ free(val);
+ }
+ break;
+ break;
+ case PH_UG_REQUEST_SET_WITH_IMG:
+ case PH_UG_REQUEST_SET_WITH_RINGTONE:
+ case CT_UG_REQUEST_SAVE_IMG:
+ case CT_UG_REQUEST_SAVE_RINGTONE:
+ service_get_extra_data(service, CT_UG_BUNDLE_PATH, &clist_d->ug_data);
+ if(CT_UG_REQUEST_SAVE_IMG == clist_d->ug_request)
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID;
+ if (-1 == access(clist_d->ug_data, R_OK)) {
+ ERR("Invalid filepath(%s)", clist_d->ug_data);
+ return -2;
+ }
+ break;
+ default:
+ ERR("Invalid request(%d)", clist_d->ug_request);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static void list_img_crop_result_for_add(ui_gadget_h ug,service_h service, void *data)
+{
+ contacts_record_h record_image = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_detail_data *cdetail_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ char *normal = NULL;
+ char *full = NULL;
+
+ service_get_extra_data(service, "crop_image_path", &normal);
+ p_retm_if(!normal, "return value is NULL.\n");
+
+ service_get_extra_data(service, "image_path", &full);
+ record_image = ctui_get_record_image(cdetail_d->contact);
+
+ err = contacts_record_set_str(record_image, _contacts_image.path, normal);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ free(normal);
+ free(full);
+ }
+ cdetail_d->only_input = true;
+ ctui_create_input_view(cdetail_d);
+}
+
+static void list_destory_detail_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_list_destroy_child_ug(void *data)
+{
+ ct_list_data *clist_d = (ct_list_data*)data;
+ clist_d->child_ug = NULL;
+}
+
+API void ctui_list_update_with_data(ph_view_info *view_info, void *data, int person_id, int grp_id, int ab_id)
+{
+ PH_FN_CALL;
+ ct_detail_data *cdetail_d;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ struct ug_cbs cbs = {0};
+
+ cdetail_d = calloc(1, sizeof(ct_detail_data));
+ p_retm_if(!cdetail_d, "cdetail_d is NULL, Not enough memory");
+
+ cdetail_d->win = view_info->win;
+ cdetail_d->navi = view_info->navi;
+ cdetail_d->ug = view_info->ug;
+ cdetail_d->prev_navi_item = elm_naviframe_top_item_get(view_info->navi);
+ cdetail_d->prev_view_data = data;
+ cdetail_d->person_id = person_id;
+ cdetail_d->base_grp = grp_id;
+ cdetail_d->base_ab = ab_id;
+ cdetail_d->ug_request = view_info->ug_request;
+
+ if (person_id) {
+ Eina_List *list_contact;
+ err = contacts_db_get_record(_contacts_person._uri, person_id, &(cdetail_d->person));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ list_contact = ctui_person_get_writable_contact_list(person_id);
+ if (NULL == list_contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+ }
+ else {
+ err = contacts_record_clone((contacts_record_h)list_contact->data, &(cdetail_d->contact));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_clone() Failed(%d)", err);
+ ctui_free_record_list(list_contact);
+ }
+ }
+
+ 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);
+ }
+
+ switch (view_info->ug_request) {
+ //case PH_UG_REQUEST_SET_WITH_NUM:
+ case CT_UG_REQUEST_UPDATE_WITH_NUM:
+ err = contacts_record_create(_contacts_number._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_number.number, view_info->ug_data);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_record_set_int(record, _contacts_number.type, CONTACTS_NUMBER_TYPE_CELL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_add_child_record(cdetail_d->contact, _contacts_contact.number, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ break;
+ //case PH_UG_REQUEST_SET_WITH_EMAIL:
+ case CT_UG_REQUEST_UPDATE_WITH_EMAIL:
+ err = contacts_record_create(_contacts_email._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_email.email, view_info->ug_data);
+ 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);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ break;
+ //case PH_UG_REQUEST_SET_WITH_WEB:
+ case CT_UG_REQUEST_UPDATE_WITH_WEB:
+ err = contacts_record_create(_contacts_url._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_url.url, view_info->ug_data);
+ 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.url, record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_add_child_record() Failed(%d)", err);
+ break;
+ case CT_UG_REQUEST_UPDATE_CONTACT:
+ break;
+ case PH_UG_REQUEST_SET_WITH_IMG:
+ case CT_UG_REQUEST_SAVE_IMG: //only handle for add
+ cbs.result_cb = list_img_crop_result_for_add;
+ cbs.destroy_cb = list_destory_detail_child_ug;
+ cbs.priv = cdetail_d;
+ cdetail_d->child_ug = phone_image_crop_ug(cdetail_d->ug, view_info->ug_data, &cbs);
+ return;
+ case PH_UG_REQUEST_SET_WITH_RINGTONE:
+ case CT_UG_REQUEST_SAVE_RINGTONE: //only handle for add
+ err = contacts_record_set_str(cdetail_d->contact, _contacts_contact.ringtone_path, view_info->ug_data);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+ break;
+ default:
+ ERR("Invalid type(%d)", view_info->ug_request);
+ break;
+ }
+ cdetail_d->only_input = true;
+ ctui_create_input_view(cdetail_d);
+ PH_FN_END;
+}
+
+void ct_list_call(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d;
+ ct_person_list *person_info = data;
+ p_retm_if(NULL == person_info, "parameter(person_info) is NULL");
+ p_retm_if(NULL == person_info->number || '\0' == *person_info->number, "number is NULL");
+ phone_launch_voice_call(person_info->id, person_info->number);
+
+ clist_d = (ct_list_data *)evas_object_data_get(obj, "clist_d");
+ if(clist_d)
+ ctui_list_set_unsweep(clist_d);
+}
+
+void ct_list_msg(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d;
+ ct_person_list *person_info = data;
+
+ p_retm_if(NULL == data, "parameter(person_info) is NULL");
+ p_retm_if(NULL == person_info->number || '\0' == *person_info->number, "number is NULL");
+
+ clist_d = (ct_list_data *)evas_object_data_get(obj, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+
+ clist_d->child_ug = ctui_msg_ug(clist_d->ug, person_info->number, person_info->id, NULL,
+ ct_list_destroy_child_ug, clist_d);
+
+ ctui_list_set_unsweep(clist_d);
+}
+
+void ct_list_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d;
+
+ clist_d = evas_object_data_get(data, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get(clist_d) return NULL");
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+}
+
+static void list_sweep_delete_contact(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_list_data *clist_d;
+ contacts_record_h record = NULL;
+ int contact_id =0;
+
+ PH_DBG("##### [TSP_TEST] list->sweep delete start#####");
+
+ clist_d = evas_object_data_get(obj, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+ evas_object_del(clist_d->popup);
+ clist_d->popup = NULL;
+
+ evas_object_data_set(clist_d->navi, "ct_list_update_ui", (void *)1);
+
+ err = contacts_db_get_record(_contacts_person._uri,(int)data,&record);
+ p_retm_if(err != CONTACTS_ERROR_NONE, "contacts_db_get_record() fail");
+ err = contacts_record_get_int(record,_contacts_person.display_contact_id,&contact_id);
+ p_retm_if(err != CONTACTS_ERROR_NONE, "contacts_record_get_int() fail");
+ err = contacts_db_delete_record(_contacts_person._uri, (int)data);
+ if (CONTACTS_ERROR_NONE == err)
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+}
+
+
+void ct_list_sweep_del_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int id;
+ ct_list_data *clist_d;
+ Evas_Object *btn;
+
+ clist_d = evas_object_data_get(obj, "clist_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get() return NULL");
+
+ id = (int)data;
+ btn = phone_create_confirm_popup(&clist_d->popup, clist_d->win, S_(PH_SYS_POP_DELETE_Q), list_sweep_delete_contact, (void *)id);
+ evas_object_data_set(btn,"clist_d", clist_d);
+
+ ctui_list_set_unsweep(clist_d);
+}
+
+void ct_list_get_title(ct_list_data *clist_d, int list_op, int id_ab, int id_grp)
+{
+ char *title = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ char* group_system_id = NULL;
+
+ // TODO: Fixme
+ switch(list_op) {
+ case CT_GET_LIST_ALL_PERSON:
+ case CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID:
+ case CT_GET_LIST_ALL_PERSON_HAD_EMAIL:
+ case CT_GET_LIST_ALL_PERSON_HAD_NUMBER:
+ {
+ char buf[PH_TEXT_SHORT_LEN];
+ snprintf(buf, sizeof(buf), "%s (%d)", T_(CT_GET_TEXT_BASIC, CTTEXT_ALL_CONTACTS), clist_d->cnt_list_total);
+ clist_d->title = strdup(buf);
+ }
+ break;
+ case CT_GET_LIST_PERSON_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID:
+ if (0 < id_ab) {
+ char temp[PH_TEXT_MAX_LEN];
+ temp[0] = '\0';
+ ctui_get_addressbook_name(id_ab, temp, sizeof(temp));
+ if (*temp)
+ title = strdup(temp);
+ }
+ else
+ title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ clist_d->sub_title = title;
+ clist_d->title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_ALL_CONTACTS));
+ break;
+ case CT_GET_LIST_PERSON_OF_GROUP_ID:
+ case CT_GET_LIST_PERSON_HAD_NUMBER_OF_GROUP_ID:
+ case CT_GET_LIST_PERSON_HAD_EMAIL_OF_GROUP_ID:
+ err = contacts_db_get_record(_contacts_group._uri, id_grp, &record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_record_get() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(record, _contacts_group.system_id, &group_system_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (group_system_id != NULL) {
+ if (strcmp(group_system_id,"friends")==0)
+ clist_d->title = SAFE_STRDUP(T_(CT_GET_TEXT_BASIC, CTTEXT_FRIENDS));
+ else if (strcmp(group_system_id,"family")==0)
+ clist_d->title = SAFE_STRDUP(T_(CT_GET_TEXT_BASIC, CTTEXT_FAMILY));
+ else if (strcmp(group_system_id,"coworkers")==0)
+ clist_d->title = SAFE_STRDUP(T_(CT_GET_TEXT_BASIC, CTTEXT_CO_WORKERS));
+ else
+ clist_d->title = SAFE_STRDUP(T_(CT_GET_TEXT_ERR, CTTEXT_NONAME));
+ }else{
+ err = contacts_record_get_str(record, _contacts_group.name, &(clist_d->title));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err);
+ }
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if(0 < id_ab) {
+ char temp[PH_TEXT_MAX_LEN];
+ temp[0] = '\0';
+ ctui_get_addressbook_name(id_ab, temp, sizeof(temp));
+ if (*temp)
+ title = strdup(temp);
+ }
+ else
+ title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ clist_d->sub_title = title;
+ break;
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OF_ADDRBOOK_ID:
+ case CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_EMAIL_OF_ADDRBOOK_ID:
+ clist_d->title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_NOT_ASSIGNED));
+ if(0 < id_ab) {
+ char temp[PH_TEXT_MAX_LEN];
+ temp[0] = '\0';
+ ctui_get_addressbook_name(id_ab, temp, sizeof(temp));
+ if (*temp)
+ title = strdup(temp);
+ }
+ else
+ title = strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ clist_d->sub_title = title;
+ break;
+
+ }
+}
+
+static void __list_add_contacts_to_favorite(ct_list_data *clist_d);
+
+static void __list_add_contacts_to_favorite_cb(int err, void *data)
+{
+ ct_list_data *clist_d = data;
+ ph_progress_info *p_info = NULL;
+
+ p_retm_if(NULL == clist_d, "Invalid parameter(clist_d is NULL)");
+ p_info = clist_d->p_info;
+ p_retm_if(NULL == p_info, "Invalid parameter(p_info is NULL)");
+
+ if (p_info->update_list) {
+ contacts_list_destroy(p_info->update_list, true);
+ p_info->update_list = 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);
+ clist_d->p_info = NULL;
+ clist_d->updating = false;
+ elm_naviframe_item_pop_to(evas_object_data_get(clist_d->navi, "navi_it_pop"));
+ 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_(CT_SYS_POP_SUCCESS));
+ free(p_info);
+ clist_d->p_info = NULL;
+ elm_naviframe_item_pop_to(evas_object_data_get(clist_d->navi, "navi_it_pop"));
+ return;
+ }
+ else {
+ __list_add_contacts_to_favorite(clist_d);
+ }
+
+}
+
+static void __list_add_contacts_to_favorite(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ const int LIST_BULK_LENGTH = 50;
+ int count = 0;
+ int base_count = 0;
+ double value = 0.0;
+ char percent_total[PH_TEXT_MAX_LEN+1] = {0, };
+ char percent[PH_TEXT_MAX_LEN+1] = {0, };
+ ph_progress_info *p_info = NULL;
+ contacts_record_h record = NULL;
+ contacts_list_h list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Eina_List *l;
+ ct_person_list *person_info;
+
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+ p_info = clist_d->p_info;
+ p_retm_if(NULL == p_info, "parameter(p_info) is NULL");
+
+ err = contacts_list_create(&list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_create() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(clist_d->list, l, person_info) {
+ if (NULL == person_info) continue;
+ if (person_info->checked) {
+ if (base_count < p_info->cnt) {
+ base_count++;
+ continue;
+ }
+
+ err = contacts_db_get_record(_contacts_person._uri, person_info->id, &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ p_info->result = FALSE;
+ p_info->completed = true;
+ break;
+ }
+ err = contacts_record_set_bool(record, _contacts_person.is_favorite, true);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_set_bool() Failed(%d)", err);
+ p_info->result = FALSE;
+ p_info->completed = true;
+ break;
+ }
+
+ err = contacts_list_add(list, record);
+
+ count++;
+ if (LIST_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_list = list;
+ contacts_db_update_records_async(list, __list_add_contacts_to_favorite_cb, clist_d);
+}
+
+
+void ct_list_add_contacts_to_favorite(Evas_Object *win, Evas_Object *navi, int cnt)
+{
+ ct_list_data *clist_d;
+ ph_progress_info *p_info;
+
+ clist_d = evas_object_data_get(navi, "favor_list_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get return NULL");
+
+ p_retm_if(clist_d->p_info, "thread is running");
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc return NULL");
+
+ clist_d->p_info = p_info;
+ p_info->cnt_checked_total = cnt;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->popup = phone_progressbar_popup(win, p_info, T_(CT_GET_TEXT_BASIC, CTTEXT_ADDING_ING));
+ __list_add_contacts_to_favorite(clist_d);
+}
+
+static void __list_add_group_relation(int group_id, int person_id, contacts_list_h list_result)
+{
+ contacts_record_h record_group = NULL;
+ contacts_list_h list = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(group_id <= 0, "Invalid parameter(group_id is %d)", group_id);
+ p_retm_if(person_id <= 0, "Invalid parameter(person_id is %d)", person_id);
+ p_retm_if(NULL == list_result, "Invalid parameter(list is NULL)");
+
+ do {
+ int address_book_id = 0;
+ if (CONTACTS_ERROR_NONE != (err = contacts_db_get_record(_contacts_group._uri, group_id, &record_group))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_record_get_int(record_group, _contacts_group.address_book_id, &address_book_id))) break;
+
+ if (CONTACTS_ERROR_NONE != (err = contacts_query_create(_contacts_contact._uri, &query))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_create(_contacts_contact._uri, &filter))) break;
+ if (CONTACTS_ERROR_NONE != (err = contacts_filter_add_int(filter, _contacts_contact.address_book_id, CONTACTS_MATCH_EQUAL, address_book_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_int(filter, _contacts_contact.person_id, CONTACTS_MATCH_EQUAL, person_id))) 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;
+
+ while (CONTACTS_ERROR_NONE == err) {
+ contacts_record_h record = NULL;
+ contacts_record_h record_clone = NULL;
+ contacts_record_h record_group_relation = NULL;
+ 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))) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ break;
+ }
+ if (CONTACTS_ERROR_NONE != (err = contacts_record_create(_contacts_group_relation._uri, &record_group_relation))) {
+ ERR("contacts_record_create() Failed(%d)", err);
+ break;
+ }
+ contacts_record_set_int(record_group_relation, _contacts_group_relation.group_id, group_id);
+ contacts_record_add_child_record(record_clone, _contacts_contact.group_relation, record_group_relation);
+ contacts_list_add(list_result, record_clone);
+
+ err = contacts_list_next(list);
+ }
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ contacts_list_destroy(list, true);
+ contacts_record_destroy(record_group, true);
+ return;
+ }while (0);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ contacts_list_destroy(list, true);
+ contacts_record_destroy(record_group, true);
+ return;
+}
+
+static void __list_add_contacts_to_group(ct_list_data *clist_d);
+
+static void __list_add_contacts_to_group_cb(int err, void *data)
+{
+ ct_list_data *clist_d = data;
+ ph_progress_info *p_info = NULL;
+
+ p_retm_if(NULL == clist_d, "Invalid parameter(clist_d is NULL)");
+ p_info = clist_d->p_info;
+ p_retm_if(NULL == p_info, "Invalid parameter(p_info is NULL)");
+
+ if (p_info->update_list) {
+ contacts_list_destroy(p_info->update_list, true);
+ p_info->update_list = NULL;
+ }
+
+ if (CONTACTS_ERROR_NONE != err || p_info->alive == false) {
+ char *err_msg = NULL;
+ if (p_info->popup) {
+ evas_object_del(p_info->popup);
+ p_info->popup = NULL;
+ }
+ switch (err) {
+ case CONTACTS_ERROR_DB:
+ 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;
+ default:
+ err_msg = S_(PH_SYS_POP_FAILED);
+ break;
+ }
+
+ phone_show_tickernoti(err_msg);
+ free(p_info);
+ clist_d->p_info = NULL;
+ clist_d->updating = false;
+ elm_naviframe_item_pop_to(evas_object_data_get(clist_d->navi, "navi_it_pop"));
+ 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_(CT_SYS_POP_SUCCESS));
+ free(p_info);
+ clist_d->p_info = NULL;
+ elm_naviframe_item_pop_to(evas_object_data_get(clist_d->navi, "navi_it_pop"));
+ return;
+ }
+ else {
+ __list_add_contacts_to_group(clist_d);
+ }
+}
+
+
+static void __list_add_contacts_to_group(ct_list_data *clist_d)
+{
+ PH_FN_CALL;
+ const int LIST_BULK_LENGTH = 50;
+ int count = 0;
+ int base_count = 0;
+ double value = 0.0;
+ char percent_total[PH_TEXT_MAX_LEN+1] = {0, };
+ char percent[PH_TEXT_MAX_LEN+1] = {0, };
+
+ contacts_list_h list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_progress_info *p_info = NULL;
+ Eina_List *l = NULL;
+ ct_person_list *person_info = NULL;
+
+ p_retm_if(NULL == clist_d, "parameter(clist_d) is NULL");
+ p_info = clist_d->p_info;
+ p_retm_if(NULL == p_info, "parameter(p_info) is NULL");
+
+ err = contacts_list_create(&list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_create() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(clist_d->list, l, person_info) {
+ if (NULL == person_info) continue;
+
+ if (person_info->checked) {
+ if (base_count < p_info->cnt) {
+ base_count++;
+ continue;
+ }
+
+ __list_add_group_relation(clist_d->base_grp, person_info->id, list);
+
+ count++;
+ if (LIST_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_list = list;
+ contacts_db_update_records_async(list, __list_add_contacts_to_group_cb, clist_d);
+}
+
+
+void ct_list_add_contacts_to_group(Evas_Object *win, Evas_Object *navi, int cnt)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d;
+ ph_progress_info *p_info;
+
+ clist_d = evas_object_data_get(navi, "gadd_list_d");
+ p_retm_if(NULL == clist_d, "evas_object_data_get return NULL");
+
+ p_retm_if(clist_d->p_info, "thread is running");
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc return NULL");
+
+ clist_d->p_info = p_info;
+ p_info->cnt_checked_total = cnt;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->popup = phone_progressbar_popup(win, p_info, T_(CT_GET_TEXT_BASIC, CTTEXT_ADDING_MEMBERS_TO_GROUP));
+ __list_add_contacts_to_group(clist_d);
+}
+
diff --git a/lib/list/ct-list-utils.h b/lib/list/ct-list-utils.h
new file mode 100755
index 0000000..90038c5
--- /dev/null
+++ b/lib/list/ct-list-utils.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 __CONTACTS_LIST_UTILS_H__
+#define __CONTACTS_LIST_UTILS_H__
+
+int ct_list_parse_bundle(service_h service, ct_list_data* clist_d);
+void ct_list_call(void *data, Evas_Object *obj, void *event_info);
+void ct_list_msg(void *data, Evas_Object *obj, void *event_info);
+void ct_list_popup_hide_cb(void *data, Evas_Object *obj, void *event_info);
+void ct_list_sweep_del_cb(void *data, Evas_Object *obj, void *event_info);
+void ct_list_get_title(ct_list_data *data, int list_op, int id_ab, int id_grp);
+void ct_list_add_contacts_to_group(Evas_Object *win, Evas_Object *navi, int cnt);
+void ct_list_add_contacts_to_favorite(Evas_Object *win, Evas_Object *navi, int cnt);
+void ct_list_destroy_child_ug(void *data);
+
+#endif //__CONTACTS_LIST_UTILS_H__
diff --git a/lib/list/ct-list-view-ug.c b/lib/list/ct-list-view-ug.c
new file mode 100755
index 0000000..94bd146
--- /dev/null
+++ b/lib/list/ct-list-view-ug.c
@@ -0,0 +1,691 @@
+/*
+* 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 "ct-list.h"
+#include "ct-detail.h"
+#include "ct-list-utils.h"
+#include "ct-list-edit-view.h"
+#include "ct-list-contact-view.h"
+#include "phone-common.h"
+
+
+static void list_ug_nums_popup_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = evas_object_data_get(obj, "clist_d");
+ int person_id = (int)evas_object_data_get(obj, "person_id");
+
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request || CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request) {
+ Elm_Object_Item *item;
+ ct_person_list *person_info;
+
+ item = evas_object_data_get(obj, "item");
+ p_retm_if(NULL == item, "evas_object_data_get() return NULL");
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() return NULL");
+
+ person_info->id_ret = (int)data;
+ person_info->id_ret_type = 1;
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ ct_list_popup_hide_cb(obj, NULL, NULL);
+ }
+ else if (PH_UG_REQUEST_LAUNCH_VOICECALL == clist_d->ug_request) {
+ char *num_info = (char*)elm_object_item_text_get(event_info);
+ char *number;
+ strtok(num_info, " ");
+ number = strtok(NULL, " ");
+ PH_DBG("%s", number);
+ ct_list_popup_hide_cb(obj, NULL, NULL);
+ phone_launch_voice_call(person_id, number);
+ }
+ else {
+ phone_ug_return_id(clist_d->ug, person_id, (int)data, 0);
+ ug_destroy_me(clist_d->ug);
+ }
+}
+
+static void list_ug_emails_popup_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = evas_object_data_get(obj, "clist_d");
+ int contact_id = (int)evas_object_data_get(obj, "person_id");
+
+ if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request || CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request) {
+ Elm_Object_Item *item;
+ ct_person_list *person_info;
+
+ item = evas_object_data_get(obj, "item");
+ p_retm_if(NULL == item, "evas_object_data_get() return NULL");
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() return NULL");
+
+ person_info->id_ret = (int)data;
+ person_info->id_ret_type = 2;
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ ct_list_popup_hide_cb(obj, NULL, NULL);
+ }
+ else {
+ phone_ug_return_id(clist_d->ug, contact_id, 0, (int)data);
+ ug_destroy_me(clist_d->ug);
+ }
+}
+
+API Evas_Object* ctui_list_create_values_list(const char *view_uri, Evas_Object *popup, Evas_Object *list, Eina_List *values, void(*cb)(void *, Evas_Object *, void *))
+{
+ int id;
+ int val_type;
+ char *email_str_p;
+ const char *type_str;
+ char buf[PH_TEXT_MAX_LEN];
+ Eina_List *l;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ if (NULL == list) {
+ list = elm_list_add(popup);
+ evas_object_size_hint_max_set(list, -1, 600 * elm_config_scale_get()); // TODO : should be revise
+ }
+
+ EINA_LIST_FOREACH(values, l, record) {
+ if (NULL == record)
+ continue;
+
+ if (0 == strcmp(view_uri, _contacts_email._uri)) {
+ err = contacts_record_get_int(record, _contacts_email.id, &id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_email.type, &val_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ type_str = T_(CT_GET_TEXT_EMAIL_TYPE, ctui_get_email_type_index(val_type));
+
+ err = contacts_record_get_str_p(record, _contacts_email.email, &email_str_p);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(buf, sizeof(buf), "%s %s", type_str, email_str_p);
+ }
+ else {
+ char num_type_str[PH_TEXT_MAX_LEN+1];
+
+ err = contacts_record_get_int(record, _contacts_number.id, &id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ err = contacts_record_get_int(record, _contacts_number.type, &val_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+
+ ctui_get_number_type_str(record, val_type, num_type_str, sizeof(num_type_str));
+
+ err = contacts_record_get_str_p(record, _contacts_number.number, &email_str_p);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ snprintf(buf, sizeof(buf), "%s %s", num_type_str, email_str_p);
+ }
+ elm_list_item_append(list, buf, NULL, NULL, cb, (void *)id);
+ }
+
+ elm_list_mode_set(list, ELM_LIST_EXPAND);
+ return list;
+}
+
+static Evas_Object* list_ug_create_popup_values_list(ct_list_data *clist_d, ct_person_list *person_info)
+{
+ Evas_Object *popup;
+ Evas_Object *list = NULL;
+ Evas_Object *btn;
+
+ popup = elm_popup_add(clist_d->navi);
+ elm_object_style_set(popup, "min_liststyle");
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ if (person_info->number_list)
+ list = ctui_list_create_values_list(_contacts_number._uri, popup, list, person_info->number_list, list_ug_nums_popup_sel);
+ if (person_info->email_list)
+ list = ctui_list_create_values_list(_contacts_email._uri, popup, list, person_info->email_list, list_ug_emails_popup_sel);
+
+ elm_object_content_set(popup, list);
+ evas_object_data_set(list, "clist_d", clist_d);
+ evas_object_data_set(list, "person_id", (void *)person_info->id);
+
+ 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", ct_list_popup_hide_cb, list);
+
+ clist_d->popup = popup;
+ evas_object_show(popup);
+ return list;
+}
+
+static inline void list_ug_handle_select_number(ct_list_data *clist_d, ct_person_list *person_info)
+{
+ char *number_str_p = NULL;
+ int number_type;
+ int number_id;
+ Eina_List *list_contact;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ list_contact = ctui_person_get_contact_list(person_info->id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if(person_info->number_list == NULL)
+ person_info->number_list = ctui_person_get_number_list(list_contact);
+
+ if (person_info->number_list) {
+ if (1 == eina_list_count(person_info->number_list)) {
+ record = (contacts_record_h)person_info->number_list->data;
+ if (PH_UG_REQUEST_LAUNCH_VOICECALL == clist_d->ug_request) {
+ err = contacts_record_get_str_p(record, _contacts_number.number, &number_str_p);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ phone_launch_voice_call(person_info->id, number_str_p);
+ }
+ else {
+ err = contacts_record_get_int(record, _contacts_number.id, &number_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
+ ug_destroy_me(clist_d->ug);
+ }
+ }
+ else
+ list_ug_create_popup_values_list(clist_d, person_info);
+ }
+ else {
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_NUMBER), 1.5);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+static inline void list_ug_handle_select_email(ct_list_data *clist_d, ct_person_list *person_info)
+{
+ int email_id;
+ Eina_List *list_contact;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ list_contact = ctui_person_get_contact_list(person_info->id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if(person_info->email_list == NULL)
+ person_info->email_list = ctui_person_get_email_list(list_contact);
+ if (person_info->email_list) {
+ if (1 == eina_list_count(person_info->email_list)) {
+ record = (contacts_record_h)person_info->email_list->data;
+ err = contacts_record_get_int(record, _contacts_email.id, &email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
+ ug_destroy_me(clist_d->ug);
+ }
+ else
+ list_ug_create_popup_values_list(clist_d, person_info);
+ }
+ else {
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+static inline void list_ug_handle_select_number_or_email(ct_list_data *clist_d, ct_person_list *person_info)
+{
+ int number_id;
+ int email_id;
+ int number_list_count = 0;
+ int email_list_count = 0;
+ Eina_List *list_contact;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ list_contact = ctui_person_get_contact_list(person_info->id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if (NULL == person_info->number_list)
+ person_info->number_list = ctui_person_get_number_list(list_contact);
+ if (NULL == person_info->email_list)
+ person_info->email_list = ctui_person_get_email_list(list_contact);
+
+ if (person_info->number_list)
+ number_list_count = eina_list_count(person_info->number_list);
+ if (person_info->email_list)
+ email_list_count = eina_list_count(person_info->email_list);
+
+ if (number_list_count == 0 && email_list_count == 0) {
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+ }
+ else if (number_list_count == 1 && email_list_count == 0) {
+ record = (contacts_record_h)person_info->number_list->data;
+ err = contacts_record_get_int(record, _contacts_number.id, &number_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
+ ug_destroy_me(clist_d->ug);
+ }
+ else if (number_list_count == 0 && email_list_count == 1) {
+ record = (contacts_record_h)person_info->email_list->data;
+ err = contacts_record_get_int(record, _contacts_email.id, &email_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
+ ug_destroy_me(clist_d->ug);
+ }
+ else {
+ list_ug_create_popup_values_list(clist_d, person_info);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+static inline void ct_list_ug_handle_select_vcard(ct_list_data *clist_d, int person_id)
+{
+ bool result = false;
+ char vcard_path[PH_TEXT_MAX_LEN+1];
+
+ result = ctui_list_make_vcard(person_id, vcard_path, sizeof(vcard_path));
+ PH_DBG("%d, %s", person_id, vcard_path);
+ if(result == true) {
+ phone_ug_return_vcard(clist_d->ug, person_id, vcard_path);
+ ug_destroy_me(clist_d->ug);
+ }
+ else {
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS), 1.5);
+ }
+}
+
+static void list_ug_img_crop_result(ui_gadget_h ug, service_h service, void *data)
+{
+ Eina_List *list_writable_contact;
+ ct_list_data *clist_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ char *normal = NULL;
+ char *full = NULL;
+ void *data;
+ Eina_List *l;
+ contacts_record_h record = NULL;
+ contacts_record_h record_image = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ service_get_extra_data(service, "crop_image_path", &normal);
+ p_retm_if(NULL == normal, "return value is NULL.");
+ service_get_extra_data(service, "image_path", &full);
+
+ list_writable_contact = NULL;
+ list_writable_contact = ctui_person_get_writable_contact_list(clist_d->selected_person_id);
+
+ if (list_writable_contact) {
+ EINA_LIST_FOREACH(list_writable_contact, l, data) {
+ record = (contacts_record_h)data;
+ if (NULL == record) continue;
+
+ record_image = ctui_get_record_image(record);
+ if (NULL == record_image) {
+ ERR("ctui_get_record_image() Failed(%d)", err);
+ break;
+ }
+
+ err = contacts_record_set_str(record_image, _contacts_image.path, normal);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_db_update_record(record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ }
+ ctui_free_record_list(list_writable_contact);
+ }
+
+ free(normal);
+ free(full);
+ }
+}
+
+void ct_list_ug_handle_check_for_number(Elm_Object_Item *item, ct_list_data *clist_d)
+{
+ ct_person_list *person_info;
+ Eina_List *list_contact;
+ Evas_Object *list_nums;
+ Eina_Bool all_check;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() return NULL");
+
+ list_contact = ctui_person_get_contact_list(person_info->id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if (NULL == person_info->number_list)
+ person_info->number_list = ctui_person_get_number_list(list_contact);
+
+ if (NULL == person_info->number_list) {
+ Evas_Object *check;
+ ERR("ctui_person_get_number_list() return NULL");
+ ctui_free_record_list(list_contact);
+
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_NUMBER), 1.5);
+
+ check = elm_object_part_content_get(clist_d->select_all_layout, "elm.icon");
+ p_retm_if(NULL == check, "elm_object_part_content_get() return NULL");
+
+ if (clist_d->cnt_list_total == clist_d->cnt_checked)
+ all_check = EINA_TRUE;
+ else
+ all_check = EINA_FALSE;
+
+ elm_check_state_set(check, all_check);
+ elm_genlist_item_update(item);
+ return;
+ }
+
+ if (1 == eina_list_count(person_info->number_list)) {
+ record = (contacts_record_h)person_info->number_list->data;
+ person_info->id_ret_type = 1;
+ err = contacts_record_get_int(record, _contacts_number.id, &(person_info->id_ret));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ }
+ else {
+ list_nums = list_ug_create_popup_values_list(clist_d, person_info);
+ if (list_nums)
+ evas_object_data_set(list_nums, "item", item);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+void ct_list_ug_handle_check_for_email(Elm_Object_Item *item, ct_list_data *clist_d)
+{
+ Eina_List *list_contact;
+ Evas_Object *list_emails;
+ ct_person_list *person_info;
+ Eina_Bool all_check;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() return NULL");
+
+ list_contact = ctui_person_get_contact_list(person_info->id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if (NULL == person_info->email_list)
+ person_info->email_list = ctui_person_get_email_list(list_contact);
+
+ if (NULL == person_info->email_list) {
+ Evas_Object *check;
+ ERR("ctui_person_get_email_list() return NULL");
+ ctui_free_record_list(list_contact);
+
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+
+ check = elm_object_part_content_get(clist_d->select_all_layout, "elm.icon");
+ p_retm_if(NULL == check, "elm_object_part_content_get() return NULL");
+
+ if (clist_d->cnt_list_total == clist_d->cnt_checked)
+ all_check = EINA_TRUE;
+ else
+ all_check = EINA_FALSE;
+
+ elm_check_state_set(check, all_check);
+ elm_genlist_item_update(item);
+ return;
+ }
+
+ if (1 == eina_list_count(person_info->email_list)) {
+ record = (contacts_record_h)person_info->email_list->data;
+ person_info->id_ret_type = 2;
+ err = contacts_record_get_int(record, _contacts_email.id, &(person_info->id_ret));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ }
+ else {
+ list_emails = list_ug_create_popup_values_list(clist_d, person_info);
+ if (list_emails)
+ evas_object_data_set(list_emails, "item", item);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+void ct_list_ug_handle_check_for_number_or_email(Elm_Object_Item *item, ct_list_data *clist_d)
+{
+ int number_list_count = 0;
+ int email_list_count = 0;
+ Eina_List *list_contact;
+ Evas_Object *list;
+ ct_person_list *person_info;
+ Eina_Bool all_check;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() return NULL");
+
+ list_contact = ctui_person_get_contact_list(person_info->id);
+ p_retm_if(NULL == list_contact, "ctui_person_get_contact_list() return NULL");
+
+ if (NULL == person_info->email_list)
+ person_info->email_list = ctui_person_get_email_list(list_contact);
+ if (NULL == person_info->number_list)
+ person_info->number_list = ctui_person_get_number_list(list_contact);
+
+ if (person_info->number_list)
+ number_list_count = eina_list_count(person_info->number_list);
+ if (person_info->email_list)
+ email_list_count = eina_list_count(person_info->email_list);
+
+ if (0 == number_list_count && 0 == email_list_count) {
+ Evas_Object *check;
+ ERR("ctui_person_get_email_list() return NULL");
+ ctui_free_record_list(list_contact);
+
+ phone_show_popup(clist_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_NO_EMAIL), 1.5);
+
+ check = elm_object_part_content_get(clist_d->select_all_layout, "elm.icon");
+ p_retm_if(NULL == check, "elm_object_part_content_get() return NULL");
+
+ if (clist_d->cnt_list_total == clist_d->cnt_checked)
+ all_check = EINA_TRUE;
+ else
+ all_check = EINA_FALSE;
+
+ elm_check_state_set(check, all_check);
+ elm_genlist_item_update(item);
+ return;
+ }
+
+ if (1 == number_list_count && 0 == email_list_count) {
+ record = (contacts_record_h)person_info->number_list->data;
+ err = contacts_record_get_int(record, _contacts_number.id, &(person_info->id_ret));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ person_info->id_ret_type = 1;
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ }
+ else if (0 == number_list_count && 1 == email_list_count) {
+ record = (contacts_record_h)person_info->email_list->data;
+ err = contacts_record_get_int(record, _contacts_email.id, &(person_info->id_ret));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
+ person_info->id_ret_type = 2;
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ }
+ else {
+ list = list_ug_create_popup_values_list(clist_d, person_info);
+ if (list)
+ evas_object_data_set(list, "item", item);
+ }
+ ctui_free_record_list(list_contact);
+}
+
+static void list_destory_child_ug(ui_gadget_h ug, void *priv)
+{
+ ct_list_data *clist_d = priv;
+ p_retm_if(NULL == ug, "ug is NULL");
+ ug_destroy(ug);
+
+ p_retm_if(NULL == priv, "priv is NULL");
+ clist_d->child_ug = NULL;
+ if (clist_d->ug)
+ ug_destroy_me(clist_d->ug);
+}
+
+void ct_list_ug_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ int ret;
+ const char *err_msg;
+ contacts_record_h record = NULL;
+ struct ug_cbs cbs = {0};
+ ct_list_data *clist_d = data;
+ ct_person_list *person_info;
+ ph_view_info *view_info;
+ Elm_Object_Item *item = event_info;
+ Evas_Object *popup;
+
+ PH_DBG("##### [TSP_TEST] list->detail start #####");
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (CT_GET_LIST_VCARD == clist_d->list_op && CT_UG_REQUEST_CHECK != clist_d->ug_request) {
+ Evas_Object *content;
+
+ p_retm_if(NULL == clist_d->vcard_path, "vcard_path is NULL");
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() returns NULL");
+
+ clist_d->idx_vcard = elm_genlist_item_index_get (item);
+
+ content = ctui_contacts_viewer(clist_d->win, clist_d->navi, clist_d->idx_vcard, clist_d->vcard_path);
+ if (NULL == content) {
+ ERR("ctui_contacts_viewer() return NULL");
+ elm_exit();
+ }
+ return;
+ }
+
+ if (CT_LIST_MODE_EDIT == clist_d->list_mode) {
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() returns NULL");
+
+
+ if (person_info->checked) {
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ return;
+ }
+
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request)
+ ct_list_ug_handle_check_for_number(item, clist_d);
+ else if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request)
+ ct_list_ug_handle_check_for_email(item, clist_d);
+ else if (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request)
+ ct_list_ug_handle_check_for_number_or_email(item, clist_d);
+ else {
+ person_info->checked = !person_info->checked;
+ ct_list_item_checked_set(item, clist_d);
+ ctui_list_update_selection_info(clist_d);
+ }
+
+ return;
+ }
+
+ person_info = elm_object_item_data_get(item);
+ p_retm_if(NULL == person_info, "elm_object_item_data_get() returns NULL");
+
+ PH_DBG("clist_d->ug_request = %d", clist_d->ug_request);
+ switch (clist_d->ug_request) {
+ case CT_UG_REQUEST_LIST:
+ case CT_UG_REQUEST_LIST_WITH_BACK:
+ ret = ctui_create_detail_view(clist_d, person_info);
+ p_warn_if(ret < 0, "ctui_create_detail_view() Failed");
+ break;
+ case CT_UG_REQUEST_SELECT_PERSON:
+ if (clist_d->ug) {
+ phone_ug_return_id(clist_d->ug, person_info->id, 0, 0);
+ ug_destroy_me(clist_d->ug);
+ }
+ break;
+ case CT_UG_REQUEST_SELECT_NUMBER:
+ case PH_UG_REQUEST_LAUNCH_VOICECALL:
+ case CT_UG_REQUEST_SELECT_CONTACT_ADD_TO_HOME:
+ list_ug_handle_select_number(clist_d, person_info);
+ break;
+ case CT_UG_REQUEST_SELECT_EMAIL:
+ list_ug_handle_select_email(clist_d, person_info);
+ break;
+ case CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL:
+ list_ug_handle_select_number_or_email(clist_d, person_info);
+ break;
+ case CT_UG_REQUEST_SELECT_VCARD:
+ ct_list_ug_handle_select_vcard(clist_d, person_info->id);
+ break;
+ case CT_UG_REQUEST_SHARE_CONTACT_INFO:
+ ctui_create_share_info_ug_layout(clist_d->navi, person_info->id, clist_d->ug);
+ break;
+ case CT_UG_REQUEST_UPDATE_CONTACT:
+ case CT_UG_REQUEST_UPDATE_WITH_NUM:
+ case CT_UG_REQUEST_UPDATE_WITH_EMAIL:
+ case CT_UG_REQUEST_UPDATE_WITH_WEB:
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, clist_d->win, clist_d->navi, clist_d->ug, clist_d->ug_request, clist_d->cnt_max_check, clist_d->ug_data);
+ ctui_list_update_with_data(view_info, clist_d, person_info->id, clist_d->base_grp, clist_d->base_ab);
+ free(view_info);
+ break;
+ case PH_UG_REQUEST_SET_WITH_IMG:
+ case CT_UG_REQUEST_SAVE_IMG:
+ clist_d->selected_person_id = person_info->id;
+
+ cbs.result_cb = list_ug_img_crop_result;
+ cbs.destroy_cb = list_destory_child_ug;
+ cbs.priv = clist_d;
+ clist_d->child_ug = phone_image_crop_ug(clist_d->ug, clist_d->ug_data, &cbs);
+ break;
+ case PH_UG_REQUEST_SET_WITH_RINGTONE:
+ case CT_UG_REQUEST_SAVE_RINGTONE:
+ 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_set_str(record, _contacts_person.ringtone_path, clist_d->ug_data);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_str() Failed(%d)", err);
+
+ err = contacts_db_update_record(record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_update_record() Failed(%d)", err);
+ ctui_create_contacts_error_popup(clist_d->navi, err);
+ }
+ else {
+ err_msg = S_(CT_SYS_POP_SUCCESS);
+ popup = phone_show_popup(clist_d->navi, err_msg, 1.5);
+ evas_object_smart_callback_add(popup, "timeout", ctui_list_ug_hide_cb, clist_d->ug);
+ }
+ break;
+ default:
+ ERR("Invalid ug_request(%d)", clist_d->ug_request);
+ break;
+ }
+}
+
diff --git a/lib/list/ct-list-view-ug.h b/lib/list/ct-list-view-ug.h
new file mode 100755
index 0000000..9ff06b3
--- /dev/null
+++ b/lib/list/ct-list-view-ug.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_LIST_VIEW_UG_H__
+#define __CONTACTS_LIST_VIEW_UG_H__
+
+void ct_list_ug_gl_sel(void *data, Evas_Object *obj, void *event_info);
+void ct_list_ug_handle_check_for_email(Elm_Object_Item *item, ct_list_data *clist_d);
+void ct_list_ug_handle_check_for_number(Elm_Object_Item *item, ct_list_data *clist_d);
+void ct_list_ug_handle_check_for_number_or_email(Elm_Object_Item *item, ct_list_data *clist_d);
+
+#endif //__CONTACTS_LIST_VIEW_UG_H__
+
diff --git a/lib/list/include/ct-list.h b/lib/list/include/ct-list.h
new file mode 100755
index 0000000..29e5122
--- /dev/null
+++ b/lib/list/include/ct-list.h
@@ -0,0 +1,115 @@
+/*
+* 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_LIST_H__
+#define __CONTACTS_LIST_H__
+
+#include "phone-common.h"
+
+
+#define CT_LIST_MAX_SEARCH_STR 1024
+#define CT_LIST_ICON_SIZE 70
+#define CT_LIST_ACCOUNT_CNT_MAX 3
+
+enum { // this order affects to set list_op in ctui_list_create_contact_view_with_info
+ CT_GET_LIST_ALL_PERSON = 0,
+ CT_GET_LIST_PERSON_OF_ADDRBOOK_ID = 1,
+ CT_GET_LIST_PERSON_HAD_NUMBER_OF_ADDRBOOK_ID = 2,
+ CT_GET_LIST_PERSON_HAD_EMAIL_OF_ADDRBOOK_ID = 3,
+ CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID = 4,
+ CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID = 5,
+
+ CT_GET_LIST_PERSON_OF_GROUP_ID = 10,
+ CT_GET_LIST_PERSON_HAD_NUMBER_OF_GROUP_ID = 11,
+ CT_GET_LIST_PERSON_HAD_EMAIL_OF_GROUP_ID = 12,
+ CT_GET_LIST_PERSON_HAD_NUMBER_OR_EMAIL_OF_GROUP_ID = 13,
+
+ CT_GET_LIST_PERSON_NOT_ASSIGNED_OF_ADDRBOOK_ID = 14,
+ CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OF_ADDRBOOK_ID = 15,
+ CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_EMAIL_OF_ADDRBOOK_ID = 16,
+ CT_GET_LIST_PERSON_NOT_ASSIGNED_HAD_NUMBER_OR_EMAIL_OF_ADDRBOOK_ID = 17,
+
+ CT_GET_LIST_ALL_PERSON_HAD_NUMBER = 20,
+ CT_GET_LIST_ALL_PERSON_HAD_EMAIL = 21,
+ CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL = 22,
+ CT_GET_LIST_VCARD = 23,
+};
+
+enum {
+ CT_LIST_ITEM_NO_NUMBER,
+ CT_LIST_ITEM,
+ CT_LIST_ITEM_SEARCH_NO_NUMBER,
+ CT_LIST_ITEM_SEARCH,
+ CT_LIST_ITEM_COUNT,
+};
+
+enum {
+ CT_LIST_SINGLE_VIEW,
+ CT_LIST_IN_MULTI_TAB,
+};
+
+enum {
+ CT_LIST_MODE_DEFAULT,
+ CT_LIST_MODE_EDIT,
+};
+
+typedef struct {
+ int id_ab;
+ int id_grp;
+ int count;
+ int mode;
+ bool is_read_only;
+ char *name;
+ char *img;
+ char *img_list[6];
+ Eina_Bool selected;
+ Elm_Object_Item *item;
+}ct_group_list;
+
+Evas_Object* ctui_create_list_select_view(Evas_Object *navi, ct_select_result_cb result_cb, void *result_cb_data, int list_op, int id_ab, int id_grp, int cnt_max);
+Evas_Object* ctui_create_gadd_list_select_view(Evas_Object *win, Evas_Object *navi, int group_id, int ab_id, Eina_List *list);
+void ctui_create_favorite_list_select_view(Evas_Object *win, Evas_Object *navi, Eina_List *list);
+Evas_Object* ctui_create_vcard_list_select_view(Evas_Object *navi, Eina_List *list, const char *path,
+ ct_select_result_cb result_cb, void *result_cb_data);
+Evas_Object* ctui_create_vcard_list_view(Evas_Object *win, Eina_List *list, const char *path);
+Evas_Object* ctui_create_phone_list_view(ph_view_info *view_info);
+Eina_Bool ctui_list_genlist_update(void *data);
+void ctui_list_new_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+void ctui_list_navi_set(int mode, ct_list_data *clist_d);
+void ctui_list_view_reset(ct_list_data *clist_d);
+void ctui_list_view_resume(Evas_Object *navi);
+void ctui_list_view_pause(Evas_Object *navi);
+void ctui_list_view_language_changed(Evas_Object *navi);
+Evas_Object* ctui_list_create_contact_view_with_info(ph_view_info *view_info, int list_op, ct_group_list *info);
+void ctui_list_set_search_text(ct_list_data *clist_d, const char *text);
+void ctui_list_edit_mode_start(ct_list_data *clist_d);
+void ctui_list_set_selectall(ct_list_data *clist_d);
+void ctui_list_update_with_data(ph_view_info *view_info, void *data, int id, int grp_id, int ab_id);
+Evas_Object* ctui_list_create_values_list(const char *view_uri, Evas_Object *popup, Evas_Object *list, Eina_List *values, void(*cb)(void *, Evas_Object *, void *));
+
+#define CT_MAX_ADDRBOOK 200
+void ct_list_init_account_data(ct_list_data *clist_d);
+void ct_list_get_addrbook_icon_path(ct_list_data *clist_d, int id_ab, char *dest, int dest_len);
+
+int ct_list_get_contacts(ct_list_data *clist_d, Eina_List **list);
+char* ct_list_gl_label_get(void *data, Evas_Object *obj, const char *part);
+char* ct_list_count_gl_label_get(void *data, Evas_Object *obj, const char *part);
+Evas_Object* ct_list_create_contact_layout(ct_list_data *clist_d);
+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);
+void ctui_list_set_background(Evas_Object *obj, bool is_background);
+
+
+#endif //__CONTACTS_LIST_H__
diff --git a/lib/log/CMakeLists.txt b/lib/log/CMakeLists.txt
new file mode 100755
index 0000000..f98e0a3
--- /dev/null
+++ b/lib/log/CMakeLists.txt
@@ -0,0 +1,20 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${PH_LOG})
+
+FILE(GLOB SRCS *.c)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(log_pkgs REQUIRED notification icu-i18n feedback)
+
+FOREACH(flag ${log_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+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} ${ug_pkgs_LDFLAGS} ${log_pkgs_LDFLAGS} ${CT_DETAILS})
+
+ADD_DEPENDENCIES(${TARGET} progress_edj_build logdetail_theme_build)
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
diff --git a/lib/log/include/phone-log.h b/lib/log/include/phone-log.h
new file mode 100755
index 0000000..3612cf8
--- /dev/null
+++ b/lib/log/include/phone-log.h
@@ -0,0 +1,111 @@
+/*
+* 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_LOG_H__
+#define __PHONE_LOG_H__
+
+#include <unicode/udat.h>
+
+#include "phone-common.h"
+
+enum {
+ LOG_VIEW_TYPE_NORMAL = 0,
+ LOG_VIEW_TYPE_NORMAL_CHECK,
+ LOG_VIEW_TYPE_UG_NUMBER_CHECK,
+ LOG_VIEW_TYPE_UG_NUMBER_SELECT,
+ LOG_VIEW_TYPE_UG_EMAIL_CHECK,
+ LOG_VIEW_TYPE_UG_EMAIL_SELECT,
+ LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_CHECK,
+ LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_SELECT,
+ LOG_VIEW_TYPE_UG_LAUNCH_CALL,
+};
+
+enum {
+ VIEWBY_ALL_LOG = 0,
+ VIEWBY_ALL_CALL,
+ VIEWBY_MISSED_CALL,
+ VIEWBY_DIALED_CALL,
+ VIEWBY_RECEIVED_CALL,
+ VIEWBY_REJECTED_CALL,
+ VIEWBY_ALL_MESSAGE,
+ VIEWBY_MAX,
+};
+
+enum{
+ LOG_FORMAT_TIME_12 = 0,
+ LOG_FORMAT_TIME_24,
+ LOG_FORMAT_DATE,
+ LOG_FORMAT_MAX,
+};
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *box;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *cbar;
+ Evas_Object *genlist;
+ Evas_Object *popup;
+ Evas_Object* radio_main;
+ Evas_Object *content;
+ Elm_Object_Item *navi_item;
+ Evas_Object *ctrl_item;
+ Eina_List *log_list;
+ int view_type;
+ int viewby_type;
+ int log_list_count;
+ int all_log_list_count;
+ int pre_date_type;//for index
+ int readed_n;
+ int ug_request;
+ Ecore_Idler *list_idler;
+ Elm_Object_Item *git;
+ Elm_Object_Item *item_last_sweep;
+ Ecore_Timer *timer;
+ void *ug;
+ void *child_ug;
+ UDateFormat *formatter[LOG_FORMAT_MAX];
+ Ecore_Timer *update_timer;
+ bool is_background;
+ bool logdetail_update;
+
+ /* edit mode */
+ Evas_Object *select_all_layout;
+ int cnt_checked;
+ ph_progress_info *p_info;
+}ph_log_data;
+
+typedef struct
+{
+ int index;
+ int state_index;
+}viewby_list_item;
+
+
+Evas_Object *phone_create_log_view(ph_view_info *view_info);
+void phone_log_views_update(Evas_Object *navi);
+void phone_log_missed_info_update(void *navi);
+void phone_log_view_reset(Evas_Object *navi);
+void phone_log_view_resume(Evas_Object *layout);
+void phone_log_set_navi(Evas_Object *layout);
+void phone_log_set_background(Evas_Object *obj, bool is_background);
+void phone_log_check_mode_start(ph_log_data *log_d);
+void phone_viewby_type_set(Evas_Object *layout, int log_type);
+void phone_log_view_language_changed(Evas_Object *navi);
+
+#endif //__PHONE_LOG_H__
diff --git a/lib/log/ph-log-check-view.c b/lib/log/ph-log-check-view.c
new file mode 100755
index 0000000..5b8c1bb
--- /dev/null
+++ b/lib/log/ph-log-check-view.c
@@ -0,0 +1,324 @@
+/*
+* 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 <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-log.h"
+#include "ph-log-utils.h"
+#include "ph-log-main-view.h"
+
+
+void ph_log_check_update_button_status(ph_log_data *log_d)
+{
+ Eina_Bool disabled;
+ p_retm_if(NULL == log_d, "parameter is NULL");
+ p_retm_if(NULL == log_d->ctrl_item, "ctrl_item is NULL");
+
+ if (0 == log_d->log_list_count)
+ disabled = EINA_TRUE;
+ else if (log_d->genlist && elm_genlist_decorate_mode_get(log_d->genlist)) {
+ if (0 < log_d->cnt_checked)
+ disabled = EINA_FALSE;
+ else
+ disabled = EINA_TRUE;
+ }
+ else
+ disabled = EINA_FALSE;
+
+ elm_object_disabled_set(log_d->ctrl_item, disabled);
+}
+
+void ph_log_check_update_selection_info(ph_log_data *log_d)
+{
+ if (log_d->cnt_checked == 0)
+ phone_hide_notify(log_d->layout);
+ else {
+ char info_text[PH_TEXT_SHORT_LEN]={0};
+ Elm_Object_Item *item;
+ int count=0;
+
+ item = elm_genlist_first_item_get(log_d->genlist);
+ while (item) {
+ Elm_Genlist_Item_Type type = elm_genlist_item_type_get(item);
+ ph_log_info *l_info = (ph_log_info*)elm_object_item_data_get(item);
+ item = elm_genlist_item_next_get(item);
+ if (ELM_GENLIST_ITEM_GROUP != type && l_info->checked)
+ count++;
+ }
+
+ snprintf(info_text, sizeof(info_text), "%s (%d)", S_(PH_SYS_POP_SELECTED),
+ count);
+ phone_show_notify(log_d->layout, info_text);
+ }
+}
+
+static void log_check_select_all(void *data, Eina_Bool checked)
+{
+ Eina_List *l;
+ ph_log_info *l_info;
+ ph_log_data *log_d = data;
+
+ if (checked)
+ log_d->cnt_checked = log_d->log_list_count;
+ else
+ log_d->cnt_checked = 0;
+
+ EINA_LIST_FOREACH(log_d->log_list, l, l_info) {
+ if (!l_info) continue;
+ l_info->checked = checked;
+ }
+ elm_genlist_realized_items_update(log_d->genlist);
+ ph_log_check_update_selection_info(log_d);
+ ph_log_check_update_button_status(log_d);
+}
+
+API void phone_log_check_mode_start(ph_log_data *log_d)
+{
+ Elm_Object_Item *item;
+ p_retm_if(NULL == log_d, "log data is NULL");
+
+ if (log_d->item_last_sweep) {
+ elm_genlist_item_decorate_mode_set(log_d->item_last_sweep, "slide", EINA_FALSE);
+ elm_genlist_item_select_mode_set(log_d->item_last_sweep, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ log_d->item_last_sweep = NULL;
+ }
+
+ if (0 < log_d->log_list_count && !log_d->select_all_layout) {
+ log_d->select_all_layout = phone_create_select_all(log_d->box, S_(PH_SYS_BODY_SELECT_ALL), log_check_select_all, log_d);
+ elm_box_pack_start(log_d->box, log_d->select_all_layout);
+ }
+
+ if (LOG_VIEW_TYPE_NORMAL == log_d->view_type)
+ log_d->view_type = LOG_VIEW_TYPE_NORMAL_CHECK;
+
+ elm_genlist_decorate_mode_set(log_d->genlist, EINA_TRUE);
+ phone_log_set_navi(log_d->navi);
+
+ item = elm_genlist_first_item_get(log_d->genlist);
+ while (item) {
+ elm_genlist_item_fields_update(item, "elm.icon.3", ELM_GENLIST_ITEM_FIELD_CONTENT);
+ item = elm_genlist_item_next_get(item);
+ }
+}
+
+void ph_log_check_mode_end(ph_log_data *log_d, bool redraw)
+{
+ Elm_Object_Item *item;
+
+ phone_hide_notify(log_d->navi);
+
+ elm_box_unpack(log_d->box, log_d->select_all_layout);
+ evas_object_del(log_d->select_all_layout);
+ log_d->select_all_layout = NULL;
+
+ if (log_d->cnt_checked)
+ log_check_select_all(log_d, EINA_FALSE);
+
+ if (LOG_VIEW_TYPE_NORMAL_CHECK == log_d->view_type) {
+ log_d->view_type = LOG_VIEW_TYPE_NORMAL;
+ if (log_d->timer)
+ ecore_timer_del(log_d->timer);
+ log_d->timer = ecore_timer_add(1.0, ph_log_missed_call_count_reset, (void*)log_d);
+ }
+ elm_genlist_decorate_mode_set(log_d->genlist, EINA_FALSE);
+
+ if (redraw)
+ phone_log_set_navi(log_d->navi);
+
+ item = elm_genlist_first_item_get(log_d->genlist);
+ while (item) {
+ elm_genlist_item_fields_update(item, "elm.icon.3", ELM_GENLIST_ITEM_FIELD_CONTENT);
+ item = elm_genlist_item_next_get(item);
+ }
+}
+
+void ph_log_check_update_select_all(ph_log_data *log_d)
+{
+ Eina_Bool all_check;
+ Evas_Object *check;
+
+ p_retm_if(NULL == log_d->select_all_layout, "select_all_layout is NULL");
+
+ check = elm_object_part_content_get(log_d->select_all_layout, "elm.icon");
+ p_retm_if(NULL == check, "elm_object_part_content_get() return NULL");
+
+ if (log_d->log_list_count == log_d->cnt_checked)
+ all_check = EINA_TRUE;
+ else
+ all_check = EINA_FALSE;
+ elm_check_state_set(check, all_check);
+}
+
+void ph_log_check_done_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int i = 0;
+ int *result_list;
+ Eina_List *l;
+ ph_log_info *l_info;
+ ph_log_data *log_d = data;
+
+ result_list = calloc(log_d->cnt_checked, sizeof(int));
+ EINA_LIST_FOREACH(log_d->log_list, l, l_info) {
+ if (!l_info) continue;
+ if (l_info->checked)
+ result_list[i++] = l_info->id;
+ }
+ phone_list_ug_return_ids(log_d->ug, result_list, log_d->cnt_checked, PH_UG_BUNDLE_RESULT_PLOG_ID_LIST);
+
+ free(result_list);
+ ug_destroy_me(log_d->ug);
+}
+
+static PTHREAD_FN log_check_del(void *data)
+{
+ ph_log_data *log_d = data;
+ ph_progress_info *p_info = log_d->p_info;
+ Eina_List *l;
+ ph_log_info *l_info;
+
+ contacts_connect_on_thread();
+
+ EINA_LIST_FOREACH(log_d->log_list, l, l_info) {
+ if (!p_info->alive) {
+ p_info->completed = true;
+ break;
+ }
+ if (!l_info) continue;
+
+ if (TRUE == l_info->checked) {
+ if (CONTACTS_ERROR_NONE != ph_log_util_del_log_by_id(log_d->log_list, l_info)) {
+ p_info->completed = true;
+ break;
+ }
+ p_info->cnt++;
+ }
+ if (p_info->cnt == p_info->cnt_checked_total)
+ break;
+ }
+
+ contacts_disconnect_on_thread();
+
+ pthread_exit(NULL);
+}
+
+
+static Eina_Bool log_check_del_timer(void *data)
+{
+ ph_log_data *log_d = data;
+ ph_progress_info *p_info = log_d->p_info;
+
+ p_retvm_if(NULL == p_info, ECORE_CALLBACK_CANCEL, "parameter(ph_progress_info) is NULL");
+
+ if (!p_info->completed) {
+ char count[PH_TEXT_SHORT_LEN];
+ char percent[5];
+ double 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(count, sizeof(count), "%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", count);
+
+ if (p_info->cnt == p_info->cnt_checked_total)
+ p_info->completed = true;
+
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ bool deleted = false;
+
+ pthread_join(p_info->thread, NULL);
+
+ if (p_info->cnt == p_info->cnt_checked_total) {
+ deleted = true;
+ }
+
+ evas_object_del(log_d->popup);
+ log_d->popup = NULL;
+
+ if (NULL != p_info) {
+ free(p_info);
+ log_d->p_info = NULL;
+ }
+
+ ph_log_check_mode_end(log_d, true);
+
+ if (deleted)
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+
+ ph_log_data_changed_cb(log_d);
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+void ph_log_check_del_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int ret;
+ ph_log_data *log_d = data;
+ ph_progress_info *p_info;
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc return NULL");
+
+ log_d->p_info = p_info;
+ p_info->cnt_checked_total = log_d->cnt_checked;
+ p_info->alive = true;
+
+ ret = pthread_create(&p_info->thread, NULL, log_check_del, log_d);
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ log_d->p_info = NULL;
+ return;
+ }
+
+ p_info->timer = ecore_timer_add(0.2, log_check_del_timer, log_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);
+ log_d->p_info = NULL;
+ return;
+ }
+
+ log_d->popup = phone_progressbar_popup(log_d->win, p_info, T_(PH_GET_TEXT_BASIC, PHTEXT_DELETING_LOGS));
+}
+
+
+void ph_log_check_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_data *log_d = data;
+
+#if 0
+ if (elm_check_state_get(obj))
+ log_d->cnt_checked++;
+ else
+ log_d->cnt_checked--;
+#endif
+
+ ph_log_check_update_select_all(log_d);
+ ph_log_check_update_selection_info(log_d);
+ ph_log_check_update_button_status(log_d);
+}
diff --git a/lib/log/ph-log-check-view.h b/lib/log/ph-log-check-view.h
new file mode 100755
index 0000000..f47fe43
--- /dev/null
+++ b/lib/log/ph-log-check-view.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 __PH_LOG_CHECK_VIEW_H_
+#define __PH_LOG_CHECK_VIEW_H_
+
+void ph_log_check_mode_end(ph_log_data *log_d, bool redraw);
+void ph_log_check_update_select_all(ph_log_data *log_d);
+void ph_log_check_update_selection_info(ph_log_data *log_d);
+void ph_log_check_update_button_status(ph_log_data *log_d);
+void ph_log_check_done_btn_cb(void *data, Evas_Object *obj, void *event_info);
+void ph_log_check_del_btn_cb(void *data, Evas_Object *obj, void *event_info);
+void ph_log_check_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
+
+#endif /* __PH_LOG_CHECK_VIEW_H_ */
diff --git a/lib/log/ph-log-detail-view.c b/lib/log/ph-log-detail-view.c
new file mode 100755
index 0000000..387edae
--- /dev/null
+++ b/lib/log/ph-log-detail-view.c
@@ -0,0 +1,1153 @@
+/*
+* 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 <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-log.h"
+#include "ph-log-utils.h"
+#include "ph-log-detail-view.h"
+
+#include <feedback.h>
+#include <msg.h>
+
+#define KEY_LOG_DETAIL_DATA "logdetail_d"
+
+enum LOG_DETAIL_ITC_TYPE {
+ LOG_DETAIL_ITC_TOP_INFO_NAMED = 0,
+ LOG_DETAIL_ITC_TOP_INFO_NONAMED,
+
+ LOG_DETAIL_ITC_TOP_BTNS,
+ LOG_DETAIL_ITC_DETAIL,
+ LOG_DETAIL_ITC_TITLE,
+ LOG_DETAIL_ITC_MAX,
+};
+
+static Elm_Genlist_Item_Class log_detail_itcs[LOG_DETAIL_ITC_MAX] = {
+ {.item_style="2text.2icon.1"},
+ {.item_style="1text.1icon.7"},
+ {.item_style="dialogue/bg/2icon"},
+ {.item_style="dialogue/3text.2icon"},
+ {.item_style="grouptitle"},
+};
+
+typedef struct
+{
+ int plog_id;
+ int plog_type;
+ int plog_time;
+ int plog_duration;
+ int plog_msgid;
+ char *plog_shortmsg;
+}ph_log_detail_info;
+
+
+static void log_detail_destroy_child_ug(void *data)
+{
+ ph_log_detail_data *logdetail_d = (ph_log_detail_data *)data;
+ logdetail_d->child_ug = NULL;
+ ph_log_detail_set_toolbar(logdetail_d);
+}
+
+static void log_detail_msg_btn_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ p_retm_if(NULL == data, "data is NULL");
+ elm_icon_file_set(data, PH_IMG_ICON_SMS_PRESSED, NULL);
+}
+
+static void log_detail_msg_btn_unpressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ p_retm_if(NULL == data, "data is NULL");
+ elm_icon_file_set(data, PH_IMG_ICON_SMS, NULL);
+}
+
+static void log_detail_msg_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = (ph_log_detail_data *)data;
+ p_retm_if(NULL == logdetail_d, "log_info is NULL");
+ ph_log_util_svi_play(FEEDBACK_PATTERN_TOUCH_TAP , FEEDBACK_PATTERN_TOUCH_TAP);
+
+ p_retm_if(1 == aul_app_is_running(VIDEOCALL_PKG), "vtcall is running");
+ p_retm_if(1 == aul_app_is_running(VOICECALL_PKG), "voice call is running");
+
+ logdetail_d->child_ug = phone_launch_msg_composer_ug(logdetail_d->ug, logdetail_d->log_number, 0,
+ log_detail_destroy_child_ug, logdetail_d);
+}
+
+static void log_detail_call_btn_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, PH_IMG_ICON_CALL_PRESSED, NULL);
+}
+
+static void log_detail_call_btn_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, PH_IMG_CIRCLE_ICON_CALL, NULL);
+}
+
+static void log_detail_call_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = (ph_log_detail_data *)data;
+ p_retm_if(NULL == logdetail_d, "log_info is NULL");
+ ph_log_util_svi_play(FEEDBACK_PATTERN_TOUCH_TAP , FEEDBACK_PATTERN_TOUCH_TAP);
+ phone_launch_voice_call(logdetail_d->contact_id, logdetail_d->log_number);
+}
+
+
+
+
+static int log_detail_is_msg_type(int type)
+{
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_SMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_SMS_OUTGOING:
+ case CONTACTS_PLOG_TYPE_SMS_BLOCKED:
+ case CONTACTS_PLOG_TYPE_MMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_MMS_OUTGOING:
+ case CONTACTS_PLOG_TYPE_MMS_BLOCKED:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static void log_detail_gl_realized(void *data, Evas_Object *obj, void *ei)
+{
+ p_retm_if(obj == NULL, "obj is null");
+ p_retm_if(ei == NULL, "ei is null");
+
+ ph_log_detail_data *logdetail_d;
+ logdetail_d = evas_object_data_get(obj, KEY_LOG_DETAIL_DATA);
+
+ int first = 0;
+
+ if (logdetail_d->log_number && *logdetail_d->log_number)
+ first = 5;
+ else
+ first = 3;
+ int last = (int)elm_genlist_items_count(obj) - 1;
+ int index = elm_genlist_item_index_get(ei);
+
+ if (last == first)
+ return;
+
+ if (index == first)
+ elm_object_item_signal_emit(ei, "elm,state,top", "");
+ else if (index == last)
+ elm_object_item_signal_emit(ei, "elm,state,bottom", "");
+ else if (index > first && index < last)
+ elm_object_item_signal_emit(ei, "elm,state,center", "");
+
+ return;
+}
+
+static void log_detail_append_separator(Evas_Object *genlist, bool isEnd)
+{
+ static Elm_Genlist_Item_Class itc[2] = {
+ {.item_style="dialogue/separator/end"},
+ {.item_style="dialogue/separator/10"}
+ };
+
+ Elm_Object_Item *item;
+ if (isEnd)
+ item = elm_genlist_item_append(genlist, &itc[0], NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ else
+ item = elm_genlist_item_append(genlist, &itc[1], NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+}
+
+static void log_detail_fill_genlist(ph_log_detail_data *logdetail_d)
+{
+ PH_FN_CALL;
+ Eina_List *l;
+ ph_log_detail_info * l_detail_info;
+ Elm_Object_Item *git;
+
+ p_retm_if(NULL == logdetail_d->genlist, "Genlist is null");
+ if (logdetail_d->log_display)
+ logdetail_d->top_item = elm_genlist_item_append(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NAMED], logdetail_d,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ else
+ logdetail_d->top_item = elm_genlist_item_append(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NONAMED], logdetail_d,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ if (logdetail_d->log_number) {
+ elm_genlist_item_append(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_TOP_BTNS], logdetail_d, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ log_detail_append_separator(logdetail_d->genlist, false);
+ }
+ l_detail_info = (ph_log_detail_info*)eina_list_data_get(eina_list_last (logdetail_d->log_list));
+ git = elm_genlist_item_append(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_TITLE], l_detail_info,
+ NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_NONE);
+ EINA_LIST_FOREACH(logdetail_d->log_list, l, l_detail_info) {
+ Elm_Object_Item * it;
+ if (!l_detail_info) continue;
+ it = elm_genlist_item_append(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_DETAIL], l_detail_info,
+ git, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+ log_detail_append_separator(logdetail_d->genlist, true);
+}
+
+static void log_detail_free_log_data(Eina_List *list)
+{
+ Eina_List *l;
+ ph_log_detail_info *l_detail_info;
+ p_retm_if(NULL == list, "data is null");
+
+ EINA_LIST_FOREACH(list, l, l_detail_info) {
+ if (!l_detail_info) continue;
+ free(l_detail_info->plog_shortmsg);
+ free(l_detail_info);
+ }
+ eina_list_free(list);
+}
+
+contacts_error_e log_detail_get_list(const char *view_uri, int property_id, const char* 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");
+
+ 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_str(filter, property_id, CONTACTS_MATCH_FULLSTRING, 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 (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);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ return err;
+}
+
+static char* log_detail_get_custom_number_type(int contact_id, const char* req_number)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h num_list = NULL;
+ char *out_num = NULL;
+ char *out_label = NULL;
+
+ if (contact_id > 0) {
+ err = phone_cts_get_list(_contacts_person_number._uri, _contacts_person_number.person_id, contact_id, &num_list);
+ if (CONTACTS_ERROR_NONE == err) {
+ while(CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_str_from_list(num_list, _contacts_person_number.number, &out_num);
+ if (err == CONTACTS_ERROR_NONE && strcmp(req_number, out_num) == 0) {
+ err = phone_cts_get_str_from_list(num_list, _contacts_person_number.label, &out_label);
+ break;
+ }
+ err = contacts_list_next(num_list);
+ }
+ }
+ contacts_list_destroy(num_list, true);
+ }
+
+ if (err == CONTACTS_ERROR_NONE && out_label && *out_label)
+ return strdup(out_label);
+ else
+ return T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_OTHER);
+
+}
+
+static void log_detail_get_contact_info(char *req_number, ph_log_detail_data *logdetail_d)
+{
+ int index;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h out_contact = NULL;
+ contacts_list_h num_list = NULL;
+ char *out_num;
+
+ p_retm_if(NULL == req_number, "Parameter is null");
+ free(logdetail_d->log_display);
+ logdetail_d->log_display = NULL;
+ free(logdetail_d->log_img_path);
+ logdetail_d->log_img_path = NULL;
+
+ index = 0;
+ if (logdetail_d->contact_id > 0) {
+ err = phone_cts_get_list(_contacts_person_number._uri, _contacts_person_number.person_id, logdetail_d->contact_id, &num_list);
+ if (CONTACTS_ERROR_NONE == err) {
+ while(CONTACTS_ERROR_NONE == err) {
+ err = phone_cts_get_str_from_list(num_list, _contacts_person_number.number, &out_num);
+ if (err == CONTACTS_ERROR_NONE && strcmp(req_number, out_num) == 0) {
+ index = logdetail_d->contact_id;
+ break;
+ }
+ err = contacts_list_next(num_list);
+ }
+ }
+ contacts_list_destroy(num_list, true);
+ }
+
+ if (index <= 0)
+ {
+ err = log_detail_get_list(_contacts_person_number._uri, _contacts_person_number.number, req_number, &num_list);
+ if (CONTACTS_ERROR_NONE == err) {
+ unsigned int count = 0;
+ contacts_list_get_count(num_list, &count);
+ if (count > 0)
+ {
+ phone_cts_get_int_from_list(num_list, _contacts_person_number.person_id, &index);
+ PH_DBG("FOUND ONE: %d", index);
+ }
+
+ }
+ contacts_list_destroy(num_list, true);
+ }
+
+ if (index > 0) {
+ err = contacts_db_get_record( _contacts_person._uri, index, &out_contact);
+ if (err < CONTACTS_ERROR_NONE)
+ ERR("contacts_db_get_record is failed");
+ else {
+ contacts_record_get_str(out_contact, _contacts_person.display_name, &logdetail_d->log_display);
+ logdetail_d->contact_id = index;
+ contacts_record_get_str(out_contact, _contacts_person.image_thumbnail_path, &logdetail_d->log_img_path);
+ contacts_record_destroy(out_contact, true);
+ PH_DBG("updated) name: %s, id: %d, imgpath: %s", logdetail_d->log_display, logdetail_d->contact_id, logdetail_d->log_img_path);
+ return;
+ }
+ }
+ logdetail_d->contact_id = 0;
+}
+
+static void log_detail_view_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = data;
+ p_retm_if(NULL == logdetail_d, "detail data is null");
+
+ if (0 < logdetail_d->contact_id)
+ {
+ PH_DBG("requested ID: %d", logdetail_d->contact_id);
+ logdetail_d->child_ug = phone_launch_contact_detail_ug(logdetail_d->ug, logdetail_d->contact_id,
+ log_detail_destroy_child_ug, logdetail_d);
+ }
+}
+
+static void log_detail_add_contact_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = data;
+ logdetail_d->child_ug = phone_launch_contact_add_list_edit_ug(logdetail_d->ug, logdetail_d->log_number,
+ log_detail_destroy_child_ug, logdetail_d);
+}
+
+static void log_detail_update_view_with_contact_cb(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d = data;
+ log_detail_get_contact_info(logdetail_d->log_number, logdetail_d);
+
+ if (logdetail_d->top_item)
+ elm_object_item_del(logdetail_d->top_item);
+ if (logdetail_d->log_display)
+ logdetail_d->top_item = elm_genlist_item_prepend(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NAMED], logdetail_d,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ else
+ logdetail_d->top_item = elm_genlist_item_prepend(logdetail_d->genlist, &log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NONAMED], logdetail_d,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ Elm_Object_Item *navi_it = elm_naviframe_top_item_get(logdetail_d->navi);
+ p_retm_if(NULL == navi_it, "navi item is NULL");
+
+ Evas_Object * contact_btn = elm_object_item_part_content_unset(navi_it, "toolbar_button2");
+ if (contact_btn)
+ evas_object_del(contact_btn);
+
+//contact button
+ if (logdetail_d->contact_id) // view button
+ contact_btn = phone_create_toolbar_btn(logdetail_d->navi, T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW), log_detail_view_clicked_cb, logdetail_d);
+ else if (logdetail_d->log_number) // save button
+ contact_btn = phone_create_toolbar_btn(logdetail_d->navi, S_(PH_SYS_OPT_ADD_TO_CONTACTS), log_detail_add_contact_btn_cb, logdetail_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button2", contact_btn);
+ elm_object_style_set(contact_btn, "naviframe/toolbar/right");
+
+ return;
+}
+
+static void log_detail_delete_confirm_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int ret = CONTACTS_ERROR_NONE;
+ ph_log_detail_data *logdetail_d = data;
+ Eina_List *l;
+ ph_log_detail_info *l_info;
+
+ evas_object_del(logdetail_d->popup);
+ logdetail_d->popup = NULL;
+
+ l = logdetail_d->log_list;
+ EINA_LIST_FOREACH(l, l, l_info) {
+ ret = contacts_db_delete_record( _contacts_phone_log._uri, l_info->plog_id);
+ if (CONTACTS_ERROR_NONE != ret)
+ break;
+ }
+
+ if (CONTACTS_ERROR_NONE != ret) {
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ }
+ else {
+ evas_object_data_del(logdetail_d->navi, KEY_LOG_DETAIL_DATA);
+ elm_naviframe_item_pop(logdetail_d->navi);
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ }
+}
+
+static void log_detail_del_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = data ;
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ snprintf(buf, sizeof(buf), "%s?", S_(PH_SYS_SK_DELETE));
+ phone_create_confirm_popup(&logdetail_d->popup, logdetail_d->win, buf,
+ log_detail_delete_confirm_cb, logdetail_d);
+}
+
+static Evas_Object *log_detail_gl_top_info_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_log_detail_data *logdetail_d = data;
+ if (0 == strcmp(part, "elm.icon")) {
+ }
+ else if (0 == strcmp(part, "elm.icon.2")) {
+ Evas_Object *detail_img = NULL;
+ if (logdetail_d->log_img_path)
+ detail_img = phone_create_icon_with_img(obj, logdetail_d->log_img_path);
+ else
+ detail_img = phone_create_icon_with_img(obj, IMG_DEFAULT);
+ if (detail_img)
+ evas_object_size_hint_aspect_set(detail_img, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
+ return detail_img;
+ }
+ return NULL;
+}
+
+void log_detail_destroy_list_child_ug(void *data)
+{
+ ph_log_detail_data *logdetail_d = data;
+ logdetail_d->child_ug = NULL;
+
+}
+
+
+static Evas_Object *log_detail_gl_top_btns_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *fullpath;
+ Evas_Object *btn;
+ Evas_Object *icon;
+ Evas_Smart_Cb clicked_fn;
+ Evas_Smart_Cb pressed_fn;
+ Evas_Smart_Cb unpressed_fn;
+ ph_log_detail_data *logdetail_d = data;
+
+ p_retv_if(NULL == data, NULL);
+
+ if (0 == strcmp(part, "elm.icon.1")) {
+ fullpath = PH_IMG_CIRCLE_ICON_CALL;
+ clicked_fn = log_detail_call_btn_cb;
+ pressed_fn = log_detail_call_btn_pressed_cb;
+ unpressed_fn = log_detail_call_btn_unpressed_cb;
+ }
+ else if (0 == strcmp(part, "elm.icon.2")) {
+ fullpath = PH_IMG_ICON_SMS;
+ clicked_fn = log_detail_msg_btn_cb;
+ pressed_fn = log_detail_msg_btn_pressed_cb;
+ unpressed_fn = log_detail_msg_btn_unpressed_cb;
+ }
+ else {
+ return NULL;
+ }
+
+ btn = elm_button_add(obj);
+ p_retvm_if(NULL == btn, NULL, "elm_button_add() return NULL");
+ elm_object_style_set(btn, "logdetail.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_smart_callback_add(btn, "clicked", clicked_fn, logdetail_d);
+ 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);
+
+ if (!logdetail_d->log_number || !*logdetail_d->log_number)
+ elm_object_disabled_set(btn, EINA_TRUE);
+
+ return btn;
+}
+
+static char *log_detail_gl_top_info_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d = data;
+ char buf[PATH_MAX] = {0};
+
+ if (0 == strcmp(part, "elm.text")) {
+ if (logdetail_d->log_number && *logdetail_d->log_number)
+ if (logdetail_d->log_list_count > 1)
+ snprintf(buf, sizeof(buf), "%s (%d)", logdetail_d->log_number, logdetail_d->log_list_count);
+ else
+ snprintf(buf, sizeof(buf), "%s",logdetail_d->log_number);
+ else
+ snprintf(buf, sizeof(buf), "%s (%d)", S_(PH_SYS_BODY_UNKNOWN), logdetail_d->log_list_count);
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.1")) {
+ if (logdetail_d->log_display && *logdetail_d->log_display)
+ if (logdetail_d->log_list_count > 1)
+ snprintf(buf, sizeof(buf), "%s (%d)",logdetail_d->log_display, logdetail_d->log_list_count);
+ else
+ snprintf(buf, sizeof(buf), "%s",logdetail_d->log_display);
+ else if (logdetail_d->log_number && *logdetail_d->log_number)
+ if (logdetail_d->log_list_count > 1)
+ snprintf(buf, sizeof(buf), "%s (%d)", logdetail_d->log_number, logdetail_d->log_list_count);
+ else
+ snprintf(buf, sizeof(buf), "%s",logdetail_d->log_number);
+ else
+ snprintf(buf, sizeof(buf), "%s (%d)", S_(PH_SYS_BODY_UNKNOWN), logdetail_d->log_list_count);
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ if ((logdetail_d->log_display && *logdetail_d->log_display)
+ && (logdetail_d->log_number && *logdetail_d->log_number))
+ {
+ if (logdetail_d->log_num_type & CONTACTS_NUMBER_TYPE_CUSTOM)
+ snprintf(buf, sizeof(buf), "%s %s", log_detail_get_custom_number_type(logdetail_d->contact_id, logdetail_d->log_number), logdetail_d->log_number);
+ else
+ snprintf(buf, sizeof(buf), "%s %s",T_(CT_GET_TEXT_NUM_TYPE, phone_detail_log_get_phonenumber_type(logdetail_d->log_num_type)), logdetail_d->log_number);
+ return strdup(buf);
+ }
+ else
+ return NULL;
+ }
+ return NULL;
+}
+
+static Evas_Object *log_detail_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_log_detail_info * l_detail_info = data;
+ char buf[PATH_MAX]={0};
+ Evas_Object *ic;
+
+ if (0 == strcmp(part, "elm.icon.1")) {
+ 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.2")) {
+ 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
+ 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 const char* log_detail_get_type_name(int type)
+{
+ switch(type)
+ {
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING:
+ return T_(PH_GET_TEXT_BASIC, PHTEXT_INCOMMING_CALL);
+ break;
+ case CONTACTS_PLOG_TYPE_VOICE_OUTGOING:
+ case CONTACTS_PLOG_TYPE_VIDEO_OUTGOING:
+ return T_(PH_GET_TEXT_BASIC, PHTEXT_OUTGOING_CALL);
+ break;
+ 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 T_(PH_GET_TEXT_BASIC, PHTEXT_MISSED_CALL);
+ break;
+ case CONTACTS_PLOG_TYPE_MMS_OUTGOING:
+ case CONTACTS_PLOG_TYPE_SMS_OUTGOING:
+ case CONTACTS_PLOG_TYPE_EMAIL_SENT:
+ return T_(PH_GET_TEXT_BASIC, PHTEXT_SENT_MESSAGE);
+ break;
+ case CONTACTS_PLOG_TYPE_MMS_INCOMMING :
+ case CONTACTS_PLOG_TYPE_SMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_EMAIL_RECEIVED:
+ return T_(PH_GET_TEXT_BASIC, PHTEXT_RECEIVED_MESSAGE);
+ break;
+ case CONTACTS_PLOG_TYPE_VOICE_REJECT:
+ case CONTACTS_PLOG_TYPE_VIDEO_REJECT:
+ return T_(PH_GET_TEXT_BASIC, PHTEXT_REJECTED_CALL_ABB);
+ break;
+ case CONTACTS_PLOG_TYPE_VOICE_BLOCKED:
+ case CONTACTS_PLOG_TYPE_VIDEO_BLOCKED:
+ return T_(PH_GET_TEXT_BASIC, PHTEXT_BLOCKED_CALL_ABB);
+ break;
+ case CONTACTS_PLOG_TYPE_SMS_BLOCKED:
+ case CONTACTS_PLOG_TYPE_MMS_BLOCKED:
+ default:
+ break;
+ }
+ return NULL;
+}
+
+static char* log_detail_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_log_detail_info * l_detail_info = data;
+ char buf[PATH_MAX]={0};
+ const char* typename = NULL;
+
+ if (0 == strcmp(part, "elm.text.1")) {
+ ph_log_detail_data *logdetail_d;
+ logdetail_d = evas_object_data_get(obj, KEY_LOG_DETAIL_DATA);
+ return phone_detail_log_get_time(logdetail_d->log_d->formatter, l_detail_info->plog_time);
+ }
+ else if (0 == strcmp(part, "elm.text.2")) {
+ typename = log_detail_get_type_name(l_detail_info->plog_type);
+ if (typename)
+ {
+ if (TRUE == phone_detail_log_is_call_ing_type(l_detail_info->plog_type))
+ {
+ sprintf(buf, "%s %s", typename, phone_detail_log_get_duration_from_number(l_detail_info->plog_duration));
+ return strdup(buf);
+ }
+ else
+ return strdup(typename);
+ }
+ else
+ {
+ if (TRUE == phone_detail_log_is_call_ing_type(l_detail_info->plog_type))
+ return phone_detail_log_get_duration_from_number(l_detail_info->plog_duration);
+ }
+ }
+ else if (0 == strcmp(part, "elm.text.3")) {
+ if (TRUE == phone_detail_log_is_call_ing_type(l_detail_info->plog_type))
+ return phone_detail_log_get_duration_from_number(l_detail_info->plog_duration);
+ }
+
+ return NULL;
+}
+
+
+static const char *log_detail_get_day_in_week(ph_log_detail_info * l_detail_info )
+{
+ PH_FN_CALL;
+ time_t stime;
+ struct tm *tmp;
+
+ stime = l_detail_info->plog_time - l_detail_info->plog_duration;
+ tmp = localtime(&stime);
+
+ switch(tmp->tm_wday) {
+ case 0:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_SUNDAY);
+ case 1:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_MONDAY);
+ case 2:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_TUESDAY);
+ case 3:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_WEDNESDAY);
+ case 4:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_THURSDAY);
+ case 5:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_FRIDAY);
+ case 6:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_SATURDAY);
+ }
+ return NULL;
+}
+static int log_detail_get_group_index(ph_log_detail_info* l_detail_info)
+{
+ time_t stime;
+ struct timeval timeval;
+ struct tm *tmp;
+ int yday, cur_yday;
+
+ gettimeofday(&timeval, 0);
+ tmp = localtime(&timeval.tv_sec);
+ cur_yday = tmp->tm_yday;
+
+ stime = l_detail_info->plog_time - l_detail_info->plog_duration;
+ tmp = localtime(&stime);
+
+ yday = tmp->tm_yday;
+
+ if (yday == cur_yday)
+ return -1;
+ else if (yday == (cur_yday-1))
+ return -2;
+ else
+ return 0;
+}
+
+static char* log_detail_gl_sep_date_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ ph_log_detail_info * l_detail_info = (ph_log_detail_info*)data;
+ const char *when;
+
+
+ int index =log_detail_get_group_index(l_detail_info);
+
+ if (0 == strcmp(part, "elm.text")) {
+ char *date_temp;
+ ph_log_detail_data *logdetail_d;
+
+ if (-1 == index)
+ when = S_(PH_SYS_BODY_TODAY);
+ else if (-2 == index)
+ when = S_(PH_SYS_BODY_YESTERDAY);
+ else
+ when = log_detail_get_day_in_week(l_detail_info);
+
+ logdetail_d = evas_object_data_get(obj, KEY_LOG_DETAIL_DATA);
+ date_temp = phone_detail_log_get_date(logdetail_d->log_d->formatter, l_detail_info->plog_time-l_detail_info->plog_duration);
+ 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 inline void log_detail_create_itcs()
+{
+ PH_FN_CALL;
+ log_detail_itcs[LOG_DETAIL_ITC_DETAIL].func.text_get = log_detail_gl_label_get;
+ log_detail_itcs[LOG_DETAIL_ITC_DETAIL].func.content_get = log_detail_gl_icon_get;
+
+ log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NAMED].func.text_get = log_detail_gl_top_info_label_get;
+ log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NAMED].func.content_get = log_detail_gl_top_info_icon_get;
+
+ log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NONAMED].func.text_get = log_detail_gl_top_info_label_get;
+ log_detail_itcs[LOG_DETAIL_ITC_TOP_INFO_NONAMED].func.content_get = log_detail_gl_top_info_icon_get;
+
+ log_detail_itcs[LOG_DETAIL_ITC_TOP_BTNS].func.content_get = log_detail_gl_top_btns_icon_get;
+ log_detail_itcs[LOG_DETAIL_ITC_TITLE].func.text_get = log_detail_gl_sep_date_label_get;
+}
+
+static Evas_Object* log_detail_create_genlist(ph_log_detail_data *logdetail_d, Evas_Object *parent)
+{
+ PH_FN_CALL;
+ Evas_Object *genlist;
+
+ genlist = elm_genlist_add(parent);
+ 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);
+ evas_object_data_set(genlist, KEY_LOG_DETAIL_DATA, logdetail_d);
+ elm_object_theme_set(genlist, logdetail_d->th);
+ evas_object_smart_callback_add(genlist, "realized", log_detail_gl_realized, NULL);
+
+ log_detail_create_itcs();
+ return genlist;
+}
+
+static void log_detail_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == logdetail_d, "log detail data is null");
+
+ err = contacts_db_remove_changed_cb(_contacts_person._uri, log_detail_update_view_with_contact_cb, logdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ evas_object_data_del(logdetail_d->navi, KEY_LOG_DETAIL_DATA);
+
+ elm_object_part_content_set(logdetail_d->layout, "elm.swallow.bg", NULL);
+
+ if (logdetail_d->th) {
+ elm_theme_extension_del(logdetail_d->th, DIALER_THEME_EDJ);
+ elm_theme_free(logdetail_d->th);
+ }
+
+ if (logdetail_d->log_list)
+ log_detail_free_log_data(logdetail_d->log_list);
+
+ if (logdetail_d->idler)
+ ecore_idler_del(logdetail_d->idler);
+
+ if (logdetail_d->popup)
+ evas_object_del(logdetail_d->popup);
+
+ if (logdetail_d->child_ug)
+ ug_destroy(logdetail_d->child_ug);
+
+ if (logdetail_d->log_display)
+ free(logdetail_d->log_display);
+
+ if (logdetail_d->log_number)
+ free(logdetail_d->log_number);
+
+ if (logdetail_d->log_img_path)
+ free(logdetail_d->log_img_path);
+
+
+ free(logdetail_d);
+}
+
+static void log_detail_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d = data;
+
+ /* TODO : remove evas_object_smart_callback_del, it will be controlled by WINSET */
+ evas_object_smart_callback_del(obj, "clicked", log_detail_back_btn_cb);
+
+ elm_naviframe_item_pop(logdetail_d->navi);
+ phone_log_missed_info_update(logdetail_d->navi);
+}
+
+static int touch_x;
+static int touch_y;
+void log_detail_gl_mousedown_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ touch_x = ev->canvas.x;
+ touch_y = ev->canvas.y;
+}
+
+static void log_detail_ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = data;
+ evas_object_del(logdetail_d->popup);
+ logdetail_d->popup = NULL;
+}
+
+static void log_detail_ctxpopup_copy_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char buf[PH_TEXT_MAX_LEN];
+
+ ph_log_detail_data *logdetail_d = data;
+ evas_object_del(obj);
+ logdetail_d->popup = NULL;
+
+ if (logdetail_d->log_display && *logdetail_d->log_display)
+ if (logdetail_d->log_number && *logdetail_d->log_number)
+ snprintf(buf, sizeof(buf), "%s\n%s", logdetail_d->log_display, logdetail_d->log_number);
+ else
+ snprintf(buf, sizeof(buf), "%s", logdetail_d->log_display);
+ else if (logdetail_d->log_number && *logdetail_d->log_number)
+ snprintf(buf, sizeof(buf), "%s", logdetail_d->log_number);
+ else
+ snprintf(buf, sizeof(buf), "%s", S_(PH_SYS_BODY_UNKNOWN));
+ elm_cnp_selection_set(logdetail_d->layout, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, buf, strlen(buf));
+}
+
+static void log_detail_ctxpopup_edit_number_before_call_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d = data;
+ evas_object_del(obj);
+ logdetail_d->popup = NULL;
+
+ service_h service;
+ int num = STRLEN(logdetail_d->log_number) + STRLEN("tel:") + 1;
+ char *uri = (char*)malloc(sizeof(char)*num);
+ memset(uri, 0, sizeof(char)*num);
+
+ snprintf(uri, sizeof(char)*num, "%s%s", "tel:", logdetail_d->log_number);
+
+ service_create(&service);
+ service_set_package(service, "org.tizen.phone");
+ service_set_operation(service, "http://tizen.org/appcontrol/operation/dial");
+ service_set_uri(service, uri);
+ service_send_launch_request(service, NULL,NULL );
+ service_destroy(service);
+
+ free(uri);
+
+}
+
+static void log_detail_gl_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+}
+
+static void log_detail_gl_longpressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_detail_data *logdetail_d = (ph_log_detail_data*)data;
+ Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+
+ if(elm_genlist_item_index_get(it) > 1)
+ return;
+
+ logdetail_d->popup = elm_ctxpopup_add(logdetail_d->navi);
+ p_retm_if(NULL == logdetail_d->popup, "elm_ctxpopup_add() return NULL");
+
+
+ elm_ctxpopup_direction_priority_set(logdetail_d->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+
+ evas_object_smart_callback_add(logdetail_d->popup, "dismissed", log_detail_ctxpopup_dismissed_cb, logdetail_d);
+ elm_ctxpopup_item_append(logdetail_d->popup, S_(CT_SYS_BODY_COPY), NULL, log_detail_ctxpopup_copy_cb, logdetail_d);
+
+ elm_ctxpopup_item_append(logdetail_d->popup, T_(PH_GET_TEXT_BASIC, PHTEXT_EDIT_NUMBER_BEFORE_CALL), NULL, log_detail_ctxpopup_edit_number_before_call_cb, logdetail_d);
+
+ evas_object_move(logdetail_d->popup, 720/2, 50+142/2);
+ evas_object_show(logdetail_d->popup);
+}
+
+static void more_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+
+ ph_log_detail_data *logdetail_d = data;
+ p_retm_if(NULL == logdetail_d, "logdetail_d is NULL");
+
+ Evas_Object *popup = NULL;
+
+ popup = elm_ctxpopup_add(logdetail_d->navi);
+ p_retm_if(NULL == popup, "elm_ctxpopup_add() return NULL");
+
+ elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+ evas_object_smart_callback_add(popup, "dismissed", log_detail_ctxpopup_dismissed_cb, logdetail_d);
+
+ int x, y, w, h;
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+ evas_object_move(popup, x+(w/2), y+(h/2));
+ evas_object_show(popup);
+
+ logdetail_d->popup = popup;
+ return;
+}
+
+void ph_log_detail_set_toolbar(ph_log_detail_data *logdetail_d)
+{
+ Elm_Object_Item *navi_it;
+ Evas_Object *more_button = NULL;
+ Evas_Object * delete_button = NULL;
+ Evas_Object * contact_btn = NULL;
+ Evas_Object *back_btn = NULL;
+
+ navi_it = elm_naviframe_top_item_get(logdetail_d->navi);
+ p_retm_if(NULL == navi_it, "navi item is NULL");
+
+ if (logdetail_d->navi) {
+ phone_navi_item_clear(navi_it);
+ }
+
+//more button
+ more_button = ctui_create_more_btn(logdetail_d->navi, more_btn_clicked_cb, logdetail_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_more_btn", more_button);
+
+//delete button
+ delete_button = phone_create_toolbar_btn(logdetail_d->navi, S_(PH_SYS_SK_DELETE), log_detail_del_btn_cb, logdetail_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", delete_button);
+ elm_object_style_set(delete_button, "naviframe/toolbar/left");
+
+//contact button
+ if (logdetail_d->contact_id) // view button
+ contact_btn = phone_create_toolbar_btn(logdetail_d->navi, T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW), log_detail_view_clicked_cb, logdetail_d);
+ else if (logdetail_d->log_number) // save button
+ contact_btn = phone_create_toolbar_btn(logdetail_d->navi, S_(PH_SYS_OPT_ADD_TO_CONTACTS), log_detail_add_contact_btn_cb, logdetail_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button2", contact_btn);
+ elm_object_style_set(contact_btn, "naviframe/toolbar/right");
+
+//BACK button
+ back_btn = elm_button_add(logdetail_d->navi);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ elm_object_item_part_content_set(navi_it, "prev_btn", back_btn);
+ evas_object_smart_callback_add(back_btn, "clicked", phone_view_back_btn_cb, logdetail_d->navi);
+
+ return;
+
+}
+
+void ph_log_detail_update(ph_log_data *log_d)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d;
+ logdetail_d = evas_object_data_get(log_d->navi, KEY_LOG_DETAIL_DATA);
+
+ if (logdetail_d) {
+ ph_log_info *l_info = NULL;
+ ph_log_info *find_info = NULL;
+ ph_log_detail_info *l_detail_info = NULL;
+ Eina_List *l_detail = logdetail_d->log_list;
+ Eina_List *l;
+ Elm_Object_Item *pre_item = NULL;
+
+ EINA_LIST_FOREACH(l_detail, l_detail, l_detail_info) {
+ l = log_d->log_list;
+ EINA_LIST_FOREACH(l, l, l_info) {
+ if (l_detail_info->plog_id == l_info->id) {
+ find_info = elm_object_item_data_get(l_info->item);
+ break;
+ }
+ }
+ }
+
+ if (find_info) {
+ log_detail_free_log_data(logdetail_d->log_list);
+ logdetail_d->log_list = NULL;
+ if (logdetail_d->genlist)
+ elm_genlist_clear(logdetail_d->genlist);
+
+ l = eina_list_data_find_list(log_d->log_list, find_info);
+ EINA_LIST_FOREACH(l, l, l_info) {
+ ph_log_detail_info *l_detail_info = calloc(1, sizeof(ph_log_detail_info));
+ l_detail_info->plog_id = l_info->id;
+ l_detail_info->plog_type = l_info->plog_log_type;
+ l_detail_info->plog_time = l_info->plog_log_time;
+ l_detail_info->plog_duration = l_info->plog_duration;
+
+ if (NULL == pre_item) {
+ logdetail_d->log_list = eina_list_append(logdetail_d->log_list, (void*)l_detail_info);
+ pre_item = l_info->item;
+ }
+ else if (l_info->item == pre_item)
+ logdetail_d->log_list = eina_list_append(logdetail_d->log_list, (void*)l_detail_info);
+ else {
+ free(l_detail_info);
+ break;
+ }
+ }
+ logdetail_d->log_list_count = eina_list_count(logdetail_d->log_list);
+ log_detail_fill_genlist(logdetail_d);
+ }
+ else {
+ elm_naviframe_item_pop(logdetail_d->navi);
+ phone_log_missed_info_update(logdetail_d->navi);
+ }
+ }
+}
+
+Evas_Object *ph_create_log_detail_view(ph_log_data *log_d, ph_log_info *l_info)
+{
+ PH_FN_CALL;
+ Evas_Object *back_btn;
+ Evas_Object *layout;
+ Evas_Object *bg;
+ Evas_Object *genlist;
+ Elm_Object_Item *navi_it;
+ ph_log_detail_data *logdetail_d;
+ Eina_List *l;
+ Elm_Object_Item *pre_item = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_log_info *log_info;
+ Elm_Theme *th;
+ p_retvm_if(NULL == l_info, NULL, "Log information is null");
+
+ logdetail_d = calloc(1, sizeof(ph_log_detail_data));
+ p_retvm_if(NULL == logdetail_d, NULL, "Fail to calloc ph_log_detail_data");
+ logdetail_d->ug = log_d->ug;
+ logdetail_d->win = log_d->win;
+ logdetail_d->navi = log_d->navi;
+ logdetail_d->log_d = log_d;
+ logdetail_d->start_plog_id = l_info->id;
+
+ layout = elm_layout_add(logdetail_d->navi);
+ if (NULL == layout) {
+ ERR("elm_layout_add() return NULL");
+ free(logdetail_d);
+ return NULL;
+ }
+ elm_layout_theme_set(layout, "layout", "application", "noindicator");
+ logdetail_d->layout = layout;
+ elm_naviframe_prev_btn_auto_pushed_set(logdetail_d->navi, EINA_FALSE);
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, LOGDETAIL_THEME_EDJ);
+ logdetail_d->th = th;
+
+ genlist = log_detail_create_genlist(logdetail_d, layout);
+ if (NULL == genlist) {
+ ERR("log_detail_create_genlist() return NULL");
+ free(logdetail_d);
+ return NULL;
+ }
+ logdetail_d->genlist = genlist;
+ elm_object_part_content_set(logdetail_d->layout, "elm.swallow.content", genlist);
+
+ evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_DOWN, log_detail_gl_mousedown_cb, NULL);
+ evas_object_smart_callback_add(genlist, "selected", log_detail_gl_selected_cb, logdetail_d);
+ evas_object_smart_callback_add(genlist, "longpressed", log_detail_gl_longpressed_cb, logdetail_d);
+
+ logdetail_d->contact_id = l_info->plog_ct_id;
+ logdetail_d->log_number = SAFE_STRDUP(l_info->plog_number);
+ if (l_info->plog_img_path)
+ logdetail_d->log_img_path = strdup(l_info->plog_img_path);
+ if (l_info->plog_display && *l_info->plog_display)
+ logdetail_d->log_display = strdup(l_info->plog_display);
+ logdetail_d->log_num_type = l_info->plog_num_type;
+
+ l = eina_list_data_find_list(log_d->log_list, l_info);
+ EINA_LIST_FOREACH(l,l,log_info) {
+ ph_log_detail_info *l_detail_info = calloc(1, sizeof(ph_log_detail_info));
+ l_detail_info->plog_id = log_info->id;
+ l_detail_info->plog_type = log_info->plog_log_type;
+ l_detail_info->plog_time = log_info->plog_log_time;
+ l_detail_info->plog_duration = log_info->plog_duration;
+
+ if (NULL == pre_item) {
+ logdetail_d->log_list = eina_list_append(logdetail_d->log_list, (void*)l_detail_info);
+ pre_item = log_info->item;
+ }
+ else if (log_info->item == pre_item)
+ logdetail_d->log_list = eina_list_append(logdetail_d->log_list, (void*)l_detail_info);
+ else {
+ free(l_detail_info);
+ break;
+ }
+ }
+ logdetail_d->log_list_count = eina_list_count(logdetail_d->log_list);
+ log_detail_fill_genlist(logdetail_d);
+
+ evas_object_event_callback_add(logdetail_d->layout, EVAS_CALLBACK_DEL,
+ log_detail_view_delete_cb, logdetail_d);
+
+ err = contacts_db_add_changed_cb(_contacts_person._uri, log_detail_update_view_with_contact_cb, logdetail_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ navi_it = elm_naviframe_item_push(logdetail_d->navi, S_(PH_SYS_BODY_DETAILS), NULL, NULL, layout, NULL);
+ elm_naviframe_item_title_visible_set(navi_it, EINA_FALSE);
+ ph_log_detail_set_toolbar(logdetail_d);
+ evas_object_data_set(logdetail_d->navi, KEY_LOG_DETAIL_DATA, logdetail_d);
+
+ bg = phone_create_bg(logdetail_d->layout);
+ elm_object_style_set(bg, "group_list");
+
+ PH_FN_END;
+ return layout;
+}
+
diff --git a/lib/log/ph-log-detail-view.h b/lib/log/ph-log-detail-view.h
new file mode 100755
index 0000000..a6ce0df
--- /dev/null
+++ b/lib/log/ph-log-detail-view.h
@@ -0,0 +1,51 @@
+/*
+* 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 __PH_LOG_DETAIL_VIEW_H_
+#define __PH_LOG_DETAIL_VIEW_H_
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *genlist;
+ Evas_Object *popup;
+ Elm_Object_Item *top_item;
+ Elm_Object_Item *block_item;
+ char *log_display;
+ char *log_number;
+ char *log_img_path;
+ int contact_id; //in terms of contacts_service, this is "person_id"
+ int start_plog_id;
+ int log_num_type;
+ int log_list_count;
+ Eina_List *log_list;
+ Ecore_Idler *idler;
+ void *ug;
+ void *child_ug;
+ ph_log_data *log_d;
+ Elm_Theme *th;
+}ph_log_detail_data;
+
+Evas_Object *ph_create_log_detail_view(ph_log_data *log_d, ph_log_info *l_info);
+void ph_log_detail_get_block_info(ph_log_detail_data *logdetail_d);
+void ph_log_detail_update(ph_log_data *log_d);
+void ph_log_detail_set_toolbar(ph_log_detail_data *logdetail_d);
+
+
+#endif /* __PH_LOG_DETAIL_VIEW_H_ */
diff --git a/lib/log/ph-log-main-view.c b/lib/log/ph-log-main-view.c
new file mode 100755
index 0000000..f765bae
--- /dev/null
+++ b/lib/log/ph-log-main-view.c
@@ -0,0 +1,1833 @@
+/*
+* 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 <notification.h>
+#include <ui-gadget-module.h>
+#include "vconf-keys.h"
+#include "phone.h"
+#include "phone-log.h"
+#include "ph-log-utils.h"
+#include "ph-log-main-view.h"
+#include "ph-log-detail-view.h"
+#include "ph-log-check-view.h"
+#include "ct-detail.h"
+
+#define KEY_LOG_DATA "log_data"
+#define NO_CONTENTS_ICON_POSITION 0.35
+
+static Elm_Genlist_Item_Class itc, itc_one, itc_date, itc_viewby_list;
+
+enum {
+ PH_LIST_ALL_CALL_MESSAGE_LOG,
+ PH_LIST_MISSED_CALL_LOG,
+ PH_LIST_EMAIL_LOG,
+ PH_LIST_ALL_CALL_LOG,//more_popup
+ PH_LIST_DIALED_CALL_LOG,
+ PH_LIST_RECEIVED_CALL_LOG,
+ PH_LIST_REJECTED_CALL_LOG,
+ PH_LIST_ALL_MESSAGE_LOG,
+ PH_LIST_ALL_CALL_MESSAGE_EMAIL_LOG,
+}; //log type
+
+enum {
+ VIEWBY_POPUP_ALL_LOG = 0,
+ VIEWBY_POPUP_ALL_CALL_LOG = 1,
+ VIEWBY_POPUP_MISSED_CALL_LOG = 2,
+ VIEWBY_POPUP_DIALED_CALL_LOG = 3,
+ VIEWBY_POPUP_RECEIVED_CALL_LOG = 4,
+ VIEWBY_POPUP_REJECTED_CALL_LOG = 5,
+ VIEWBY_POPUP_ALL_MESSAGE_LOG = 6,
+}; //set the value with viewby index
+
+static void log_destroy_child_ug(void *data)
+{
+ ph_log_data *log_d = data;
+ log_d->child_ug = NULL;
+}
+
+static void log_gl_msg_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_data *log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ log_d->child_ug = phone_launch_msg_composer_ug(log_d->ug, data, 0,
+ log_destroy_child_ug, log_d);
+}
+
+// today: -1, yesterday : -2, previous : positive value
+static void log_append_separate_all_date_index(ph_log_data *log_d, void *data, int index)
+{
+ ph_log_info *l_info = data;
+ time_t stime;
+ struct timeval timeval;
+ struct tm *tmp;
+ int yday, cur_yday;
+
+ gettimeofday(&timeval, 0);
+ tmp = localtime(&timeval.tv_sec);
+ cur_yday = tmp->tm_yday;
+
+ stime = l_info->plog_log_time - l_info->plog_duration;
+ tmp = localtime(&stime);
+
+ yday = tmp->tm_yday;
+
+ if (yday == cur_yday)
+ l_info->group_index = -1;
+ else if (yday == (cur_yday-1))
+ l_info->group_index = -2;
+ else
+ l_info->group_index = yday;
+
+ if (yday+1 != log_d->pre_date_type) {
+ log_d->pre_date_type = yday+1;
+ log_d->git = elm_genlist_item_append(log_d->genlist, &itc_date,
+ data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_genlist_item_select_mode_set(log_d->git, ELM_OBJECT_SELECT_MODE_NONE);
+ }
+}
+
+static void __log_update_checked_item(ph_log_data *log_d, ph_log_info *l_selected_info)
+{
+
+ Eina_List *l;
+ ph_log_info *l_info;
+ Eina_Bool bChecked = l_selected_info->checked;
+
+ EINA_LIST_FOREACH(log_d->log_list, l, l_info) {
+ if (!l_info) continue;
+ if (l_info->group_base_id == l_selected_info->id)
+ {
+ l_info->checked = !bChecked;
+ //PH_DBG("called id : %d, %d", l_info->id, l_info->group_base_id);
+ }
+ }
+
+ if (l_selected_info->checked)
+ log_d->cnt_checked+=l_selected_info->grouped_count;
+ else
+ log_d->cnt_checked-=l_selected_info->grouped_count;
+
+}
+
+static void log_gl_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ service_h service;
+ char buf[16];
+ Elm_Object_Item *item = event_info;
+ ph_log_info *l_info = data;
+ ph_log_data *log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (elm_genlist_decorate_mode_get(log_d->genlist)) {
+ __log_update_checked_item(log_d, l_info);
+ elm_genlist_item_fields_update(event_info, "elm.edit.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT);
+ ph_log_check_update_select_all(log_d);
+ ph_log_check_update_selection_info(log_d);
+ ph_log_check_update_button_status(log_d);
+ return;
+ }
+
+ PH_DBG("view_type : %d", log_d->view_type);
+ switch (log_d->view_type) {
+ case LOG_VIEW_TYPE_UG_LAUNCH_CALL:
+ if (l_info->plog_number && *l_info->plog_number)
+ phone_launch_voice_call(l_info->plog_ct_id, l_info->plog_number);
+ break;
+ case LOG_VIEW_TYPE_UG_NUMBER_SELECT:
+ case LOG_VIEW_TYPE_UG_EMAIL_SELECT:
+ case LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_SELECT:
+ service_create(&service);
+ snprintf(buf, sizeof(buf), "%d", l_info->id);
+ service_add_extra_data(service, PH_UG_BUNDLE_RESULT_PLOG_ID, buf);
+ PH_DBG("plog_id : %d %s", l_info->id, buf);
+ ug_send_result(log_d->ug, service);
+ service_destroy(service);
+ ug_destroy_me(log_d->ug);
+ break;
+ case LOG_VIEW_TYPE_NORMAL:
+ ph_create_log_detail_view(log_d, l_info);
+ break;
+ default:
+ ERR("Invalid view type(%d)", log_d->view_type);
+ break;
+ }
+}
+
+#define N 20
+static bool log_compare_type(int type, int pre_type)
+{
+ switch (pre_type) {
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING:
+ case CONTACTS_PLOG_TYPE_MMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_SMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VOICE_OUTGOING:
+ case CONTACTS_PLOG_TYPE_VIDEO_OUTGOING:
+ case CONTACTS_PLOG_TYPE_MMS_OUTGOING:
+ case CONTACTS_PLOG_TYPE_SMS_OUTGOING:
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VIDEO_INCOMMING:
+ case CONTACTS_PLOG_TYPE_MMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_SMS_INCOMMING:
+ case CONTACTS_PLOG_TYPE_VOICE_OUTGOING:
+ case CONTACTS_PLOG_TYPE_VIDEO_OUTGOING:
+ case CONTACTS_PLOG_TYPE_MMS_OUTGOING:
+ case CONTACTS_PLOG_TYPE_SMS_OUTGOING:
+ return true;
+ default :
+ return false;
+ }
+ 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:
+ 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;
+ }
+ case CONTACTS_PLOG_TYPE_VOICE_REJECT:
+ case CONTACTS_PLOG_TYPE_VIDEO_REJECT:
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_REJECT:
+ case CONTACTS_PLOG_TYPE_VIDEO_REJECT:
+ return true;
+ default :
+ return false;
+ }
+ case CONTACTS_PLOG_TYPE_VOICE_BLOCKED:
+ case CONTACTS_PLOG_TYPE_VIDEO_BLOCKED:
+ case CONTACTS_PLOG_TYPE_SMS_BLOCKED:
+ switch (type) {
+ case CONTACTS_PLOG_TYPE_VOICE_BLOCKED:
+ case CONTACTS_PLOG_TYPE_VIDEO_BLOCKED:
+ case CONTACTS_PLOG_TYPE_SMS_BLOCKED:
+ return true;
+ default :
+ return false;
+ }
+ default:
+ return false;
+ }
+}
+
+static int log_fill_genlist_sub(ph_log_data * log_d, Eina_List *l, ph_log_info *pre_info)
+{
+ ph_log_info *l_info;
+ int count;
+ int cnt_append;
+ int pre_type;
+ int pre_date;
+ int pre_ct_id;
+ int last_group_base_id = 0;
+ bool diff;
+ char *pre_num;
+ Elm_Object_Item *item;
+ Elm_Object_Item *pre_item;
+
+ if (pre_info) {
+ pre_date = pre_info->group_index;
+ pre_ct_id = pre_info->plog_ct_id;
+ pre_type = pre_info->plog_log_type;
+ pre_item = pre_info->item;
+ pre_num = SAFE_STRDUP(pre_info->plog_number);
+ }
+ else {
+ pre_date = -3;
+ pre_ct_id = -1;
+ pre_type = CONTACTS_PLOG_TYPE_NONE;
+ pre_item = NULL;
+ pre_num = NULL;
+ }
+
+ cnt_append = 0;
+ count = 0;
+ EINA_LIST_FOREACH(l, l, l_info) {
+ if (N == cnt_append) break;
+ diff = false;
+ log_append_separate_all_date_index(log_d, l_info, cnt_append + log_d->readed_n);
+
+ if (l_info->group_index != pre_date)
+ diff = true;
+ else if (!log_compare_type(l_info->plog_log_type, pre_type))
+ diff = true;
+ else if (0 < l_info->plog_ct_id && 0 < pre_ct_id && l_info->plog_ct_id != pre_ct_id)
+ diff = true;
+ else if (l_info->plog_number && *l_info->plog_number) {
+ if (!pre_num)
+ diff = true;
+ else if (strcmp(l_info->plog_number, pre_num))
+ diff = true;
+ }
+
+ if (diff) {
+ if (pre_num)
+ free(pre_num);
+ if (l_info->plog_number && *l_info->plog_number) {
+ item = elm_genlist_item_append(log_d->genlist, &itc, l_info,
+ log_d->git, ELM_GENLIST_ITEM_NONE, log_gl_item_sel, l_info);
+ pre_num = strdup(l_info->plog_number);
+ }
+ else {
+ item = elm_genlist_item_append(log_d->genlist, &itc, l_info,
+ log_d->git, ELM_GENLIST_ITEM_NONE, log_gl_item_sel, l_info);
+ pre_num = NULL;
+ }
+ pre_date = l_info->group_index;
+ pre_type = l_info->plog_log_type;
+ pre_ct_id = l_info->plog_ct_id;
+ pre_item = item;
+ l_info->grouped_count = 1;
+ pre_info = l_info;
+ cnt_append++;
+ last_group_base_id = l_info->id;
+ }
+ else
+ pre_info->grouped_count++;
+
+ l_info->group_base_id = last_group_base_id;
+ l_info->item = pre_item;
+ count++;
+ }
+ return count;
+}
+
+static Eina_Bool log_append_item_part(void *data)
+{
+ int count;
+ Eina_List *l;
+ ph_log_info *l_info;
+ ph_log_data * log_d = data;
+
+ l = eina_list_nth_list(log_d->log_list, log_d->readed_n-1);
+ l_info = l->data;
+ count = log_fill_genlist_sub(log_d, l->next, l_info);
+ if (N <= count) {
+ log_d->readed_n += count;
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ log_d->list_idler = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+static void log_fill_genlist(ph_log_data * log_d)
+{
+ int count;
+
+ p_retm_if(NULL == log_d || NULL == log_d->genlist, "Genlist is null");
+
+ if (log_d->list_idler) {
+ ecore_idler_del(log_d->list_idler);
+ log_d->list_idler = NULL;
+ }
+
+ log_d->readed_n = 0;
+ count = log_fill_genlist_sub(log_d, log_d->log_list, NULL);
+
+ if (N <= count) {
+ log_d->readed_n += count;
+ log_d->list_idler = ecore_idler_add(log_append_item_part, log_d);
+ }
+}
+
+static void log_free_log_list(ph_log_data *log_d)
+{
+ ph_log_info *l_info;
+
+ if(log_d->log_list) {
+
+ EINA_LIST_FREE(log_d->log_list, l_info) {
+ if (NULL == l_info) continue;
+ free(l_info->plog_display);
+ free(l_info->plog_img_path);
+ free(l_info->plog_number);
+ free(l_info);
+ }
+ log_d->log_list = NULL;
+ }
+}
+
+static unsigned int get_cts_log_list(int type, contacts_list_h* pCts_list)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+ unsigned int record_cnt = 0;
+
+ int log_type_min, log_type_max;
+ err = contacts_query_create(_contacts_person_phone_log._uri, &query);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_query_create() Failed(%d)", err);
+
+ err = contacts_filter_create( _contacts_person_phone_log._uri, &filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_create() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ switch (type)
+ {
+ case PH_LIST_MISSED_CALL_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN;
+ log_type_max = CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN;
+ break;
+ case PH_LIST_EMAIL_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_EMAIL_RECEIVED;
+ log_type_max = CONTACTS_PLOG_TYPE_EMAIL_SENT;
+ break;
+ case PH_LIST_ALL_CALL_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_VOICE_INCOMMING;
+ log_type_max = CONTACTS_PLOG_TYPE_VIDEO_BLOCKED;
+ break;
+ case PH_LIST_DIALED_CALL_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_VOICE_OUTGOING;
+ log_type_max =CONTACTS_PLOG_TYPE_VIDEO_OUTGOING;
+ break;
+ case PH_LIST_RECEIVED_CALL_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_VOICE_INCOMMING;
+ log_type_max =CONTACTS_PLOG_TYPE_VIDEO_INCOMMING;
+ break;
+ case PH_LIST_REJECTED_CALL_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_VOICE_REJECT;
+ log_type_max = CONTACTS_PLOG_TYPE_VIDEO_REJECT;
+ break;
+ case PH_LIST_ALL_MESSAGE_LOG:
+ log_type_min = CONTACTS_PLOG_TYPE_MMS_INCOMMING;
+ log_type_max = CONTACTS_PLOG_TYPE_MMS_BLOCKED;
+ break;
+ case PH_LIST_ALL_CALL_MESSAGE_LOG:
+ default:
+ log_type_min = CONTACTS_PLOG_TYPE_VOICE_INCOMMING;
+ log_type_max = CONTACTS_PLOG_TYPE_MMS_BLOCKED;
+ break;
+ }
+
+ if(type == PH_LIST_DIALED_CALL_LOG || type == PH_LIST_RECEIVED_CALL_LOG)
+ {
+ err = contacts_filter_add_int(filter, _contacts_person_phone_log.log_type, CONTACTS_MATCH_EQUAL, log_type_min);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_bool() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ err = contacts_filter_add_int(filter, _contacts_person_phone_log.log_type, CONTACTS_MATCH_EQUAL, log_type_max);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+ }
+ else {
+ err = contacts_filter_add_int(filter, _contacts_person_phone_log.log_type, CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, log_type_min);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_bool() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ err = contacts_filter_add_int(filter, _contacts_person_phone_log.log_type, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, log_type_max);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+ }
+ err = contacts_query_set_filter(query, filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_query_set_filter() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ err = contacts_query_set_sort(query, _contacts_person_phone_log.log_time, false);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_query_set_filter() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ return NULL;
+ }
+
+ // if output param NULL, just count the records
+ if(pCts_list != NULL)
+ {
+ err = contacts_db_get_records_with_query(query, 0, 0, pCts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_records_with_query() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return NULL;
+ }
+ contacts_list_get_count(*pCts_list, &record_cnt );
+ }
+ else
+ {
+ contacts_db_get_count_with_query(query, &record_cnt);
+ }
+
+
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+
+ PH_DBG("get person_phonelog table records(type:%d, count:%d)", type, record_cnt);
+ return record_cnt;
+
+}
+
+static int log_load_data(int type, ph_log_data* log_d, bool include_unknown)
+{
+ PH_FN_CALL;
+ int count = 0;
+ int omit_count = 0;
+ contacts_list_h cts_list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ count = (int) get_cts_log_list(type, &cts_list);
+ while (CONTACTS_ERROR_NONE == err && count > 0) {
+ ph_log_info *l_info = NULL;
+ char *number;
+ err = phone_cts_get_str_from_list(cts_list, _contacts_person_phone_log.address, &number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+
+
+ if (false == include_unknown && (!number || !*number)) {
+ err = contacts_list_next(cts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ omit_count++;
+ continue;
+ }
+
+ l_info = calloc(1, sizeof(ph_log_info));
+ p_retvm_if(l_info == NULL, NULL, "ph_log_info calloc Failed.");
+
+ err = phone_cts_get_int_from_list(cts_list, _contacts_person_phone_log.log_id, &l_info->id);
+ err = phone_cts_get_int_from_list(cts_list, _contacts_person_phone_log.person_id, &l_info->plog_ct_id);
+ l_info->plog_number = SAFE_STRDUP(number);
+ err = phone_cts_get_int_from_list(cts_list, _contacts_person_phone_log.log_time, &l_info->plog_log_time);
+ err = phone_cts_get_int_from_list(cts_list, _contacts_person_phone_log.log_type, &l_info->plog_log_type);
+ err = phone_cts_get_int_from_list(cts_list, _contacts_person_phone_log.extra_data1, &l_info->plog_duration);
+ err = phone_cts_get_int_from_list(cts_list, _contacts_person_phone_log.address_type, &l_info->plog_num_type);
+
+ err = phone_cts_get_str_from_list(cts_list, _contacts_person_phone_log.display_name, &l_info->plog_display);
+ err = phone_cts_get_str_from_list(cts_list, _contacts_person_phone_log.image_thumbnail_path, &l_info->plog_img_path);
+
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_next() Failed(%d)", err);
+ log_d->log_list = eina_list_append(log_d->log_list, (void*)l_info);
+
+ err = contacts_list_next(cts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ contacts_list_destroy(cts_list, true);
+
+ return count;
+}
+static int log_get_log_list_type(int viewby_type)
+{
+ switch(viewby_type){
+ case VIEWBY_ALL_LOG :
+ return PH_LIST_ALL_CALL_MESSAGE_LOG;
+ case VIEWBY_ALL_CALL:
+ return PH_LIST_ALL_CALL_LOG;
+ case VIEWBY_MISSED_CALL:
+ return PH_LIST_MISSED_CALL_LOG;
+ case VIEWBY_DIALED_CALL:
+ return PH_LIST_DIALED_CALL_LOG;
+ case VIEWBY_RECEIVED_CALL:
+ return PH_LIST_RECEIVED_CALL_LOG;
+ case VIEWBY_REJECTED_CALL:
+ return PH_LIST_REJECTED_CALL_LOG;
+ case VIEWBY_ALL_MESSAGE:
+ return PH_LIST_ALL_MESSAGE_LOG;
+ default:
+ return PH_LIST_ALL_CALL_MESSAGE_LOG;
+ }
+}
+static void log_load_list(ph_log_data * log_d)
+{
+ int count;
+ p_retm_if(NULL == log_d, "Parameter is null");
+ log_free_log_list(log_d);
+
+ // need to reset all log count
+ log_d->all_log_list_count = -1;
+
+ switch(log_d->view_type)
+ {
+ case LOG_VIEW_TYPE_UG_EMAIL_SELECT:
+ case LOG_VIEW_TYPE_UG_EMAIL_CHECK:
+ log_d->log_list_count = log_load_data(PH_LIST_EMAIL_LOG, log_d, true);
+ break;
+ case LOG_VIEW_TYPE_NORMAL:
+ case LOG_VIEW_TYPE_UG_LAUNCH_CALL:
+ if(log_get_log_list_type(log_d->viewby_type) == PH_LIST_ALL_CALL_MESSAGE_LOG)
+ log_d->all_log_list_count = log_d->log_list_count = log_load_data(PH_LIST_ALL_CALL_MESSAGE_LOG, log_d, true);
+ else
+ log_d->log_list_count = log_load_data(log_get_log_list_type(log_d->viewby_type), log_d, true);
+ break;
+ case LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_CHECK:
+ case LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_SELECT:
+ log_d->log_list_count = log_load_data(PH_LIST_ALL_CALL_MESSAGE_EMAIL_LOG, log_d, true);
+ break;
+ case LOG_VIEW_TYPE_UG_NUMBER_CHECK:
+ case LOG_VIEW_TYPE_UG_NUMBER_SELECT:
+ default:
+ log_d->all_log_list_count = log_d->log_list_count = log_load_data(PH_LIST_ALL_CALL_MESSAGE_LOG, log_d, true);
+ break;
+ }
+
+ //all_log_count for dim
+ if(log_d->all_log_list_count == -1)
+ log_d->all_log_list_count = get_cts_log_list(PH_LIST_ALL_CALL_MESSAGE_LOG, NULL);
+ }
+
+static void log_update_db_result_cb(int err, void *user_data)
+{
+ p_warn_if(CONTACTS_ERROR_NONE != err, "log_update_db_result_cb() result : error(%d)", err);
+ p_retm_if(user_data == NULL, "log_update_db_result_cb() list handle is NULL.");
+ contacts_list_h cts_list = user_data;
+
+ err = contacts_list_destroy(cts_list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() result : error(%d)", err);
+
+ return;
+}
+Eina_Bool ph_log_set_log_as_seen(int index, int type)
+{
+ int logtype = 0;
+ contacts_record_h log_record = NULL;
+ contacts_list_h cts_list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_filter_h filter = NULL;
+ contacts_query_h query = NULL;
+ unsigned int record_cnt = 0;
+
+ p_retvm_if(CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN != type &&
+ CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN != type &&
+ CONTACTS_PLOG_TYPE_NONE != type,
+ false,
+ "The type is invalid. It must be CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN"
+ " or CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN or none");
+
+ if (0 == index) {
+ err = contacts_query_create(_contacts_phone_log._uri, &query);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_query_create() Failed(%d)", err);
+
+ err = contacts_filter_create(_contacts_phone_log._uri, &filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_create() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ if (CONTACTS_PLOG_TYPE_NONE == type)
+ {
+ err = contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_EQUAL, CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_bool() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_EQUAL, CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_query_set_filter(query, filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_query_set_filter() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_create() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_db_get_records_with_query(query, 0, 0, &cts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_records_with_query() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ contacts_list_get_count( cts_list, &record_cnt );
+ PH_DBG("get phonelogs table records(index: %d, log_type:%d, count:%d)",index, type, record_cnt);
+
+ while(CONTACTS_ERROR_NONE == err && record_cnt>0)
+ {
+ phone_cts_get_int_from_list( cts_list, _contacts_phone_log.log_type, &logtype);
+ err = contacts_list_get_current_record_p(cts_list, &log_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+ err = contacts_record_set_int( log_record, _contacts_phone_log.log_type, logtype+1);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_list_next(cts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ if (record_cnt>0)
+ {
+ err = contacts_db_update_records_async(cts_list, log_update_db_result_cb, cts_list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_records_async() Failed(%d)", err);
+ }
+ }
+ else
+ {
+ err = contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_EQUAL, type);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_filter_add_int() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_query_set_filter(query, filter);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_query_set_filter() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_create() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ err = contacts_db_get_records_with_query(query, 0, 0, &cts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_records_with_query() Failed(%d)", err);
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+ return false;
+ }
+
+ contacts_list_get_count( cts_list, &record_cnt );
+ PH_DBG("get phonelogs table records(index: %d, log_type:%d, count:%d)",index, type, record_cnt);
+
+ while(CONTACTS_ERROR_NONE == err && record_cnt>0)
+ {
+ err = contacts_list_get_current_record_p(cts_list, &log_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_get_current_record_p() Failed(%d)", err);
+ err = contacts_record_set_int( log_record, _contacts_phone_log.log_type, type+1);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_list_next(cts_list);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_list_next() Failed(%d)", err);
+ break;
+ }
+ }
+ if (record_cnt>0)
+ {
+ err = contacts_db_update_records_async(cts_list, log_update_db_result_cb, cts_list);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_records_async() Failed(%d)", err);
+ }
+ }
+ }
+ else {
+ PH_DBG("get phonelogs table record(index: %d, log_type:%d)",index, type);
+ err = contacts_db_get_record( _contacts_phone_log._uri, index, &log_record);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, false, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_int( log_record, _contacts_phone_log.log_type, &logtype );
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ err = contacts_record_set_int( log_record, _contacts_phone_log.log_type, logtype+1);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ err = contacts_db_update_record(log_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_update_record() Failed(%d)", err);
+ err = contacts_record_destroy(log_record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ return true;
+ }
+
+ err = contacts_query_destroy(query);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_query_destroy() Failed(%d)", err);
+ err = contacts_filter_destroy(filter);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_filter_destroy() Failed(%d)", err);
+
+ return true;
+}
+
+Eina_Bool ph_log_missed_call_count_reset(void *data)
+{
+ ph_log_data * log_d = data;
+
+ notification_delete_group_by_group_id(VOICECALL_PKG, 0, 1001);
+ notification_delete_group_by_group_id(VIDEOCALL_PKG, 0, 1001);
+
+ ph_log_set_log_as_seen(0, CONTACTS_PLOG_TYPE_NONE);
+
+ log_d->timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+API void phone_log_set_background(Evas_Object *obj, bool is_background)
+{
+ ph_log_data *log_d;
+ log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ p_retm_if(NULL == log_d, "log data is null");
+
+ log_d->is_background = is_background;
+ if (log_d->update_timer) {
+ ecore_timer_del(log_d->update_timer);
+ log_d->update_timer = NULL;
+ ph_log_data_changed_cb(log_d);
+ }
+}
+
+API void phone_log_missed_info_update(void *layout)
+{
+ ph_log_data *log_d;
+ log_d = evas_object_data_get(layout, KEY_LOG_DATA);
+ p_retm_if(NULL == log_d , "log data is null");
+
+ if(elm_naviframe_top_item_get(log_d->navi) == elm_naviframe_bottom_item_get(log_d->navi)) {
+ if (LOG_VIEW_TYPE_NORMAL == log_d->view_type) {
+ if (log_d->timer)
+ ecore_timer_del(log_d->timer);
+ log_d->timer = ecore_timer_add(1.0, ph_log_missed_call_count_reset, (void*)log_d);
+ }
+ }
+}
+
+static void log_delete_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_data * log_d = data;
+ phone_log_check_mode_start(log_d);
+}
+
+static void log_sweep_delete_reponse_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_log_info *l_info = data;
+ ph_log_data *log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ p_retm_if(NULL == log_d, "log data is NULL");
+ evas_object_del(log_d->popup);
+ log_d->popup = NULL;
+
+ err = ph_log_util_del_log_by_id(log_d->log_list, l_info);
+ if (CONTACTS_ERROR_NONE != err) {
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ }
+ else {
+ phone_show_tickernoti(S_(PH_SYS_POP_DELETED));
+ }
+}
+
+static void log_gl_sweep_del_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_info *l_info = data;
+ ph_log_data *log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ char buf[PH_TEXT_MAX_LEN] = {0};
+ Evas_Object *btn;
+ snprintf(buf, sizeof(buf), "%s?", S_(PH_SYS_SK_DELETE));
+ btn = phone_create_confirm_popup(&log_d->popup, log_d->win, buf, log_sweep_delete_reponse_cb, (void *)l_info);
+ evas_object_data_set(btn, KEY_LOG_DATA, log_d);
+}
+
+static void log_gl_sweep_right(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = data;
+ if (!event_info) return;
+ elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_TRUE);
+ elm_genlist_item_select_mode_set(log_d->item_last_sweep, ELM_OBJECT_SELECT_MODE_NONE);
+ log_d->item_last_sweep = event_info;
+}
+
+static void log_gl_sweep_left(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = data;
+ if (!event_info) return;
+ elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_FALSE);
+ elm_genlist_item_select_mode_set(event_info, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ log_d->item_last_sweep = NULL;
+}
+
+static void log_gl_sweep_up_down(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_data *log_d = data;
+ Elm_Object_Item *item;
+ if (!obj) return;
+ item = (Elm_Object_Item *)elm_genlist_decorated_item_get(obj);
+ if (item) {
+ elm_genlist_item_decorate_mode_set(item, "slide", EINA_FALSE);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ log_d->item_last_sweep = NULL;
+ }
+}
+
+static char* log_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PH_TEXT_MAX_LEN]={0};
+ ph_log_info *l_info = data;
+ if (0 == strcmp(part, "elm.text.1") || 0 == strcmp(part, "elm.slide.text.1")) {
+ if (NULL == l_info->plog_number || '\0' == l_info->plog_number[0]) {
+ snprintf(buf, sizeof(buf), "%s (%d)", S_(PH_SYS_BODY_UNKNOWN), l_info->grouped_count);
+ return strdup(buf);
+ }
+ else if (l_info->plog_display && *l_info->plog_display) {
+ if (1 < l_info->grouped_count)
+ snprintf(buf, sizeof(buf), "%s (%d)", l_info->plog_display, l_info->grouped_count);
+ else
+ snprintf(buf, sizeof(buf), "%s", l_info->plog_display);
+ }
+ else {
+ if (1 < l_info->grouped_count)
+ snprintf(buf, sizeof(buf), "%s (%d)", l_info->plog_number, l_info->grouped_count);
+ else
+ snprintf(buf, sizeof(buf), "%s", l_info->plog_number);
+ }
+ return strdup(buf);
+ }
+ else if ((strcmp(part, "elm.text.2") == 0)) {
+ ph_log_data * log_d;
+ char *time;
+ log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ time = ph_log_util_get_formatted_date(log_d->formatter, l_info->plog_log_time-l_info->plog_duration, PH_LOG_TIME_ONLY);
+ if (l_info->plog_display && *l_info->plog_display)
+ snprintf(buf, sizeof(buf), "%s %s", l_info->plog_number, time);
+ else
+ snprintf(buf, sizeof(buf), "%s", time);
+ free(time);
+ return strdup(buf);
+ }
+ else
+ return NULL;
+}
+
+static void log_gl_call_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_info * l_info = data;
+ p_retm_if(NULL == l_info, "parameter(l_info) is NULL");
+ p_retm_if(NULL == l_info->plog_number|| '\0' == *l_info->plog_number, "number is NULL");
+ phone_launch_voice_call(l_info->plog_ct_id, l_info->plog_number);
+}
+
+static void log_list_ctxpopup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_data *log_d = data;
+ evas_object_del(log_d->popup);
+ log_d->popup = NULL;
+}
+
+void ct_list_destroy_child_ug(void *data)
+{
+ ph_log_data *log_d = data;
+ log_d->child_ug = NULL;
+
+
+}
+
+
+
+static Evas_Object *log_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PATH_MAX];
+ ph_log_info * l_info = data;
+ ph_log_data * log_d;
+ Evas_Object *btn = NULL;
+
+ buf[0] = '\0';
+ log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+
+ if (0 == strcmp(part, "elm.icon.2")) {
+ char *icon_type = phone_detail_log_get_icon_type(l_info->plog_log_type);
+ Evas_Object *ic;
+ if (icon_type) {
+ snprintf(buf, sizeof(buf), "%s", icon_type);
+ free(icon_type);
+
+ ic = elm_icon_add(obj);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add is failed");
+ 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")) {
+ char *icon_path = phone_detail_log_get_icon_path_with_action(l_info->plog_log_type);
+ if (icon_path) {
+ Evas_Object *ic;
+ snprintf(buf, sizeof(buf), "%s", icon_path);
+ free(icon_path);
+
+ ic = elm_icon_add(obj);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add is failed");
+ 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.3")) {
+ Evas_Object *ic;
+ if (LOG_VIEW_TYPE_NORMAL != log_d->view_type && LOG_VIEW_TYPE_UG_LAUNCH_CALL != log_d->view_type)
+ return NULL;
+
+ if (NULL == l_info->plog_number || '\0' == l_info->plog_number[0])
+ return NULL;
+
+ btn = elm_button_add(obj);
+ ic = elm_icon_add(btn);
+ p_retvm_if(NULL == ic, NULL, "elm_icon_add is failed");
+ elm_icon_file_set(ic, PH_IMG_ICON_PHONE, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_object_part_content_set(btn, "icon", ic);
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "clicked", log_gl_call_btn_cb, l_info);
+ return btn;
+ }
+ else if (0 == strcmp(part, "elm.slide.swallow.1")) {
+ if (l_info->plog_number && *l_info->plog_number) {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_CALL);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn() return NULL");
+
+ evas_object_data_set(btn, KEY_LOG_DATA, log_d);
+ evas_object_smart_callback_add(btn, "clicked", log_gl_call_btn_cb, l_info);
+ return btn;
+ }
+ else {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_CALL_DIM);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn is failed");
+ evas_object_data_set(btn, KEY_LOG_DATA, log_d);
+ elm_object_disabled_set(btn, true);
+ return btn;
+
+ }
+ }
+ else if (0 == strcmp(part, "elm.slide.swallow.2")) {
+ if (l_info->plog_number && *l_info->plog_number) {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_MESSAGE);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn is failed");
+ evas_object_data_set(btn, KEY_LOG_DATA, log_d);
+ evas_object_smart_callback_add(btn, "clicked", log_gl_msg_btn_cb, l_info->plog_number);
+ return btn;
+ }
+ else {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_MESSAGE_DIM);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn is failed");
+ evas_object_data_set(btn, KEY_LOG_DATA, log_d);
+ elm_object_disabled_set(btn, true);
+ return btn;
+ }
+
+ }
+
+ else if (0 == strcmp(part, "elm.slide.swallow.3")) {
+ btn = phone_create_list_sweep_btn(obj, PH_IMG_ICON_DELETE);
+ p_retvm_if(NULL == btn, NULL, "phone_create_list_sweep_btn() return NULL");
+
+ evas_object_data_set(btn, KEY_LOG_DATA, log_d);
+ evas_object_smart_callback_add(btn, "clicked", log_gl_sweep_del_btn_cb, l_info);
+ return btn;
+ }
+
+ else if (0 == strcmp(part, "elm.edit.icon.1")) {
+ 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_info->checked);
+ evas_object_smart_callback_add(check, "changed", ph_log_check_check_changed_cb, log_d);
+ return check;
+ }
+ return NULL;
+}
+
+static const char *log_get_day_in_week(ph_log_info *l_info)
+{
+ time_t stime;
+ struct tm *tmp;
+
+ stime = l_info->plog_log_time - l_info->plog_duration;
+ tmp = localtime(&stime);
+
+ switch(tmp->tm_wday) {
+ case 0:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_SUNDAY);
+ case 1:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_MONDAY);
+ case 2:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_TUESDAY);
+ case 3:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_WEDNESDAY);
+ case 4:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_THURSDAY);
+ case 5:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_FRIDAY);
+ case 6:
+ return T_(PH_GET_TEXT_DAY, PHTEXT_BODY_SATURDAY);
+ }
+ return NULL;
+}
+
+static char* log_gl_sep_date_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ph_log_info *l_info = data;
+ const char *when;
+ int index = l_info->group_index;
+
+ if (0 == strcmp(part, "elm.text")) {
+ char *date_temp;
+ ph_log_data *log_d;
+
+ if (-1 == index)
+ when = S_(PH_SYS_BODY_TODAY);
+ else if (-2 == index)
+ when = S_(PH_SYS_BODY_YESTERDAY);
+ else
+ when = log_get_day_in_week(l_info);
+
+ log_d = evas_object_data_get(obj, KEY_LOG_DATA);
+ date_temp = phone_detail_log_get_date(log_d->formatter, l_info->plog_log_time-l_info->plog_duration);
+ 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 void log_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_log_data *log_d = data;
+ ph_log_check_mode_end(log_d, true);
+}
+
+static Evas_Object* log_create_genlist(ph_log_data * log_d)
+{
+ PH_FN_CALL;
+ Evas_Object *genlist = elm_genlist_add(log_d->box);
+ 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);
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+ evas_object_show(genlist);
+ evas_object_data_set(genlist, KEY_LOG_DATA, log_d);
+
+ if (!log_d->ug) {
+ evas_object_smart_callback_add(genlist, "drag,start,right", log_gl_sweep_right, log_d);
+ evas_object_smart_callback_add(genlist, "drag,start,left", log_gl_sweep_left, log_d);
+ evas_object_smart_callback_add(genlist, "drag,start,up", log_gl_sweep_up_down, log_d);
+ evas_object_smart_callback_add(genlist, "drag,start,down", log_gl_sweep_up_down, log_d);
+ }
+ elm_genlist_block_count_set(genlist, 10);
+ return genlist;
+}
+
+static Evas_Object* log_fill_layout(void *data)
+{
+ ph_log_data *log_d = data;
+ if (0 < log_d->log_list_count) {
+ if (NULL == log_d->genlist)
+ log_d->genlist = log_create_genlist(log_d);
+ else {
+ elm_genlist_clear(log_d->genlist);
+ log_d->pre_date_type = 0;
+ }
+ log_fill_genlist(log_d);
+ return log_d->genlist;
+ }
+ else {
+ Evas_Object *noc;
+ noc = phone_create_nocontents(log_d->box, T_(PH_GET_TEXT_BASIC, PHTEXT_NO_LOGS));
+
+ p_retvm_if(NULL == noc, NULL, "phone_create_nocontents() return NULL");
+ evas_object_size_hint_weight_set(noc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(noc, EVAS_HINT_FILL, NO_CONTENTS_ICON_POSITION);
+ evas_object_show(noc);
+
+ return noc;
+ }
+}
+
+Eina_Bool ph_log_data_changed_cb(void *data)
+{
+ PH_FN_CALL;
+ Evas_Object *content;
+ ph_log_data *log_d = data;
+
+ if (log_d->update_timer) {
+ ecore_timer_del(log_d->update_timer);
+ log_d->update_timer = NULL;
+ }
+
+ if (log_d->list_idler) {
+ ecore_idler_del(log_d->list_idler);
+ log_d->list_idler = NULL;
+ }
+ log_load_list(log_d);
+
+ elm_box_unpack(log_d->box, log_d->content);
+ evas_object_del(log_d->content);
+ log_d->content = NULL;
+ if (log_d->genlist) {
+ log_d->genlist = NULL;
+ log_d->pre_date_type = 0;
+ }
+
+ content = log_fill_layout(log_d);
+ p_retvm_if(NULL == content, ECORE_CALLBACK_CANCEL, "log_fill_layout() return NULL");
+ log_d->content = content;
+
+ elm_box_pack_end(log_d->box, content);
+ if (LOG_VIEW_TYPE_UG_NUMBER_CHECK == log_d->view_type
+ || LOG_VIEW_TYPE_NORMAL_CHECK == log_d->view_type
+ || LOG_VIEW_TYPE_UG_EMAIL_CHECK == log_d->view_type
+ || LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_CHECK == log_d->view_type)
+ phone_log_check_mode_start(log_d);
+ ph_log_check_update_button_status(log_d);
+ if (log_d->logdetail_update) {
+ ph_log_detail_update(log_d);
+ log_d->logdetail_update = false;
+ }
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void log_data_lazy_update(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = data;
+ if (log_d->update_timer) {
+ ecore_timer_del(log_d->update_timer);
+ log_d->update_timer = NULL;
+ }
+
+ if (log_d->is_background)
+ log_d->update_timer = ecore_timer_add(3.0, ph_log_data_changed_cb, log_d);
+ else
+ ph_log_data_changed_cb(log_d);
+
+ PH_FN_END;
+}
+
+static void log_data_updated(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = data;
+ log_d->logdetail_update = true;
+ if (log_d->p_info == NULL)
+ log_data_lazy_update(_contacts_phone_log._uri, log_d);
+}
+
+static void log_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = data;
+ p_retm_if(NULL == log_d, "log_d is null");
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_db_remove_changed_cb(_contacts_person._uri, log_data_lazy_update, log_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ err = contacts_db_remove_changed_cb(_contacts_phone_log._uri, log_data_updated, log_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, ph_log_timezone_changed);
+ evas_object_data_del(log_d->navi, KEY_LOG_DATA);
+
+ log_free_log_list(log_d);
+
+ if (log_d->list_idler)
+ ecore_idler_del(log_d->list_idler);
+
+ if (log_d->popup)
+ evas_object_del(log_d->popup);
+
+ if (log_d->p_info) {
+ log_d->p_info->alive = false;
+ pthread_join(log_d->p_info->thread, NULL);
+ ecore_timer_del(log_d->p_info->timer);
+ free(log_d->p_info);
+ }
+
+ if (log_d->timer)
+ ecore_timer_del(log_d->timer);
+
+ if (log_d->update_timer)
+ ecore_timer_del(log_d->update_timer);
+
+ phone_detail_log_delete_date_format(log_d->formatter);
+
+ free(log_d);
+ PH_FN_END;
+}
+static Evas_Object* viewby_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *radio;
+ viewby_list_item *popup_i = (viewby_list_item*)data;
+ Evas_Object *radio_main = NULL;
+
+ if (!strcmp(part, "elm.icon"))
+ {
+ radio = elm_radio_add(obj);
+ p_retvm_if(NULL == radio, NULL, "elm_radio_add() return NULL");
+
+ if (0 == popup_i->index) {
+ 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, popup_i->index);
+ if (radio_main && popup_i->state_index == popup_i->index)
+ elm_radio_value_set(radio_main, popup_i->state_index);
+
+ 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_TRUE);
+
+ return radio;
+
+ }
+
+ return NULL;
+
+}
+
+
+static char *viewby_gl_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ viewby_list_item *popup_i = (viewby_list_item*)data;
+
+ if (!strcmp(part, "elm.text"))
+ {
+ switch(popup_i->index) {
+ case VIEWBY_POPUP_ALL_LOG:
+ return strdup("All logs");
+ break;
+ case VIEWBY_POPUP_ALL_CALL_LOG:
+ return strdup("All calls");
+ break;
+ case VIEWBY_POPUP_MISSED_CALL_LOG:
+ return strdup("Missed calls");
+ break;
+ case VIEWBY_POPUP_DIALED_CALL_LOG:
+ return strdup("Dialed calls");
+ break;
+ case VIEWBY_POPUP_RECEIVED_CALL_LOG:
+ return strdup("Received calls");
+ break;
+ case VIEWBY_POPUP_REJECTED_CALL_LOG:
+ return strdup("Rejected calls");
+ break;
+ case VIEWBY_POPUP_ALL_MESSAGE_LOG:
+ return strdup("All messages");
+ break;
+ default:
+ return strdup("Error");
+ break;
+ }
+ }
+ else
+ return NULL;
+}
+
+static Eina_Bool viewby_gl_state_get(void *data, Evas_Object *obj, const char *part)
+{
+ return EINA_FALSE;
+}
+
+static void viewby_gl_del(void *data, Evas_Object *obj)
+{
+ return;
+}
+
+static void viewby_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+
+ viewby_list_item *popup_i;
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ ph_log_data *log_d = data;
+ Evas_Object * delete_button = NULL;
+ p_retm_if(NULL == log_d, "log_d is NULL");
+ p_retm_if(NULL == item, "item is null");
+
+ popup_i = (viewby_list_item *) elm_object_item_data_get(item);
+ popup_i->state_index = popup_i->index;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ elm_genlist_item_update(item);
+
+ switch(popup_i->index)
+ {
+ case VIEWBY_POPUP_ALL_LOG:
+ log_d->viewby_type = VIEWBY_ALL_LOG;
+ break;
+ case VIEWBY_POPUP_ALL_CALL_LOG:
+ log_d->viewby_type = VIEWBY_ALL_CALL;
+ break;
+ case VIEWBY_POPUP_MISSED_CALL_LOG:
+ log_d->viewby_type = VIEWBY_MISSED_CALL;
+ break;
+ case VIEWBY_POPUP_DIALED_CALL_LOG:
+ log_d->viewby_type = VIEWBY_DIALED_CALL;
+ break;
+ case VIEWBY_POPUP_RECEIVED_CALL_LOG:
+ log_d->viewby_type = VIEWBY_RECEIVED_CALL;
+ break;
+ case VIEWBY_POPUP_REJECTED_CALL_LOG:
+ log_d->viewby_type = VIEWBY_REJECTED_CALL;
+ break;
+ case VIEWBY_POPUP_ALL_MESSAGE_LOG:
+ log_d->viewby_type = VIEWBY_ALL_MESSAGE;
+ break;
+ default:
+ log_d->viewby_type = VIEWBY_ALL_LOG;
+ }
+
+ log_load_list(log_d);
+
+ log_list_ctxpopup_hide_cb(log_d, NULL, NULL);
+
+ delete_button = elm_object_item_part_content_get(log_d->navi_item, "toolbar_button1");
+ if(0 == log_d->log_list_count)
+ {
+ elm_object_disabled_set(delete_button, EINA_TRUE);
+ }
+ else
+ {
+ elm_object_disabled_set(delete_button, EINA_FALSE);
+ }
+
+}
+
+static void log_set_genlist_item_style()
+{
+ itc.item_style = "2text.2icon";
+ itc.decorate_item_style= "mode/slide3";
+ itc.decorate_all_item_style = "edit_default";
+ itc.func.text_get = log_gl_label_get;
+ itc.func.content_get = log_gl_icon_get;
+ itc.func.state_get = NULL;
+
+ itc_one.item_style = "2text.2icon";
+ itc_one.decorate_item_style = "mode/slide";
+ itc_one.decorate_all_item_style = "edit_default";
+ itc_one.func.text_get = log_gl_label_get;
+ itc_one.func.content_get = log_gl_icon_get;
+ itc_one.func.state_get = NULL;
+
+ itc_date.item_style ="grouptitle";
+ itc_date.func.text_get = log_gl_sep_date_label_get;
+
+ itc_viewby_list.item_style = "1text.1icon.2";
+ itc_viewby_list.func.text_get = viewby_gl_text_get;
+ itc_viewby_list.func.content_get = viewby_gl_icon_get;
+ itc_viewby_list.func.state_get = viewby_gl_state_get;
+ itc_viewby_list.func.del = viewby_gl_del;
+}
+
+static void log_genlist_update(Evas_Object *genlist)
+{
+ PH_FN_CALL;
+ Elm_Object_Item *item;
+ p_retm_if(NULL == genlist, "Genlist is null");
+
+ item = elm_genlist_first_item_get(genlist);
+ while (item) {
+ elm_genlist_item_update(item);
+ item = elm_genlist_item_next_get(item);
+ }
+}
+
+API void phone_log_views_update(Evas_Object *navi)
+{
+ ph_log_data *log_d;
+ ph_log_detail_data *logdetail_d;
+
+ log_d = evas_object_data_get(navi, KEY_LOG_DATA);
+ if (log_d) {
+ phone_detail_log_generate_date_format(log_d->formatter);
+ log_genlist_update(log_d->genlist);
+ }
+
+ logdetail_d = evas_object_data_get(navi, "logdetail_d");
+ if (logdetail_d)
+ log_genlist_update(logdetail_d->genlist);
+}
+
+void ph_log_timezone_changed(keynode_t* key, void *data)
+{
+ PH_FN_CALL;
+ phone_log_views_update(data);
+}
+
+API void phone_log_view_resume(Evas_Object *navi)
+{
+ PH_FN_CALL;
+ ph_log_detail_data *logdetail_d;
+
+ phone_log_missed_info_update(navi);
+
+}
+
+API void phone_log_view_reset(Evas_Object *navi)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d;
+ Elm_Object_Item *item;
+
+ log_d = evas_object_data_get(navi, KEY_LOG_DATA);
+ p_retm_if(NULL == log_d, "log_d is null");
+
+ if (log_d->child_ug) {
+ ug_destroy(log_d->child_ug);
+ log_d->child_ug = NULL;
+ }
+
+ item = elm_naviframe_bottom_item_get(log_d->navi);
+ if (elm_naviframe_top_item_get(log_d->navi) != item)
+ elm_naviframe_item_pop_to(item);
+ else if (LOG_VIEW_TYPE_NORMAL_CHECK == log_d->view_type)
+ ph_log_check_mode_end(log_d, false);
+ else if (log_d->item_last_sweep) {
+ elm_genlist_item_decorate_mode_set(log_d->item_last_sweep, "slide", EINA_FALSE);
+ elm_genlist_item_select_mode_set(log_d->item_last_sweep, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ log_d->item_last_sweep = NULL;
+ }
+ log_d->ctrl_item = NULL;
+}
+
+API void phone_viewby_type_set(Evas_Object *layout, int viewby_type)
+{
+ ph_log_data *log_d;
+ log_d = evas_object_data_get(layout, KEY_LOG_DATA);
+ p_retm_if(NULL == log_d, "log data is NULL");
+ log_d->viewby_type = viewby_type;
+}
+
+static void viewby_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ ph_log_data *log_d = data;
+ int i;
+ viewby_list_item *popup_i;
+ Elm_Object_Item *item;
+
+ if(log_d->popup)
+ log_list_ctxpopup_hide_cb(log_d, NULL, NULL);
+
+ popup = elm_popup_add(log_d->navi);
+ log_d->popup = popup;
+ elm_object_style_set(popup, "menustyle");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW));
+ genlist = elm_genlist_add(popup);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ Evas_Object *cancel_btn = elm_button_add(popup);
+ elm_object_style_set(cancel_btn, "popup_button/default");
+ elm_object_text_set(cancel_btn, S_(PH_SYS_SK_CANCEL));
+ elm_object_part_content_set(popup, "button1", cancel_btn);
+ evas_object_smart_callback_add(cancel_btn, "clicked", log_list_ctxpopup_hide_cb, log_d);
+
+ for(i = 0; i < VIEWBY_MAX; i++)
+ {
+ popup_i = (viewby_list_item*)calloc(1, sizeof(viewby_list_item));
+ popup_i->index = i;
+ popup_i->state_index = log_d->viewby_type;
+ item = elm_genlist_item_append(genlist, &itc_viewby_list, (void *)popup_i, NULL, ELM_GENLIST_ITEM_NONE, viewby_gl_sel, log_d);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ }
+
+ elm_object_content_set(popup, genlist);
+ evas_object_show(popup);
+}
+
+static void more_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = data;
+ Evas_Object *popup = NULL;
+ Elm_Object_Item* popup_item;
+
+ log_list_ctxpopup_hide_cb(log_d, NULL, NULL);
+
+ popup = elm_ctxpopup_add(log_d->navi);
+ p_retm_if(NULL == popup, "elm_ctxpopup_add() return NULL");
+
+ popup_item = elm_ctxpopup_item_append(popup, T_(CT_GET_TEXT_BASIC, CTTEXT_VIEW), NULL, viewby_clicked_cb, log_d);
+
+ if(log_d->all_log_list_count == 0)
+ {
+ elm_object_item_disabled_set (popup_item, true);
+ }
+
+ elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+
+ evas_object_smart_callback_add(popup, "dismissed", log_list_ctxpopup_hide_cb, log_d);
+
+ int x, y, w, h;
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+ evas_object_move(popup, x+(w/2), y+(h/2));
+ evas_object_show(popup);
+
+ log_d->popup = popup;
+
+}
+
+API void phone_log_set_navi(Evas_Object *layout)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d;
+ Evas_Object *back_btn;
+ Elm_Object_Item *navi_it;
+ Evas_Object * more_button = NULL;
+
+ log_d = evas_object_data_get(layout, KEY_LOG_DATA);
+ p_retm_if(NULL == log_d, "log data is NULL");
+
+ navi_it = elm_naviframe_bottom_item_get(log_d->navi);
+ p_retm_if(NULL == navi_it, "navi item is NULL");
+
+ if(log_d->navi_item){
+ phone_navi_item_clear(log_d->navi_item);
+ }
+
+ back_btn = elm_button_add(log_d->navi);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ elm_object_item_part_content_set(log_d->navi_item, "prev_btn", back_btn);
+
+ switch (log_d->view_type) {
+ case LOG_VIEW_TYPE_NORMAL:
+ case LOG_VIEW_TYPE_UG_LAUNCH_CALL:
+
+//more button
+ more_button = ctui_create_more_btn(log_d->navi, more_btn_clicked_cb, log_d);
+ elm_object_item_part_content_set(log_d->navi_item, "toolbar_more_btn", more_button);
+
+//delete button
+ if (log_d->view_type == LOG_VIEW_TYPE_NORMAL)
+ {
+ Evas_Object * delete_button = NULL;
+
+ delete_button = phone_create_toolbar_btn(log_d->navi, S_(PH_SYS_SK_DELETE), log_delete_btn_cb, log_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", delete_button);
+
+ if(0 == log_d->log_list_count) {
+ elm_object_disabled_set(delete_button, EINA_TRUE);
+ }
+ else {
+ elm_object_disabled_set(delete_button, EINA_FALSE);
+ }
+ }
+
+//back button
+ evas_object_smart_callback_add(back_btn, "clicked", phone_back_btn_clicked_cb, log_d->win);
+
+ break;
+ case LOG_VIEW_TYPE_NORMAL_CHECK:
+ {
+ log_d->ctrl_item = phone_create_toolbar_btn(log_d->navi, S_(PH_SYS_SK_DELETE), ph_log_check_del_btn_cb, log_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", log_d->ctrl_item);
+
+ if(0 == log_d->cnt_checked) {
+ elm_object_disabled_set(log_d->ctrl_item, EINA_TRUE);
+ }
+ else {
+ elm_object_disabled_set(log_d->ctrl_item, EINA_FALSE);
+ }
+
+ evas_object_smart_callback_add(back_btn, "clicked", log_cancel_clicked_cb, log_d);
+ }
+ break;
+
+ case LOG_VIEW_TYPE_UG_NUMBER_CHECK:
+ case LOG_VIEW_TYPE_UG_EMAIL_CHECK:
+ case LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_CHECK:
+ {
+ Evas_Object * done_btn = NULL;
+ log_d->ctrl_item = phone_create_toolbar_btn(log_d->navi, S_(CT_SYS_SK_DONE), ph_log_check_done_btn_cb, log_d);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", log_d->ctrl_item);
+
+ }
+ break;
+ case LOG_VIEW_TYPE_UG_NUMBER_SELECT:
+ case LOG_VIEW_TYPE_UG_EMAIL_SELECT:
+ case LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_SELECT:
+ default:
+ break;
+ }
+
+ if (log_d->ug)
+ evas_object_smart_callback_add(back_btn, "clicked", phone_ug_destroy_me_cb, log_d->ug);
+
+
+ if(log_d->ctrl_item)
+ ph_log_check_update_button_status(log_d);
+}
+
+int ph_log_create_content(ph_log_data *log_d)
+{
+ PH_FN_CALL;
+ int ret;
+ Evas_Object *box;
+ Evas_Object *content;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ log_d->layout = elm_layout_add(log_d->navi);
+ p_retvm_if(NULL == log_d->layout, -1, "elm_layout_add() return NULL");
+ elm_layout_file_set(log_d->layout, SELECTION_INFO_EDJ, "selectioninfo_layout");
+ box = elm_box_add(log_d->layout);
+ elm_object_part_content_set(log_d->layout, "contents", box);
+ p_retvm_if(NULL == box, -1, "elm_box_add() return NULL");
+ log_d->box = box;
+
+ log_set_genlist_item_style();
+ log_load_list(log_d);
+ content = log_fill_layout(log_d);
+ p_retvm_if(NULL == content, -1, "log_fill_layout() return NULL");
+ elm_box_pack_end(box, content);
+ log_d->content = content;
+
+ evas_object_event_callback_add(box, EVAS_CALLBACK_DEL,
+ log_view_delete_cb, log_d);
+
+ err = contacts_db_add_changed_cb(_contacts_person._uri, log_data_lazy_update, log_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+ err = contacts_db_add_changed_cb(_contacts_phone_log._uri, log_data_updated, log_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ evas_object_data_set(log_d->navi, KEY_LOG_DATA, log_d);
+
+ vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, ph_log_timezone_changed, log_d->navi);
+
+ return 0;
+}
+
+API void phone_log_view_language_changed(Evas_Object *navi)
+{
+ // TODO: Fixme
+}
+
diff --git a/lib/log/ph-log-main-view.h b/lib/log/ph-log-main-view.h
new file mode 100755
index 0000000..18b83cc
--- /dev/null
+++ b/lib/log/ph-log-main-view.h
@@ -0,0 +1,28 @@
+/*
+* 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 __PH_LOG_MAIN_VIEW_H__
+#define __PH_LOG_MAIN_VIEW_H__
+
+#include "vconf.h"
+
+int ph_log_create_content(ph_log_data *log_d);
+Eina_Bool ph_log_missed_call_count_reset(void *data);
+void ph_log_timezone_changed(keynode_t *key, void *data);
+Eina_Bool ph_log_data_changed_cb(void *data);
+
+#endif /* __PH_LOG_MAIN_VIEW_H__ */
diff --git a/lib/log/ph-log-main.c b/lib/log/ph-log-main.c
new file mode 100755
index 0000000..c600354
--- /dev/null
+++ b/lib/log/ph-log-main.c
@@ -0,0 +1,300 @@
+/*
+* 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-log.h"
+#include "ph-log-utils.h"
+#include "ph-log-main-view.h"
+#include "ph-log-check-view.h"
+#include "ph-log-detail-view.h"
+#include <bundle.h>
+
+// for removing build warning ////////////////////////////////////
+int service_export_as_bundle(service_h service, bundle **data);
+////////////////////////////////////////////////////////
+
+static bool log_create_ug_view(int request, ph_log_data *log_d, Evas_Object *base)
+{
+ PH_FN_CALL;
+ int ret;
+ p_retvm_if(NULL == log_d, false, "Parameter is null");
+
+ if (NULL == log_d->navi) {
+ log_d->navi = elm_naviframe_add(base);
+ p_retvm_if(NULL == log_d->navi, false, "elm_naviframe_add is failed");
+ elm_object_part_content_set(base, "elm.swallow.content", log_d->navi);
+ evas_object_show(log_d->navi);
+ }
+
+ if (PH_UG_REQUEST_LOG_SELECT == request)
+ log_d->view_type = LOG_VIEW_TYPE_UG_NUMBER_SELECT;
+ else if (PH_UG_REQUEST_LOG_CHECK == request)
+ log_d->view_type = LOG_VIEW_TYPE_UG_NUMBER_CHECK;
+ else
+ log_d->view_type = LOG_VIEW_TYPE_UG_LAUNCH_CALL;
+
+ ret = ph_log_create_content(log_d);
+ if (ret < 0) {
+ ERR("Fail to ph_log_create_content");
+ return false;
+ }
+ log_d->navi_item = elm_naviframe_item_push(log_d->navi, T_(PH_GET_TEXT_BASE_OP, PHTEXT_SELECT_LOGS),
+ NULL, NULL, log_d->box, NULL);
+
+ if (LOG_VIEW_TYPE_UG_NUMBER_CHECK == log_d->view_type)
+ phone_log_check_mode_start(log_d);
+ else
+ phone_log_set_navi(log_d->navi);
+
+ return true;
+}
+
+static void *log_on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ int ret;
+ Evas_Object *bg;
+ Evas_Object *parent;
+ Evas_Object *base;
+ ph_log_data *log_d;
+ int request = PH_UG_REQUEST_LOG_CHECK;
+ char* val = NULL;
+
+ if (!ug || !priv)
+ return NULL;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ parent = ug_get_parent_layout(ug);
+ if (!parent)
+ return NULL;
+
+ ret = contacts_connect2();
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, NULL, "contacts_connect2() Failed(%d)", ret);
+
+ if (SERVICE_ERROR_NONE == service_get_extra_data (service, "type", &val)) {
+ if (val)
+ request = atoi(val);
+ PH_DBG("log request : %d", request);
+ free(val);
+ }
+
+ if (mode==UG_MODE_FULLVIEW)
+ base = phone_create_base_layout(parent, true);
+ else
+ base = phone_create_base_layout(parent, false);
+
+ log_d = priv;
+ log_d->win = ug_get_window();
+ log_d->ug = ug;
+
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ PH_DBG("phone_create_bg() return NULL");
+ evas_object_del(base);
+ ret = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_disconnect2() Failed(%d)", ret);
+ return NULL;
+ }
+
+ phone_detail_log_init_time_format();
+ phone_detail_log_generate_date_format(log_d->formatter);
+
+ if (!log_create_ug_view(request, log_d, base)) {
+ phone_detail_log_delete_date_format(log_d->formatter);
+ evas_object_del(base);
+ ret = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != ret, "contacts_disconnect2() Failed(%d)", ret);
+ return NULL;
+ }
+
+ return base;
+}
+
+static void log_on_start(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+static void log_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = priv;
+ log_d->is_background = true;
+
+}
+
+static void log_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ ph_log_data *log_d = priv;
+
+ log_d->is_background = false;
+ if (log_d->update_timer) {
+ ecore_timer_del(log_d->update_timer);
+ log_d->update_timer = NULL;
+ ph_log_data_changed_cb(log_d);
+ }
+}
+
+static void log_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+
+ if (!ug)
+ return;
+
+ evas_object_del(ug_get_layout(ug));
+ contacts_disconnect2();
+ PH_FN_END;
+}
+
+static void log_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+static void log_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ ph_log_data *log_d = priv;
+
+ switch (event) {
+ case UG_EVENT_REGION_CHANGE:
+ if (log_d->navi)
+ phone_log_views_update(log_d->navi);
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ phone_log_view_language_changed(log_d->navi);
+ break;
+ default:
+ break;
+ }
+}
+
+static void log_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ if (!ug)
+ return;
+
+ switch (event) {
+ case UG_KEY_EVENT_END:
+ ug_destroy_me(ug);
+ break;
+ default:
+ break;
+ }
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ph_log_data *log_d;
+
+ if (!ops)
+ return -1;
+
+ log_d = calloc(1, sizeof(ph_log_data));
+ p_retvm_if(NULL == log_d, -1, "calloc is failed");
+
+ ops->create = log_on_create;
+ ops->start = log_on_start;
+ ops->pause = log_on_pause;
+ ops->resume = log_on_resume;
+ ops->destroy = log_on_destroy;
+ ops->message = log_on_message;
+ ops->event = log_on_event;
+ ops->key_event = log_on_key_event;
+ ops->priv = log_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;
+
+ ops->priv = NULL;
+ PH_FN_END;
+}
+
+API Evas_Object* phone_create_log_view(ph_view_info *view_info)
+{
+ PH_FN_CALL;
+ int ret;
+ ph_log_data * log_d = calloc(1, sizeof(ph_log_data));
+ p_retvm_if(NULL == log_d, NULL, "Fail to calloc ph_log_data");
+ memset(log_d, 0x00, sizeof(ph_log_data));
+
+ log_d->ug = view_info->ug;
+ log_d->win = view_info->win;
+ log_d->navi = view_info->navi;
+ log_d->navi_item = elm_naviframe_bottom_item_get(log_d->navi);
+ log_d->is_background = true;
+
+ if(!log_d->ug)
+ {
+ log_d->view_type = LOG_VIEW_TYPE_NORMAL;
+ log_d->viewby_type = VIEWBY_ALL_LOG;
+ }
+ else
+ {
+ switch(view_info->ug_request)
+ {
+ case PH_UG_REQUEST_SELECT:
+ case PH_UG_REQUEST_SELECT_NUMBER:
+ log_d->view_type = LOG_VIEW_TYPE_UG_NUMBER_SELECT;
+ break;
+ case PH_UG_REQUEST_SELECT_EMAIL:
+ log_d->view_type = LOG_VIEW_TYPE_UG_EMAIL_SELECT;
+ break;
+ case PH_UG_REQUEST_CHECK:
+ case PH_UG_REQUEST_CHECK_FOR_NUMBER:
+ log_d->view_type = LOG_VIEW_TYPE_UG_NUMBER_CHECK;
+ break;
+ case PH_UG_REQUEST_CHECK_FOR_EMAIL:
+ log_d->view_type = LOG_VIEW_TYPE_UG_EMAIL_CHECK;
+ break;
+ case PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL:
+ log_d->view_type = LOG_VIEW_TYPE_UG_NUMBER_OR_EMAIL_CHECK;
+ break;
+ default:
+ log_d->view_type = LOG_VIEW_TYPE_UG_LAUNCH_CALL;
+ break;
+ }
+ }
+
+ phone_detail_log_init_time_format();
+ phone_detail_log_generate_date_format(log_d->formatter);
+
+ ret = ph_log_create_content(log_d);
+ if (ret < 0) {
+ free(log_d);
+ return NULL;
+ }
+
+ return log_d->layout;
+}
+
diff --git a/lib/log/ph-log-utils.c b/lib/log/ph-log-utils.c
new file mode 100755
index 0000000..4f2df16
--- /dev/null
+++ b/lib/log/ph-log-utils.c
@@ -0,0 +1,54 @@
+/*
+* 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 "ph-log-utils.h"
+#include <feedback.h>
+
+#include <vconf.h>
+#include <vconf-keys.h>
+
+contacts_error_e ph_log_util_del_log_by_id(Eina_List *list, ph_log_info *l_info)
+{
+ PH_FN_CALL;
+ Eina_List *l;
+ Elm_Object_Item *item;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ l = eina_list_data_find_list(list, l_info);
+ item = l_info->item;
+ EINA_LIST_FOREACH(l, l, l_info) {
+ if (item != l_info->item)
+ break;
+ err = contacts_db_delete_record( _contacts_phone_log._uri, l_info->id);
+ if (CONTACTS_ERROR_NONE != err)
+ break;
+ }
+ return err;
+}
+
+void ph_log_util_svi_play(int vibration_key, int sound_key)
+{
+ int effect_status = FALSE;
+ vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &effect_status);
+ if (effect_status)
+ feedback_play_type(FEEDBACK_TYPE_SOUND, sound_key);
+
+ vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &effect_status);
+ if (effect_status)
+ feedback_play_type(FEEDBACK_TYPE_VIBRATION, vibration_key);
+} \ No newline at end of file
diff --git a/lib/log/ph-log-utils.h b/lib/log/ph-log-utils.h
new file mode 100755
index 0000000..91fe8a6
--- /dev/null
+++ b/lib/log/ph-log-utils.h
@@ -0,0 +1,25 @@
+/*
+* 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 __PH_LOG_UTILS_H__
+#define __PH_LOG_UTILS_H__
+
+#include "phone-common.h"
+contacts_error_e ph_log_util_del_log_by_id(Eina_List *list, ph_log_info *l_info);
+void ph_log_util_svi_play(int vibration_key, int sound_key);
+
+#endif /* __PH_LOG_UTILS_H__ */
diff --git a/lib/ph-front/CMakeLists.txt b/lib/ph-front/CMakeLists.txt
new file mode 100755
index 0000000..bfe93d6
--- /dev/null
+++ b/lib/ph-front/CMakeLists.txt
@@ -0,0 +1,14 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${PH_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} ${SPEEDDIAL} ${PH_LOG} ${PH_DIALER} ${CT_DETAILS} ${CT_LIST})
+
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/ph-front/phone-tabui-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/ph-front/include/ph-front.h b/lib/ph-front/include/ph-front.h
new file mode 100755
index 0000000..9068bfb
--- /dev/null
+++ b/lib/ph-front/include/ph-front.h
@@ -0,0 +1,74 @@
+/*
+* 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 __PH_FRONT_H__
+#define __PH_FRONT_H__
+
+#include <app.h>
+#include <phone-common.h>
+
+enum {
+ PH_FRONT_DIALER_WITH_NUM,
+ PH_FRONT_LOG_MISSED,
+ PH_FRONT_DIALER_WITH_SEND_KEY,
+};
+
+enum PH_VIEW_TYPE {
+ PH_VIEW_NONE = -1,
+ PH_VIEW_DIALER = 0,
+ PH_VIEW_CONTACT,
+ PH_VIEW_LOG,
+ PH_VIEW_FAVORITE,
+ PH_VIEW_MAX,
+};
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *tabbar;
+ Evas_Object *sub_view[PH_VIEW_MAX];
+ Elm_Object_Item *item[PH_VIEW_MAX];
+ bool view_visible[PH_VIEW_MAX];
+ void *ug;
+ char *ug_data;
+ int ug_request;
+ int cnt_max;
+ int select_tab;
+ Ecore_Idler *idler;
+ Ecore_Timer *timer;
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ Evas_Object *icon;
+ bool is_desktop_mode;
+#endif
+
+}ph_phoneui_data;
+
+
+ph_phoneui_data* phone_front_view_create(Evas_Object *win);
+API void phone_front_view_show_sub_view(ph_phoneui_data *phoneui_d);
+Eina_Bool phone_front_view_load_timer(void *data);
+void phone_front_view_region_changed(ph_phoneui_data *phoneui_d);
+void phone_front_view_reset(ph_phoneui_data *phoneui_d, int tab_index, int op, service_h service);
+void phone_front_view_language_changed(ph_phoneui_data *phoneui_d);
+void phone_front_view_resume(ph_phoneui_data *phoneui_d);
+void phone_front_view_pause(ph_phoneui_data *phoneui_d);
+int phone_front_view_show_call_app(ph_phoneui_data *phoneui_d);
+
+#endif /* __PH_FRONT_H__ */
+
diff --git a/lib/ph-front/ph-front-main.c b/lib/ph-front/ph-front-main.c
new file mode 100755
index 0000000..62242d0
--- /dev/null
+++ b/lib/ph-front/ph-front-main.c
@@ -0,0 +1,193 @@
+/*
+* 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 "phone-ug.h"
+#include "ph-front.h"
+#include "ph-front-view.h"
+#include <bundle.h>
+
+// for removing build warning ////////////////////////////////////
+int service_export_as_bundle(service_h service, bundle **data);
+////////////////////////////////////////////////////////
+
+void *phoneui_on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *bg;
+ Evas_Object *parent;
+ Evas_Object *layout;
+ ph_phoneui_data *phoneui_d;
+ const char* val = NULL;
+ bundle *bd;
+
+ if (!ug || !priv)
+ return NULL;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ service_export_as_bundle(service, &bd);
+
+ phoneui_d = priv;
+ if (bd) {
+ val = bundle_get_val(bd, PH_UG_BUNDLE_TYPE);
+ if (val) phoneui_d->ug_request = atoi(val);
+ PH_DBG("type = %d", phoneui_d->ug_request);
+ bundle_free(bd);
+ }
+ p_retvm_if(PH_UG_REQUEST_LAUNCH_VOICECALL != phoneui_d->ug_request, NULL, "Invalid ug request (%d)", phoneui_d->ug_request);
+
+ phoneui_d->view_visible[PH_VIEW_DIALER] = true;
+ phoneui_d->view_visible[PH_VIEW_LOG] = true;
+ phoneui_d->view_visible[PH_VIEW_CONTACT] = false;
+ phoneui_d->view_visible[PH_VIEW_FAVORITE] = false;
+
+ 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;
+
+ phoneui_d = priv;
+ phoneui_d->win = ug_get_window();
+ elm_win_conformant_set(phoneui_d->win, EINA_TRUE);
+ phoneui_d->select_tab = PH_VIEW_NONE;
+ phoneui_d->ug = ug;
+
+ layout = ph_front_create_toolbar(phoneui_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 phoneui_on_start(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ ph_phoneui_data *phoneui_d = priv;
+
+ elm_toolbar_select_mode_set(phoneui_d->tabbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ phoneui_d->timer = ecore_timer_add(3.0, phone_front_view_load_timer, phoneui_d);
+ PH_FN_END;
+}
+
+void phoneui_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+void phoneui_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+void phoneui_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retm_if(NULL == priv, "The parameter is invalid(priv=%p)", priv);
+ p_retm_if(NULL == ug, "The parameter is invalid(ug=%p)", ug);
+ ph_phoneui_data *phoneui_d = priv;
+ if (!ug)
+ return;
+
+ free(phoneui_d->ug_data);
+
+ if (phoneui_d && phoneui_d->ug == NULL) {
+ PH_DBG("view destroy already called, so clist_d free here");
+ free(phoneui_d);
+ }
+ else {
+ phoneui_d->ug = NULL;
+ 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 phoneui_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+void phoneui_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ ph_phoneui_data *phoneui_d = priv;
+ switch (event) {
+ case UG_EVENT_REGION_CHANGE:
+ phone_front_view_region_changed(phoneui_d);
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ phone_front_view_language_changed(phoneui_d);
+ break;
+ default:
+ break;
+ }
+}
+
+void phoneui_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h data, void *priv)
+{
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ph_phoneui_data *phoneui_d;
+
+ if (!ops)
+ return -1;
+
+ phoneui_d = calloc(1, sizeof(ph_phoneui_data));
+ if (!phoneui_d)
+ return -1;
+
+ ops->create = phoneui_on_create;
+ ops->start = phoneui_on_start;
+ ops->pause = phoneui_on_pause;
+ ops->resume = phoneui_on_resume;
+ ops->destroy = phoneui_on_destroy;
+ ops->message = phoneui_on_message;
+ ops->event = phoneui_on_event;
+ ops->key_event = phoneui_on_key_event;
+ ops->priv = phoneui_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;
+ ops->priv = NULL;
+}
+
diff --git a/lib/ph-front/ph-front-view.c b/lib/ph-front/ph-front-view.c
new file mode 100755
index 0000000..17f3d58
--- /dev/null
+++ b/lib/ph-front/ph-front-view.c
@@ -0,0 +1,574 @@
+/*
+* 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 <aul.h>
+#include <app.h>
+
+#include "phone.h"
+#include "ph-front.h"
+#include "phone-log.h"
+#include "phone-dialer.h"
+#include "ph-front-view.h"
+#include "ct-list.h"
+#include "ct-favor.h"
+
+static void front_view_reset_current_sub_view(ph_phoneui_data *phoneui_d)
+{
+ PH_FN_CALL;
+ p_ret_if(phoneui_d->select_tab <= PH_VIEW_NONE || PH_VIEW_MAX <= phoneui_d->select_tab);
+ if (phoneui_d->sub_view[phoneui_d->select_tab]) {
+ switch (phoneui_d->select_tab) {
+ case PH_VIEW_DIALER:
+ phone_dialer_view_reset(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ phone_dialer_set_background(phoneui_d->sub_view[PH_VIEW_DIALER], true);
+ break;
+ case PH_VIEW_CONTACT :
+ ctui_list_view_reset(evas_object_data_get(phoneui_d->navi, "clist_d"));
+ ctui_list_set_background(phoneui_d->navi, true);
+ break;
+ case PH_VIEW_LOG :
+ phone_log_view_reset(phoneui_d->navi);
+ phone_log_set_background(phoneui_d->navi, true);
+ break;
+ case PH_VIEW_FAVORITE :
+ phone_favor_view_reset(phoneui_d->sub_view[PH_VIEW_FAVORITE]);
+ phone_favor_set_background(phoneui_d->sub_view[PH_VIEW_FAVORITE], true);
+ break;
+ }
+ }
+}
+
+static void front_view_load_sub_view(ph_phoneui_data *phoneui_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, phoneui_d->win, phoneui_d->navi, phoneui_d->ug, phoneui_d->ug_request,
+ phoneui_d->cnt_max, phoneui_d->ug_data);
+ switch (tab_index) {
+ case PH_VIEW_DIALER:
+ phoneui_d->sub_view[tab_index] = phone_create_dialer_view(view_info);
+ break;
+ case PH_VIEW_CONTACT:
+ phoneui_d->sub_view[tab_index] = ctui_create_phone_list_view(view_info);
+ break;
+ case PH_VIEW_LOG:
+ phoneui_d->sub_view[tab_index] = phone_create_log_view(view_info);
+ break;
+ case PH_VIEW_FAVORITE:
+ phoneui_d->sub_view[tab_index] = phone_favor_create_view(view_info);
+ break;
+ default:
+ ERR("INVALID tab_index : %d", tab_index);
+ break;
+ };
+ free(view_info);
+ return;
+}
+
+API void phone_front_view_show_sub_view(ph_phoneui_data *phoneui_d)
+{
+ PH_FN_CALL;
+ Evas_Object *view;
+ ph_view_info *view_info;
+
+ front_view_reset_current_sub_view(phoneui_d);
+ phone_hide_notify(phoneui_d->navi);
+
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, phoneui_d->win, phoneui_d->navi, phoneui_d->ug, phoneui_d->ug_request,
+ phoneui_d->cnt_max, phoneui_d->ug_data);
+
+ if (NULL == phoneui_d->sub_view[PH_VIEW_CONTACT])
+ phoneui_d->sub_view[PH_VIEW_CONTACT] = ctui_create_phone_list_view(view_info);
+ ctui_list_set_background(phoneui_d->navi, false);
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, evas_object_data_get(phoneui_d->navi, "clist_d"));
+
+ phoneui_d->select_tab = PH_VIEW_CONTACT;
+
+ view = elm_object_part_content_unset(phoneui_d->layout, "elm.swallow.content");
+ if (view)
+ evas_object_hide(view);
+ elm_object_part_content_set(phoneui_d->layout, "elm.swallow.content", phoneui_d->sub_view[PH_VIEW_CONTACT]);
+ evas_object_show(phoneui_d->sub_view[PH_VIEW_CONTACT]);
+
+ free(view_info);
+}
+
+
+static void front_view_show_sub_view(ph_phoneui_data *phoneui_d, int tab_index)
+{
+ PH_FN_CALL;
+ Evas_Object *view;
+ ph_view_info *view_info;
+ p_retm_if(tab_index <= PH_VIEW_NONE || PH_VIEW_MAX <= tab_index, "tab index is invalid");
+ p_retm_if(phoneui_d->select_tab == tab_index, "The tab is already shown");
+
+ front_view_reset_current_sub_view(phoneui_d);
+ phone_hide_notify(phoneui_d->navi);
+
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, phoneui_d->win, phoneui_d->navi, phoneui_d->ug, phoneui_d->ug_request,
+ phoneui_d->cnt_max, phoneui_d->ug_data);
+
+ switch (tab_index) {
+ case PH_VIEW_DIALER:
+ if (NULL == phoneui_d->sub_view[tab_index])
+ phoneui_d->sub_view[tab_index] = phone_create_dialer_view(view_info);
+ phone_dialer_set_background(phoneui_d->sub_view[PH_VIEW_DIALER], false);
+ phone_dialer_set_navi(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ phone_dialer_check_focus(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ if(!phoneui_d->ug)
+ phone_front_view_show_call_app(phoneui_d);
+
+ evas_object_data_set(phoneui_d->sub_view[tab_index], "phoneui_d", phoneui_d);
+ break;
+ case PH_VIEW_CONTACT:
+ if (NULL == phoneui_d->sub_view[tab_index])
+ phoneui_d->sub_view[tab_index] = ctui_create_phone_list_view(view_info);
+ ctui_list_set_background(phoneui_d->navi, false);
+ if (PH_UG_REQUEST_CHECK == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_EMAIL == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == phoneui_d->ug_request) {
+ ctui_list_edit_mode_start(evas_object_data_get(phoneui_d->navi, "clist_d"));
+ }
+ else
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, evas_object_data_get(phoneui_d->navi, "clist_d"));
+ break;
+ case PH_VIEW_LOG:
+ if (NULL == phoneui_d->sub_view[tab_index])
+ phoneui_d->sub_view[tab_index] = phone_create_log_view(view_info);
+ phone_log_set_background(phoneui_d->navi, false);
+ if (!phoneui_d->ug)
+ phone_log_missed_info_update(phoneui_d->navi);
+
+ if (PH_UG_REQUEST_CHECK == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_EMAIL == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == phoneui_d->ug_request)
+ phone_log_check_mode_start(evas_object_data_get(phoneui_d->navi, "log_data"));
+ else
+ phone_log_set_navi(phoneui_d->navi);
+ break;
+ case PH_VIEW_FAVORITE:
+ if (NULL == phoneui_d->sub_view[tab_index])
+ phoneui_d->sub_view[tab_index] = phone_favor_create_view(view_info);
+ phone_favor_set_background(phoneui_d->sub_view[PH_VIEW_FAVORITE], false);
+ if (phoneui_d->ug &&
+ (PH_UG_REQUEST_CHECK == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_EMAIL == phoneui_d->ug_request ||
+ PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == phoneui_d->ug_request)) {
+ phone_favor_edit_mode_start(evas_object_data_get(phoneui_d->sub_view[tab_index], "favor_d"));
+ }
+ else
+ phone_favor_set_navi(phoneui_d->sub_view[tab_index], PH_FAVOR_MODE_DEFAULT);
+ break;
+ default:
+ free(view_info);
+ ERR("INVALID tab_index: %d", tab_index);
+ return;
+ }
+ phoneui_d->select_tab = tab_index;
+
+ view = elm_object_part_content_unset(phoneui_d->layout, "elm.swallow.content");
+ if (view)
+ evas_object_hide(view);
+ elm_object_part_content_set(phoneui_d->layout, "elm.swallow.content", phoneui_d->sub_view[tab_index]);
+ evas_object_show(phoneui_d->sub_view[tab_index]);
+
+ free(view_info);
+}
+
+static Eina_Bool front_view_load_all_sub_view(void *data)
+{
+ PH_FN_CALL;
+ ph_phoneui_data *phoneui_d = data;
+ int i;
+
+ for (i=PH_VIEW_DIALER;i<PH_VIEW_MAX;i++) {
+ if (phoneui_d->view_visible[i] && NULL == phoneui_d->sub_view[i]) {
+ front_view_load_sub_view(phoneui_d, i);
+ return ECORE_CALLBACK_RENEW;
+ }
+ }
+ phoneui_d->idler = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+API Eina_Bool phone_front_view_load_timer(void *data)
+{
+ ph_phoneui_data *phoneui_d = data;
+ phoneui_d->idler = ecore_idler_add(front_view_load_all_sub_view, phoneui_d);
+ phoneui_d->timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void pfront_view_change_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int i;
+ Elm_Object_Item *selected_it;
+ ph_phoneui_data *phoneui_d = data;
+
+ selected_it = elm_toolbar_selected_item_get(obj);
+
+ for (i=PH_VIEW_DIALER;i<PH_VIEW_MAX;i++) {
+ if (phoneui_d->item[i])
+ if (selected_it == phoneui_d->item[i]) break;
+ }
+ PH_DBG("cur sel : %d, sel index : %d", phoneui_d->select_tab, i);
+ front_view_show_sub_view(phoneui_d, i);
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ if(phoneui_d->is_desktop_mode) {
+ Elm_Object_Item *navi_item = elm_naviframe_bottom_item_get(phoneui_d->navi);
+ elm_object_item_part_content_set(navi_item, "prev_btn", NULL);
+ }
+#endif
+}
+
+static void pfront_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_phoneui_data *phoneui_d = data;
+ int i;
+
+ p_retm_if(NULL == phoneui_d, "phoneui_d is null");
+
+ for (i=0;i<PH_VIEW_MAX;i++) {
+ if (phoneui_d->sub_view[i])
+ evas_object_del(phoneui_d->sub_view[i]);
+ }
+
+ if (phoneui_d->idler)
+ ecore_idler_del(phoneui_d->idler);
+
+ if (phoneui_d->timer)
+ ecore_timer_del(phoneui_d->timer);
+
+ if(!phoneui_d->ug) {
+ PH_DBG("no ug");
+ free(phoneui_d);
+ }
+ else {
+ PH_DBG("view destroy called earlier than ug destroy");
+ phoneui_d->ug = NULL;
+ }
+ PH_FN_END;
+}
+
+Evas_Object* ph_front_create_toolbar(ph_phoneui_data *phoneui_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(phoneui_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(phoneui_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);
+ phoneui_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");
+ phoneui_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);
+ phoneui_d->tabbar = toolbar;
+
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+
+ if (phoneui_d->view_visible[PH_VIEW_DIALER])
+ phoneui_d->item[PH_VIEW_DIALER] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_DIALER, T_(PH_GET_TEXT_BASIC, PHTEXT_KEYPAD), pfront_view_change_cb, phoneui_d);
+ if (phoneui_d->view_visible[PH_VIEW_CONTACT])
+ phoneui_d->item[PH_VIEW_CONTACT] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_CONTACTS, S_(PH_SYS_BODY_CONTACTS), pfront_view_change_cb, phoneui_d);
+ if (phoneui_d->view_visible[PH_VIEW_LOG])
+ phoneui_d->item[PH_VIEW_LOG] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_LOGS, T_(PH_GET_TEXT_BASIC, PHTEXT_LOGS), pfront_view_change_cb, phoneui_d);
+ if (phoneui_d->view_visible[PH_VIEW_FAVORITE])
+ phoneui_d->item[PH_VIEW_FAVORITE] = elm_toolbar_item_append(toolbar,
+ PH_IMG_ICON_FAVORITE, T_(PH_GET_TEXT_BASIC, PHTEXT_FAVORITES), pfront_view_change_cb, phoneui_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, pfront_view_delete_cb, phoneui_d);
+
+ return base;
+}
+
+API ph_phoneui_data* phone_front_view_create(Evas_Object *win)
+{
+ PH_FN_CALL;
+ Evas_Object *bg;
+ Evas_Object *layout;
+ ph_phoneui_data *phoneui_d = calloc(1, sizeof(ph_phoneui_data));
+ phoneui_d->win = win;
+ phoneui_d->select_tab = PH_VIEW_NONE;
+
+ phoneui_d->view_visible[PH_VIEW_DIALER] = true;
+ phoneui_d->view_visible[PH_VIEW_CONTACT] = true;
+ phoneui_d->view_visible[PH_VIEW_LOG] = true;
+ phoneui_d->view_visible[PH_VIEW_FAVORITE] = true;
+
+ layout = ph_front_create_toolbar(phoneui_d);
+ if (NULL == layout) {
+ PH_DBG("layout_main is null");
+ free(phoneui_d);
+ return NULL;
+ }
+
+ bg = phone_create_bg(layout);
+ if (NULL == bg) {
+ PH_DBG("phone_create_bg() return NULL");
+ free(phoneui_d);
+ return NULL;
+ }
+
+ return phoneui_d;
+}
+
+API void phone_front_view_region_changed(ph_phoneui_data *phoneui_d)
+{
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_LOG])
+ phone_log_views_update(phoneui_d->navi);
+}
+
+API void phone_front_view_pause(ph_phoneui_data *phoneui_d)
+{
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_LOG])
+ phone_log_set_background(phoneui_d->navi, true);
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_CONTACT])
+ ctui_list_view_pause(phoneui_d->navi);
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_DIALER])
+ phone_dialer_set_background(phoneui_d->sub_view[PH_VIEW_DIALER], true);
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_FAVORITE])
+ phone_favor_set_background(phoneui_d->sub_view[PH_VIEW_FAVORITE], true);
+}
+
+API void phone_front_view_resume(ph_phoneui_data *phoneui_d)
+{
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_LOG]) {
+ if (PH_VIEW_LOG == phoneui_d->select_tab) {
+ phone_log_set_background(phoneui_d->navi, false);
+ phone_log_view_resume(phoneui_d->navi);
+ }
+ }
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_CONTACT])
+ ctui_list_view_resume(phoneui_d->navi);
+
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_DIALER]) {
+ if (PH_VIEW_DIALER == phoneui_d->select_tab) {
+ phone_dialer_set_background(phoneui_d->sub_view[PH_VIEW_DIALER], false);
+ phone_dialer_view_resume(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ }
+ }
+ if (phoneui_d && phoneui_d->sub_view[PH_VIEW_FAVORITE] && PH_VIEW_FAVORITE == phoneui_d->select_tab)
+ phone_favor_set_background(phoneui_d->sub_view[PH_VIEW_FAVORITE], false);
+}
+
+static void front_view_win_activate(void *data, Evas *e, void *even_info)
+{
+ elm_win_activate(data);
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST, front_view_win_activate);
+}
+
+API void phone_front_view_language_changed(ph_phoneui_data *phoneui_d)
+{
+ p_retm_if(NULL == phoneui_d, "parameter(phoneui_d) is NULL");
+
+ // 1. Update toolbar
+ if (phoneui_d->item[PH_VIEW_LOG])
+ elm_object_item_text_set(phoneui_d->item[PH_VIEW_LOG], T_(PH_GET_TEXT_BASIC, PHTEXT_LOGS));
+
+ if (phoneui_d->item[PH_VIEW_CONTACT])
+ elm_object_item_text_set(phoneui_d->item[PH_VIEW_CONTACT], S_(PH_SYS_BODY_CONTACTS));
+
+ if (phoneui_d->item[PH_VIEW_DIALER])
+ elm_object_item_text_set(phoneui_d->item[PH_VIEW_DIALER], T_(PH_GET_TEXT_BASIC, PHTEXT_KEYPAD));
+
+ if (phoneui_d->item[PH_VIEW_FAVORITE])
+ elm_object_item_text_set(phoneui_d->item[PH_VIEW_FAVORITE], T_(PH_GET_TEXT_BASIC, PHTEXT_FAVORITES));
+
+ // 2. update view
+ if (phoneui_d->sub_view[PH_VIEW_LOG])
+ phone_log_view_language_changed(phoneui_d->navi);
+
+ if (phoneui_d->sub_view[PH_VIEW_CONTACT])
+ ctui_list_view_language_changed(phoneui_d->navi);
+
+ if (phoneui_d->sub_view[PH_VIEW_DIALER])
+ phone_dialer_view_language_changed(phoneui_d->sub_view[PH_VIEW_DIALER]);
+
+ if (phoneui_d->sub_view[PH_VIEW_FAVORITE])
+ phone_favor_view_language_changed(phoneui_d->sub_view[PH_VIEW_FAVORITE]);
+}
+
+API void phone_front_view_reset(ph_phoneui_data *phoneui_d, int select_index, int op, service_h service)
+{
+ PH_FN_CALL;
+ int call_launched = FALSE;
+ ph_view_info *view_info;
+ Evas_Object *view;
+ int ret;
+
+ elm_toolbar_select_mode_set(phoneui_d->tabbar, ELM_OBJECT_SELECT_MODE_NONE);
+
+ front_view_reset_current_sub_view(phoneui_d);
+ if (phoneui_d->sub_view[PH_VIEW_CONTACT])
+ ctui_list_view_resume(phoneui_d->navi);
+ view = elm_object_part_content_unset(phoneui_d->layout, "elm.swallow.content");
+ if (view)
+ evas_object_hide(view);
+
+ elm_toolbar_select_mode_set(phoneui_d->tabbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ view_info = calloc(1, sizeof(ph_view_info));
+ phone_set_view_info(view_info, phoneui_d->win, phoneui_d->navi, phoneui_d->ug, phoneui_d->ug_request,
+ phoneui_d->cnt_max, phoneui_d->ug_data);
+
+ switch (select_index) {
+ case PH_VIEW_DIALER:
+ if (NULL == phoneui_d->sub_view[select_index])
+ phoneui_d->sub_view[select_index] = phone_create_dialer_view(view_info);
+
+ if (PH_FRONT_DIALER_WITH_NUM == op) {
+ char *num = NULL;
+ ret = service_get_uri(service, &num);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_uri is failed(%d)", ret);
+ phone_dialer_view_set_num(phoneui_d->sub_view[PH_VIEW_DIALER], num+4);
+ free(num);
+ } else if(PH_FRONT_DIALER_WITH_SEND_KEY == op) {
+ phone_dialer_view_send_key(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ } else {
+ phone_dialer_view_resume(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ }
+
+ phone_dialer_set_navi(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ phone_dialer_check_focus(phoneui_d->sub_view[PH_VIEW_DIALER]);
+ phone_dialer_set_background(phoneui_d->sub_view[PH_VIEW_DIALER], false);
+
+ if(!phoneui_d->ug)
+ call_launched = phone_front_view_show_call_app(phoneui_d);
+ break;
+ case PH_VIEW_CONTACT:
+ if (NULL == phoneui_d->sub_view[select_index]) {
+ phoneui_d->sub_view[PH_VIEW_CONTACT] = ctui_create_phone_list_view(view_info);
+ }
+ ctui_list_navi_set(CT_LIST_MODE_DEFAULT, evas_object_data_get(phoneui_d->navi, "clist_d"));
+ break;
+ case PH_VIEW_LOG:
+ if (NULL == phoneui_d->sub_view[select_index])
+ phoneui_d->sub_view[select_index] = phone_create_log_view(view_info);
+ if (!phoneui_d->ug)
+ phone_log_missed_info_update(phoneui_d->navi);
+ if (PH_FRONT_LOG_MISSED == op)
+ phone_viewby_type_set(phoneui_d->navi, VIEWBY_MISSED_CALL);
+ phone_log_set_navi(phoneui_d->navi);
+ break;
+ case PH_VIEW_FAVORITE:
+ if (NULL == phoneui_d->sub_view[select_index])
+ phoneui_d->sub_view[select_index] = phone_favor_create_view(view_info);
+ phone_favor_set_navi(phoneui_d->sub_view[select_index], PH_FAVOR_MODE_DEFAULT);
+ phone_favor_set_background(phoneui_d->sub_view[PH_VIEW_FAVORITE], false);
+ break;
+ default:
+ break;
+ }
+
+ phoneui_d->select_tab = select_index;
+
+ if (PH_VIEW_NONE < select_index && select_index < PH_VIEW_MAX) {
+ elm_object_part_content_set(phoneui_d->layout, "elm.swallow.content", phoneui_d->sub_view[select_index]);
+ evas_object_show(phoneui_d->sub_view[select_index]);
+ elm_toolbar_item_selected_set(phoneui_d->item[select_index], EINA_TRUE);
+ }
+
+ if (phoneui_d->win && FALSE == call_launched && PH_VIEW_NONE != select_index) {
+ if (EINA_FALSE == evas_object_visible_get(phoneui_d->win))
+ evas_object_show(phoneui_d->win);
+ evas_event_callback_add(evas_object_evas_get(phoneui_d->navi),
+ EVAS_CALLBACK_RENDER_FLUSH_POST, front_view_win_activate, phoneui_d->win);
+ elm_win_activate(phoneui_d->win);
+ }
+ else
+ elm_win_lower(phoneui_d->win);
+ phoneui_d->timer = ecore_timer_add(3.0, phone_front_view_load_timer, phoneui_d);
+
+
+ free(view_info);
+ PH_FN_END;
+}
+
+static bool front_view_call_app_check(service_h service, const char *pkg_name, void *data)
+{
+ int *call_app_launched = data;
+
+ // premise : Only one Call app can be running at a time
+ if (1 == aul_app_is_running(pkg_name)) {
+ aul_open_app(pkg_name);
+ *call_app_launched = TRUE;
+ return true;
+ }
+ return true;
+}
+
+API int phone_front_view_show_call_app(ph_phoneui_data *phoneui_d)
+{
+ PH_FN_CALL;
+ service_h service;
+ int call_app_launched = FALSE;
+
+ service_create(&service);
+ service_set_operation(service, SERVICE_OPERATION_CALL);
+ service_set_uri(service, "tel:");
+ service_foreach_app_matched(service, front_view_call_app_check, (void *)&call_app_launched);
+
+ if (call_app_launched)
+ return 1;
+ if (1 == aul_app_is_running(VIDEOCALL_PKG)) {
+ aul_open_app(VIDEOCALL_PKG);
+ return 1;
+ }
+ return 0;
+}
+
diff --git a/lib/ph-front/ph-front-view.h b/lib/ph-front/ph-front-view.h
new file mode 100755
index 0000000..91ad736
--- /dev/null
+++ b/lib/ph-front/ph-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 __PH_FRONT_VIEW_H__
+#define __PH_FRONT_VIEW_H__
+
+Evas_Object* ph_front_create_toolbar(ph_phoneui_data *phoneui_d);
+
+#endif /* __PH_FRONT_VIEW_H__ */
+
diff --git a/lib/ph-front/phone-tabui-efl.xml b/lib/ph-front/phone-tabui-efl.xml
new file mode 100644
index 0000000..8b1d08b
--- /dev/null
+++ b/lib/ph-front/phone-tabui-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="phone-tabui-efl" version="0.1.0-0" install-location="internal-only">
+ <label>phone-tabui</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>phone-tabui-efl Application</description>
+ <ui-application appid="phone-tabui-efl" exec="/usr/ug/bin/phone-tabui-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.contacts.png</icon>
+ <label>phone-tabui</label>
+ <label xml:lang="en-us">phone-tabui</label>
+ <label xml:lang="nl-nl">phone-tabui</label>
+ <label xml:lang="de-de">phone-tabui</label>
+ <label xml:lang="en-gb">phone-tabui</label>
+ <label xml:lang="zh-hk">phone-tabui</label>
+ <label xml:lang="zh-cn">phone-tabui</label>
+ <label xml:lang="ru-ru">phone-tabui</label>
+ <label xml:lang="zh-tw">phone-tabui</label>
+ <label xml:lang="ja-jp">phone-tabui</label>
+ <label xml:lang="es-es">phone-tabui</label>
+ <label xml:lang="el-gr">phone-tabui</label>
+ <label xml:lang="it-it">phone-tabui</label>
+ <label xml:lang="tr-tr">phone-tabui</label>
+ <label xml:lang="pt-pt">phone-tabui</label>
+ <label xml:lang="fr-fr">phone-tabui</label>
+ <label xml:lang="ko-kr">phone-tabui</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/lib/settings/CMakeLists.txt b/lib/settings/CMakeLists.txt
new file mode 100755
index 0000000..dc4ff9d
--- /dev/null
+++ b/lib/settings/CMakeLists.txt
@@ -0,0 +1,13 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${CT_SETTING})
+
+FILE(GLOB SRCS *.c)
+
+ADD_LIBRARY(${TARGET} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
+TARGET_LINK_LIBRARIES(${TARGET} ${COMMON_LIB} ${ug_pkgs_LDFLAGS} ${CT_LIST})
+ADD_DEPENDENCIES(${TARGET} contacts_edj_build)
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/settings/contacts-settings-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/settings/contacts-settings-efl.xml b/lib/settings/contacts-settings-efl.xml
new file mode 100644
index 0000000..8994073
--- /dev/null
+++ b/lib/settings/contacts-settings-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="contacts-settings-efl" version="0.1.0-0" install-location="internal-only">
+ <label>contacts-settings</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>contacts-settings-efl Application</description>
+ <ui-application appid="contacts-settings-efl" exec="/usr/ug/bin/contacts-settings-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.contacts.png</icon>
+ <label>contacts-settings</label>
+ <label xml:lang="en-us">contacts-settings</label>
+ <label xml:lang="nl-nl">contacts-settings</label>
+ <label xml:lang="de-de">contacts-settings</label>
+ <label xml:lang="en-gb">contacts-settings</label>
+ <label xml:lang="zh-hk">contacts-settings</label>
+ <label xml:lang="zh-cn">contacts-settings</label>
+ <label xml:lang="ru-ru">contacts-settings</label>
+ <label xml:lang="zh-tw">contacts-settings</label>
+ <label xml:lang="ja-jp">contacts-settings</label>
+ <label xml:lang="es-es">contacts-settings</label>
+ <label xml:lang="el-gr">contacts-settings</label>
+ <label xml:lang="it-it">contacts-settings</label>
+ <label xml:lang="tr-tr">contacts-settings</label>
+ <label xml:lang="pt-pt">contacts-settings</label>
+ <label xml:lang="fr-fr">contacts-settings</label>
+ <label xml:lang="ko-kr">contacts-settings</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>
diff --git a/lib/settings/ct-setting-main.c b/lib/settings/ct-setting-main.c
new file mode 100755
index 0000000..00ddce9
--- /dev/null
+++ b/lib/settings/ct-setting-main.c
@@ -0,0 +1,157 @@
+/*
+* 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 "ct-setting-view.h"
+
+static int create_setting_view(Evas_Object *parent, ct_setting_data *csetting_d)
+{
+ Evas_Object *l_btn;
+ Evas_Object *content;
+ Elm_Object_Item *navi_item;
+
+ p_retvm_if(NULL == parent, FALSE, "parameter(parent) is NULL");
+
+ csetting_d->navi = elm_naviframe_add(parent);
+ evas_object_show(csetting_d->navi);
+ p_retvm_if(NULL == csetting_d->navi, FALSE, "navi is NULL");
+
+ content = ct_setting_create_layout(csetting_d);
+ navi_item = elm_naviframe_item_push(csetting_d->navi, S_(PH_SYS_BODY_CONTACTS), NULL, NULL, content, NULL);
+ csetting_d->navi_item_main = navi_item;
+
+ l_btn = elm_button_add(csetting_d->navi);
+ p_retvm_if(NULL == l_btn, -1, "elm_button_add() return NULL");
+
+ elm_object_item_part_content_set(navi_item, "prev_btn", l_btn);
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(l_btn, "clicked", phone_ug_destroy_me_cb, csetting_d->ug);
+
+ return TRUE;
+}
+
+static void* settings_on_create(ui_gadget_h ug, enum ug_mode mode,
+ service_h service, void *priv)
+{
+ Evas_Object *bg;
+ Evas_Object *parent;
+ Evas_Object *base;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_setting_data *csetting_d = priv;
+
+ p_retvm_if(NULL == ug || NULL == priv, NULL,
+ "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
+
+ parent = ug_get_parent_layout(ug);
+ p_retvm_if(NULL == parent, NULL, "ug_get_parent_layout() return NULL");
+ csetting_d->ug = ug;
+
+ bindtextdomain(PACKAGE, "/usr/ug/res/locale");
+
+ err = contacts_connect2();
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_connect2() Failed(%d)", err);
+
+ if (UG_MODE_FULLVIEW == mode)
+ base = phone_create_base_layout(parent, true);
+ else {
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ return NULL;
+ }
+
+ 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_setting_view(base, csetting_d ))
+ elm_object_part_content_set(base, "elm.swallow.content", csetting_d->navi);
+ else {
+ evas_object_del(base);
+ base = NULL;
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ }
+
+ return base;
+}
+
+static void settings_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
+{
+ if (!ug)
+ return;
+
+ switch (event) {
+ case UG_KEY_EVENT_END:
+ ug_destroy_me(ug);
+ break;
+ default:
+ break;
+ }
+}
+
+static void settings_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retm_if(NULL == ug, "The ug is NULL(ug = %p)", ug);
+ evas_object_del(ug_get_layout(ug));
+
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ct_setting_data *csetting_d;
+
+ p_retvm_if(!ops, -1, "ops is NULL");
+
+ csetting_d = calloc(1, sizeof(ct_setting_data));
+ p_retvm_if(NULL == csetting_d , -1, "calloc() return NULL");
+
+ ops->create = settings_on_create;
+ ops->start = NULL;
+ ops->pause = NULL;
+ ops->resume = NULL;
+ ops->destroy = settings_on_destroy;
+ ops->message = NULL;
+ ops->event = NULL;
+ ops->key_event = settings_on_key_event;
+ ops->priv = csetting_d ;
+
+ return 0;
+}
+
+API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ if (!ops)
+ return;
+
+ ops->priv = NULL;
+}
+
+API int setting_plugin_reset(service_h service, void *priv)
+{
+ return 0;
+}
diff --git a/lib/settings/ct-setting-view.c b/lib/settings/ct-setting-view.c
new file mode 100755
index 0000000..76611cd
--- /dev/null
+++ b/lib/settings/ct-setting-view.c
@@ -0,0 +1,1377 @@
+/*
+* 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 <errno.h>
+#include <fcntl.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <media_content.h>
+#include "phone.h"
+#include "phone-common.h"
+
+#include "ct-list.h"
+#include "ct-setting-view.h"
+
+#define CT_SETTING_PHONE_PATH "/opt/usr/media/Backup/Contacts"
+#define CT_SETTING_MEMORY_CARD_PATH "/opt/storage/sdcard/Backup/Contacts"
+
+
+#define CT_SETTING_TIMER_DURATION 0.2
+
+enum SETTING_ITC_TYPE{
+ SETTING_ITC_TEXT = 0,
+ SETTING_ITC_IMPORT = SETTING_ITC_TEXT,
+ SETTING_ITC_EXPORT = SETTING_ITC_TEXT,
+ SETTING_ITC_IMPORT_EXPORT = SETTING_ITC_TEXT,
+ SETTING_ITC_ORDER = 1,
+ SETTING_ITC_RADIO = 2,
+ SETTING_ITC_FIRSTLAST = SETTING_ITC_RADIO,
+ SETTING_ITC_LASTFIRST = SETTING_ITC_RADIO,
+ SETTING_ITC_MFC = 3,
+ SETTING_ITC_MFC_RIDIO = 4,
+ SETTING_ITC_SHOW = SETTING_ITC_MFC_RIDIO,
+ SETTING_ITC_HIDE = SETTING_ITC_MFC_RIDIO,
+ SETTING_ITC_SDN = 5,
+ SETTING_ITC_MAX,
+};
+
+enum SETTING_STORAGE_TYPE{
+ SETTING_STORAGE_PHONE = 0,
+ SETTING_STORAGE_MEMORY_CARD = 1,
+};
+
+static Elm_Genlist_Item_Class setting_itcs[] = {
+ {.item_style="dialogue/1text"},
+ {.item_style="dialogue/2text.3/expandable"},
+ {.item_style="dialogue/1text.1icon/expandable2"},
+ {.item_style="dialogue/2text.3/expandable"},
+ {.item_style="dialogue/1text.1icon/expandable2"},
+ {.item_style="dialogue/2text.2"},
+};
+
+typedef enum {
+ CT_SETTING_IMPORT,
+ CT_SETTING_EXPORT,
+} ct_setting_op;
+
+
+static void __setting_insert_records(ct_setting_data *csetting_d);
+
+static void setting_set_mfc_option(int mfc_option)
+{
+ int fd;
+ char buf[PH_TEXT_MAX_LEN+1] = {0};
+
+ fd = open(SETTING_MFC_PATH, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ p_retm_if(fd < 0, "Open(%s) Failed", SETTING_MFC_PATH);
+ snprintf(buf, sizeof(buf), "%d", mfc_option);
+ if (-1 == write(fd, buf, strlen(buf)))
+ ERR("write()... Failed(%s)", strerror(errno));
+ close(fd);
+}
+
+static void setting_order(contacts_name_display_order_e order_type)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ /* set ORDER_OF_DISPLAY */
+ err = contacts_setting_set_name_display_order(order_type);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_setting_set_name_display_order() Failed(%d)", err);
+}
+
+
+static void setting_order_ui(Evas_Object *genlist)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_name_display_order_e order;
+ ct_setting_data *csetting_d;
+ Elm_Object_Item *item_order;
+
+ p_retm_if(NULL == genlist, "parameter(genlist) is NULL");
+
+ csetting_d = evas_object_data_get(genlist, "csetting_d");
+ p_retm_if(NULL == csetting_d, "evas_object_data_get() return NULL");
+
+ err = contacts_setting_get_name_display_order(&order);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_name_display_order_e() Failed(%d)", err);
+ elm_radio_value_set(csetting_d->radio_order, (int)order);
+
+ item_order = evas_object_data_get(genlist, "order");
+ p_retm_if(NULL == item_order, "evas_object_data_get() return NULL");
+ elm_genlist_item_update(item_order);
+}
+
+static void setting_handle_order(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ setting_order((contacts_name_display_order_e)data);
+ setting_order_ui(obj);
+}
+
+static void setting_handle_mfc(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_setting_data *csetting_d;
+ Elm_Object_Item *it = event_info;
+ Evas_Object *genlist = obj;
+ Elm_Object_Item *item;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ csetting_d = evas_object_data_get(genlist, "csetting_d");
+ p_retm_if(NULL == csetting_d, "evas_object_data_get() return NULL");
+
+ setting_set_mfc_option((int)data);
+ elm_radio_value_set(csetting_d->radio_mfc, (int)data);
+
+ item = evas_object_data_get(genlist, "mfc");
+ p_retm_if(NULL == item, "evas_object_data_get() return NULL");
+
+ elm_genlist_item_update(item);
+}
+
+static PTHREAD_FN setting_import_sim_contacts(void *data)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ err = contacts_connect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
+
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info = csetting_d->p_info;
+ p_info->result = contacts_sim_import_all_contacts();
+ PH_DBG("p_info->result = %d",p_info->result);
+ p_info->completed = true;
+
+ contacts_disconnect2();
+
+ pthread_exit(NULL);
+}
+
+static Eina_Bool setting_import_sim_timer_cb(void *data)
+{
+ const char *message;
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info;
+
+ p_retvm_if(NULL == csetting_d , ECORE_CALLBACK_CANCEL, "parameter(ct_setting_data) is NULL");
+ p_info = csetting_d->p_info;
+
+ if (!p_info->completed)
+ return ECORE_CALLBACK_RENEW;
+
+ pthread_join(p_info->thread, NULL);
+
+ if (CONTACTS_ERROR_NONE == p_info->result)
+ message = T_(CT_GET_TEXT_BASIC, CTTEXT_IMPORTED);
+ else if (CONTACTS_ERROR_NO_DATA == p_info->result)
+ message = T_(CT_GET_TEXT_ERR, CTTEXT_IMPORT_SIM_NO_DATA);
+ else {
+ switch (p_info->result) {
+ case CONTACTS_ERROR_DB:
+ message = T_(CT_GET_TEXT_ERR, CTTEXT_ERR_DB_LOCKED);
+ break;
+ case CONTACTS_ERROR_FILE_NO_SPACE:
+ message = S_(CT_SYS_POP_NOT_ENOUGH_MEMORY);
+ break;
+ default:
+ message = S_(PH_SYS_POP_FAILED);
+ break;
+ }
+ }
+
+ evas_object_del(csetting_d->popup);
+ csetting_d->popup = NULL;
+
+ free(p_info);
+ csetting_d->p_info = NULL;
+
+ phone_show_tickernoti(message);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void setting_import_sim(ct_setting_data *csetting_d)
+{
+ int ret;
+ ph_progress_info *p_info;
+
+ p_retm_if(csetting_d->p_info, "thread is running");
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc() return NULL");
+ csetting_d->p_info = p_info;
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->without_cancel_btn = true;
+ ret = pthread_create(&p_info->thread, NULL, setting_import_sim_contacts, csetting_d );
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ csetting_d->p_info = NULL;
+ return;
+ }
+
+ p_info->timer = ecore_timer_add(CT_SETTING_TIMER_DURATION, setting_import_sim_timer_cb, csetting_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);
+ csetting_d->p_info = NULL;
+ return;
+ }
+ csetting_d->popup = phone_progressbar_popup(csetting_d->navi, p_info, T_(CT_GET_TEXT_BASIC, CTTEXT_IMPORTING_SIM_CONTACTS));
+}
+
+static inline void setting_progress_fail(ph_progress_info *p_info)
+{
+ p_info->completed = true;
+ p_info->result = FALSE;
+ pthread_exit(NULL);
+}
+
+static Eina_Bool setting_export_timer_cb(void *data)
+{
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info;
+
+ p_retvm_if(NULL == csetting_d, ECORE_CALLBACK_CANCEL, "parameter(ct_setting_data) is NULL");
+ p_info = csetting_d->p_info;
+
+ if (!p_info->completed) {
+ char count[PH_TEXT_SHORT_LEN];
+ char percent[PH_TEXT_SHORT_LEN];
+ double value = (double)p_info->cnt/(double)p_info->cnt_checked_total;
+
+ if (!p_info->alive) {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ elm_progressbar_value_set(p_info->progressbar, value);
+ snprintf(percent, sizeof(percent), "%d%%", (int)(100.0*value));
+ snprintf(count, sizeof(count), "%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", count);
+
+ if (p_info->cnt == p_info->cnt_checked_total)
+ p_info->completed = true;
+
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ const char *message;
+
+ pthread_join(p_info->thread, NULL);
+
+ if (p_info->result)
+ message = T_(CT_GET_TEXT_BASIC, CTTEXT_EXPORTED);
+ else
+ message = S_(PH_SYS_POP_FAILED);
+
+ free(p_info);
+ csetting_d->p_info = NULL;
+
+ if (csetting_d->list_export_ct) {
+ free(csetting_d->list_export_ct);
+ csetting_d->list_export_ct = NULL;
+ }
+
+ evas_object_del(csetting_d->popup);
+ csetting_d->popup = NULL;
+ phone_show_tickernoti(message);
+ elm_naviframe_item_pop_to(csetting_d->navi_item_main);
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+static Eina_Bool setting_import_timer_cb(void *data)
+{
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info;
+
+ p_retvm_if(NULL == csetting_d, ECORE_CALLBACK_CANCEL, "parameter(ct_setting_data) is NULL");
+ p_info = csetting_d->p_info;
+
+ if(p_info->next_job) {
+ pthread_join(p_info->thread, NULL);
+ __setting_insert_records(csetting_d);
+ p_info->next_job = false;
+ }
+
+ if (!p_info->alive && !p_info->completed) {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ }
+
+ if (!p_info->completed) {
+ return ECORE_CALLBACK_RENEW;
+ }
+ else {
+ const char *message;
+
+ pthread_join(p_info->thread, NULL);
+
+ if (p_info->result)
+ message = T_(CT_GET_TEXT_BASIC, CTTEXT_IMPORTED);
+ else
+ message = S_(PH_SYS_POP_FAILED);
+
+ evas_object_del(csetting_d->popup);
+ csetting_d->popup = NULL;
+ phone_show_tickernoti(message);
+
+ free(p_info);
+ csetting_d->p_info = NULL;
+
+ elm_naviframe_item_pop_to(csetting_d->navi_item_main);
+ return ECORE_CALLBACK_CANCEL;
+ }
+}
+
+
+static void __setting_update_media_db(const char *path)
+{
+ p_retm_if(NULL == path, "path is NULL");
+
+ int error = media_content_connect();
+ p_retm_if(error != MEDIA_CONTENT_ERROR_NONE, "media_content_connect(%s) is failed(%d)", path, error);
+
+ error = media_content_scan_file(path);
+ p_retm_if(error != MEDIA_CONTENT_ERROR_NONE, "media_content_scan_file(%s) is failed(%d)", path, error);
+
+ error = media_content_disconnect();
+ p_retm_if(error != MEDIA_CONTENT_ERROR_NONE, "media_content_disconnect(%s) is failed(%d)", path, error);
+}
+
+static PTHREAD_FN setting_export_contacts(void *data)
+{
+ int i;
+ int ret;
+ int fd;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info = csetting_d->p_info;
+
+ fd = open(csetting_d->path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (fd < 0) {
+ ERR("open(%s) Failed", csetting_d->path);
+ setting_progress_fail(p_info);
+ }
+ else
+ __setting_update_media_db(csetting_d->path);
+
+ err = contacts_connect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
+
+ for (i=0;i<csetting_d->list_export_ct_cnt;i++) {
+ char* vcard;
+
+ if (!p_info->alive) {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ break;
+ }
+ PH_DBG("csetting_d->list_export_ct[%d] = %d",i,csetting_d->list_export_ct[i]);
+ err = contacts_db_get_record(_contacts_person._uri, csetting_d->list_export_ct[i], &record);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_db_get_record() Failed(%d)", err);
+ p_info->result = FALSE;
+ continue;
+ }
+
+ err = contacts_vcard_make_from_person(record, &vcard);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_vcard_make_from_person() Failed(%d)", err);
+ p_info->result = FALSE;
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+ continue;
+ }
+ err = contacts_record_destroy(record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ if (-1 == write(fd, vcard, strlen(vcard)))
+ ERR("write()... Failed(%s)", strerror(errno));
+ else
+ __setting_update_media_db(csetting_d->path);
+
+ p_info->cnt++;
+ free(vcard);
+ }
+
+ ret = fsync(fd);
+ if (0 != ret)
+ ERR("fsync() failed(%d)", ret);
+
+ close(fd);
+ if (!p_info->result) {
+ ret = unlink(csetting_d->path);
+ if (0 != ret)
+ ERR("unlink(%s) failed(%d)", csetting_d->path, ret);
+ }
+
+ contacts_disconnect2();
+
+ pthread_exit(NULL);
+}
+
+static void setting_get_filename(char *fullpath, char *dest, int size_dest)
+{
+ char* index;
+ index = strrchr(fullpath, '/');
+ snprintf(dest, size_dest, "%s", index + 1);
+}
+
+static inline char* setting_export_get_filename(char *path)
+{
+ int ret;
+ time_t timer;
+ struct tm *stime;
+ char buf[PH_TEXT_MAX_LEN+1] = {0};
+ char mkcmd[PH_TEXT_MAX_LEN+1] = {0};
+
+ timer = time(NULL);
+ stime = localtime(&timer);
+ p_retvm_if(NULL == stime, NULL, "localtime() Failed(%d)", errno);
+
+ sprintf(mkcmd, "mkdir -p %s", path);
+ ret = system(mkcmd);
+
+ snprintf(buf, sizeof(buf), "%s/contacts_%02d%02d%02d%02d%02d%02d.vcf", path,
+ stime->tm_year-100, stime->tm_mon+1, stime->tm_mday,
+ stime->tm_hour, stime->tm_min, stime->tm_sec);
+
+ return strdup(buf);
+}
+
+static void setting_ug_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ ct_setting_data *csetting_d = priv;
+ p_retm_if(NULL == ug, "parameter(ug) is NULL");
+ ug_destroy(ug);
+
+ p_retm_if(NULL == priv, "parameter(ct_setting_data) is NULL");
+ csetting_d->child_ug = NULL;
+}
+
+static bool setting_import_vcard_foreach_cb(contacts_record_h record, void *data)
+{
+ int ret_id = 0;
+ contacts_error_e err;
+ ph_progress_info *p_info;
+ ct_setting_data *csetting_d = data;
+ contacts_record_h record_clone = NULL;
+
+ p_retvm_if(NULL == csetting_d, -1, "parameter(csetting_d) is NULL");
+
+ p_info = csetting_d->p_info;
+ p_retvm_if(NULL == p_info, -1, "csetting_d->p_info is NULL");
+
+ PH_DBG("setting_import_vcard_foreach_cb total_cnt %d", csetting_d->import_total_cnt);
+
+ if (!p_info->alive) {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ return false;
+ }
+
+ err = contacts_record_clone(record, &record_clone);
+ if (CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_clone() Failed(%d)", err);
+ return false;
+ }
+ csetting_d->list_import_records = eina_list_append(csetting_d->list_import_records, record_clone);
+ csetting_d->import_total_cnt++;
+
+ return true;
+}
+
+
+
+static void __setting_insert_records_cb(int err, int *ids, unsigned int count, void *data)
+{
+ ct_setting_data *csetting_d = data;
+ contacts_error_e _err = CONTACTS_ERROR_NONE;
+
+ if(CONTACTS_ERROR_NONE != err) {
+ if(csetting_d->p_info) {
+ csetting_d->p_info->completed = true;
+ csetting_d->p_info->alive = false;
+ csetting_d->p_info->result = false;
+ }
+ ctui_create_contacts_error_popup(csetting_d->navi, err);
+ return;
+ }
+
+ _err = contacts_list_destroy(csetting_d->import_list, true);
+ p_retm_if(CONTACTS_ERROR_NONE != _err, "contacts_list_destroy() Failed(%d)", _err);
+
+ PH_DBG("__setting_insert_records_cb total count %d, count %d", csetting_d->import_total_cnt, csetting_d->import_cnt);
+
+ if(csetting_d->p_info) {
+ if(!csetting_d->p_info->alive) {
+ csetting_d->p_info->result = FALSE;
+ csetting_d->p_info->completed = true;
+ return;
+ }
+ }
+ else
+ return;
+
+ if(csetting_d->import_cnt == csetting_d->import_total_cnt) {
+ if(csetting_d->p_info) {
+ csetting_d->p_info->completed = true;
+ csetting_d->p_info->alive = false;
+ csetting_d->p_info->result = true;
+ }
+ return;
+ }
+
+ __setting_insert_records(csetting_d);
+}
+
+static void __setting_insert_records(ct_setting_data *csetting_d)
+{
+ const int LIST_BULK_LENGTH = 50;
+ Eina_List *l;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record_temp = NULL;
+
+ err = contacts_list_create(&csetting_d->import_list);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_create() Failed(%d)", err);
+
+ EINA_LIST_FOREACH(csetting_d->list_import_records, l, record_temp) {
+ err = contacts_list_add(csetting_d->import_list, record_temp);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_list_add() Failed(%d) count %d", err, csetting_d->import_cnt);
+ csetting_d->list_import_records = eina_list_remove_list(csetting_d->list_import_records, l);
+
+ csetting_d->import_cnt++;
+
+ if((csetting_d->import_cnt % LIST_BULK_LENGTH) == 0)
+ break;
+
+ }
+ err = contacts_db_insert_records_async(csetting_d->import_list, __setting_insert_records_cb, csetting_d);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_insert_records_async() Failed(%d)", err);
+}
+
+static PTHREAD_FN setting_import_vcard_contacts(void *data)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ const char *path = NULL;
+ char *last = NULL;
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info = csetting_d->p_info;
+
+ err = contacts_connect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
+
+ path = strtok_r(csetting_d->path, "?", &last);
+ while (path) {
+ err = contacts_vcard_parse_to_contact_foreach(path, setting_import_vcard_foreach_cb, csetting_d);
+ if (CONTACTS_ERROR_NONE != err) {
+ p_info->result = FALSE;
+ ERR("contacts_svc_vcard_foreach() Failed(%d)", p_info->result);
+ break;
+ }
+ path = strtok_r(NULL, "?", &last);
+ }
+
+ p_info->next_job = true;
+
+ contacts_disconnect2();
+
+ pthread_exit(NULL);
+}
+
+
+static void setting_import_vcard_myfile_ug_result(ui_gadget_h ug, service_h service, void *data)
+{
+ int ret;
+ char *val = NULL;
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info;
+
+ p_retm_if(NULL == ug, "parameter(ug) is NULL");
+ ug_destroy(ug);
+
+ p_retm_if(NULL == data, "parameter(ct_setting_data) is NULL");
+ csetting_d->child_ug = NULL;
+
+ p_retm_if(NULL == service, "parameter(result) is NULL");
+
+ service_get_extra_data(service, "result", &val);
+ p_retm_if(NULL == val, "service_get_extra_data() return NULL");
+
+ FREEandSTRDUP(csetting_d->path, val);
+ p_retm_if(NULL == csetting_d->path, "strdup() return NULL");
+
+ free(val);
+
+ p_retm_if(csetting_d->p_info, "thread is running");
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc() return NULL");
+ csetting_d->p_info = p_info;
+ p_info->alive = true;
+ p_info->result = TRUE;
+
+ ret = pthread_create(&p_info->thread, NULL, setting_import_vcard_contacts, csetting_d);
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ csetting_d->p_info = NULL;
+ return;
+ }
+
+ p_info->timer = ecore_timer_add(CT_SETTING_TIMER_DURATION, setting_import_timer_cb, csetting_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);
+ csetting_d->p_info = NULL;
+ return;
+ }
+ csetting_d->popup = phone_progressbar_popup(csetting_d->navi, p_info, T_(CT_GET_TEXT_BASIC, CTTEXT_IMPORTING_SD_CONTACTS));
+}
+
+static void setting_import_vcard_myfile_ug(ct_setting_data *csetting_d)
+{
+ ui_gadget_h ug;
+ struct ug_cbs cbs = {0};
+ service_h service;
+
+ service_create(&service);
+ service_add_extra_data(service, "path", CT_SETTING_PHONE_PATH);
+ service_add_extra_data(service, "select_type", "IMPORT");
+ service_add_extra_data(service, "file_type", "vcf");
+
+ cbs.result_cb = setting_import_vcard_myfile_ug_result;
+ cbs.destroy_cb = setting_ug_destroy_cb;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = csetting_d;
+
+ ug = ug_create(csetting_d->ug, MYFILES_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == ug, "ug_create() Failed");
+ csetting_d->child_ug = ug;
+
+ service_destroy(service);
+}
+
+static PTHREAD_FN setting_export_sim_contacts(void *data)
+{
+ PH_FN_CALL;
+ int i;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ct_setting_data *csetting_d = data;
+
+ csetting_d->p_info->result = CONTACTS_ERROR_NONE;
+ for (i=0;i<csetting_d->list_export_ct_cnt;i++) {
+ err = contacts_sim_export_person(csetting_d->list_export_ct[i]);
+ if (CONTACTS_ERROR_NONE == err) {
+ csetting_d->p_info->cnt++;
+ }
+ else {
+ csetting_d->p_info->result = err;
+ ERR("contacts_sim_export_person() Failed(%d)", err);
+ }
+ }
+ pthread_exit(NULL);
+}
+
+static Eina_Bool setting_export_sim_timer_cb(void *data)
+{
+ PH_FN_CALL;
+ const char *message;
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info;
+ p_info = csetting_d->p_info;
+
+ double value = (double)p_info->cnt/(double)p_info->cnt_checked_total;
+ p_retvm_if(NULL == csetting_d , ECORE_CALLBACK_CANCEL, "parameter(ct_setting_data) is NULL");
+ p_info = csetting_d->p_info;
+
+ if (!p_info->completed)
+ {
+ char count[PH_TEXT_SHORT_LEN];
+ char percent[PH_TEXT_SHORT_LEN];
+ if (!p_info->alive)
+ {
+ p_info->result = FALSE;
+ p_info->completed = true;
+ return ECORE_CALLBACK_RENEW;
+ }
+ elm_progressbar_value_set(p_info->progressbar, value);
+ snprintf(percent, sizeof(percent), "%d%%", (int)(100.0*value));
+ snprintf(count, sizeof(count), "%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", count);
+
+ if(p_info->cnt == p_info->cnt_checked_total)
+ p_info->completed = true;
+
+ if(p_info->result == CONTACTS_ERROR_INTERNAL)
+ p_info->completed = true;
+
+ return ECORE_CALLBACK_RENEW;
+ }
+ pthread_join(p_info->thread, NULL);
+
+ if (CONTACTS_ERROR_NONE == p_info->result)
+ message = T_(CT_GET_TEXT_BASIC, CTTEXT_EXPORTED);
+ else
+ message = S_(PH_SYS_POP_FAILED);
+
+
+ evas_object_del(csetting_d->popup);
+ csetting_d->popup = NULL;
+
+ free(p_info);
+ csetting_d->p_info = NULL;
+
+ phone_show_tickernoti(message);
+ return ECORE_CALLBACK_CANCEL;
+}
+static void setting_export_sim(void *data, int *list, int cnt)
+{
+ PH_FN_CALL;
+ int ret;
+ ct_setting_data *csetting_d = data;
+ ph_progress_info *p_info;
+ char title[PH_TEXT_MAX_LEN] = {0,};
+
+ if (NULL == csetting_d) {
+ ERR("parameter(csetting_d) is NULL");
+ return;
+ }
+
+ if (cnt <= 0) {
+ ERR("evas_object_data_get() return NULL");
+ return;
+ }
+ if(list == NULL){
+ ERR("list is NULL");
+ return;
+ }
+ p_retm_if(csetting_d->p_info, "thread is running");
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc() return NULL");
+
+ csetting_d->p_info = p_info;
+ p_info->cnt_checked_total = csetting_d->list_export_ct_cnt = cnt;
+ int *export_list = calloc(cnt,sizeof(int));
+ memcpy(export_list,list,sizeof(int)*cnt);
+ csetting_d->list_export_ct = export_list;
+
+ p_info->alive = true;
+ p_info->result = TRUE;
+ p_info->without_cancel_btn = true;
+
+ ret = pthread_create(&p_info->thread, NULL, setting_export_sim_contacts, csetting_d );
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ csetting_d->p_info = NULL;
+ return;
+ }
+
+ p_info->timer = ecore_timer_add(CT_SETTING_TIMER_DURATION, setting_export_sim_timer_cb, csetting_d );
+ if (NULL == p_info->timer) {
+ ERR("ecore_timer_add() return NULL");
+ p_info->alive = false;
+ free(p_info);
+ csetting_d->p_info = NULL;
+ return;
+ }
+ snprintf(title, sizeof(title), T_(CT_GET_TEXT_BASIC, CTTEXT_EXPORT_TO_SIM_CARD));
+ csetting_d->popup = phone_progressbar_popup(csetting_d->navi, p_info, title);
+
+ return;
+
+}
+static void setting_import_export_sim_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ int cnt_max = 0;
+ ct_setting_data *csetting_d = data;
+ contacts_error_e err;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+
+ if (CT_SETTING_IMPORT == csetting_d->mode) {
+ setting_import_sim(csetting_d);
+ }
+ else { // CT_SETTING_EXPORT
+ err = contacts_sim_get_empty_record_count(&cnt_max);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_sim_get_empty_record_count() Failed(%d)", err);
+
+ if (0 == cnt_max) {
+ phone_show_popup(csetting_d->navi, T_(CT_GET_TEXT_ERR, CTTEXT_SIM_MEMORY_FULL), 2.0);
+ PH_DBG("cnt_max is zero");
+ return;
+ }
+ ctui_create_list_select_view(csetting_d->navi, setting_export_sim, csetting_d, CT_GET_LIST_ALL_PERSON, 0, 0, cnt_max);
+ }
+}
+
+static void setting_export_vcard_contacts(void *data, int *list, int cnt)
+{
+ int ret;
+ char title[PH_TEXT_MAX_LEN]= {0};;
+ char filepath[PH_TEXT_MAX_LEN+1]= {0};;
+ ph_progress_info *p_info;
+ ct_setting_data *csetting_d = data;
+
+ if (NULL == csetting_d) {
+ ERR("parameter(csetting_d) is NULL");
+ return;
+ }
+
+ if (cnt <= 0) {
+ ERR("evas_object_data_get() return NULL");
+ return;
+ }
+ if(list == NULL){
+ ERR("list is NULL");
+ return;
+ }
+ int *export_list = calloc(cnt,sizeof(int));
+ memcpy(export_list,list,sizeof(int)*cnt);
+ csetting_d->list_export_ct = export_list;
+ csetting_d->list_export_ct_cnt = cnt;
+
+ p_retm_if(csetting_d->p_info, "thread is running");
+
+ p_info = calloc(1, sizeof(ph_progress_info));
+ p_retm_if(NULL == p_info, "calloc() return NULL");
+ csetting_d->p_info = p_info;
+
+ p_info->cnt_checked_total = csetting_d->list_export_ct_cnt;
+ if (p_info->cnt_checked_total <= 0) {
+ char err[PH_TEXT_SHORT_LEN];
+ ERR("cnt_checked_total is %d", p_info->cnt_checked_total);
+ free(p_info);
+ free(csetting_d->list_export_ct);
+ csetting_d->p_info = NULL;
+ csetting_d->list_export_ct = NULL;
+ snprintf(err, sizeof(err), "Fail (%s)", T_(CT_GET_TEXT_ERR, CTTEXT_NO_CONTACTS));
+ phone_show_tickernoti(err);
+ return;
+ }
+ free(csetting_d->path);
+ if (SETTING_STORAGE_MEMORY_CARD == csetting_d->storage_type) {
+ csetting_d->path = setting_export_get_filename(CT_SETTING_MEMORY_CARD_PATH);
+ }
+ else{
+ csetting_d->path = setting_export_get_filename(CT_SETTING_PHONE_PATH);
+ }
+
+ p_info->alive = true;
+ p_info->result = TRUE;
+ setting_get_filename(csetting_d->path, filepath, sizeof(filepath));
+ snprintf(title, sizeof(title), T_(CT_GET_TEXT_BASIC, CTTEXT_EXPORTING_CONTACTS_TO), filepath);
+ ret = pthread_create(&p_info->thread, NULL, setting_export_contacts, csetting_d );
+ if (0 != ret) {
+ ERR("Thread creation failed(%d)", ret);
+ free(p_info);
+ free(csetting_d->list_export_ct);
+ csetting_d->p_info = NULL;
+ csetting_d->list_export_ct = NULL;
+ return;
+ }
+
+ p_info->timer = ecore_timer_add(CT_SETTING_TIMER_DURATION, setting_export_timer_cb, csetting_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);
+ free(csetting_d->list_export_ct);
+ csetting_d->p_info = NULL;
+ csetting_d->list_export_ct = NULL;
+ return;
+ }
+
+ csetting_d->popup = phone_progressbar_popup(csetting_d->navi, p_info, title);
+}
+
+static void setting_import_export_phone_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_setting_data *csetting_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ csetting_d->storage_type = SETTING_STORAGE_PHONE;
+ if (CT_SETTING_IMPORT == csetting_d->mode)
+ setting_import_vcard_myfile_ug(csetting_d);
+ else {// CT_SETTING_EXPORT
+ ctui_create_list_select_view(csetting_d->navi, setting_export_vcard_contacts, csetting_d, CT_GET_LIST_ALL_PERSON, 0, 0, 0);
+ }
+}
+
+static void setting_import_export_memory_card_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_setting_data *csetting_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ csetting_d->storage_type = SETTING_STORAGE_MEMORY_CARD;
+ if (CT_SETTING_IMPORT == csetting_d->mode)
+ setting_import_vcard_myfile_ug(csetting_d);
+ else {// CT_SETTING_EXPORT
+ ctui_create_list_select_view(csetting_d->navi, setting_export_vcard_contacts, csetting_d, CT_GET_LIST_ALL_PERSON, 0, 0, 0);
+ }
+}
+
+static void setting_import_export(ct_setting_data *csetting_d)
+{
+ int sim_state;
+ int mmc_mode = VCONFKEY_SYSMAN_MMC_REMOVED;
+ char buf[PH_TEXT_MAX_LEN+1]= {0};;
+ Evas_Object *genlist;
+ Evas_Object *l_btn;
+ Elm_Object_Item *item;
+
+ genlist = elm_genlist_add(csetting_d->navi);
+ elm_object_style_set(genlist,"dialogue");
+ vconf_get_int(VCONFKEY_TELEPHONY_SIM_PB_INIT, &sim_state);
+
+ ctui_genlist_append_separator_20px_with_line(genlist);
+
+ PH_DBG("import/export sim_state is %d",sim_state);
+ item = elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_IMPORT_EXPORT], S_(CT_SYS_BODY_SIM), NULL, ELM_GENLIST_ITEM_NONE, setting_import_export_sim_sel, csetting_d);
+ if(sim_state <= 0)
+ elm_object_item_disabled_set(item, EINA_TRUE);
+
+ if (CT_SETTING_EXPORT == csetting_d->mode) {
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_IMPORT_EXPORT], T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE), NULL, ELM_GENLIST_ITEM_NONE, setting_import_export_phone_sel, csetting_d);
+
+ item = elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_IMPORT_EXPORT], S_(CT_SYS_BODY_MEMORYCARD), NULL, ELM_GENLIST_ITEM_NONE, setting_import_export_memory_card_sel, csetting_d);
+ vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmc_mode);
+ if (mmc_mode == VCONFKEY_SYSMAN_MMC_REMOVED || mmc_mode == VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED)
+ elm_object_item_disabled_set(item, EINA_TRUE);
+ snprintf(buf, sizeof(buf), "%s", T_(CT_GET_TEXT_BASE_OP, CTTEXT_EXPORT_CONTACTS));
+ }
+ else if (CT_SETTING_IMPORT == csetting_d->mode) {
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_IMPORT_EXPORT], S_(CT_SYS_BODY_MEMORYCARD), NULL, ELM_GENLIST_ITEM_NONE, setting_import_export_phone_sel, csetting_d);
+ snprintf(buf, sizeof(buf), "%s", T_(CT_GET_TEXT_BASE_OP, CTTEXT_IMPORT_CONTACTS));
+ }
+
+ l_btn = elm_button_add(csetting_d->navi);
+ evas_object_smart_callback_add(l_btn, "clicked", phone_view_back_btn_cb, csetting_d->navi);
+ elm_object_style_set(l_btn, "naviframe/back_btn/default");
+
+ elm_naviframe_item_push(csetting_d->navi, buf, l_btn, NULL, genlist, NULL);
+}
+
+static void setting_export_contacts_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_setting_data *csetting_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+
+ csetting_d->mode = CT_SETTING_EXPORT;
+ setting_import_export(csetting_d);
+}
+
+static void setting_import_contacts_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_setting_data *csetting_d = data;
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+
+ csetting_d->mode = CT_SETTING_IMPORT;
+ setting_import_export(csetting_d);
+}
+
+static void setting_order_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (EINA_TRUE == elm_genlist_item_expanded_get(item))
+ elm_genlist_item_expanded_set(item, EINA_FALSE);
+ else
+ elm_genlist_item_expanded_set(item, EINA_TRUE);
+}
+
+static void setting_mfc_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (EINA_TRUE == elm_genlist_item_expanded_get(item))
+ elm_genlist_item_expanded_set(item, EINA_FALSE);
+ else
+ elm_genlist_item_expanded_set(item, EINA_TRUE);
+}
+
+static void setting_gl_exp(void *data, Evas_Object *obj, void *event_info)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_name_display_order_e order;
+ int mfc_option;
+ Evas_Object *genlist = obj;
+ Elm_Object_Item *it = event_info;
+ ct_setting_data *csetting_d = data;
+
+ if (evas_object_data_get(obj, "order") == it) {
+ csetting_d->radio_order = elm_radio_add(genlist);
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_FIRSTLAST],
+ (void *)CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST, it, ELM_GENLIST_ITEM_NONE,
+ setting_handle_order, (void *)CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST);
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_LASTFIRST],
+ (void *)CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST, it, ELM_GENLIST_ITEM_NONE,
+ setting_handle_order, (void *)CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST);
+
+ err = contacts_setting_get_name_display_order(&order);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_name_display_order_e() Failed(%d)", err);
+ elm_radio_value_set(csetting_d->radio_order, (int)order);
+ }
+ else if (evas_object_data_get(obj, "mfc") == it) {
+ csetting_d->radio_mfc = elm_radio_add(genlist);
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_SHOW],
+ (void *)0, it, ELM_GENLIST_ITEM_NONE,
+ setting_handle_mfc, (void *)0);
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_HIDE],
+ (void *)1, it, ELM_GENLIST_ITEM_NONE,
+ setting_handle_mfc, (void *)1);
+ mfc_option = ctui_get_mfc_option();
+ elm_radio_value_set(csetting_d->radio_mfc, mfc_option);
+ }
+
+}
+
+static void setting_gl_con(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_setting_data *csetting_d = data;
+ Elm_Object_Item *item = event_info;
+ elm_genlist_item_subitems_clear(item);
+
+ p_retm_if(NULL == csetting_d, "parameter(csetting_d) is NULL");
+
+ if (evas_object_data_get(obj, "order") == item) {
+ if(csetting_d->radio_order) {
+ evas_object_del(csetting_d->radio_order);
+ csetting_d->radio_order = NULL;
+ }
+ }
+ else if (evas_object_data_get(obj, "mfc") == item) {
+ if(csetting_d->radio_mfc) {
+ evas_object_del(csetting_d->radio_mfc);
+ csetting_d->radio_mfc = NULL;
+ }
+ }
+}
+
+static char *setting_gl_text_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (0 == strcmp(part, "elm.text"))
+ return strdup(data);
+ return NULL;
+}
+
+static char *setting_gl_order_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_name_display_order_e order;
+
+ if (0 == strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_ORDER_DISPLAY_NAME));
+ else if (0 == strcmp(part, "elm.text.2")) {
+ err = contacts_setting_get_name_display_order(&order);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_name_display_order_e() Failed(%d)", err);
+
+ if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == order)
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_FIRSTLAST));
+ else
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_LASTFIRST));
+ }
+ return NULL;
+}
+
+static char *setting_gl_mf_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (0 == strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_MOST_FREQUENT_CONTACTS));
+ else if (0 == strcmp(part, "elm.text.2")) {
+ if (0 == ctui_get_mfc_option())
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_SHOW));
+ else if (1 == ctui_get_mfc_option())
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_HIDE));
+ }
+ return NULL;
+}
+
+static char *setting_gl_mf_radio_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ int type = (int)data;
+ if (0 == strcmp(part, "elm.text")) {
+ if (0 == type)
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_SHOW));
+ else if (1 == type)
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_HIDE));
+ }
+ return NULL;
+}
+
+static char *setting_gl_radio_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type = (int)data;
+ if (0 == strcmp(part, "elm.text")) {
+ if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == type)
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_FIRSTLAST));
+ else if (CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST == type)
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_LASTFIRST));
+ }
+ return NULL;
+}
+
+static Evas_Object *setting_gl_radio_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type = (int)data;
+ ct_setting_data *csetting_d;
+
+ if (0 == strcmp(part, "elm.icon")) {
+ Evas_Object *radio;
+
+ csetting_d = evas_object_data_get(obj, "csetting_d");
+ p_retvm_if(NULL == csetting_d, NULL, "evas_object_data_get() return NULL");
+
+ radio = elm_radio_add(obj);
+ p_retvm_if(NULL == radio, NULL, "elm_radio_add() return NULL");
+
+ elm_radio_group_add(radio, csetting_d->radio_order);
+ elm_radio_state_value_set(radio, type);
+
+ return radio;
+ }
+ return NULL;
+}
+
+static Evas_Object *setting_gl_mf_radio_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ int type = (int)data;
+ ct_setting_data *csetting_d;
+
+ if (0 == strcmp(part, "elm.icon")) {
+ Evas_Object *radio;
+
+ csetting_d = evas_object_data_get(obj, "csetting_d");
+ p_retvm_if(NULL == csetting_d, NULL, "evas_object_data_get() return NULL");
+
+ radio = elm_radio_add(obj);
+ p_retvm_if(NULL == radio, NULL, "elm_radio_add() return NULL");
+
+ elm_radio_group_add(radio, csetting_d->radio_mfc);
+ elm_radio_state_value_set(radio, type);
+
+ return radio;
+ }
+ return NULL;
+}
+
+static char* setting_gl_sdn_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_sdn_list *info = data;
+ p_retvm_if(NULL == data, NULL, "The parameter(data) is NULL");
+
+ if (0 == strcmp(part, "elm.text.2"))
+ return SAFE_STRDUP(info->name);
+ else if (0 == strcmp(part, "elm.text.1"))
+ return SAFE_STRDUP(info->number);
+ return NULL;
+}
+
+static void setting_gl_sdn_del(void *data, Evas_Object *obj)
+{
+ ct_sdn_list *info = data;
+ p_retm_if(NULL == info, "parameter(info) is NULL");
+
+ free(info->name);
+ free(info->number);
+ free(info);
+}
+
+
+static inline void setting_create_itcs()
+{
+ setting_itcs[SETTING_ITC_TEXT].func.text_get = setting_gl_text_label_get;
+
+ setting_itcs[SETTING_ITC_ORDER].func.text_get = setting_gl_order_label_get;
+
+ setting_itcs[SETTING_ITC_MFC].func.text_get = setting_gl_mf_label_get;
+
+ setting_itcs[SETTING_ITC_RADIO].func.text_get = setting_gl_radio_label_get;
+ setting_itcs[SETTING_ITC_MFC_RIDIO].func.text_get = setting_gl_mf_radio_label_get;
+ setting_itcs[SETTING_ITC_RADIO].func.content_get = setting_gl_radio_icon_get;
+ setting_itcs[SETTING_ITC_MFC_RIDIO].func.content_get = setting_gl_mf_radio_icon_get;
+
+ setting_itcs[SETTING_ITC_SDN].func.text_get = setting_gl_sdn_label_get;
+ setting_itcs[SETTING_ITC_SDN].func.del = setting_gl_sdn_del;
+}
+
+static void setting_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Eina_List *l;
+ contacts_record_h record = NULL;
+ ct_setting_data *csetting_d = data;
+ p_retm_if(NULL == csetting_d, "parameter(csetting_d) is NULL");
+
+ if (csetting_d->popup)
+ evas_object_del(csetting_d->popup);
+
+ EINA_LIST_FOREACH(csetting_d->list_import_records, l, record) {
+ contacts_record_destroy(record, true);
+ }
+ eina_list_free(csetting_d->list_import_records);
+
+ if (csetting_d->p_info) {
+ csetting_d->p_info->alive = false;
+ pthread_join(csetting_d->p_info->thread, NULL);
+
+ ecore_timer_del(csetting_d->p_info->timer);
+ free(csetting_d->p_info);
+ csetting_d->p_info = NULL;
+ }
+
+ if (csetting_d->child_ug)
+ ug_destroy(csetting_d->child_ug);
+
+ free(csetting_d->path);
+ free(csetting_d);
+}
+
+static void setting_gl_sdn_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = event_info;
+ ct_sdn_list *info = elm_object_item_data_get(item);
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ phone_launch_voice_call(0, info->number);
+}
+
+
+static Evas_Object* setting_fill_sdn_view(Evas_Object *parent, ct_setting_data *csetting_d)
+{
+ Evas_Object *genlist;
+
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_list_h list = NULL;
+
+ genlist = elm_genlist_add(parent);
+ elm_object_style_set(genlist,"dialogue");
+ p_retvm_if(NULL == genlist, NULL, "elm_genlist_add() return NULL");
+
+ ctui_genlist_append_separator_20px_with_line(genlist);
+
+ err = contacts_db_get_all_records(_contacts_sdn._uri, 0, 0, &list);
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_db_get_all_records...() Failed(%d)", err);
+
+ csetting_d->cnt_sdn_list = 0;
+ while (CONTACTS_ERROR_NONE == err) {
+ ct_sdn_list *data;
+
+ data = calloc(1, sizeof(ct_sdn_list));
+ if (NULL == data) {
+ ERR("calloc() return NULL");
+ break;
+ }
+ err = phone_cts_get_str_from_list(list, _contacts_sdn.name, &(data->name));
+ 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_sdn.number, &(data->number));
+ p_warn_if(CONTACTS_ERROR_NONE != err, "phone_cts_get_str_from_list() Failed(%d)", err);
+
+ csetting_d->cnt_sdn_list++;
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_SDN], data, NULL, ELM_GENLIST_ITEM_NONE, setting_gl_sdn_sel, NULL);
+
+ 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);
+
+ return genlist;
+}
+
+static void setting_create_genlist_sdn(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *back_btn;
+ Evas_Object *genlist;
+ ct_setting_data *csetting_d = data;
+ char buf[PH_TEXT_MAX_LEN+1]= {0};;
+
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+
+ genlist = setting_fill_sdn_view(csetting_d->navi, csetting_d);
+
+ back_btn = elm_button_add(csetting_d->navi);
+ evas_object_smart_callback_add(back_btn, "clicked", phone_view_back_btn_cb, csetting_d->navi);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+
+ snprintf(buf, sizeof(buf), "%s (%d)", T_(CT_GET_TEXT_BASIC, CTTEXT_SDN), csetting_d->cnt_sdn_list);
+
+ elm_naviframe_item_push(csetting_d->navi, buf, back_btn, NULL, genlist, NULL);
+}
+
+Evas_Object* ct_setting_create_layout(ct_setting_data *csetting_d)
+{
+ unsigned int sdn_count;
+ contacts_list_h list = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *genlist;
+ Elm_Object_Item *item;
+
+ setting_create_itcs();
+
+ genlist = elm_genlist_add(csetting_d->navi);
+ elm_object_style_set(genlist,"dialogue");
+ evas_object_data_set(genlist, "csetting_d", csetting_d);
+ evas_object_event_callback_add(genlist, EVAS_CALLBACK_DEL, setting_view_delete_cb, csetting_d);
+
+ ctui_genlist_append_separator_20px_with_line(genlist);
+
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_IMPORT],
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_IMPORT_CONTACTS), NULL, ELM_GENLIST_ITEM_NONE,
+ setting_import_contacts_cb, csetting_d);
+ item = elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_ORDER],
+ NULL, NULL, ELM_GENLIST_ITEM_TREE, setting_order_item_sel, NULL);
+ evas_object_data_set(genlist, "order", item);
+
+ item = elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_MFC],
+ NULL, NULL, ELM_GENLIST_ITEM_TREE, setting_mfc_item_sel, NULL);
+ evas_object_data_set(genlist, "mfc", item);
+
+ err = contacts_db_get_all_records(_contacts_sdn._uri, 0, 0, &list);
+ if (CONTACTS_ERROR_NONE == err) {
+ err = contacts_list_get_count(list, &sdn_count);
+ if (CONTACTS_ERROR_NONE == err && sdn_count) {
+ elm_genlist_item_append(genlist, &setting_itcs[SETTING_ITC_TEXT],
+ T_(CT_GET_TEXT_BASIC, CTTEXT_SDN), NULL, ELM_GENLIST_ITEM_NONE, setting_create_genlist_sdn, csetting_d);
+ }
+ err = contacts_list_destroy(list, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_list_destroy() Failed(%d)", err);
+ }
+
+ evas_object_smart_callback_add(genlist, "expanded", setting_gl_exp, csetting_d);
+ evas_object_smart_callback_add(genlist, "contracted", setting_gl_con, csetting_d);
+
+ return genlist;
+}
+
+
diff --git a/lib/settings/ct-setting-view.h b/lib/settings/ct-setting-view.h
new file mode 100755
index 0000000..7beecd2
--- /dev/null
+++ b/lib/settings/ct-setting-view.h
@@ -0,0 +1,63 @@
+/*
+* 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_SETTING_VIEW_H__
+#define __CONTACTS_SETTING_VIEW_H__
+
+typedef struct {
+ Eina_Bool checked;
+ void *data;
+} ct_setting_gl_data;
+
+typedef struct {
+ Evas_Object *navi;
+ Evas_Object *popup;
+ Evas_Object *notify;
+ Evas_Object *radio_order;
+ Evas_Object *radio_mfc;
+ Elm_Object_Item *navi_item_main;
+
+ Evas_Object *genlist;
+
+ int cnt_sdn_list;
+ int id_ab;
+ int mode;
+ char *path;
+ ui_gadget_h ug;
+ void *child_ug;
+
+ int *list_export_ct;
+ int list_export_ct_cnt;
+
+ Eina_List *list_import_records;
+ int import_total_cnt;
+ int import_cnt;
+ int storage_type;
+ contacts_list_h import_list;
+
+ ph_progress_info *p_info;
+}ct_setting_data;
+
+typedef struct {
+ char *name;
+ char *number;
+}ct_sdn_list;
+
+
+Evas_Object* ct_setting_create_layout(ct_setting_data *csetting_d );
+
+#endif //__CONTACTS_DETAIL_VIEW_H__
diff --git a/lib/settings/mfc_option b/lib/settings/mfc_option
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/settings/mfc_option
diff --git a/lib/speed/CMakeLists.txt b/lib/speed/CMakeLists.txt
new file mode 100755
index 0000000..a0979cf
--- /dev/null
+++ b/lib/speed/CMakeLists.txt
@@ -0,0 +1,16 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TARGET ${SPEEDDIAL})
+
+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} ${ug_pkgs_LDFLAGS})
+
+ADD_DEPENDENCIES(${TARGET} speeddial_theme_build)
+
+INSTALL(TARGETS ${TARGET} DESTINATION ${UGLIBDIR})
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/speed/speeddial-efl.xml DESTINATION "/usr/share/packages")
diff --git a/lib/speed/include/phone-speed.h b/lib/speed/include/phone-speed.h
new file mode 100755
index 0000000..337f00e
--- /dev/null
+++ b/lib/speed/include/phone-speed.h
@@ -0,0 +1,25 @@
+/*
+* 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_SPEED_H__
+#define __PHONE_SPEED_H__
+
+#include "phone-common.h"
+
+Evas_Object *phone_create_speeddial_view(void *ug, Evas_Object *win, Evas_Object *navi);
+
+#endif //__PHONE_SPEED_H__
diff --git a/lib/speed/ph-speeddial-main.c b/lib/speed/ph-speeddial-main.c
new file mode 100755
index 0000000..24d590c
--- /dev/null
+++ b/lib/speed/ph-speeddial-main.c
@@ -0,0 +1,203 @@
+/*
+* 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 <bundle.h>
+
+#include "phone.h"
+#include "phone-common.h"
+#include "ph-speeddial-view.h"
+
+// for removing build warning ////////////////////////////////////
+int service_export_as_bundle(service_h service, bundle **data);
+////////////////////////////////////////////////////////
+
+static bool speed_create_ug_view(ph_speeddial_data * speed_d, Evas_Object *base)
+{
+ p_retvm_if(NULL == speed_d, false, "Parameter is null");
+
+ if (NULL == speed_d->navi) {
+ speed_d->navi = elm_naviframe_add(base);
+ p_retvm_if(NULL == speed_d->navi, false, "elm_naviframe_add is failed");
+ elm_object_part_content_set(base, "elm.swallow.content", speed_d->navi);
+ evas_object_show(speed_d->navi);
+ }
+
+ speed_d->layout = ph_speed_create_content(speed_d->navi, speed_d);
+ p_retvm_if(NULL == speed_d->layout, false, "Fail to ph_speed_create_content");
+
+ return true;
+}
+
+static void *speed_on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ Evas_Object *bg;
+ Evas_Object *base;
+ Evas_Object *parent;
+ ph_speeddial_data *speed_d;
+
+ if (!ug || !priv)
+ return NULL;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ parent = ug_get_parent_layout(ug);
+ if (!parent)
+ return NULL;
+
+ speed_d = priv;
+ speed_d->ug = ug;
+ speed_d->win = ug_get_window();
+ speed_d->is_ug = true;
+
+ err = contacts_connect2();
+ p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_connect2() Failed(%d)", err);
+
+ if (mode==UG_MODE_FULLVIEW)
+ base = phone_create_base_layout(parent, true);
+ else
+ base = phone_create_base_layout(parent, false);
+
+ bg = phone_create_bg(base);
+ if (NULL == bg) {
+ PH_DBG("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 (!speed_create_ug_view(speed_d, base)) {
+ evas_object_del(base);
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ }
+ return base;
+}
+
+static void speed_on_start(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+static void speed_on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+static void speed_on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+}
+
+static void speed_on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ if (!ug)
+ return;
+
+ evas_object_del(ug_get_layout(ug));
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+}
+
+static void speed_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+static void speed_on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ switch (event) {
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ break;
+ default:
+ break;
+ }
+}
+
+static void speed_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h data, void *priv)
+{
+ PH_FN_CALL;
+ if (!ug)
+ return;
+
+ switch (event) {
+ case UG_KEY_EVENT_END:
+ ug_destroy_me(ug);
+ break;
+ default:
+ break;
+ }
+}
+
+API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ ph_speeddial_data *speed_d;
+
+ if (!ops)
+ return -1;
+
+ speed_d = calloc(1, sizeof(ph_speeddial_data));
+ if (!speed_d)
+ return -1;
+
+ ops->create = speed_on_create;
+ ops->start = speed_on_start;
+ ops->pause = speed_on_pause;
+ ops->resume = speed_on_resume;
+ ops->destroy = speed_on_destroy;
+ ops->message = speed_on_message;
+ ops->event = speed_on_event;
+ ops->key_event = speed_on_key_event;
+ ops->priv = speed_d;
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+
+ return 0;
+}
+
+API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ PH_FN_END;
+ if (!ops)
+ return;
+
+ ops->priv = NULL;
+}
+
+API Evas_Object *phone_create_speeddial_view(void *ug, Evas_Object *win, Evas_Object *navi)
+{
+ ph_speeddial_data * speed_d = calloc(1, sizeof(ph_speeddial_data));
+ p_retvm_if(NULL == speed_d, NULL, "Faile to calloc ph_speeddial_data");
+
+ speed_d->ug = ug;
+ speed_d->is_ug = false;
+ speed_d->win = win;
+ speed_d->navi = navi;
+ speed_d->layout = ph_speed_create_content(navi, speed_d);
+ if (NULL == speed_d->layout) {
+ free(speed_d);
+ return NULL;
+ }
+
+ return speed_d->layout;
+}
+
diff --git a/lib/speed/ph-speeddial-view.c b/lib/speed/ph-speeddial-view.c
new file mode 100755
index 0000000..15bbc59
--- /dev/null
+++ b/lib/speed/ph-speeddial-view.c
@@ -0,0 +1,588 @@
+/*
+* 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 <Ecore_X.h>
+#include <ui-gadget-module.h>
+
+#include "phone.h"
+#include "phone-common.h"
+#include "ph-speeddial-view.h"
+
+#define KEY_SPEED_DATA "speed_d"
+#define SPEED_VOICE_MAIL_NUM 1
+
+static Elm_Gengrid_Item_Class grid_itc, grid_itc_empty;
+
+enum{
+ PH_SPEED_MODE_DEFAULT,
+ PH_SPEED_MODE_EDIT,
+};
+
+static void speed_edit_mode_start(ph_speeddial_data * speed_d);
+static void speed_edit_mode_end(ph_speeddial_data * speed_d);
+
+static int speed_set_speeddial(int spdial_num, int number_id)
+{
+ contacts_record_h spd_record = NULL;
+ int ret_id = 0;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ contacts_record_create( _contacts_speeddial._uri, &spd_record );
+
+ err = contacts_record_set_int(spd_record, _contacts_speeddial.speeddial_number, spdial_num);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_int(spd_record, _contacts_speeddial.number_id, number_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_db_insert_record(spd_record, &ret_id);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_insert_record() Failed(%d)", err);
+
+ contacts_record_destroy(spd_record, true);
+ return err;
+}
+
+static int speed_unset_speeddial(int spdial_num)
+{
+ return contacts_db_delete_record( _contacts_speeddial._uri, spdial_num);
+}
+
+static void speed_update_button_status(ph_speeddial_data *speed_d)
+{
+ p_retm_if(NULL == speed_d, "Parameter is null");
+ p_retm_if(NULL == speed_d->ctrl_item, "Navi button is null");
+
+ if ((false == speed_d->is_edit_mode && 0 == speed_d->speeddial_list_count)
+ || (true == speed_d->is_edit_mode && 0 == speed_d->checked_cnt))
+ elm_object_disabled_set(speed_d->ctrl_item, EINA_TRUE);
+ else
+ elm_object_disabled_set(speed_d->ctrl_item, EINA_FALSE);
+}
+
+static void speed_load_list(ph_speeddial_data *speed_d)
+{
+ p_retm_if(NULL == speed_d, "Parameter is null");
+
+ phone_free_speeddial_data(speed_d->speeddial_list);
+ speed_d->speeddial_list_count = 0;
+ speed_d->speeddial_list = phone_load_speeddial_data(&(speed_d->speeddial_list_count));
+}
+
+static void speed_popup_response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_speeddial_data *speed_d = data;
+ evas_object_del(speed_d->popup);
+ speed_d->popup = NULL;
+}
+
+static void speed_add_start_cb(void *data, void *data2)
+{
+ PH_FN_CALL;
+ ph_speeddial_data *speed_d = data;
+ int *number_id = data2;
+ int ret;
+
+ p_retm_if(NULL == speed_d, "speed data is null");
+ p_retm_if(*number_id <= 0, "returned number_id is less than 0");
+ p_retm_if(20 < speed_d->cur_dial_num, "current dial num is higher than 20");
+
+ ret = speed_set_speeddial(speed_d->cur_dial_num, *number_id);
+ if (ret < 0)
+ phone_show_popup(speed_d->navi, S_(PH_SYS_POP_ALREDY_EXISTS), 2.0);
+}
+
+static void speed_destroy_child_ug(void *data)
+{
+ ph_speeddial_data *speed_d = data;
+ speed_d->child_ug = NULL;
+}
+
+static void speed_grid_empty_selected(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_speeddial_data * speed_d = evas_object_data_get(obj, KEY_SPEED_DATA);
+ int index = (int)data;
+ p_retm_if(true == speed_d->is_edit_mode, "It is in Edit mode");
+ elm_gengrid_item_selected_set(event_info, EINA_FALSE);
+
+ speed_d->cur_dial_num = index;
+ speed_d->child_ug = phone_launch_contact_list_ug(speed_d->ug, CT_UG_REQUEST_SELECT_NUMBER,
+ speed_add_start_cb, speed_destroy_child_ug, speed_d);
+}
+
+static void speed_change_start_cb(void *data, void *data2)
+{
+ PH_FN_CALL;
+ ph_speeddial_data *speed_d = data;
+ int *number_id = data2;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ p_retm_if(NULL == speed_d, "speed data is null");
+ p_retm_if(*number_id <= 0, "returned number_id is less than 0");
+ p_retm_if(20 < speed_d->cur_dial_num, "current dial num is higher than 20");
+ speed_unset_speeddial(speed_d->cur_dial_num);
+ err = speed_set_speeddial(speed_d->cur_dial_num, *number_id);
+ if (CONTACTS_ERROR_NONE != err) {
+ phone_show_popup(speed_d->navi, S_(PH_SYS_POP_ALREDY_EXISTS), 1.5);
+ }
+}
+
+static void speed_grid_change_contact(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_speeddial_data *speed_d = data;
+ p_retm_if(NULL== speed_d, "Speeddial data is null");
+
+ speed_popup_response_cb(speed_d, NULL, NULL);
+ speed_d->child_ug = phone_launch_contact_list_ug(speed_d->ug, CT_UG_REQUEST_SELECT_NUMBER,
+ speed_change_start_cb, speed_destroy_child_ug, speed_d);
+}
+
+static void speed_grid_remove_speeddial(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ ph_speeddial_data *speed_d = data;
+ speed_popup_response_cb(speed_d, NULL, NULL);
+ err = speed_unset_speeddial(speed_d->cur_dial_num);
+ if (CONTACTS_ERROR_NONE != err)
+ phone_show_tickernoti(S_(PH_SYS_POP_FAILED));
+ else
+ phone_show_tickernoti(S_(PH_SYS_POP_REMOVED));
+}
+
+static void speed_grid_item_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_speeddial_info *s_info = data;
+ ph_speeddial_data *speed_d = evas_object_data_get(obj, KEY_SPEED_DATA);
+ Evas_Object *popup;
+ Evas_Object *list;
+ Evas_Object *btn;
+
+ p_retm_if(true == speed_d->is_edit_mode, "It is in Edit mode");
+ elm_gengrid_item_selected_set(event_info, EINA_FALSE);
+
+ p_retm_if(NULL == s_info, "speeddial info is null");
+ if (SPEED_VOICE_MAIL_NUM == s_info->dial_number)
+ return;
+
+ speed_d->cur_dial_num = s_info->dial_number;
+ popup = elm_popup_add(speed_d->win);
+ elm_object_style_set(popup, "min_liststyle");
+ elm_object_part_text_set(popup, "title,text", S_(PH_SYS_SK_EDIT));
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ list = elm_list_add(popup);
+ elm_list_item_append(list, T_(PH_GET_TEXT_BASE_OP, PHTEXT_CHANGE_CONTACT),
+ NULL, NULL, speed_grid_change_contact, speed_d);
+ elm_list_item_append(list, S_(PH_SYS_BODY_REMOVE),
+ NULL, NULL, speed_grid_remove_speeddial, speed_d);
+ elm_list_mode_set(list, ELM_LIST_EXPAND);
+ elm_object_content_set(popup, list);
+
+ 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", speed_popup_response_cb, speed_d);
+
+ speed_d->popup = popup;
+ evas_object_show(popup);
+}
+
+static void speed_fill_gengrid(ph_speeddial_data *speed_d)
+{
+ int i;
+ p_retm_if(NULL == speed_d, "Parameter is null");
+
+ for(i = 1 ; i < 10; i++) {
+ Eina_List *l=NULL;
+ bool is_find = false;
+ ph_speeddial_info *cd = NULL;
+
+ EINA_LIST_FOREACH(speed_d->speeddial_list, l, cd) {
+ if (!cd) continue;
+ if (cd->dial_number == i) {
+ is_find = true;
+ break;
+ }
+ }
+ if (is_find)
+ elm_gengrid_item_append(speed_d->gengrid, &grid_itc, cd, speed_grid_item_sel, cd);
+ else
+ elm_gengrid_item_append(speed_d->gengrid, &grid_itc_empty, (void*)i, speed_grid_empty_selected, (void*)i);
+ }
+ evas_object_show(speed_d->gengrid);
+}
+
+static void speed_data_list_changed_cb(const char* view_uri, void* data)
+{
+ PH_FN_CALL;
+ ph_speeddial_data *speed_d = data;
+ p_retm_if(NULL == speed_d, "Parameter is null");
+ if (speed_d->gengrid) {
+ speed_d->checked_cnt = 0;
+ speed_load_list(speed_d);
+ elm_gengrid_clear(speed_d->gengrid);
+ speed_fill_gengrid(speed_d);
+ speed_update_button_status(speed_d);
+ }
+ PH_FN_END;
+}
+
+static char *speed_grid_empty_label_get(void *data, Evas_Object *obj, const char *part )
+{
+ if (0 == strcmp(part, "elm.text.number")) {
+ int index = (int)data;
+ char buf[PATH_MAX]={0};
+ snprintf(buf, sizeof(buf), "%d", index);
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static char *speed_grid_label_get(void *data, Evas_Object *obj, const char *part )
+{
+ char buf[PATH_MAX]={0};
+ ph_speeddial_info * s_info = data;
+
+ p_retvm_if(NULL == s_info, NULL, "speeddial info is null");
+
+ if (0 == strcmp(part, "elm.text.number")) {
+ if (SPEED_VOICE_MAIL_NUM == s_info->dial_number)
+ return NULL;
+ snprintf(buf, sizeof(buf), "%d", s_info->dial_number);
+ return strdup(buf);
+ }
+ else if (0 == strcmp(part, "elm.text")) {
+ if (s_info->display && *s_info->display)
+ snprintf(buf, sizeof(buf), "%s", s_info->display);
+ else if (s_info->ph_number && *s_info->ph_number)
+ snprintf(buf, sizeof(buf), "%s", s_info->ph_number);
+ else
+ return NULL;
+ return strdup(buf);
+ }
+ return NULL;
+}
+
+static void speed_del_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_speeddial_data *speed_d = data;
+ ph_speeddial_info *s_info = NULL;
+ Eina_List *l;
+ bool deleted = false;
+
+ EINA_LIST_FOREACH(speed_d->speeddial_list, l, s_info) {
+ if (!s_info) continue;
+ if (EINA_TRUE == s_info->is_checked) {
+ PH_DBG("%d", s_info->dial_number);
+ speed_unset_speeddial(s_info->dial_number);
+ deleted = true;
+ }
+ }
+
+ if (deleted){
+ phone_hide_notify(speed_d->layout);
+ phone_show_tickernoti(S_(PH_SYS_POP_REMOVED));
+ }
+
+ speed_edit_mode_end(speed_d);
+}
+
+static void speed_edit_set_selection_info(void *data)
+{
+ ph_speeddial_data *speed_d = data;
+ p_retm_if(NULL == speed_d, "Selection info is null");
+
+ if (0 == speed_d->checked_cnt)
+ phone_hide_notify(speed_d->layout);
+ else {
+ char info_text[PH_TEXT_SHORT_LEN]={0};
+ snprintf(info_text, sizeof(info_text), "%s (%d)", S_(PH_SYS_POP_SELECTED),
+ speed_d->checked_cnt);
+ phone_show_notify(speed_d->layout, info_text);
+ }
+}
+
+static void speed_edit_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_speeddial_data *speed_d = data;
+ if (elm_check_state_get(obj))
+ speed_d->checked_cnt++;
+ else
+ speed_d->checked_cnt--;
+ speed_edit_set_selection_info(speed_d);
+ speed_update_button_status(speed_d);
+}
+
+static Evas_Object *speed_grid_content_get(void *data, Evas_Object *obj, const char *part )
+{
+ ph_speeddial_info *s_info = data;
+ p_retvm_if(NULL == s_info, NULL, "parameter is null");
+ ph_speeddial_data *speed_d = evas_object_data_get(obj, KEY_SPEED_DATA);
+
+ if ((0 == strcmp(part, "elm.thumbnail")) || (0 == strcmp(part, "elm.swallow.icon"))) {
+ Evas_Object *ic;
+ if (s_info->img_path)
+ ic = phone_create_icon_with_img(obj, s_info->img_path);
+ else
+ ic = phone_create_icon_with_img(obj, IMG_DEFAULT);
+ if (SPEED_VOICE_MAIL_NUM == s_info->dial_number)
+ elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ return ic;
+ }
+ else if (0 == strcmp(part, "elm.swallow.check.icon") && speed_d->is_edit_mode) {
+ Evas_Object *btn;
+ if (SPEED_VOICE_MAIL_NUM == s_info->dial_number)
+ return NULL;
+ btn = elm_check_add(obj);
+ elm_object_style_set(btn, "grid");
+ elm_check_state_pointer_set(btn, &(s_info->is_checked));
+ evas_object_smart_callback_add(btn, "changed", speed_edit_check_changed_cb, speed_d);
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ return btn;
+ }
+ return NULL;
+}
+
+static void speed_edit_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item;
+ ph_speeddial_data *speed_d = data;
+ ph_speeddial_info *s_info;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(speed_d->speeddial_list, l, s_info) {
+ if (!s_info) continue;
+ s_info->is_checked = EINA_FALSE;
+ }
+ speed_d->checked_cnt = 0;
+ phone_hide_notify(speed_d->layout);
+ speed_edit_mode_end(speed_d);
+
+ item = elm_gengrid_first_item_get(speed_d->gengrid);
+ while (item) {
+ elm_gengrid_item_update(item);
+ item = elm_gengrid_item_next_get(item);
+ }
+}
+
+static void speed_edit_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ph_speeddial_data *speed_d = data;
+ speed_edit_mode_start(speed_d);
+}
+
+static void speed_navi_set(int mode, ph_speeddial_data *speed_d)
+{
+ Elm_Object_Item *navi_it;
+ Evas_Object *back_btn, *toolbar_btn;
+
+ p_retm_if(NULL == speed_d, "parameter(controlbar) is NULL");
+
+ navi_it = elm_naviframe_top_item_get(speed_d->navi);
+ p_retm_if(NULL == navi_it, "navi item is NULL");
+
+ if (speed_d->navi) {
+ phone_navi_item_clear(speed_d->navi_item);
+ }
+
+ back_btn = elm_button_add(speed_d->navi);
+ elm_object_item_part_content_set(speed_d->navi_item, "prev_btn", back_btn);
+
+ switch (mode) {
+ case PH_SPEED_MODE_DEFAULT:
+ toolbar_btn = phone_create_toolbar_btn(speed_d->navi, S_(PH_SYS_SK_DELETE), speed_edit_btn_cb, speed_d);
+ elm_object_item_part_content_set(speed_d->navi_item, "toolbar_button1", toolbar_btn);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ if (speed_d->is_ug)
+ evas_object_smart_callback_add(back_btn, "clicked", phone_ug_destroy_me_cb, speed_d->ug);
+ else
+ evas_object_smart_callback_add(back_btn, "clicked", phone_view_back_btn_cb, speed_d->navi);
+
+ break;
+ case PH_SPEED_MODE_EDIT:
+ toolbar_btn = phone_create_toolbar_btn(speed_d->navi, S_(PH_SYS_SK_DELETE), speed_del_btn_cb, speed_d);
+ elm_object_item_part_content_set(speed_d->navi_item, "toolbar_button1", toolbar_btn);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", speed_edit_back_btn_cb, speed_d);
+ break;
+ default:
+ return;
+ }
+ if(toolbar_btn)
+ speed_d->ctrl_item = toolbar_btn;
+ speed_update_button_status(speed_d);
+}
+
+static void speed_edit_mode_start(ph_speeddial_data *speed_d)
+{
+ Elm_Object_Item *item;
+
+ speed_d->is_edit_mode = true;
+
+ item = elm_gengrid_first_item_get(speed_d->gengrid);
+ while (item) {
+ elm_gengrid_item_update(item);
+ item = elm_gengrid_item_next_get(item);
+ }
+ elm_object_item_part_text_set(speed_d->navi_item, "elm.text.title", T_(PH_GET_TEXT_BASE_OP, PHTEXT_SELECT_SPEED_DIAL_CONTACTS));
+ speed_navi_set(PH_SPEED_MODE_EDIT, speed_d);
+}
+
+static void speed_edit_mode_end(ph_speeddial_data *speed_d)
+{
+ Evas_Object *back_btn;
+
+ speed_d->is_edit_mode = false;
+ back_btn = elm_button_add(speed_d->layout);
+ if (speed_d->is_ug)
+ evas_object_smart_callback_add(back_btn, "clicked", phone_ug_destroy_me_cb, speed_d->ug);
+ else
+ evas_object_smart_callback_add(back_btn, "clicked", phone_view_back_btn_cb, speed_d->navi);
+
+ elm_object_item_part_content_set(speed_d->navi_item, "prev_btn", back_btn);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+
+ elm_object_item_part_text_set(speed_d->navi_item, "elm.text.title", T_(PH_GET_TEXT_BASIC, PHTEXT_SPEEDDIAL));
+ speed_navi_set(PH_SPEED_MODE_DEFAULT, speed_d);
+}
+
+static Evas_Object* speed_create_gengrid(ph_speeddial_data *speed_d, Evas_Object *parent)
+{
+ Evas_Object *gengrid;
+ int wx = 0;
+ int hy = 0;
+
+ p_retvm_if(NULL == speed_d, NULL, "Parameter is null");
+
+ gengrid = elm_gengrid_add(parent);
+ p_retvm_if(NULL == gengrid, NULL, "elm_gengrid_add is failed");
+ elm_object_theme_set(gengrid, speed_d->th);
+
+ ecore_x_window_size_get(ecore_x_window_root_get(ecore_x_window_focus_get()), &wx, &hy);
+ elm_gengrid_item_size_set(gengrid, wx/3, 273);
+ elm_gengrid_align_set(gengrid, 0.5, 0.0);
+ elm_gengrid_horizontal_set(gengrid, EINA_FALSE);
+ elm_gengrid_bounce_set(gengrid, EINA_FALSE, EINA_TRUE);
+ elm_gengrid_multi_select_set(gengrid, EINA_TRUE);
+
+ evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ grid_itc_empty.item_style = "gridtext_speeddial";
+ grid_itc_empty.func.text_get = speed_grid_empty_label_get;
+ grid_itc_empty.func.content_get = NULL;
+ grid_itc_empty.func.state_get = NULL;
+ grid_itc_empty.func.del = NULL;
+
+ grid_itc.item_style = "gridtext_speeddial";
+ grid_itc.func.text_get = speed_grid_label_get;
+ grid_itc.func.content_get = speed_grid_content_get;
+ grid_itc.func.state_get = NULL;
+ grid_itc.func.del = NULL;
+
+ evas_object_data_set(gengrid, KEY_SPEED_DATA, speed_d);
+
+ return gengrid;
+}
+
+static void speed_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ph_speeddial_data *speed_d = data;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ p_retm_if(NULL == speed_d, "speed data is null");
+
+ err = contacts_db_remove_changed_cb(_contacts_person._uri, speed_data_list_changed_cb, speed_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+ err = contacts_db_remove_changed_cb(_contacts_speeddial._uri, speed_data_list_changed_cb, speed_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_remove_changed_cb() Failed(%d)", err);
+
+ if (speed_d->speeddial_list)
+ phone_free_speeddial_data(speed_d->speeddial_list);
+
+ if (speed_d->th) {
+ elm_theme_extension_del(speed_d->th, SPEEDDIAL_THEME_EDJ);
+ elm_theme_free(speed_d->th);
+ }
+
+ if (speed_d->popup)
+ evas_object_del(speed_d->popup);
+
+ if (!speed_d->ug && speed_d->child_ug)
+ ug_destroy(speed_d->child_ug);
+
+ free(speed_d);
+ PH_FN_END;
+}
+
+static int speed_create_layout(ph_speeddial_data *speed_d)
+{
+ Evas_Object *layout;
+ Evas_Object *base;
+ Evas_Object *gengrid;
+
+ base = elm_layout_add(speed_d->navi);
+ p_retvm_if(NULL == base, 0, "elm_layout_add() return NULL");
+ elm_layout_file_set(base, SELECTION_INFO_EDJ, "selectioninfo_layout");
+
+ layout = phone_create_base_layout(base, false);
+ p_retvm_if(NULL == layout, 0, "fail : phone_create_base_layout");
+ elm_object_part_content_set(base, "contents", layout);
+ speed_d->layout = base;
+
+ gengrid = speed_create_gengrid(speed_d, layout);
+ p_retvm_if(NULL == gengrid, 0, "fail : _create_check_gengrid");
+ speed_d->gengrid = gengrid;
+ elm_object_part_content_set(layout, "elm.swallow.content", gengrid);
+
+ speed_load_list(speed_d);
+ speed_fill_gengrid(speed_d);
+
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL,
+ speed_view_delete_cb, speed_d);
+ return 1;
+}
+
+Evas_Object *ph_speed_create_content(Evas_Object *parent, ph_speeddial_data *speed_d)
+{
+ Elm_Theme *th;
+ int ret;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, SPEEDDIAL_THEME_EDJ);
+ speed_d->th = th;
+
+ ret = speed_create_layout(speed_d);
+ p_retvm_if(0 == ret, NULL, "speed_create_layout is failed");
+
+ speed_d->navi_item = elm_naviframe_item_push(speed_d->navi, T_(PH_GET_TEXT_BASIC, PHTEXT_SPEEDDIAL), NULL,
+ NULL, speed_d->layout, NULL);
+
+
+ speed_navi_set(PH_SPEED_MODE_DEFAULT, speed_d);
+
+ err = contacts_db_add_changed_cb(_contacts_person._uri, speed_data_list_changed_cb, speed_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+ err = contacts_db_add_changed_cb(_contacts_speeddial._uri, speed_data_list_changed_cb, speed_d);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_add_changed_cb() Failed(%d)", err);
+
+ return speed_d->layout;
+}
diff --git a/lib/speed/ph-speeddial-view.h b/lib/speed/ph-speeddial-view.h
new file mode 100755
index 0000000..6b1535b
--- /dev/null
+++ b/lib/speed/ph-speeddial-view.h
@@ -0,0 +1,43 @@
+/*
+* 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 __SPEEDDIAL_VIEW_H__
+#define __SPEEDDIAL_VIEW_H__
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *layout;
+ Evas_Object *gengrid;
+ Evas_Object *popup;
+ Elm_Object_Item *navi_item;
+ Evas_Object *ctrl_item;
+ Eina_List *speeddial_list;
+ int cur_dial_num;
+ int checked_cnt;
+ int speeddial_list_count;
+ Elm_Theme *th;
+ void *ug;
+ void *child_ug;
+ bool is_ug;
+ bool is_edit_mode;
+}ph_speeddial_data;
+
+Evas_Object *ph_speed_create_content(Evas_Object *parent, ph_speeddial_data *speed_d);
+
+#endif /* __SPEEDDIAL_VIEW_H__ */
diff --git a/lib/speed/speeddial-efl.xml b/lib/speed/speeddial-efl.xml
new file mode 100644
index 0000000..b807660
--- /dev/null
+++ b/lib/speed/speeddial-efl.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="speeddial-efl" version="0.1.0-0" install-location="internal-only">
+ <label>speeddial</label>
+ <author email="ensung.park@samsung.com" href="www.samsung.com">ensung park</author>
+ <description>speeddial-efl Application</description>
+ <ui-application appid="speeddial-efl" exec="/usr/ug/bin/speeddial-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>org.tizen.contacts.png</icon>
+ <label>speeddial</label>
+ <label xml:lang="en-us">speeddial</label>
+ <label xml:lang="nl-nl">speeddial</label>
+ <label xml:lang="de-de">speeddial</label>
+ <label xml:lang="en-gb">speeddial</label>
+ <label xml:lang="zh-hk">speeddial</label>
+ <label xml:lang="zh-cn">speeddial</label>
+ <label xml:lang="ru-ru">speeddial</label>
+ <label xml:lang="zh-tw">speeddial</label>
+ <label xml:lang="ja-jp">speeddial</label>
+ <label xml:lang="es-es">speeddial</label>
+ <label xml:lang="el-gr">speeddial</label>
+ <label xml:lang="it-it">speeddial</label>
+ <label xml:lang="tr-tr">speeddial</label>
+ <label xml:lang="pt-pt">speeddial</label>
+ <label xml:lang="fr-fr">speeddial</label>
+ <label xml:lang="ko-kr">speeddial</label>
+ <application-service>
+ <operation name="http://tizen.org/ns/packages"/>
+ </application-service>
+ </ui-application>
+</manifest>