2005-09-09 [colin] 1.9.14cvs13
authorColin Leroy <colin@colino.net>
Fri, 9 Sep 2005 16:49:10 +0000 (16:49 +0000)
committerColin Leroy <colin@colino.net>
Fri, 9 Sep 2005 16:49:10 +0000 (16:49 +0000)
* 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
PATCHSETS
configure.ac
src/etpan/imap-thread.c
src/etpan/imap-thread.h
src/gtk/prefswindow.c
src/imap.c
src/mainwindow.c
src/mainwindow.h
src/prefs_spelling.c

index 114decf8f6e3a3cfb70e407e0a8f74183fc0517a..3d0cb5461b0a98d8ad1b26753fda546d4d081592 100644 (file)
@@ -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
index af4b1409b42879cff8c168ba501e11b2f6c967cf..fb3e9d3635548efc3d0edb5d3aface9dbbdbba40 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 1831ef87a6e956cc3d7663fcb0f1f2352ec0b75c..c6edf0d0118a4ab6e742e611798b8d7f385b9788 100644 (file)
@@ -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=
 
index 6fb81a3fa13b8c65e19338453bf3d3f7ee291ebe..43868a03986b7bba614c88ca7c8235628fde22f8 100644 (file)
@@ -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) {
index cbda7c9a4b8021707f7b7bde8ddcd3110a1db1d2..ea40eac1dec3ad9a9c51e3c50536fe8801ff9103 100644 (file)
@@ -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,
index 0cb2caecea1946f91d6c4c98aaad407d81e0895b..ddfb90583530a4536ec291f7799ff8a510a0241a 100644 (file)
@@ -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);
index 3e33680fc3519cdd76a3bbce49ca02f7d3ab9c8c..211dc3a4d1ab1dda2c3894f0a17b7657d8d07368 100644 (file)
@@ -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);
index e8155fbb67aa1171902b67f6d6d8524bab1077fc..f1d90a4b2107d3ce7e12e08d1287993f76c27643 100644 (file)
@@ -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},
index 60a4f169ca7592c1299223d8765fefcfa0656128..840688655928f9e33550ebad321f0061b8fdbda8 100644 (file)
@@ -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
index 05d3a97a64776fa61665b30f22c8538951d2ca9f..30006bdf035361ab35d16345fb2ec0852eddea36 100644 (file)
@@ -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,"@"))