/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-msg-composer.c
*
* Copyright (C) 1999 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* published by the Free Software Foundation; either version 2 of the
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Ettore Perazzoli (ettore@ximian.com)
* Jeffrey Stedfast (fejj@ximian.com)
* Miguel de Icaza (miguel@ximian.com)
*
*/
/*
TODO
- Somehow users should be able to see if any file(s) are attached even when
the attachment bar is not shown.
Should use EventSources to keep track of global changes made to configuration
values. Right now it ignores the problem olympically. Miguel.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
#include <libgnome/gnome-defs.h>
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-window-icon.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-object-client.h>
#include <bonobo/bonobo-stream-memory.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-widget.h>
#include <libgnomevfs/gnome-vfs.h>
#include <glade/glade.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-scroll-frame.h>
#include <gal/e-text/e-entry.h>
#include <gtkhtml/gtkhtml.h>
#include "widgets/misc/e-charset-picker.h"
#include "camel/camel.h"
#include "camel/camel-charset-map.h"
#include "camel/camel-session.h"
#include "mail/mail.h"
#include "mail/mail-crypto.h"
#include "mail/mail-tools.h"
#include "mail/mail-ops.h"
#include "mail/mail-mt.h"
#include "mail/mail-session.h"
#include "e-util/e-html-utils.h"
#include "e-msg-composer.h"
#include "e-msg-composer-attachment-bar.h"
#include "e-msg-composer-hdrs.h"
#include "e-msg-composer-select-file.h"
#include "evolution-shell-component-utils.h"
#include "Editor.h"
#include "listener.h"
#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor"
#define DEFAULT_WIDTH 600
#define DEFAULT_HEIGHT 500
enum {
SEND,
POSTPONE,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
enum {
DND_TYPE_MESSAGE_RFC822,
DND_TYPE_TEXT_URI_LIST,
};
static GtkTargetEntry drop_types[] = {
{ "message/rfc822", 0, DND_TYPE_MESSAGE_RFC822 },
{ "text/uri-list", 0, DND_TYPE_TEXT_URI_LIST },
};
static const int num_drop_types = sizeof (drop_types) / sizeof (drop_types[0]);
static GnomeAppClass *parent_class = NULL;
/* local prototypes */
static GList *add_recipients (GList *list, const char *recips, gboolean decode);
static void message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream);
/* used by e_msg_composer_add_message_attachments() */
static void add_attachments_from_multipart (EMsgComposer *composer, CamelMultipart *multipart,
gboolean just_inlines, int depth);
/* used by e_msg_composer_new_with_message() */
static void handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart, int depth);
static void handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth);
static GByteArray *
get_text (Bonobo_PersistStream persist, char *format)
{
BonoboStream *stream;
BonoboStreamMem *stream_mem;
CORBA_Environment ev;
GByteArray *text;
CORBA_exception_init (&ev);
stream = bonobo_stream_mem_create (NULL, 0, FALSE, TRUE);
Bonobo_PersistStream_save (persist, (Bonobo_Stream)bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
format, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception getting mail '%s'",
bonobo_exception_get_text (&ev));
|