sync with 0.7.8cvs3
authorPaul Mangan <paul@claws-mail.org>
Wed, 19 Jun 2002 08:04:32 +0000 (08:04 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 19 Jun 2002 08:04:32 +0000 (08:04 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/compose.c
src/procmime.c
src/procmime.h
src/textview.c

index 4f4fedf..0272367 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-06-19
+
+       * src/compose.c: if the Content-Type of a file is text/*, check
+         its content and set the optimal Content-Transfer-Encoding (thanks
+         to Yoichi Yuasa).
+
+2002-06-18
+
+       * src/textview.c: textview_key_pressed(): pass key press event to
+         main window to activate menu shortcuts (thanks to Alfons).
+
 2002-06-18
 
        * src/folder.c: folder_build_tree(): use strtoul() instead of atoi()
index ec78b3f..32213c9 100644 (file)
@@ -1,4 +1,9 @@
-2002-06-18 [paul]      0.7.8claws8
+2002-06-19 [paul]      0.7.8claws9
+
+       * sync with 0.7.8claws9
+               see ChangeLog 2002-06-18 and 2002-06-19
+
+2002-06-19 [paul]      0.7.8claws8
 
        * sync with 0.7.8cvs1
                see ChangeLog 2002-06-18
index 9967f77..2202667 100644 (file)
@@ -1,3 +1,15 @@
+2002-06-19
+
+       * src/compose.c: ¥Õ¥¡¥¤¥ë¤Î Content-Type ¤¬ text/* ¤Î¾ì¹ç¤Ï¡¢¤½¤Î
+         ÆâÍƤò¥Á¥§¥Ã¥¯¤·¤ÆºÇŬ¤Ê Content-Transfer-Encoding ¤ò»ØÄê
+         (ÅòÀõ¤µ¤ó thanks)¡£
+
+2002-06-18
+
+       * src/textview.c: textview_key_pressed(): ¥á¥Ë¥å¡¼¥·¥ç¡¼¥È¥«¥Ã¥È¤ò
+         ºîÆ°¤µ¤»¤ë¤¿¤á¤Ë¥­¡¼¥×¥ì¥¹¥¤¥Ù¥ó¥È¤ò¥á¥¤¥ó¥¦¥£¥ó¥É¥¦¤ËÅϤ¹¤è¤¦¤Ë
+         ¤·¤¿(Alfons ¤µ¤ó thanks)¡£
+
 2002-06-18
 
        * src/folder.c: folder_build_tree(): ·«¤ê²¼¤²¤òËɤ°¤¿¤á¤Ë mtime ¤Ë
index 6b88634..b63f62d 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws8
+EXTRA_VERSION=claws9
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 2366e2d..4c82888 100644 (file)
@@ -1966,16 +1966,24 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                                (_("Message: %s"),
                                 g_basename(filename ? filename : file));
                } else {
-                       ainfo->encoding = ENC_BASE64;
+                       if (!g_strncasecmp(content_type, "text", 4))
+                               ainfo->encoding =
+                                       procmime_get_encoding_for_file(file);
+                       else
+                               ainfo->encoding = ENC_BASE64;
                        ainfo->name = g_strdup
                                (g_basename(filename ? filename : file));
                }
        } else {
                ainfo->content_type = procmime_get_mime_type(file);
-               if (!ainfo->content_type)
+               if (!ainfo->content_type) {
                        ainfo->content_type =
                                g_strdup("application/octet-stream");
-               ainfo->encoding = ENC_BASE64;
+                       ainfo->encoding = ENC_BASE64;
+               } else if (!g_strncasecmp(ainfo->content_type, "text", 4))
+                       ainfo->encoding = procmime_get_encoding_for_file(file);
+               else
+                       ainfo->encoding = ENC_BASE64;
                ainfo->name = g_strdup(g_basename(filename ? filename : file)); 
        }
        ainfo->size = size;
index 503466a..f0038bc 100644 (file)
@@ -1262,6 +1262,33 @@ EncodingType procmime_get_encoding_for_charset(const gchar *charset)
                /* return ENC_QUOTED_PRINTABLE; */
 }
 
+EncodingType procmime_get_encoding_for_file(const gchar *file)
+{
+       FILE *fp;
+       guchar buf[BUFSIZ];
+       size_t len;
+
+       if ((fp = fopen(file, "rb")) == NULL) {
+               FILE_OP_ERROR(file, "fopen");
+               return ENC_UNKNOWN;
+       }
+
+       while ((len = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
+               guchar *p;
+               gint i;
+
+               for (p = buf, i = 0; i < len; p++, i++) {
+                       if (*p & 0x80) {
+                               fclose(fp);
+                               return ENC_BASE64;
+                       }
+               }
+       }
+
+       fclose(fp);
+       return ENC_7BIT;
+}
+
 const gchar *procmime_get_encoding_str(EncodingType encoding)
 {
        static const gchar *encoding_str[] = {
index 56cd66a..8373a12 100644 (file)
@@ -177,6 +177,7 @@ gchar *procmime_get_mime_type               (const gchar    *filename);
 GList *procmime_get_mime_type_list     (void);
 
 EncodingType procmime_get_encoding_for_charset (const gchar    *charset);
+EncodingType procmime_get_encoding_for_file    (const gchar    *file);
 const gchar *procmime_get_encoding_str         (EncodingType    encoding);
 
 void renderer_read_config(void);
index 531e396..df92f55 100644 (file)
@@ -1660,7 +1660,8 @@ static gint textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
        case GDK_y:
        case GDK_t:
        case GDK_l:
-               if (messageview->type == MVIEW_MIME) {
+               if (messageview->type == MVIEW_MIME &&
+                   textview == messageview->mimeview->textview) {
                        KEY_PRESS_EVENT_STOP();
                        mimeview_pass_key_press_event(messageview->mimeview,
                                                      event);
@@ -1668,8 +1669,15 @@ static gint textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
                }
                /* fall through */
        default:
-               if (summaryview)
-                       summary_pass_key_press_event(summaryview, event);
+               if (summaryview &&
+                   event->window != messageview->mainwin->window->window) {
+                       GdkEventKey tmpev = *event;
+
+                       tmpev.window = messageview->mainwin->window->window;
+                       KEY_PRESS_EVENT_STOP();
+                       gtk_widget_event(messageview->mainwin->window,
+                                        (GdkEvent *)&tmpev);
+               }
                break;
        }