Bug 1359471 - Add a checkbox to disable the cache smart size. r=jorgk

This commit is contained in:
Richard Marti 2017-04-25 21:23:09 +02:00
Родитель c0a883b9eb
Коммит 0f2a1aecfd
3 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -186,6 +186,21 @@ var gAdvancedPane = {
} catch (e) {}
},
updateCacheSizeUI: function (smartSizeEnabled)
{
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled: function ()
{
// The smart_size.enabled preference element is inverted="true", so its
// value is the opposite of the actual pref value
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
this.updateCacheSizeUI(!disabled);
},
/**
* Converts the cache size from units of KB to units of MB and returns that
* value.

Просмотреть файл

@ -91,6 +91,10 @@
name="mail.purge_threshhold_mb" type="int"/>
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity" type="int"/>
<preference id="browser.cache.disk.smart_size.enabled"
name="browser.cache.disk.smart_size.enabled"
inverted="true"
type="bool"/>
#ifdef MOZ_UPDATER
<!-- Update tab -->
<preference id="app.update.enabled" name="app.update.enabled"
@ -310,7 +314,14 @@ type="bool"/>
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
oncommand="gAdvancedPane.clearCache();"/>
</hbox>
<hbox align="center">
<hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
id="allowSmartSize"
onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
label="&overrideSmartCacheSize.label;"
accesskey="&overrideSmartCacheSize.accesskey;"/>
</hbox>
<hbox align="center" class="indent">
<label id="useCacheBefore" control="cacheSize"
accesskey="&useCacheBefore.accesskey;" value="&useCacheBefore.label;"/>
<textbox id="cacheSize" type="number" size="4" max="1024"

Просмотреть файл

@ -89,6 +89,8 @@
<!ENTITY useCacheBefore.label "Use up to">
<!ENTITY useCacheBefore.accesskey "U">
<!ENTITY useCacheAfter.label "MB of space for the cache">
<!ENTITY overrideSmartCacheSize.label "Override automatic cache management">
<!ENTITY overrideSmartCacheSize.accesskey "v">
<!ENTITY clearCacheNow.label "Clear Now">
<!ENTITY clearCacheNow.accesskey "C">