Add methods to create a reply to calendar message and open it in editor
[modest] / src / modest-ui-actions.h
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  *   notice, this list of conditions and the following disclaimer in the
12  *   documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Nokia Corporation nor the names of its
14  *   contributors may be used to endorse or promote products derived from
15  *   this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef __MODEST_UI_ACTIONS_H__
31 #define __MODEST_UI_ACTIONS_H__
32
33 #include <widgets/modest-main-window.h>
34 #include <widgets/modest-msg-edit-window.h>
35 #include <widgets/modest-recpt-view.h>
36 #include "modest-mail-operation.h"
37 #include "modest-tny-send-queue.h"
38 #include "modest-plugin-ui-actions.h"
39
40 G_BEGIN_DECLS
41
42 /* Menu & toolbar actions */
43 void     modest_ui_actions_on_about         (GtkAction *action, ModestWindow *win);
44
45 void     modest_ui_actions_refresh_message_window_after_delete (ModestMsgViewWindow* win);
46
47 void     modest_ui_actions_on_delete_message     (GtkAction *action, ModestWindow *win);
48
49 gboolean modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win);
50
51 gboolean modest_ui_actions_on_edit_mode_delete_folder (ModestWindow *win);
52
53 void     modest_ui_actions_on_delete_message_or_folder (GtkAction *action, ModestWindow *win);
54
55 void     modest_ui_actions_on_quit          (GtkAction *action, ModestWindow *win);
56
57 void     modest_ui_actions_on_close_window  (GtkAction *action, ModestWindow *win);
58
59 void     modest_ui_actions_on_new_account      (GtkAction *action, ModestWindow *win);
60
61 void     modest_ui_actions_on_accounts      (GtkAction *action, ModestWindow *win);
62
63 void     modest_ui_actions_on_smtp_servers  (GtkAction *action, ModestWindow *win);
64
65 void     modest_ui_actions_add_to_contacts   (GtkAction *action, ModestWindow *win);
66 void     modest_ui_actions_on_add_to_contacts   (GtkAction *action, ModestWindow *win);
67
68 void     modest_ui_actions_on_select_contacts (GtkAction *action, ModestMsgEditWindow *win);
69
70 void     modest_ui_actions_on_open_addressbook (GtkAction *action, ModestWindow *win);
71
72 void     modest_ui_actions_on_check_names (GtkAction *action, ModestMsgEditWindow *win);
73
74 void     modest_ui_actions_on_new_msg       (GtkAction *action, ModestWindow *win);
75
76 void     modest_ui_actions_on_new_msg_or_folder (GtkAction *action, ModestWindow *win);
77
78 void     modest_ui_actions_on_open           (GtkAction *action, ModestWindow *win);
79
80 void     modest_ui_actions_on_reply         (GtkAction *action, ModestWindow *win);
81
82 void     modest_ui_actions_reply_calendar (ModestWindow *win, TnyMsg *msg, TnyList *header_pairs);
83
84 void     modest_ui_actions_on_forward       (GtkAction *action, ModestWindow *win);
85
86 void     modest_ui_actions_on_sort          (GtkAction *action, ModestWindow *window);
87
88 void     modest_ui_actions_on_reply_all     (GtkAction *action, ModestWindow *win);
89
90 void     modest_ui_actions_on_next          (GtkAction *action, ModestWindow *main_window);
91
92 void     modest_ui_actions_on_prev          (GtkAction *action, ModestWindow *main_window);
93
94 void     modest_ui_actions_on_details       (GtkAction *action, ModestWindow *win);
95
96 void     modest_ui_actions_on_limit_error   (GtkAction *action, ModestWindow *win);
97
98 gboolean     modest_ui_actions_on_edit_mode_move_to       (ModestWindow *win);
99
100 void     modest_ui_actions_on_move_to       (GtkAction *action, ModestWindow *win);
101
102 void     modest_ui_actions_on_settings      (GtkAction *action, ModestWindow *win);
103
104 /**
105  * modest_ui_actions_on_help:
106  * @action: a #GtkAction
107  * @win: a #ModestWindow
108  * 
109  * Shows the help dialog
110  **/
111 void     modest_ui_actions_on_help          (GtkAction *action, GtkWindow *win);
112
113
114 /**
115  * modest_ui_actions_on_csm_elp:
116  * @action: a #GtkAction
117  * @win: a #ModestWindow
118  * 
119  * Shows the help dialog for folder view CSM. It shows the help ID
120  * which refers to the currently selected folder if any
121  **/
122 void     modest_ui_actions_on_csm_help      (GtkAction *action, GtkWindow *win);
123
124 /**
125  * modest_ui_actions_toggle_folders_view:
126  * @action: the #GtkAction
127  * @main_window: the #ModestMainWindow
128  * 
129  * this action switches between split view (with a folders pane at the
130  * left) and simple view without the left pane with the folders and
131  * accounts. Maybe it's only useful for Maemo code, but as it uses
132  * generic code could be used also by the GNOME UI
133  **/
134 void     modest_ui_actions_toggle_folders_view       (GtkAction *action, 
135                                                       ModestMainWindow *main_window);
136
137 /**
138  * modest_ui_actions_toggle_folders_view:
139  * @action: the #GtkAction
140  * @main_window: the #ModestMainWindow
141  * 
142  * this action shows or hides the column titles of the header list
143  * view. It also enables the two lines rendering for the treeview rows
144  **/
145 void     modest_ui_actions_toggle_header_list_view    (GtkAction *action, 
146                                                        ModestMainWindow *main_window);
147
148 /* Widget actions */
149 void     modest_ui_actions_on_header_selected          (ModestHeaderView *folder_view, 
150                                                         TnyHeader *header,
151                                                         ModestMainWindow *main_window);
152 void     modest_ui_actions_on_header_activated         (ModestHeaderView *folder_view, 
153                                                         TnyHeader *header,
154                                                         GtkTreePath *path,
155                                                         ModestWindow *main_window);
156
157 void     modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
158                                                          TnyFolderStore *folder_store, 
159                                                          gboolean selected,
160                                                          ModestMainWindow *main_window);
161
162 void     modest_ui_actions_on_item_not_found           (ModestHeaderView *header_view,
163                                                          ModestItemType type,
164                                                          ModestWindow *window);
165
166 void     modest_ui_actions_on_msg_link_hover           (ModestMsgView *msgview, const gchar* link,
167                                                         ModestWindow *win);
168
169 void     modest_ui_actions_on_msg_link_clicked         (ModestMsgView *msgview, const gchar* link,
170                                                         ModestWindow *win);
171
172 void     modest_ui_actions_on_msg_link_contextual      (ModestMsgView *msgview, const gchar* link,
173                                                         ModestWindow *win);
174
175 void     modest_ui_actions_on_msg_attachment_clicked   (ModestMsgView *msgview, TnyMimePart *mime_part,
176                                                         ModestWindow *win);
177
178 void     modest_ui_actions_on_msg_recpt_activated   (ModestMsgView *msgview, const gchar *address,
179                                                      ModestWindow *win);
180
181 gboolean modest_ui_actions_on_send                     (GtkWidget *widget,
182                                                         ModestMsgEditWindow *edit_window);
183 gboolean modest_ui_actions_on_save_to_drafts           (GtkWidget *widget, 
184                                                         ModestMsgEditWindow *edit_window);
185
186
187 void     modest_ui_actions_on_toggle_bold              (GtkToggleAction *action,
188                                                         ModestMsgEditWindow *window);
189
190 void     modest_ui_actions_on_toggle_italics           (GtkToggleAction *action,
191                                                         ModestMsgEditWindow *window);
192
193 void     modest_ui_actions_on_toggle_bullets           (GtkToggleAction *action,
194                                                         ModestMsgEditWindow *window);
195
196 void     modest_ui_actions_on_change_justify      (GtkRadioAction *action,
197                                                    GtkRadioAction *selected,
198                                                    ModestMsgEditWindow *window);
199
200 void     modest_ui_actions_on_select_editor_color      (GtkAction *action,
201                                                         ModestMsgEditWindow *window);
202
203 void     modest_ui_actions_on_select_editor_background_color      (GtkAction *action,
204                                                                    ModestMsgEditWindow *window);
205
206 void     modest_ui_actions_on_insert_image             (GObject *object,
207                                                         ModestMsgEditWindow *window);
208
209 void     modest_ui_actions_on_attach_file             (GtkAction *action,
210                                                        ModestMsgEditWindow *window);
211
212 void     modest_ui_actions_on_remove_attachments      (GtkAction *action,
213                                                        ModestMsgEditWindow *window);
214 void     modest_ui_actions_on_mark_as_read            (GtkAction *action,
215                                                        ModestWindow *window);
216
217 void     modest_ui_actions_on_mark_as_unread            (GtkAction *action,
218                                                          ModestWindow *window);
219
220 void     modest_ui_actions_cancel_send (GtkAction *action,  ModestWindow *win);
221
222 /**
223  * modest_ui_actions_do_send_receive_all:
224  * @win: the window that will be used as source of the refresh mail operation
225  * @force_connection: whether or not the code should try to force a new connection if we're offline
226  * @poke_status: wheter ot not we want to poke the status of all mail folders
227  * @interactive: is coming from an interactive send receive.
228  * 
229  * Refreshes all the accounts
230  **/
231 void    modest_ui_actions_do_send_receive_all          (ModestWindow *win,
232                                                         gboolean force_connection,
233                                                         gboolean poke_status,
234                                                         gboolean interactive);
235
236 /**
237  * modest_ui_actions_do_send_receive:
238  * @account_name: the name of the Modest account or NULL
239  * @force_connection: whether or not the code should try to force a new connection if we're offline
240  * @poke_status: wheter ot not we want to poke the status of all mail folders
241  * @interactive: is coming from an interactive send receive
242  * @win: the window that will be used as source of the refresh mail operation
243  * 
244  * Refreshes the Modest account whose name is passed as argument. If
245  * NULL is passed as #account_name then this function refreses the
246  * active account, if no active account is defined then it picks the
247  * default account
248  **/
249 void    modest_ui_actions_do_send_receive              (const gchar *account_name,
250                                                         gboolean force_connection,
251                                                         gboolean poke_status,
252                                                         gboolean interactive,
253                                                         ModestWindow *win);
254
255 /**
256  * modest_ui_actions_on_send_receive:
257  * @action: a #GtkAction
258  * @win: the Window that contains the action
259  * 
260  * Handles the activation of the send receive action, for example
261  * clicks on Send&Receive button in the main toolbar
262  **/
263 void    modest_ui_actions_on_send_receive              (GtkAction *action, 
264                                                         ModestWindow *win);
265
266 void     modest_ui_actions_on_new_folder               (GtkAction *action,
267                                                         ModestWindow *main_window);
268
269 gboolean     modest_ui_actions_on_edit_mode_rename_folder            (ModestWindow *window);
270
271 void     modest_ui_actions_on_rename_folder            (GtkAction *action,
272                                                         ModestWindow *window);
273
274 void     modest_ui_actions_on_delete_folder            (GtkAction *action,
275                                                         ModestWindow *window);
276
277 void     modest_ui_actions_on_move_folder_to_trash_folder     (GtkAction *action,
278                                                                ModestMainWindow *main_window);
279
280 void     modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
281                                                   const gchar* server_account_name,
282                                                   gchar **username, gchar **password, gboolean *cancel, 
283                                                   gboolean *remember, ModestMainWindow *main_window);
284
285 void     modest_ui_actions_on_undo                     (GtkAction *action,
286                                                         ModestWindow *window);
287
288 void     modest_ui_actions_on_redo                     (GtkAction *action,
289                                                         ModestWindow *window);
290
291 void     modest_ui_actions_on_cut                      (GtkAction *action,
292                                                         ModestWindow *window);
293
294 void     modest_ui_actions_on_copy                     (GtkAction *action,
295                                                         ModestWindow *window);
296
297 void     modest_ui_actions_on_zoom_plus (GtkAction *action,
298                                          ModestWindow *window);
299
300 void     modest_ui_actions_on_zoom_minus (GtkAction *action,
301                                           ModestWindow *window);
302
303 void     modest_ui_actions_on_toggle_fullscreen    (GtkToggleAction *toggle,
304                                                     ModestWindow *window);
305
306 void     modest_ui_actions_on_change_fullscreen    (GtkAction *action,
307                                                     ModestWindow *window);
308
309 void     modest_ui_actions_on_paste                    (GtkAction *action,
310                                                         ModestWindow *window);
311
312 void     modest_ui_actions_on_select_all               (GtkAction *action,
313                                                         ModestWindow *window);
314
315 void     modest_ui_actions_on_toggle_show_cc (GtkToggleAction *toggle,
316                                               ModestMsgEditWindow *window);
317
318 void     modest_ui_actions_on_toggle_show_bcc (GtkToggleAction *toggle,
319                                               ModestMsgEditWindow *window);
320
321 void     modest_ui_actions_on_change_zoom              (GtkRadioAction *action,
322                                                         GtkRadioAction *selected,
323                                                         ModestWindow *window);
324
325 void     modest_ui_actions_msg_edit_on_change_priority (GtkRadioAction *action,
326                                                         GtkRadioAction *selected,
327                                                         ModestWindow *window);
328
329 void     modest_ui_actions_msg_edit_on_change_file_format (GtkRadioAction *action,
330                                                            GtkRadioAction *selected,
331                                                            ModestWindow *window);
332
333 void     modest_ui_actions_msg_edit_on_select_font (GtkAction *action,
334                                                     ModestMsgEditWindow *window);
335
336 /**
337  * modest_ui_actions_on_toggle_toolbar:
338  * @toggle: 
339  * @window: 
340  * 
341  * Hides/Shows the toolbars of the #ModestWindow instances
342  **/
343 void     modest_ui_actions_on_toggle_toolbar           (GtkToggleAction *toggle, 
344                                                         ModestWindow *window);
345
346 /**
347  * modest_ui_actions_on_folder_display_name_changed:
348  * @folder_view: a #ModestFolderView
349  * @display_name: the new window title
350  * @window: a #GtkWindow
351  * 
352  * Sets the title of the window to the value specified by
353  * display_name. This function is used typically as a callback to the
354  * "folder-display-name-changed" signal from the #ModestFolderView
355  **/
356 void     modest_ui_actions_on_folder_display_name_changed (ModestFolderView *folder_view,
357                                                            const gchar *display_name,
358                                                            GtkWindow *window);
359
360 void     modest_ui_actions_view_attachment                (GtkAction *action,
361                                                            ModestWindow *window);
362
363 void     modest_ui_actions_save_attachments               (GtkAction *action,
364                                                            ModestWindow *window);
365
366 void     modest_ui_actions_remove_attachments             (GtkAction *action,
367                                                            ModestWindow *window);
368
369 /**
370  * modest_ui_actions_on_retrieve_msg_contents:
371  * @action: the #GtkAction
372  * @window: the #ModestWindow that issues the action
373  * 
374  * Retrieve the contents of the selected messages in the header view
375  **/
376 void     modest_ui_actions_on_retrieve_msg_contents       (GtkAction *action,
377                                                            ModestWindow *window);
378
379 void
380 modest_ui_actions_on_email_menu_activated (GtkAction *action,
381                                           ModestWindow *window);
382
383 void
384 modest_ui_actions_on_edit_menu_activated (GtkAction *action,
385                                           ModestWindow *window);
386
387 void
388 modest_ui_actions_on_format_menu_activated (GtkAction *action,
389                                             ModestWindow *window);
390
391 void
392 modest_ui_actions_on_view_menu_activated (GtkAction *action,
393                                           ModestWindow *window);
394
395 void
396 modest_ui_actions_on_tools_menu_activated (GtkAction *action,
397                                           ModestWindow *window);
398
399 void
400 modest_ui_actions_on_attachment_menu_activated (GtkAction *action,
401                                                 ModestWindow *window);
402
403 void
404 modest_ui_actions_on_toolbar_csm_menu_activated (GtkAction *action,
405                                                  ModestWindow *window);
406
407 void
408 modest_ui_actions_on_folder_view_csm_menu_activated (GtkAction *action,
409                                                      ModestWindow *window);
410
411 void
412 modest_ui_actions_on_header_view_csm_menu_activated (GtkAction *action,
413                                                      ModestWindow *window);
414
415 void
416 modest_ui_actions_check_toolbar_dimming_rules (ModestWindow *window);
417
418 void
419 modest_ui_actions_check_menu_dimming_rules (ModestWindow *window);
420
421 /* Dimming rules groups */
422 #define MODEST_DIMMING_RULES_TOOLBAR "ModestToolbarDimmingRules"
423 #define MODEST_DIMMING_RULES_MENU "ModestMenuDimmingRules"
424 #define MODEST_DIMMING_RULES_CLIPBOARD "ModestClipboardDimmingRules"
425
426 /**
427  * modest_ui_actions_move_folder_error_handler:
428  * @mail_op: a #ModestMailOperation
429  * @user_data: user data
430  * 
431  * manages an error in a mail operation that tries to move a folder
432  **/
433 void     modest_ui_actions_move_folder_error_handler      (ModestMailOperation *mail_op, 
434                                                            gpointer user_data);
435 /**
436  * modest_ui_actions_send-receive_error_handler:
437  * @mail_op: a #ModestMailOperation
438  * @user_data: user data
439  * 
440  * manages an error in a mail operation that tries to execute
441  * a send&receive operation.
442  **/
443 void     modest_ui_actions_send_receive_error_handler      (ModestMailOperation *mail_op, 
444                                                             gpointer user_data);
445
446 /**
447  * modest_ui_actions_on_search_messages:
448  * @action: a #GtkAction
449  * @window: a #ModestWindow
450  *
451  * Shows the search messages dialog
452  **/
453 void     modest_ui_actions_on_search_messages             (GtkAction *action,
454                                                            ModestWindow *window);
455
456 /**
457  * modest_ui_actions_on_find_in_page:
458  * @action: a #GtkAction
459  * @window: a #ModestWindow
460  *
461  * Toggles the visibility of the find in page toolbar
462  **/
463 void     modest_ui_actions_on_toggle_find_in_page             (GtkAction *action,
464                                                                ModestWindow *window);
465
466 /**
467  * modest_ui_actions_msg_retrieval_check
468  * @mail_op: a #ModestMailOperation
469  * @header: a #TnyHeader
470  * @msg: a #TnyMsg
471  *
472  * This function checks that the message has been retrieved
473  * successfully. It it was not the case it unregisters the header from
474  * the window manager because it won't do it automatically unless the
475  * operation run fine
476  *
477  * Returns: TRUE if the operation was OK, otherwise FALSE
478  **/
479 gboolean modest_ui_actions_msg_retrieval_check                (ModestMailOperation *mail_op, 
480                                                                TnyHeader *header,
481                                                                TnyMsg *msg);
482
483
484 /**
485  * modest_ui_actions_disk_operations_error_handler
486  * @mail_op: a #ModestMailOperation
487  *
488  * Error handler for retrieval operations like
489  * modest_mail_operation_get_msg or
490  * modest_mail_operation_get_msgs_full
491  **/
492 void     modest_ui_actions_disk_operations_error_handler      (ModestMailOperation *mail_op,
493                                                                gpointer user_data);
494
495 /* Show the account creation wizard dialog.
496  * returns: TRUE if an account was created. FALSE if the user cancelled.
497  */
498 gboolean modest_ui_actions_run_account_setup_wizard (ModestWindow *win);
499
500 gint modest_ui_actions_msgs_move_to_confirmation (ModestWindow *win,
501                                                   TnyFolder *dest_folder,
502                                                   gboolean delete,
503                                                   TnyList *headers);
504
505 /*
506  * modest_ui_actions_on_send_queue_error_happened:
507  *
508  * Method for handling errors in send queues
509  */
510 void modest_ui_actions_on_send_queue_error_happened (TnySendQueue *self, 
511                                                      TnyHeader *header, 
512                                                      TnyMsg *msg, 
513                                                      GError *err, 
514                                                      gpointer user_data);
515
516 /*
517  * modest_ui_actions_on_send_queue_status_changed:
518  *
519  * Method for handling changes in the status of the messages in the send queues
520  */
521 void modest_ui_actions_on_send_queue_status_changed (ModestTnySendQueue *send_queue,
522                                                      gchar *msg_id, 
523                                                      guint status,
524                                                      gpointer user_data);
525
526 /**
527  * modest_ui_actions_compose_msg
528  * @win: Modest main window (can be NULL)
529  * @to_str: "To:" header, or NULL
530  * @cc_str: "Cc:" header, or NULL
531  * @bcc_str: "Bcc:" header, or NULL
532  * @subject_str: Subject of the message, or NULL
533  * @body_str: Body of the message (without signature), or NULL
534  * @attachments: attachments List of file URIs to attach
535  * @set_as_modified: wheter or not the message is set initially as modified or not
536  *
537  * Opens a new message editor for composing
538  */
539 void modest_ui_actions_compose_msg (ModestWindow *win,
540                                     const gchar *to_str,
541                                     const gchar *cc_str,
542                                     const gchar *bcc_str,
543                                     const gchar *subject_str,
544                                     const gchar *body_str,
545                                     GSList *attachments,
546                                     gboolean set_as_modified);
547
548 void modest_ui_actions_on_account_connection_error (GtkWindow *parent_window,
549                                                     TnyAccount *account);
550
551 gchar *modest_ui_actions_get_msg_already_deleted_error_msg (ModestWindow *win);
552
553 void modest_ui_actions_transfer_messages_helper (GtkWindow *win,
554                                                  TnyFolder *src_folder,
555                                                  TnyList *headers,
556                                                  TnyFolder *dst_folder);
557
558 void modest_ui_actions_on_fetch_images (GtkAction *action,
559                                         ModestWindow *window);
560
561 /**
562  * modest_ui_actions_check_for_active_account:
563  * @win: a #ModestWindow
564  * @account_name: the account name of the account to check
565  *
566  * Check whether any connections are active, and cancel them if
567  * the user wants.
568  *
569  * Returns: Returns TRUE if there was no problem, or if an operation
570  * was cancelled so we can continue. Returns FALSE if the user chose
571  * to cancel his request instead.
572  **/
573 gboolean modest_ui_actions_check_for_active_account (ModestWindow *win,
574                                                      const gchar* account_name);
575
576 G_END_DECLS
577 #endif /* __MODEST_UI_ACTIONS_H__ */