Author: aschnell Date: Wed Jun 25 15:13:43 2008 New Revision: 48532 URL: http://svn.opensuse.org/viewcvs/yast?rev=48532&view=rev Log: - better checks for pe size Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp?rev=48532&r1=48531&r2=48532&view=diff ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp Wed Jun 25 15:13:43 2008 @@ -8,6 +8,21 @@ textdomain "storage"; + boolean CheckPeSize(integer pe_size) + { + if (!Integer::IsPowerOfTwo(pe_size) || pe_size < 1024) + { + Error(_("The data entered is invalid. Insert a physical extent size larger than 1kB +in powers of 2, for example, \"512kB\" or \"4MB\"")); + return false; + } + else + { + return true; + } + } + + boolean CheckNumberOfDevicesForVg(integer num) { if (num < 1) @@ -71,7 +86,7 @@ any tmp = UI::QueryWidget(`id("pesize"), `Value); if (is(tmp, string)) - pesize = pesize_str_to_byte((string) tmp); + pesize = kmgt_str_to_byte((string) tmp); else pesize = (integer) tmp; @@ -81,17 +96,8 @@ // TODO: checks - if (pesize == 0) - { - // error popup text - Popup::Error(_("The data entered is invalid. -Insert a physical extent size from 8kB to 512MB -in powers of 2, for example, \"4MB\" or \"512kB\" -")); - widget = `again; - } - - if (!CheckNumberOfDevicesForVg(size(pvs))) + if (!CheckPeSize(pesize) || + !CheckNumberOfDevicesForVg(size(pvs))) widget = `again; } break; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org