static void save_to_settings (ModestEasysetupWizardDialog *self);
static void real_enable_buttons (ModestWizardDialog *dialog, gboolean enable_next);
+static GList* check_for_supported_auth_methods (ModestEasysetupWizardDialog* self);
+static gboolean check_has_supported_auth_methods(ModestEasysetupWizardDialog* self);
static gboolean
on_delete_event (GtkWidget *widget,
invoke_enable_buttons_vfunc(self);
}
+static void
+on_serviceprovider_picker_button_value_changed (HildonPickerButton *widget, gpointer user_data)
+{
+ gchar* default_account_name_start;
+ gchar* default_account_name;
+ ModestEasysetupWizardDialog *self;
+ ModestEasysetupWizardDialogPrivate *priv;
+ ModestProviderPickerIdType provider_id_type;
+
+ self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
+ priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+
+ on_picker_button_value_changed (widget, user_data);
+
+ provider_id_type = modest_provider_picker_get_active_id_type (
+ MODEST_PROVIDER_PICKER (priv->account_serviceprovider_picker));
+ if (provider_id_type == MODEST_PROVIDER_PICKER_ID_OTHER) {
+ default_account_name_start = g_strdup (_("mcen_ia_emailsetup_defaultname"));
+ } else {
+ GtkWidget *selector;
+
+ selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (widget)));
+ default_account_name_start =
+ g_strdup (hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
+
+ }
+ default_account_name = modest_account_mgr_get_unused_account_display_name (
+ priv->account_manager, default_account_name_start);
+ g_free (default_account_name_start);
+ default_account_name_start = NULL;
+
+ hildon_entry_set_text (HILDON_ENTRY (priv->entry_account_title), default_account_name);
+ g_free (default_account_name);
+}
+
/** This is a convenience function to create a caption containing a mandatory widget.
* When the widget is edited, the enable_buttons() vfunc will be called.
*/
_("mcen_fi_serviceprovider"),
priv->account_serviceprovider_picker);
g_signal_connect (G_OBJECT (priv->account_serviceprovider_picker), "value-changed",
- G_CALLBACK (on_picker_button_value_changed), self);
+ G_CALLBACK (on_serviceprovider_picker_button_value_changed), self);
gtk_box_pack_start (GTK_BOX (box), priv->account_serviceprovider_picker, FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (priv->account_serviceprovider_picker);
/* Prevent the use of some characters in the username,
* as required by our UI specification: */
- modest_validating_entry_set_unallowed_characters_whitespace (
- MODEST_VALIDATING_ENTRY (priv->entry_user_username));
modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(priv->entry_user_username),
modest_utils_on_entry_invalid_character, self);
create_page_custom_outgoing (ModestEasysetupWizardDialog *self)
{
ModestEasysetupWizardDialogPrivate *priv;
+ gchar *smtp_caption_label;
GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
/* Create a size group to be used by all captions.
G_CALLBACK (on_easysetup_changed), self);
/* Auto-capitalization is the default, so let's turn it off: */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
+ smtp_caption_label = g_strconcat (_("mcen_li_emailsetup_smtp"), "\n<small>(SMTP)</small>", NULL);
GtkWidget *caption = create_captioned (self, title_sizegroup, value_sizegroup,
- _("mcen_li_emailsetup_smtp"), FALSE, priv->entry_outgoingserver);
+ smtp_caption_label, TRUE, priv->entry_outgoingserver);
+ g_free (smtp_caption_label);
gtk_widget_show (priv->entry_outgoingserver);
gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
set_default_custom_servernames (self);
/* Check if the server supports secure authentication */
-/* if (modest_security_options_view_auth_check (security_options)) */
-/* if (!check_has_supported_auth_methods (self)) */
-/* return FALSE; */
+ if (modest_security_options_view_auth_check (MODEST_SECURITY_OPTIONS_VIEW (priv->incoming_security)))
+ if (!check_has_supported_auth_methods (self))
+ return FALSE;
gtk_widget_show (priv->outgoing_security);
}
g_free (provider_id);
}
+static GList*
+check_for_supported_auth_methods (ModestEasysetupWizardDialog* self)
+{
+ GError *error = NULL;
+ ModestProtocolType protocol_type;
+ const gchar* hostname;
+ const gchar* username;
+ ModestProtocolType security_protocol_incoming_type;
+ ModestProtocolRegistry *registry;
+ int port_num;
+ GList *list_auth_methods;
+ ModestEasysetupWizardDialogPrivate *priv;
+
+ priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+ registry = modest_runtime_get_protocol_registry ();
+ protocol_type = modest_servertype_picker_get_active_servertype (
+ MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker));
+ hostname = gtk_entry_get_text(GTK_ENTRY(priv->entry_incomingserver));
+ username = gtk_entry_get_text(GTK_ENTRY(priv->entry_user_username));
+ security_protocol_incoming_type = modest_security_options_view_get_connection_protocol
+ (MODEST_SECURITY_OPTIONS_VIEW (priv->incoming_security));
+ port_num = get_port_from_protocol(protocol_type, FALSE);
+ list_auth_methods = modest_utils_get_supported_secure_authentication_methods (protocol_type, hostname, port_num,
+ username, GTK_WINDOW (self), &error);
+
+ if (list_auth_methods) {
+ /* TODO: Select the correct method */
+ GList* list = NULL;
+ GList* method;
+ for (method = list_auth_methods; method != NULL; method = g_list_next(method)) {
+ ModestProtocolType auth_protocol_type = (ModestProtocolType) (GPOINTER_TO_INT(method->data));
+ if (modest_protocol_registry_protocol_type_has_tag (registry, auth_protocol_type,
+ MODEST_PROTOCOL_REGISTRY_SECURE_PROTOCOLS)) {
+ list = g_list_append(list, GINT_TO_POINTER(auth_protocol_type));
+ }
+ }
+
+ g_list_free(list_auth_methods);
+
+ if (list)
+ return list;
+ }
+
+ if(error == NULL || error->domain != modest_utils_get_supported_secure_authentication_error_quark() ||
+ error->code != MODEST_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED)
+ {
+ modest_platform_information_banner (GTK_WIDGET(self), NULL,
+ _("mcen_ib_unableto_discover_auth_methods"));
+ }
+
+ if(error != NULL)
+ g_error_free(error);
+
+ return NULL;
+}
+
+static gboolean
+check_has_supported_auth_methods(ModestEasysetupWizardDialog* self)
+{
+ GList* methods = check_for_supported_auth_methods(self);
+ if (!methods)
+ {
+ return FALSE;
+ }
+
+ g_list_free(methods);
+ return TRUE;
+}
+