From e5babe3cafb4d83f69feddd746c288f6502f6e5b Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Thu, 30 Apr 2009 07:03:11 +0000 Subject: [PATCH] Hide attachment column in lis display if "enable attachments = 0" SVN revision: 2195 --- src/elogd.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index e4cd6043..e93448d7 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -16687,8 +16687,8 @@ void synchronize(LOGBOOK * lbs, int mode) /*------------------------------------------------------------------*/ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode, int expand, int level, - BOOL printable, int n_line, int show_attachments, char *date, char *reply_to, - int n_attr_disp, char disp_attr[MAX_N_ATTR + 4][NAME_LENGTH], + BOOL printable, int n_line, int show_attachments, int show_att_column, + char *date, char *reply_to, int n_attr_disp, char disp_attr[MAX_N_ATTR + 4][NAME_LENGTH], BOOL disp_attr_link[MAX_N_ATTR + 4], char attrib[MAX_N_ATTR][NAME_LENGTH], int n_attr, char *text, BOOL show_text, char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], char *encoding, BOOL select, int *n_display, char *locked_by, int highlight, @@ -17294,7 +17294,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode, int exp rsputs("\n"); } - if (strieq(mode, "Summary")) { + if (show_att_column) { /* show attachment icons */ rsputs(" "); @@ -17542,7 +17542,7 @@ void display_reply(LOGBOOK * lbs, int message_id, int printable, int expand, int return; } - display_line(lbs, message_id, 0, "threaded", expand, level, printable, n_line, FALSE, date, reply_to, + display_line(lbs, message_id, 0, "threaded", expand, level, printable, n_line, FALSE, FALSE, date, reply_to, n_attr_disp, disp_attr, NULL, (void *) attrib, lbs->n_attr, text, show_text, NULL, encoding, 0, NULL, locked_by, highlight, &re_buf[0], highlight_mid, absolute_link); @@ -18929,7 +18929,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa sort_attr[MAX_N_ATTR + 4][NAME_LENGTH], mode_cookie[80], charset[25], sort_item[NAME_LENGTH]; char *p, *pt1, *pt2, *slist, *svalue, *gattr, line[1024], iattr[256]; BOOL show_attachments, threaded, csv, xml, raw, mode_commands, expand, filtering, disp_filter, show_text, - text_in_attr, searched, found, disp_attr_link[MAX_N_ATTR + 4], sort_attributes; + text_in_attr, searched, found, disp_attr_link[MAX_N_ATTR + 4], sort_attributes, show_att_column; time_t ltime, ltime_start, ltime_end, now, ltime1, ltime2; struct tm tms, *ptms; MSG_LIST *msg_list; @@ -20270,6 +20270,15 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa if (getcfg(lbs->name, "Summary lines", str, sizeof(str))) n_line = atoi(str); + /* suppress summary completely if text body is disabled */ + if (getcfg(lbs->name, "Show text", str, sizeof(str)) && atoi(str) == 0) + n_line = 0; + + /* suppress attachment colum if switched off */ + show_att_column = strieq(mode, "Summary"); + if (getcfg(lbs->name, "Enable attachments", str, sizeof(str)) && atoi(str) == 0) + show_att_column = FALSE; + /* get mode commands flag */ mode_commands = TRUE; if (getcfg(lbs->name, "Mode commands", str, sizeof(str)) && atoi(str) == 0) @@ -20433,10 +20442,9 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa if (!strieq(mode, "Full") && n_line > 0 && show_text) rsprintf("%s\n", loc("Text")); - if (strieq(mode, "Summary")) { + if (show_att_column) rsprintf("\"%s\"", loc("Attachments"), loc("Attachments")); - } rsprintf("\n\n"); } @@ -20639,7 +20647,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa } display_line(msg_list[index].lbs, message_id, index, mode, expand, 0, printable, n_line, - show_attachments, date, reply_to, n_attr_disp, disp_attr, disp_attr_link, attrib, + show_attachments, show_att_column, date, reply_to, n_attr_disp, disp_attr, disp_attr_link, attrib, lbs->n_attr, text, show_text, attachment, encoding, isparam("select") ? atoi(getparam("select")) : 0, &n_display, locked_by, 0, re_buf, page_mid, FALSE); @@ -20750,7 +20758,7 @@ void show_elog_thread(LOGBOOK * lbs, int message_id, int absolute_links, int hig rsprintf("\n"); display_line(lbs, head_id, 0, "Threaded", 1, 0, FALSE, 0, - FALSE, date, reply_to, n_attr_disp, disp_attr, NULL, attrib, lbs->n_attr, text, FALSE, + FALSE, FALSE, date, reply_to, n_attr_disp, disp_attr, NULL, attrib, lbs->n_attr, text, FALSE, attachment, encoding, 0, &n_display, locked_by, message_id, NULL, highlight_mid, absolute_links);