[evolution] Bug 582744 – CC field autofill doesn't work for replies



commit 152d43ec92989b4a416c1fedf3ec133b48bee6ae
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat May 16 17:19:51 2009 -0400

    Bug 582744 â?? CC field autofill doesn't work for replies
---
 composer/e-composer-header-table.c |   44 ++++++++++++++++++++++++++++++++++++
 composer/e-composer-header-table.h |    9 +++++++
 composer/e-composer-name-header.c  |   29 ++++++++++++++++++-----
 composer/e-composer-name-header.h  |    3 ++
 mail/em-composer-utils.c           |    5 +++-
 5 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index 44a4919..d539565 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -1003,6 +1003,22 @@ e_composer_header_table_get_destinations_bcc (EComposerHeaderTable *table)
 }
 
 void
+e_composer_header_table_add_destinations_bcc (EComposerHeaderTable *table,
+                                              EDestination **destinations)
+{
+	EComposerNameHeader *header;
+
+	g_return_if_fail (E_IS_COMPOSER_HEADER_TABLE (table));
+
+	header = E_COMPOSER_HEADER_TABLE_GET_BCC_HEADER (table);
+	e_composer_name_header_add_destinations (header, destinations);
+
+	if (destinations != NULL && *destinations != NULL)
+		e_composer_header_table_set_header_visible (
+			table, E_COMPOSER_HEADER_BCC, TRUE);
+}
+
+void
 e_composer_header_table_set_destinations_bcc (EComposerHeaderTable *table,
                                               EDestination **destinations)
 {
@@ -1030,6 +1046,22 @@ e_composer_header_table_get_destinations_cc (EComposerHeaderTable *table)
 }
 
 void
+e_composer_header_table_add_destinations_cc (EComposerHeaderTable *table,
+                                             EDestination **destinations)
+{
+	EComposerNameHeader *header;
+
+	g_return_if_fail (E_IS_COMPOSER_HEADER_TABLE (table));
+
+	header = E_COMPOSER_HEADER_TABLE_GET_CC_HEADER (table);
+	e_composer_name_header_add_destinations (header, destinations);
+
+	if (destinations != NULL && *destinations != NULL)
+		e_composer_header_table_set_header_visible (
+			table, E_COMPOSER_HEADER_CC, TRUE);
+}
+
+void
 e_composer_header_table_set_destinations_cc (EComposerHeaderTable *table,
                                              EDestination **destinations)
 {
@@ -1057,6 +1089,18 @@ e_composer_header_table_get_destinations_to (EComposerHeaderTable *table)
 }
 
 void
+e_composer_header_table_add_destinations_to (EComposerHeaderTable *table,
+                                             EDestination **destinations)
+{
+	EComposerNameHeader *header;
+
+	g_return_if_fail (E_IS_COMPOSER_HEADER_TABLE (table));
+
+	header = E_COMPOSER_HEADER_TABLE_GET_TO_HEADER (table);
+	e_composer_name_header_add_destinations (header, destinations);
+}
+
+void
 e_composer_header_table_set_destinations_to (EComposerHeaderTable *table,
                                              EDestination **destinations)
 {
diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h
index b3150c4..91d64fe 100644
--- a/composer/e-composer-header-table.h
+++ b/composer/e-composer-header-table.h
@@ -112,16 +112,25 @@ EDestination ** e_composer_header_table_get_destinations
 						(EComposerHeaderTable *table);
 EDestination **	e_composer_header_table_get_destinations_bcc
 						(EComposerHeaderTable *table);
+void		e_composer_header_table_add_destinations_bcc
+						(EComposerHeaderTable *table,
+						 EDestination **destination);
 void		e_composer_header_table_set_destinations_bcc
 						(EComposerHeaderTable *table,
 						 EDestination **destinations);
 EDestination **	e_composer_header_table_get_destinations_cc
 						(EComposerHeaderTable *table);
+void		e_composer_header_table_add_destinations_cc
+						(EComposerHeaderTable *table,
+						 EDestination **destination);
 void		e_composer_header_table_set_destinations_cc
 						(EComposerHeaderTable *table,
 						 EDestination **destinations);
 EDestination **	e_composer_header_table_get_destinations_to
 						(EComposerHeaderTable *table);
+void		e_composer_header_table_add_destinations_to
+						(EComposerHeaderTable *table,
+						 EDestination **destinations);
 void		e_composer_header_table_set_destinations_to
 						(EComposerHeaderTable *table,
 						 EDestination **destinations);
diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
index 70a126b..5aab95d 100644
--- a/composer/e-composer-name-header.c
+++ b/composer/e-composer-name-header.c
@@ -295,13 +295,33 @@ e_composer_name_header_get_destinations (EComposerNameHeader *header)
 }
 
 void
+e_composer_name_header_add_destinations (EComposerNameHeader *header,
+                                         EDestination **destinations)
+{
+	EDestinationStore *store;
+	ENameSelectorEntry *entry;
+	gint ii;
+
+	g_return_if_fail (E_IS_COMPOSER_NAME_HEADER (header));
+
+	entry = E_COMPOSER_NAME_HEADER_GET_ENTRY (header);
+	store = e_name_selector_entry_peek_destination_store (entry);
+
+	if (destinations == NULL)
+		return;
+
+	for (ii = 0; destinations[ii] != NULL; ii++)
+		e_destination_store_append_destination (
+			store, destinations[ii]);
+}
+
+void
 e_composer_name_header_set_destinations (EComposerNameHeader *header,
                                          EDestination **destinations)
 {
 	EDestinationStore *store;
 	ENameSelectorEntry *entry;
 	GList *list, *iter;
-	gint ii;
 
 	g_return_if_fail (E_IS_COMPOSER_NAME_HEADER (header));
 
@@ -314,10 +334,5 @@ e_composer_name_header_set_destinations (EComposerNameHeader *header,
 		e_destination_store_remove_destination (store, iter->data);
 	g_list_free (list);
 
-	if (destinations == NULL)
-		return;
-
-	for (ii = 0; destinations[ii] != NULL; ii++)
-		e_destination_store_append_destination (
-			store, destinations[ii]);
+	e_composer_name_header_add_destinations (header, destinations);
 }
diff --git a/composer/e-composer-name-header.h b/composer/e-composer-name-header.h
index 04f7100..f95c33f 100644
--- a/composer/e-composer-name-header.h
+++ b/composer/e-composer-name-header.h
@@ -66,6 +66,9 @@ ENameSelector *	e_composer_name_header_get_name_selector
 						(EComposerNameHeader *header);
 EDestination **	e_composer_name_header_get_destinations
 						(EComposerNameHeader *header);
+void		e_composer_name_header_add_destinations
+						(EComposerNameHeader *header,
+						 EDestination **destination);
 void		e_composer_name_header_set_destinations
 						(EComposerNameHeader *header,
 						 EDestination **destinations);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 2336f3c..0f9945b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1789,7 +1789,10 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account,
 	e_composer_header_table_set_account (table, account);
 	e_composer_header_table_set_subject (table, subject);
 	e_composer_header_table_set_destinations_to (table, tov);
-	e_composer_header_table_set_destinations_cc (table, ccv);
+
+	/* Add destinations instead of setting, so we don't remove
+	 * automatic CC addresses that have already been added. */
+	e_composer_header_table_add_destinations_cc (table, ccv);
 
 	g_free (subject);
 



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