Author: aschnell Date: Thu Oct 23 12:37:31 2008 New Revision: 52456 URL: http://svn.opensuse.org/viewcvs/yast?rev=52456&view=rev Log: - allow ommission of 'B' in size input fields (bnc #437914) Modified: trunk/storage/libstorage/src/AppUtil.cc trunk/storage/libstorage/src/StorageInterface.h trunk/storage/package/yast2-storage.changes Modified: trunk/storage/libstorage/src/AppUtil.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.cc?rev=52456&r1=52455&r2=52456&view=diff ============================================================================== --- trunk/storage/libstorage/src/AppUtil.cc (original) +++ trunk/storage/libstorage/src/AppUtil.cc Thu Oct 23 12:37:31 2008 @@ -522,33 +522,56 @@ string -getSuffix(int i, bool classic) +getSuffix(int i, bool classic, bool sloppy = false) { switch (i) { case 0: - /* Byte abbreviated */ - return classic ? "B" : _("B"); + if (sloppy) + return ""; + else + /* Byte abbreviated */ + return classic ? "B" : _("B"); case 1: - /* KiloByte abbreviated */ - return classic ? "kB" : _("kB"); + if (sloppy) + /* Kilo abbreviated */ + return classic ? "k" : _("k"); + else + /* KiloByte abbreviated */ + return classic ? "kB" : _("kB"); case 2: - /* MegaByte abbreviated */ - return classic ? "MB" : _("MB"); + if (sloppy) + /* Mega abbreviated */ + return classic ? "M" : _("M"); + else + /* MegaByte abbreviated */ + return classic ? "MB" : _("MB"); case 3: - /* GigaByte abbreviated */ - return classic ? "GB" : _("GB"); + if (sloppy) + /* Giga abbreviated */ + return classic ? "G" : _("G"); + else + /* GigaByte abbreviated */ + return classic ? "GB" : _("GB"); case 4: - /* TeraByte abbreviated */ - return classic ? "TB" : _("TB"); + if (sloppy) + /* Tera abbreviated */ + return classic ? "T" : _("T"); + else + /* TeraByte abbreviated */ + return classic ? "TB" : _("TB"); case 5: - /* PetaByte abbreviated */ - return classic ? "PB" : _("PB"); + if (sloppy) + /* Peta abbreviated */ + return classic ? "P" : _("P"); + else + /* PetaByte abbreviated */ + return classic ? "PB" : _("PB"); } return string("error"); @@ -595,17 +618,30 @@ double f; string suffix; - s >> f >> suffix; + s >> f; + if (!s.eof()) s >> suffix; if (s.fail() || !s.eof() || f < 0.0) return false; for(int i = 0; i < numSuffixes(); i++) { - if (boost::equals(suffix, getSuffix(i, classic), boost::is_iequal(loc))) + if (classic) { - size = f; - return true; + if (boost::equals(suffix, getSuffix(i, true), boost::is_equal())) + { + size = f; + return true; + } + } + else + { + if (boost::equals(suffix, getSuffix(i, false, false), boost::is_iequal(loc)) || + boost::equals(suffix, getSuffix(i, false, true), boost::is_iequal(loc))) + { + size = f; + return true; + } } f *= 1024.0; Modified: trunk/storage/libstorage/src/StorageInterface.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=52456&r1=52455&r2=52456&view=diff ============================================================================== --- trunk/storage/libstorage/src/StorageInterface.h (original) +++ trunk/storage/libstorage/src/StorageInterface.h Thu Oct 23 12:37:31 2008 @@ -2121,6 +2121,9 @@ * @param classic use classic locale * @param size size in bytes * @return true on successful conversion + * + * With classic set to false the conversion is also case-insensitive + * and sloppy concerning omission of 'B'. */ virtual bool humanStringToByte(const string& str, bool classic, unsigned long long& size) const = 0; Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=52456&r1=52455&r2=52456&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Thu Oct 23 12:37:31 2008 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Oct 23 12:35:19 CEST 2008 - aschnell@suse.de + +- allow ommission of 'B' in size input fields (bnc #437914) + +------------------------------------------------------------------- Wed Oct 22 12:12:27 CEST 2008 - aschnell@suse.de - initialize file system combobox correctly (bnc #428141) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org