#include "modest-account-mgr-helpers.h" /* For modest_account_mgr_get_account_data(). */
#include "modest-runtime.h" /* For modest_runtime_get_account_mgr(). */
#include "maemo/modest-connection-specific-smtp-window.h"
+#include "maemo/modest-signature-editor-dialog.h"
#include <maemo/modest-maemo-ui-constants.h>
#include <gconf/gconf-client.h>
#include <string.h> /* For strlen(). */
if (self->specific_window)
gtk_widget_destroy (self->specific_window);
+
+ if (self->signature_dialog)
+ gtk_widget_destroy (self->signature_dialog);
G_OBJECT_CLASS (modest_account_settings_dialog_parent_class)->finalize (object);
}
return caption;
}
+
+static void
+on_entry_max (EasysetupValidatingEntry *self, gpointer user_data)
+{
+ ModestAccountSettingsDialog *dialog = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
+ show_error (GTK_WINDOW (dialog), _("ckdg_ib_maximum_characters_reached"));
+}
+
static GtkWidget*
create_page_account_details (ModestAccountSettingsDialog *self)
{
g_list_free (list_prevent);
/* Set max length as in the UI spec:
- * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
+ * The UI spec seems to want us to show a dialog if we hit the maximum. */
gtk_entry_set_max_length (GTK_ENTRY (self->entry_account_title), 64);
+ easysetup_validating_entry_set_max_func (EASYSETUP_VALIDATING_ENTRY (self->entry_account_title),
+ on_entry_max, self);
/* The retrieve combobox: */
self->combo_retrieve = GTK_WIDGET (modest_retrieve_combo_box_new ());
static void
on_button_signature (GtkButton *button, gpointer user_data)
{
+ ModestAccountSettingsDialog * self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
+ /* Create the window, if necessary: */
+ if (!(self->signature_dialog)) {
+ self->signature_dialog = GTK_WIDGET (modest_signature_editor_dialog_new ());
+
+ gboolean use_signature = FALSE;
+ gchar *signature = modest_account_mgr_get_signature(self->account_manager, self->account_name,
+ &use_signature);
+ const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (self->entry_account_title));
+ modest_signature_editor_dialog_set_settings (
+ MODEST_SIGNATURE_EDITOR_DIALOG (self->signature_dialog),
+ use_signature, signature, account_title);
+ g_free (signature);
+ signature = NULL;
+ }
+
+ /* Show the window: */
+ gtk_window_set_transient_for (GTK_WINDOW (self->signature_dialog), GTK_WINDOW (self));
+ gtk_window_set_modal (GTK_WINDOW (self->signature_dialog), TRUE);
+ const gint response = gtk_dialog_run (GTK_DIALOG (self->signature_dialog));
+ gtk_widget_hide (self->signature_dialog);
+ if (response != GTK_RESPONSE_OK) {
+ /* Destroy the widget now, and its data: */
+ gtk_widget_destroy (self->signature_dialog);
+ self->signature_dialog = NULL;
+ }
+ else {
+ /* Mark modified, so we use the dialog's data later: */
+ self->modified = TRUE;
+ }
}
static GtkWidget*
/* The name widgets: */
self->entry_user_name = GTK_WIDGET (easysetup_validating_entry_new ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_user_name), HILDON_GTK_INPUT_MODE_FULL);
/* Set max length as in the UI spec:
- * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
+ * The UI spec seems to want us to show a dialog if we hit the maximum. */
gtk_entry_set_max_length (GTK_ENTRY (self->entry_user_name), 64);
+ easysetup_validating_entry_set_max_func (EASYSETUP_VALIDATING_ENTRY (self->entry_user_name),
+ on_entry_max, self);
GtkWidget *caption = create_caption_new_with_asterix (self, sizegroup,
_("mcen_li_emailsetup_name"), self->entry_user_name, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->entry_user_name);
/* The username widgets: */
self->entry_user_username = GTK_WIDGET (easysetup_validating_entry_new ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_user_username), HILDON_GTK_INPUT_MODE_FULL);
caption = create_caption_new_with_asterix (self, sizegroup, _("mail_fi_username"),
self->entry_user_username, NULL, HILDON_CAPTION_MANDATORY);
gtk_widget_show (self->entry_user_username);
EASYSETUP_VALIDATING_ENTRY (self->entry_user_username));
/* Set max length as in the UI spec:
- * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
+ * The UI spec seems to want us to show a dialog if we hit the maximum. */
gtk_entry_set_max_length (GTK_ENTRY (self->entry_user_username), 64);
+ easysetup_validating_entry_set_max_func (EASYSETUP_VALIDATING_ENTRY (self->entry_user_username),
+ on_entry_max, self);
/* The password widgets: */
self->entry_user_password = gtk_entry_new ();
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_user_password), HILDON_GTK_INPUT_MODE_FULL);
gtk_entry_set_visibility (GTK_ENTRY (self->entry_user_password), FALSE);
/* gtk_entry_set_invisible_char (GTK_ENTRY (self->entry_user_password), '*'); */
caption = create_caption_new_with_asterix (self, sizegroup,
/* The email address widgets: */
self->entry_user_email = GTK_WIDGET (easysetup_validating_entry_new ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_user_email), HILDON_GTK_INPUT_MODE_FULL);
caption = create_caption_new_with_asterix (self, sizegroup,
_("mcen_li_emailsetup_email_address"), self->entry_user_email, NULL, HILDON_CAPTION_MANDATORY);
gtk_entry_set_text (GTK_ENTRY (self->entry_user_email), EXAMPLE_EMAIL_ADDRESS); /* Default text. */
gtk_widget_show (caption);
/* Set max length as in the UI spec:
- * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
+ * The UI spec seems to want us to show a dialog if we hit the maximum. */
gtk_entry_set_max_length (GTK_ENTRY (self->entry_user_email), 64);
-
+ easysetup_validating_entry_set_max_func (EASYSETUP_VALIDATING_ENTRY (self->entry_user_email),
+ on_entry_max, self);
/* Signature button: */
if (!self->button_signature)
/* The incoming server widgets: */
if(!self->entry_incomingserver)
self->entry_incomingserver = gtk_entry_new ();
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_incomingserver), HILDON_GTK_INPUT_MODE_FULL);
if (self->caption_incoming)
gtk_widget_destroy (self->caption_incoming);
/* The outgoing server widgets: */
if (!self->entry_outgoingserver)
self->entry_outgoingserver = gtk_entry_new ();
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
GtkWidget *caption = create_caption_new_with_asterix (self, sizegroup,
_("mcen_li_emailsetup_smtp"), self->entry_outgoingserver, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->entry_outgoingserver);
/* The username widgets: */
self->entry_outgoing_username = GTK_WIDGET (easysetup_validating_entry_new ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_outgoing_username), HILDON_GTK_INPUT_MODE_FULL);
self->caption_outgoing_username = create_caption_new_with_asterix (self, sizegroup, _("mail_fi_username"),
self->entry_outgoing_username, NULL, HILDON_CAPTION_MANDATORY);
gtk_widget_show (self->entry_outgoing_username);
EASYSETUP_VALIDATING_ENTRY (self->entry_outgoing_username));
/* Set max length as in the UI spec:
- * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
+ * The UI spec seems to want us to show a dialog if we hit the maximum. */
gtk_entry_set_max_length (GTK_ENTRY (self->entry_outgoing_username), 64);
-
+ easysetup_validating_entry_set_max_func (EASYSETUP_VALIDATING_ENTRY (self->entry_outgoing_username),
+ on_entry_max, self);
+
/* The password widgets: */
self->entry_outgoing_password = gtk_entry_new ();
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_outgoing_password), HILDON_GTK_INPUT_MODE_FULL);
gtk_entry_set_visibility (GTK_ENTRY (self->entry_outgoing_password), FALSE);
/* gtk_entry_set_invisible_char (GTK_ENTRY (self->entry_outgoing_password), '*'); */
self->caption_outgoing_password = create_caption_new_with_asterix (self, sizegroup,
MODEST_ACCOUNT_EMAIL, emailaddress, FALSE /* not server account */);
if (!test)
return FALSE;
+
+ /* Signature: */
+ if (dialog->signature_dialog) {
+ gboolean use_signature = FALSE;
+ gchar *signature = modest_signature_editor_dialog_get_settings (
+ MODEST_SIGNATURE_EDITOR_DIALOG (dialog->signature_dialog),
+ &use_signature);
+
+ modest_account_mgr_set_signature(dialog->account_manager, account_name,
+ signature, use_signature);
+ g_free (signature);
+ }
gchar *retrieve = modest_retrieve_combo_box_get_active_retrieve_conf (
MODEST_RETRIEVE_COMBO_BOX (dialog->combo_retrieve));