diff options
author | Radoslaw Czerski <r.czerski@samsung.com> | 2016-04-08 16:44:28 +0200 |
---|---|---|
committer | Radoslaw Czerski <r.czerski@samsung.com> | 2016-04-08 16:44:28 +0200 |
commit | a654132fb3a96511dfa4f5501f0f0550a5f279f0 (patch) | |
tree | 3cca54ec0c8d0379398232e4d24a1030e0670493 | |
parent | 86a96d732fda8b3f5d41ef1124c8a78da1159b49 (diff) | |
download | share-panel-a654132fb3a96511dfa4f5501f0f0550a5f279f0.tar.gz share-panel-a654132fb3a96511dfa4f5501f0f0550a5f279f0.tar.bz2 share-panel-a654132fb3a96511dfa4f5501f0f0550a5f279f0.zip |
'*/*' set as mime when no mime set.
Fix for TSAM-1712
Change-Id: I40eab4a9e041b513e8ccc8896a680e94f492c07f
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
-rw-r--r-- | inc/log.h | 10 | ||||
-rw-r--r-- | src/list.c | 21 |
2 files changed, 31 insertions, 0 deletions
@@ -19,6 +19,9 @@ #include <dlog.h> +#define OK (0) +#define FAIL (-1) + #undef LOG_TAG #define LOG_TAG "SHARE_PANEL" @@ -39,6 +42,13 @@ #define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, fmt"\n", ##arg) #endif +#define retvm_if(expr, val, fmt, arg...) do { \ + if(expr) { \ + _E(fmt, ##arg); \ + _E("(%s) -> %s() return", #expr, __FUNCTION__); \ + return val; \ + } \ +} while (0) #define retv_if(expr, val) do { \ if(expr) { \ @@ -340,6 +340,25 @@ static void __make_applist(share_panel_h share_panel, Eina_List *matchlist, Eina } } +static int check_mime(app_control_h control, char* operation_type) +{ + if (!strcmp(operation_type, APP_CONTROL_OPERATION_SHARE) + || !strcmp(operation_type, APP_CONTROL_OPERATION_MULTI_SHARE)) { + char *mime; + int ret = app_control_get_mime(control, &mime); + retvm_if(ret != APP_CONTROL_ERROR_NONE, FAIL, "app_control_get_mime failed[%d]", ret); + if (mime == NULL) { + ret = app_control_set_mime(control, "*/*"); + if (ret != APP_CONTROL_ERROR_NONE) { + _E("app_control_set_mime failed[%d]", ret); + free(mime); + return FAIL; + } + } + free(mime); + } + return OK; +} Eina_List *_list_create(share_panel_h share_panel) { @@ -354,6 +373,8 @@ Eina_List *_list_create(share_panel_h share_panel) app_control_get_operation(share_panel->control, &operation_type); retv_if(!operation_type, NULL); + retv_if(check_mime(share_panel->control, operation_type) == FAIL, NULL); + __trim_uri(share_panel->control); if (!strcmp(operation_type, APP_CONTROL_OPERATION_SHARE) |