Author: aschnell Date: Tue Jul 15 10:13:23 2008 New Revision: 49086 URL: http://svn.opensuse.org/viewcvs/yast?rev=49086&view=rev Log: - work on partition size dialog Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp?rev=49086&r1=49085&r2=49086&view=diff ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp Tue Jul 15 10:13:23 2008 @@ -69,8 +69,6 @@ data["fsid"] = Partitions::fsid_extended_win; data["used_fs"] = `unknown; } - - Debug("data", data); } y2milestone("MiniWorkflowStepPartitionType data:%1 ret:%2", data, widget); @@ -83,17 +81,23 @@ { y2milestone("MiniWorkflowStepPartitionSize data:%1", data); - list slot = data["slots", data["type"]:`unknown]:[]; - integer max_size = slot[1]:0 * data["cyl_size"]:0; + integer cyl_size = data["cyl_size"]:0; + list<integer> slot = data["slots", data["type"]:`unknown]:[]; + + list<integer> region = data["region"]:slot; + integer size_k = (region[1]:0 * cyl_size) / 1024; - string tmp = Storage::ByteToHumanString(max_size); + integer min_size_k = tointeger(float::ceil(cyl_size / 1024.0)); + integer max_size_k = (slot[1]:0 * cyl_size) / 1024; + + symbol what = (region == slot) ? `max_size : `manual_size; term contents = `HVSquash( `Frame(_("Size"), `RadioButtonGroup(`id(`size), `VBox( `LeftRadioButton(`id(`max_size), `opt(`notify), - sformat(_("Maximum Size (%1)"), tmp)), + sformat(_("Maximum Size (%1)"), Storage::KByteToHumanString(max_size_k))), `LeftRadioButtonWithAttachment(`id(`manual_size), `opt(`notify), _("Manual Size"), `VBox(`id(`manual_size_attachment), `MinWidth(15, `InputField(`id(`size_input), `opt(`shrinkable), _("Size"))) @@ -102,10 +106,13 @@ ) ))); - MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help"); - + MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "TODO help"); MiniWorkflow::SetLastStep(data["type"]:`unknown == `extended); + UI::ChangeWidget(`id(`size), `Value, what); + UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, what == `manual_size); + UI::ChangeWidget(`id(`size_input), `Value, Storage::KByteToHumanString(size_k)); + symbol widget = nil; repeat @@ -121,6 +128,28 @@ case `manual_size: UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, true); break; + + case `next: + what = (symbol) UI::QueryWidget(`id(`size), `Value); + + if (what == `manual_size) + { + string tmp = (string) UI::QueryWidget(`id(`size_input), `Value); + if (!Storage::HumanStringToKByte(tmp, size_k)) + { + Error(_("The size entered is invalid. Enter a value like \"500MB\" or \"1GB\".")); + widget = `again; + } + else if (size_k < min_size_k || size_k > max_size_k) + { + Error(sformat(_("The size entered is invalid. Enter a size beteen %1 and %2."), + Storage::KByteToHumanString(min_size_k), + Storage::KByteToHumanString(max_size_k))); + widget = `again; + } + } + + break; } } until (widget == `abort || widget == `back || widget == `next); @@ -137,14 +166,7 @@ case `manual_size: { - // TODO - string s = (string) UI::QueryWidget(`id(`size_input), `Value); - - integer i = 0; - Storage::HumanStringToByte(s, i); - // integer i = Storage::KmgtStrToByte(s); - - integer num_cyl = tointeger(float::ceil(tofloat(i) / tofloat(data["cyl_size"]:42))); + integer num_cyl = tointeger(float::ceil(tofloat(size_k*1024) / tofloat(cyl_size))); data["region"] = [ slot[0]:0, num_cyl ]; break; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org