Author: jreidinger Date: Tue Feb 24 13:34:06 2009 New Revision: 55714 URL: http://svn.opensuse.org/viewcvs/yast?rev=55714&view=rev Log: implement ui for add (use old, only better separate it allow editing device map also on running system Modified: branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/widgets_i386.ycp Modified: branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/widgets_i386.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/widgets_i386.ycp?rev=55714&r1=55713&r2=55714&view=diff ============================================================================== --- branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/widgets_i386.ycp (original) +++ branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/widgets_i386.ycp Tue Feb 24 13:34:06 2009 @@ -249,10 +249,37 @@ BootCommon::device_mapping = listmap (string d, result, { string indexs = tostring(index); index = index + 1; - return $[ d : sformat ("hd%1", indexs)]; + return $[ d : sformat ("hd%1", indexs)]; }); } +string NewDevicePopup(){ + term popup = `VBox (`VSpacing (1), + // textentry header + `InputField (`id (`devname), `opt (`hstretch), _("&Device")), + `VSpacing (1), + `HBox (`HStretch (), + `PushButton (`id (`ok), `opt (`key_F10, `default), + Label::OKButton ()), + `HStretch (), + `PushButton (`id (`cancel), `opt (`key_F8), + Label::CancelButton ()), + `HStretch () + ), + `VSpacing (1) + ); + UI::OpenDialog (popup); + symbol pushed = (symbol)UI::UserInput (); + string new_dev = (string) UI::QueryWidget (`id (`devname), `Value); + UI::CloseDialog (); + string ret = ""; + if (pushed == `ok){ + ret = new_dev; + } + return ret; +} + + symbol HandleDiskOrder( string widget, map event ){ any action = event["ID"]:nil; boolean changed = false; @@ -273,7 +300,7 @@ (list<term>) BootCommon::swapItems (disksOrder, pos, pos - 1); } else if (action == `down){ changed= true; - disksOrder = + disksOrder = (list<term>) BootCommon::swapItems (disksOrder, pos, pos + 1); } else if (action == `delete){ changed = true; @@ -282,7 +309,11 @@ (pos > 0) ? GetItemID(disksOrder[(pos-1)]:`Item(`id(""))) : GetItemID(disksOrder[0]:`Item(`id("")))); } else if (action == `add) { - //TODO + string new_dev = NewDevicePopup(); + if (new_dev != ""){ + changed = true; + disksOrder = add(disksOrder, `item(`id(new_dev),new_dev)); + } } if (changed){ @@ -295,16 +326,14 @@ `VSpacing (1), `SelectionBox (`id (`disks), `opt (`notify, `immediate),_("D&isks"), []), - (Mode::config () || Mode::installation()) - ? `HBox ( + `HBox( `HStretch (), `PushButton (`id (`add), `opt (`key_F3), Label::AddButton ()), `PushButton (`id (`delete), `opt(`key_F5), Label::DeleteButton ()), `HStretch () - ) - : `HBox (), + ), `VSpacing (1) ), `HSquash ( -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org