[PATCH 2/2 master] Add dialog for wireless config (ssid and wepkey) in stage 1 (#473803)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 loader/net.c |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 loader/net.h |    1 +
 2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/loader/net.c b/loader/net.c
index 19bb8be..efb5b4e 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -459,6 +459,14 @@ int readNetConfig(char * device, iface_t * iface,
     opts.ipv6Choice = 0;
 #endif
 
+    if (isWirelessDevice(iface->device) &&
+        (iface->ssid == NULL || iface->wepkey == NULL)) {
+        ret = wirelessConfig(device, iface);
+        if (ret == LOADER_BACK) {
+            return LOADER_BACK;
+        }
+    }
+
     /* JKFIXME: we really need a way to override this and be able to change
      * our network config */
     if (!FL_ASKNETWORK(flags) &&
@@ -746,6 +754,73 @@ int configureTCPIP(char * device, iface_t * iface,
     return ret;
 }
 
+int wirelessConfig(char * device, iface_t * iface) {
+    int ret;
+    char *buf = NULL;
+    newtComponent f, okay, back, answer, ssidEntry, wepkeyEntry;
+    newtGrid egrid = NULL;
+    newtGrid buttons, grid;
+    newtComponent text = NULL;
+
+    const char *ssid;
+    const char *wepkey;
+
+    egrid = newtCreateGrid(2, 2);
+
+    ssidEntry = newtEntry(-1, -1, iface->ssid, 41, &ssid, 0);
+    wepkeyEntry = newtEntry(-1, -1, iface->wepkey, 41, &wepkey, 0);
+
+    newtGridSetField(egrid, 0, 0, NEWT_GRID_COMPONENT,
+                     newtLabel(-1, -1, _("SSID:")),
+                     0, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
+    newtGridSetField(egrid, 1, 0, NEWT_GRID_COMPONENT,
+                     ssidEntry, 1, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
+
+    newtGridSetField(egrid, 0, 1, NEWT_GRID_COMPONENT,
+                     newtLabel(-1, -1, _("WEP key:")),
+                     0, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
+    newtGridSetField(egrid, 1, 1, NEWT_GRID_COMPONENT,
+                     wepkeyEntry, 1, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
+
+    /* button bar at the bottom of the window */
+    buttons = newtButtonBar(_("OK"), &okay, _("Back"), &back, NULL);
+
+    /* main window layout */
+    grid = newtCreateGrid(1, 3);
+
+    checked_asprintf(&buf, _("Enter SSID and WEP key of your wireless access point"));
+
+    text = newtTextboxReflowed(-1, -1, buf, 52, 0, 10, 0);
+
+    newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, text,
+                     0, 0, 0, 1, NEWT_ANCHOR_LEFT, 0);
+    newtGridSetField(grid, 0, 1, NEWT_GRID_SUBGRID, egrid,
+                     0, 0, 0, 1, NEWT_ANCHOR_LEFT, 0);
+    newtGridSetField(grid, 0, 2, NEWT_GRID_SUBGRID, buttons,
+                     0, 0, 0, 0, 0, NEWT_GRID_FLAG_GROWX);
+
+    f = newtForm(NULL, NULL, 0);
+    newtGridAddComponentsToForm(grid, f, 1);
+    newtGridWrappedWindow(grid, _("Wireless Configuration"));
+    newtGridFree(grid, 1);
+
+    answer = newtRunForm(f);
+
+    if (answer == back) {
+        ret = LOADER_BACK;
+    } else {
+        iface->ssid = strdup(ssid);
+        iface->wepkey = strdup(wepkey);
+        ret = LOADER_OK;
+    }
+
+    free(buf);
+    newtFormDestroy(f);
+    newtPopWindow();
+
+    return ret;
+}
+
 int manualNetConfig(char * device, iface_t * iface,
                     struct intfconfig_s * ipcomps, struct netconfopts * opts) {
     int i, rows, pos, cidr, have[2], stack[2];
diff --git a/loader/net.h b/loader/net.h
index a494630..7fdff91 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -61,6 +61,7 @@ int configureTCPIP(char * device, iface_t * iface, struct netconfopts * opts,
                    int methodNum);
 int manualNetConfig(char * device, iface_t * iface,
                     struct intfconfig_s * ipcomps, struct netconfopts * opts);
+int wirelessConfig(char * device, iface_t * iface);
 void debugNetworkInfo(iface_t * iface);
 int writeDisabledNetInfo(void);
 int writeEnabledNetInfo(iface_t * iface);
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux