[yast-commit] r40780 - in /trunk/network: VERSION package/yast2-network.changes src/lan/address.ycp src/lan/complex.ycp src/lan/hardware.ycp src/lan/wizards.ycp src/modules/LanItems.ycp
Author: mzugec Date: Thu Sep 6 14:14:17 2007 New Revision: 40780 URL: http://svn.opensuse.org/viewcvs/yast?rev=40780&view=rev Log: for `abort in network dialogs use LanItems::Rollback (#307779) workflow for add/edit card can be aborted (#307778) Modified: trunk/network/VERSION trunk/network/package/yast2-network.changes trunk/network/src/lan/address.ycp trunk/network/src/lan/complex.ycp trunk/network/src/lan/hardware.ycp trunk/network/src/lan/wizards.ycp trunk/network/src/modules/LanItems.ycp Modified: trunk/network/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/VERSION (original) +++ trunk/network/VERSION Thu Sep 6 14:14:17 2007 @@ -1 +1 @@ -2.15.73 +2.15.74 Modified: trunk/network/package/yast2-network.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.changes?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/package/yast2-network.changes (original) +++ trunk/network/package/yast2-network.changes Thu Sep 6 14:14:17 2007 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Sep 6 14:05:18 CEST 2007 - mzugec@suse.cz + +- for `abort in network dialogs use LanItems::Rollback (#307779) +- workflow for add/edit card can be aborted (#307778) +- 2.15.74 + +------------------------------------------------------------------- Wed Sep 5 14:23:30 CEST 2007 - kmachalkova@suse.cz - Proxy testsuite adjusted to correct .curlrc syntax (#305163 related) Modified: trunk/network/src/lan/address.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/address.ycp?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/src/lan/address.ycp (original) +++ trunk/network/src/lan/address.ycp Thu Sep 6 14:14:17 2007 @@ -792,7 +792,7 @@ "validate_type": `function, "validate_function": ValidateDialog, "store" : StoreAddrWidget, - `abort : ReallyAbort, + `abort : LanItems::Rollback, ]; @@ -861,11 +861,17 @@ /* Address dialog caption */ "caption": _("Network Card Setup"), "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), "next_button" : Label::NextButton (), "fallback_functions" : functions, ]); + Wizard::RestoreAbortButton(); + if (LanItems::operation!=`add) Wizard::DisableBackButton (); + y2milestone ("ShowAndRun: %1", ret); + if (ret==`abort) LanItems::Rollback(); + if (ret != `back && ret != `abort) { string ifcfgname = NetworkDevices::device_name ( Modified: trunk/network/src/lan/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/complex.ycp?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/src/lan/complex.ycp (original) +++ trunk/network/src/lan/complex.ycp Thu Sep 6 14:14:17 2007 @@ -136,6 +136,7 @@ LanItems::SelectHWMap(LanItems::getCurrentItem()["hwinfo"]:$[]); LanItems::Items[LanItems::current, "ifcfg"] = LanItems::getCurrentItem()["hwinfo", "dev_name"]:""; + LanItems::Items[LanItems::current, "commited"] = false; LanItems::operation = `edit; // LanItems::SetDefaultsForHW (); @@ -460,7 +461,6 @@ Wizard::DisableBackButton(); symbol ret = CWM::Run(w, $[`abort:ReallyAbort ]); - return ret; } Modified: trunk/network/src/lan/hardware.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/hardware.ycp?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/src/lan/hardware.ycp (original) +++ trunk/network/src/lan/hardware.ycp Thu Sep 6 14:14:17 2007 @@ -346,9 +346,11 @@ symbol handleHW (string key, map event) { + if (event["ID"]:nil==`cancel) LanItems::Rollback(); symbol ret=nil; if (event["EventReason"]:"" == "ValueChanged" || event["EventReason"]:"" == "Activated") ret = (symbol)event["WidgetID"]:nil; if (ret == `list) SelectionDialog(); +// if (ret == `abort) LanItems::Rollback(); if(ret == `pcmcia || ret == `usb || ret == `dev) { @@ -439,15 +441,13 @@ LanItems::type = (string) UI::QueryWidget(`id(`dev), `Value); string nm = (string) UI::QueryWidget(`id(`num), `Value); string name=NetworkDevices::device_name(LanItems::type, nm); -// if( hardware["device"]:"" != LanItems::device ) { if(contains(NetworkDevices::List(""), name)) { Popup::Error(sformat(_("Configuration name %1 (%2) already exists. Choose a different one."), nm, NetworkDevices::device_name(hardware["type"]:"", nm))); UI::SetFocus(`id(`num)); } -// } NetworkDevices::Name = name; - LanItems::Items[LanItems::current]= $["ifcfg":name]; + LanItems::Items[LanItems::current, "ifcfg"]= name; } LanItems::setDriver((string) UI::QueryWidget(`modul, `Value)); @@ -770,8 +770,15 @@ string help = CWM::MergeHelps(w); contents = CWM::PrepareDialog(contents, w); - Wizard::SetContentsButtons(caption, contents, "",Label::BackButton(), Label::NextButton()); - return CWM::Run(w, $[`abort:ReallyAbort ]); + + Wizard::OpenNextBackDialog(); + Wizard::SetContents(caption, contents, "",false, true); + Wizard::SetAbortButton(`cancel, Label::CancelButton()); +// Wizard::DisableBackButton(); + any ret = CWM::Run(w, $[ /*`abort:ReallyAbort*/ ]); + Wizard::CloseDialog(); +// Wizard::RestoreAbortButton(); + return ret; } Modified: trunk/network/src/lan/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/wizards.ycp?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/src/lan/wizards.ycp (original) +++ trunk/network/src/lan/wizards.ycp Thu Sep 6 14:14:17 2007 @@ -162,11 +162,11 @@ map sequence = $[ "ws_start" : ws_start, "hardware" : $[ - `abort : `abort, + `abort : `back, `next : "address", ], "address" : $[ - `abort : `abort, + `abort : `back, `next : `next, ], "s390" : $[ Modified: trunk/network/src/modules/LanItems.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp?rev=40780&r1=40779&r2=40780&view=diff ============================================================================== --- trunk/network/src/modules/LanItems.ycp (original) +++ trunk/network/src/modules/LanItems.ycp Thu Sep 6 14:14:17 2007 @@ -147,7 +147,7 @@ if (hasAnyValue(Items[key, "udev", "driver"]:"")) udev_drivers_rules[Items[key, "udev", "driver"]:""] = [ sformat("ENV{MODALIAS}==\"%1\"", Items[key, "hwinfo", "modalias"]:""), sformat("ENV{MODALIAS}=\"%1\"", Items[key, "udev", "driver"]:"") ]; }); -y2internal("%1", udev_drivers_rules); + y2milestone("write udev rules: %1", udev_drivers_rules); SCR::Write(.udev_persistent.drivers, udev_drivers_rules); } @@ -184,6 +184,7 @@ global void AddNew(){ current = size(Items); + Items[current] = $["commited":false]; operation = `add; } @@ -219,16 +220,24 @@ global void ReadNetworkModules(){ } +// get list of all configurations for "netcard" macro in NetworkDevices module +list<string> getNetworkDevices(){ + list<string> confs=[]; + map <string, any> configurations = NetworkDevices::FilterDevices("netcard"); + foreach(string devtype, splitstring(NetworkDevices::CardRegex["netcard"]:"", "|"), { + foreach(string devnum, (list<string>) Map::Keys(configurations[devtype]:$[]), { + confs = add(confs, NetworkDevices::device_name(devtype, devnum)); + }); + }); + return confs; +} + global void ReadNetworkInterfaces(){ NetworkDevices::Read(); NetworkDevices::CleanHotplugSymlink(); // match configurations to Items list with hwinfo - map <string, any> configurations = NetworkDevices::FilterDevices("netcard"); - foreach(string devtype, splitstring(NetworkDevices::CardRegex["netcard"]:"", "|"), { - foreach(string devnum, (list<string>) Map::Keys(configurations[devtype]:$[]), { - string confname = NetworkDevices::device_name(devtype, devnum); - + foreach(string confname, getNetworkDevices(), { integer pos = nil; map<string, any> val = $[]; foreach(integer key, map<string, any> value, (map<integer, map<string, any> >)Items, { @@ -243,28 +252,21 @@ } Items[pos, "ifcfg"] = confname; }); - }); // add to Items also virtual devices (configurations) without hwinfo - - foreach(string devtype, splitstring(NetworkDevices::CardRegex["netcard"]:"", "|"), { - foreach(string devnum, (list<string>) Map::Keys(configurations[devtype]:$[]), { - -// foreach(string dev_name, map tmp_map, NetworkDevices::FilterDevices("netcard"), { -// foreach(string dev_num, (list<string>)Map::Keys(tmp_map), { + foreach(string confname, getNetworkDevices(), { boolean already = false; foreach(integer key, (list<integer>)Map::Keys(Items), { - if (NetworkDevices::device_name(devtype, devnum) == Items[key, "ifcfg"]:""){ + if (confname == Items[key, "ifcfg"]:""){ already = true; break; }; }); if (!already){ AddNew(); - Items[current] = $["ifcfg":NetworkDevices::device_name(devtype, devnum)]; + Items[current] = $["ifcfg":confname]; } }); - }); y2milestone("Read Configuration LanItems::Items %1", Items); } @@ -566,7 +568,7 @@ * must be in sync with @ref GetDefaultsForHW */ global define void SetDefaultsForHW () { -y2internal("SetDefaultsForHW type %1", type); + y2milestone("SetDefaultsForHW type %1", type); if (type == "wlan") { usercontrol = true; @@ -1055,6 +1057,19 @@ return true; } +global boolean Rollback(){ + if(getCurrentItem()["commited"]:true==false){ + y2milestone("rollback item %1", current); + if (!(size(getCurrentItem()["hwinfo"]:$[])>0)) Items = remove(Items, current); + else{ + if (haskey(Items[current]:$[], "ifcfg")) + if (!contains(getNetworkDevices(), getCurrentItem()["ifcfg"]:"")) + Items[current]=remove(Items[current]:$[], "ifcfg"); + } + }; + return true; +} + /** * Get the module configuration for the modules configured in the * interface section @@ -1236,7 +1251,7 @@ } global void DeleteItem(){ - y2internal("deleting ... %1", Items[current]:$[]); + y2milestone("deleting ... %1", Items[current]:$[]); string ifcfg = Items[current, "ifcfg"]:""; string hwcfg = Items[current, "hwcfg"]:""; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
mzugec@svn.opensuse.org