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