Mercurial > snowl
changeset 366:d2636b3cd8e2
add toggle between message and message link to list view, missing pref
author | alta88 |
---|---|
date | Thu, 06 Nov 2008 12:22:28 -0700 |
parents | 03a77e6d86cd |
children | 6ede77153361 |
files | content/list.js content/list.xul defaults/preferences/snowl.js modules/utils.js |
diffstat | 4 files changed, 66 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/content/list.js Tue Nov 04 21:32:43 2008 -0800 +++ b/content/list.js Thu Nov 06 12:22:28 2008 -0700 @@ -240,6 +240,9 @@ // Don't rebuild the view if the list view hasn't been made visible yet // (in which case the tree won't yet have a view property). + // XXX problem: if some non viewed source updates, we loose our selection + // which is not good. not good even if our viewed source updates + // (additions).. need to rebuild for unsubscribe though (blank out view). if (this._tree.view) this._rebuildView(); }, @@ -393,7 +396,7 @@ }, onSelect: function(aEvent) { -this._log.info("onSelect - start: event.target.id = "+aEvent.target.id); +//this._log.info("onSelect - start: event.target.id = "+aEvent.target.id); if (this._tree.currentIndex == -1 || SnowlUtils.gRightMouseButtonDown) return; @@ -410,6 +413,8 @@ SnowlUtils.gListViewListIndex = row; this._setRead(true); + // If new message selected, reset for toggle + SnowlUtils.gMessagePosition.pageIndex = null; }, onKeyPress: function(aEvent) { @@ -429,6 +434,28 @@ this._openListMessage(aEvent); }, + onClick: function(aEvent) { + // Only for left click, button = 0.. + if (aEvent.button != 0) + return; + + // Figure out what cell the click was in + let row = {}, col = {}, child = {}; + this._tree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, child); + if (row.value == -1) + return; + + // If the cell is in a "cycler" column or if the user double clicked on + // the twisty, don't open the message in a new window + if (aEvent.detail == 2 && !col.value.cycler && (child.value != "twisty")) { + this._listDoubleClick(); + // Double clicking should not toggle the open / close state of the + // thread. This will happen if we don't prevent the event from + // bubbling to the default handler in tree.xml + aEvent.stopPropagation(); + } + }, + // Based on SpaceHit in mailWindowOverlay.js _onSpacePress: function(aEvent) { if (aEvent.shiftKey) { @@ -557,8 +584,36 @@ this._collection.sort(); }, + _listDoubleClick: function() { + // Special type? +// if () {} else + this._openListMessage(); + }, + + // Toggle between summary and web page (feeds); use back/forward to avoid + // slow reload, but must also reset this in case tab changes or a url is + // loaded from address bar or link is clicked (in onblur) or another item + // in the list is selected (in onSelect). _openListMessage: function(event) { -alert("openlistmessage"); + let row = this._tree.currentIndex; + let message = this._collection.messages[row]; + + // No message or link in this message + if (!message || typeof(message.link)=="undefined") + return; + + if (SnowlUtils.gMessagePosition.pageIndex == --gBrowser.sessionHistory.index) + window.BrowserBack(); + else + if (SnowlUtils.gMessagePosition.pageIndex == gBrowser.sessionHistory.index) + window.BrowserForward(); + else { + SnowlUtils.gMessagePosition.tabIndex = gBrowser.tabContainer.selectedIndex; + SnowlUtils.gMessagePosition.pageIndex = + (++gBrowser.sessionHistory.index == gBrowser.sessionHistory.maxLength) ? + --gBrowser.sessionHistory.index : gBrowser.sessionHistory.index; + window.loadURI(message.link, null, null, false); + } }, onListTreeMouseDown: function(aEvent) {
--- a/content/list.xul Tue Nov 04 21:32:43 2008 -0800 +++ b/content/list.xul Thu Nov 06 12:22:28 2008 -0700 @@ -108,6 +108,8 @@ sortResource="snowlTimestampCol" sortDirection="ascending" enableColumnDrag="true" disableKeyNavigation="true" onselect="SnowlMessageView.onSelect(event)" + onblur="SnowlUtils.gMessagePosition.pageIndex=null" + ondblclick="SnowlMessageView.onKeyPress(event)" onkeypress="SnowlMessageView.onKeyPress(event)"> <treecols> <treecol id="snowlAuthorCol" label="&authorCol.label;" flex="1" @@ -127,6 +129,7 @@ </treecols> <treechildren flex="1" context="snowlListContext" + onclick="SnowlMessageView.onClick(event)" onmousedown="SnowlMessageView.onListTreeMouseDown(event)"/> </tree> </vbox>
--- a/defaults/preferences/snowl.js Tue Nov 04 21:32:43 2008 -0800 +++ b/defaults/preferences/snowl.js Thu Nov 06 12:22:28 2008 -0700 @@ -1,2 +1,4 @@ // Header view pref: 0 = none, 1 = brief, 2= full pref("extensions.snowl.message.headerView", 1); +// Collections hierarchical view pref: 0 = flat, 1 = hierarchical +pref("extensions.snowl.collection.hierarchicalView", 0);
--- a/modules/utils.js Tue Nov 04 21:32:43 2008 -0800 +++ b/modules/utils.js Thu Nov 06 12:22:28 2008 -0700 @@ -252,6 +252,8 @@ // XXX store on document for restore on restart?? gListViewListIndex: null, gListViewCollectionIndex: null, + // Position of current page in tabs and history + gMessagePosition: {tabIndex: null, pageIndex: null}, // From Tb: Detect right mouse click and change the highlight to the row // where the click happened without loading the message headers in @@ -285,7 +287,7 @@ // clicked without loading the contents of the selected row. // It will also keep the outline/dotted line in the original row. ChangeSelectionWithoutContentLoad: function(aEvent, tree) { -this._log.info("change selection right click: tree.id = "+tree.id); +//this._log.info("change selection right click: tree.id = "+tree.id); let treeBoxObj = tree.treeBoxObject; let treeSelection = treeBoxObj.view.selection; @@ -326,7 +328,7 @@ // this.gListDeleteOrMoveOccurred = false; // return; // } -this._log.info("restore selection onpopuphidden: tree.id = "+tree.id); +//this._log.info("restore selection onpopuphidden: tree.id = "+tree.id); let treeSelection = tree.view.selection;