Re: [Evolution] Reply for list messages should go back to the list



On Tue, 2010-07-13 at 17:34 -0430, Patrick O'Callaghan wrote:
And this one to say "are you sure you want to reply to all?" when you
reply to a message with lots of recipients. Unless it's a mailing list
message.

Definitely against this. There's no such thing as a "right number" of
recipients to trigger the query.

You're welcome to turn it off. I certainly would -- but I think it would
still be useful. It doesn't *matter* that there's no "right number",
because it's just a heuristic to make you think. We could also make the
number tunable (given that I've now made it actually count recipients
properly).

diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index a1e0ebb..35a6a5e 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -353,7 +353,7 @@ html_contains_nonwhitespace (const gchar *html,
 }
 
 void
-e_mail_reader_reply_to_message (EMailReader *reader,
+e_mail_reader_reply_to_message (EMailReader *reader, CamelMimeMessage *message,
                                 gint reply_mode)
 {
        EMFormatHTML *formatter;
@@ -423,7 +428,7 @@ e_mail_reader_reply_to_message (EMailReader *reader,
 
 whole_message:
        em_utils_reply_to_message (
-               folder, uid, NULL, reply_mode, EM_FORMAT (formatter));
+               folder, uid, message, reply_mode, EM_FORMAT (formatter));
 }
 
 void
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
index 72ad761..9f3a06b 100644
--- a/mail/e-mail-reader-utils.h
+++ b/mail/e-mail-reader-utils.h
@@ -48,6 +48,7 @@ guint         e_mail_reader_open_selected     (EMailReader *reader);
 void           e_mail_reader_print             (EMailReader *reader,
                                                 GtkPrintOperationAction action);
 void           e_mail_reader_reply_to_message  (EMailReader *reader,
+                                                CamelMimeMessage *message,
                                                 gint reply_mode);
 void           e_mail_reader_select_next_message
                                                (EMailReader *reader,
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 26048c5..e3ad1c8 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -820,17 +820,96 @@ action_mail_redirect_cb (GtkAction *action,
 }
 
 static void
+action_mail_reply_all_check(CamelFolder *folder, const gchar *uid, CamelMimeMessage *message, gpointer 
user_data)
+{
+       EMailReader *reader = user_data;
+       CamelInternetAddress *to, *cc;
+       gint recip_count = 0;
+       gint mode = REPLY_MODE_ALL;
+
+       if (!message)
+               return;
+
+       to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
+       cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
+
+       recip_count = camel_address_length(CAMEL_ADDRESS(to));
+       recip_count += camel_address_length(CAMEL_ADDRESS(cc));
+
+       if (recip_count >= 15) {
+               GConfClient *gconf = mail_config_get_gconf_client ();
+               GtkDialog *dialog;
+               GtkWidget *content_area, *check;
+               gint response;
+
+               dialog = (GtkDialog*) e_alert_dialog_new_for_args (e_mail_reader_get_window (reader),
+                                                                  "mail:ask-reply-many-recips", NULL);
+
+               /*Check buttons*/
+               check = gtk_check_button_new_with_mnemonic (_("_Do not ask me again."));
+               gtk_container_set_border_width((GtkContainer *)check, 12);
+               content_area = gtk_dialog_get_content_area (dialog);
+               gtk_box_pack_start (GTK_BOX (content_area), check, TRUE, TRUE, 0);
+               gtk_widget_show (check);
+
+               response = gtk_dialog_run ((GtkDialog *) dialog);
+
+               if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)))
+                       gconf_client_set_bool(gconf, "/apps/evolution/mail/prompts/reply_many_recips", FALSE, 
NULL);
+
+               gtk_widget_destroy((GtkWidget *)dialog);
+
+               if (response == GTK_RESPONSE_NO)
+                       mode = REPLY_MODE_SENDER;
+               else if (response == GTK_RESPONSE_CANCEL)
+                       return;
+       }                  
+
+       e_mail_reader_reply_to_message (reader, message, mode);
+}
+
+static void
 action_mail_reply_all_cb (GtkAction *action,
                           EMailReader *reader)
 {
-       e_mail_reader_reply_to_message (reader, REPLY_MODE_ALL);
+       guint32 state = e_mail_reader_check_state (reader);
+       GConfClient *gconf = mail_config_get_gconf_client ();
+
+       if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/reply_many_recips", NULL) &&
+           !(state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) {
+               CamelMimeMessage *message = NULL;
+#if 0 /* Not until bug 624285 is fixed */
+               EMFormatHTML *formatter;
+
+               formatter = e_mail_reader_get_formatter (reader);
+               message = CAMEL_MIME_MESSAGE (EM_FORMAT (formatter)->message);
+#endif
+               if (!message) {
+                       CamelFolder *folder;
+                       GtkWidget *message_list;
+                       gchar *uid;
+
+                       folder = e_mail_reader_get_folder (reader);
+                       message_list = e_mail_reader_get_message_list (reader);
+
+                       uid = MESSAGE_LIST (message_list)->cursor_uid;
+                       g_return_if_fail (uid != NULL);
+
+                       mail_get_message(folder, uid, action_mail_reply_all_check, reader, 
mail_msg_unordered_push);
+                       return;
+               }
+               action_mail_reply_all_check(NULL, NULL, message, reader);
+               return;
+       }
+
+       e_mail_reader_reply_to_message (reader, NULL, REPLY_MODE_ALL);
 }
 
 static void
 action_mail_reply_list_cb (GtkAction *action,
                            EMailReader *reader)
 {
-       e_mail_reader_reply_to_message (reader, REPLY_MODE_LIST);
+       e_mail_reader_reply_to_message (reader, NULL, REPLY_MODE_LIST);
 }
 
 static void
