зеркало из https://github.com/mozilla/snowl.git
add support for writing messages to the river view
This commit is contained in:
Родитель
7a8ae5200d
Коммит
0eba4afce5
|
@ -11,17 +11,15 @@ overlay chrome://browser/content/browser.xul chrome://snowl/content/list.xul
|
|||
# For Customize to display our buttons correctly.
|
||||
style chrome://global/content/customizeToolbar.xul chrome://snowl/content/browser.css
|
||||
|
||||
# Add the collections view to the list view sidebar. We overlay it onto both
|
||||
# the list view sidebar and the river view, but for the river view we overlay it
|
||||
# dynamically via document.loadOverlay instead of an entry here because we
|
||||
# modify the query params of the river view URL to reflect the selected
|
||||
# collection and filters, and chrome.manifest overlay instructions only work
|
||||
# on exact matches of the entire URL.
|
||||
# Note: we overlay the river view via xul-overlay processing instructions
|
||||
# because chrome.manifest instructions require exact URLs, and the river view's
|
||||
# URL varies because of query params in response to user searches.
|
||||
|
||||
# Add the collections view to the list view sidebar.
|
||||
overlay chrome://snowl/content/list-sidebar.xul chrome://snowl/content/collections.xul
|
||||
|
||||
# Add the interface for writing messages to the stream and river views.
|
||||
# Add the interface for writing messages to the stream view.
|
||||
overlay chrome://snowl/content/stream.xul chrome://snowl/content/write.xul
|
||||
overlay chrome://snowl/content/river.xul chrome://snowl/content/write.xul
|
||||
|
||||
# Add the toolbar to the collections and stream views.
|
||||
# XXX Should we add the toolbar directly to the list and river views
|
||||
|
|
|
@ -53,6 +53,7 @@ Cu.import("resource://snowl/modules/URI.js");
|
|||
Cu.import("resource://snowl/modules/datastore.js");
|
||||
Cu.import("resource://snowl/modules/collection.js");
|
||||
Cu.import("resource://snowl/modules/utils.js");
|
||||
Cu.import("resource://snowl/modules/service.js");
|
||||
|
||||
const XML_NS = "http://www.w3.org/XML/1998/namespace"
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
@ -158,6 +159,16 @@ let SnowlMessageView = {
|
|||
}
|
||||
},
|
||||
|
||||
get _writeButton() {
|
||||
delete this._writeButton;
|
||||
return this._writeButton = document.getElementById("writeButton");
|
||||
},
|
||||
|
||||
get _writeForm() {
|
||||
delete this._writeForm;
|
||||
return this._writeForm = document.getElementById("writeForm");
|
||||
},
|
||||
|
||||
// The set of messages to display in the view.
|
||||
_collection: null,
|
||||
|
||||
|
@ -223,6 +234,9 @@ let SnowlMessageView = {
|
|||
// time to initialize itself.
|
||||
let t = this;
|
||||
window.setTimeout(function() { t._initDelayed() }, 0);
|
||||
|
||||
this._initWriteForm();
|
||||
this._updateWriteButton();
|
||||
},
|
||||
|
||||
_initDelayed: function() {
|
||||
|
@ -277,6 +291,20 @@ let SnowlMessageView = {
|
|||
window.setTimeout(function() { t.onMidnight() }, msUntilMidnight);
|
||||
},
|
||||
|
||||
_initWriteForm: function() {
|
||||
// For some reason setting hidden="true" in the XUL file prevents us
|
||||
// from showing the box later via writeForm.hidden = false, so we set it
|
||||
// here instead.
|
||||
// FIXME: file a bug on this abnormality.
|
||||
this._writeForm.hidden = true;
|
||||
},
|
||||
|
||||
// Selectively enable/disable the button for writing a message depending on
|
||||
// whether or not the user has an account that supports writing.
|
||||
_updateWriteButton: function() {
|
||||
this._writeButton.disabled = (SnowlService.targets.length == 0);
|
||||
},
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
// Toolbar
|
||||
|
@ -567,6 +595,26 @@ let SnowlMessageView = {
|
|||
},
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
// Writing and Sending Messages
|
||||
|
||||
onToggleWrite: function(event) {
|
||||
if (event.target.checked) {
|
||||
this._writeForm.hidden = false;
|
||||
// FIXME: only do this when the user first starts to write a message,
|
||||
// not every time they show the write form.
|
||||
WriteForm.init();
|
||||
}
|
||||
else
|
||||
this._writeForm.hidden = true;
|
||||
},
|
||||
|
||||
onMessageSent: function() {
|
||||
this._writeButton.checked = false;
|
||||
this._writeForm.hidden = true;
|
||||
},
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
// Safe DOM Manipulation
|
||||
|
||||
|
|
|
@ -40,9 +40,20 @@
|
|||
<?xml-stylesheet href="chrome://snowl/content/river.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://snowl/content/riverContent.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE page SYSTEM "chrome://snowl/locale/river.dtd">
|
||||
<!-- toolbar.dtd gives us writeButton.tooltip -->
|
||||
<!DOCTYPE page [
|
||||
<!ENTITY % riverDTD SYSTEM "chrome://snowl/locale/river.dtd">
|
||||
%riverDTD;
|
||||
<!ENTITY % toolbarDTD SYSTEM "chrome://snowl/locale/toolbar.dtd">
|
||||
%toolbarDTD;
|
||||
]>
|
||||
|
||||
<!-- We load overlays via xul-overlay processing instructions rather than
|
||||
- chrome.manifest instructions because manifest instructions require us
|
||||
- to specify the exact URL to overlay, and our URL changes based on
|
||||
- query parameters that get set in response to user searches. -->
|
||||
<?xul-overlay href="chrome://snowl/content/collections.xul"?>
|
||||
<?xul-overlay href="chrome://snowl/content/write.xul"?>
|
||||
|
||||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
|
@ -52,6 +63,9 @@
|
|||
<script type="application/javascript" src="chrome://snowl/content/strands.js"/>
|
||||
<script type="application/javascript" src="chrome://snowl/content/river.js"/>
|
||||
|
||||
<!-- write.xul overlays a string bundle into this. -->
|
||||
<stringbundleset id="stringbundleset"/>
|
||||
|
||||
<keyset>
|
||||
<key id="pageLeftKey" keycode="VK_PAGE_UP" oncommand="SnowlMessageView.doPageMove(-1)" disabled="true"/>
|
||||
<key id="pageRightKey" keycode="VK_PAGE_DOWN" oncommand="SnowlMessageView.doPageMove(1)" disabled="true"/>
|
||||
|
@ -70,20 +84,25 @@
|
|||
<toolbar id="toolbar">
|
||||
<!-- <toolbarbutton oncommand="dump(new XMLSerializer().serializeToString(document))"/> -->
|
||||
|
||||
<toolbarbutton id="writeButton" type="checkbox"
|
||||
image="chrome://snowl/content/icons/email_add.png"
|
||||
oncommand="SnowlMessageView.onToggleWrite(event)"
|
||||
tooltiptext="&writeButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="currentButton" type="checkbox"
|
||||
image="chrome://snowl/content/icons/newspaper.png"
|
||||
oncommand="SnowlMessageView.onCommandCurrentButton(event)"
|
||||
tooltiptext="¤tButton.tooltip;"/>
|
||||
image="chrome://snowl/content/icons/newspaper.png"
|
||||
oncommand="SnowlMessageView.onCommandCurrentButton(event)"
|
||||
tooltiptext="¤tButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="bodyButton" type="checkbox"
|
||||
image="chrome://snowl/content/icons/page_white_text.png"
|
||||
oncommand="SnowlMessageView.onCommandBodyButton(event)"
|
||||
tooltiptext="&bodyButton.tooltip;"/>
|
||||
image="chrome://snowl/content/icons/page_white_text.png"
|
||||
oncommand="SnowlMessageView.onCommandBodyButton(event)"
|
||||
tooltiptext="&bodyButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="columnsButton" type="checkbox"
|
||||
image="chrome://snowl/content/icons/application_view_columns.png"
|
||||
oncommand="SnowlMessageView.onCommandColumnsButton(event)"
|
||||
tooltiptext="&columnsButton.tooltip;"/>
|
||||
image="chrome://snowl/content/icons/application_view_columns.png"
|
||||
oncommand="SnowlMessageView.onCommandColumnsButton(event)"
|
||||
tooltiptext="&columnsButton.tooltip;"/>
|
||||
|
||||
<menulist id="periodMenu" oncommand="SnowlMessageView.onCommandPeriodMenu(event)">
|
||||
<menupopup id="periodMenuPopup">
|
||||
|
@ -120,6 +139,8 @@
|
|||
oncommand="SnowlMessageView.onFilter(event)"/>
|
||||
</toolbar>
|
||||
|
||||
<vbox id="writeForm"/>
|
||||
|
||||
<stack id="contentStack" flex="1">
|
||||
<html:div id="contentBox"
|
||||
onoverflow="SnowlMessageView.onFlowChange(event)"
|
||||
|
|
|
@ -173,12 +173,7 @@ let SnowlMessageView = {
|
|||
|
||||
gBrowserWindow.Snowl._initSnowlToolbar();
|
||||
|
||||
// For some reason setting hidden="true" in the XUL file prevents us
|
||||
// from showing the box later via writeForm.hidden = false, so we set it
|
||||
// here instead.
|
||||
// FIXME: file a bug on this abnormality.
|
||||
this._writeForm.hidden = true;
|
||||
|
||||
this._initWriteForm();
|
||||
this._updateWriteButton();
|
||||
},
|
||||
|
||||
|
@ -194,6 +189,14 @@ let SnowlMessageView = {
|
|||
window.setTimeout(function() { SnowlMessageView.onMidnight() }, msUntilMidnight);
|
||||
},
|
||||
|
||||
_initWriteForm: function() {
|
||||
// For some reason setting hidden="true" in the XUL file prevents us
|
||||
// from showing the box later via writeForm.hidden = false, so we set it
|
||||
// here instead.
|
||||
// FIXME: file a bug on this abnormality.
|
||||
this._writeForm.hidden = true;
|
||||
},
|
||||
|
||||
// Selectively enable/disable the button for writing a message depending on
|
||||
// whether or not the user has an account that supports writing.
|
||||
_updateWriteButton: function() {
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<script type="application/javascript" src="chrome://snowl/content/strands.js"/>
|
||||
<script type="application/javascript" src="chrome://snowl/content/stream.js"/>
|
||||
|
||||
<!-- write.xul overlays a string bundle into this. -->
|
||||
<stringbundleset id="stringbundleset"/>
|
||||
|
||||
<toolbar id="snowlToolbar"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче