* src/widgets/modest-msg-edit-window.h:
* Now the message data contains the draft message the editor was
created from, if any, and the account name of the From: email
address we'll use.
* src/modest-ui-actions.c:
* Now it retrieves the account name from the editor to be able
to send the message from local folders.
* Now it retrieves the draft message on trying to send a mail,
to be able to delete it on send.
* Now it retrieves the draft message on trying to save to
drafts, to delete it and replace it with the new edited
version.
* src/maemo/modest-msg-edit-window.c:
* Obtains the account name and adds a reference to the drafts
message on getting message data, to be able to handle sending
on local folders, and removing drafts that should be removed.
* src/modest-mail-operation.[ch]:
* Now send new mail removes the draft message the mail is coming
from, if any.
* Now save to drafts removes previous draft message if any.
* src/modest-main.c:
* API update on send_new_mail method.
* src/dbus_api/modest-dbus-callbacks.c:
* API update on send_new_mail method.
Other fixes:
* src/widgets/modest-msg-edit-window-ui.h:
* Added non implemented actions for global search and find in
page.
* src/maemo/ui/modest-msg-edit-window-ui.xml:
* Add ui manager actions for find in page and global search.
* src/maemo/modest-msg-edit-window.c:
* Some changes on font size update code.
pmo-trunk-r2061
modest_mail_operation_send_new_mail (mail_operation,
transport_account,
modest_mail_operation_send_new_mail (mail_operation,
transport_account,
from, /* from */
idle_data->to, idle_data->cc, idle_data->bcc, idle_data->subject,
idle_data->body, /* plain_body */
from, /* from */
idle_data->to, idle_data->cc, idle_data->bcc, idle_data->subject,
idle_data->body, /* plain_body */
data = g_slice_new0 (MsgData);
data = g_slice_new0 (MsgData);
- data->from = from_string, /* will be freed when data is freed */
- data->to = g_strdup (gtk_entry_get_text (GTK_ENTRY(priv->to_field))));
+ data->from = from_string; /* will be freed when data is freed */
+ data->to = g_strdup (gtk_entry_get_text (GTK_ENTRY(priv->to_field)));
data->cc = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->cc_field)));
data->bcc = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->bcc_field)));
data->subject = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->subject_field)));
data->cc = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->cc_field)));
data->bcc = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->bcc_field)));
data->subject = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->subject_field)));
GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
GtkTextIter b, e;
GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
GtkTextIter b, e;
data = g_slice_new0 (MsgData);
data->from = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(),
account_name);
data = g_slice_new0 (MsgData);
data->from = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(),
account_name);
+ data->account_name = g_strdup (account_name);
data->to = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->to_field)));
data->cc = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->cc_field)));
data->bcc = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->bcc_field)));
data->subject = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->subject_field)));
data->to = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->to_field)));
data->cc = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->cc_field)));
data->bcc = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->bcc_field)));
data->subject = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->subject_field)));
+ if (priv->draft_msg) {
+ data->draft_msg = g_object_ref (priv->draft_msg);
+ } else {
+ data->draft_msg = NULL;
+ }
GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
GtkTextIter b, e;
GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
GtkTextIter b, e;
g_free (data->subject);
g_free (data->plain_body);
g_free (data->html_body);
g_free (data->subject);
g_free (data->plain_body);
g_free (data->html_body);
+ if (data->draft_msg != NULL) {
+ g_object_unref (data->draft_msg);
+ data->draft_msg = NULL;
+ }
+ g_free (data->account_name);
/* TODO: Free data->attachments? */
/* TODO: Free data->attachments? */
if (gtk_check_menu_item_get_active (menu_item)) {
gchar *markup;
if (gtk_check_menu_item_get_active (menu_item)) {
gchar *markup;
+ WPTextBufferFormat format;
label = gtk_bin_get_child (GTK_BIN (menu_item));
new_size_index = atoi (gtk_label_get_text (GTK_LABEL (label)));
label = gtk_bin_get_child (GTK_BIN (menu_item));
new_size_index = atoi (gtk_label_get_text (GTK_LABEL (label)));
-
- if (!wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE,
- (gpointer) wp_get_font_size_index (new_size_index, 12)))
- wp_text_view_reset_and_show_im (WP_TEXT_VIEW (priv->msg_body));
+ memset (&format, 0, sizeof (format));
+ format.cs.font_size = TRUE;
+ format.font_size = wp_get_font_size_index (new_size_index, DEFAULT_FONT_SIZE);
+ wp_text_buffer_set_format (WP_TEXT_BUFFER (priv->text_buffer), &format);
+
+/* if (!wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, */
+/* (gpointer) wp_get_font_size_index (new_size_index, 12))) */
+/* wp_text_view_reset_and_show_im (WP_TEXT_VIEW (priv->msg_body)); */
text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (window));
markup = g_strconcat ("<span font_family='Serif'>", gtk_label_get_text (GTK_LABEL (label)), "</span>", NULL);
text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (window));
markup = g_strconcat ("<span font_family='Serif'>", gtk_label_get_text (GTK_LABEL (label)), "</span>", NULL);
<menuitem name="MessagePriorityLowMenu" action="MessagePriorityLow"/>
</menu>
<separator/>
<menuitem name="MessagePriorityLowMenu" action="MessagePriorityLow"/>
</menu>
<separator/>
-<!--
- <menuitem name="ToolsFindOnPageMenu" action="ToolsFindOnPage"/>
- <menuitem name="ToolSearchMessagesMenu" action="ToolSearchMessages"/>
+ <menuitem name="FindInMessageMenu" action="FindInMessage"/>
+ <menuitem name="ToolSearchMessagesMenu" action="SearchMessages"/>
<menuitem name="ToolsHelpMenu" action="Help"/>
</menu>
<menuitem name="ToolsHelpMenu" action="Help"/>
</menu>
void
modest_mail_operation_send_new_mail (ModestMailOperation *self,
TnyTransportAccount *transport_account,
void
modest_mail_operation_send_new_mail (ModestMailOperation *self,
TnyTransportAccount *transport_account,
const gchar *from, const gchar *to,
const gchar *cc, const gchar *bcc,
const gchar *subject, const gchar *plain_body,
const gchar *from, const gchar *to,
const gchar *cc, const gchar *bcc,
const gchar *subject, const gchar *plain_body,
TnyHeaderFlags priority_flags)
{
TnyMsg *new_msg = NULL;
TnyHeaderFlags priority_flags)
{
TnyMsg *new_msg = NULL;
+ TnyFolder *folder = NULL;
ModestMailOperationPrivate *priv = NULL;
g_return_if_fail (MODEST_IS_MAIL_OPERATION (self));
ModestMailOperationPrivate *priv = NULL;
g_return_if_fail (MODEST_IS_MAIL_OPERATION (self));
/* Call mail operation */
modest_mail_operation_send_mail (self, transport_account, new_msg);
/* Call mail operation */
modest_mail_operation_send_mail (self, transport_account, new_msg);
+ folder = modest_tny_account_get_special_folder (TNY_ACCOUNT (transport_account), TNY_FOLDER_TYPE_DRAFTS);
+ if (folder) {
+ if (draft_msg != NULL) {
+ TnyHeader *header = tny_msg_get_header (draft_msg);
+ tny_folder_remove_msg (folder, header, NULL);
+ g_object_unref (header);
+ }
+ }
+
/* Free */
g_object_unref (G_OBJECT (new_msg));
}
/* Free */
g_object_unref (G_OBJECT (new_msg));
}
void
modest_mail_operation_save_to_drafts (ModestMailOperation *self,
TnyTransportAccount *transport_account,
void
modest_mail_operation_save_to_drafts (ModestMailOperation *self,
TnyTransportAccount *transport_account,
const gchar *from, const gchar *to,
const gchar *cc, const gchar *bcc,
const gchar *subject, const gchar *plain_body,
const gchar *from, const gchar *to,
const gchar *cc, const gchar *bcc,
const gchar *subject, const gchar *plain_body,
"modest: failed to create a new msg\n");
goto end;
}
"modest: failed to create a new msg\n");
goto end;
}
+
+ if (draft_msg != NULL) {
+ TnyHeader *header = tny_msg_get_header (draft_msg);
+ tny_folder_remove_msg (folder, header, NULL);
+ g_object_unref (header);
+ }
tny_folder_add_msg (folder, msg, &(priv->error));
if (priv->error)
tny_folder_add_msg (folder, msg, &(priv->error));
if (priv->error)
* modest_mail_operation_send_new_mail:
* @self: a #ModestMailOperation
* @transport_account: a non-NULL #TnyTransportAccount
* modest_mail_operation_send_new_mail:
* @self: a #ModestMailOperation
* @transport_account: a non-NULL #TnyTransportAccount
+ * @draft_msg: a #TnyMsg of the origin draft message, if any
* @from: the email address of the mail sender
* @to: a non-NULL email address of the mail receiver
* @cc: a comma-separated list of email addresses where to send a carbon copy
* @from: the email address of the mail sender
* @to: a non-NULL email address of the mail receiver
* @cc: a comma-separated list of email addresses where to send a carbon copy
**/
void modest_mail_operation_send_new_mail (ModestMailOperation *self,
TnyTransportAccount *transport_account,
**/
void modest_mail_operation_send_new_mail (ModestMailOperation *self,
TnyTransportAccount *transport_account,
const gchar *from,
const gchar *to,
const gchar *cc,
const gchar *from,
const gchar *to,
const gchar *cc,
* modest_mail_operation_save_to_drafts:
* @self: a #ModestMailOperation
* @transport_account: a non-NULL #TnyTransportAccount
* modest_mail_operation_save_to_drafts:
* @self: a #ModestMailOperation
* @transport_account: a non-NULL #TnyTransportAccount
+ * @draft_msg: the previous draft message, in case it's an update
+ * to an existing draft.
* @from: the email address of the mail sender
* @to: a non-NULL email address of the mail receiver
* @cc: a comma-separated list of email addresses where to send a carbon copy
* @from: the email address of the mail sender
* @to: a non-NULL email address of the mail receiver
* @cc: a comma-separated list of email addresses where to send a carbon copy
**/
void modest_mail_operation_save_to_drafts (ModestMailOperation *self,
TnyTransportAccount *transport_account,
**/
void modest_mail_operation_save_to_drafts (ModestMailOperation *self,
TnyTransportAccount *transport_account,
const gchar *from,
const gchar *to,
const gchar *cc,
const gchar *from,
const gchar *to,
const gchar *cc,
mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_SEND, NULL);
modest_mail_operation_send_new_mail (mail_operation, account,
mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_SEND, NULL);
modest_mail_operation_send_new_mail (mail_operation, account,
from_string, mailto,
cc, bcc, subject, body, NULL /* html_body */,
NULL /* attachments */, 0 /* priority */);
from_string, mailto,
cc, bcc, subject, body, NULL /* html_body */,
NULL /* attachments */, 0 /* priority */);
modest_msg_edit_window_free_msg_data (edit_window, data);
return;
}
modest_msg_edit_window_free_msg_data (edit_window, data);
return;
}
+
+ if (!strcmp (account_name, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+ account_name = g_strdup (data->account_name);
+ }
+
transport_account =
TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_tny_account_by_account
(modest_runtime_get_account_store(),
transport_account =
TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_tny_account_by_account
(modest_runtime_get_account_store(),
modest_mail_operation_save_to_drafts (mail_operation,
transport_account,
modest_mail_operation_save_to_drafts (mail_operation,
transport_account,
from,
data->to,
data->cc,
from,
data->to,
data->cc,
g_printerr ("modest: no account found\n");
return;
}
g_printerr ("modest: no account found\n");
return;
}
+ MsgData *data = modest_msg_edit_window_get_msg_data (edit_window);
+
+ if (!strcmp (account_name, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+ account_name = g_strdup (data->account_name);
+ }
/* Get the currently-active transport account for this modest account: */
TnyTransportAccount *transport_account =
/* Get the currently-active transport account for this modest account: */
TnyTransportAccount *transport_account =
if (!transport_account) {
g_printerr ("modest: no transport account found for '%s'\n", account_name);
g_free (account_name);
if (!transport_account) {
g_printerr ("modest: no transport account found for '%s'\n", account_name);
g_free (account_name);
+ modest_msg_edit_window_free_msg_data (edit_window, data);
return;
}
gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
return;
}
gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
- MsgData *data = modest_msg_edit_window_get_msg_data (edit_window);
-
/* mail content checks and dialogs */
if (data->subject == NULL || data->subject[0] == '\0') {
GtkResponseType response;
/* mail content checks and dialogs */
if (data->subject == NULL || data->subject[0] == '\0') {
GtkResponseType response;
modest_mail_operation_send_new_mail (mail_operation,
transport_account,
modest_mail_operation_send_new_mail (mail_operation,
transport_account,
from,
data->to,
data->cc,
from,
data->to,
data->cc,
{ "CloseWindow", NULL, N_("mcen_me_inbox_close_window"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_close_window)},
{ "CloseAllWindows", NULL, N_("mcen_me_inbox_close_windows"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_quit) },
{ "Help", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
{ "CloseWindow", NULL, N_("mcen_me_inbox_close_window"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_close_window)},
{ "CloseAllWindows", NULL, N_("mcen_me_inbox_close_windows"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_quit) },
{ "Help", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
+ { "SearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, NULL },
/* KEY ACCELERATOR ACTIONS */
/* KEY ACCELERATOR ACTIONS */
{ "ActionsBold", GTK_STOCK_BOLD, NULL, NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_bold), FALSE },
{ "ActionsItalics", GTK_STOCK_ITALIC, NULL, NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_italics), FALSE },
{ "ActionsBold", GTK_STOCK_BOLD, NULL, NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_bold), FALSE },
{ "ActionsItalics", GTK_STOCK_ITALIC, NULL, NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_italics), FALSE },
+ /* Find in page */
+ { "FindInMessage", NULL, N_("mcen_me_viewer_find"), NULL, NULL, NULL, FALSE },
+
};
static const GtkRadioActionEntry modest_msg_edit_alignment_radio_action_entries [] = {
};
static const GtkRadioActionEntry modest_msg_edit_alignment_radio_action_entries [] = {
gchar *from, *to, *cc, *bcc, *subject, *plain_body, *html_body;
GList *attachments;
TnyHeaderFlags priority_flags;
gchar *from, *to, *cc, *bcc, *subject, *plain_body, *html_body;
GList *attachments;
TnyHeaderFlags priority_flags;
+ TnyMsg *draft_msg;
+ gchar *account_name;
} MsgData;
typedef struct {
} MsgData;
typedef struct {