[Email] Fix display issue in mailbox when subject has '\n' symbols 44/83244/1
authorAndriy Kolesnichenko <a.kolesniche@samsung.com>
Tue, 9 Aug 2016 16:49:50 +0000 (19:49 +0300)
committerAndriy Kolesnichenko <a.kolesniche@samsung.com>
Tue, 9 Aug 2016 16:49:50 +0000 (19:49 +0300)
[Implementation] Interprete <br> symbols as space symbol in mailbox genlist style

Change-Id: I9d13c99cef813b32c4332be094be36eb9168afe3
Signed-off-by: Andriy Kolesnichenko <a.kolesniche@samsung.com>
common/inc/email-engine.h
common/inc/email-utils.h
edc/mailbox/email-mailbox-macros.edc
modules/mailbox/inc/email-mailbox.h
modules/mailbox/src/email-mailbox-list.c
modules/mailbox/src/email-mailbox-noti-mgr.c

index 7aef28e..cd408c3 100644 (file)
@@ -25,38 +25,12 @@ G_BEGIN_DECLS
 
 /* Array length definition */
 
-#define TAG_LEN                50 /*tag for hightlight keyword <color=#ff0000>key</>*/
+#define TAG_LEN                        50 /*tag for hightlight keyword <color=#ff0000>key</>*/
 #define FROM_LEN               100
-#define SUBJECT_LEN    100
 #define ADDR_LEN               320
 #define RECIPIENT_LEN  100
 
 typedef struct {
-       gint uid;
-       gint account_id;
-       gchar from[FROM_LEN + TAG_LEN + 1];
-       gchar sender[ADDR_LEN + 1];
-       guint from_count;               // will be removed
-       char recipient[RECIPIENT_LEN + 1];
-       gchar subject[SUBJECT_LEN + TAG_LEN + 1];
-       gint mailbox_id;
-       time_t datetime;
-       gint priority;
-       gint flags;             /* See email_mail_status_type_e in email-types.h. */
-       gboolean seen : 1;
-       gboolean attachments : 1;
-       gboolean lock : 1;
-       gboolean body_download : 1;
-       gboolean sending : 1;
-       gboolean checked : 1;
-       gboolean reserved_1 : 1;
-       gboolean reserved_2 : 1;
-       gint thread_id;
-       gint thread_count;
-       gint save_status;
-} email_mailbox_info_t;
-
-typedef struct {
        gchar *name;
        gchar *alias;
        gchar *account_name;
index c960390..9f8a64e 100644 (file)
@@ -217,14 +217,14 @@ G_BEGIN_DECLS
        } while (0)
 
 /*utf8 util*/
-#define UTF8_VALIDATE(from, len) \
-       ({\
-               char *end = NULL;\
-               if (STR_VALID(from))\
-                       if (!g_utf8_validate(from, len, (const gchar **)&end) && end)\
-                               *end = '\0';\
-               NULL;\
-       })
+#define UTF8_VALIDATE(from) \
+       do { \
+               gchar *end = NULL; \
+               g_utf8_validate(from, -1, (const gchar **)&end); \
+               if (end) {\
+                       *end = '\0';\
+               \
+       } while (0)
 
 #define EMAIL_GENLIST_ITC_FREE(x) \
        do { \
index c995e62..2085f3e 100644 (file)
@@ -19,8 +19,8 @@
 #define MAILBOX_TEXT_STYLE(style_name, font_size, font_color, font_match_color) \
        style { name: style_name; \
        base: "font=Tizen:style=Regular font_size="font_size" color="font_color" text_class=list_item ellipsis=1.0"; \
-       tag:  "br" "\n"; \
-       tag:  "tab" "\t"; \
+       tag:  "br" " "; \
+       tag:  "tab" " "; \
        tag:  "match" "+ color="font_match_color""; \
 }
 
index 9e068ba..619519f 100644 (file)
@@ -44,9 +44,7 @@
 #define MAIL_ID_SIZE   30
 #define MAIL_ID_COUNT  1000
 
-#define EMAIL_MAILBOX_PREVIEW_TEXT_DEFAULT_CHAR_COUNT 75
-#define EMAIL_MAILBOX_TITLE_DEFAULT_CHAR_COUNT 55
-
+#define EMAIL_MAILBOX_TITLE_DEFAULT_CHAR_COUNT 150
 #define EMAIL_MAILBOX_CHECK_CACHE_SIZE 42
 
 typedef enum {
index dc3eefd..e4bda42 100644 (file)
@@ -2408,8 +2408,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info
        retvm_if(!ld, NULL, "memory allocarion failed.");
 
        gchar buf[MAX_STR_LEN] = { 0, };
-       int preview_len = EMAIL_MAILBOX_PREVIEW_TEXT_DEFAULT_CHAR_COUNT;
-       debug_log("account_id(%d), mail_id(%d), preview_len(%d)", mail_info->account_id, mail_info->mail_id, preview_len);
+       debug_log("account_id(%d), mail_id(%d)", mail_info->account_id, mail_info->mail_id);
 
        ld->base.item_type = MAILBOX_LIST_ITEM_MAIL_BRIEF;
        ld->base.item = NULL;
@@ -2457,7 +2456,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info
 
        /* subject */
        if (STR_VALID(mail_info->subject)) {
-               UTF8_VALIDATE(mail_info->subject, SUBJECT_LEN);
+               UTF8_VALIDATE(mail_info->subject);
                memset(buf, 0, sizeof(buf));
                g_utf8_strncpy(buf, mail_info->subject, EMAIL_MAILBOX_TITLE_DEFAULT_CHAR_COUNT);
                char *_subject = elm_entry_utf8_to_markup(buf);
@@ -2480,7 +2479,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info
                                        STRNDUP(mail_info->email_address_sender, ADDR_LEN - 1) :
                                        STRNDUP(email_get_email_string("IDS_EMAIL_MBODY_NO_EMAIL_ADDRESS_OR_NAME"), ADDR_LEN - 1);
 
-       UTF8_VALIDATE(mail_info->full_address_from, FROM_LEN - 1);
+       UTF8_VALIDATE(mail_info->full_address_from);
        char *alias = GET_ALIAS_FROM_FULL_ADDRESS(mail_info->full_address_from, mail_info->email_address_sender, FROM_LEN - 1);
        if (alias) {
                char *_alias = elm_entry_utf8_to_markup(alias);
index d55eb16..dec4f0d 100644 (file)
@@ -529,7 +529,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection,
                                                gchar buf[MAX_STR_LEN] = { 0, };
 
                                                FREE(ld->title);
-                                               UTF8_VALIDATE(mail_info->subject, SUBJECT_LEN);
+                                               UTF8_VALIDATE(mail_info->subject);
                                                g_utf8_strncpy(buf, mail_info->subject, EMAIL_MAILBOX_TITLE_DEFAULT_CHAR_COUNT);
                                                char *_subject = elm_entry_utf8_to_markup(buf);
                                                int title_len = STR_LEN(_subject);
@@ -618,7 +618,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection,
                                                                gchar buf[MAX_STR_LEN] = { 0, };
 
                                                                FREE(ld->title);
-                                                               UTF8_VALIDATE(mail_info->subject, SUBJECT_LEN);
+                                                               UTF8_VALIDATE(mail_info->subject);
                                                                g_utf8_strncpy(buf, mail_info->subject, EMAIL_MAILBOX_TITLE_DEFAULT_CHAR_COUNT);
                                                                char *_subject = elm_entry_utf8_to_markup(buf);
                                                                int title_len = STR_LEN(_subject);