From: Jisung Ahn Date: Sat, 30 Mar 2013 02:30:52 +0000 (+0900) Subject: add print function X-Git-Tag: 2.1b_release~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0f89e0301453a9e37dee5ffc63f0420f428979b;p=apps%2Fcore%2Fpreloaded%2Fug-image-viewer-efl.git add print function Change-Id: I5fb352fdf5840ccbcf89d8d9d3368545903419b3 --- diff --git a/feature/include/ivug-ext-ug.h b/feature/include/ivug-ext-ug.h index e1031ae..fa66335 100755 --- a/feature/include/ivug-ext-ug.h +++ b/feature/include/ivug-ext-ug.h @@ -46,10 +46,6 @@ ui_gadget_h ivug_ext_launch_select_contact(ug_result_cb result_func, ug_destroy bool ivug_ext_launch_browser(const char *uri); bool ivug_ext_launch_email(const char *uri); - -/* - Below functions are not used at Now, but should be needed soon. -*/ bool ivug_ext_launch_print(const char *uri); bool ivug_ext_launch_default(const char *uri, const char *operation, const char *pkg, void *data); diff --git a/feature/src/ivug-ext-ug.c b/feature/src/ivug-ext-ug.c index 8a24186..8b79a34 100755 --- a/feature/src/ivug-ext-ug.c +++ b/feature/src/ivug-ext-ug.c @@ -998,3 +998,72 @@ LAUNCH_END: return (ret == SERVICE_ERROR_NONE ? true : false); } +bool ivug_ext_launch_print(const char *uri) +{ + MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri); + + int ret = -1; + int destroy_ret = -1; + const char *pkgname = PRINT_PKG_NAME; + + if(uri == NULL) + { + MSG_IMAGEVIEW_ERROR("URI is NULL"); + return false; + } + + service_h handle; + + ret = service_create(&handle); + if(ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_create failed, %d", ret); + return false; + } + + ret = service_set_operation(handle, OPERATION_NAME_PRINT); + if(ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_set_operation failed, %d", ret); + goto PRINT_END; + } + + ret = service_set_package(handle, pkgname); + if(ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_set_package failed, %d", ret); + goto PRINT_END; + } + + ret = service_set_uri (handle, uri); + if(ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_set_uri failed, %d", ret); + goto PRINT_END; + } + + ret = service_add_extra_data(handle, SERVICE_PRINT_FILES_TYPE, "IMG"); + if(ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_add_extra_data failed, %d", ret); + goto PRINT_END; + } + + ret = service_send_launch_request(handle, ivug_ext_service_reply_cb, NULL); + if(ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_send_launch_request failed, %d", ret); + goto PRINT_END; + } + +PRINT_END: + destroy_ret = service_destroy(handle); + if(destroy_ret != SERVICE_ERROR_NONE) + { + MSG_IMAGEVIEW_ERROR("service_destroy failed, %d", destroy_ret); + return false; + } + + return (ret == SERVICE_ERROR_NONE ? true : false); +} + diff --git a/main/src/view/ivug-main-view-menu.cpp b/main/src/view/ivug-main-view-menu.cpp index a32e5c3..0b17791 100755 --- a/main/src/view/ivug-main-view-menu.cpp +++ b/main/src/view/ivug-main-view-menu.cpp @@ -1882,6 +1882,21 @@ static void _on_more_selected(void *data, Evas_Object *obj, void *event_info) { on_btn_tag_clicked(data, obj, event_info); } + else if(strncmp(label, IDS_PRINT, strlen(label)) == 0) + { + Media_Item *WMitem = ivug_slider_get_item(pMainView->slider); + Media_Data *mdata = ivug_medialist_get_data(WMitem); + + if (mdata == NULL) + { + MSG_MAIN_ERROR("slider data is NULL"); + evas_object_del(pMainView->ctx_popup); + pMainView->ctx_popup = NULL; + ivug_main_view_set_hide_timer(pMainView); + return; + } + ivug_ext_launch_print(mdata->filepath); + } evas_object_del(pMainView->ctx_popup); pMainView->ctx_popup = NULL; @@ -1935,6 +1950,8 @@ void on_btn_more_clicked(void *data, Evas_Object *obj, void *event_info) ivug_listpopup_item_append(popup, NULL, IDS_ROTATE_RIGHT, IDS_ROTATE_RIGHT); } } + + ivug_listpopup_item_append(popup, NULL, IDS_PRINT, IDS_PRINT); } else if(mdata->slide_type == SLIDE_TYPE_VIDEO) {