@@ -871,7 +950,7 @@ action_mail_reply_sender_cb (GtkAction *action,
                else if (response == GTK_RESPONSE_CANCEL)
                        return;
        }
-       e_mail_reader_reply_to_message (reader, mode);
+       e_mail_reader_reply_to_message (reader, NULL, mode);
 }
 
 static void
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 8956974..a8024a7 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -1067,6 +1067,21 @@
       </locale>
     </schema>
 
+    <schema>
+      <key>/schemas/apps/evolution/mail/prompts/reply_many_recips</key>
+      <applyto>/apps/evolution/mail/prompts/reply_many_recips</applyto>
+      <owner>evolution-mail</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+         <short>Prompt when replying to many recipients</short>
+         <long>
+         It disables/enables the repeated prompts to warn that you are
+        sending a reply to many people.
+         </long>
+      </locale>
+    </schema>
+
        <!-- Trash settings -->
 
     <schema>
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 3817d06..6c1f57b 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -4816,6 +4816,21 @@ For example: "Work" or "Personal"</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="chkPromptReplyManyRecips">
+                            <property name="label" translatable="yes">Prompt when sending replies to _many 
recipients</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
                       </object>
                     </child>
                   </object>
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index a9be483..962a509 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -67,6 +67,14 @@ Many email systems add an Apparently-To header to messages that only have BCC re
     <button response="GTK_RESPONSE_OK" _label="Reply to _List"></button>
   </error>
 
+  <error id="ask-reply-many-recips" type="question" default="GTK_RESPONSE_CANCEL">
+    <_primary>Send reply to all recipients?</_primary>
+    <_secondary>You are replying to a message which was sent to many recipients. Are you sure you want to 
reply to ALL of them?</_secondary>
+    <button response="GTK_RESPONSE_YES" _label="Reply to _All"></button>
+    <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+    <button response="GTK_RESPONSE_NO" _label="Reply _Privately"/>
+  </error>
+
   <error id="send-no-recipients" type="warning">
     <_primary>This message cannot be sent because you have not specified any recipients</_primary>
     <_secondary xml:space="preserve">Please enter a valid email address in the To: field. You can search for 
email addresses by clicking on the To: button next to the entry box.</_secondary>
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index d46972f..97b5891 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -224,6 +224,10 @@ e_mail_shell_settings_init (EShell *shell)
                "/apps/evolution/mail/prompts/private_list_reply");
 
        e_shell_settings_install_property_for_key (
+               "composer-prompt-reply-many-recips",
+               "/apps/evolution/mail/prompts/reply-many-recips");
+
+       e_shell_settings_install_property_for_key (
                "composer-prompt-empty-subject",
                "/apps/evolution/mail/prompts/empty_subject");
 
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 0ea3d34..15f1416 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -424,6 +424,11 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
                shell_settings, "composer-prompt-private-list-reply",
                widget, "active");
 
+       widget = e_builder_get_widget (prefs->builder, "chkPromptReplyManyRecips");
+       e_mutual_binding_new (
+               shell_settings, "composer-prompt-reply-many-recips",
+               widget, "active");
+
        widget = e_builder_get_widget (prefs->builder, "chkAutoSmileys");
        e_mutual_binding_new (
                shell_settings, "composer-magic-smileys",

-- 
dwmw2




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]