From 8f0cba5cb83e8529316db147ccfaf3438fed59cb Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Fri, 2 Aug 2013 02:26:38 -0500
Subject: [PATCH 4/4] eap: Add initial option to dialog
---
wpa_supplicant/WirelessConfigDialog.cpp | 33 ++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/wpa_supplicant/WirelessConfigDialog.cpp b/wpa_supplicant/WirelessConfigDialog.cpp
index 6fdad6a..8c78f2e 100644
a
|
b
|
public:
|
38 | 38 | WirelessConfigView() |
39 | 39 | : |
40 | 40 | BView("WirelessConfigView", B_WILL_DRAW), |
| 41 | fUsername(NULL), |
41 | 42 | fPassword(NULL) |
42 | 43 | { |
43 | 44 | SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); |
… |
… |
public:
|
78 | 79 | authMenu->AddItem(fAuthWEP); |
79 | 80 | fAuthWPA = new(std::nothrow) BMenuItem("WPA/WPA2", NULL); |
80 | 81 | authMenu->AddItem(fAuthWPA); |
| 82 | fAuthWPAEAP = new(std::nothrow) BMenuItem("WPA/WPA2 Enterprise", NULL); |
| 83 | authMenu->AddItem(fAuthWPAEAP); |
81 | 84 | |
82 | 85 | BMenuField* authMenuField = new(std::nothrow) BMenuField( |
83 | 86 | "Authentication:", authMenu); |
… |
… |
public:
|
87 | 90 | layout->AddItem(authMenuField->CreateLabelLayoutItem(), 0, row); |
88 | 91 | layout->AddItem(authMenuField->CreateMenuBarLayoutItem(), 1, row++); |
89 | 92 | |
| 93 | fUsername = new(std::nothrow) BTextControl("Username:", "", NULL); |
| 94 | if (fUsername == NULL) |
| 95 | return; |
| 96 | |
| 97 | BLayoutItem* usernameItem = fUsername->CreateTextViewLayoutItem(); |
| 98 | layout->AddItem(fUsername->CreateLabelLayoutItem(), 0, row); |
| 99 | layout->AddItem(usernameItem, 1, row++); |
| 100 | |
90 | 101 | fPassword = new(std::nothrow) BTextControl("Password:", "", NULL); |
91 | 102 | if (fPassword == NULL) |
92 | 103 | return; |
93 | 104 | |
94 | | BLayoutItem* layoutItem = fPassword->CreateTextViewLayoutItem(); |
95 | | layoutItem->SetExplicitMinSize(BSize(fPassword->StringWidth( |
| 105 | BLayoutItem* passwordItem = fPassword->CreateTextViewLayoutItem(); |
| 106 | passwordItem->SetExplicitMinSize(BSize(fPassword->StringWidth( |
96 | 107 | "0123456789012345678901234567890123456789") + inset, |
97 | 108 | B_SIZE_UNSET)); |
98 | 109 | |
99 | 110 | layout->AddItem(fPassword->CreateLabelLayoutItem(), 0, row); |
100 | | layout->AddItem(layoutItem, 1, row++); |
| 111 | layout->AddItem(passwordItem, 1, row++); |
101 | 112 | |
102 | 113 | fPersist = new(std::nothrow) BCheckBox("Store this configuration"); |
103 | 114 | layout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, row); |
… |
… |
public:
|
152 | 163 | case B_NETWORK_AUTHENTICATION_WPA2: |
153 | 164 | fAuthWPA->SetMarked(true); |
154 | 165 | break; |
| 166 | case B_NETWORK_AUTHENTICATION_EAP: |
| 167 | fAuthWPAEAP->SetMarked(true); |
| 168 | BString username; |
| 169 | if (message.FindString("username", &username) |
| 170 | == B_OK) { |
| 171 | fUsername->SetText(username); |
| 172 | } |
| 173 | fUsername->SetText(username); |
| 174 | break; |
155 | 175 | } |
156 | 176 | |
157 | 177 | BString password; |
… |
… |
public:
|
170 | 190 | authMode = B_NETWORK_AUTHENTICATION_WEP; |
171 | 191 | else if (fAuthWPA->IsMarked()) |
172 | 192 | authMode = B_NETWORK_AUTHENTICATION_WPA; |
| 193 | else if (fAuthWPAEAP->IsMarked()) { |
| 194 | authMode = B_NETWORK_AUTHENTICATION_EAP; |
| 195 | message.RemoveName("username"); |
| 196 | message.AddString("username", fUsername->Text()); |
| 197 | } |
173 | 198 | |
174 | 199 | message.RemoveName("authentication"); |
175 | 200 | message.AddUInt32("authentication", authMode); |
… |
… |
private:
|
186 | 211 | BMenuItem* fAuthOpen; |
187 | 212 | BMenuItem* fAuthWEP; |
188 | 213 | BMenuItem* fAuthWPA; |
| 214 | BMenuItem* fAuthWPAEAP; |
| 215 | BTextControl* fUsername; |
189 | 216 | BTextControl* fPassword; |
190 | 217 | BCheckBox* fPersist; |
191 | 218 | BButton* fCancelButton; |