2006-11-13 [wwp] 2.6.0cvs39
[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 #include "textview.h"
40
41 #ifdef USE_ASPELL
42 #include "gtkaspell.h"
43 #endif
44
45 #define COMPOSE_CHECK_BEFORE_SEND_HOOKLIST "compose_check_before_send"
46
47 typedef enum
48 {
49         COMPOSE_TO,
50         COMPOSE_CC,
51         COMPOSE_BCC,
52         COMPOSE_REPLYTO,
53         COMPOSE_NEWSGROUPS,
54         COMPOSE_FOLLOWUPTO
55 } ComposeEntryType;
56
57 typedef enum
58 {
59         COMPOSE_REPLY,
60         COMPOSE_REPLY_WITH_QUOTE,
61         COMPOSE_REPLY_WITHOUT_QUOTE,
62         COMPOSE_REPLY_TO_SENDER,
63         COMPOSE_FOLLOWUP_AND_REPLY_TO,
64         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
65         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
66         COMPOSE_REPLY_TO_ALL,
67         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
68         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
69         COMPOSE_REPLY_TO_LIST,
70         COMPOSE_REPLY_TO_LIST_WITH_QUOTE,
71         COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
72         COMPOSE_FORWARD,
73         COMPOSE_FORWARD_AS_ATTACH,
74         COMPOSE_FORWARD_INLINE,
75         COMPOSE_NEW,
76         COMPOSE_REDIRECT,
77         COMPOSE_REEDIT
78 } ComposeMode;
79
80 typedef struct {
81         guint headernum;
82         Compose *compose;
83         GtkWidget *combo;
84         GtkWidget *entry;
85 } ComposeHeaderEntry;
86
87 struct _Compose
88 {
89         /* start with window widget don`t change order */
90         GtkWidget *window;
91         GtkWidget *vbox;
92         GtkWidget *menubar;
93
94         /* Toolbar handlebox */
95         GtkWidget *handlebox;
96         Toolbar *toolbar;
97         
98         GtkWidget *vbox2;
99
100         /* Header */
101         GtkWidget *table_vbox;
102         GtkWidget *table;
103         GtkWidget *subject_entry;
104         GtkWidget *paned;
105
106         /* Attachments */
107         GtkWidget *attach_scrwin;
108         GtkWidget *attach_clist;
109
110         /* Others */
111         GtkWidget *savemsg_checkbtn;
112         GtkWidget *savemsg_entry;
113
114         /* Textedit */
115         GtkWidget *edit_vbox;
116         GtkWidget *ruler_hbox;
117         GtkWidget *ruler;
118         GtkWidget *scrolledwin;
119         GtkWidget *text;
120         GtkWidget *from_name;
121         GtkTooltips *tooltips;
122
123         GtkWidget *focused_editable;
124
125         GtkWidget *popupmenu;
126
127         GtkItemFactory *popupfactory;
128
129         GtkWidget *tmpl_menu;
130
131         ComposeMode mode;
132
133         MsgInfo *targetinfo;
134         MsgInfo *replyinfo;
135         MsgInfo *autosaved_draft;
136         MsgInfo *fwdinfo;
137
138         GtkWidget *header_table;
139         GSList    *header_list;
140         guint      header_nextrow;
141         ComposeHeaderEntry *header_last;
142
143         gchar   *replyto;
144         gchar   *cc;
145         gchar   *bcc;
146         gchar   *newsgroups;
147         gchar   *followup_to;
148
149         gchar   *ml_post;
150
151         gchar   *inreplyto;
152         gchar   *references;
153         gchar   *msgid;
154         gchar   *boundary;
155
156         gboolean autowrap;
157
158         gboolean use_to;
159         gboolean use_cc;
160         gboolean use_bcc;
161         gboolean use_replyto;
162         gboolean use_newsgroups;
163         gboolean use_followupto;
164         gboolean use_attach;
165
166         CharSet out_encoding;
167
168         /* privacy settings */
169         gboolean use_signing;
170         gboolean use_encryption;
171         gchar *privacy_system;
172
173         gboolean modified;
174
175         gboolean sending;
176         
177         gboolean return_receipt;
178
179         gboolean batch;
180         
181         GSList *to_list;
182         GSList *newsgroup_list;
183
184         PrefsAccount *account;
185
186         UndoMain *undostruct;
187
188         gchar *sig_str;
189
190         /* external editor */
191         gchar      *exteditor_file;
192         pid_t       exteditor_pid;
193         GIOChannel *exteditor_ch;
194         gint        exteditor_tag;
195
196 #if USE_ASPELL
197         /* GNU/aspell spell checker */
198         GtkAspell *gtkaspell;
199         GtkWidget *aspell_options_menu;
200 #endif
201
202         /* Priority */
203         gint priority;
204
205         gchar *redirect_filename;
206         
207         gboolean remove_references;
208
209         guint draft_timeout_tag;
210         
211         GtkTextTag *no_wrap_tag;
212         GtkTextTag *no_join_tag;
213         GMutex *mutex;
214         gchar *orig_charset;
215         gint set_cursor_pos;
216         
217         gboolean updating;
218         gboolean deferred_destroy;
219         ComposeMode rmode;
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 /*#warning FIXME_GTK2 */
232 /* attache_files will be locale encode */
233 Compose *compose_new                    (PrefsAccount   *account,
234                                          const gchar    *mailto,
235                                          GPtrArray      *attach_files);
236
237 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
238                                          FolderItem     *item,
239                                          const gchar    *mailto);
240
241 Compose *compose_new_with_list          (PrefsAccount   *account,
242                                          GList          *listAddress);
243
244 Compose *compose_reply_mode             (ComposeMode     mode, 
245                                          GSList         *msginfo_list, 
246                                          gchar          *body);
247 /* remove */
248 Compose *compose_followup_and_reply_to  (MsgInfo        *msginfo,
249                                          gboolean        quote,
250                                          gboolean        to_all,
251                                          gboolean        to_sender,
252                                          const gchar    *body);
253 Compose *compose_reply                  (MsgInfo        *msginfo,
254                                          gboolean        quote,
255                                          gboolean        to_all,
256                                          gboolean        to_ml,
257                                          gboolean        to_sender,
258                                          const gchar    *body);
259 Compose *compose_forward                (PrefsAccount *account,
260                                          MsgInfo        *msginfo,
261                                          gboolean        as_attach,
262                                          const gchar    *body,
263                                          gboolean        no_extedit,
264                                          gboolean        batch);
265 Compose *compose_forward_multiple       (PrefsAccount   *account, 
266                                          GSList         *msginfo_list);
267 /* remove end */
268
269 Compose *compose_redirect               (PrefsAccount   *account,
270                                          MsgInfo        *msginfo,
271                                          gboolean        batch);
272 Compose *compose_reedit                 (MsgInfo        *msginfo,
273                                          gboolean        batch);
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 void compose_set_position                               (Compose        *compose,
303                                                  gint            pos);
304 gboolean compose_search_string                  (Compose        *compose,
305                                                  const gchar    *str,
306                                                  gboolean        case_sens);
307 gboolean compose_search_string_backward (Compose        *compose,
308                                                  const gchar    *str,
309                                                  gboolean        case_sens);
310 gint compose_queue                      (Compose *compose, 
311                                          gint *msgnum, 
312                                          FolderItem **item, 
313                                          gchar **msgpath,
314                                          gboolean remove_reedit_target);
315 gboolean compose_close                  (Compose *compose);
316 #endif /* __COMPOSE_H__ */