From 8c22c3e4b68606ba5f9db91ab5e2ce43cb6a0fb6 Mon Sep 17 00:00:00 2001 From: "kairo%kairo.at" Date: Wed, 5 Mar 2008 14:29:11 +0000 Subject: [PATCH] bug 417590 - port Firefox application pane as new helper app pane in SeaMonkey, r+sr=Neil git-svn-id: svn://10.0.0.236/trunk@247096 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/suite/browser/browser-prefs.js | 27 + mozilla/suite/common/Makefile.in | 6 + mozilla/suite/common/jar.mn | 7 +- .../common/pref/pref-applicationManager.js | 130 ++ .../common/pref/pref-applicationManager.xul | 92 + .../suite/common/pref/pref-applications.js | 2043 +++++++++++++++-- .../suite/common/pref/pref-applications.xul | 261 +-- mozilla/suite/common/pref/preferences.xul | 10 +- mozilla/suite/common/pref/prefpanels.css | 43 + mozilla/suite/common/pref/prefpanels.xml | 89 + mozilla/suite/common/pref/preftree.xul | 2 +- .../en-US/chrome/browser/region.properties | 9 + .../common/pref/pref-applicationManager.dtd | 4 + .../pref/pref-applicationManager.properties | 6 + .../chrome/common/pref/pref-applications.dtd | 35 +- .../common/pref/pref-applications.properties | 41 +- mozilla/suite/locales/jar.mn | 3 + .../classic/communicator/prefpanels.css | 79 +- mozilla/suite/themes/classic/jar.mn | 5 + 19 files changed, 2450 insertions(+), 442 deletions(-) create mode 100644 mozilla/suite/common/pref/pref-applicationManager.js create mode 100644 mozilla/suite/common/pref/pref-applicationManager.xul create mode 100755 mozilla/suite/common/pref/prefpanels.css create mode 100644 mozilla/suite/common/pref/prefpanels.xml create mode 100644 mozilla/suite/locales/en-US/chrome/common/pref/pref-applicationManager.dtd create mode 100644 mozilla/suite/locales/en-US/chrome/common/pref/pref-applicationManager.properties diff --git a/mozilla/suite/browser/browser-prefs.js b/mozilla/suite/browser/browser-prefs.js index 9fcdf888c1b..2c5fe776604 100644 --- a/mozilla/suite/browser/browser-prefs.js +++ b/mozilla/suite/browser/browser-prefs.js @@ -220,6 +220,33 @@ pref("browser.preferences.animateFadeIn", true); pref("browser.preferences.animateFadeIn", false); #endif +pref("browser.download.show_plugins_in_list", true); +pref("browser.download.hide_plugins_without_extensions", true); + +// initial web feed readers list - add enough entries for locales to add theirs +pref("browser.contentHandlers.types.0.title", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.0.uri", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.0.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.1.title", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.1.uri", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.1.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.2.title", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.2.uri", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.2.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.3.title", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.3.uri", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.3.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.4.title", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.4.uri", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.4.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.5.title", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.5.uri", "chrome://navigator-region/locale/region.properties"); +pref("browser.contentHandlers.types.5.type", "application/vnd.mozilla.maybe.feed"); + +pref("browser.feeds.handler", "ask"); +pref("browser.videoFeeds.handler", "ask"); +pref("browser.audioFeeds.handler", "ask"); + pref("app.releaseNotesURL", "chrome://branding/locale/brand.properties"); pref("app.vendorURL", "chrome://branding/locale/brand.properties"); diff --git a/mozilla/suite/common/Makefile.in b/mozilla/suite/common/Makefile.in index de5fc4c3a5d..c3a4a96ecb8 100644 --- a/mozilla/suite/common/Makefile.in +++ b/mozilla/suite/common/Makefile.in @@ -49,3 +49,9 @@ EXTRA_COMPONENTS = \ $(NULL) include $(topsrcdir)/config/rules.mk + +# DEFINES for preprocessing +# once we support the shell service, define this for supported platforms +#ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT))) +#DEFINES += -DHAVE_SHELL_SERVICE=1 +#endif diff --git a/mozilla/suite/common/jar.mn b/mozilla/suite/common/jar.mn index 26c1372ac8e..02c22c1f322 100644 --- a/mozilla/suite/common/jar.mn +++ b/mozilla/suite/common/jar.mn @@ -142,10 +142,15 @@ comm.jar: content/communicator/pref/preftree.xul (pref/preftree.xul) content/communicator/pref/pref-help.js (pref/pref-help.js) # files deprecated by preferences.xul: end + content/communicator/pref/prefpanels.css (pref/prefpanels.css) + content/communicator/pref/prefpanels.xml (pref/prefpanels.xml) content/communicator/pref/pref-advanced.xul (pref/pref-advanced.xul) content/communicator/pref/pref-appearance.xul (pref/pref-appearance.xul) content/communicator/pref/pref-applications.xul (pref/pref-applications.xul) - content/communicator/pref/pref-applications.js (pref/pref-applications.js) +* content/communicator/pref/pref-applications.js (pref/pref-applications.js) +* content/communicator/pref/pref-applicationManager.js (pref/pref-applicationManager.js) + content/communicator/pref/pref-applicationManager.xul (pref/pref-applicationManager.xul) +# XXX: remove line below once we have a helper app dialog that doesn't need it (comes with toolkit download manager) content/communicator/pref/pref-applications-edit.xul (pref/pref-applications-edit.xul) content/communicator/pref/overrideHandler.js (pref/overrideHandler.js) content/communicator/pref/pref-cache.js (pref/pref-cache.js) diff --git a/mozilla/suite/common/pref/pref-applicationManager.js b/mozilla/suite/common/pref/pref-applicationManager.js new file mode 100644 index 00000000000..ae6ed1bdb85 --- /dev/null +++ b/mozilla/suite/common/pref/pref-applicationManager.js @@ -0,0 +1,130 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Mozilla Corporation. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Florian Queze (Original author) + * Robert Kaiser + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// As pref-applications.js is always loaded, we can (and should!) reuse +// the nsI* constants from there, if needed also any services we need. + +var gAppManagerDialog = { + _removed: [], + + init: function appManager_init() { + this.handlerInfo = window.arguments[0]; + + var bundle = document.getElementById("appManagerBundle"); + var contentText; + if (this.handlerInfo.type == TYPE_MAYBE_FEED) + contentText = bundle.getString("descriptionHandleWebFeeds"); + else { + var description = gApplicationsPane._describeType(this.handlerInfo); + var key = (this.handlerInfo.wrappedHandlerInfo instanceof nsIMIMEInfo) ? + "descriptionHandleFile" : + "descriptionHandleProtocol"; + contentText = bundle.getFormattedString(key, [description]); + } + document.getElementById("appDescription").textContent = contentText; + + var list = document.getElementById("appList"); + var apps = this.handlerInfo.possibleApplicationHandlers.enumerate(); + while (apps.hasMoreElements()) { + let app = apps.getNext(); + app.QueryInterface(nsIHandlerApp); + var item = list.appendItem(app.name); + item.className = "listitem-iconic"; + item.setAttribute("image", gApplicationsPane._getIconURLForHandlerApp(app)); + item.app = app; + } + + list.selectedIndex = 0; + }, + + onOK: function appManager_onOK() { + if (!this._removed.length) { + // return early to avoid calling the |store| method. + return; + } + + for (var i = 0; i < this._removed.length; ++i) + this.handlerInfo.removePossibleApplicationHandler(this._removed[i]); + + this.handlerInfo.store(); + }, + + onCancel: function appManager_onCancel() { + // do nothing + }, + + remove: function appManager_remove() { + var list = document.getElementById("appList"); + this._removed.push(list.selectedItem.app); + var index = list.selectedIndex; + list.removeItemAt(index); + if (list.getRowCount() == 0) { + // The list is now empty, make the bottom part disappear + document.getElementById("appDetails").hidden = true; + } + else { + // Select the item at the same index, if we removed the last + // item of the list, select the previous item + if (index == list.getRowCount()) + --index; + list.selectedIndex = index; + } + }, + + onSelect: function appManager_onSelect() { + var list = document.getElementById("appList"); + if (!list.selectedItem) { + document.getElementById("cmd_delete").setAttribute("disabled", "true"); + return; + } + document.getElementById("cmd_delete").removeAttribute("disabled"); + var app = list.selectedItem.app; + var address = ""; + if (app instanceof nsILocalHandlerApp) + address = app.executable.path; + else if (app instanceof nsIWebHandlerApp) + address = app.uriTemplate; + else if (app instanceof nsIWebContentHandlerInfo) + address = app.uri; + document.getElementById("appLocation").value = address; + var bundle = document.getElementById("appManagerBundle"); + var appType = app instanceof nsILocalHandlerApp ? "descriptionLocalApp" + : "descriptionWebApp"; + document.getElementById("appType").value = bundle.getString(appType); + } +}; diff --git a/mozilla/suite/common/pref/pref-applicationManager.xul b/mozilla/suite/common/pref/pref-applicationManager.xul new file mode 100644 index 00000000000..e87d32777ce --- /dev/null +++ b/mozilla/suite/common/pref/pref-applicationManager.xul @@ -0,0 +1,92 @@ + + + + + + + + + + + - - - - -