#include <tny-camel-folder.h>
#include <tny-camel-imap-folder.h>
#include <tny-camel-pop-folder.h>
+#include <widgets/modest-header-window.h>
#ifdef MODEST_TOOLKIT_HILDON2
#include <modest-accounts-window.h>
#include <hildon/hildon-gtk.h>
-#include <modest-header-window.h>
#include <modest-folder-window.h>
#include <modest-maemo-utils.h>
#endif
#include <tny-msg-view.h>
#include <tny-device.h>
#include <tny-merge-folder.h>
+#include <widgets/modest-toolkit-utils.h>
#include <gtkhtml/gtkhtml.h>
g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE);
-#ifndef MODEST_TOOLKIT_HILDON2
- /* Check first if the header view has the focus */
- if (MODEST_IS_MAIN_WINDOW (win)) {
- GtkWidget *header_view = NULL;
-
- header_view =
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (!gtk_widget_is_focus (header_view))
- return FALSE;
- }
-#endif
/* Get the headers, either from the header view (if win is the main window),
* or from the message view window: */
header_list = get_selected_headers (win);
if (!header_list) return FALSE;
/* Check if any of the headers are already opened, or in the process of being opened */
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (win)) {
- gint opened_headers = 0;
-
- iter = tny_list_create_iterator (header_list);
- mgr = modest_runtime_get_window_mgr ();
- while (!tny_iterator_is_done (iter)) {
- header = TNY_HEADER (tny_iterator_get_current (iter));
- if (header) {
- if (modest_window_mgr_find_registered_header (mgr, header, NULL))
- opened_headers++;
- g_object_unref (header);
- }
- tny_iterator_next (iter);
- }
- g_object_unref (iter);
-
- if (opened_headers > 0) {
- gchar *msg;
-
- msg = g_strdup_printf (_("mcen_nc_unable_to_delete_n_messages"),
- opened_headers);
-
- modest_platform_run_information_dialog (GTK_WINDOW (win), (const gchar *) msg, FALSE);
-
- g_free (msg);
- g_object_unref (header_list);
- return FALSE;
- }
- }
-#endif
/* Select message */
if (tny_list_get_length(header_list) == 1) {
ModestMailOperation *mail_op = NULL;
/* Find last selected row */
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (win)) {
- GList *tmp = NULL;
- ModestWindowMgr *mgr = NULL;
- GtkTreeModel *model = NULL;
- GtkTreeRowReference *next_row_reference = NULL, *prev_row_reference = NULL;
- GtkTreePath *next_path = NULL, *prev_path = NULL;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view));
- sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (header_view));
- sel_list = gtk_tree_selection_get_selected_rows (sel, &model);
- for (tmp=sel_list; tmp; tmp=tmp->next) {
- if (tmp->next == NULL) {
- prev_path = gtk_tree_path_copy((GtkTreePath *) tmp->data);
- next_path = gtk_tree_path_copy((GtkTreePath *) tmp->data);
-
- gtk_tree_path_prev (prev_path);
- gtk_tree_path_next (next_path);
-
- prev_row_reference = gtk_tree_row_reference_new (model, prev_path);
- next_row_reference = gtk_tree_row_reference_new (model, next_path);
- }
- }
- }
-#endif
/* Disable window dimming management */
modest_window_disable_dimming (win);
/* Get main window */
mgr = modest_runtime_get_window_mgr ();
-#ifndef MODEST_TOOLKIT_HILDON2
- } else if (MODEST_IS_MAIN_WINDOW (win)) {
- /* Select next or previous row */
- if (gtk_tree_row_reference_valid (next_row_reference)) {
- gtk_tree_selection_select_path (sel, next_path);
- }
- else if (gtk_tree_row_reference_valid (prev_row_reference)) {
- gtk_tree_selection_select_path (sel, prev_path);
- }
-
- /* Free */
- if (gtk_tree_row_reference_valid (next_row_reference))
- gtk_tree_row_reference_free (next_row_reference);
- if (next_path != NULL)
- gtk_tree_path_free (next_path);
- if (gtk_tree_row_reference_valid (prev_row_reference))
- gtk_tree_row_reference_free (prev_row_reference);
- if (prev_path != NULL)
- gtk_tree_path_free (prev_path);
-#endif
}
/* Update toolbar dimming state */
void
modest_ui_actions_add_to_contacts (GtkAction *action, ModestWindow *win)
{
- g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (win));
-
- modest_msg_view_window_add_to_contacts (MODEST_MSG_VIEW_WINDOW (win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ modest_msg_view_window_add_to_contacts (MODEST_MSG_VIEW_WINDOW (win));
+ else if (MODEST_IS_MSG_EDIT_WINDOW (win))
+ modest_msg_edit_window_add_to_contacts (MODEST_MSG_EDIT_WINDOW (win));
}
void
if (protocol) {
if (tny_account_get_connection_status (account) ==
TNY_CONNECTION_STATUS_CONNECTED) {
- format = modest_protocol_get_translation (protocol,
- MODEST_PROTOCOL_TRANSLATION_MSG_NOT_AVAILABLE,
- subject);
+ if (header) {
+ format = modest_protocol_get_translation (protocol,
+ MODEST_PROTOCOL_TRANSLATION_MSG_NOT_AVAILABLE,
+ subject);
+ } else {
+ format = modest_protocol_get_translation (protocol,
+ MODEST_PROTOCOL_TRANSLATION_MSG_NOT_AVAILABLE_LOST_HEADER);
+ }
} else {
format = g_strdup_printf (_("mail_ib_backend_server_invalid"),
tny_account_get_hostname (account));
g_object_unref (account);
}
- if (!format)
- format = g_strdup (_("emev_ni_ui_imap_message_not_available_in_server"));
+ if (!format) {
+ if (header) {
+ format = g_strdup (_("emev_ni_ui_imap_message_not_available_in_server"));
+ } else {
+ format = g_strdup (_("emev_ni_ui_pop3_msg_recv_error"));
+ }
+ }
msg = g_strdup_printf (format, subject);
modest_platform_run_information_dialog (NULL, msg, FALSE);
g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW(edit_window), TRUE);
- if (!modest_msg_edit_window_check_names (edit_window, TRUE))
+ /* Check names but do not automatically add them to addressbook */
+ if (!modest_msg_edit_window_check_names (edit_window, FALSE))
return TRUE;
data = modest_msg_edit_window_get_msg_data (edit_window);
*/
gtk_widget_set_sensitive (entry_username, FALSE);
-#ifndef MODEST_TOOLKIT_GTK
/* Auto-capitalization is the default, so let's turn it off: */
+#ifdef MAEMO_CHANGES
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_username), HILDON_GTK_INPUT_MODE_FULL);
+#endif
/* Create a size group to be used by all captions.
* Note that HildonCaption does not create a default size group if we do not specify one.
* We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-#ifdef MODEST_TOOLKIT_HILDON2
- GtkWidget *caption = modest_maemo_utils_create_captioned (sizegroup, NULL,
- _("mail_fi_username"), FALSE,
- entry_username);
-#else
- GtkWidget *caption = hildon_caption_new (sizegroup,
- _("mail_fi_username"), entry_username, NULL, HILDON_CAPTION_MANDATORY);
-#endif
+ GtkWidget *caption = modest_toolkit_utils_create_captioned (sizegroup, NULL,
+ _("mail_fi_username"), FALSE,
+ entry_username);
gtk_widget_show (entry_username);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), caption,
FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
-#else
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry_username,
- TRUE, FALSE, 0);
-#endif /* !MODEST_TOOLKIT_GTK */
/* password: */
GtkWidget *entry_password = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
gtk_entry_set_visibility (GTK_ENTRY(entry_password), FALSE);
/* gtk_entry_set_invisible_char (GTK_ENTRY(entry_password), "*"); */
-#ifndef MODEST_TOOLKIT_GTK
/* Auto-capitalization is the default, so let's turn it off: */
+#ifdef MAEMO_CHANGES
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_password),
HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
+#endif
- caption = modest_maemo_utils_create_captioned (sizegroup, NULL,
- _("mail_fi_password"), FALSE,
- entry_password);
+ caption = modest_toolkit_utils_create_captioned (sizegroup, NULL,
+ _("mail_fi_password"), FALSE,
+ entry_password);
gtk_widget_show (entry_password);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), caption,
FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
g_object_unref (sizegroup);
-#else
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry_password,
- TRUE, FALSE, 0);
-#endif /* !MODEST_TOOLKIT_GTK */
if (initial_username != NULL)
gtk_widget_grab_focus (GTK_WIDGET (entry_password));