diff options
author | Junyong Sim <junyong.sim@samsung.com> | 2012-08-30 16:02:48 +0900 |
---|---|---|
committer | Junyong Sim <junyong.sim@samsung.com> | 2012-08-30 16:02:48 +0900 |
commit | 35807d96ceca62d2b8bdfd35d0d392589d43f936 (patch) | |
tree | b1d7360dcf778ba2bb70ddf6fcd94983d58e09ea | |
parent | 5dc79e15f9e8fa4f7e549f0b122e4aa8a795856e (diff) | |
download | ug-nfc-efl-35807d96ceca62d2b8bdfd35d0d392589d43f936.tar.gz ug-nfc-efl-35807d96ceca62d2b8bdfd35d0d392589d43f936.tar.bz2 ug-nfc-efl-35807d96ceca62d2b8bdfd35d0d392589d43f936.zip |
remove S BEAM setting
-rw-r--r-- | packaging/ug-nfc-efl.spec | 5 | ||||
-rw-r--r-- | ug-nfc-setting-efl/CMakeLists.txt | 1 | ||||
-rw-r--r-- | ug-nfc-setting-efl/data/edc/ug-nfc-setting-efl.edc | 127 | ||||
-rw-r--r-- | ug-nfc-setting-efl/include/ug-nfc-setting-main.h | 2 | ||||
-rw-r--r-- | ug-nfc-setting-efl/src/ug-nfc-setting-main.c | 48 | ||||
-rw-r--r-- | ug-nfc-share-efl/CMakeLists.txt | 4 | ||||
-rw-r--r-- | ug-nfc-share-efl/include/ug-nfc-share-main.h | 8 | ||||
-rw-r--r-- | ug-nfc-share-efl/src/ug-nfc-share-main.c | 45 | ||||
-rw-r--r-- | ug-nfc-share-efl/src/ug-nfc-share-tag.c | 114 |
9 files changed, 201 insertions, 153 deletions
diff --git a/packaging/ug-nfc-efl.spec b/packaging/ug-nfc-efl.spec index 7fbb8b9..8bae082 100644 --- a/packaging/ug-nfc-efl.spec +++ b/packaging/ug-nfc-efl.spec @@ -5,7 +5,7 @@ Name: ug-nfc-efl Summary: UI gadget about the nfc Version: 0.0.2 -Release: 17 +Release: 20 Group: TO_BE/FILLED_IN License: Samsung Proprietary License Source0: %{name}-%{version}.tar.gz @@ -16,9 +16,10 @@ BuildRequires: pkgconfig(ui-gadget-1) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(utilX) -BuildRequires: pkgconfig(syspopup-caller) +BuildRequires: pkgconfig(status) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-network-nfc) +BuildRequires: pkgconfig(capi-content-mime-type) BuildRequires: cmake BuildRequires: edje-tools diff --git a/ug-nfc-setting-efl/CMakeLists.txt b/ug-nfc-setting-efl/CMakeLists.txt index 72a0fe8..be86fea 100644 --- a/ug-nfc-setting-efl/CMakeLists.txt +++ b/ug-nfc-setting-efl/CMakeLists.txt @@ -56,6 +56,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DEDJDIR=\"${EDJDIR}\"") ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"") +#ADD_DEFINITIONS("-D_SBEAM_SUPPORT_") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0.1.0) diff --git a/ug-nfc-setting-efl/data/edc/ug-nfc-setting-efl.edc b/ug-nfc-setting-efl/data/edc/ug-nfc-setting-efl.edc index 6c24744..5077db2 100644 --- a/ug-nfc-setting-efl/data/edc/ug-nfc-setting-efl.edc +++ b/ug-nfc-setting-efl/data/edc/ug-nfc-setting-efl.edc @@ -1,3 +1,79 @@ + +#define PADDING_TOP( param_padding_size ) \ + part \ + { \ + name: "top_pad"; \ + type: RECT; \ + scale: 1; \ + description \ + { \ + state: "default" 0.0; \ + color: 0 0 0 0; \ + min: 0 param_padding_size; \ + fixed: 0 1; \ + rel1 {relative: 0 0;} \ + rel2 {relative: 1 0;} \ + align:0 0; \ + } \ + } \ + +#define PADDING_BOTTOM( param_padding_size ) \ + part \ + { \ + name: "bottom_pad"; \ + type: RECT; \ + scale: 1; \ + description \ + { \ + state: "default" 0.0; \ + color: 0 0 0 0; \ + min: 0 param_padding_size; \ + fixed: 0 1; \ + rel1 { relative: 0 1; } \ + rel2 { relative: 1 1; } \ + align: 0 1; \ + } \ + } \ + +#define PADDING_LEFT( param_padding_size ) \ + part \ + { \ + name: "left_pad"; \ + type: RECT; \ + scale: 1; \ + description \ + { \ + state: "default" 0.0; \ + color: 0 0 0 0; \ + min: param_padding_size 0; \ + fixed: 1 0; \ + rel1 {relative: 0 0;} \ + rel2 {relative: 0 1;} \ + align:0 0; \ + } \ + } \ + +#define PADDING_RIGHT( param_padding_size ) \ + part \ + { \ + name: "right_pad"; \ + type: RECT; \ + scale: 1; \ + description \ + { \ + state: "default" 0.0; \ + color: 0 0 0 0; \ + min: param_padding_size 0; \ + fixed: 1 0; \ + rel1 {relative: 1 0;} \ + rel2 {relative: 1 1;} \ + align:1 0; \ + } \ + } \ + +#define SETTING_LIST_HEIGHT (40+113+113) +#define SCREEN_HEIGHT 1280 + collections { styles @@ -27,65 +103,34 @@ collections { description { state: "default" 0.0; - min: 0 50; + min: 0 SETTING_LIST_HEIGHT; fixed: 0 1; rel1{relative: 0 0;} - rel2{relative: 1 0.3;} - align: 0.5 0.0; - } - } - - part - { - name: "left_pad"; - type: RECT; - scale: 1; - description - { - state: "default" 0.0; - color: 0 0 0 0; - min: 16 0; - fixed: 1 0; - rel1 {relative: 0 1; to_y: "setting_list";} - rel2 {relative: 0 1;} - align: 0 0; - } - } - - part - { - name: "right_pad"; - type: RECT; - scale: 1; - description - { - state: "default" 0.0; - color: 0 0 0 0; - min: 16 0; - fixed: 1 0; - rel1 {relative: 1 1; to_y: "setting_list";} - rel2 {relative: 1 1;} + rel2{relative: 1 SETTING_LIST_HEIGHT/SCREEN_HEIGHT;} align: 0 0; } } part { - name: "bottom_pad"; + name: "setting_list_pad"; type: RECT; scale: 1; description { state: "default" 0.0; color: 0 0 0 0; - min: 0 16; + min: 0 36; fixed: 0 1; - rel1 {relative: 0 0.75;} - rel2 {relative: 1 0.75;} - align: 0 0; + rel1 {relative: 0 1; to_y: "setting_list";} + rel2 {relative: 1 1; to_y: "setting_list";} + align:0 0; } } + PADDING_LEFT(40) + PADDING_RIGHT(40) + PADDING_BOTTOM(40) part { diff --git a/ug-nfc-setting-efl/include/ug-nfc-setting-main.h b/ug-nfc-setting-efl/include/ug-nfc-setting-main.h index cd9e065..2ac96e2 100644 --- a/ug-nfc-setting-efl/include/ug-nfc-setting-main.h +++ b/ug-nfc-setting-efl/include/ug-nfc-setting-main.h @@ -58,7 +58,9 @@ extern "C" { typedef enum _NFCSettingType { NFC_ON_OFF = 0, +#ifdef _SBEAM_SUPPORT_ NFC_S_BEAM, +#endif NFC_SETTING_MAX } NFCSettingType; diff --git a/ug-nfc-setting-efl/src/ug-nfc-setting-main.c b/ug-nfc-setting-efl/src/ug-nfc-setting-main.c index e913cad..a3bee46 100644 --- a/ug-nfc-setting-efl/src/ug-nfc-setting-main.c +++ b/ug-nfc-setting-efl/src/ug-nfc-setting-main.c @@ -35,10 +35,16 @@ #define NFC_MANAGER_ENABLE 1 #define NFC_MANAGER_DISABLE 0 +#ifdef _SBEAM_SUPPORT_ +#define S_BEAM_DESCRIPTION_MSG_WRAP_WIDTH 640 +#endif + static Elm_Genlist_Item_Class itc_seperator; static Elm_Genlist_Item_Class itc; static Elm_Object_Item *on_off_item = NULL; +#ifdef _SBEAM_SUPPORT_ static Elm_Object_Item *sbeam_item = NULL; +#endif static bool pending_status = FALSE; @@ -146,7 +152,7 @@ uint32_t _get_font_color(int font) break; case UG_FONT_HELP : - color = 0x00000000; + color = 0x007C7C7C; break; default : @@ -214,7 +220,7 @@ const char *_get_font_style(int font) break; case UG_FONT_HELP : - style = "bold"; + style = ""; break; default : @@ -281,12 +287,6 @@ static void _activation_completed_cb(nfc_error_e error, void *user_data) { LOGD("[%s(): %d] BEGIN >>>>", __FUNCTION__, __LINE__); -#if 0 - _set_pending_status(FALSE); - - if (on_off_item != NULL) - elm_genlist_item_update(on_off_item); -#endif nfc_manager_deinitialize(); LOGD("[%s(): %d] END <<<<", __FUNCTION__, __LINE__); @@ -315,6 +315,7 @@ static void _change_nfc_onoff_setting(void) LOGD("[%s(): %d] END <<<<", __FUNCTION__, __LINE__); } +#ifdef _SBEAM_SUPPORT_ static void _change_nfc_sbeam_setting(void) { int status; @@ -342,14 +343,17 @@ static void _change_nfc_sbeam_setting(void) LOGD("[%s(): %d] END <<<<", __FUNCTION__, __LINE__); } +#endif static void _nfc_onoff_vconf_update_cb(keynode_t *key, void *data) { LOGD("[%s(): %d] BEGIN >>>>", __FUNCTION__, __LINE__); int nfc_mode = 0; +#ifdef _SBEAM_SUPPORT_ int sbeam_state = 0; static int sbeam_off_by_nfcOnOff = EINA_FALSE; +#endif int result; if ((result = vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_mode)) == 0) @@ -362,6 +366,9 @@ static void _nfc_onoff_vconf_update_cb(keynode_t *key, void *data) return; } + LOGD("nfc mode %s \n", nfc_mode > 0 ? "ON" : "OFF"); + +#ifdef _SBEAM_SUPPORT_ if ((result = vconf_get_bool(VCONFKEY_NFC_SBEAM, &sbeam_state)) == 0) { LOGD("[%s(): %d] vconf_get_bool status [%d]\n", __FUNCTION__, __LINE__, sbeam_state); @@ -372,9 +379,9 @@ static void _nfc_onoff_vconf_update_cb(keynode_t *key, void *data) return; } - LOGD("nfc mode %s \n", nfc_mode > 0 ? "ON" : "OFF"); LOGD("S BEAM state %d, NFC was off by nfcOnOff %s \n", sbeam_state, sbeam_off_by_nfcOnOff == EINA_TRUE ? "Yes" : "No"); +#endif /* nfc setting ui updated */ _set_pending_status(FALSE); @@ -382,6 +389,7 @@ static void _nfc_onoff_vconf_update_cb(keynode_t *key, void *data) if (on_off_item != NULL) elm_genlist_item_update(on_off_item); +#ifdef _SBEAM_SUPPORT_ if (nfc_mode == VCONFKEY_NFC_STATE_OFF) { /* sbeam setting disabled */ @@ -422,6 +430,7 @@ static void _nfc_onoff_vconf_update_cb(keynode_t *key, void *data) { LOGD("Invalid Vconf value \n"); } +#endif LOGD("[%s(): %d] END <<<<", __FUNCTION__, __LINE__); } @@ -494,6 +503,7 @@ static Eina_Bool _gl_state_get(void *data, Evas_Object *obj, const char *part) LOGD("[%s(): %d] vconf_get_bool error [%d]", __FUNCTION__, __LINE__, result); } } +#ifdef _SBEAM_SUPPORT_ else if (item_data->type == NFC_S_BEAM) { if (!vconf_get_bool(VCONFKEY_NFC_SBEAM, &enable)) @@ -513,6 +523,7 @@ static Eina_Bool _gl_state_get(void *data, Evas_Object *obj, const char *part) LOGD("[%s(): %d] vconf_get_bool error [%d]", __FUNCTION__, __LINE__, result); } } +#endif else { LOGD("[%s(): %d] item_data->type error", __FUNCTION__, __LINE__); @@ -562,12 +573,14 @@ static void _gl_sel_activation(void *data, Evas_Object *obj, void *event_info) elm_genlist_item_update(item); } +#ifdef _SBEAM_SUPPORT_ else if (item_data->type == NFC_S_BEAM) { _change_nfc_sbeam_setting(); elm_genlist_item_update(item); } +#endif else { LOGD("[%s(): %d] item_data->type error", __FUNCTION__, __LINE__); @@ -601,6 +614,7 @@ static void _check_changed_cb(void *data, Evas_Object *obj, void *event_info) if (on_off_item != NULL) elm_genlist_item_update(on_off_item); } +#ifdef _SBEAM_SUPPORT_ else if (item_data->type == NFC_S_BEAM) { _change_nfc_sbeam_setting(); @@ -608,6 +622,7 @@ static void _check_changed_cb(void *data, Evas_Object *obj, void *event_info) if (sbeam_item != NULL) elm_genlist_item_update(sbeam_item); } +#endif else { LOGD("[%s(): %d] item_data->type error", __FUNCTION__, __LINE__); @@ -669,6 +684,7 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa elm_object_style_set(content, "on&off"); } } +#ifdef _SBEAM_SUPPORT_ else if (item_data->type == NFC_S_BEAM) { content = elm_check_add(obj); @@ -688,6 +704,7 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa elm_object_style_set(content, "on&off"); } +#endif else { LOGD("[%s(): %d] item_data->type error", __FUNCTION__, __LINE__); @@ -715,10 +732,12 @@ static char *_gl_text_get_onoff(void *data, Evas_Object *obj, const char *part) { text = strdup(IDS_NFC_NFC); } +#ifdef _SBEAM_SUPPORT_ else if (item_data->type == NFC_S_BEAM) { text = strdup(IDS_NFC_S_BEAM); } +#endif else { LOGD("[%s(): %d] type error", __FUNCTION__, __LINE__); @@ -753,7 +772,7 @@ static Evas_Object *_ug_nfc_create_setting_layout(void *data) elm_genlist_bounce_set(genlist, EINA_FALSE, EINA_FALSE); elm_object_style_set(genlist, "dialogue"); - itc_seperator.item_style = "grouptitle.dialogue.seperator"; + itc_seperator.item_style = "dialogue/separator"; itc_seperator.func.text_get = NULL; itc_seperator.func.content_get = NULL; itc_seperator.func.state_get = NULL; @@ -766,8 +785,8 @@ static Evas_Object *_ug_nfc_create_setting_layout(void *data) itc.func.del = NULL; /* seperator */ - Elm_Object_Item* dialoguegroup = elm_genlist_item_append(genlist, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(dialoguegroup, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + Elm_Object_Item* seperator1 = elm_genlist_item_append(genlist, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_select_mode_set(seperator1, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); /* NFC setting */ gl_item_data *on_off_data = NULL; @@ -776,6 +795,7 @@ static Evas_Object *_ug_nfc_create_setting_layout(void *data) on_off_data->data = ug_data; on_off_item = elm_genlist_item_append(genlist, &itc, (void *)on_off_data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_activation, (void *)on_off_data); +#ifdef _SBEAM_SUPPORT_ /* S beam setting */ gl_item_data *sbeam_data = NULL; sbeam_data = malloc(sizeof(gl_item_data)); @@ -790,10 +810,12 @@ static Evas_Object *_ug_nfc_create_setting_layout(void *data) { elm_object_item_disabled_set(sbeam_item, TRUE); } +#endif evas_object_show(genlist); elm_object_part_content_set(layout, "setting_list", genlist); +#ifdef _SBEAM_SUPPORT_ /* set help text */ char path[1024] = { 0, }; Evas_Object *label = NULL; @@ -801,8 +823,10 @@ static Evas_Object *_ug_nfc_create_setting_layout(void *data) _get_label_text(UG_FONT_HELP, IDS_NFC_S_BEAM_DESCRIPTION_MSG_CHN, UG_ALIGN_LEFT, path, sizeof(path)); label = elm_label_add(layout); elm_object_part_content_set(layout, "sbeam_help", label); + elm_label_wrap_width_set(label, S_BEAM_DESCRIPTION_MSG_WRAP_WIDTH); elm_label_line_wrap_set(label, ELM_WRAP_MIXED); elm_object_text_set(label, path); +#endif return layout; } diff --git a/ug-nfc-share-efl/CMakeLists.txt b/ug-nfc-share-efl/CMakeLists.txt index aab8716..f99f2a0 100644 --- a/ug-nfc-share-efl/CMakeLists.txt +++ b/ug-nfc-share-efl/CMakeLists.txt @@ -32,9 +32,10 @@ elementary ui-gadget-1 dlog vconf -syspopup-caller +status capi-appfw-application capi-network-nfc +capi-content-mime-type ) FOREACH(flag ${pkgs_ug_nfc_share_CFLAGS}) @@ -78,4 +79,3 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${IMAGEDI INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${IMAGEDIR} FILES_MATCHING PATTERN "*.jpg") ADD_SUBDIRECTORY(po) - diff --git a/ug-nfc-share-efl/include/ug-nfc-share-main.h b/ug-nfc-share-efl/include/ug-nfc-share-main.h index 96af344..6b46125 100644 --- a/ug-nfc-share-efl/include/ug-nfc-share-main.h +++ b/ug-nfc-share-efl/include/ug-nfc-share-main.h @@ -79,14 +79,14 @@ extern "C" { #define IDS_SHARE_VIA_NFC dgettext(PACKAGE, "IDS_NFC_HEADER_SHARE_VIA_NFC") #define IDS_GENTLY_TOUCH_PHONES_TOGETHER_TO_SHARE dgettext(PACKAGE, "IDS_NFC_BODY_GENTLY_TOUCH_PHONES_TOGETHER_TO_SHARE") #define IDS_TO_CANCEL_SHARING_TAP_CANCEL dgettext(PACKAGE, "IDS_NFC_BODY_TO_CANCEL_SHARING_TAP_CANCEL") -#define IDS_TAG_SHARED dgettext(PACKAGE, "IDS_NFC_POP_TAG_SHARED") -#define IDS_FAILED_TO_SHARE_TAG dgettext(PACKAGE, "IDS_NFC_POP_FAILED_TO_SHARE_TAG") #define IDS_TRANSFER_FAILED dgettext(PACKAGE, "IDS_NFC_POP_TRANSFER_FAILED") #define IDS_SERVICE_NOT_AVAILABLE_NFC_TURNED_OFF_TURN_ON_NFC_Q dgettext(PACKAGE, "IDS_NFC_POP_SERVICE_NOT_AVAILABLE_NFC_TURNED_OFF_TURN_ON_NFC_Q") +//#define IDS_TAG_SHARED dgettext(PACKAGE, "IDS_NFC_POP_TAG_SHARED") +#define IDS_TAG_SHARED _("Shared") +//#define IDS_FAILED_TO_SHARE_TAG dgettext(PACKAGE, "IDS_NFC_POP_FAILED_TO_SHARE_TAG") +#define IDS_FAILED_TO_SHARE_TAG _("Failed") #define IDS_HANDOVER _("HANDOVER") -#define IDS_UNABLE_TO_SHARE_FILES_MAXIMUM_FILE_SIZE_EXCEEDED_SHARE_FILES_VIA_BLUETOOTH_PAIRED_DEVICES_MAY_BE_DISCONNECTED_CONTINUE_Q \ - _("File size exceeds allowed limit. Share files via Bluetooth. Continue?") #define IDS_NFC_SERVICE_IS_NOT_SUPPORTED _("NFC service is not supported") /* System string */ diff --git a/ug-nfc-share-efl/src/ug-nfc-share-main.c b/ug-nfc-share-efl/src/ug-nfc-share-main.c index fbc61c6..64ddf98 100644 --- a/ug-nfc-share-efl/src/ug-nfc-share-main.c +++ b/ug-nfc-share-efl/src/ug-nfc-share-main.c @@ -29,8 +29,6 @@ #include <sys/wait.h> /* external library header */ -#include "xdgmime.h" - #include <assert.h> #include <glib.h> @@ -304,6 +302,7 @@ static Evas_Object *_create_image(Evas_Object *parent, const char *file_path, co return image; } +#if 0 static Evas_Object *_create_label(Evas_Object *parent, const char *text, const char *swallow, void *data) { Evas_Object *label; @@ -364,6 +363,27 @@ static Evas_Object *_create_layout(Evas_Object *parent, const char *clas, const return ly; } +static Evas_Object* _create_win_for_popup(Evas_Object * parent) +{ + Evas_Object *eo; + int w, h; + + eo = elm_win_add(parent, "NFCShareSubWindow", ELM_WIN_BASIC); + if (eo) + { + elm_win_title_set(eo, "NFCShareSubWindow"); + elm_win_borderless_set(eo, EINA_TRUE); + elm_win_alpha_set(eo, EINA_TRUE); + evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL); + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + evas_object_resize(eo, w, h); + elm_win_indicator_mode_set(eo, EINA_TRUE); + } + + return eo; +} +#endif + static Evas_Object *_create_bg(Evas_Object *win) { Evas_Object *bg = elm_bg_add(win); @@ -402,26 +422,6 @@ static void _win_del(void *data, Evas_Object *obj, void *event_info) LOGD("[%s(): %d] END >>>>", __FUNCTION__, __LINE__); } -static Evas_Object* _create_win_for_popup(Evas_Object * parent) -{ - Evas_Object *eo; - int w, h; - - eo = elm_win_add(parent, "NFCShareSubWindow", ELM_WIN_BASIC); - if (eo) - { - elm_win_title_set(eo, "NFCShareSubWindow"); - elm_win_borderless_set(eo, EINA_TRUE); - elm_win_alpha_set(eo, EINA_TRUE); - evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL); - ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); - evas_object_resize(eo, w, h); - elm_win_indicator_mode_set(eo, EINA_TRUE); - } - - return eo; -} - static void _activation_completed_cb(nfc_error_e error, void *user_data) { ugdata_t *ug_data = (ugdata_t *)user_data; @@ -644,7 +644,6 @@ void ug_nfc_share_create_nfc_share_view(void *user_data) { ugdata_t* ug_data = (ugdata_t*)user_data; Evas_Object* nfc_share_layout = NULL; - Evas_Object* l_button = NULL; LOGD("[%s(): %d] BEGIN >>>>", __FUNCTION__, __LINE__); diff --git a/ug-nfc-share-efl/src/ug-nfc-share-tag.c b/ug-nfc-share-efl/src/ug-nfc-share-tag.c index a44ddf2..6924815 100644 --- a/ug-nfc-share-efl/src/ug-nfc-share-tag.c +++ b/ug-nfc-share-efl/src/ug-nfc-share-tag.c @@ -28,68 +28,28 @@ #include <sys/wait.h> /* external library header */ -#include "xdgmime.h" -#include "syspopup_caller.h" - +#include "mime_type.h" +#include "status.h" #define NFC_POPUP_TIMEOUT 3.0 static ug_nfc_share_tag_type ug_nfc_share_tagType; -static char *ug_nfc_share_displayText = NULL; int _bt_ipc_send_obex_message(uint8_t *address, const uint8_t *files, uint32_t length); /*-----------------------------------------------------------------------------------------------*/ -static void _show_failure_popup(void *data, char *str) -{ - ugdata_t *ug_data = (ugdata_t *)data; - - LOGD("[%s(): %d] BEGIN>>>>", __FUNCTION__, __LINE__); - - ret_if(ug_data == NULL); - ret_if(str == NULL); - - bundle *bd = NULL; - - bd = bundle_create(); - bundle_add(bd, "0", "info"); - bundle_add(bd, "1", str); - bundle_add(bd, "2", "0"); // bottom orientation - bundle_add(bd, "3", "2"); // terminated after 2 seconds - - syspopup_launch("tickernoti-syspopup", bd); - - bundle_free(bd); - - ug_destroy_me(ug_data->nfc_share_ug); - - LOGD("[%s(): %d] END>>>>", __FUNCTION__, __LINE__); -} - -static void _show_success_popup(void *data) +static void _show_status_text(void *data, char *text) { - char popup_str[POPUP_TEXT_SIZE] = { 0, }; ugdata_t *ug_data = (ugdata_t *)data; LOGD("[%s(): %d] BEGIN>>>>", __FUNCTION__, __LINE__); ret_if(ug_data == NULL); + ret_if(text == NULL); - snprintf(popup_str, POPUP_TEXT_SIZE, "%s", IDS_TAG_SHARED); - - bundle *bd = NULL; - - bd = bundle_create(); - bundle_add(bd, "0", "info"); - bundle_add(bd, "1", popup_str); - bundle_add(bd, "2", "0"); // bottom orientation - bundle_add(bd, "3", "2"); // terminated after 2 seconds - - syspopup_launch("tickernoti-syspopup", bd); - - bundle_free(bd); + status_message_post(text); ug_destroy_me(ug_data->nfc_share_ug); @@ -148,24 +108,45 @@ ug_nfc_share_result_e ug_nfc_share_set_current_ndef(void *data, nfc_ndef_message } -static ug_nfc_share_result_e ug_nfc_share_make_mime_type_data_from_file_path(const char *path, uint8_t **type_data, uint32_t *type_size) +static ug_nfc_share_result_e ug_nfc_share_make_mime_type_data_from_file_path(const char *path, uint8_t *type_data, uint32_t *type_size) { ug_nfc_share_result_e result = UG_NFC_SHARE_ERROR; - const char *mime_type; + char *extension = NULL; LOGD("[%s(): %d] BEGIN >>>>", __FUNCTION__, __LINE__); retv_if(path == NULL, result); retv_if(type_data == NULL, result); + retv_if(type_size == NULL, result); + + LOGD("typedata = %p, typesize = %d", type_data, *type_size); + + memset(type_data, 0, *type_size); + *type_size = 0; + + extension = strrchr(path, '.'); + LOGD("extension = %s\n", GET_SAFE_STRING(extension)); - mime_type = xdg_mime_get_mime_type_from_file_name(path); - UG_NFC_SHARE_MEM_MALLOC(*type_data, strlen(mime_type), uint8_t); - memcpy(*type_data, mime_type, strlen(mime_type)); - *type_size = strlen(mime_type); + if (extension != NULL) + { + char *mime_str = NULL; + + if (mime_type_get_mime_type(extension+1, &mime_str) == MIME_TYPE_ERROR_NONE) + { + LOGD("mime_str[%s]", mime_str); - LOGD("mime type : %s", GET_SAFE_STRING((char *)*type_data)); + *type_size = strlen(mime_str); + memcpy(type_data, mime_str, *type_size); + result = UG_NFC_SHARE_OK; + } + else + { + LOGD("ERROR :: mime_type_get_mime_type failed"); + result = UG_NFC_SHARE_ERROR; + } + } - result = UG_NFC_SHARE_OK; + LOGD("mime type : %s", GET_SAFE_STRING((char *)type_data)); LOGD("[%s(): %d] END >>>>", __FUNCTION__, __LINE__); @@ -176,8 +157,8 @@ ug_nfc_share_result_e ug_nfc_share_make_ndef_message_from_file(nfc_ndef_message_ { int result = UG_NFC_SHARE_ERROR; struct stat st; - uint8_t *type_buffer = NULL; - int type_size = 0; + uint8_t type_buffer[50] = { 0, }; + int type_size = sizeof(type_buffer); nfc_ndef_record_h record = NULL; FILE *file = NULL; char *file_name = NULL; @@ -236,7 +217,7 @@ ug_nfc_share_result_e ug_nfc_share_make_ndef_message_from_file(nfc_ndef_message_ } /* get type data */ - result = ug_nfc_share_make_mime_type_data_from_file_path(path, &type_buffer, (uint32_t *)&type_size); + result = ug_nfc_share_make_mime_type_data_from_file_path(path, type_buffer, (uint32_t *)&type_size); if (result != UG_NFC_SHARE_OK) { LOGD("ERROR :: _make_mime_type_data_from_file_path failed [%d]", result); @@ -298,8 +279,8 @@ ug_nfc_share_result_e ug_nfc_share_make_ndef_message_from_multi_file(nfc_ndef_me { int result = UG_NFC_SHARE_ERROR; struct stat st; - uint8_t *type_buffer = NULL; - int type_size = 0; + uint8_t type_buffer[50] = { 0, }; + int type_size = sizeof(type_buffer); nfc_ndef_record_h record = NULL; FILE *file = NULL; char *file_name = NULL; @@ -363,7 +344,7 @@ ug_nfc_share_result_e ug_nfc_share_make_ndef_message_from_multi_file(nfc_ndef_me } /* get type data */ - result = ug_nfc_share_make_mime_type_data_from_file_path(path[index], &type_buffer, (uint32_t *)&type_size); + result = ug_nfc_share_make_mime_type_data_from_file_path(path[index], type_buffer, (uint32_t *)&type_size); if (result != UG_NFC_SHARE_OK) { LOGD("ERROR :: _make_mime_type_data_from_file_path failed [%d]", result); @@ -483,23 +464,20 @@ static void _p2p_connection_handover_completed_cb(nfc_error_e result, nfc_ac_typ if (_bt_ipc_send_obex_message(address, (uint8_t *)data, strlen(data) + 1) == 0) { - /* show success popup */ - _show_success_popup(ug_data); + _show_status_text(ug_data, IDS_TAG_SHARED); } else { LOGD("_bt_ipc_send_obex_message failed"); - /* show failure popup */ - _show_failure_popup(ug_data, IDS_FAILED_TO_SHARE_TAG); + _show_status_text(ug_data, IDS_FAILED_TO_SHARE_TAG); } } else { LOGD("p2p_connection_handover failed"); - /* show failure popup */ - _show_failure_popup(ug_data, IDS_FAILED_TO_SHARE_TAG); + _show_status_text(ug_data, IDS_FAILED_TO_SHARE_TAG); } LOGD("[%s(): %d] END>>>>", __FUNCTION__, __LINE__); @@ -524,15 +502,13 @@ static void _p2p_send_completed_cb(nfc_error_e result, void *user_data) { LOGD("_p2p_send_completed_cb is completed"); - /* show success popup */ - _show_success_popup(ug_data); + _show_status_text(ug_data, IDS_TAG_SHARED); } else { LOGD("_p2p_send_completed_cb failed"); - /* show failure popup */ - _show_failure_popup(ug_data, IDS_FAILED_TO_SHARE_TAG); + _show_status_text(ug_data, IDS_FAILED_TO_SHARE_TAG); } LOGD("[%s(): %d] END>>>>", __FUNCTION__, __LINE__); |