From 715f938d016aa9b028da19cd71d7ed0ce548940d Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Thu, 17 Nov 2016 14:57:40 +0900 Subject: [PATCH] Add more app_control data to open image files Change-Id: I9a489e5c25c9681832e26e968d4869389477f4d4 Signed-off-by: DoHyun Pyun --- packaging/org.tizen.bluetooth-share-ui.spec | 2 +- src/bt-share-ui-view.c | 39 +++++++++++++++++++++++++++++ src/bt-share-ui-view.h | 10 ++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/packaging/org.tizen.bluetooth-share-ui.spec b/packaging/org.tizen.bluetooth-share-ui.spec index 158a163..6fa42be 100755 --- a/packaging/org.tizen.bluetooth-share-ui.spec +++ b/packaging/org.tizen.bluetooth-share-ui.spec @@ -3,7 +3,7 @@ Name: org.tizen.bluetooth-share-ui Summary: bluetooth share UI application -Version: 0.1.0 +Version: 0.2.1 Release: 1 Group: TO_BE_FILLED License: Flora-1.1 diff --git a/src/bt-share-ui-view.c b/src/bt-share-ui-view.c index 6a5c20b..a3a73c5 100644 --- a/src/bt-share-ui-view.c +++ b/src/bt-share-ui-view.c @@ -966,16 +966,55 @@ Evas_Object *__bt_create_error_popup(bt_share_appdata_t *ad) return popup; } +static bt_file_type_e __get_file_type(char *name) +{ + FN_START; + + char *extn = NULL; + + extn = strrchr(name, '.'); + if (extn != NULL) + extn++; + + DBG("extn : %s", extn); + + if (extn != NULL) { + if (!strcasecmp(extn, "png") || !strcasecmp(extn, "bmp") || !strcasecmp(extn, "gif") || + !strcasecmp(extn, "jpg") || !strcasecmp(extn, "jpeg") || !strcasecmp(extn, "jpe") || + !strcasecmp(extn, "jp2") || !strcasecmp(extn, "pjpeg") || !strcasecmp(extn, "tif") || + !strcasecmp(extn, "wbmp") || !strcasecmp(extn, "wmf")) + return BT_FILE_IMAGE; + else if (!strcasecmp(extn, "vcf")) + return BT_FILE_VCARD; + else if (!strcasecmp(extn, "vcs")) + return BT_FILE_VCAL; + else if (!strcasecmp(extn, "vbm")) + return BT_FILE_VBOOKMARK; + } + FN_END; + return BT_FILE_OTHER; +} + static gboolean __bt_open_file(const char *path) { FN_START; app_control_h handle; int ret; + bt_file_type_e file_type; bt_share_appdata_t *ad = app_state; app_control_create(&handle); app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW); app_control_set_uri(handle, path); + + file_type = __get_file_type(path); + + if (file_type == BT_FILE_IMAGE) { + app_control_set_mime(handle, "image/*"); + app_control_add_extra_data(handle, "Path", path); + app_control_set_launch_mode(handle, APP_CONTROL_LAUNCH_MODE_GROUP); + } + ret = app_control_send_launch_request(handle, NULL, NULL); if (ret == APP_CONTROL_ERROR_APP_NOT_FOUND) diff --git a/src/bt-share-ui-view.h b/src/bt-share-ui-view.h index 7cfb651..d9fa8d4 100644 --- a/src/bt-share-ui-view.h +++ b/src/bt-share-ui-view.h @@ -39,6 +39,16 @@ extern "C" { #define BT_ANI_UPLOAD "bt_share_upload" #define BT_ANI_DOWNLOAD "bt_share_download" +typedef enum { + BT_FILE_IMAGE, /**