From 24de9fc45198b6cccf6ddc1f42b3735fcb9a9917 Mon Sep 17 00:00:00 2001 From: "jin0.kim" Date: Fri, 21 Apr 2017 16:03:17 +0830 Subject: [PATCH] fixed display error on notification content Change-Id: Ifb894c5295d1d7a18bed3ddd83fcfa9adab85cef --- src/notifications/noti_view_listype.c | 49 +++++++++++++++++---------------- src/notifications/noti_view_ongoing.c | 52 ++++++++++++++++++----------------- 2 files changed, 52 insertions(+), 49 deletions(-) diff --git a/src/notifications/noti_view_listype.c b/src/notifications/noti_view_listype.c index 5b4d2f2..d3ab8fb 100755 --- a/src/notifications/noti_view_listype.c +++ b/src/notifications/noti_view_listype.c @@ -92,8 +92,9 @@ static void _set_text(Evas_Object *item, notification_h noti) { int noti_err = NOTIFICATION_ERROR_NONE; bool is_exist_count = false; - char *text = NULL; - + char *title_text = NULL; + char *count_text = NULL; + char *content_text = NULL; char *domain = NULL; char *dir = NULL; @@ -128,49 +129,49 @@ static void _set_text(Evas_Object *item, notification_h noti) /* Get pkgname & id */ if (noti_privacy_mode == QP_PRIVACY_MODE_HIDE_CONTENT) - text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); + title_text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); - if (text == NULL) - text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); + if (title_text == NULL) + title_text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); - if (text != NULL) { - DBG("TITLE text : %s", text); - quickpanel_common_util_char_replace(text, _NEWLINE, _SPACE); - _set_text_to_part(item, "elm.text.title", text); + if (title_text != NULL) { + DBG("TITLE text : %s", title_text); + quickpanel_common_util_char_replace(title_text, _NEWLINE, _SPACE); + _set_text_to_part(item, "elm.text.title", title_text); #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, title_text); #endif } - noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &text); - if (noti_err == NOTIFICATION_ERROR_NONE && text != NULL) { - quickpanel_common_util_char_replace(text, _NEWLINE, _SPACE); - int count = atoi(text); + noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &count_text); + if (noti_err == NOTIFICATION_ERROR_NONE && count_text != NULL) { + quickpanel_common_util_char_replace(count_text, _NEWLINE, _SPACE); + int count = atoi(count_text); if (count > 999) _set_text_to_part(item, "elm.text.count", "999+"); else - _set_text_to_part(item, "elm.text.count", text); + _set_text_to_part(item, "elm.text.count", count_text); is_exist_count = true; #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, count_text); #endif } if (noti_privacy_mode == QP_PRIVACY_MODE_HIDE_CONTENT) - text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); + content_text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); - if (text == NULL) - text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); + if (content_text == NULL) + content_text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); - if (text != NULL) { - DBG("CONTENT text : %s", text); - quickpanel_common_util_char_replace(text, _NEWLINE, _SPACE); - _set_text_to_part(item, "elm.text.content", text); + if (content_text != NULL) { + DBG("CONTENT text : %s", content_text); + quickpanel_common_util_char_replace(content_text, _NEWLINE, _SPACE); + _set_text_to_part(item, "elm.text.content", content_text); #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, content_text); #endif } diff --git a/src/notifications/noti_view_ongoing.c b/src/notifications/noti_view_ongoing.c index 46765ec..dc02169 100755 --- a/src/notifications/noti_view_ongoing.c +++ b/src/notifications/noti_view_ongoing.c @@ -228,7 +228,10 @@ static void _set_progressbar(Evas_Object *item, notification_h noti) static void _set_text(Evas_Object *item, notification_h noti) { - char *text = NULL; + char *title_text = NULL; + char *count_text = NULL; + char *content_text = NULL; + char *progress_text = NULL; char *text_utf8 = NULL; char *domain = NULL; char *dir = NULL; @@ -247,7 +250,6 @@ static void _set_text(Evas_Object *item, notification_h noti) Evas_Object *textblock = NULL; int len_w = 0, num_line = 1, view_height = 0; struct appdata *ad = quickpanel_get_app_data(); - char *text_count = NULL; int ret; qp_privacy_mode noti_privacy_mode = quickpanel_noti_util_get_noti_privacy_mode(noti); @@ -296,7 +298,7 @@ static void _set_text(Evas_Object *item, notification_h noti) if (ret != NOTIFICATION_ERROR_NONE) ERR("Unable to get layout"); - ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &text_count); + ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &count_text); if (ret != NOTIFICATION_ERROR_NONE) ERR("Unable to get event_count"); @@ -304,32 +306,32 @@ static void _set_text(Evas_Object *item, notification_h noti) DBG("percentage:%f size:%f", percentage, size); if (noti_privacy_mode == QP_PRIVACY_MODE_HIDE_CONTENT) - text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); + title_text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); - if (text == NULL) - text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); + if (title_text == NULL) + title_text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE); - if (text != NULL) { - quickpanel_common_util_char_replace(text, _NEWLINE, _SPACE); - _set_text_to_part(item, "elm.text.title", text); + if (title_text != NULL) { + quickpanel_common_util_char_replace(title_text, _NEWLINE, _SPACE); + _set_text_to_part(item, "elm.text.title", title_text); #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, title_text); #endif } if (noti_privacy_mode == QP_PRIVACY_MODE_HIDE_CONTENT) - text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); + content_text = quickpanel_noti_util_get_hidden_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); else - text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); + content_text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); - if (text != NULL) { + if (content_text != NULL) { if (layout == NOTIFICATION_LY_ONGOING_EVENT) { - text_utf8 = elm_entry_utf8_to_markup(text); + text_utf8 = elm_entry_utf8_to_markup(content_text); if (text_utf8 != NULL) { _set_text_to_part(item, "elm.text.content", text_utf8); free(text_utf8); } else { - _set_text_to_part(item, "elm.text.content", text); + _set_text_to_part(item, "elm.text.content", content_text); } textblock = (Evas_Object *)edje_object_part_object_get(_EDJ(item), "elm.text.content"); evas_object_textblock_size_native_get(textblock, &len_w, NULL); @@ -347,23 +349,23 @@ static void _set_text(Evas_Object *item, notification_h noti) }*/ quickpanel_uic_initial_resize(item, view_height); #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, content_text); #endif } else { - quickpanel_common_util_char_replace(text, _NEWLINE, _SPACE); - _set_text_to_part(item, "elm.text.content", text); + quickpanel_common_util_char_replace(content_text, _NEWLINE, _SPACE); + _set_text_to_part(item, "elm.text.content", content_text); #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, content_text); #endif } } if (layout != NOTIFICATION_LY_ONGOING_EVENT) { - text = _noti_get_progress(noti, buf, sizeof(buf)); - if (text != NULL) { - quickpanel_common_util_char_replace(text, _NEWLINE, _SPACE); + progress_text = _noti_get_progress(noti, buf, sizeof(buf)); + if (progress_text != NULL) { + quickpanel_common_util_char_replace(progress_text, _NEWLINE, _SPACE); #ifdef QP_SCREENREADER_ENABLE - _check_and_add_to_buffer(str_buf, text); + _check_and_add_to_buffer(str_buf, progress_text); #endif } else { _set_text_to_part(item, "elm.text.time", ""); @@ -378,8 +380,8 @@ static void _set_text(Evas_Object *item, notification_h noti) } } - if (layout == NOTIFICATION_LY_ONGOING_PROGRESS && text_count != NULL) { - _set_text_to_part(item, "elm.text.count", text_count); + if (layout == NOTIFICATION_LY_ONGOING_PROGRESS && count_text != NULL) { + _set_text_to_part(item, "elm.text.count", count_text); if (elm_object_part_text_get(item, "elm.text.count") != NULL) { elm_object_signal_emit(item, "content.short", "prog"); elm_object_signal_emit(item, "count.show", "prog"); -- 2.7.4