https://bugs.kde.org/show_bug.cgi?id=466257

--- Comment #1 from Stefano Crocco <stefano.cro...@alice.it> ---
(In reply to Karl Ove Hufthammer from comment #0)
> I took a look at the source code in
> konqueor/settings/konqhtml/cache/cache.cpp, and the following two lines look
> wrong to me:
> 
> In void Cache::load():
>     //Ensure that maxSizeInMB is greater than 0 if maxSizeInBytes is not 0
>     int maxSizeInMB = maxSizeInBytes == 0 ? 0 : std::max(1, maxSizeInBytes /
> 1000);
> 
> In void Cache::save():
>     //We store the size in bytes, not in MB
>     grp.writeEntry("MaximumCacheSize", m_ui->cacheSize->value()*1000);
> 
> If you divide the number of bytes by 1000, you get kB, *not* MB. Similarly,
> if you multiply an MB value by 1000, you get the number of kB, not the
> number of bytes.
> 
> In the UI (cache.ui), the suffix is set to ‘ MB’. So either the calculation
> should be changed to divide/multiply by 1000^2, or the UI string should be
> changed to ‘ kB’, or, preferably, to use the correct KFormat feature for
> proper formatting
> (https://api.kde.org/frameworks/kcoreaddons/html/classKFormat.html).

Thanks for pointing this out. The conversion factor is clearly wrong and I'll
fix it immediately. I'm not sure, instead, about using KFormat here. As far as
I can see, KFormat only returns a string representation of the number converted
to the appropriate unit, but this won't be useful here, as I need to put the
value inside a QSpinBox, which only accepts numbers. Of course I could use
KFormat to convert a dummy value, then extract the unit from the string, but
I'm not sure it's worth doing so. Could you please clarify your suggestion?

Thanks

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to