Add more app_control data to open image files 32/98332/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 17 Nov 2016 05:57:40 +0000 (14:57 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 17 Nov 2016 05:58:36 +0000 (14:58 +0900)
Change-Id: I9a489e5c25c9681832e26e968d4869389477f4d4
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
packaging/org.tizen.bluetooth-share-ui.spec
src/bt-share-ui-view.c
src/bt-share-ui-view.h

index 158a163..6fa42be 100755 (executable)
@@ -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
index 6a5c20b..a3a73c5 100644 (file)
@@ -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)
index 7cfb651..d9fa8d4 100644 (file)
@@ -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,  /**<IMAGE */
+       BT_FILE_VCARD,  /**<VCARD */
+       BT_FILE_VCAL,   /**<VCAL */
+       BT_FILE_VBOOKMARK,      /**<VBOOKMARK */
+       BT_FILE_VMEMO,
+       BT_FILE_DOC,    /**<DOC, */
+       BT_FILE_OTHER   /**<OTHER*/
+} bt_file_type_e;
+
 Evas_Object *_bt_create_win(const char *name);
 void _bt_terminate_app(void);
 void _bt_genlist_prepend_tr_data_item(bt_share_appdata_t *ad,