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