From 61a27a80a800bb8a74b7f49a1b515bc1a41e1486 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Fri, 9 Sep 2005 16:49:10 +0000 Subject: [PATCH] 2005-09-09 [colin] 1.9.14cvs13 * src/imap.c * src/etpan/imap-thread.c * src/etpan/imap-thread.h Fix moving from queue or drafts to normal folders Fix bug #794 (No way to delete without expunging) Take flags unset by other mailers into account Take deleted flag set by other mailers into account Fix unsetting REPLIED flag Fix crash when capabilities can't be retrieved * src/mainwindow.c * src/mainwindow.h Add M_DELAYED_FLAGS condition, and let the user use Execute in order to be able to expunge deleted mails, even if he's not in delayed execute mode * src/prefs_spelling.c Use 'en' dictionary by default if LANG is POSIX or C * src/gtk/prefswindow.c Fix bug #767 (Preferences windows expanding) by making the window a bit larger when the resolution is greater than 640x480, and by putting the prefs in a GtkScrolledWindow. --- ChangeLog-gtk2.claws | 24 ++++++++++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/etpan/imap-thread.c | 10 ++++++- src/etpan/imap-thread.h | 1 + src/gtk/prefswindow.c | 18 ++++++++++-- src/imap.c | 63 +++++++++++++++++++++++++++++++++++------ src/mainwindow.c | 4 +++ src/mainwindow.h | 1 + src/prefs_spelling.c | 11 +++++-- 10 files changed, 120 insertions(+), 15 deletions(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index 114decf8f..3d0cb5461 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,27 @@ +2005-09-09 [colin] 1.9.14cvs13 + + * src/imap.c + * src/etpan/imap-thread.c + * src/etpan/imap-thread.h + Fix moving from queue or drafts to normal folders + Fix bug #794 (No way to delete without expunging) + Take flags unset by other mailers into account + Take deleted flag set by other mailers into account + Fix unsetting REPLIED flag + Fix crash when capabilities can't be retrieved + * src/mainwindow.c + * src/mainwindow.h + Add M_DELAYED_FLAGS condition, and let the user use + Execute in order to be able to expunge deleted mails, + even if he's not in delayed execute mode + * src/prefs_spelling.c + Use 'en' dictionary by default if LANG is POSIX or C + * src/gtk/prefswindow.c + Fix bug #767 (Preferences windows expanding) by making + the window a bit larger when the resolution is greater + than 640x480, and by putting the prefs in a + GtkScrolledWindow. + 2005-09-09 [paul] 1.9.14cvs12 * AUTHORS diff --git a/PATCHSETS b/PATCHSETS index af4b1409b..fb3e9d363 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -781,3 +781,4 @@ ( cvs diff -u -r 1.179.2.67 -r 1.179.2.68 src/imap.c; ) > 1.9.14cvs10.patchset ( cvs diff -u -r 1.274.2.62 -r 1.274.2.63 src/mainwindow.c; cvs diff -u -r 1.1.4.10 -r 1.1.4.11 src/common/xml.c; ) > 1.9.14cvs11.patchset ( cvs diff -u -r 1.100.2.24 -r 1.100.2.25 AUTHORS; cvs diff -u -r 1.654.2.822 -r 1.654.2.823 configure.ac; cvs diff -u -r -1.11.2.2 -r -1.11.2.3 po/zh_TW.Big5.po; diff -u /dev/null po/zh_TW.po; ) > 1.9.14cvs12.patchset +( cvs diff -u -r 1.179.2.68 -r 1.179.2.69 src/imap.c; cvs diff -u -r 1.274.2.63 -r 1.274.2.64 src/mainwindow.c; cvs diff -u -r 1.39.2.5 -r 1.39.2.6 src/mainwindow.h; cvs diff -u -r 1.5.2.9 -r 1.5.2.10 src/prefs_spelling.c; cvs diff -u -r 1.1.4.19 -r 1.1.4.20 src/etpan/imap-thread.c; cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/etpan/imap-thread.h; cvs diff -u -r 1.12.2.20 -r 1.12.2.21 src/gtk/prefswindow.c; ) > 1.9.14cvs13.patchset diff --git a/configure.ac b/configure.ac index 1831ef87a..c6edf0d01 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=14 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=12 +EXTRA_VERSION=13 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c index 6fb81a3fa..43868a039 100644 --- a/src/etpan/imap-thread.c +++ b/src/etpan/imap-thread.c @@ -347,7 +347,7 @@ static void capability_run(struct etpan_thread_op * op) r = mailimap_capability(param->imap, &caps); result->error = r; - result->caps = caps; + result->caps = (r == 0 ? caps : NULL); } @@ -1030,6 +1030,14 @@ static void search_run(struct etpan_thread_op * op) NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); break; + case IMAP_SEARCH_TYPE_DELETED: + search_type_key = mailimap_search_key_new(MAILIMAP_SEARCH_KEY_DELETED, + NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, 0, + NULL, NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL); + break; } if (search_type_key != NULL) { diff --git a/src/etpan/imap-thread.h b/src/etpan/imap-thread.h index cbda7c9a4..ea40eac1d 100644 --- a/src/etpan/imap-thread.h +++ b/src/etpan/imap-thread.h @@ -50,6 +50,7 @@ enum { IMAP_SEARCH_TYPE_UNSEEN, IMAP_SEARCH_TYPE_ANSWERED, IMAP_SEARCH_TYPE_FLAGGED, + IMAP_SEARCH_TYPE_DELETED, }; int imap_threaded_search(Folder * folder, int search_type, diff --git a/src/gtk/prefswindow.c b/src/gtk/prefswindow.c index 0cb2caece..ddfb90583 100644 --- a/src/gtk/prefswindow.c +++ b/src/gtk/prefswindow.c @@ -50,6 +50,7 @@ struct _PrefsWindow GtkWidget *window; GtkWidget *table1; GtkWidget *scrolledwindow1; + GtkWidget *scrolledwindow2; GtkWidget *tree_view; GtkWidget *table2; GtkWidget *pagelabel; @@ -334,6 +335,8 @@ static void prefswindow_build_tree(GtkWidget *tree_view, GSList *prefs_pages) void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer data, GtkDestroyNotify func) { PrefsWindow *prefswindow; + gint x = gdk_screen_width(); + gint y = gdk_screen_height(); prefswindow = g_new0(PrefsWindow, 1); @@ -343,7 +346,12 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer dat prefswindow->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(prefswindow->window), title); - gtk_window_set_default_size(GTK_WINDOW(prefswindow->window), 600, 440); + + if (x < 800 && y < 600) + gtk_window_set_default_size(GTK_WINDOW(prefswindow->window), 600, 440); + else + gtk_window_set_default_size(GTK_WINDOW(prefswindow->window), 700, 550); + gtk_window_set_position (GTK_WINDOW(prefswindow->window), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (prefswindow->window), TRUE); gtk_window_set_resizable (GTK_WINDOW(prefswindow->window), TRUE); @@ -383,12 +391,18 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer dat gtk_misc_set_alignment(GTK_MISC(prefswindow->pagelabel), 0, 0.0); gtk_container_add(GTK_CONTAINER(prefswindow->labelframe), prefswindow->pagelabel); + prefswindow->scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL); + gtk_widget_show(prefswindow->scrolledwindow2); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(prefswindow->scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + prefswindow->notebook = gtk_notebook_new(); gtk_widget_show(prefswindow->notebook); gtk_notebook_set_scrollable(GTK_NOTEBOOK(prefswindow->notebook), TRUE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(prefswindow->notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(prefswindow->notebook), FALSE); - gtk_table_attach(GTK_TABLE(prefswindow->table2), prefswindow->notebook, 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 8, 8); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(prefswindow->scrolledwindow2), + prefswindow->notebook); + gtk_table_attach(GTK_TABLE(prefswindow->table2), prefswindow->scrolledwindow2, 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 8, 8); prefswindow->empty_page = gtk_label_new(""); gtk_widget_show(prefswindow->empty_page); diff --git a/src/imap.c b/src/imap.c index 3e33680fc..211dc3a4d 100644 --- a/src/imap.c +++ b/src/imap.c @@ -990,7 +990,8 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, for (cur = file_list; cur != NULL; cur = cur->next) { IMAPFlags iflags = 0; guint32 new_uid = 0; - + gchar *real_file = NULL; + gboolean file_is_tmp = FALSE; fileinfo = (MsgFileInfo *)cur->data; if (fileinfo->flags) { @@ -1001,18 +1002,34 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, if (!MSG_IS_UNREAD(*fileinfo->flags)) iflags |= IMAP_FLAG_SEEN; } - + + if ((MSG_IS_QUEUED(*fileinfo->flags) || MSG_IS_DRAFT(*fileinfo->flags)) + && !folder_has_parent_of_type(dest, F_QUEUE) + && !folder_has_parent_of_type(dest, F_DRAFT)) { + real_file = get_tmp_file(); + file_is_tmp = TRUE; + if (procmsg_remove_special_headers(fileinfo->file, real_file) !=0) { + g_free(real_file); + g_free(destdir); + return -1; + } + } else + real_file = g_strdup(fileinfo->file); + if (folder_has_parent_of_type(dest, F_QUEUE) || folder_has_parent_of_type(dest, F_OUTBOX) || folder_has_parent_of_type(dest, F_DRAFT) || folder_has_parent_of_type(dest, F_TRASH)) iflags |= IMAP_FLAG_SEEN; - ok = imap_cmd_append(session, destdir, fileinfo->file, iflags, + ok = imap_cmd_append(session, destdir, real_file, iflags, &new_uid); if (ok != IMAP_SUCCESS) { - g_warning("can't append message %s\n", fileinfo->file); + g_warning("can't append message %s\n", real_file); + if (file_is_tmp) + g_unlink(real_file); + g_free(real_file); g_free(destdir); return -1; } @@ -1023,6 +1040,8 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, GINT_TO_POINTER(dest->last_num + 1)); if (last_uid < new_uid) last_uid = new_uid; + if (file_is_tmp) + g_unlink(real_file); } g_free(destdir); @@ -1147,7 +1166,9 @@ static gint imap_copy_msgs(Folder *folder, FolderItem *dest, msginfo = (MsgInfo *)msglist->data; g_return_val_if_fail(msginfo->folder != NULL, -1); - if (folder == msginfo->folder->folder) { + if (folder == msginfo->folder->folder && + !folder_has_parent_of_type(msginfo->folder, F_DRAFT) && + !folder_has_parent_of_type(msginfo->folder, F_QUEUE)) { ret = imap_do_copy_msgs(folder, dest, msglist, relation); return ret; } @@ -3194,7 +3215,12 @@ void imap_change_flags(Folder *folder, FolderItem *item, MsgInfo *msginfo, MsgPe if (!MSG_IS_REPLIED(msginfo->flags) && (newflags & MSG_REPLIED)) flags_set |= IMAP_FLAG_ANSWERED; if ( MSG_IS_REPLIED(msginfo->flags) && !(newflags & MSG_REPLIED)) - flags_set |= IMAP_FLAG_ANSWERED; + flags_unset |= IMAP_FLAG_ANSWERED; + + if (!MSG_IS_DELETED(msginfo->flags) && (newflags & MSG_DELETED)) + flags_set |= IMAP_FLAG_DELETED; + if ( MSG_IS_DELETED(msginfo->flags) && !(newflags & MSG_DELETED)) + flags_unset |= IMAP_FLAG_DELETED; numlist.next = NULL; numlist.data = GINT_TO_POINTER(msginfo->msgnum); @@ -3345,8 +3371,8 @@ static /*gint*/ void *imap_get_flags_thread(void *data) GRelation *msgflags = stuff->msgflags; IMAPSession *session; GSList *sorted_list; - GSList *unseen = NULL, *answered = NULL, *flagged = NULL; - GSList *p_unseen, *p_answered, *p_flagged; + GSList *unseen = NULL, *answered = NULL, *flagged = NULL, *deleted = NULL; + GSList *p_unseen, *p_answered, *p_flagged, *p_deleted; GSList *elem; GSList *seq_list, *cur; gboolean reverse_seen = FALSE; @@ -3443,11 +3469,23 @@ static /*gint*/ void *imap_get_flags_thread(void *data) flagged = g_slist_concat(flagged, uidlist); } + + r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_DELETED, + imapset, &lep_uidlist); + if (r == MAILIMAP_NO_ERROR) { + GSList * uidlist; + + uidlist = imap_uid_list_from_lep(lep_uidlist); + mailimap_search_result_free(lep_uidlist); + + deleted = g_slist_concat(deleted, uidlist); + } } p_unseen = unseen; p_answered = answered; p_flagged = flagged; + p_deleted = deleted; for (elem = sorted_list; elem != NULL; elem = g_slist_next(elem)) { MsgInfo *msginfo; @@ -3469,13 +3507,22 @@ static /*gint*/ void *imap_get_flags_thread(void *data) } if (gslist_find_next_num(&p_answered, msginfo->msgnum) == msginfo->msgnum) flags |= MSG_REPLIED; + else + flags &= ~MSG_REPLIED; if (gslist_find_next_num(&p_flagged, msginfo->msgnum) == msginfo->msgnum) flags |= MSG_MARKED; + else + flags &= ~MSG_MARKED; + if (gslist_find_next_num(&p_deleted, msginfo->msgnum) == msginfo->msgnum) + flags |= MSG_DELETED; + else + flags &= ~MSG_DELETED; g_relation_insert(msgflags, msginfo, GINT_TO_POINTER(flags)); } imap_lep_set_free(seq_list); g_slist_free(flagged); + g_slist_free(deleted); g_slist_free(answered); g_slist_free(unseen); g_slist_free(sorted_list); diff --git a/src/mainwindow.c b/src/mainwindow.c index e8155fbb6..f1d90a4b2 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1762,6 +1762,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin) if (inc_is_active()) state |= M_INC_ACTIVE; + if (mainwin->summaryview->deleted > 0) + state |= M_DELAYED_FLAGS; + return state; } @@ -1848,6 +1851,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin) {"/Tools/Create filter rule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED}, {"/Tools/Actions" , M_TARGET_EXIST|M_UNLOCKED}, {"/Tools/Execute" , M_DELAY_EXEC}, + {"/Tools/Execute" , M_DELAYED_FLAGS}, {"/Tools/Delete duplicated messages/In selected folder" , M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED}, {"/Configuration", M_UNLOCKED}, diff --git a/src/mainwindow.h b/src/mainwindow.h index 60a4f169c..840688655 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -49,6 +49,7 @@ typedef enum M_HIDE_READ_MSG = 1 << 13, M_DELAY_EXEC = 1 << 14, M_NOT_NEWS = 1 << 15, + M_DELAYED_FLAGS = 1 << 16, } SensitiveCond; typedef enum diff --git a/src/prefs_spelling.c b/src/prefs_spelling.c index 05d3a97a6..30006bdf0 100644 --- a/src/prefs_spelling.c +++ b/src/prefs_spelling.c @@ -357,7 +357,8 @@ void prefs_spelling_init(void) { SpellingPage *page; static gchar *path[3]; - + const gchar* language = NULL; + path[0] = _("Compose"); path[1] = _("Spell Checking"); path[2] = NULL; @@ -372,15 +373,19 @@ void prefs_spelling_init(void) prefs_gtk_register_page((PrefsPage *) page); prefs_spelling = page; + language = g_getenv("LANG"); + if (!strcmp(language, "POSIX") || !strcmp(language, "C")) + language = "en"; + if (!prefs_common.dictionary) prefs_common.dictionary = g_strdup_printf("%s%s", prefs_common.aspell_path, - g_getenv("LANG")); + language); if (!strlen(prefs_common.dictionary) || !strcmp(prefs_common.dictionary,"(None")) prefs_common.dictionary = g_strdup_printf("%s%s", prefs_common.aspell_path, - g_getenv("LANG")); + language); if (strcasestr(prefs_common.dictionary,".utf")) *(strcasestr(prefs_common.dictionary,".utf")) = '\0'; if (strstr(prefs_common.dictionary,"@")) -- 2.25.1