From 3206d072bf2428930bea2d4c7a66bd68db1a467c Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 20 Jan 2006 10:44:24 +0000 Subject: allow non-ascii mailto string and filename on --compose option. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@916 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 6 ++++++ ChangeLog.ja | 6 ++++++ src/compose.c | 8 ++++++-- src/main.c | 35 +++++++++++++++++++++++++++++++---- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e705628..b0583377 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-20 + + * src/compose.c: compose_new(): fixed filename encoding. + * src/main.c: open_compose_new(): allow non-ascii mailto string and + filename. + 2006-01-20 * src/alertpanel.c diff --git a/ChangeLog.ja b/ChangeLog.ja index 40c4addb..aca98832 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,9 @@ +2006-01-20 + + * src/compose.c: compose_new(): ファイル名エンコーディングを修正。 + * src/main.c: open_compose_new(): 非 ascii mailto 文字列とファイル名 + が使えるようにした。 + 2006-01-20 * src/alertpanel.c diff --git a/src/compose.c b/src/compose.c index 3a216f47..071cbd7b 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -721,8 +721,12 @@ void compose_new(PrefsAccount *account, FolderItem *item, const gchar *mailto, gchar *file; for (i = 0; i < attach_files->len; i++) { + gchar *utf8file; + file = g_ptr_array_index(attach_files, i); - compose_attach_append(compose, file, file, NULL); + utf8file = conv_filename_to_utf8(file); + compose_attach_append(compose, file, utf8file, NULL); + g_free(utf8file); } } diff --git a/src/main.c b/src/main.c index e815c91f..f06aab38 100644 --- a/src/main.c +++ b/src/main.c @@ -1127,14 +1127,41 @@ static void migrate_old_config(void) static void open_compose_new(const gchar *address, GPtrArray *attach_files) { - gchar *addr = NULL; + gchar *utf8addr = NULL; +#ifdef G_OS_WIN32 + GPtrArray *utf8files = NULL; +#endif if (address) { - Xstrdup_a(addr, address, return); - g_strstrip(addr); + utf8addr = g_locale_to_utf8(address, -1, NULL, NULL, NULL); + if (utf8addr) + g_strstrip(utf8addr); } - compose_new(NULL, NULL, addr, attach_files); +#ifdef G_OS_WIN32 + if (attach_files) { + gint i; + gchar *utf8file; + + utf8files = g_ptr_array_new(); + for (i = 0; i < attach_files->len; i++) { + file = g_ptr_array_index(attach_files, i); + utf8file = g_locale_to_utf8(file, -1, NULL, NULL, NULL); + if (utf8file) + g_ptr_array_add(utf8files, utf8file); + } + } + + compose_new(NULL, NULL, utf8addr, utf8files); + if (utf8files) { + ptr_array_free_strings(utf8files); + g_ptr_array_free(utf8files); + } +#else + compose_new(NULL, NULL, utf8addr, attach_files); +#endif + + g_free(utf8addr); } static void send_queue(void) -- cgit v1.2.3