Steps to proceed ::<br><br>a)<br>Follow the steps as per <a href="http://kperisetla.blogspot.in/2012/07/sugar-build-alternative-to-sugar.html">http://kperisetla.blogspot.in/2012/07/sugar-build-alternative-to-sugar.html</a><br>
I tried the above on a Fedora-17, as Fedora-18 is still alpha, and can't be installed in a dual-boot fashion.<br><br><br>b)<br>Ensure that "sugar" is on release 0.97.6.<br><br><br>c)<br>Apply the patch.<br><br>
<br>d)<br>Copy the 4 files, to the flashed 31004o2.zd image (on XO-1.75).<br><br><br>e)<br>Follow the steps as per <a href="http://wiki.sugarlabs.org/go/Features/WPA-WPA2-Enterprise-Network-Connections">http://wiki.sugarlabs.org/go/Features/WPA-WPA2-Enterprise-Network-Connections</a>, to prepare the setup for WPA-Entrprise Networks.<br>
<br><br>f)<br>Reboot the XO.<br><br><br>g)<br>Test first, as getting to know the workflow of "what" the patch does, makes it MUCH easier to understand "how" the patch does it.<br><br><br>Next-in-Line ==><br>
=============<br><br>"Multi-Select" and "1-to-N" clubbed into one, as both require a lot of journal-changes.<br><br><br><br><div class="gmail_quote">On Wed, Oct 10, 2012 at 11:08 AM, Ajay Garg <span dir="ltr"><<a href="mailto:ajay@activitycentral.com" target="_blank">ajay@activitycentral.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">*<br>
Feature Page ::<br>
<a href="http://wiki.sugarlabs.org/go/Features/WPA-WPA2-Enterprise-Network-Connections" target="_blank">http://wiki.sugarlabs.org/go/Features/WPA-WPA2-Enterprise-Network-Connections</a><br>
<br>
<br>
*<br>
The patch has been tested to work on <a href="http://build.laptop.org/13.1.0/os4/xo-1.75/31004o2.zd" target="_blank">http://build.laptop.org/13.1.0/os4/xo-1.75/31004o2.zd</a><br>
(after copying the 4 patched source-code files to the XO-1.75).<br>
<br>
<br>
src/jarabe/desktop/keydialog.py | 236 +++++++++++++++++++++++++++++++++-<br>
src/jarabe/desktop/networkviews.py | 243 ++++++++++++++++++++++++++++++++++-<br>
src/jarabe/journal/objectchooser.py | 20 +++<br>
src/jarabe/model/network.py | 3 +<br>
4 files changed, 494 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/jarabe/desktop/keydialog.py b/src/jarabe/desktop/keydialog.py<br>
index 5215d05..8a57feb 100644<br>
--- a/src/jarabe/desktop/keydialog.py<br>
+++ b/src/jarabe/desktop/keydialog.py<br>
@@ -20,8 +20,12 @@ from gettext import gettext as _<br>
<br>
from gi.repository import Gtk<br>
import dbus<br>
+import os<br>
+import shutil<br>
<br>
+from sugar import env<br>
from jarabe.model import network<br>
+from jarabe.journal.objectchooser import ObjectChooser<br>
<br>
<br>
IW_AUTH_ALG_OPEN_SYSTEM = 'open'<br>
@@ -31,6 +35,10 @@ WEP_PASSPHRASE = 1<br>
WEP_HEX = 2<br>
WEP_ASCII = 3<br>
<br>
+SETTING_TYPE_STRING = 1<br>
+SETTING_TYPE_LIST = 2<br>
+SETTING_TYPE_CHOOSER = 3<br>
+<br>
<br>
def string_is_hex(key):<br>
is_hex = True<br>
@@ -72,6 +80,210 @@ class CanceledKeyRequestError(dbus.DBusException):<br>
self._dbus_error_name = network.NM_SETTINGS_IFACE + '.CanceledError'<br>
<br>
<br>
+class NetworkParameters(Gtk.HBox):<br>
+ def __init__(self, auth_param):<br>
+ Gtk.HBox.__init__(self, homogeneous=True)<br>
+ self._key = auth_param._key_name<br>
+ self._label = Gtk.Label(_(auth_param._key_label))<br>
+ self._key_type = auth_param._key_type<br>
+ self._auth_param = auth_param<br>
+<br>
+ self.pack_start(self._label, True, True, 0)<br>
+ self._label.show()<br>
+<br>
+ if self._is_entry():<br>
+ self._entry = Gtk.Entry()<br>
+ self.pack_start(self._entry, True, True, 0)<br>
+ self._entry.show()<br>
+ elif self._is_liststore():<br>
+ self._option_store = Gtk.ListStore(str, str)<br>
+ for option in auth_param._options:<br>
+ self._option_store.append(option)<br>
+<br>
+ self._entry = auth_param._options[0][1]<br>
+ self._option_combo = Gtk.ComboBox(model=self._option_store)<br>
+ cell = Gtk.CellRendererText()<br>
+ self._option_combo.pack_start(cell, True)<br>
+ self._option_combo.add_attribute(cell, 'text', 0)<br>
+ self._option_combo.set_active(0)<br>
+ self._option_combo.connect('changed',<br>
+ self._option_combo_changed_cb)<br>
+ self.pack_start(self._option_combo, True, True, 0)<br>
+ self.show()<br>
+ self._option_combo.show()<br>
+ elif self._is_chooser():<br>
+ self._chooser_button = Gtk.Button(_('Choose..'))<br>
+ self._chooser_button.connect('clicked',<br>
+ self._object_chooser_cb)<br>
+ self.pack_start(self._chooser_button, True, True, 0)<br>
+ self._chooser_button.show()<br>
+ self._entry = ''<br>
+<br>
+ def _is_entry(self):<br>
+ return ( not self._is_chooser() ) and \<br>
+ ( len(self._auth_param._options) == 0 )<br>
+<br>
+ def _is_liststore(self):<br>
+ return ( not self._is_chooser() ) and \<br>
+ ( len(self._auth_param._options) > 0 )<br>
+<br>
+ def _is_chooser(self):<br>
+ return self._key_type == SETTING_TYPE_CHOOSER<br>
+<br>
+ def _object_chooser_cb(self, chooser_button):<br>
+ self._want_document = True<br>
+ self._show_picker_cb()<br>
+<br>
+ def _show_picker_cb(self):<br>
+ if not self._want_document:<br>
+ return<br>
+ self._chooser = ObjectChooser()<br>
+ self._chooser._set_callback(self.__process_selected_journal_object)<br>
+<br>
+ self._chooser.show()<br>
+<br>
+ def __process_selected_journal_object(self, object_id):<br>
+ jobject = self._chooser.get_selected_object()<br>
+ if jobject and jobject.file_path:<br>
+ file_basename = \<br>
+ os.path.basename(jobject._metadata._properties['title'])<br>
+ self._chooser_button.set_label(file_basename)<br>
+<br>
+ profile_path = env.get_profile_path()<br>
+ self._entry = os.path.join(profile_path, file_basename)<br>
+<br>
+ # Remove (older) file, if it exists.<br>
+ if os.path.exists(self._entry):<br>
+ os.remove(self._entry)<br>
+<br>
+ # Copy the file.<br>
+ shutil.copy2(jobject.file_path, self._entry)<br>
+<br>
+ self._chooser.destroy()<br>
+<br>
+ def _option_combo_changed_cb(self, widget):<br>
+ it = self._option_combo.get_active_iter()<br>
+ (value, ) = self._option_store.get(it, 1)<br>
+ self._entry = value<br>
+<br>
+ def _get_key(self):<br>
+ return self._key<br>
+<br>
+ def _get_value(self):<br>
+ if self._is_entry():<br>
+ return self._entry.get_text()<br>
+ elif self._is_liststore():<br>
+ return self._entry<br>
+ elif self._is_chooser():<br>
+ if len(self._entry) > 0:<br>
+ return dbus.ByteArray('file://' + self._entry + '\0')<br>
+ else:<br>
+ return self._entry<br>
+<br>
+<br>
+class KeyValuesDialog(Gtk.Dialog):<br>
+ def __init__(self, auth_lists, final_callback, settings):<br>
+ # This must not be "modal", else the "chooser" widgets won't<br>
+ # accept anything !!<br>
+ Gtk.Dialog.__init__(self)<br>
+ self.set_title(_('Wireless Parameters required'))<br>
+<br>
+ self._spacing_between_children_widgets = 5<br>
+ self._auth_lists = auth_lists<br>
+ self._final_callback = final_callback<br>
+ self._settings = settings<br>
+<br>
+ label = Gtk.Label(_("Please enter parameters\n"))<br>
+ self.vbox.set_spacing(self._spacing_between_children_widgets)<br>
+ self.vbox.pack_start(label, True, True, 0)<br>
+<br>
+ self._auth_type_store = Gtk.ListStore(str, str)<br>
+ for auth_list in self._auth_lists:<br>
+ self._auth_type_store.append([auth_list._auth_label,<br>
+ auth_list._auth_type])<br>
+<br>
+ self._auth_type_combo = Gtk.ComboBox(model=self._auth_type_store)<br>
+ cell = Gtk.CellRendererText()<br>
+ self._auth_type_combo.pack_start(cell, True)<br>
+ self._auth_type_combo.add_attribute(cell, 'text', 0)<br>
+ self._auth_type_combo.set_active(0)<br>
+ self._auth_type_combo.connect('changed',<br>
+ self._auth_type_combo_changed_cb)<br>
+ self._auth_type_box = Gtk.HBox(homogeneous=True)<br>
+ self._auth_label = Gtk.Label(_('Authentication'))<br>
+ self._auth_type_box.pack_start(self._auth_label, True, True, 0)<br>
+ self._auth_type_box.pack_start(self._auth_type_combo,<br>
+ True, True, 0)<br>
+ self.vbox.pack_start(self._auth_type_box, True, True, 0)<br>
+ self._auth_label.show()<br>
+ self._auth_type_combo.show()<br>
+<br>
+ self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK)<br>
+ self.set_default_response(Gtk.ResponseType.OK)<br>
+ #self.set_has_separator(True)<br>
+<br>
+ self.connect('response', self._fetch_values)<br>
+<br>
+ auth_type = self._auth_lists[0]._auth_type<br>
+ self._selected_auth_list = self._select_auth_list(auth_type)<br>
+ self._add_key_value('eap', auth_type)<br>
+ self._add_container_box()<br>
+<br>
+ def _auth_type_combo_changed_cb(self, widget):<br>
+ it = self._auth_type_combo.get_active_iter()<br>
+ (auth_type, ) = self._auth_type_store.get(it, 1)<br>
+ self._selected_auth_list = self._select_auth_list(auth_type)<br>
+ self._add_key_value('eap', auth_type)<br>
+ self._reset()<br>
+<br>
+ def _select_auth_list(self, auth_type):<br>
+ for auth_list in self._auth_lists:<br>
+ if auth_list._params_list[0]._options[0][1] == auth_type:<br>
+ return auth_list<br>
+<br>
+ def _populate_auth_params(self, auth_list):<br>
+ for auth_param in auth_list._params_list[1:]:<br>
+ obj = NetworkParameters(auth_param)<br>
+ self._key_values_box.pack_start(obj, True, True, 0)<br>
+ obj.show()<br>
+<br>
+ def _reset(self):<br>
+ self.vbox.remove(self._key_values_box)<br>
+ self._add_container_box()<br>
+<br>
+ def _add_container_box(self):<br>
+ self._key_values_box = \<br>
+ Gtk.VBox(spacing=self._spacing_between_children_widgets)<br>
+ self.vbox.pack_start(self._key_values_box, True, True, 0)<br>
+ self._key_values_box.show()<br>
+ self._populate_auth_params(self._selected_auth_list)<br>
+<br>
+ def _remove_all_params(self):<br>
+ self._key_values_box.remove_all()<br>
+<br>
+ def _fetch_values(self, key_dialog, response_id):<br>
+ if response_id == Gtk.ResponseType.OK:<br>
+ for child in self._key_values_box.get_children():<br>
+ key = child._get_key()<br>
+ value = child._get_value()<br>
+ self._add_key_value(key, value)<br>
+<br>
+ key_dialog.destroy()<br>
+ self._final_callback(self._settings,<br>
+ self._selected_auth_list)<br>
+<br>
+ def _add_key_value(self, key, value):<br>
+ for auth_param in self._selected_auth_list._params_list:<br>
+ if auth_param._key_name == key:<br>
+ if (auth_param._key_type == SETTING_TYPE_STRING) or \<br>
+ (auth_param._key_type == SETTING_TYPE_CHOOSER):<br>
+ auth_param._value = value<br>
+ elif auth_param._key_type == SETTING_TYPE_LIST:<br>
+ values = []<br>
+ values.append(value)<br>
+ auth_param._value = values<br>
+<br>
+<br>
class KeyDialog(Gtk.Dialog):<br>
def __init__(self, ssid, flags, wpa_flags, rsn_flags, dev_caps, response):<br>
Gtk.Dialog.__init__(self, flags=Gtk.DialogFlags.MODAL)<br>
@@ -134,7 +346,7 @@ class WEPKeyDialog(KeyDialog):<br>
self.key_combo.connect('changed', self._key_combo_changed_cb)<br>
<br>
hbox = Gtk.HBox()<br>
- hbox.pack_start(Gtk.Label(_('Key Type:', True, True, 0)))<br>
+ hbox.pack_start(Gtk.Label(_('Key Type:')), True, True, 0)<br>
hbox.pack_start(self.key_combo, True, True, 0)<br>
hbox.show_all()<br>
self.vbox.pack_start(hbox, True, True, 0)<br>
@@ -154,7 +366,7 @@ class WEPKeyDialog(KeyDialog):<br>
self.auth_combo.set_active(0)<br>
<br>
hbox = Gtk.HBox()<br>
- hbox.pack_start(Gtk.Label(_('Authentication Type:', True, True, 0)))<br>
+ hbox.pack_start(Gtk.Label(_('Authentication Type:')), True, True, 0)<br>
hbox.pack_start(self.auth_combo, True, True, 0)<br>
hbox.show_all()<br>
<br>
@@ -210,7 +422,7 @@ class WEPKeyDialog(KeyDialog):<br>
self.set_response_sensitive(Gtk.ResponseType.OK, valid)<br>
<br>
<br>
-class WPAKeyDialog(KeyDialog):<br>
+class WPAPersonalKeyDialog(KeyDialog):<br>
def __init__(self, ssid, flags, wpa_flags, rsn_flags, dev_caps, response):<br>
KeyDialog.__init__(self, ssid, flags, wpa_flags, rsn_flags,<br>
dev_caps, response)<br>
@@ -286,14 +498,26 @@ def create(ssid, flags, wpa_flags, rsn_flags, dev_caps, response):<br>
rsn_flags == network.NM_802_11_AP_SEC_NONE:<br>
key_dialog = WEPKeyDialog(ssid, flags, wpa_flags, rsn_flags,<br>
dev_caps, response)<br>
- else:<br>
- key_dialog = WPAKeyDialog(ssid, flags, wpa_flags, rsn_flags,<br>
- dev_caps, response)<br>
+ elif (wpa_flags & network.NM_802_11_AP_SEC_KEY_MGMT_PSK) or \<br>
+ (rsn_flags & network.NM_802_11_AP_SEC_KEY_MGMT_PSK):<br>
+ key_dialog = WPAPersonalKeyDialog(ssid, flags, wpa_flags, rsn_flags,<br>
+ dev_caps, settings, response)<br>
+ elif (wpa_flags & network.NM_802_11_AP_SEC_KEY_MGMT_802_1X) or \<br>
+ (rsn_flags & network.NM_802_11_AP_SEC_KEY_MGMT_802_1X):<br>
+ # nothing. All details are asked for WPA/WPA2-Enterprise<br>
+ # networks, before the conneection-activation is done.<br>
+ return<br>
<br>
key_dialog.connect('response', _key_dialog_response_cb)<br>
key_dialog.show_all()<br>
<br>
<br>
+def get_key_values(key_list, final_callback, settings):<br>
+ key_dialog = KeyValuesDialog(key_list, final_callback,<br>
+ settings)<br>
+ key_dialog.show_all()<br>
+<br>
+<br>
def _key_dialog_response_cb(key_dialog, response_id):<br>
response = key_dialog.get_response_object()<br>
secrets = None<br>
diff --git a/src/jarabe/desktop/networkviews.py b/src/jarabe/desktop/networkviews.py<br>
index c949b7e..e9c138f 100644<br>
--- a/src/jarabe/desktop/networkviews.py<br>
+++ b/src/jarabe/desktop/networkviews.py<br>
@@ -22,6 +22,7 @@ import hashlib<br>
<br>
import dbus<br>
import glib<br>
+import string<br>
<br>
from sugar3.graphics.icon import Icon<br>
from sugar3.graphics.xocolor import XoColor<br>
@@ -47,6 +48,192 @@ _OLPC_MESH_ICON_NAME = 'network-mesh'<br>
<br>
_FILTERED_ALPHA = 0.33<br>
<br>
+SETTING_TYPE_STRING = 1<br>
+SETTING_TYPE_LIST = 2<br>
+SETTING_TYPE_CHOOSER = 3<br>
+<br>
+<br>
+class AuthenticationType:<br>
+ def __init__(self, auth_label, auth_type, params_list):<br>
+ self._auth_label = auth_label<br>
+ self._auth_type = auth_type<br>
+ self._params_list = params_list<br>
+<br>
+<br>
+class AuthenticationParameter:<br>
+ def __init__(self, key_name, key_label, key_type,<br>
+ options):<br>
+ self._key_name = key_name<br>
+ self._key_label = key_label<br>
+ self._key_type = key_type<br>
+ self._options = options<br>
+ self._value = None<br>
+<br>
+<br>
+<br>
+AUTHENTICATION_LIST = \<br>
+ [<br>
+ AuthenticationType('TLS',<br>
+ 'tls',<br>
+ [<br>
+ AuthenticationParameter(<br>
+ 'eap',<br>
+ 'Authentication',<br>
+ SETTING_TYPE_LIST,<br>
+ [['TLS', 'tls']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'identity',<br>
+ 'Identity',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'client-cert',<br>
+ 'User certificate',<br>
+ SETTING_TYPE_CHOOSER,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'ca-cert',<br>
+ 'CA certificate',<br>
+ SETTING_TYPE_CHOOSER,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'private-key',<br>
+ 'Private key',<br>
+ SETTING_TYPE_CHOOSER,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'private-key-password',<br>
+ 'Private Key password',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ )<br>
+ ]<br>
+ ),<br>
+ AuthenticationType('LEAP',<br>
+ 'leap',<br>
+ [<br>
+ AuthenticationParameter(<br>
+ 'eap',<br>
+ 'Authentication',<br>
+ SETTING_TYPE_LIST,<br>
+ [['LEAP', 'leap']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'identity',<br>
+ 'Username',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'password',<br>
+ 'Password',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ )<br>
+ ]<br>
+ ),<br>
+ AuthenticationType('Tunnelled TLS',<br>
+ 'ttls',<br>
+ [<br>
+ AuthenticationParameter(<br>
+ 'eap',<br>
+ 'Authentication',<br>
+ SETTING_TYPE_LIST,<br>
+ [['Tunnelled TLS', 'ttls']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'anonymous-identity',<br>
+ 'Anonymous identity',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'ca-cert',<br>
+ 'CA certificate',<br>
+ SETTING_TYPE_CHOOSER,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'phase2-auth',<br>
+ 'Inner Authentication',<br>
+ SETTING_TYPE_STRING,<br>
+ [['PAP', 'pap'],<br>
+ ['MSCHAP', 'mschap'],<br>
+ ['MSCHAPv2', 'mschapv2'],<br>
+ ['CHAP', 'chap']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'identity',<br>
+ 'Username',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'password',<br>
+ 'Password',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ )<br>
+ ]<br>
+ ),<br>
+ AuthenticationType('Protected EAP (PEAP)',<br>
+ 'peap',<br>
+ [<br>
+ AuthenticationParameter(<br>
+ 'eap',<br>
+ 'Authentication',<br>
+ SETTING_TYPE_LIST,<br>
+ [['Protected EAP (PEAP)', 'peap']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'anonymous-identity',<br>
+ 'Anonymous identity',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'ca-cert',<br>
+ 'CA certificate',<br>
+ SETTING_TYPE_CHOOSER,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'phase1-peapver',<br>
+ 'PEAP version',<br>
+ SETTING_TYPE_STRING,<br>
+ [['Automatic', ''],<br>
+ ['Version 0', '0'],<br>
+ ['Version 1', '1']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'phase2-auth',<br>
+ 'Inner Authentication',<br>
+ SETTING_TYPE_STRING,<br>
+ [['MSCHAPv2', 'mschapv2'],<br>
+ ['MD5', 'md5'],<br>
+ ['GTC', 'gtc']]<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'identity',<br>
+ 'Username',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ ),<br>
+ AuthenticationParameter(<br>
+ 'password',<br>
+ 'Password',<br>
+ SETTING_TYPE_STRING,<br>
+ []<br>
+ )<br>
+ ]<br>
+ )<br>
+ ]<br>
+<br>
<br>
class WirelessNetworkView(EventPulsingIcon):<br>
def __init__(self, initial_ap):<br>
@@ -309,7 +496,7 @@ class WirelessNetworkView(EventPulsingIcon):<br>
group = self._add_ciphers_from_flags(self._rsn_flags, False)<br>
wireless_security = WirelessSecurity()<br>
wireless_security.key_mgmt = 'wpa-psk'<br>
- wireless_security.proto = 'rsn'<br>
+ wireless_security.proto = ['rsn']<br>
wireless_security.pairwise = pairwise<br>
wireless_security.group = group<br>
return wireless_security<br>
@@ -321,7 +508,31 @@ class WirelessNetworkView(EventPulsingIcon):<br>
group = self._add_ciphers_from_flags(self._wpa_flags, False)<br>
wireless_security = WirelessSecurity()<br>
wireless_security.key_mgmt = 'wpa-psk'<br>
- wireless_security.proto = 'wpa'<br>
+ wireless_security.proto = ['wpa']<br>
+ wireless_security.pairwise = pairwise<br>
+ wireless_security.group = group<br>
+ return wireless_security<br>
+<br>
+ if (self._rsn_flags & network.NM_802_11_AP_SEC_KEY_MGMT_802_1X) and \<br>
+ (self._device_caps & network.NM_WIFI_DEVICE_CAP_RSN):<br>
+ # WPA2 Enterprise<br>
+ pairwise = self._add_ciphers_from_flags(self._rsn_flags, True)<br>
+ group = self._add_ciphers_from_flags(self._rsn_flags, False)<br>
+ wireless_security = WirelessSecurity()<br>
+ wireless_security.key_mgmt = 'wpa-eap'<br>
+ wireless_security.proto = ['rsn']<br>
+ wireless_security.pairwise = pairwise<br>
+ wireless_security.group = group<br>
+ return wireless_security<br>
+<br>
+ if (self._wpa_flags & network.NM_802_11_AP_SEC_KEY_MGMT_802_1X) and \<br>
+ (self._device_caps & network.NM_WIFI_DEVICE_CAP_WPA):<br>
+ # WPA Enterprise<br>
+ pairwise = self._add_ciphers_from_flags(self._wpa_flags, True)<br>
+ group = self._add_ciphers_from_flags(self._wpa_flags, False)<br>
+ wireless_security = WirelessSecurity()<br>
+ wireless_security.key_mgmt = 'wpa-eap'<br>
+ wireless_security.proto = ['wpa']<br>
wireless_security.pairwise = pairwise<br>
wireless_security.group = group<br>
return wireless_security<br>
@@ -365,6 +576,34 @@ class WirelessNetworkView(EventPulsingIcon):<br>
if wireless_security is not None:<br>
settings.wireless.security = '802-11-wireless-security'<br>
<br>
+ # Take in the settings, if applicable.<br>
+ if (wireless_security is not None) and \<br>
+ ( (wireless_security.key_mgmt == 'ieee8021x') or \<br>
+ (wireless_security.key_mgmt == 'wpa-eap') ):<br>
+ keydialog.get_key_values(AUTHENTICATION_LIST,<br>
+ self.__add_and_activate_connection,<br>
+ settings)<br>
+ else:<br>
+ self.__add_and_activate_connection(settings)<br>
+<br>
+ def __add_and_activate_connection(self, settings, additional_settings=None):<br>
+ if additional_settings is not None:<br>
+ key_value_dict = {}<br>
+ auth_params_list = additional_settings._params_list<br>
+<br>
+ for auth_param in auth_params_list:<br>
+ key = auth_param._key_name<br>
+ value = auth_param._value<br>
+ logging.debug('key == %s', key)<br>
+ logging.debug('value == %s', value)<br>
+ if len(value) > 0:<br>
+ key_value_dict[key] = value<br>
+ else:<br>
+ logging.debug('Not setting empty value for key :'<br>
+ ' %s', key)<br>
+<br>
+ settings.wpa_eap_setting = key_value_dict<br>
+<br>
network.add_and_activate_connection(self._device, settings,<br>
self.get_first_ap().model)<br>
<br>
diff --git a/src/jarabe/journal/objectchooser.py b/src/jarabe/journal/objectchooser.py<br>
index d860b0d..45e72af 100644<br>
--- a/src/jarabe/journal/objectchooser.py<br>
+++ b/src/jarabe/journal/objectchooser.py<br>
@@ -16,15 +16,20 @@<br>
<br>
from gettext import gettext as _<br>
import logging<br>
+import os<br>
<br>
from gi.repository import GObject<br>
from gi.repository import Gtk<br>
from gi.repository import Gdk<br>
from gi.repository import Wnck<br>
<br>
+from sugar3 import env<br>
+<br>
from sugar3.graphics import style<br>
from sugar3.graphics.toolbutton import ToolButton<br>
<br>
+from sugar3.datastore import datastore<br>
+<br>
from jarabe.journal.listview import BaseListView<br>
from jarabe.journal.listmodel import ListModel<br>
from jarabe.journal.journaltoolbox import MainToolbox<br>
@@ -47,6 +52,7 @@ class ObjectChooser(Gtk.Window):<br>
self.set_border_width(style.LINE_WIDTH)<br>
<br>
self._selected_object_id = None<br>
+ self._callback = None<br>
<br>
self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)<br>
self.connect('visibility-notify-event',<br>
@@ -111,6 +117,15 @@ class ObjectChooser(Gtk.Window):<br>
self._selected_object_id = uid<br>
self.emit('response', Gtk.ResponseType.ACCEPT)<br>
<br>
+ if self._callback is not None:<br>
+ self._callback(self._selected_object_id)<br>
+<br>
+ def get_selected_object(self):<br>
+ if self._selected_object_id is None:<br>
+ return None<br>
+ else:<br>
+ return datastore.get(self._selected_object_id)<br>
+<br>
def __delete_event_cb(self, chooser, event):<br>
self.emit('response', Gtk.ResponseType.DELETE_EVENT)<br>
<br>
@@ -121,6 +136,8 @@ class ObjectChooser(Gtk.Window):<br>
<br>
def __close_button_clicked_cb(self, button):<br>
self.emit('response', Gtk.ResponseType.DELETE_EVENT)<br>
+ if self._callback is not None:<br>
+ self._callback(self._selected_object_id)<br>
<br>
def get_selected_object_id(self):<br>
return self._selected_object_id<br>
@@ -140,6 +157,9 @@ class ObjectChooser(Gtk.Window):<br>
def __clear_clicked_cb(self, list_view):<br>
self._toolbar.clear_query()<br>
<br>
+ def _set_callback(self, callback):<br>
+ self._callback = callback<br>
+<br>
<br>
class TitleBox(VolumesToolbar):<br>
__gtype_name__ = 'TitleBox'<br>
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py<br>
index 930ba13..95b294b 100644<br>
--- a/src/jarabe/model/network.py<br>
+++ b/src/jarabe/model/network.py<br>
@@ -492,6 +492,7 @@ class Settings(object):<br>
self.connection = ConnectionSettings()<br>
self.ip4_config = None<br>
self.wireless_security = None<br>
+ self.wpa_eap_setting = None<br>
<br>
if wireless_cfg is not None:<br>
self.wireless = wireless_cfg<br>
@@ -507,6 +508,8 @@ class Settings(object):<br>
self.wireless_security.get_dict()<br>
if self.ip4_config is not None:<br>
settings['ipv4'] = self.ip4_config.get_dict()<br>
+ if self.wpa_eap_setting is not None:<br>
+ settings['802-1x'] = self.wpa_eap_setting<br>
return settings<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
1.7.10.2<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br><font face="arial, sans-serif">Regards,<br><br>Ajay Garg</font><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><font face="arial, sans-serif">Dextrose Developer</font><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Activity Central: </span><a href="http://activitycentral.com/" style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)" target="_blank">http://activitycentral.com</a><br>