aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2006-05-25 14:04:48 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2006-05-25 14:04:48 +0800
commit24368cf92dd5eaae1b41b3f191a25e2cbc45e824 (patch)
treef250be111bc4afa6440414ada53ff051bb30ff0d /mail
parent0fdf8a120ccb5638527293f6155d0e16af571732 (diff)
downloadgsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.tar
gsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.tar.gz
gsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.tar.bz2
gsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.tar.lz
gsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.tar.xz
gsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.tar.zst
gsoc2013-evolution-24368cf92dd5eaae1b41b3f191a25e2cbc45e824.zip
Added code to save/attach files/mails/events to/from remote shares
svn path=/trunk/; revision=32023
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-utils.c30
-rw-r--r--mail/mail-ops.c14
3 files changed, 39 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 53ec958e50..8074c83042 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,15 @@
2006-05-25 Srinivasa Ragavan <sragavan@novell.com>
+ ** Added remote shares save/load support across evolution.
+
+ * em-utils.c: (emu_file_check_local), (emu_get_save_filesel),
+ (emu_save_part_response), (emu_save_parts_response),
+ (emu_save_messages_response): Added code to save messages/attachments
+ to remote shares.
+ * mail-ops.c: (save_messages_save), (save_part_save):
+
+2006-05-25 Srinivasa Ragavan <sragavan@novell.com>
+
** fixes bug #342092
* em-popup.c: (emp_standard_menu_factory): Read the mime
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 76c817aa17..d59d99fc00 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -90,6 +90,23 @@ extern struct _CamelSession *session;
#define d(x)
+static gboolean
+emu_file_check_local (const char *name)
+{
+ CamelURL *url;
+ gboolean local = FALSE;
+
+ url = camel_url_new (name, NULL);
+ if (url == NULL)
+ return TRUE;
+
+ if (!g_ascii_strcasecmp (url->protocol, "file"))
+ local = TRUE;
+
+ camel_url_free (url);
+
+ return local;
+}
/**
* em_utils_prompt_user:
* @parent: parent window
@@ -374,6 +391,7 @@ emu_get_save_filesel (GtkWidget *parent, const char *title, const char *name, Gt
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
+ gtk_file_chooser_set_local_only (filesel, FALSE);
#else
char *filename;
@@ -454,20 +472,22 @@ static void
emu_save_part_response(GtkWidget *filesel, int response, CamelMimePart *part)
{
const char *path;
+ const char *uri;
if (response == GTK_RESPONSE_OK) {
#ifdef USE_GTKFILECHOOSER
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel));
#else
path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
#endif
-
- if (!emu_can_save((GtkWindow *)filesel, path))
+
+ if (emu_file_check_local(uri) && !emu_can_save((GtkWindow *)filesel, path))
return;
emu_update_save_path(path, FALSE);
/* FIXME: popup error if it fails? */
- mail_save_part(part, path, NULL, NULL, FALSE);
+ mail_save_part(part, uri, NULL, NULL, FALSE);
}
gtk_widget_destroy((GtkWidget *)filesel);
@@ -512,7 +532,7 @@ emu_save_parts_response (GtkWidget *filesel, int response, GSList *parts)
GSList *selected;
if (response == GTK_RESPONSE_OK) {
#ifdef USE_GTKFILECHOOSER
- path = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (filesel));
+ path = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (filesel));
#else
path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
#endif
@@ -627,7 +647,7 @@ emu_save_messages_response(GtkWidget *filesel, int response, struct _save_messag
if (response == GTK_RESPONSE_OK) {
#ifdef USE_GTKFILECHOOSER
- path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel));
+ path = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
#else
path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
#endif
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 23dc550e0a..5c8c97e2fd 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -41,6 +41,7 @@
#include <camel/camel-mime-filter-from.h>
#include <camel/camel-stream-filter.h>
#include <camel/camel-stream-fs.h>
+#include <camel/camel-stream-vfs.h>
#include <camel/camel-mime-filter-charset.h>
#include <camel/camel-offline-folder.h>
#include <camel/camel-offline-store.h>
@@ -1985,14 +1986,7 @@ save_messages_save (struct _mail_msg *mm)
int fd, i;
char *from;
- fd = g_open (m->path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
- if (fd == -1) {
- camel_exception_setv(&mm->ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to create output file: %s\n %s"), m->path, strerror(errno));
- return;
- }
-
- stream = camel_stream_fs_new_with_fd(fd);
+ stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
from_filter = camel_mime_filter_from_new();
filtered_stream = camel_stream_filter_new_with_stream(stream);
camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)from_filter);
@@ -2099,13 +2093,13 @@ save_part_save (struct _mail_msg *mm)
CamelStream *stream;
if(!m->readonly){
- if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) {
+ if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) {
camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot create output file: %s:\n %s"),
m->path, g_strerror (errno));
return;
}
- } else if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0444))) {
+ } else if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0444))) {
camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot create output file: %s:\n %s"),
m->path, g_strerror (errno));