57dc9ec9615efb8ed08cb30df27e57b09b0dae82
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 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
27 typedef struct _Compose         Compose;
28 typedef struct _ComposeToolbar  ComposeToolbar;
29 typedef struct _AttachInfo      AttachInfo;
30
31 #include "procmsg.h"
32 #include "procmime.h"
33 #include "addressbook.h"
34 #include "prefs_account.h"
35 #include "undo.h"
36
37 #ifdef USE_ASPELL
38 #include "gtkaspell.h"
39 #endif
40
41 typedef enum
42 {
43         COMPOSE_TO,
44         COMPOSE_CC,
45         COMPOSE_BCC,
46         COMPOSE_REPLYTO,
47         COMPOSE_NEWSGROUPS,
48         COMPOSE_FOLLOWUPTO
49 } ComposeEntryType;
50
51 typedef enum
52 {
53         COMPOSE_REPLY,
54         COMPOSE_REPLY_WITH_QUOTE,
55         COMPOSE_REPLY_WITHOUT_QUOTE,
56         COMPOSE_REPLY_TO_SENDER,
57         COMPOSE_FOLLOWUP_AND_REPLY_TO,
58         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
59         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
60         COMPOSE_REPLY_TO_ALL,
61         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
62         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
63         COMPOSE_REPLY_TO_LIST,
64         COMPOSE_REPLY_TO_LIST_WITH_QUOTE,
65         COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
66         COMPOSE_FORWARD,
67         COMPOSE_FORWARD_AS_ATTACH,
68         COMPOSE_FORWARD_INLINE,
69         COMPOSE_NEW,
70         COMPOSE_REDIRECT,
71         COMPOSE_REEDIT
72 } ComposeMode;
73
74 typedef struct {
75         guint headernum;
76         Compose *compose;
77         GtkWidget *combo;
78         GtkWidget *entry;
79 } ComposeHeaderEntry;
80
81 struct _Compose
82 {
83         GtkWidget *window;
84         GtkWidget *vbox;
85         GtkWidget *menubar;
86         
87         /* Toolbar handlebox */
88         GtkWidget *handlebox;
89         ComposeToolbar *toolbar;
90
91         GtkWidget *vbox2;
92
93         /* Header */
94         GtkWidget *table_vbox;
95         GtkWidget *table;
96 /*
97         GtkWidget *to_hbox;
98         GtkWidget *to_entry;
99         GtkWidget *newsgroups_hbox;
100         GtkWidget *newsgroups_entry;
101 */
102         GtkWidget *subject_entry;
103 /*
104         GtkWidget *cc_hbox;
105         GtkWidget *cc_entry;
106         GtkWidget *bcc_hbox;
107         GtkWidget *bcc_entry;
108         GtkWidget *reply_hbox;
109         GtkWidget *reply_entry;
110         GtkWidget *followup_hbox;
111         GtkWidget *followup_entry;
112 */
113         GtkWidget *paned;
114
115         /* Attachments */
116         GtkWidget *attach_scrwin;
117         GtkWidget *attach_clist;
118
119         /* Others */
120         GtkWidget *savemsg_checkbtn;
121         GtkWidget *savemsg_entry;
122
123         /* Textedit */
124         GtkWidget *edit_vbox;
125         GtkWidget *ruler_hbox;
126         GtkWidget *ruler;
127         GtkWidget *scrolledwin;
128         GtkWidget *text;
129
130         GtkWidget *focused_editable;
131
132         GtkWidget *popupmenu;
133
134         GtkItemFactory *popupfactory;
135
136         GtkWidget *tmpl_menu;
137
138         ComposeMode mode;
139
140         MsgInfo *targetinfo;
141         MsgInfo *replyinfo;
142
143         GtkWidget *header_table;
144         GSList    *header_list;
145         guint      header_nextrow;
146         ComposeHeaderEntry *header_last;
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 use_to;
162         gboolean use_cc;
163         gboolean use_bcc;
164         gboolean use_replyto;
165         gboolean use_newsgroups;
166         gboolean use_followupto;
167         gboolean use_attach;
168
169         /* privacy settings */
170         gboolean use_signing;
171         gboolean use_encryption;
172
173         gboolean modified;
174
175         gboolean sending;
176         
177         gboolean return_receipt;
178         gboolean paste_as_quotation;
179
180         GSList *to_list;
181         GSList *newsgroup_list;
182
183         PrefsAccount *account;
184
185         UndoMain *undostruct;
186
187         /* external editor */
188         gchar *exteditor_file;
189         pid_t  exteditor_pid;
190         gint   exteditor_readdes;
191         gint   exteditor_tag;
192
193 #if USE_ASPELL
194         /* GNU/aspell spell checker */
195         GtkAspell *gtkaspell;
196 #endif
197
198         /* Priority */
199         gint priority;
200
201         gchar *redirect_filename;
202 };
203
204 struct _ComposeToolbar {
205
206         GtkWidget *toolbar;
207
208         GtkWidget *send_btn;
209         GtkWidget *sendl_btn;
210         GtkWidget *draft_btn;
211         GtkWidget *insert_btn;
212         GtkWidget *attach_btn;
213         GtkWidget *sig_btn;
214         GtkWidget *exteditor_btn;
215         GtkWidget *linewrap_btn;
216         GtkWidget *addrbook_btn;
217
218         GSList    *t_action_list;
219         GSList    *t_item_list;
220 };
221
222 struct _AttachInfo
223 {
224         gchar *file;
225         gchar *content_type;
226         EncodingType encoding;
227         gchar *name;
228         off_t size;
229 };
230
231 Compose *compose_new                    (PrefsAccount   *account,
232                                          const gchar    *mailto,
233                                          GPtrArray      *attach_files);
234
235 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
236                                          FolderItem     *item);
237
238 void compose_followup_and_reply_to      (MsgInfo        *msginfo,
239                                          gboolean        quote,
240                                          gboolean        to_all,
241                                          gboolean        ignore_replyto,
242                                          const gchar    *body);
243 void compose_reply                      (MsgInfo        *msginfo,
244                                          gboolean        quote,
245                                          gboolean        to_all,
246                                          gboolean        to_ml,
247                                          gboolean        ignore_replyto,
248                                          const gchar    *body);
249 Compose *compose_forward                (PrefsAccount *account,
250                                          MsgInfo        *msginfo,
251                                          gboolean        as_attach,
252                                          const gchar    *body);
253 Compose *compose_forward_multiple       (PrefsAccount   *account, 
254                                          GSList         *msginfo_list);
255 Compose *compose_redirect               (PrefsAccount   *account,
256                                          MsgInfo        *msginfo);
257 void compose_reedit                     (MsgInfo        *msginfo);
258
259 GList *compose_get_compose_list         (void);
260
261 void compose_entry_append               (Compose          *compose,
262                                          const gchar      *address,
263                                          ComposeEntryType  type);
264
265 void compose_entry_select               (Compose          *compose,
266                                          const gchar      *address);
267
268 gint compose_send                       (Compose          *compose);
269
270 void compose_reflect_prefs_all                  (void);
271 void compose_reflect_prefs_pixmap_theme (void);
272
273 void compose_destroy_all                (void);
274 void compose_draft                      (gpointer data);
275
276 #endif /* __COMPOSE_H__ */