diff options
author | Niklas | 2011-10-24 16:05:51 +0200 |
---|---|---|
committer | Niklas | 2011-10-24 16:05:51 +0200 |
commit | 658ae710964c6d8f4c157cc36f42940563781d09 (patch) | |
tree | 1ac04228efb2af8ef088a119374422ddda806cbb | |
parent | manual conf shows now a no interfaces found message without any form fields. (diff) | |
download | fbgui-658ae710964c6d8f4c157cc36f42940563781d09.tar.gz fbgui-658ae710964c6d8f4c157cc36f42940563781d09.tar.xz fbgui-658ae710964c6d8f4c157cc36f42940563781d09.zip |
manual conf. onchange interface, present the already collected infos
-rw-r--r-- | src/html/js/networkDiscovery.js | 52 | ||||
-rw-r--r-- | src/ndgui.cpp | 6 | ||||
-rw-r--r-- | src/ndgui.h | 1 |
3 files changed, 55 insertions, 4 deletions
diff --git a/src/html/js/networkDiscovery.js b/src/html/js/networkDiscovery.js index 7f065d0..ec7fff6 100644 --- a/src/html/js/networkDiscovery.js +++ b/src/html/js/networkDiscovery.js @@ -9,6 +9,8 @@ var updateTips = function ( t ) { 500 ); }; + + var checkLength = function ( o, n, min, max ) { if ( o.val().length > max || o.val().length < min ) { o.addClass( "ui-state-error" ); @@ -20,6 +22,8 @@ var checkLength = function ( o, n, min, max ) { } }; + + var checkRegexp = function ( o, regexp, n ) { if ( !( regexp.test( o.val() ) ) ) { o.addClass( "ui-state-error" ); @@ -30,6 +34,8 @@ var checkRegexp = function ( o, regexp, n ) { } }; + + var showLog = function (t) { $("#nd_show_log_msg").html(t); //$("#nd_show_log_msg").attr('readonly','readonly'); @@ -40,14 +46,39 @@ var showLog = function (t) { }); }; + + +var getInterfaceConfOnChange = function (i) { + var n = i.options[i.selectedIndex].text; + var jsonObj = fbgui.getInterfaceConf(n); + if (!jQuery.isEmptyObject(jsonObj)) { + $("#ipaddr").val(jsonObj.ipaddr); + $("#netmask").val(jsonObj.netmask); + $("#broadcast").val(jsonObj.broadcast); + $("#gateway").val(jsonObj.gateway); + $("#dns").val(jsonObj.dns); + } + +}; + + + var getInterfaceConf = function (i) { - var n = i.options[i.selectedIndex].text(); + var jsonObj = fbgui.getInterfaceConf(i); + if (!jQuery.isEmptyObject(jsonObj)) { + $("#ipaddr").val(jsonObj.ipaddr); + $("#netmask").val(jsonObj.netmask); + $("#broadcast").val(jsonObj.broadcast); + $("#gateway").val(jsonObj.gateway); + $("#dns").val(jsonObj.dns); + } + }; var ip4_manualConfigurationDialog = function () { - var jsonArr = fbgui.getManualConfInterfaces(); + var jsonArr = "eth0";// fbgui.getManualConfInterfaces(); if(jsonArr == "") { var c = "<p>Have not found usable interfaces for manual configuration</p>"; $("#nd_manual_configuration_dialog").html(c); @@ -62,7 +93,7 @@ var ip4_manualConfigurationDialog = function () { }); } else { - var c = "<select name='nd_mc_ifname_select' id='nd_mc_ifname_select' onChange='getInterfaceConf(this)'>"; + var c = "<select name='nd_mc_ifname_select' id='nd_mc_ifname_select' onChange='getInterfaceConfOnChange(this)'>"; jQuery.each(jsonArr, function() { c += " <option>"+ this +"</option>"; } @@ -79,7 +110,8 @@ var ip4_manualConfigurationDialog = function () { dns = $("#dns"), allFields = $([]).add(ipaddr).add(netmask).add(broadcast).add(gateway).add(dns); - + getInterfaceConf(ifname); + $("#nd_manual_configuration_dialog").dialog( { buttons: { "Cancel": function() { $(this).dialog("close");}, @@ -126,6 +158,8 @@ var ip4_manualConfigurationDialog = function () { } }; + + var abortBootDialog = function (m) { fbgui.notifyCall("abortBootDialog"); $("#nd_abort_boot_msg").html(m); @@ -150,6 +184,8 @@ var abortBootDialog = function (m) { }); }; + + var chooseInterfaceDialog = function (i) { var cb = "<label> Choose your interface: </label>"+ "<select id='nd_ifName_select'>"; @@ -185,10 +221,14 @@ var chooseInterfaceDialog = function (i) { }); } + + var updateStatus = function (s){ }; + + var updateIfProgressBar = function (i, p){ if (p >= 0 && p <= 100){ $("#"+i+"_progress").progressbar({ value: p }); @@ -197,10 +237,14 @@ var updateIfProgressBar = function (i, p){ } }; + + var updateIfStatus = function(i, s){ $("#"+i+"_status").html(s); }; + + var addInterface = function (i){ $("#nd_progress_container").append( "<div class='interface'>"+ diff --git a/src/ndgui.cpp b/src/ndgui.cpp index 6e358b8..ecee5e8 100644 --- a/src/ndgui.cpp +++ b/src/ndgui.cpp @@ -255,6 +255,12 @@ QVariantList ndgui::getManualConfInterfaces() { } +/**/ +QVariantMap ndgui::getInterfaceConf(QString ifName) { + +} + + /** * takes the entered manual configuration dates and delivers it diff --git a/src/ndgui.h b/src/ndgui.h index f95e42d..d8adf63 100644 --- a/src/ndgui.h +++ b/src/ndgui.h @@ -23,6 +23,7 @@ public: Q_INVOKABLE QVariantList getManualConfInterfaces(); Q_INVOKABLE int ip4_setManualConfiguration(QVariantMap result); Q_INVOKABLE QString readLogFile(); + Q_INVOKABLE QVariantMap getInterfaceConf(QString ifName); public slots: void handleConnectionEstablished(QString ifName); |