From 4912b4006bec8c23c5742bd46f7c450cb2a194a5 Mon Sep 17 00:00:00 2001 From: Alfons Hoogervorst Date: Sat, 14 Jun 2003 13:36:28 +0000 Subject: [PATCH] * AUTHORS add Martin Wicke * src/action.c * src/messageview.[ch] * src/summaryview.c apply patch #754162 "Quoting messages filtered by actions" submitted by Martin Wicke, which allows quoting message body changed by an action (Thanks!). --- AUTHORS | 1 + ChangeLog.claws | 11 +++++++++++ configure.ac | 2 +- src/action.c | 8 +++++++- src/messageview.c | 38 ++++++++++++++++++++++++++------------ src/messageview.h | 3 +++ src/summaryview.c | 7 ++++++- 7 files changed, 55 insertions(+), 15 deletions(-) diff --git a/AUTHORS b/AUTHORS index c70040799..d9dab7b6c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -177,3 +177,4 @@ contributors (beside the above; based on Changelog) Radek Vybiral Tsu-Fan Cheng Martin Zwickel + Martin Wicke diff --git a/ChangeLog.claws b/ChangeLog.claws index 1a83ccf5c..689fba4c1 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,14 @@ +2003-06-14 [alfons] 0.9.0claws37 + + * AUTHORS + add Martin Wicke + * src/action.c + * src/messageview.[ch] + * src/summaryview.c + apply patch #754162 "Quoting messages filtered by actions" submitted + by Martin Wicke, which allows quoting message body changed by an + action (Thanks!). + 2003-06-13 [alfons] 0.9.0claws36 * src/utils.c diff --git a/configure.ac b/configure.ac index 34dbba153..1b3f9d0cb 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws36 +EXTRA_VERSION=claws37 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/action.c b/src/action.c index e18dffa19..34be9b90b 100644 --- a/src/action.c +++ b/src/action.c @@ -507,7 +507,8 @@ static void message_actions_execute(MessageView *msgview, guint action_nb, GtkWidget *text = NULL; GdkFont *msgfont = NULL; guint body_pos = 0; - + ActionType action_type; + g_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list)); buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb); @@ -526,6 +527,11 @@ static void message_actions_execute(MessageView *msgview, guint action_nb, } partinfo = messageview_get_selected_mime_part(msgview); + /* this command will alter the message text */ + action_type = action_get_type(action); + if (action_type & (ACTION_PIPE_OUT | ACTION_INSERT)) + msgview->filtered = TRUE; + execute_actions(action, msg_list, text, msgfont, body_pos, partinfo); } diff --git a/src/messageview.c b/src/messageview.c index 87ece4f5c..a1dfcc1b1 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -768,6 +768,7 @@ void messageview_clear(MessageView *messageview) procmsg_msginfo_free(messageview->msginfo); messageview->msginfo = NULL; messageview_change_view_type(messageview, MVIEW_TEXT); + messageview->filtered = FALSE; headerview_clear(messageview->headerview); textview_clear(messageview->textview); noticeview_hide(messageview->noticeview); @@ -1117,10 +1118,9 @@ static PrefsAccount *select_account_from_list(GList *ac_list) return account_find_from_id(account_id); } - /* - * \brief return selected messageview text used by composing - * to reply to selected text only + * \brief return selected messageview text, when nothing is + * selected and message was filtered, return complete text * * \param pointer to Messageview * @@ -1129,20 +1129,34 @@ static PrefsAccount *select_account_from_list(GList *ac_list) gchar *messageview_get_selection(MessageView *msgview) { gchar *text = NULL; + GtkEditable *edit = NULL; + gint body_pos = 0; g_return_val_if_fail(msgview != NULL, NULL); - text = gtkut_editable_get_selection - (GTK_EDITABLE(msgview->textview->text)); - - if (!text && msgview->type == MVIEW_MIME - && msgview->mimeview->type == MIMEVIEW_TEXT - && msgview->mimeview->textview - && !msgview->mimeview->textview->default_text) { - text = gtkut_editable_get_selection - (GTK_EDITABLE(msgview->mimeview->textview->text)); + if (msgview->type == MVIEW_TEXT) { + edit = GTK_EDITABLE(msgview->textview->text); + body_pos = msgview->textview->body_pos; } + else if (msgview->type == MVIEW_MIME + && msgview->mimeview->type == MIMEVIEW_TEXT + && msgview->mimeview->textview + && !msgview->mimeview->textview->default_text) { + edit = GTK_EDITABLE(msgview->mimeview->textview->text); + body_pos = msgview->mimeview->textview->body_pos; + } + + g_return_val_if_fail(edit != NULL, NULL); + printf("filtered: %d\n", msgview->filtered); + + if (edit->has_selection) + text = gtkut_editable_get_selection(edit); + else if (msgview->filtered) + text = gtk_editable_get_chars (edit, body_pos, -1); + else + text = NULL; + return text; } diff --git a/src/messageview.h b/src/messageview.h index f640ccc1e..9308b916b 100644 --- a/src/messageview.h +++ b/src/messageview.h @@ -66,6 +66,9 @@ struct _MessageView gboolean visible; + /* this message was filtered by an action */ + gboolean filtered; + /* From messageview_show */ gboolean all_headers; }; diff --git a/src/summaryview.c b/src/summaryview.c index 6478863b7..ac2524f15 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -2437,7 +2437,12 @@ static void summary_display_msg_full(SummaryView *summaryview, MsgFlags flags; gchar *filename; - if (!new_window && summaryview->displayed == row) return; + if (!new_window) + if (summaryview->displayed == row) + return; + else + summaryview->messageview->filtered = FALSE; + g_return_if_fail(row != NULL); if (summary_is_locked(summaryview)) return; -- 2.25.1