diff options
-rw-r--r-- | mail/ChangeLog | 14 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 53 | ||||
-rw-r--r-- | mail/mail-account-gui.h | 20 | ||||
-rw-r--r-- | mail/mail-config.c | 66 | ||||
-rw-r--r-- | mail/mail-config.glade | 274 | ||||
-rw-r--r-- | mail/mail-config.h | 6 |
6 files changed, 401 insertions, 32 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 833245f15d..78a60f848e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,19 @@ 2001-06-01 Jeffrey Stedfast <fejj@ximian.com> + * mail-account-gui.c (mail_account_gui_save): Save the pgp and + smime settings. + (mail_account_gui_new): Setup the pgp and s/mime page (but disable + the s/mime frame if we are not compiled with s/mime support). + + * mail-config.c (account_copy): Updated to save extra pgp and + smime options. + (account_destroy): Free draft/sent folder info and also the new + pgp/smime keys. + (config_read): Read in the pgp and s/mime config options. + (mail_config_write): Save the account pgp and smime options. + +2001-06-01 Jeffrey Stedfast <fejj@ximian.com> + * mail-account-gui.c (source_type_changed): Call build_extra_conf() here too. This is when we REALLY want to call it anyway, not on switch-page because then we'd lose any data on diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 36e4ed68e9..74150adace 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -772,18 +772,18 @@ MailAccountGui * mail_account_gui_new (MailConfigAccount *account) { MailAccountGui *gui; - + gui = g_new0 (MailAccountGui, 1); gui->account = account; gui->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); - + /* Management */ gui->account_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "management_name")); gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "management_default")); if (account->name) e_utf8_gtk_entry_set_text (gui->account_name, account->name); gtk_toggle_button_set_active (gui->default_account, account->default_account); - + /* Identity */ gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name")); gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address")); @@ -803,7 +803,7 @@ mail_account_gui_new (MailConfigAccount *account) account->id->signature); } } - + /* Source */ gui->source.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_type_omenu")); gui->source.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_host")); @@ -823,7 +823,7 @@ mail_account_gui_new (MailConfigAccount *account) GTK_SIGNAL_FUNC (service_check_supported), &gui->source); gui->source_auto_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check")); gui->source_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check_min")); - + /* Transport */ gui->transport.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_type_omenu")); gui->transport.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_host")); @@ -840,7 +840,7 @@ mail_account_gui_new (MailConfigAccount *account) gui->transport.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "transport_check_supported")); gtk_signal_connect (GTK_OBJECT (gui->transport.check_supported), "clicked", GTK_SIGNAL_FUNC (service_check_supported), &gui->transport); - + /* Drafts folder */ gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button")); gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "clicked", @@ -866,7 +866,23 @@ mail_account_gui_new (MailConfigAccount *account) gui->sent_folder.name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1); } set_folder_picker_label (gui->sent_folder_button, gui->sent_folder.name); - + + /* Security */ + gui->pgp_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "pgp_key")); + gui->pgp_encrypt_to_self = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_encrypt_to_self")); + gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key")); + gui->smime_encrypt_to_self = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_encrypt_to_self")); + +#ifndef HAVE_NSS + { + /* Since we don't have NSS, hide the S/MIME config options */ + GtkWidget *frame; + + frame = glade_xml_get_widget (gui->xml, "smime_frame"); + gtk_widget_hide (frame); + } +#endif + return gui; } @@ -880,7 +896,7 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top) char *max_authname = NULL; char *source_proto, *transport_proto; GList *providers, *l; - + if (gui->account->source && gui->account->source->url) { source_proto = gui->account->source->url; source_proto = g_strndup (source_proto, strcspn (source_proto, ":")); @@ -1137,17 +1153,17 @@ mail_account_gui_save (MailAccountGui *gui) { MailConfigAccount *account = gui->account; gboolean old_enabled; - + if (!mail_account_gui_identity_complete (gui) || !mail_account_gui_source_complete (gui) || !mail_account_gui_transport_complete (gui) || !mail_account_gui_management_complete (gui)) return FALSE; - + g_free (account->name); account->name = e_utf8_gtk_entry_get_text (gui->account_name); account->default_account = gtk_toggle_button_get_active (gui->default_account); - + /* construct the identity */ identity_destroy (account->id); account->id = g_new0 (MailConfigIdentity, 1); @@ -1155,7 +1171,7 @@ mail_account_gui_save (MailAccountGui *gui) account->id->address = e_utf8_gtk_entry_get_text (gui->email_address); account->id->organization = e_utf8_gtk_entry_get_text (gui->organization); account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE); - + old_enabled = account->source && account->source->enabled; service_destroy (account->source); account->source = g_new0 (MailConfigService, 1); @@ -1165,11 +1181,11 @@ mail_account_gui_save (MailAccountGui *gui) account->source->auto_check = gtk_toggle_button_get_active (gui->source_auto_check); if (account->source->auto_check) account->source->auto_check_time = gtk_spin_button_get_value_as_int (gui->source_auto_check_min); - + service_destroy (account->transport); account->transport = g_new0 (MailConfigService, 1); save_service (&gui->transport, NULL, account->transport); - + g_free (account->drafts_folder_name); account->drafts_folder_name = g_strdup (gui->drafts_folder.name); g_free (account->drafts_folder_uri); @@ -1178,7 +1194,14 @@ mail_account_gui_save (MailAccountGui *gui) account->sent_folder_name = g_strdup (gui->sent_folder.name); g_free (account->sent_folder_uri); account->sent_folder_uri = g_strdup (gui->sent_folder.uri); - + + g_free (account->pgp_key); + account->pgp_key = e_utf8_gtk_entry_get_text (gui->pgp_key); + account->pgp_encrypt_to_self = gtk_toggle_button_get_active (gui->pgp_encrypt_to_self); + g_free (account->smime_key); + account->smime_key = e_utf8_gtk_entry_get_text (gui->smime_key); + account->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self); + return TRUE; } diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h index 159743e475..f1989a4ec4 100644 --- a/mail/mail-account-gui.h +++ b/mail/mail-account-gui.h @@ -47,7 +47,7 @@ typedef struct { GtkWidget *authitem; GtkToggleButton *remember; GtkButton *check_supported; - + CamelProvider *provider; CamelProviderType provider_type; } MailAccountGuiService; @@ -60,34 +60,40 @@ typedef struct { GtkWidget *top; MailConfigAccount *account; GladeXML *xml; - + /* identity */ GtkEntry *full_name; GtkEntry *email_address; GtkEntry *organization; GnomeFileEntry *signature; - + /* incoming mail */ MailAccountGuiService source; GtkToggleButton *source_auto_check; GtkSpinButton *source_auto_check_min; - + /* extra incoming config */ GHashTable *extra_config; - + /* outgoing mail */ MailAccountGuiService transport; GtkToggleButton *transport_needs_auth; - + /* account management */ GtkEntry *account_name; GtkToggleButton *default_account; - + /* special folders */ GtkButton *drafts_folder_button; MailAccountGuiFolder drafts_folder; GtkButton *sent_folder_button; MailAccountGuiFolder sent_folder; + + /* Security */ + GtkEntry *pgp_key; + GtkToggleButton *pgp_encrypt_to_self; + GtkEntry *smime_key; + GtkToggleButton *smime_encrypt_to_self; } MailAccountGui; diff --git a/mail/mail-config.c b/mail/mail-config.c index 2819abaffa..4465ac27db 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -167,7 +167,13 @@ account_copy (const MailConfigAccount *account) new->drafts_folder_uri = g_strdup (account->drafts_folder_uri); new->sent_folder_name = g_strdup (account->sent_folder_name); new->sent_folder_uri = g_strdup (account->sent_folder_uri); - + + new->pgp_key = g_strdup (account->pgp_key); + new->pgp_encrypt_to_self = account->pgp_encrypt_to_self; + + new->smime_key = g_strdup (account->smime_key); + new->smime_encrypt_to_self = account->smime_encrypt_to_self; + return new; } @@ -183,6 +189,14 @@ account_destroy (MailConfigAccount *account) service_destroy (account->source); service_destroy (account->transport); + g_free (account->drafts_folder_name); + g_free (account->drafts_folder_uri); + g_free (account->sent_folder_name); + g_free (account->sent_folder_uri); + + g_free (account->pgp_key); + g_free (account->smime_key); + g_free (account); } @@ -220,7 +234,7 @@ mail_config_clear (void) g_slist_free (config->news); config->news = NULL; } - + /* overkill? */ memset (config, 0, sizeof (MailConfig)); } @@ -290,6 +304,36 @@ config_read (void) else g_free (val); + /* get the pgp info */ + path = g_strdup_printf ("account_pgp_key_%d", i); + val = gnome_config_get_string (path); + g_free (path); + if (val && *val) + account->pgp_key = val; + else + g_free (val); + + path = g_strdup_printf ("account_pgp_encrypt_to_self_%d", i); + account->pgp_encrypt_to_self = gnome_config_get_bool_with_default (path, &def); + if (def) + account->pgp_encrypt_to_self = TRUE; + g_free (path); + + /* get the s/mime info */ + path = g_strdup_printf ("account_smime_key_%d", i); + val = gnome_config_get_string (path); + g_free (path); + if (val && *val) + account->smime_key = val; + else + g_free (val); + + path = g_strdup_printf ("account_smime_encrypt_to_self_%d", i); + account->smime_encrypt_to_self = gnome_config_get_bool_with_default (path, &def); + if (def) + account->smime_encrypt_to_self = TRUE; + g_free (path); + /* get the identity info */ id = g_new0 (MailConfigIdentity, 1); path = g_strdup_printf ("identity_name_%d", i); @@ -491,7 +535,7 @@ config_read (void) else config->default_charset = g_strdup (config->default_charset); } - + gnome_config_sync (); } @@ -536,6 +580,22 @@ mail_config_write (void) gnome_config_set_string (path, account->sent_folder_uri); g_free (path); + /* account pgp options */ + path = g_strdup_printf ("account_pgp_key_%d", i); + gnome_config_set_string (path, account->pgp_key); + g_free (path); + path = g_strdup_printf ("account_pgp_encrypt_to_self_%d", i); + gnome_config_set_bool (path, account->pgp_encrypt_to_self); + g_free (path); + + /* account s/mime options */ + path = g_strdup_printf ("account_smime_key_%d", i); + gnome_config_set_string (path, account->smime_key); + g_free (path); + path = g_strdup_printf ("account_smime_encrypt_to_self_%d", i); + gnome_config_set_bool (path, account->smime_encrypt_to_self); + g_free (path); + /* identity info */ path = g_strdup_printf ("identity_name_%d", i); gnome_config_set_string (path, account->id->name); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index f4c5519882..7c8c945059 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -43,7 +43,7 @@ Click "Next" to begin. </text> <background_color>0,0,0</background_color> <logo_background_color>0,0,0</logo_background_color> <textbox_color>255,255,255</textbox_color> - <logo_image>../../images/evolution/mail-config-druid.png</logo_image> + <logo_image>mail-config-druid.png</logo_image> </widget> <widget> @@ -53,7 +53,7 @@ Click "Next" to begin. </text> <title_color>255,255,255</title_color> <background_color>0,0,0</background_color> <logo_background_color>0,0,0</logo_background_color> - <logo_image>../../images/evolution/mail-config-druid-identity.png</logo_image> + <logo_image>mail-config-druid-identity.png</logo_image> <widget> <class>GtkVBox</class> @@ -80,7 +80,7 @@ Click "Next" to begin. </text> <title_color>255,255,255</title_color> <background_color>0,0,0</background_color> <logo_background_color>0,0,0</logo_background_color> - <logo_image>../../images/evolution/mail-config-druid-receive.png</logo_image> + <logo_image>mail-config-druid-receive.png</logo_image> <widget> <class>GtkVBox</class> @@ -107,7 +107,7 @@ Click "Next" to begin. </text> <title_color>255,255,255</title_color> <background_color>0,0,0</background_color> <logo_background_color>0,0,0</logo_background_color> - <logo_image>../../images/evolution/mail-config-druid-receive.png</logo_image> + <logo_image>mail-config-druid-receive.png</logo_image> <widget> <class>GtkVBox</class> @@ -134,7 +134,7 @@ Click "Next" to begin. </text> <title_color>255,255,255</title_color> <background_color>0,0,0</background_color> <logo_background_color>0,0,0</logo_background_color> - <logo_image>../../images/evolution/mail-config-druid-send.png</logo_image> + <logo_image>mail-config-druid-send.png</logo_image> <widget> <class>GtkVBox</class> @@ -161,7 +161,7 @@ Click "Next" to begin. </text> <title_color>255,255,255</title_color> <background_color>0,0,0</background_color> <logo_background_color>0,0,0</logo_background_color> - <logo_image>../../images/evolution/mail-config-druid-account-name.png</logo_image> + <logo_image>mail-config-druid-account-name.png</logo_image> <widget> <class>GtkVBox</class> @@ -196,7 +196,7 @@ Click "Finish" to save your settings.</text> <textbox_color>255,255,255</textbox_color> <text_color>0,0,0</text_color> <title_color>255,255,255</title_color> - <logo_image>../../images/evolution/thankyou.png</logo_image> + <logo_image>thankyou.png</logo_image> </widget> </widget> </widget> @@ -1574,6 +1574,266 @@ Kerberos <xpad>0</xpad> <ypad>0</ypad> </widget> + + <widget> + <class>GtkVBox</class> + <name>security_vbox</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkFrame</class> + <name>pgp_frame</name> + <border_width>4</border_width> + <label>Pretty Good Privacy</label> + <label_xalign>0</label_xalign> + <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkTable</class> + <name>pgp_table</name> + <border_width>3</border_width> + <rows>2</rows> + <columns>2</columns> + <homogeneous>False</homogeneous> + <row_spacing>4</row_spacing> + <column_spacing>4</column_spacing> + + <widget> + <class>GtkLabel</class> + <name>pgp_key_id_label</name> + <label>PGP Key ID:</label> + <justify>GTK_JUSTIFY_RIGHT</justify> + <wrap>False</wrap> + <xalign>1</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>pgp_key</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>pgp_encrypt_to_self</name> + <can_focus>True</can_focus> + <label>Always encrypt to myself when sending encrypted mail</label> + <active>True</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>0</left_attach> + <right_attach>2</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + </widget> + + <widget> + <class>GtkFrame</class> + <name>smime_frame</name> + <border_width>4</border_width> + <label>Secure MIME</label> + <label_xalign>0</label_xalign> + <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkTable</class> + <name>smime_table</name> + <border_width>3</border_width> + <rows>2</rows> + <columns>3</columns> + <homogeneous>False</homogeneous> + <row_spacing>4</row_spacing> + <column_spacing>4</column_spacing> + + <widget> + <class>GtkLabel</class> + <name>smime_key_label</name> + <label>Certificate ID:</label> + <justify>GTK_JUSTIFY_RIGHT</justify> + <wrap>False</wrap> + <xalign>1</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>smime_key</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>smime_encrypt_to_self</name> + <can_focus>True</can_focus> + <label>Always encrypt to myself when sending encrypyed mail</label> + <active>True</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>0</left_attach> + <right_attach>2</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GnomeHRef</class> + <name>get_digital_id</name> + <can_focus>True</can_focus> + <url>http://www.verisign.com/products/class1/index.html</url> + <label>Get Digital ID...</label> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>digital_ids</name> + <can_focus>True</can_focus> + <label>Digital IDs...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblSecurity</name> + <label>Security</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> </widget> </widget> diff --git a/mail/mail-config.h b/mail/mail-config.h index bb4fb8fbce..e4f9b1d020 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -57,6 +57,12 @@ typedef struct { gchar *drafts_folder_name, *drafts_folder_uri; gchar *sent_folder_name, *sent_folder_uri; + + gchar *pgp_key; + gboolean pgp_encrypt_to_self; + + gchar *smime_key; + gboolean smime_encrypt_to_self; } MailConfigAccount; typedef enum { |