From 130017e15709e1f16cac8271214d0f7f41845a2f Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 5 Apr 2001 02:06:26 +0000 Subject: Merge from evolution-0-10 to evolution-0-10-merge-0 into head. 2001-04-05 Not Zed * Merge from evolution-0-10 to evolution-0-10-merge-0 into head. svn path=/trunk/; revision=9193 --- mail/ChangeLog | 118 ++++++++++++++++++++++++++++++++++++++++++ mail/folder-browser-factory.c | 45 ++++++++-------- mail/folder-browser.c | 20 +++++++ mail/folder-browser.h | 5 ++ mail/mail-config.c | 27 ++++++++++ mail/mail-config.h | 3 ++ mail/mail-local.c | 2 +- mail/mail-ops.c | 6 +-- mail/message-list.c | 64 ++++++++++++++++++++--- 9 files changed, 258 insertions(+), 32 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index ce4e988421..166bf7ba59 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,7 @@ +2001-04-05 Not Zed + + * Merge from evolution-0-10 to evolution-0-10-merge-0 into head. + 2001-04-04 Kjartan Maraas * mail-account-gui.c: Add prototype for service_changed(). @@ -153,6 +157,120 @@ * mail-account-gui.c (save_service): Update calls to camel_url_to_string. +2001-04-03 Dan Winship + + * folder-browser-factory.c (control_activate): Sync the folder on + activate. + + * session.c (mail_session_remember_password): Use the same + URL-transforming rules we use when hashing the password so this + actually works. + +2001-04-03 Not Zed + + * mail-ops.c (mail_send_message): Strip header content before using it. + +2001-04-02 Iain Holmes + + * importers/elm-importer.c (elm_can_import): Calls is_kmail to check for + kmail files. + (is_kmail): Checks if the given directory is a KMail directory. + +2001-04-02 Dan Winship + + * mail-account-gui.c: Add a "provider_type" arg to + MailAccountGuiService. + (transport_needs_auth_toggled): Call service_changed if enabling + the auth pane so the status of the "Check supported types" button + will be correct. + (service_check_supported): Use gsvc->provider_type, not + CAMEL_PROVIDER_STORE. + (mail_account_gui_new): Pass the transport as the user_data to the + "changed" signal on transport.hostname, not the store. + (mail_account_gui_setup): Set up provider_type fields + +2001-04-02 Iain Holmes + + * importers/elm-importer.c (elm_can_import): Check for some MH files + to make sure that the dir really is an Elm dir. + +2001-03-30 Not Zed + + * folder-browser.c (folder_browser_toggle_hide_deleted): New + function to listen for hide_deleted changes. + (folder_browser_toggle_hide_deleted): Only svae the hide-deleted + state if we are not setting a trash folder. + + * folder-browser-factory.c (control_activate): Set the + hide_deleted flag appropriately/setup the menu's appropriately. + (control_activate): Workaround to Force setting of options by + bypassing bonobo notification, since it doesn't properly handle + changed components. + + * mail-config.c (mail_config_get_hide_deleted): + (mail_config_set_hide_deleted): New functions for + accessing/setting the hide deleted state. + (mail_config_write_on_exit): + (config_read): Save/load the hide_deleted flag. + + * message-list.c (main_folder_changed): Oops, remember to copy + over all the rest of the changes too if we removed some. + (find_next_undeleted): Find the first undeleted message below us. + This of course does not follow sorting conventions, but thats + etree. Have to ask chris if there is a way to make it work like + that. + (message_list_set_hidedeleted): Check we dont set hide_delete on a + vtrash. + (build_tree): If the message has vanished, try and get the next + undeleted message set, etc, if it still exists. The set_cursor() + function seems very broken but i'm sure e-lahey will get to it + soon. + (build_flat): Similarly for above. + +2001-03-30 Dan Winship + + * mail-config.c (check_service_check): Register for cancellation. + (mail_config_check_service): Pop up a modal dialog with a message + and a "Cancel" button for the duration of the check. + + * component-factory.c (debug_cb): If the EvolutionShellComponent + emits a "debug" signal, turn on camel_verbose_debug. + +2001-03-30 Radek Doulik + + * mail-display.c (mail_display_redisplay): reset last_active + +2001-03-29 Dan Winship + + * mail-format.c (call_handler_function): if called with a + multipart that's really a 0-part, spew an error and display as + source. + + * mail-display.c (pixmap_press): Ignore "funky" button clicks + (like scroll wheel scrolls) + +2001-03-29 Dan Winship + + * mail-account-editor.c (switch_page): Fix this so the "Receiving + Options" page gets filled in again. + + * mail-send-recv.c (receive_get_folder): Doh! This was storing + "struct _folder_info"s in the cache and then trying to read them + back as CamelFolders. Fixicate. Fixes the "crash with 2 POP + accounts" bug. + + * session.c (auth_callback): Update call to camel_url_to_string. + (Don't include the params in the password hash table key.) + + * mail-config.c (mail_config_folder_to_cachename): Call + camel_url_to_string with HIDE_PASSWORD and HIDE_PARAMS so that + changing URL params doesn't change the cachename. + + * mail-ops.c (add_vtrash_info): + * mail-local.c (reconfigure_folder_reconfigure): + * mail-account-gui.c (save_service): Update calls to + camel_url_to_string. + 2001-03-29 Not Zed * mail-local.c (init_trash): Create a vtrash folder, not a vee folder. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 6c80677352..4d7644d149 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -38,6 +38,7 @@ #include "mail-session.h" #include "e-util/e-gui-utils.h" +#include "camel/camel-vtrash-folder.h" /* The FolderBrowser BonoboControls we have. */ static EList *control_list = NULL; @@ -222,6 +223,7 @@ control_activate (BonoboControl *control, { GtkWidget *folder_browser; Bonobo_UIContainer container; + int state; container = bonobo_control_get_remote_ui_container (control); bonobo_ui_component_set_container (uic, container); @@ -241,27 +243,28 @@ control_activate (BonoboControl *control, uic, EVOLUTION_DATADIR, "evolution-mail.xml", "evolution-mail"); - if (mail_config_get_thread_list ()) - bonobo_ui_component_set_prop ( - uic, "/commands/ViewThreaded", "state", "1", NULL); - else - bonobo_ui_component_set_prop ( - uic, "/commands/ViewThreaded", "state", "0", NULL); - - bonobo_ui_component_add_listener ( - uic, "ViewThreaded", - folder_browser_toggle_threads, folder_browser); - - if (mail_config_get_view_source ()) - bonobo_ui_component_set_prop (uic, "/commands/ViewSource", - "state", "1", NULL); - else - bonobo_ui_component_set_prop (uic, "/commands/ViewSource", - "state", "0", NULL); - - bonobo_ui_component_add_listener (uic, "ViewSource", - folder_browser_toggle_view_source, - folder_browser); + state = mail_config_get_thread_list(); + bonobo_ui_component_set_prop(uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL); + bonobo_ui_component_add_listener(uic, "ViewThreaded", folder_browser_toggle_threads, folder_browser); + /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ + folder_browser_toggle_threads(uic, "", Bonobo_UIComponent_STATE_CHANGED, state?"1":"0", folder_browser); + + state = mail_config_get_view_source(); + bonobo_ui_component_set_prop(uic, "/commands/ViewSource", "state", state?"1":"0", NULL); + bonobo_ui_component_add_listener(uic, "ViewSource", folder_browser_toggle_view_source, folder_browser); + /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ + folder_browser_toggle_view_source(uic, "", Bonobo_UIComponent_STATE_CHANGED, state?"1":"0", folder_browser); + + if (fb->folder && CAMEL_IS_VTRASH_FOLDER(fb->folder)) { + bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL); + state = FALSE; + } else { + state = mail_config_get_hide_deleted(); + } + bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "state", state?"1":"0", NULL); + bonobo_ui_component_add_listener(uic, "HideDeleted", folder_browser_toggle_hide_deleted, folder_browser); + /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ + folder_browser_toggle_hide_deleted(uic, "", Bonobo_UIComponent_STATE_CHANGED, state?"1":"0", folder_browser); folder_browser_setup_view_menus (fb, uic); folder_browser_setup_property_menu (fb, uic); diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 37267950ec..2c1fd764b9 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -41,6 +41,9 @@ #include "mail-local.h" #include "mail-config.h" +#include +#include + #define d(x) x #define PARENT_TYPE (gtk_table_get_type ()) @@ -307,6 +310,23 @@ folder_browser_toggle_threads (BonoboUIComponent *component, message_list_set_threaded (fb->message_list, atoi (state)); } +void +folder_browser_toggle_hide_deleted (BonoboUIComponent *component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) +{ + FolderBrowser *fb = user_data; + + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + if (!(fb->folder && CAMEL_IS_VTRASH_FOLDER(fb->folder))) + mail_config_set_hide_deleted (atoi (state)); + message_list_set_hidedeleted (fb->message_list, atoi (state)); +} + void folder_browser_toggle_view_source (BonoboUIComponent *component, const char *path, diff --git a/mail/folder-browser.h b/mail/folder-browser.h index b7c424dfbd..9e4531b055 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -111,4 +111,9 @@ void folder_browser_toggle_view_source (BonoboUIComponent *component, const char *state, gpointer user_data); +void folder_browser_toggle_hide_deleted (BonoboUIComponent *component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data); #endif /* _FOLDER_BROWSER_H_ */ diff --git a/mail/mail-config.c b/mail/mail-config.c index cf7e1eb517..50b0e49874 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -46,6 +46,7 @@ typedef struct { gboolean thread_list; gboolean view_source; + gboolean hide_deleted; gint paned_size; gboolean send_html; gboolean citation_highlight; @@ -390,6 +391,14 @@ config_read (void) config->thread_list = FALSE; g_free (str); + /* Hide deleted automatically */ + str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted", + evolution_dir); + config->hide_deleted = gnome_config_get_bool_with_default (str, &def); + if (def) + config->hide_deleted = FALSE; + g_free (str); + /* Size of vpaned in mail view */ str = g_strdup_printf ("=%s/config/Mail=/Display/paned_size", evolution_dir); @@ -543,6 +552,12 @@ mail_config_write_on_exit (void) evolution_dir); gnome_config_set_bool (str, config->thread_list); g_free (str); + + /* Hide deleted automatically */ + str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted", + evolution_dir); + gnome_config_set_bool (str, config->hide_deleted); + g_free (str); /* Size of vpaned in mail view */ str = g_strdup_printf ("=%s/config/Mail=/Display/paned_size", @@ -632,6 +647,18 @@ mail_config_set_view_source (gboolean value) config->view_source = value; } +gboolean +mail_config_get_hide_deleted (void) +{ + return config->hide_deleted; +} + +void +mail_config_set_hide_deleted (gboolean value) +{ + config->hide_deleted = value; +} + gint mail_config_get_paned_size (void) { diff --git a/mail/mail-config.h b/mail/mail-config.h index 889037012f..3989635521 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -88,6 +88,9 @@ void mail_config_set_thread_list (gboolean value); gboolean mail_config_get_view_source (void); void mail_config_set_view_source (gboolean value); +gboolean mail_config_get_hide_deleted (void); +void mail_config_set_hide_deleted (gboolean value); + gint mail_config_get_paned_size (void); void mail_config_set_paned_size (gint size); diff --git a/mail/mail-local.c b/mail/mail-local.c index c1c6ff54c7..c5f32c5376 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -357,7 +357,7 @@ trash_finalize (CamelObject *trash, gpointer event_data, gpointer user_data) store->vtrash = NULL; } - + static void init_trash (CamelStore *store) { diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 57397af8e7..e4b5e111d4 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -516,14 +516,14 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte if (!transport_url) { header = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); if (header) { - transport_url = g_strdup (header); + transport_url = g_strstrip(g_strdup (header)); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); } } if (!sent_folder_uri) { header = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"); if (header) { - sent_folder_uri = g_strdup (header); + sent_folder_uri = g_strstrip(g_strdup (header)); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"); } } @@ -693,7 +693,7 @@ send_queue_send(struct _mail_msg *mm) uids = camel_folder_get_uids (m->queue); if (uids == NULL || uids->len == 0) return; - + if (m->cancel) camel_operation_register (m->cancel); diff --git a/mail/message-list.c b/mail/message-list.c index b891cd9fbf..2747f89b86 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1363,6 +1363,30 @@ free_tree_state(GHashTable *expanded_nodes) g_hash_table_destroy(expanded_nodes); } +/* we try and find something that isn't deleted in our tree + there is actually no assurance that we'll find somethign that will + still be there next time, but its probably going to work most of the time */ +static const char *find_next_undeleted(MessageList *ml, ETreePath *node) +{ + ETreePath *child; + + child = e_tree_model_node_get_first_child(ml->model, node); + if (child) { + const char *ret = find_next_undeleted(ml, child); + if (ret) + return ret; + } + while (node) { + CamelMessageInfo *info = e_tree_memory_node_get_data(E_TREE_MEMORY(ml->model), node); + if ((info->flags & CAMEL_MESSAGE_DELETED) == 0) { + return camel_message_info_uid(info); + } + node = e_tree_model_node_get_next(ml->model, node); + } + + return NULL; +} + /* only call if we have a tree model */ /* builds the tree structure */ static void build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, int *row, GHashTable *); @@ -1398,8 +1422,14 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c ml->tree_root = e_tree_memory_node_insert(E_TREE_MEMORY(etm), NULL, 0, NULL); } - if (ml->cursor_uid) - saveuid = g_strdup(ml->cursor_uid); + if (ml->cursor_uid) { + if (ml->hidedeleted) { + ETreePath *node = g_hash_table_lookup(ml->uid_nodemap, ml->cursor_uid); + saveuid = g_strdup(find_next_undeleted(ml, node)); + } else { + saveuid = g_strdup(ml->cursor_uid); + } + } #define BROKEN_ETREE /* avoid some broken code in etree(?) by not using the incremental update */ @@ -1433,6 +1463,10 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c e_tree_set_cursor(ml->tree, node); } g_free(saveuid); + } else if (ml->cursor_uid) { + g_free(ml->cursor_uid); + ml->cursor_uid = NULL; + gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); } free_tree_state(expanded_nodes); @@ -1711,8 +1745,14 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) gettimeofday(&start, NULL); #endif - if (ml->cursor_uid) - saveuid = g_strdup(ml->cursor_uid); + if (ml->cursor_uid) { + if (ml->hidedeleted) { + ETreePath *node = g_hash_table_lookup(ml->uid_nodemap, ml->cursor_uid); + saveuid = g_strdup(find_next_undeleted(ml, node)); + } else { + saveuid = g_strdup(ml->cursor_uid); + } + } #ifndef BROKEN_ETREE if (changes) { @@ -1735,7 +1775,7 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) #endif if (saveuid) { - node = g_hash_table_lookup(ml->uid_nodemap, saveuid); + ETreePath *node = g_hash_table_lookup(ml->uid_nodemap, saveuid); if (node == NULL) { g_free(ml->cursor_uid); ml->cursor_uid = NULL; @@ -1744,6 +1784,10 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) e_tree_set_cursor(ml->tree, node); } g_free(saveuid); + } else if (ml->cursor_uid) { + g_free(ml->cursor_uid); + ml->cursor_uid = NULL; + gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); } #ifdef TIMEIT @@ -1846,8 +1890,11 @@ main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) camel_folder_free_message_info(folder, info); } - if (newchanges->uid_added->len != changes->uid_added->len - || newchanges->uid_removed->len != changes->uid_removed->len) { + if (newchanges->uid_added->len > 0 || newchanges->uid_removed->len > 0) { + for (i=0;iuid_added->len;i++) + camel_folder_change_info_add_uid(newchanges, changes->uid_added->pdata[i]); + for (i=0;iuid_removed->len;i++) + camel_folder_change_info_remove_uid(newchanges, changes->uid_removed->pdata[i]); camel_folder_change_info_free(changes); changes = newchanges; } else { @@ -2066,6 +2113,9 @@ message_list_set_threaded(MessageList *ml, gboolean threaded) void message_list_set_hidedeleted(MessageList *ml, gboolean hidedeleted) { + if (ml->folder && CAMEL_IS_VTRASH_FOLDER(ml->folder)) + hidedeleted = FALSE; + if (ml->hidedeleted ^ hidedeleted) { ml->hidedeleted = hidedeleted; -- cgit v1.2.3