From 27719d0f4aaece3efa311241c2a60c9651ea4b5f Mon Sep 17 00:00:00 2001 From: "anatoliya%netscape.com" Date: Wed, 17 May 2006 02:29:23 +0000 Subject: [PATCH] bug 76512 r=pchen sr=hyatt --- suite/common/pref/pref-themes.js | 76 +++++++++++++++---- suite/common/pref/pref-themes.xul | 3 + .../common/pref/prefutilities.properties | 5 +- 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/suite/common/pref/pref-themes.js b/suite/common/pref/pref-themes.js index 9eaa21a45fd2..203888679a8b 100644 --- a/suite/common/pref/pref-themes.js +++ b/suite/common/pref/pref-themes.js @@ -3,6 +3,7 @@ // ( 05/09/2000, Ben Goodger ) var gPrefutilitiesBundle; +var gBrandBundle; const DEBUG_USE_PROFILE = true; @@ -17,6 +18,8 @@ catch(e) {} function Startup() { gPrefutilitiesBundle = document.getElementById("bundle_prefutilities"); + gBrandBundle = document.getElementById("bundle_brand"); + var tree = document.getElementById( "skinsTree" ); var theSkinKids = document.getElementById("theSkinKids"); if (theSkinKids.hasChildNodes() && theSkinKids.firstChild) @@ -65,36 +68,79 @@ function installSkin() function themeSelect() { var tree = document.getElementById("skinsTree"); + + if (!tree) + return; + var selectedItem = tree.selectedItems.length ? tree.selectedItems[0] : null; var applyButton = document.getElementById("applySkin"); if (selectedItem && selectedItem.getAttribute("skin") == "true") { var themeName = selectedItem.getAttribute("displayName"); + var skinName = selectedItem.getAttribute("name"); + + + var oldTheme; + try { + oldTheme = !chromeRegistry.checkThemeVersion(skinName); + } + catch(e) { + oldTheme = false; + } + var nameField = document.getElementById("displayName"); - nameField.setAttribute("value", themeName); var author = document.getElementById("author"); - author.setAttribute("value", selectedItem.getAttribute("author")); var image = document.getElementById("previewImage"); - image.setAttribute("src", selectedItem.getAttribute("image")); var descText = document.createTextNode(selectedItem.getAttribute("description")); var description = document.getElementById("description"); - while (description.hasChildNodes()) - description.removeChild(description.firstChild); - description.appendChild(descText); var uninstallButton = document.getElementById("uninstallSkin"); var applyLabel = gPrefutilitiesBundle.getString("applyThemePrefix"); var uninstallLabel = gPrefutilitiesBundle.getString("uninstallThemePrefix"); - applyButton.removeAttribute("disabled"); - applyLabel = applyLabel.replace(/%theme_name%/, themeName); - uninstallLabel = uninstallLabel.replace(/%theme_name%/, themeName); - applyButton.label = applyLabel; - uninstallButton.label = uninstallLabel; - var locType = selectedItem.getAttribute("loctype"); - uninstallButton.disabled = (locType == "install"); - var skinName = selectedItem.getAttribute( "name" ); - applyButton.disabled = chromeRegistry.isSkinSelected(skinName, DEBUG_USE_PROFILE); + + while (description.hasChildNodes()) + description.removeChild(description.firstChild); + + nameField.setAttribute("value", themeName); + author.setAttribute("value", selectedItem.getAttribute("author")); + image.setAttribute("src", selectedItem.getAttribute("image")); + + + if (!oldTheme) { + description.appendChild(descText); + + applyButton.removeAttribute("disabled"); + applyLabel = applyLabel.replace(/%theme_name%/, themeName); + uninstallLabel = uninstallLabel.replace(/%theme_name%/, themeName); + applyButton.label = applyLabel; + uninstallButton.label = uninstallLabel; + + var locType = selectedItem.getAttribute("loctype"); + uninstallButton.disabled = (locType == "install"); + } + else{ + applyLabel = gPrefutilitiesBundle.getString("applyThemePrefix"); + applyLabel = applyLabel.replace(/%theme_name%/, themeName); + applyButton.label = applyLabel; + + uninstallLabel = uninstallLabel.replace(/%theme_name%/, themeName); + uninstallButton.label = uninstallLabel; + + applyButton.setAttribute("disabled", true); + uninstallButton.disabled = false; + + var newText = gPrefutilitiesBundle.getString("oldTheme"); + newText = newText.replace(/%theme_name%/, themeName); + + newText = newText.replace(/%brand%/g, gBrandBundle.getString("brandShortName")); + + descText = document.createTextNode(newText); + description.appendChild(descText); + } + } else { applyButton.setAttribute("disabled", true); } } + + diff --git a/suite/common/pref/pref-themes.xul b/suite/common/pref/pref-themes.xul index 5a09c2223018..0bf557826ee4 100644 --- a/suite/common/pref/pref-themes.xul +++ b/suite/common/pref/pref-themes.xul @@ -38,6 +38,9 @@ + +