1 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */ 2 /* Balsa E-Mail Client 3 * Copyright (C) 1997-2013 Stuart Parmenter and others, 4 * See the file AUTHORS for a list. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 * 02111-1307, USA. 20 */ 21 22 #ifndef __BALSA_SENDMSG_H__ 23 #define __BALSA_SENDMSG_H__ 24 25 #ifndef BALSA_VERSION 26 # error "Include config.h before this file." 27 #endif 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif /* __cplusplus */ 32 33 #include "libbalsa.h" 34 #include "address-view.h" 35 #include "toolbar-factory.h" 36 37 typedef enum { 38 SEND_NORMAL, /* initialized by Compose */ 39 SEND_REPLY, /* by Reply */ 40 SEND_REPLY_ALL, /* by Reply All */ 41 SEND_REPLY_GROUP, /* by Reply to Group */ 42 SEND_FORWARD_ATTACH, /* by Forward attached */ 43 SEND_FORWARD_INLINE, /* by Forward inline */ 44 SEND_CONTINUE /* by Continue postponed */ 45 } SendType; 46 47 typedef enum { 48 SENDMSG_STATE_CLEAN, 49 SENDMSG_STATE_MODIFIED, 50 SENDMSG_STATE_AUTO_SAVED 51 } SendmsgState; 52 53 #if defined(ENABLE_TOUCH_UI) 54 #define VIEW_MENU_LENGTH 4 55 #else 56 #define VIEW_MENU_LENGTH 5 57 #endif 58 typedef struct _BalsaSendmsg BalsaSendmsg; 59 60 struct _BalsaSendmsg { 61 GtkWidget *window; 62 GtkWidget *toolbar; 63 LibBalsaAddressView *recipient_view, *replyto_view; 64 GtkWidget *from[2], *recipients[2], *subject[2], *fcc[2]; 65 #if !defined(ENABLE_TOUCH_UI) 66 GtkWidget *replyto[2]; 67 #endif /* ENABLE_TOUCH_UI */ 68 GtkWidget *attachments[4]; 69 gchar *in_reply_to; 70 GList *references; 71 GtkWidget *text; 72 #if !HAVE_GTKSPELL 73 GtkWidget *spell_checker; 74 #endif /* HAVE_GTKSPELL */ 75 GtkWidget *notebook; 76 LibBalsaMessage *parent_message; /* to which we're replying */ 77 LibBalsaMessage *draft_message; /* where the message was saved */ 78 SendType type; 79 gboolean is_continue; 80 /* language selection related data */ 81 const gchar *spell_check_lang; 82 GtkWidget *current_language_menu; 83 /* identity related data */ 84 LibBalsaIdentity* ident; 85 /* fcc mailbox */ 86 gchar *fcc_url; 87 gboolean update_config; /* is the window being set up or in normal */ 88 /* operation and user actions should update */ 89 /* the config */ 90 gulong delete_sig_id; 91 gulong changed_sig_id; 92 #if !HAVE_GTKSOURCEVIEW 93 gulong delete_range_sig_id; 94 #endif /* HAVE_GTKSOURCEVIEW */ 95 gulong insert_text_sig_id; 96 guint autosave_timeout_id; 97 SendmsgState state; 98 gulong identities_changed_id; 99 gboolean flow; /* send format=flowed */ 100 gboolean send_mp_alt; /* send multipart/alternative (plain and html) */ 101 gboolean req_dispnotify; /* send a MDN */ 102 gboolean quit_on_close; /* quit balsa after the compose window */ 103 /* is closed. */ 104 #ifdef HAVE_GPGME 105 guint gpg_mode; 106 #endif 107 108 #if !HAVE_GTKSOURCEVIEW 109 GtkTextBuffer *buffer2; /* Undo buffer. */ 110 #endif /* HAVE_GTKSOURCEVIEW */ 111 112 /* To update cursor after text is inserted. */ 113 GtkTextMark *insert_mark; 114 115 GtkActionGroup *action_group; 116 GtkActionGroup *ready_action_group; 117 #if !defined(ENABLE_TOUCH_UI) 118 GtkActionGroup *gpg_action_group; 119 #endif /* ENABLE_TOUCH_UI */ 120 }; 121 122 BalsaSendmsg *sendmsg_window_compose(void); 123 BalsaSendmsg *sendmsg_window_compose_with_address(const gchar * 124 address); 125 BalsaSendmsg *sendmsg_window_reply(LibBalsaMailbox *, 126 guint msgno, SendType rt); 127 BalsaSendmsg *sendmsg_window_reply_embedded(LibBalsaMessageBody *part, 128 SendType reply_type); 129 130 BalsaSendmsg *sendmsg_window_forward(LibBalsaMailbox *, 131 guint msgno, gboolean attach); 132 BalsaSendmsg *sendmsg_window_continue(LibBalsaMailbox *, 133 guint msgno); 134 135 void sendmsg_window_set_field(BalsaSendmsg *bsmsg, const gchar* key, 136 const gchar* val); 137 138 gboolean add_attachment(BalsaSendmsg * bsmsg, 139 const gchar *filename, 140 gboolean is_a_tmp_file, 141 const gchar *forced_mime_type); 142 143 typedef void (*field_setter)(BalsaSendmsg *d, const gchar*, const gchar*); 144 145 void sendmsg_window_process_url(const char *url, field_setter func, 146 void *data); 147 BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox * mailbox, 148 GArray * selected, 149 SendType type); 150 BalsaToolbarModel *sendmsg_window_get_toolbar_model(void); 151 GtkUIManager *sendmsg_window_ui_manager_new(BalsaSendmsg * bsmsg); 152 153 #define SENDMSG_WINDOW_QUIT_ON_CLOSE(bsmsg) ((bsmsg)->quit_on_close=TRUE) 154 155 #ifdef __cplusplus 156 } 157 #endif /* __cplusplus */ 158 #endif /* __BALSA_SENDMSG_H__ */ 159