1 /* 2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client 3 * Copyright (C) 1999-2017 Hiroyuki Yamamoto 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 20 #ifndef __COMPOSE_H__ 21 #define __COMPOSE_H__ 22 23 #include <glib.h> 24 #include <gtk/gtkwidget.h> 25 #include <gtk/gtkitemfactory.h> 26 #include <gtk/gtktexttag.h> 27 #include <gtk/gtkliststore.h> 28 #include <gtk/gtktooltips.h> 29 30 typedef struct _Compose Compose; 31 typedef struct _AttachInfo AttachInfo; 32 33 #include "procmsg.h" 34 #include "procmime.h" 35 #include "folder.h" 36 #include "addressbook.h" 37 #include "prefs_account.h" 38 #include "undo.h" 39 #include "codeconv.h" 40 41 typedef enum 42 { 43 COMPOSE_ENTRY_TO, 44 COMPOSE_ENTRY_CC, 45 COMPOSE_ENTRY_BCC, 46 COMPOSE_ENTRY_REPLY_TO, 47 COMPOSE_ENTRY_SUBJECT, 48 COMPOSE_ENTRY_NEWSGROUPS, 49 COMPOSE_ENTRY_FOLLOWUP_TO 50 } ComposeEntryType; 51 52 typedef enum 53 { 54 COMPOSE_REPLY = 1, 55 COMPOSE_REPLY_TO_SENDER = 2, 56 COMPOSE_REPLY_TO_ALL = 3, 57 COMPOSE_REPLY_TO_LIST = 4, 58 COMPOSE_FORWARD = 5, 59 COMPOSE_FORWARD_AS_ATTACH = 6, 60 COMPOSE_NEW = 7, 61 COMPOSE_REDIRECT = 8, 62 COMPOSE_REEDIT = 9, 63 64 COMPOSE_WITH_QUOTE = 1 << 16, 65 COMPOSE_WITHOUT_QUOTE = 2 << 16, 66 67 COMPOSE_MODE_MASK = 0xffff, 68 COMPOSE_QUOTE_MODE_MASK = 0x30000 69 } ComposeMode; 70 71 #define COMPOSE_MODE(mode) ((mode) & COMPOSE_MODE_MASK) 72 #define COMPOSE_QUOTE_MODE(mode) ((mode) & COMPOSE_QUOTE_MODE_MASK) 73 74 struct _Compose 75 { 76 GtkWidget *window; 77 GtkWidget *vbox; 78 GtkWidget *menubar; 79 80 GtkWidget *toolbar; 81 GtkWidget *send_btn; 82 GtkWidget *sendl_btn; 83 GtkWidget *draft_btn; 84 GtkWidget *insert_btn; 85 GtkWidget *attach_btn; 86 GtkWidget *sig_btn; 87 GtkWidget *exteditor_btn; 88 GtkWidget *linewrap_btn; 89 GtkWidget *addrbook_btn; 90 GtkWidget *prefs_common_btn; 91 GtkWidget *prefs_account_btn; 92 93 GtkWidget *vbox2; 94 95 GtkWidget *table_vbox; 96 GtkWidget *table; 97 GtkWidget *to_hbox; 98 GtkWidget *to_entry; 99 GtkWidget *newsgroups_hbox; 100 GtkWidget *newsgroups_entry; 101 GtkWidget *subject_entry; 102 GtkWidget *cc_hbox; 103 GtkWidget *cc_entry; 104 GtkWidget *bcc_hbox; 105 GtkWidget *bcc_entry; 106 GtkWidget *reply_hbox; 107 GtkWidget *reply_entry; 108 GtkWidget *followup_hbox; 109 GtkWidget *followup_entry; 110 111 GtkWidget *misc_hbox; 112 GtkWidget *attach_toggle; 113 GtkWidget *signing_chkbtn; 114 GtkWidget *encrypt_chkbtn; 115 116 GtkWidget *paned; 117 118 GtkWidget *attach_scrwin; 119 GtkWidget *attach_treeview; 120 GtkListStore *attach_store; 121 122 GtkWidget *edit_vbox; 123 GtkWidget *ruler_hbox; 124 GtkWidget *ruler; 125 GtkWidget *scrolledwin; 126 GtkWidget *text; 127 128 GtkWidget *focused_editable; 129 130 GtkWidget *popupmenu; 131 132 GtkItemFactory *popupfactory; 133 134 GtkWidget *tmpl_menu; 135 136 /* GtkSpell */ 137 GtkWidget *spell_menu; 138 gchar *spell_lang; 139 gboolean check_spell; 140 GSList *dict_list; 141 142 ComposeMode mode; 143 144 MsgInfo *targetinfo; 145 gchar *reply_target; 146 gchar *forward_targets; 147 148 gchar *replyto; 149 gchar *cc; 150 gchar *bcc; 151 gchar *newsgroups; 152 gchar *followup_to; 153 154 gchar *ml_post; 155 156 gchar *inreplyto; 157 gchar *references; 158 gchar *msgid; 159 gchar *boundary; 160 161 gboolean autowrap; 162 163 gboolean use_to; 164 gboolean use_cc; 165 gboolean use_bcc; 166 gboolean use_replyto; 167 gboolean use_newsgroups; 168 gboolean use_followupto; 169 gboolean use_attach; 170 171 CharSet out_encoding; 172 173 gboolean use_mdn; 174 175 /* privacy settings */ 176 gboolean use_signing; 177 gboolean use_encryption; 178 179 gboolean modified; 180 181 GSList *to_list; 182 GSList *newsgroup_list; 183 184 PrefsAccount *account; 185 186 UndoMain *undostruct; 187 188 GtkTextTag *sig_tag; 189 190 /* external editor */ 191 gchar *exteditor_file; 192 GPid exteditor_pid; 193 guint exteditor_tag; 194 195 guint autosave_tag; 196 197 guint lock_count; 198 199 gboolean window_maximized; 200 201 gboolean block_modified; 202 203 GtkTooltips *toolbar_tip; 204 205 GtkWidget *sig_combo; 206 }; 207 208 struct _AttachInfo 209 { 210 gchar *file; 211 gchar *content_type; 212 EncodingType encoding; 213 gchar *name; 214 gsize size; 215 }; 216 217 Compose *compose_new (PrefsAccount *account, 218 FolderItem *item, 219 const gchar *mailto, 220 GPtrArray *attach_files); 221 222 Compose *compose_reply (MsgInfo *msginfo, 223 FolderItem *item, 224 ComposeMode mode, 225 const gchar *body); 226 Compose *compose_forward (GSList *mlist, 227 FolderItem *item, 228 gboolean as_attach, 229 const gchar *body); 230 Compose *compose_redirect (MsgInfo *msginfo, 231 FolderItem *item); 232 Compose *compose_reedit (MsgInfo *msginfo); 233 234 GList *compose_get_compose_list (void); 235 236 void compose_entry_set (Compose *compose, 237 const gchar *text, 238 ComposeEntryType type); 239 void compose_entry_append (Compose *compose, 240 const gchar *text, 241 ComposeEntryType type); 242 gchar *compose_entry_get_text (Compose *compose, 243 ComposeEntryType type); 244 245 void compose_lock (Compose *compose); 246 void compose_unlock (Compose *compose); 247 248 void compose_block_modified (Compose *compose); 249 void compose_unblock_modified (Compose *compose); 250 251 void compose_reflect_prefs_all (void); 252 253 GtkWidget *compose_get_toolbar (Compose *compose); 254 GtkWidget *compose_get_misc_hbox(Compose *compose); 255 GtkWidget *compose_get_textview (Compose *compose); 256 257 void compose_attach_append (Compose *compose, 258 const gchar *file, 259 const gchar *filename, 260 const gchar *content_type); 261 void compose_attach_remove_all (Compose *compose); 262 GSList *compose_get_attach_list (Compose *compose); 263 264 gint compose_send (Compose *compose, 265 gboolean close_on_success); 266 267 #endif /* __COMPOSE_H__ */ 268