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