From 0b2fb9086c940f485554f28be04684881814f51f Mon Sep 17 00:00:00 2001 From: "jin0.kim" Date: Thu, 3 Nov 2016 16:39:40 +0830 Subject: [PATCH] Update MSG Reply Feature for pressing the body Change-Id: Ia99dd22cdd46d705e1535f9e4ce8168829f988cd --- src/notifications/activenoti.c | 46 +++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/src/notifications/activenoti.c b/src/notifications/activenoti.c index 319916f..f379e91 100755 --- a/src/notifications/activenoti.c +++ b/src/notifications/activenoti.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "common.h" #include "common_uic.h" @@ -133,6 +134,8 @@ static bool _activenoti_check_reply_button_handler(notification_h noti, app_cont static void _activenoti_show_entry(void); static void _activenoti_destroy_entry(void); static bool _activenoti_create_entry(Evas_Object *obj, notification_h noti); +static char *_activenoti_get_entry_text(); + QP_Module activenoti = { .name = "activenoti", @@ -876,6 +879,7 @@ static void _noti_press_cb(void *data, Evas_Object *obj, const char *emission, c int flags = 0, group_id = 0, priv_id = 0, count = 0, flag_launch = 0; notification_type_e type = NOTIFICATION_TYPE_NONE; notification_h noti = NULL; + char *entry_text = NULL; retif(s_info.activenoti == NULL, , "Invalid parameter!"); retif(s_info.current_noti == NULL, , "Invalid parameter!"); @@ -907,6 +911,22 @@ static void _noti_press_cb(void *data, Evas_Object *obj, const char *emission, c DBG("NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH failed [%d]", ret); } + if (s_info.is_entry_activated) { + entry_text = _activenoti_get_entry_text(); + if (responding_service_handle != NULL) { + bundle_add(responding_service_handle, APP_CONTROL_DATA_TEXT, entry_text); + } + if (single_service_handle != NULL) { + bundle_add(single_service_handle, APP_CONTROL_DATA_TEXT, entry_text); + } + if (multi_service_handle != NULL) { + bundle_add(multi_service_handle, APP_CONTROL_DATA_TEXT, entry_text); + } + if (entry_text) { + free(entry_text); + } + } + if (responding_service_handle != NULL) { DBG("responding_service_handle : %s", responding_service_handle); ret = quickpanel_common_launch_app(NULL, responding_service_handle); @@ -919,7 +939,6 @@ static void _noti_press_cb(void *data, Evas_Object *obj, const char *emission, c } else { count = 1; } - if (single_service_handle != NULL && multi_service_handle == NULL) { ret = quickpanel_common_launch_app(NULL, single_service_handle); } else if (single_service_handle == NULL && multi_service_handle != NULL) { @@ -1159,11 +1178,14 @@ static void _entry_changed_cb(void *data, Evas_Object *obj, void *event_info) retif (!obj, , "Invalid parameters"); char buf[1024]; - const char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj)); + char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj)); snprintf(buf, sizeof(buf), "%d", s_info.text_input_max_length-strlen(entry_text)); elm_object_part_text_set(s_info.entrylayout, "text.char_count", buf); + + if (entry_text) + free(entry_text); } static void _entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -1183,10 +1205,18 @@ static void _entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) s_info.is_entry_activated = true; } +static char *_activenoti_get_entry_text() { + char *entry_text = NULL; + + entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(s_info.text_input_entry)); + + return entry_text; +} + static void _send_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) { - const char *entry_text = NULL; - char *text_copy = NULL; + char *entry_text = NULL; + app_control_h app_control = data; int ret = APP_CONTROL_ERROR_NONE; @@ -1194,14 +1224,13 @@ static void _send_button_clicked_cb(void *data, Evas_Object *obj, void *event_in entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(s_info.text_input_entry)); } - text_copy = strdup(entry_text); - ret = app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, text_copy); + ret = app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, entry_text); if (ret == APP_CONTROL_ERROR_NONE) app_control_send_launch_request(app_control, NULL, NULL); - if (text_copy) - free(text_copy); + if (entry_text) + free(entry_text); _activenoti_hide(NULL, 1); } @@ -2005,4 +2034,3 @@ void quickpanel_activenoti_set_display_mode(bool is_landscape) // elm_entry_single_line_set(s_info.text_input_entry, EINA_FALSE); } } - -- 2.7.4