From edfedf54acdc747bca8786366d72ae0a6f8c8e8a Mon Sep 17 00:00:00 2001 From: "jin0.kim" Date: Fri, 10 Jun 2016 10:52:26 +0830 Subject: [PATCH] Fix time conversion issue Change-Id: I65c8bf964a436eeddad5e9077de06a0d37e0b5d8 --- daemon/notifications/noti_util.c | 25 +++++++++++++++++++++++++ daemon/notifications/noti_util.h | 1 + daemon/notifications/noti_view_listype.c | 11 ++++------- daemon/notifications/noti_view_ongoing.c | 8 ++++---- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/daemon/notifications/noti_util.c b/daemon/notifications/noti_util.c index a41da37..47922b7 100755 --- a/daemon/notifications/noti_util.c +++ b/daemon/notifications/noti_util.c @@ -296,3 +296,28 @@ err: return ret <= 0 ? NULL : buf; } + +HAPI char *quickpanel_noti_util_get_text(notification_h noti, notification_text_type_e text_type) +{ + time_t time = 0; + char *text = NULL; + char buf[128] = {0,}; + + if (notification_get_time_from_text(noti, text_type, &time) == NOTIFICATION_ERROR_NONE) { + if ((int)time > 0) { + quickpanel_noti_util_get_time(time, buf, sizeof(buf)); + text = buf; + } + } else { + notification_get_text(noti, text_type, &text); + } + + DBG("text : %s", text); + + if (text != NULL) { + return elm_entry_utf8_to_markup(text); + } + + return NULL; +} + diff --git a/daemon/notifications/noti_util.h b/daemon/notifications/noti_util.h index e866beb..2b39299 100755 --- a/daemon/notifications/noti_util.h +++ b/daemon/notifications/noti_util.h @@ -31,5 +31,6 @@ typedef enum _qp_noti_image_type { extern int quickpanel_noti_util_get_event_count_from_noti(notification_h noti); extern int quickpanel_noti_util_get_event_count_by_pkgname(const char *pkgname); extern char *quickpanel_noti_util_get_time(time_t t, char *buf, int buf_len); +extern char *quickpanel_noti_util_get_text(notification_h noti, notification_text_type_e text_type); #endif diff --git a/daemon/notifications/noti_view_listype.c b/daemon/notifications/noti_view_listype.c index d99d1c1..739f722 100755 --- a/daemon/notifications/noti_view_listype.c +++ b/daemon/notifications/noti_view_listype.c @@ -253,9 +253,8 @@ static void _set_text(Evas_Object *item, notification_h noti) #endif /* Get pkgname & id */ - noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text); - - if (noti_err == NOTIFICATION_ERROR_NONE && text != NULL) { + 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); @@ -265,7 +264,6 @@ static void _set_text(Evas_Object *item, notification_h noti) } 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); @@ -279,9 +277,8 @@ static void _set_text(Evas_Object *item, notification_h noti) #endif } - noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &text); - - if (noti_err == NOTIFICATION_ERROR_NONE && text != NULL) { + 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); diff --git a/daemon/notifications/noti_view_ongoing.c b/daemon/notifications/noti_view_ongoing.c index b93214d..c29b9b6 100755 --- a/daemon/notifications/noti_view_ongoing.c +++ b/daemon/notifications/noti_view_ongoing.c @@ -432,8 +432,8 @@ static void _set_text(Evas_Object *item, notification_h noti) SDBG("percentage:%f size:%f", percentage, size); - ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text); - if (ret == NOTIFICATION_ERROR_NONE && text != NULL) { + 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); #ifdef QP_SCREENREADER_ENABLE @@ -441,8 +441,8 @@ static void _set_text(Evas_Object *item, notification_h noti) #endif } - ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &text); - if (ret == NOTIFICATION_ERROR_NONE && text != NULL) { + text = quickpanel_noti_util_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT); + if (text != NULL) { if (layout == NOTIFICATION_LY_ONGOING_EVENT) { text_utf8 = elm_entry_utf8_to_markup(text); if (text_utf8 != NULL) { -- 2.7.4