add print function
authorJisung Ahn <jcastle.ahn@samsung.com>
Sat, 30 Mar 2013 02:30:52 +0000 (11:30 +0900)
committerJisung Ahn <jcastle.ahn@samsung.com>
Sat, 30 Mar 2013 02:30:52 +0000 (11:30 +0900)
Change-Id: I5fb352fdf5840ccbcf89d8d9d3368545903419b3

feature/include/ivug-ext-ug.h
feature/src/ivug-ext-ug.c
main/src/view/ivug-main-view-menu.cpp

index e1031ae..fa66335 100755 (executable)
@@ -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);
index 8a24186..8b79a34 100755 (executable)
@@ -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);
+}
+
index a32e5c3..0b17791 100755 (executable)
@@ -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)
        {