Updating preference dialogs to include basic networking, ssr, image [on/off], default home page. Removing SSR from dropdown dialog in minimo.xul

This commit is contained in:
dougt%meer.net 2005-09-06 19:02:04 +00:00
Родитель 4351889525
Коммит 9d82e93dc2
4 изменённых файлов: 93 добавлений и 59 удалений

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

@ -48,7 +48,6 @@ var gSelectedTab=null;
var gFullScreen=false;
var gGlobalHistory = null;
var gURIFixup = null;
var gSSRSupport = null;
function nsBrowserStatusHandler()
{
@ -382,6 +381,7 @@ function BrowserPopupShowing () {
function DoPanelPreferences() {
window.openDialog("chrome://minimo/content/preferences.xul","preferences","modal,centerscreeen,chrome,resizable=no");
BrowserReload();
}
/*
@ -495,30 +495,6 @@ function URLBarFocusHandler()
gURLBar.showHistoryPopup();
}
function URLBarClickHandler()
{
}
function BrowserToogleSSR()
{
if(!gSSRSupport)
gSSRSupport = Components.classes["@mozilla.org/ssr;1"].getService(Components.interfaces.nsISSRSupport);
gSSRSupport.SSREnabled = !gSSRSupport.SSREnabled;
BrowserReload(); // hack until this is done by ssr itself
}
function BrowserToogleSiteSSR()
{
if(!gSSRSupport)
gSSRSupport = Components.classes["@mozilla.org/ssr;1"].getService(Components.interfaces.nsISSRSupport);
gSSRSupport.siteSSREnabled = !gSSRSupport.siteSSREnabled;
BrowserReload(); // hack until this is done by ssr itself
}
var gRotationDirection = true;
function BrowserScreenRotate()

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

@ -70,8 +70,6 @@
<command id="cmd_BrowserOpenTab" oncommand="BrowserOpenTab()"/>
<command id="cmd_BrowserScreenRotate" oncommand="BrowserScreenRotate()"/>
<command id="cmd_BrowserSSR" oncommand="BrowserToogleSSR()"/>
<command id="cmd_BrowserSiteSSR" oncommand="BrowserToogleSiteSSR()"/>
<command id="cmd_BrowserOpenInfo" oncommand="BrowserOpenInfo()"/>
<command id="cmd_BrowserTestDialogs" oncommand="BrowserTestDialogs()"/>
<command id="cmd_BrowserTestSendSMS" oncommand="BrowserTestSendSMS()"/>
@ -96,22 +94,6 @@
<!-- separator for now in CSS - need to redesign -->
<menuitem id="command_ViewOptions" style='border-top:1px solid black' type="checkbox" command="cmd_ViewOptions" label="View Options" />
<!--
<menu id="SSR" label="SSR">
<menupopup >
<menuitem id="command_BrowserSSR" type="checkbox" command="cmd_BrowserSSR" label="Toggle SSR" />
<menuitem id="command_BrowserSiteSSR" type="checkbox" command="cmd_BrowserSiteSSR" label="Toggle Site SSR"/>
</menupopup>
</menu>
<menu id="menu-zoom" label="Text zoom">
<menupopup >
<menuitem id="" oncommand="BrowserResetZoomPlus()" label="ZOOM + " />
<menuitem id="" oncommand="BrowserResetZoomMinus()" label="ZOOM - " />
</menupopup>
</menu>
-->
<!--
<menuitem id="command_BrowserOpenInfo" label="page Info" />
<menuitem id="command_BrowserTestDialogs" label="Dialog XUL" />
@ -142,10 +124,6 @@
<hbox flex="1" >
<vbox flex="1" style="padding:4px ! important">
<hbox flex="1">
<checkbox command="cmd_BrowserSSR" label="&toggleSSR.label;"/>
<checkbox command="cmd_BrowserSiteSSR" label="&toggleSiteSSR.label;"/>
</hbox>
<hbox flex="1" style="margin-top:4px ! important">
<label value="&zoomText.label;" />
<toolbarbutton class="button-border" command="cmd_BrowserZoomPlus" label="&zoomTextPlus.label;" />

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

@ -0,0 +1,51 @@
function readEnableImagesPref()
{
var pref = document.getElementById("permissions.default.image");
return (pref.value == 1);
}
function writeEnableImagesPref()
{
var checkbox = document.getElementById("enableImages");
if (checkbox.checked) {
return 1;
}
return 2;
}
function readProxyPref()
{
var pref = document.getElementById("network.proxy.type");
return (pref.value == 1);
}
function writeProxyPref()
{
var checkbox = document.getElementById("UseProxy");
if (checkbox.checked) {
return 1;
}
return 0;
}
function sanitizeAll()
{
// Cache
var classID = Components.classes["@mozilla.org/network/cache-service;1"];
var cacheService = classID.getService(Components.interfaces.nsICacheService);
cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
// Autocomplete
var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
.getService(Components.interfaces.nsIBrowserHistory);
globalHistory.removeAllPages();
try
{
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.notifyObservers(null, "browser:purge-session-history", "");
} catch (e) { }
}

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

@ -15,17 +15,8 @@
<script type="application/x-javascript" src="chrome://minimo/content/preferences.js"/>
<stringbundle id="bundlePreferences" src="chrome://minimo/locale/minimo.properties"/>
<prefpane id="GeneralPane">
<preferences>
<preference id="browser.startup.homepage" name="browser.startup.homepage" type="wstring"/>
<preference id="permissions.default.image" name="permissions.default.image" type="int"/>
</preferences>
<groupbox>
<caption label="Home Page"/>
<textbox id="browserStartupHomepage" class="padded" flex="1" type="autocomplete" autocompletesearch="history"
preference="browser.startup.homepage"/>
</groupbox>
<prefpane id="Privacy">
<button label="Sanitize All" oncommand="sanitizeAll();"/>
</prefpane>
<prefpane id="ConnectionsDialogPane">
@ -34,6 +25,44 @@
<preference id="network.proxy.http" name="network.proxy.http" type="string"/>
<preference id="network.proxy.http_port" name="network.proxy.http_port" type="int"/>
</preferences>
<groupbox>
<caption label="HTTP Proxy Settings"/>
<checkbox id="UseProxy" label="Use Proxy" preference="network.proxy.type"
onsyncfrompreference="return readProxyPref();"
onsynctopreference="return writeProxyPref();"/>
<hbox>
<textbox id="networkProxyHTTP" preference="network.proxy.http"/>
<label value="Port"/>
<textbox id="networkProxyHTTP_Port" size="5" preference="network.proxy.http_port"/>
</hbox>
</groupbox>
</prefpane>
<prefpane id="GeneralPane">
<preferences>
<preference id="browser.startup.homepage" name="browser.startup.homepage" type="wstring"/>
<preference id="permissions.default.image" name="permissions.default.image" type="int"/>
<preference id="ssr.enabled" name="ssr.enabled" type="bool"/>
<preference id="ssr.site.enabled" name="ssr.site.enabled" type="bool"/>
</preferences>
<groupbox>
<caption label="Home Page"/>
<textbox id="browserStartupHomepage" class="padded" flex="1" preference="browser.startup.homepage"/>
</groupbox>
<groupbox>
<caption label="Small Screen Settings"/>
<checkbox id="enableImages" label="Display Images" preference="permissions.default.image"
onsyncfrompreference="return readEnableImagesPref();"
onsynctopreference="return writeEnableImagesPref();"/>
<checkbox id="ssr" label="Use SSR" preference="ssr.enabled"/>
<checkbox id="sitessr" label="Use Site-Specific SSR" preference="ssr.site.enabled"/>
</groupbox>
</prefpane>
</prefwindow>