Bug 590725 - Convert suite/ files for content XUL being killed. (feed part) r+=Neil
r=Callek
This commit is contained in:
Родитель
21807b551a
Коммит
f8a1666515
|
@ -0,0 +1,3 @@
|
|||
#feedSubscribeLine {
|
||||
-moz-binding: url(chrome://communicator/content/feeds/subscribe.xml#feedreaderUI);
|
||||
}
|
|
@ -16,10 +16,13 @@
|
|||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<html id="feedHandler"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>&feedPage.title;</title>
|
||||
<link rel="stylesheet"
|
||||
href="chrome://communicator/content/feeds/subscribe.css"
|
||||
type="text/css"
|
||||
media="all"/>
|
||||
<link rel="stylesheet"
|
||||
href="chrome://communicator/skin/feed-subscribe.css"
|
||||
type="text/css"
|
||||
|
@ -34,37 +37,10 @@
|
|||
<p id="feedSubscriptionInfo1" />
|
||||
<p id="feedSubscriptionInfo2" />
|
||||
</div>
|
||||
|
||||
<!-- XXXmano this can't have any whitespace in it. Otherwise you would see
|
||||
how much XUL-in-XHTML sucks, see bug 348830 -->
|
||||
<div id="feedSubscribeLine"
|
||||
><xul:vbox
|
||||
><xul:hbox align="center"
|
||||
><xul:description id="subscribeUsingDescription"
|
||||
/><xul:menulist id="handlersMenuList" aria-labelledby="subscribeUsingDescription"
|
||||
><xul:menupopup menugenerated="true" id="handlersMenuPopup"
|
||||
><xul:menuitem id="messengerFeedsMenuItem" label="&feedMessenger;" class="menuitem-iconic" image="chrome://communicator/skin/icons/feedIcon16.png" selected="true"
|
||||
/><xul:menuitem id="liveBookmarksMenuItem" label="&feedLiveBookmarks;" class="menuitem-iconic" image="chrome://communicator/skin/icons/feedIcon16.png" selected="true"
|
||||
/><xul:menuseparator
|
||||
/></xul:menupopup
|
||||
></xul:menulist
|
||||
></xul:hbox
|
||||
><xul:hbox
|
||||
><xul:checkbox id="alwaysUse" checked="false"
|
||||
/></xul:hbox
|
||||
><xul:hbox align="center"
|
||||
><xul:spacer flex="1"
|
||||
/><xul:button label="&feedSubscribeNow;" id="subscribeButton"
|
||||
/></xul:hbox
|
||||
></xul:vbox
|
||||
></div
|
||||
></div>
|
||||
<div id="feedSubscribeLine" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
SubscribeHandler.init();
|
||||
</script>
|
||||
|
||||
<div id="feedBody">
|
||||
<div id="feedTitle">
|
||||
<a id="feedTitleLink">
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE bindings SYSTEM "chrome://communicator/locale/feeds/subscribe.dtd">
|
||||
|
||||
<bindings id="feedBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<binding id="feedreaderUI">
|
||||
<content>
|
||||
<xul:vbox>
|
||||
<xul:hbox align="center">
|
||||
<xul:description anonid="subscribeUsingDescription" class="subscribeUsingDescription"/>
|
||||
<xul:menulist anonid="handlersMenuList" class="handlersMenuList" aria-labelledby="subscribeUsingDescription">
|
||||
<xul:menupopup menugenerated="true" anonid="handlersMenuPopup" class="handlersMenuPopup">
|
||||
<xul:menuitem anonid="messengerFeedsMenuItem" label="&feedMessenger;" class="menuitem-iconic messengerFeedsMenuItem" image="chrome://communicator/skin/icons/feedIcon16.png" selected="true"/>
|
||||
<xul:menuitem anonid="liveBookmarksMenuItem" label="&feedLiveBookmarks;" class="menuitem-iconic liveBookmarksMenuItem" image="chrome://communicator/skin/icons/feedIcon16.png"/>
|
||||
<xul:menuseparator/>
|
||||
</xul:menupopup>
|
||||
</xul:menulist>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:checkbox anonid="alwaysUse" class="alwaysUse" checked="false"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox align="center">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button label="&feedSubscribeNow;" anonid="subscribeButton" class="subscribeButton"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<constructor>
|
||||
SubscribeHandler.init();
|
||||
</constructor>
|
||||
</implementation>
|
||||
<resources>
|
||||
<stylesheet src="chrome://communicator/skin/feed-subscribe-ui.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -139,8 +139,10 @@ comm.jar:
|
|||
content/communicator/downloads/uploadProgress.xul (downloads/uploadProgress.xul)
|
||||
content/communicator/downloads/uploadProgress.js (downloads/uploadProgress.js)
|
||||
content/communicator/downloads/treeView.js (downloads/treeView.js)
|
||||
content/communicator/feeds/subscribe.xhtml (feeds/subscribe.xhtml)
|
||||
content/communicator/feeds/subscribe.css (feeds/subscribe.css)
|
||||
content/communicator/feeds/subscribe.js (feeds/subscribe.js)
|
||||
content/communicator/feeds/subscribe.xhtml (feeds/subscribe.xhtml)
|
||||
content/communicator/feeds/subscribe.xml (feeds/subscribe.xml)
|
||||
content/communicator/history/controller.js (history/controller.js)
|
||||
content/communicator/history/history.js (history/history.js)
|
||||
content/communicator/history/history.xul (history/history.xul)
|
||||
|
|
|
@ -725,6 +725,15 @@ FeedWriter.prototype = {
|
|||
Components.utils.evalInSandbox(codeStr, this._contentSandbox);
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper method to get an element in the XBL binding where the handler
|
||||
* selection UI lives
|
||||
*/
|
||||
_getUIElement: function getUIElement(id) {
|
||||
return this._document.getAnonymousElementByAttribute(
|
||||
this._document.getElementById("feedSubscribeLine"), "anonid", id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a prompt from which the user may choose a (client) feed reader.
|
||||
* @return - true if a feed reader was selected, false otherwise.
|
||||
|
@ -772,7 +781,7 @@ FeedWriter.prototype = {
|
|||
},
|
||||
|
||||
_setAlwaysUseCheckedState: function setAlwaysUseCheckedState(feedType) {
|
||||
var checkbox = this._document.getElementById("alwaysUse");
|
||||
var checkbox = this._getUIElement("alwaysUse");
|
||||
if (checkbox) {
|
||||
var alwaysUse = (safeGetCharPref(getPrefActionForType(feedType), "ask") != "ask");
|
||||
this._setCheckboxCheckedState(checkbox, alwaysUse);
|
||||
|
@ -792,18 +801,17 @@ FeedWriter.prototype = {
|
|||
}
|
||||
|
||||
this._contentSandbox.subscribeUsing =
|
||||
this._document.getElementById("subscribeUsingDescription");
|
||||
this._getUIElement("subscribeUsingDescription");
|
||||
this._contentSandbox.label = this._getString(stringLabel);
|
||||
var codeStr = "subscribeUsing.setAttribute('value', label);"
|
||||
Components.utils.evalInSandbox(codeStr, this._contentSandbox);
|
||||
},
|
||||
|
||||
_setAlwaysUseLabel: function setAlwaysUseLabel() {
|
||||
var checkbox = this._document.getElementById("alwaysUse");
|
||||
var checkbox = this._getUIElement("alwaysUse");
|
||||
if (checkbox) {
|
||||
var handlersMenuList = this._document.getElementById("handlersMenuList");
|
||||
if (handlersMenuList) {
|
||||
var handlerName = this._getSelectedItemFromMenulist(handlersMenuList)
|
||||
if (this._handlersMenuList) {
|
||||
var handlerName = this._getSelectedItemFromMenulist(this._handlersMenuList)
|
||||
.getAttribute("label");
|
||||
var stringLabel = "alwaysUseForFeeds";
|
||||
switch (this._getFeedType()) {
|
||||
|
@ -835,7 +843,7 @@ FeedWriter.prototype = {
|
|||
}
|
||||
|
||||
if (event.type == "command") {
|
||||
switch (event.target.id) {
|
||||
switch (event.target.getAttribute("anonid")) {
|
||||
case "subscribeButton":
|
||||
this.subscribe();
|
||||
break;
|
||||
|
@ -848,8 +856,7 @@ FeedWriter.prototype = {
|
|||
* selected). If we don't show the filepicker here, it will be shown
|
||||
* when clicking "Subscribe Now".
|
||||
*/
|
||||
var popupbox = this._document.getElementById("handlersMenuList")
|
||||
.firstChild.boxObject;
|
||||
var popupbox = this._handlersMenuList.firstChild.boxObject;
|
||||
popupbox.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
if (popupbox.popupState == "hiding" && !this._chooseClientApp()) {
|
||||
// Select the (per-prefs) selected handler if no application was
|
||||
|
@ -870,11 +877,10 @@ FeedWriter.prototype = {
|
|||
|
||||
switch (handler) {
|
||||
case "web":
|
||||
var handlersMenuList = this._document.getElementById("handlersMenuList");
|
||||
if (handlersMenuList) {
|
||||
if (this._handlersMenuList) {
|
||||
var url = prefs.getComplexValue(getPrefWebForType(feedType),
|
||||
Components.interfaces.nsISupportsString).data;
|
||||
var handlers = handlersMenuList.getElementsByAttribute("webhandlerurl", url);
|
||||
var handlers = this._handlersMenuList.getElementsByAttribute("webhandlerurl", url);
|
||||
if (handlers.length == 0) {
|
||||
LOG("FeedWriter._setSelectedHandler: selected web handler isn't in the menulist");
|
||||
return;
|
||||
|
@ -909,13 +915,13 @@ FeedWriter.prototype = {
|
|||
break;
|
||||
}
|
||||
case "bookmarks":
|
||||
var liveBookmarksMenuItem = this._document.getElementById("liveBookmarksMenuItem");
|
||||
var liveBookmarksMenuItem = this._getUIElement("liveBookmarksMenuItem");
|
||||
if (liveBookmarksMenuItem)
|
||||
this._safeDoCommand(liveBookmarksMenuItem);
|
||||
break;
|
||||
// fall through if this._selectedApp is null
|
||||
default:
|
||||
var messengerFeedsMenuItem = this._document.getElementById("messengerFeedsMenuItem");
|
||||
var messengerFeedsMenuItem = this._getUIElement("messengerFeedsMenuItem");
|
||||
if (messengerFeedsMenuItem)
|
||||
this._safeDoCommand(messengerFeedsMenuItem);
|
||||
break;
|
||||
|
@ -923,7 +929,7 @@ FeedWriter.prototype = {
|
|||
},
|
||||
|
||||
_initSubscriptionUI: function initSubscriptionUI() {
|
||||
var handlersMenuPopup = this._document.getElementById("handlersMenuPopup");
|
||||
var handlersMenuPopup = this._getUIElement("handlersMenuPopup");
|
||||
if (!handlersMenuPopup)
|
||||
return;
|
||||
|
||||
|
@ -946,11 +952,13 @@ FeedWriter.prototype = {
|
|||
codeStr = "header.className = 'feedBackground'; ";
|
||||
}
|
||||
|
||||
var liveBookmarksMenuItem = this._getUIElement("liveBookmarksMenuItem");
|
||||
|
||||
// Last-selected application
|
||||
var menuItem = this._document.createElementNS(XUL_NS, "menuitem");
|
||||
menuItem.id = "selectedAppMenuItem";
|
||||
menuItem.className = "menuitem-iconic";
|
||||
var menuItem = liveBookmarksMenuItem.cloneNode(false);
|
||||
menuItem.removeAttribute("selected");
|
||||
menuItem.setAttribute("anonid", "selectedAppMenuItem");
|
||||
menuItem.className = "menuitem-iconic selectedAppMenuItem";
|
||||
menuItem.setAttribute("handlerType", "client");
|
||||
try {
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
|
@ -981,9 +989,10 @@ FeedWriter.prototype = {
|
|||
this._defaultSystemReader = Components.classes["@mozilla.org/suite/shell-feed-service;1"]
|
||||
.getService(Components.interfaces.nsIShellService)
|
||||
.defaultFeedReader;
|
||||
menuItem = this._document.createElementNS(XUL_NS, "menuitem");
|
||||
menuItem.id = "defaultHandlerMenuItem";
|
||||
menuItem.className = "menuitem-iconic";
|
||||
menuItem = liveBookmarksMenuItem.cloneNode(false);
|
||||
menuItem.removeAttribute("selected");
|
||||
menuItem.setAttribute("anonid", "defaultHandlerMenuItem");
|
||||
menuItem.className = "menuitem-iconic defaultHandlerMenuItem";
|
||||
menuItem.setAttribute("handlerType", "client");
|
||||
|
||||
this._initMenuItemWithFile(menuItem, this._defaultSystemReader);
|
||||
|
@ -1003,16 +1012,18 @@ FeedWriter.prototype = {
|
|||
}
|
||||
|
||||
// "Choose Application..." menuitem
|
||||
menuItem = this._document.createElementNS(XUL_NS, "menuitem");
|
||||
menuItem.id = "chooseApplicationMenuItem";
|
||||
menuItem = liveBookmarksMenuItem.cloneNode(false);
|
||||
menuItem.removeAttribute("selected");
|
||||
menuItem.setAttribute("anonid", "chooseApplicationMenuItem");
|
||||
menuItem.className = "menuitem-iconic chooseApplicationMenuItem";
|
||||
menuItem.setAttribute("label", this._getString("chooseApplicationMenuItem"));
|
||||
|
||||
this._contentSandbox.chooseAppMenuItem = menuItem;
|
||||
codeStr += "handlersMenuPopup.appendChild(chooseAppMenuItem); ";
|
||||
|
||||
// separator
|
||||
this._contentSandbox.chooseAppSep = this._document
|
||||
.createElementNS(XUL_NS, "menuseparator");
|
||||
this._contentSandbox.chooseAppSep =
|
||||
menuItem = liveBookmarksMenuItem.nextSibling.cloneNode(false);
|
||||
codeStr += "handlersMenuPopup.appendChild(chooseAppSep); ";
|
||||
|
||||
Components.utils.evalInSandbox(codeStr, this._contentSandbox);
|
||||
|
@ -1027,7 +1038,8 @@ FeedWriter.prototype = {
|
|||
var handlers = wccr.getContentHandlers(this._getMimeTypeForFeedType(feedType));
|
||||
if (handlers.length != 0) {
|
||||
for (let i = 0; i < handlers.length; ++i) {
|
||||
menuItem = this._document.createElementNS(XUL_NS, "menuitem");
|
||||
menuItem = liveBookmarksMenuItem.cloneNode(false);
|
||||
menuItem.removeAttribute("selected");
|
||||
menuItem.className = "menuitem-iconic";
|
||||
menuItem.setAttribute("label", handlers[i].name);
|
||||
menuItem.setAttribute("handlerType", "web");
|
||||
|
@ -1061,8 +1073,7 @@ FeedWriter.prototype = {
|
|||
handlersMenuPopup.addEventListener("command", this, false);
|
||||
|
||||
// Set up the "Subscribe Now" button
|
||||
this._document
|
||||
.getElementById("subscribeButton")
|
||||
this._getUIElement("subscribeButton")
|
||||
.addEventListener("command", this, false);
|
||||
|
||||
// first-run ui
|
||||
|
@ -1130,6 +1141,7 @@ FeedWriter.prototype = {
|
|||
_document: null,
|
||||
_feedURI: null,
|
||||
_feedPrincipal: null,
|
||||
_handlersMenuList: null,
|
||||
|
||||
// nsIFeedWriter
|
||||
init: function init(aWindow) {
|
||||
|
@ -1143,6 +1155,7 @@ FeedWriter.prototype = {
|
|||
|
||||
this._window = window;
|
||||
this._document = window.document;
|
||||
this._handlersMenuList = this._getUIElement("handlersMenuList");
|
||||
|
||||
var secman = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager);
|
||||
|
@ -1189,11 +1202,9 @@ FeedWriter.prototype = {
|
|||
},
|
||||
|
||||
close: function close() {
|
||||
this._document
|
||||
.getElementById("handlersMenuPopup")
|
||||
this._getUIElement("handlersMenuPopup")
|
||||
.removeEventListener("command", this, false);
|
||||
this._document
|
||||
.getElementById("subscribeButton")
|
||||
this._getUIElement("subscribeButton")
|
||||
.removeEventListener("command", this, false);
|
||||
this._document = null;
|
||||
this._window = null;
|
||||
|
@ -1240,19 +1251,17 @@ FeedWriter.prototype = {
|
|||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var defaultHandler = "reader";
|
||||
var useAsDefault = this._document.getElementById("alwaysUse")
|
||||
.getAttribute("checked");
|
||||
var useAsDefault = this._getUIElement("alwaysUse").getAttribute("checked");
|
||||
|
||||
var handlersMenuList = this._document.getElementById("handlersMenuList");
|
||||
var selectedItem = this._getSelectedItemFromMenulist(handlersMenuList);
|
||||
var selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
|
||||
|
||||
// Show the file picker before subscribing if the
|
||||
// choose application menuitem was chosen using the keyboard
|
||||
if (selectedItem.id == "chooseApplicationMenuItem") {
|
||||
if (selectedItem.getAttribute("anonid") == "chooseApplicationMenuItem") {
|
||||
if (!this._chooseClientApp())
|
||||
return;
|
||||
|
||||
selectedItem = this._getSelectedItemFromMenulist(handlersMenuList);
|
||||
selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
|
||||
}
|
||||
|
||||
if (selectedItem.hasAttribute("webhandlerurl")) {
|
||||
|
@ -1277,7 +1286,7 @@ FeedWriter.prototype = {
|
|||
}
|
||||
}
|
||||
else {
|
||||
switch (selectedItem.id) {
|
||||
switch (selectedItem.getAttribute("anonid")) {
|
||||
case "selectedAppMenuItem":
|
||||
prefs.setComplexValue(getPrefAppForType(feedType), Components.interfaces.nsILocalFile,
|
||||
this._selectedApp);
|
||||
|
@ -1394,8 +1403,7 @@ FeedWriter.prototype = {
|
|||
// Go through the readers menu and look for the corresponding
|
||||
// reader menu-item for the page if any.
|
||||
var spec = aURI.spec;
|
||||
var handlersMenulist = this._document.getElementById("handlersMenuList");
|
||||
var possibleHandlers = handlersMenulist.firstChild.childNodes;
|
||||
var possibleHandlers = this._handlersMenuList.firstChild.childNodes;
|
||||
for (let i=0; i < possibleHandlers.length ; i++) {
|
||||
if (possibleHandlers[i].getAttribute("webhandlerurl") == spec) {
|
||||
this._setFaviconForWebReader(aURI, possibleHandlers[i]);
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#feedSubscribeLine {
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
.menuitem-iconic {
|
||||
-moz-padding-start: 2px;
|
||||
}
|
||||
|
||||
.menu-iconic-left {
|
||||
display: -moz-box;
|
||||
-moz-padding-end: 2px;
|
||||
}
|
||||
|
||||
menupopup:-moz-locale-dir(rtl) {
|
||||
direction: rtl;
|
||||
}
|
|
@ -48,8 +48,6 @@ html {
|
|||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#feedHeader[firstrun="true"] #feedIntroText {
|
||||
padding-top: 0.1em;
|
||||
-moz-padding-start: 0.6em;
|
||||
|
@ -64,14 +62,6 @@ html {
|
|||
padding-top: 0.2em;
|
||||
}
|
||||
|
||||
#messengerFeedsMenuItem {
|
||||
list-style-image: url("chrome://communicator/skin/icons/feedIcon16.png");
|
||||
}
|
||||
|
||||
#feedHeader[dir="rtl"] #handlersMenuList > menupopup {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
/* Don't print subscription UI */
|
||||
@media print {
|
||||
#feedHeaderContainer {
|
||||
|
|
|
@ -75,6 +75,7 @@ classic.jar:
|
|||
skin/classic/communicator/brand/throbber16-single.png (communicator/brand/throbber16-single.png)
|
||||
skin/classic/communicator/directory/directory.css (communicator/directory/directory.css)
|
||||
skin/classic/communicator/feed-subscribe.css (communicator/feed-subscribe.css)
|
||||
skin/classic/communicator/feed-subscribe-ui.css (communicator/feed-subscribe-ui.css)
|
||||
skin/classic/communicator/fullscreen-video.css (communicator/fullscreen-video.css)
|
||||
skin/classic/communicator/directory/folder-clsd.gif (communicator/directory/folder-clsd.gif)
|
||||
skin/classic/communicator/directory/folder-open.gif (communicator/directory/folder-open.gif)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#feedSubscribeLine {
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
menupopup:-moz-locale-dir(rtl) {
|
||||
direction: rtl;
|
||||
}
|
|
@ -100,14 +100,6 @@ html {
|
|||
padding-top: 0.2em;
|
||||
}
|
||||
|
||||
#messengerFeedsMenuItem {
|
||||
list-style-image: url("chrome://communicator/skin/icons/feedIcon16.png");
|
||||
}
|
||||
|
||||
#feedHeader[dir="rtl"] #handlersMenuList > menupopup {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
/* Don't print subscription UI */
|
||||
@media print {
|
||||
#feedHeaderContainer {
|
||||
|
|
|
@ -55,6 +55,7 @@ modern.jar:
|
|||
skin/modern/communicator/downloads/downloadButtons.png (communicator/downloads/downloadButtons.png)
|
||||
skin/modern/communicator/downloads/downloadmanager.css (communicator/downloads/downloadmanager.css)
|
||||
skin/modern/communicator/feed-subscribe.css (communicator/feed-subscribe.css)
|
||||
skin/modern/communicator/feed-subscribe-ui.css (communicator/feed-subscribe-ui.css)
|
||||
skin/modern/communicator/fullscreen-video.css (communicator/fullscreen-video.css)
|
||||
skin/modern/communicator/history/calendar.png (communicator/history/calendar.png)
|
||||
skin/modern/communicator/icons/alwaysAsk.png (communicator/icons/alwaysAsk.png)
|
||||
|
|
Загрузка…
Ссылка в новой задаче