Author: kmachalkova Date: Wed Apr 9 10:50:26 2008 New Revision: 46271 URL: http://svn.opensuse.org/viewcvs/yast?rev=46271&view=rev Log: Improved resize partition dialog Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp Wed Apr 9 10:50:26 2008 @@ -108,6 +108,7 @@ integer vg_min_free = 0; integer total_free = lv_free + vg_free; + integer total = lv_used + total_free; // Unit for partition resizing - currently Megabytes string unit = _("MB"); @@ -144,45 +145,60 @@ field_label_vg_free = sformat(_("VG Free (%1)"), unit); } - if (UI::HasSpecialWidget(`PartitionSplitter)) + term content = `Empty(); + + if (UI::HasSpecialWidget(`BarGraph) && + UI::HasSpecialWidget(`Slider)) { - UI::OpenDialog( - `VBox( - `Left(`Heading(heading)), - `HSpacing(60), - `PartitionSplitter(lv_used, total_free, vg_free, vg_min_free, lv_min_free, - bargraph_label_lv_used, bargraph_label_lv_free, - bargraph_label_vg_free, field_label_lv_free, - field_label_vg_free), - `HBox( - `HStretch(), - `PushButton(`id(`cancel), Label::CancelButton()), - `PushButton(`id(`ok), `opt(`default), Label::OKButton()) - ) - ) - ); + content = `VBox( + `BarGraph(`id(`graph), `opt(`vstretch), [lv_used, total_free] ), + `Slider(`id(`new_size), `opt(`notify), sformat(_("New Size (in %1)"), unit), vg_min_free, + (lv_used + total_free - lv_min_free), lv_used ) + ); } else { - UI::OpenDialog( - `VBox( - `Left(`Heading(heading)), - `HSpacing(30), - // Label for input field of partition size in non-graphical mode - // "%1" will be replaced with the current unit (MB). - `IntField(`id(`new_size), sformat(_("New Size (%1)"), unit), + content = `Frame("", + `IntField(`id(`new_size), `opt(`notify), sformat(_("New Size (in %1)"), unit), lv_used + lv_min_free, lv_used + lv_free + vg_free, - lv_used + lv_free), - `HBox( - `HStretch(), - `PushButton(`id(`cancel), Label::CancelButton()), - `PushButton(`id(`ok), `opt(`default), Label::OKButton()) - ) - ) - ); + lv_used + lv_free) + ); } - any widget = UI::UserInput(); + UI::OpenDialog( + `VBox( + `Left(`Heading(heading)), + `HSpacing(60), + content, + `Left(`Label( `id(`free), sformat(_("Free Space Remaining: %1 MB"), total_free ))), + `VSpacing(1.0), + `Left(`Label( sformat(_("Minimum Partition Size: %1 MB"), lv_min_free ))), + `Left(`Label( sformat(_("Maximum Partition Size: %1 MB"), total ))), + //`PartitionSplitter(lv_used, total_free, vg_free, vg_min_free, lv_min_free, + // bargraph_label_lv_used, bargraph_label_lv_free, + // bargraph_label_vg_free, field_label_lv_free, + // field_label_vg_free), + `HBox( + `HStretch(), + `PushButton(`id(`cancel), Label::CancelButton()), + `PushButton(`id(`ok), `opt(`default), Label::OKButton()) + ) + ) + ); + + any widget = nil; + do { + widget = UI::UserInput(); + + if (widget == `new_size) + { + integer new_size = (integer) UI::QueryWidget(`id(`new_size), `Value); + integer new_free = total - new_size; + UI::ChangeWidget(`id(`graph), `Values, [ new_size, new_free ]); + UI::ChangeWidget(`id(`free), `Value, sformat(_("Free Space Remaining: %1 MB"), (new_free))); + } + + } while ( widget != `cancel && widget != `ok); UI::CloseDialog(); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org