From d54b7c537990f15c2831e328f6897a1c682dceb5 Mon Sep 17 00:00:00 2001 From: "ben%bengoodger.com" Date: Mon, 4 Aug 2003 22:43:44 +0000 Subject: [PATCH] The Mother Of All Download Landings, Phase I http://bugzilla.mozilla.org/show_bug.cgi?id=214259 Firebird Download System Upgrades. components/prefwindow/content/pref-connection.js components/prefwindow/content/pref-connection.xul components/prefwindow/locale/pref-connection.dtd components/prefwindow/content/pref-fonts.js components/prefwindow/content/pref-fonts.xul components/prefwindow/content/pref-features.js components/prefwindow/content/pref-features.xul components/prefwindow/locale/pref-features.dtd components/prefwindow/content/pref-navigator.js components/prefwindow/content/pref-navigator.xul components/prefwindow/locale/pref-navigator.dtd components/prefwindow/locale/pref.dtd - Update Connection and Fonts panel to be sub-dialogs --- .../prefwindow/content/pref-connection.js | 19 +++- .../prefwindow/content/pref-connection.xul | 22 ++--- .../prefwindow/content/pref-features.js | 83 +++++++++++++++++ .../prefwindow/content/pref-features.xul | 9 ++ .../prefwindow/content/pref-fonts.js | 88 ++++++++++--------- .../prefwindow/content/pref-fonts.xul | 12 ++- .../prefwindow/content/pref-navigator.js | 5 ++ .../prefwindow/content/pref-navigator.xul | 78 +++------------- .../prefwindow/locale/pref-connection.dtd | 2 +- .../prefwindow/locale/pref-features.dtd | 8 ++ .../prefwindow/locale/pref-fonts.dtd | 3 +- .../prefwindow/locale/pref-navigator.dtd | 14 +-- browser/components/prefwindow/locale/pref.dtd | 2 - 13 files changed, 203 insertions(+), 142 deletions(-) diff --git a/browser/components/prefwindow/content/pref-connection.js b/browser/components/prefwindow/content/pref-connection.js index fb34ab60307..02771a6e397 100644 --- a/browser/components/prefwindow/content/pref-connection.js +++ b/browser/components/prefwindow/content/pref-connection.js @@ -18,6 +18,15 @@ # # Contributor(s): +var _elementIDs = ["networkProxyType", + "networkProxyFTP", "networkProxyFTP_Port", + "networkProxyGopher", "networkProxyGopher_Port", + "networkProxyHTTP", "networkProxyHTTP_Port", + "networkProxySOCKS", "networkProxySOCKS_Port", + "networkProxySOCKSVersion", + "networkProxySSL", "networkProxySSL_Port", + "networkProxyNone", "networkProxyAutoconfigURL"]; + function Startup() { DoEnabling(); @@ -78,10 +87,18 @@ function DoEnabling() const nsIProtocolProxyService = Components.interfaces.nsIProtocolProxyService; const kPROTPROX_CID = '{e9b301c0-e0e4-11D3-a1a8-0050041caf44}'; -function ReloadPAC() { +function ReloadPAC() +{ var autoURL = document.getElementById("networkProxyAutoconfigURL"); var pps = Components.classesByID[kPROTPROX_CID] .getService(nsIProtocolProxyService); pps.configureFromPAC(autoURL.value); } +function onConnectionsDialogOK() +{ + window.opener.top.hPrefWindow.wsm.savePageData(window.location.href, window); + + return true; +} + diff --git a/browser/components/prefwindow/content/pref-connection.xul b/browser/components/prefwindow/content/pref-connection.xul index bda9d12f3b9..4d024c41251 100644 --- a/browser/components/prefwindow/content/pref-connection.xul +++ b/browser/components/prefwindow/content/pref-connection.xul @@ -24,22 +24,10 @@ - - - + @@ -151,5 +139,5 @@ - + diff --git a/browser/components/prefwindow/content/pref-features.js b/browser/components/prefwindow/content/pref-features.js index 8513fc1e7d5..fea6ecfeeaf 100644 --- a/browser/components/prefwindow/content/pref-features.js +++ b/browser/components/prefwindow/content/pref-features.js @@ -334,3 +334,86 @@ function HandlePermissionKeyPress(e) { DeletePermission(); } } + +function showFontsAndColors() +{ + top.hPrefWindow.registerOKCallbackFunc(saveFontPrefs); + + openDialog("chrome://browser/content/pref/pref-fonts.xul", "", "centerscreen,chrome,modal=yes,dialog=yes"); +} + +function saveFontPrefs() +{ + var dataObject = top.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-fonts.xul"]; + var pref = top.hPrefWindow.pref; + for (var language in dataObject.languageData) { + for (var type in dataObject.languageData[language].types) { + var fontPrefString = "font.name." + type + "." + language; + var currValue = ""; + try { + currValue = pref.CopyUnicharPref(fontPrefString); + } + catch(e) { + } + if (currValue != dataObject.languageData[language].types[type]) + pref.SetUnicharPref(fontPrefString, dataObject.languageData[language].types[type]); + } + var variableSizePref = "font.size.variable." + language; + var fixedSizePref = "font.size.fixed." + language; + var minSizePref = "font.minimum-size." + language; + var currVariableSize = 12, currFixedSize = 12, minSizeVal = 0; + try { + currVariableSize = pref.GetIntPref(variableSizePref); + currFixedSize = pref.GetIntPref(fixedSizePref ); + minSizeVal = pref.GetIntPref(minSizePref); + } + catch(e) { + } + if (currVariableSize != dataObject.languageData[language].variableSize) + pref.SetIntPref(variableSizePref, dataObject.languageData[language].variableSize); + if (currFixedSize != dataObject.languageData[language].fixedSize) + pref.SetIntPref(fixedSizePref, dataObject.languageData[language].fixedSize); + if (minSizeVal != dataObject.languageData[language].minSize) { + pref.SetIntPref(minSizePref, dataObject.languageData[language].minSize); + } + } + + // font scaling + var fontDPI = parseInt(dataObject.fontDPI); + var myFonts = dataObject.dataEls["useMyFonts"].checked; + var defaultFont = dataObject.defaultFont; + var myColors = dataObject.dataEls["useMyColors"].checked; + try { + var currDPI = pref.GetIntPref("browser.display.screen_resolution"); + var currFonts = pref.GetIntPref("browser.display.use_document_fonts"); + var currColors = pref.GetBoolPref("browser.display.use_document_colors"); + var currDefault = pref.CopyUnicharPref( "font.default" ); + } + catch(e) { + } + + if (currDPI != fontDPI) + pref.SetIntPref("browser.display.screen_resolution", fontDPI); + if (currFonts == myFonts) + pref.SetIntPref("browser.display.use_document_fonts", !myFonts); + if(currDefault != defaultFont) + pref.SetUnicharPref( "font.default", defaultFont ); + if (currColors == myColors) + pref.SetBoolPref("browser.display.use_document_colors", !myColors); + + var items = ["foregroundText", "background", "unvisitedLinks", "visitedLinks"]; + var prefs = ["browser.display.foreground_color", "browser.display.background_color", + "browser.anchor_color", "browser.visited_color"]; + var prefvalue; + for (var i = 0; i < items.length; ++i) { + prefvalue = dataObject.dataEls[items[i]].value; + pref.SetUnicharPref(prefs[i], prefvalue) + } + items = ["browserUseSystemColors", "browserUnderlineAnchors"]; + prefs = ["browser.display.use_system_colors", "browser.underline_anchors"]; + for (var i = 0; i < items.length; ++i) { + prefvalue = dataObject.dataEls[items[i]].checked; + pref.SetBoolPref(prefs[i], prefvalue) + } +} + diff --git a/browser/components/prefwindow/content/pref-features.xul b/browser/components/prefwindow/content/pref-features.xul index 7ec5bca2d65..a5e43c7d22d 100644 --- a/browser/components/prefwindow/content/pref-features.xul +++ b/browser/components/prefwindow/content/pref-features.xul @@ -123,5 +123,14 @@ + + + + &fontsInfo.label; +