[Pkg-mozext-commits] [sage-extension] 20/54: Adding feed item list toolbar and cleaning up read state code to use commands.
David Prévot
taffit at moszumanska.debian.org
Fri May 1 03:10:37 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag sage_1_3
in repository sage-extension.
commit a171d713d883a933f18bcf4f236c8766a019a5ad
Author: Erik Arvidsson <erik.arvidsson at gmail.com>
Date: Wed Sep 29 17:34:37 2004 +0000
Adding feed item list toolbar and cleaning up read state code to use commands.
---
src/sage/content/sage.js | 505 +++++++++++++++++---------------
src/sage/content/sage.xul | 64 +++-
src/sage/locale/en-US/sage.dtd | 32 ++
src/sage/locale/en-US/sage.properties | 6 -
src/sage/skin/classic/sage.css | 60 +++-
src/sage/skin/classic/toolbar-small.png | Bin 0 -> 6963 bytes
6 files changed, 405 insertions(+), 262 deletions(-)
diff --git a/src/sage/content/sage.js b/src/sage/content/sage.js
index 2942b6b..027c710 100755
--- a/src/sage/content/sage.js
+++ b/src/sage/content/sage.js
@@ -65,6 +65,7 @@ function init() {
setCheckbox("chkShowSearchBar", "false");
setCheckbox("chkShowTooltip", "true");
setCheckbox("chkShowFeedItemList", "true");
+ setCheckbox("chkShowFeedItemListToolbar", "true");
}
// get feed folder location
@@ -79,6 +80,10 @@ function init() {
FeedSearch.init();
toggleShowSearchBar();
toggleShowFeedItemList();
+ toggleShowFeedItemListToolbar();
+
+ document.documentElement.controllers.appendController(readStateController);
+ readStateController.onCommandUpdate();
logMessage("initialized");
}
@@ -247,8 +252,8 @@ function rssItemListBoxClick(aEvent) {
var listItem = rssItemListBox.selectedItem;
var feedItem = getFeedItemFromListItem( listItem );
- openURI( feedItem.getLink(), aEvent );
listItem.setAttribute("visited", "true");
+ openURI(feedItem.getLink(), aEvent);
}
function rssTitleLabelClick(aNode, aEvent){
@@ -312,6 +317,12 @@ function toggleShowFeedItemList() {
if(showFeedItemList) setRssItemListBox();
}
+function toggleShowFeedItemListToolbar() {
+ var showFeedItemListToolbar = getCheckboxCheck("chkShowFeedItemListToolbar");
+ document.getElementById("itemListToolbar").hidden = !showFeedItemListToolbar;
+ if (showFeedItemListToolbar) readStateController.onCommandUpdate();
+}
+
function setRssItemListBox() {
if(!currentFeed) return;
if(document.getElementById("rssItemListBoxBox").hidden) return;
@@ -327,12 +338,14 @@ function setRssItemListBox() {
for(var i = 0; items.length > i; i++) {
var item = items[i];
var itemLabel = item.getTitle();
- itemLabel = (i+1) + ". " + itemLabel;
+ //itemLabel = (i+1) + ". " + itemLabel;
var listItem = rssItemListBox.appendItem(itemLabel, i);
- if(isVisited(item.getLink())) {
+ if(linkVisitor.getVisited(item.getLink())) {
listItem.setAttribute("visited", "true");
}
}
+
+ readStateController.onCommandUpdate();
}
function getCheckboxCheck(element_id) {
@@ -345,39 +358,6 @@ function setCheckbox(element_id, value) {
checkboxNode.setAttribute("checked", value);
}
-// TODO: Is this still used?
-function showRssItemListPopup(aEvent) {
- if(aEvent.originalTarget.localName != "listitem") {
- rssItemListPopup.hidePopup();
- return;
- }
- if(!getCheckboxCheck("chkShowTooltip")) {
- rssItemListPopup.hidePopup();
- return;
- }
-
- var feedItemOrder = CommonFunc.getPrefValue(CommonFunc.FEED_ITEM_ORDER, "str", "chrono");
-
- var items = currentFeed.getItems(feedItemOrder);
-
- var description = htmlToText(items[aEvent.originalTarget.value].getContent());
- if(description.indexOf("/") != -1) {
- description = description.replace(/\//gm, "/\u200B");
- }
- // description 400ȓɂ
- if(description.length > 400) {
- description = description.substring(0,400) + "...";
- }
-
- var popX = aEvent.screenX + 10;
- var popY = aEvent.screenY + 20;
-
- rssItemListPopup.title = aEvent.originalTarget.label;
- rssItemListPopup.description = description;
- rssItemListPopup.autoPosition = false;
- rssItemListPopup.moveTo(popX, popY);
- popupTimeoutId = setTimeout("rssItemListPopup.showPopup(rssItemListBox)", 150);
-}
function populateToolTip(e) {
// if setting disabled
@@ -405,12 +385,6 @@ function populateToolTip(e) {
rssItemToolTip.description = description;
}
-// TODO: Is this still used?
-function hideRssItemListPopup(aEvent) {
- clearTimeout(popupTimeoutId);
- rssItemListPopup.hidePopup();
-}
-
function htmlToText(aStr) {
var formatConverter = Components.classes["@mozilla.org/widget/htmlformatconverter;1"].createInstance(Components.interfaces.nsIFormatConverter);
var fromStr = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
@@ -533,259 +507,302 @@ function httpGetResult(aResultCode) {
}
}
+// This takes a list item from the rss list box and returns the uri it represents
+// this seems a bit inefficient. Shouldn't there be a direct mapping between these?
-// link visit code based on LinkVisitor.mozdev.org
-
-
-const _uriFixup = Components.classes["@mozilla.org/docshell/urifixup;1"].getService(Components.interfaces.nsIURIFixup);
-const _globalHistory = Components.classes['@mozilla.org/browser/global-history;2'].getService(Components.interfaces.nsIGlobalHistory2);
-const _browserHistory = Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory);
-
-function markURIAsRead( sURI )
-{
- markURIReadState( sURI, true );
-}
-
-function markURIAsUnread( sURI )
-{
- markURIReadState( sURI, false );
+/**
+ * This takes a listitem element and returns the FeedItem it represents
+ * @param oListItem : XULListItem
+ * @returns FeedItem
+ */
+function getFeedItemFromListItem( oListItem ) {
+ var feedItemOrder = CommonFunc.getPrefValue(CommonFunc.FEED_ITEM_ORDER, "str", "chrono");
+ var items = currentFeed.getItems(feedItemOrder);
+ return items[oListItem.value];
}
-function markURIReadState( sURI, bRead )
-{
- if ( !sURI )
- return;
-
- // why do we need to fixup the URI?
- var fixupURI = _getFixupURI( sURI );
- var visited = _globalHistory.isVisited( fixupURI );
- if ( visited == bRead )
- return;
-
- if ( bRead )
- _globalHistory.addURI( fixupURI, false, true );
- else
- _browserHistory.removePage( fixupURI );
-}
-function _getFixupURI( sURI )
-{
- try
- {
- return _uriFixup.createFixupURI( sURI, 0 );
+/**
+ * Opens a link in the same window, a new tab or a new window
+ *
+ * @param sURI : String
+ * @param oType : Object If this is an Event object we check the modifiers.
+ * Otherwise we assume it is a string describing the
+ * window type.
+ * @returns void
+ */
+function openURI(sURI, oType) {
+ var windowType;
+ if (oType instanceof Event) {
+ // figure out what kind of open we want
+ if (oType.button == 1 || oType.ctrlKey) // click middle button or ctrl click
+ windowType = "tab";
+ else if (oType.shiftKey)
+ windowType = "window";
}
- catch( e )
- {
- return null;
+ else {
+ windowType = oType;
}
-}
-function isVisited( sURI )
-{
- var fixupURI = _getFixupURI( sURI );
- return _globalHistory.isVisited( fixupURI );
-}
+ switch (windowType) {
+ case "tab":
+ getContentBrowser().addTab(sURI);
+ break;
+ case "window":
+ document.commandDispatcher.focusedWindow.open(sURI);
+ break;
+ default:
+ getContentBrowser().loadURI(sURI);
+ }
-// RSS Item Context Menu
+ readStateController.onCommandUpdate();
+}
/**
- * This is called before the context menu for the listbox is shown. Here we enabled/disable
- * menu items as well as change the text to correctly reflect the read state
- * @param e : Event
+ * This is called by the context menu
+ * @param oType : String
* @returns void
*/
-function updateItemContextMenu( e )
-{
- var popupNode = document.popupNode;
-
- var menuItemIds = ["rssOpenItem", "rssOpenNewTabItem", "rssOpenNewWindowItem",
- "rssMarkAsReadItem", "rssMarkAllAsReadItem", "rssMarkAllAsUnreadItem"];
- var menuItems = {};
- for ( var i = 0; i < menuItemIds.length; i++ )
- {
- menuItems[ menuItemIds[i] ] = document.getElementById( menuItemIds[i] );
- }
-
- // cmd_bm_open
- // cmd_bm_openinnewwindow
- // cmd_bm_openinnewtab
- menuItems.rssOpenItem.label = bmStrRes.getString("cmd_bm_open");
- menuItems.rssOpenNewTabItem.label = bmStrRes.getString("cmd_bm_openinnewtab");
- menuItems.rssOpenNewWindowItem.label = bmStrRes.getString("cmd_bm_openinnewwindow");
-
- menuItems.rssMarkAsReadItem.label = strRes.getString("itemcontext_markasread");
- menuItems.rssMarkAllAsReadItem.label = strRes.getString("itemcontext_markallasread");
- menuItems.rssMarkAllAsUnreadItem.label = strRes.getString("itemcontext_markallasunread");
-
- if ( popupNode.localName == "listbox" )
- {
- // only mark all should work
- for ( var id in menuItems )
- {
- if ( (id == "rssMarkAllAsReadItem" || id == "rssMarkAllAsUnreadItem") &&
- currentFeed && rssItemListBox.getRowCount() > 0 )
- menuItems[id].removeAttribute( "disabled" );
- else
- menuItems[id].setAttribute( "disabled", "true" );;
- }
- }
- else
- {
- for ( id in menuItems )
- menuItems[id].removeAttribute( "disabled" );
-
- // need to figure out if the current list item is visited
- var listItem = popupNode;
- var feedItem = getFeedItemFromListItem( listItem );
- var visited = isVisited( feedItem.getLink() );
- menuItems.rssMarkAsReadItem.label =
- strRes.getString( visited ? "itemcontext_markasunread" : "itemcontext_markasread" );
-
- // lets make sure the visited flag is correct in the ui
- if ( visited )
- listItem.setAttribute( "visited", "true" );
- else
- listItem.removeAttribute( "visited" );
- }
+function openListItem(oType) {
+ var listItem = document.popupNode;
+ var feedItem = getFeedItemFromListItem(listItem);
+ listItem.setAttribute("visited", "true");
+ openURI(feedItem.getLink(), oType);
}
+// link visit code based on LinkVisitor.mozdev.org
-/**
- * This marks the selected items as read/unread. This works with multiple
- * selection as well if we want to enable that in the future.
- * @param e : Event
- * @returns void
- */
-function toggleMarkAsRead( e )
-{
- var listItems = rssItemListBox.selectedItems;
- for ( var i = 0; i < listItems.length; i++ )
- {
- var listItem = listItems[i];
- var feedItem = getFeedItemFromListItem( listItem );
- var uri = feedItem.getLink();
- var visited = isVisited( uri );
- markURIReadState( uri, !visited );
- if ( !visited )
- listItem.setAttribute( "visited", "true" );
+
+var linkVisitor = {
+ _uriFixup : Components.classes["@mozilla.org/docshell/urifixup;1"].getService(Components.interfaces.nsIURIFixup),
+ _globalHistory : Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIGlobalHistory2),
+ _browserHistory : Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory),
+
+ setVisited: function (sURI, bRead) {
+ if (!sURI)
+ return;
+
+ // why do we need to fixup the URI?
+ var fixupURI = this._getFixupURI(sURI);
+ if (fixupURI == null)
+ return;
+ if (bRead)
+ this._globalHistory.addURI(fixupURI, false, true);
else
- listItem.removeAttribute( "visited" );
+ this._browserHistory.removePage(fixupURI);
+ },
+
+ getVisited : function (sURI) {
+ var fixupURI = this._getFixupURI(sURI);
+ if (fixupURI == null)
+ return false;
+ return this._globalHistory.isVisited(fixupURI);
+ },
+
+ _getFixupURI : function (sURI) {
+ try {
+ return this._uriFixup.createFixupURI(sURI, 0);
+ }
+ catch (e) {
+ logMessage("Could not fixup URI: " + sURI);
+ return null;
+ }
}
-}
+};
-/**
- * This called from the context menu.
- * @param e : Event
- * @returns void
- */
-function markAllAsRead( e )
-{
- markAllReadState( true );
-}
+
+
+// RSS Item Context Menu
/**
- * This called from the context menu.
- * @param e : Event
+ * This is called before the context menu for the listbox is shown. Here we
+ * enabled/disable menu items as well as change the text to correctly reflect
+ * the read state
* @returns void
*/
-function markAllAsUnread( e )
-{
- markAllReadState( false );
+function updateItemContextMenu() {
+ readStateController.onCommandUpdate();
+ document.getElementById("rssMarkAsReadItem").hidden =
+ !readStateController.isCommandEnabled("cmd_markasread");
+ document.getElementById("rssMarkAsUnreadItem").hidden =
+ !readStateController.isCommandEnabled("cmd_markasunread");
}
+
/**
* Marks all read or unread
* @param bRead : Boolean Whether to mark as read or unread
* @returns void
*/
-function markAllReadState( bRead )
-{
- if ( currentFeed )
- {
+function markAllReadState(bRead) {
+ if (currentFeed) {
var feedItemOrder = CommonFunc.getPrefValue(CommonFunc.FEED_ITEM_ORDER, "str", "chrono");
- var feedItems = currentFeed.getItems( feedItemOrder );
+ var feedItems = currentFeed.getItems(feedItemOrder);
- for ( var i = 0; i < feedItems.length; i++ )
- markURIReadState( feedItems[i].getLink(), bRead );
+ for (var i = 0; i < feedItems.length; i++)
+ linkVisitor.setVisited(feedItems[i].getLink(), bRead);
var listItem;
- for ( var y = 0; y < rssItemListBox.getRowCount(); y++ )
+ for (var y = 0; y < rssItemListBox.getRowCount(); y++)
{
- listItem = rssItemListBox.getItemAtIndex( y );
- if ( bRead )
- listItem.setAttribute( "visited", "true" );
+ listItem = rssItemListBox.getItemAtIndex(y);
+ if (bRead)
+ listItem.setAttribute("visited", "true");
else
- listItem.removeAttribute( "visited" );
+ listItem.removeAttribute("visited");
}
}
}
-// This takes a list item from the rss list box and returns the uri it represents
-// this seems a bit inefficient. Shouldn't there be a direct mapping between these?
/**
- * This takes a listitem element and returns the FeedItem it represents
- * @param oListItem : XULListItem
- * @returns FeedItem
+ * This marks the selected items as read/unread. This works with multiple
+ * selection as well if we want to enable that in the future.
+ * @param bRead : Boolean Whether to mark items read or unread
+ * @returns void
*/
-function getFeedItemFromListItem( oListItem )
-{
- var feedItemOrder = CommonFunc.getPrefValue(CommonFunc.FEED_ITEM_ORDER, "str", "chrono");
- var items = currentFeed.getItems( feedItemOrder );
- return items[ oListItem.value ];
+function markReadState(bRead) {
+ var listItems = rssItemListBox.selectedItems;
+ for (var i = 0; i < listItems.length; i++) {
+ var listItem = listItems[i];
+ var feedItem = getFeedItemFromListItem(listItem);
+ var uri = feedItem.getLink();
+ if (bRead)
+ listItem.setAttribute("visited", "true");
+ else
+ listItem.removeAttribute("visited");
+ linkVisitor.setVisited(uri, bRead);
+ }
}
-
-
/**
- * Opens a link in the same window, a new tab or a new window
+ * This toggles the selected items read state. This works with multiple
+ * selection as well if we want to enable that in the future.
+ *
+ * In Thunderbird, pressing M marks all read on unread based on the first
+ * item. This seems more consistent and more useful
*
- * @param sURI : String
- * @param oType : Object If this is an Event object we check the modifiers.
- * Otherwise we assume it is a string describing the
- * window type.
* @returns void
*/
-function openURI( sURI, oType )
-{
- var windowType;
- if ( oType instanceof Event )
- {
- // figure out what kind of open we want
- if ( oType.button == 1 || oType.ctrlKey ) // click middle button or ctrl click
- windowType = "tab";
- else if ( oType.shiftKey )
- windowType = "window";
- }
- else
- {
- windowType = oType;
- }
-
- switch ( windowType )
- {
- case "tab":
- getContentBrowser().addTab( sURI );
- break;
- case "window":
- document.commandDispatcher.focusedWindow.open( sURI );
- break;
-
- default:
- getContentBrowser().loadURI( sURI );
+function toggleMarkAsRead() {
+ var listItems = rssItemListBox.selectedItems;
+ var read;
+ for (var i = 0; i < listItems.length; i++) {
+ var listItem = listItems[i];
+ var feedItem = getFeedItemFromListItem(listItem);
+ var uri = feedItem.getLink();
+ if (read == null)
+ read = !linkVisitor.getVisited(uri);
+ if (read)
+ listItem.setAttribute("visited", "true");
+ else
+ listItem.removeAttribute("visited");
+ linkVisitor.setVisited(uri, read);
}
}
+
/**
- * This is called by the context menu
- * @param oType : String
- * @returns void
+ * This controller object takes care of the commands related to marking feed
+ * items as read
*/
-function openListItem( oType )
-{
- var listItem = document.popupNode;
- var feedItem = getFeedItemFromListItem( listItem );
- openURI( feedItem.getLink(), oType );
- listItem.setAttribute( "visited", "true" );
-}
+var readStateController = {
+ supportsCommand : function(cmd) {
+ switch (cmd) {
+ case "cmd_markasread":
+ case "cmd_markasunread":
+ case "cmd_toggleread":
+ case "cmd_markallasread":
+ case "cmd_markallasunread":
+ return true;
+ default:
+ return false;
+ }
+ },
+
+ isCommandEnabled : function(cmd) {
+ var items, feedItem, visited, i;
+
+ if (!getCheckboxCheck("chkShowFeedItemList"))
+ return false;
+
+ switch (cmd) {
+ // Enable if any items available. A more exact solution is to loop
+ // over the item and disable/enable dependiong on whether all items
+ // are read/unread. This solution is however too slow to be practical.
+ case "cmd_markallasread":
+ case "cmd_markallasunread":
+ return rssItemListBox.getRowCount() > 0;
+
+ // There is a state where we mark a listitem as visited even though
+ // we don't know if the server will respond and therefore the link
+ // might be unread in the history and read in the UI. In these cases
+ // both mark as read and mark as unread needs to be enabled
+
+ case "cmd_markasread":
+ items = rssItemListBox.selectedItems;
+
+ // if we have one non visited we can mark as read
+ for (i = 0; i < items.length; i++) {
+ feedItem = getFeedItemFromListItem( items[i] );
+ visited = linkVisitor.getVisited( feedItem.getLink() );
+ if (!visited || items[i].getAttribute("visited") != "true")
+ return true;
+ }
+ return false;
+
+ case "cmd_markasunread":
+ items = rssItemListBox.selectedItems;
+
+ // if we have one visited we can mark as unread
+ for (i = 0; i < items.length; i++) {
+ feedItem = getFeedItemFromListItem( items[i] );
+ visited = linkVisitor.getVisited( feedItem.getLink() );
+ if (visited || items[i].getAttribute("visited") == "true")
+ return true;
+ }
+ return false;
+
+ case "cmd_toggleread":
+ return this.isCommandEnabled("cmd_markasread") ||
+ this.isCommandEnabled("cmd_markasunread");
+ }
+
+ return false;
+ },
+ doCommand : function(cmd) {
+ switch (cmd) {
+ case "cmd_markasread":
+ markReadState(true);
+ break;
+
+ case "cmd_markasunread":
+ markReadState(false);
+ break;
+
+ case "cmd_toggleread":
+ toggleMarkAsRead();
+ break;
+
+ case "cmd_markallasread":
+ markAllReadState(true);
+ break;
+
+ case "cmd_markallasunread":
+ markAllReadState(false);
+ break;
+ }
+ this.onCommandUpdate();
+ },
+
+ onCommandUpdate: function () {
+ var commands = ["cmd_markasread", "cmd_markasunread",
+ "cmd_toggleread",
+ "cmd_markallasread", "cmd_markallasunread"];
+ for (var i = 0; i < commands.length; i++)
+ goSetCommandEnabled(commands[i], this.isCommandEnabled(commands[i]));
+ },
+
+ onEvent : function(evt){ }
+};
diff --git a/src/sage/content/sage.xul b/src/sage/content/sage.xul
index fefb781..c7aeb1f 100755
--- a/src/sage/content/sage.xul
+++ b/src/sage/content/sage.xul
@@ -38,6 +38,33 @@
<command id="cmd_bm_newseparator" oncommand="goDoCommand('cmd_bm_newseparator');"/>
<command id="cmd_bm_find" oncommand="goDoCommand('cmd_bm_find');"/>
<command id="cmd_bm_properties" oncommand="goDoCommand('cmd_bm_properties');"/>
+ <command id="cmd_bm_sortbyname" oncommand="goDoCommand('cmd_bm_sortbyname');"/>
+</commandset>
+
+<keyset>
+ <key id="key_toggleread" key="&toggleReadState.command.key;" command="cmd_toggleread"/>
+ <key id="key_markallasread" modifiers="&markAllAsRead.command.modifiers;"
+ key="&markAllAsRead.command.key;" command="cmd_markallasread"/>
+</keyset>
+
+<commandset id="readCommands">
+ <command id="cmd_markasread" oncommand="readStateController.doCommand('cmd_markasread')"
+ tooltiptext="&markAsRead.command.tooltip;"
+ label="&markAsRead.command.label;"
+ accesskey="&markAsRead.command.accesskey;"/>
+ <command id="cmd_markasunread" oncommand="readStateController.doCommand('cmd_markasunread')"
+ label="&markAsUnread.command.label;"
+ tooltiptext="&markAsUnread.command.tooltip;"
+ accesskey="&markAsUnread.command.accesskey;"/>
+ <command id="cmd_toggleread" oncommand="readStateController.doCommand('cmd_toggleread')"/>
+ <command id="cmd_markallasread" oncommand="readStateController.doCommand('cmd_markallasread')"
+ label="&markAllAsRead.command.label;"
+ tooltiptext="&markAllAsRead.command.tooltip;"
+ accesskey="&markAllAsRead.command.accesskey;"/>
+ <command id="cmd_markallasunread" oncommand="readStateController.doCommand('cmd_markallasunread')"
+ label="&markAllAsUnread.command.label;"
+ tooltiptext="&markAllAsUnread.command.tooltip;"
+ accesskey="&markAllAsUnread.command.accesskey;"/>
</commandset>
<stringbundleset>
@@ -55,6 +82,7 @@
<menuitem id="chkShowSearchBar" type="checkbox" persist="checked" label="&menu.showSearchBar;" oncommand="toggleShowSearchBar()"/>
<menuitem id="chkShowTooltip" type="checkbox" persist="checked" label="&menu.showDescTooltip;"/>
<menuitem id="chkShowFeedItemList" type="checkbox" persist="checked" label="&menu.showFeedItemList;" oncommand="toggleShowFeedItemList()"/>
+ <menuitem id="chkShowFeedItemListToolbar" type="checkbox" persist="checked" label="&menu.showFeedItemListToolbar;" oncommand="toggleShowFeedItemListToolbar()"/>
<menuseparator/>
<menuitem label="&menu.manageRSSList;" oncommand="manageRSSList()"/>
<menuitem label="&menu.opmlImportExport;" oncommand="openOPMLWizard()"/>
@@ -94,21 +122,31 @@
ondraggesture="if(event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, this.DNDObserver);"
onclick="bookmarksTreeClick(event)"/>
</vbox>
-
+
<splitter id="sage-splitter"/>
-
+
<vbox id="rssItemListBoxBox" flex="1" persist="height">
<sidebarheader id="feedTitleBar" align="center">
<hbox align="center" flex="1">
<label id="rssTitleLabel" flex="1" crop="end" value="" onclick="rssTitleLabelClick(this, event)"/>
</hbox>
</sidebarheader>
-
+
+ <toolbox class="plain">
+ <toolbar class="plain" id="itemListToolbar">
+ <toolbarbutton id="markAsReadButton" class="sage_button" command="cmd_markasread"/>
+ <toolbarbutton id="markAsUnreadButton" class="sage_button" command="cmd_markasunread"/>
+ <toolbarbutton id="markAllAsReadButton" class="sage_button" command="cmd_markallasread"/>
+ <toolbarbutton id="markAllAsUnreadButton" class="sage_button" command="cmd_markallasunread"/>
+ </toolbar>
+ </toolbox>
+
<listbox id="rssItemListBox" class="plain" flex="1"
tooltip="rssItemToolTip"
contextmenu="rssItemListBoxContextMenu"
onkeypress="if(event.keyCode == 13) rssItemListBoxClick(event)"
- onclick="rssItemListBoxClick(event)"/>
+ onclick="rssItemListBoxClick(event)"
+ onselect="readStateController.onCommandUpdate()"/>
</vbox>
</vbox>
@@ -125,14 +163,18 @@
</popup>
<popup id="rssItemListBoxContextMenu"
- onpopupshowing="updateItemContextMenu(event)">
- <menuitem id="rssOpenItem" default="true" oncommand="openListItem()"/>
- <menuitem id="rssOpenNewTabItem" oncommand="openListItem('tab')"/>
- <menuitem id="rssOpenNewWindowItem" oncommand="openListItem('window')"/>
+ onpopupshowing="updateItemContextMenu()">
+ <menuitem id="rssOpenItem" default="true" oncommand="openListItem()"
+ label="&openLinkInWindow.label;" accesskey="&openLinkInWindow.accesskey;"/>
+ <menuitem id="rssOpenNewTabItem" oncommand="openListItem('tab')"
+ label="&openInNewTab.label;" accesskey="&openInNewTab.accesskey;"/>
+ <menuitem id="rssOpenNewWindowItem" oncommand="openListItem('window')"
+ label="&openInNewWindow.label;" accesskey="&openInNewWindow.accesskey;"/>
<menuseparator/>
- <menuitem id="rssMarkAsReadItem" oncommand="toggleMarkAsRead(event)"/>
- <menuitem id="rssMarkAllAsReadItem" oncommand="markAllAsRead(event)"/>
- <menuitem id="rssMarkAllAsUnreadItem" oncommand="markAllAsUnread(event)"/>
+ <menuitem id="rssMarkAsReadItem" command="cmd_markasread"/>
+ <menuitem id="rssMarkAsUnreadItem" command="cmd_markasunread"/>
+ <menuitem id="rssMarkAllAsReadItem" command="cmd_markallasread"/>
+ <menuitem id="rssMarkAllAsUnreadItem" command="cmd_markallasunread"/>
</popup>
</popupset>
diff --git a/src/sage/locale/en-US/sage.dtd b/src/sage/locale/en-US/sage.dtd
index 015cb36..4ba35c2 100755
--- a/src/sage/locale/en-US/sage.dtd
+++ b/src/sage/locale/en-US/sage.dtd
@@ -9,6 +9,7 @@
<!ENTITY menu.view "View">
<!ENTITY menu.showSearchBar "Show Feed Search Bar">
<!ENTITY menu.showFeedItemList "Show Feed Item List">
+<!ENTITY menu.showFeedItemListToolbar "Show Feed Item List Toolbar">
<!ENTITY menu.showDescTooltip "Show Description Tooltips">
<!ENTITY menu.openHTML "Open Feeds In Contents Area">
<!ENTITY menu.tools "Options">
@@ -50,3 +51,34 @@
<!ENTITY openSageSidebar.commandkey "S">
<!ENTITY openSageSidebar.modifiersKey "alt">
+
+<!-- These are taken from history.dtd -->
+<!ENTITY openLinkInWindow.label "Open">
+<!ENTITY openLinkInWindow.accesskey "O">
+<!ENTITY openInNewTab.label "Open in New Tab">
+<!ENTITY openInNewTab.accesskey "T">
+<!ENTITY openInNewWindow.label "Open in New Window">
+<!ENTITY openInNewWindow.accesskey "W">
+
+<!-- Read State -->
+<!ENTITY markAsRead.command.label "Mark as Read">
+<!ENTITY markAsRead.command.tooltip "Mark as Read">
+<!ENTITY markAsRead.command.accesskey "R">
+
+<!ENTITY markAsUnread.command.label "Mark as Unread">
+<!ENTITY markAsUnread.command.tooltip "Mark as Unread">
+<!ENTITY markAsUnread.command.accesskey "U">
+
+<!ENTITY markAllAsRead.command.label "Mark All as Read">
+<!ENTITY markAllAsRead.command.tooltip "Mark All as Read">
+<!ENTITY markAllAsRead.command.accesskey "A">
+<!ENTITY markAllAsRead.command.key "C">
+<!ENTITY markAllAsRead.command.modifiers "accel shift">
+
+<!ENTITY markAllAsUnread.command.label "Mark All as Unread">
+<!ENTITY markAllAsUnread.command.tooltip "Mark All as Unread">
+<!ENTITY markAllAsUnread.command.accesskey "n">
+
+<!ENTITY toggleReadState.command.key "M">
+
+
diff --git a/src/sage/locale/en-US/sage.properties b/src/sage/locale/en-US/sage.properties
index 607a971..6412292 100755
--- a/src/sage/locale/en-US/sage.properties
+++ b/src/sage/locale/en-US/sage.properties
@@ -82,9 +82,3 @@ date_november = November
date_november_short = Nov
date_december = December
date_december_short = Dec
-
-# Item context menu
-itemcontext_markasread = Mark as Read
-itemcontext_markasunread = Mark as Unread
-itemcontext_markallasread = Mark All as Read
-itemcontext_markallasunread = Mark All as Unread
diff --git a/src/sage/skin/classic/sage.css b/src/sage/skin/classic/sage.css
index eb0f4b4..3b9e25d 100755
--- a/src/sage/skin/classic/sage.css
+++ b/src/sage/skin/classic/sage.css
@@ -94,6 +94,64 @@ treechildren::-moz-tree-cell-text(rss, updated) {
}
+/* ++++++++++ List Tool Bar ++++++++++++ */
+
+toolbarbutton#markAsReadButton,
+toolbarbutton#markAsUnreadButton,
+toolbarbutton#markAllAsReadButton,
+toolbarbutton#markAllAsUnreadButton {
+ list-style-image: url("chrome://sage/skin/toolbar-small.png") !important;
+}
+
+#markAsReadButton {
+ -moz-image-region: rect(0px 80px 16px 64px) !important;
+}
+
+#markAsReadButton:hover {
+ -moz-image-region: rect(16px 80px 32px 64px) !important;
+}
+
+#markAsReadButton[disabled="true"] {
+ -moz-image-region: rect(32px 80px 48px 64px) !important;
+}
+
+#markAsUnreadButton {
+ -moz-image-region: rect(0px 96px 16px 80px) !important;
+}
+
+#markAsUnreadButton:hover {
+ -moz-image-region: rect(16px 96px 32px 80px) !important;
+}
+
+#markAsUnreadButton[disabled="true"] {
+ -moz-image-region: rect(32px 96px 48px 80px) !important;
+}
+
+#markAllAsReadButton {
+ -moz-image-region: rect(0px 48px 16px 32px) !important;
+}
+
+#markAllAsReadButton:hover {
+ -moz-image-region: rect(16px 48px 32px 32px) !important;
+}
+
+#markAllAsReadButton[disabled="true"] {
+ -moz-image-region: rect(32px 48px 48px 32px) !important;
+}
+
+#markAllAsUnreadButton {
+ -moz-image-region: rect(0px 64px 16px 48px) !important;
+}
+
+#markAllAsUnreadButton:hover {
+ -moz-image-region: rect(16px 64px 32px 48px) !important;
+}
+
+#markAllAsUnreadButton[disabled="true"] {
+ -moz-image-region: rect(32px 64px 48px 48px) !important;
+}
+
+
/* ++++++++++ Search ++++++++++ */
#barSearch {
padding-bottom: 2px;
@@ -133,4 +191,4 @@ treechildren::-moz-tree-cell-text(rss, updated) {
.popupex-internal-box {
margin: 2px;
padding: 2px;
-}
\ No newline at end of file
+}
diff --git a/src/sage/skin/classic/toolbar-small.png b/src/sage/skin/classic/toolbar-small.png
new file mode 100644
index 0000000..0e64ac3
Binary files /dev/null and b/src/sage/skin/classic/toolbar-small.png differ
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/sage-extension.git
More information about the Pkg-mozext-commits
mailing list