2005-09-10 [colin] 1.9.14cvs16
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2005 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 typedef struct _Compose         Compose;
24 typedef struct _AttachInfo      AttachInfo;
25
26 #include <glib.h>
27 #include <gtk/gtkwidget.h>
28 #include <gtk/gtkitemfactory.h>
29
30 #include "procmsg.h"
31 #include "procmime.h"
32 #include "addressbook.h"
33 #include "prefs_account.h"
34 #include "undo.h"
35 #include "toolbar.h"
36 #include "messageview.h"
37 #include "codeconv.h"
38
39 #ifdef USE_ASPELL
40 #include "gtkaspell.h"
41 #endif
42
43 typedef enum
44 {
45         COMPOSE_TO,
46         COMPOSE_CC,
47         COMPOSE_BCC,
48         COMPOSE_REPLYTO,
49         COMPOSE_NEWSGROUPS,
50         COMPOSE_FOLLOWUPTO
51 } ComposeEntryType;
52
53 typedef enum
54 {
55         COMPOSE_REPLY,
56         COMPOSE_REPLY_WITH_QUOTE,
57         COMPOSE_REPLY_WITHOUT_QUOTE,
58         COMPOSE_REPLY_TO_SENDER,
59         COMPOSE_FOLLOWUP_AND_REPLY_TO,
60         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
61         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
62         COMPOSE_REPLY_TO_ALL,
63         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
64         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
65         COMPOSE_REPLY_TO_LIST,
66         COMPOSE_REPLY_TO_LIST_WITH_QUOTE,
67         COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
68         COMPOSE_FORWARD,
69         COMPOSE_FORWARD_AS_ATTACH,
70         COMPOSE_FORWARD_INLINE,
71         COMPOSE_NEW,
72         COMPOSE_REDIRECT,
73         COMPOSE_REEDIT
74 } ComposeMode;
75
76 typedef struct {
77         guint headernum;
78         Compose *compose;
79         GtkWidget *combo;
80         GtkWidget *entry;
81 } ComposeHeaderEntry;
82
83 struct _Compose
84 {
85         /* start with window widget don`t change order */
86         GtkWidget *window;
87         GtkWidget *vbox;
88         GtkWidget *menubar;
89
90         /* Toolbar handlebox */
91         GtkWidget *handlebox;
92         Toolbar *toolbar;
93         
94         GtkWidget *vbox2;
95
96         /* Header */
97         GtkWidget *table_vbox;
98         GtkWidget *table;
99 /*
100         GtkWidget *to_hbox;
101         GtkWidget *to_entry;
102         GtkWidget *newsgroups_hbox;
103         GtkWidget *newsgroups_entry;
104 */
105         GtkWidget *subject_entry;
106 /*
107         GtkWidget *cc_hbox;
108         GtkWidget *cc_entry;
109         GtkWidget *bcc_hbox;
110         GtkWidget *bcc_entry;
111         GtkWidget *reply_hbox;
112         GtkWidget *reply_entry;
113         GtkWidget *followup_hbox;
114         GtkWidget *followup_entry;
115 */
116         GtkWidget *paned;
117
118         /* Attachments */
119         GtkWidget *attach_scrwin;
120         GtkWidget *attach_clist;
121
122         /* Others */
123         GtkWidget *savemsg_checkbtn;
124         GtkWidget *savemsg_entry;
125
126         /* Textedit */
127         GtkWidget *edit_vbox;
128         GtkWidget *ruler_hbox;
129         GtkWidget *ruler;
130         GtkWidget *scrolledwin;
131         GtkWidget *text;
132
133         GtkWidget *focused_editable;
134
135         GtkWidget *popupmenu;
136
137         GtkItemFactory *popupfactory;
138
139         GtkWidget *tmpl_menu;
140
141         ComposeMode mode;
142
143         MsgInfo *targetinfo;
144         MsgInfo *replyinfo;
145         MsgInfo *autosaved_draft;
146         MsgInfo *fwdinfo;
147
148         GtkWidget *header_table;
149         GSList    *header_list;
150         guint      header_nextrow;
151         ComposeHeaderEntry *header_last;
152
153         gchar   *replyto;
154         gchar   *cc;
155         gchar   *bcc;
156         gchar   *newsgroups;
157         gchar   *followup_to;
158
159         gchar   *ml_post;
160
161         gchar   *inreplyto;
162         gchar   *references;
163         gchar   *msgid;
164         gchar   *boundary;
165
166         gboolean autowrap;
167
168         gboolean use_to;
169         gboolean use_cc;
170         gboolean use_bcc;
171         gboolean use_replyto;
172         gboolean use_newsgroups;
173         gboolean use_followupto;
174         gboolean use_attach;
175
176         CharSet out_encoding;
177
178         /* privacy settings */
179         gboolean use_signing;
180         gboolean use_encryption;
181         gchar *privacy_system;
182
183         gboolean modified;
184
185         gboolean sending;
186         
187         gboolean return_receipt;
188
189         GSList *to_list;
190         GSList *newsgroup_list;
191
192         PrefsAccount *account;
193
194         UndoMain *undostruct;
195
196         gchar *sig_str;
197
198         /* external editor */
199         gchar      *exteditor_file;
200         pid_t       exteditor_pid;
201         GIOChannel *exteditor_ch;
202         gint        exteditor_tag;
203
204 #if USE_ASPELL
205         /* GNU/aspell spell checker */
206         GtkAspell *gtkaspell;
207 #endif
208
209         /* Priority */
210         gint priority;
211
212         gchar *redirect_filename;
213         
214         gboolean remove_references;
215
216         guint draft_timeout_tag;
217 };
218
219 struct _AttachInfo
220 {
221         gchar *file;
222         gchar *content_type;
223         EncodingType encoding;
224         gchar *name;
225         off_t size;
226 };
227
228 /*#warning FIXME_GTK2 */
229 /* attache_files will be locale encode */
230 Compose *compose_new                    (PrefsAccount   *account,
231                                          const gchar    *mailto,
232                                          GPtrArray      *attach_files);
233
234 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
235                                          FolderItem     *item);
236
237 Compose *compose_new_with_list          (PrefsAccount   *account,
238                                          GList          *listAddress);
239
240 void compose_reply_mode                 (ComposeMode     mode, 
241                                          GSList         *msginfo_list, 
242                                          gchar          *body);
243 /* remove */
244 void compose_followup_and_reply_to      (MsgInfo        *msginfo,
245                                          gboolean        quote,
246                                          gboolean        to_all,
247                                          gboolean        to_sender,
248                                          const gchar    *body);
249 void compose_reply                      (MsgInfo        *msginfo,
250                                          gboolean        quote,
251                                          gboolean        to_all,
252                                          gboolean        to_ml,
253                                          gboolean        to_sender,
254                                          const gchar    *body);
255 Compose *compose_forward                (PrefsAccount *account,
256                                          MsgInfo        *msginfo,
257                                          gboolean        as_attach,
258                                          const gchar    *body,
259                                          gboolean        no_extedit);
260 Compose *compose_forward_multiple       (PrefsAccount   *account, 
261                                          GSList         *msginfo_list);
262 /* remove end */
263
264 Compose *compose_redirect               (PrefsAccount   *account,
265                                          MsgInfo        *msginfo);
266 void compose_reedit                     (MsgInfo        *msginfo);
267
268 GList *compose_get_compose_list         (void);
269
270 void compose_entry_append               (Compose          *compose,
271                                          const gchar      *address,
272                                          ComposeEntryType  type);
273
274 void compose_entry_mark_default_to      (Compose          *compose,
275                                          const gchar      *address);
276
277 gint compose_send                       (Compose          *compose);
278
279 void compose_update_actions_menu        (Compose        *compose);
280 void compose_update_privacy_systems_menu(Compose        *compose);
281 void compose_reflect_prefs_all                  (void);
282 void compose_reflect_prefs_pixmap_theme (void);
283
284 void compose_destroy_all                (void);
285 void compose_draft                      (gpointer data);
286 void compose_toolbar_cb                 (gint           action, 
287                                          gpointer       data);
288 void compose_reply_from_messageview     (MessageView    *msgview, 
289                                          GSList         *msginfo_list, 
290                                          guint           action);
291
292 #endif /* __COMPOSE_H__ */