add toggle between message and message link to list view, missing pref

This commit is contained in:
alta88 2008-11-06 12:22:28 -07:00
Родитель 2e00e647b0
Коммит 4e97fd9468
4 изменённых файлов: 66 добавлений и 4 удалений

Просмотреть файл

@ -240,6 +240,9 @@ this._log.info("get rowCount: " + this._collection.messages.length);
// 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 @@ this._log.info("get rowCount: " + this._collection.messages.length);
},
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 @@ this._log.info("onSelect - start: event.target.id = "+aEvent.target.id);
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._log.info("onSelect - start: event.target.id = "+aEvent.target.id);
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._log.info("_toggleRead: all? " + aAll);
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) {

Просмотреть файл

@ -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>

Просмотреть файл

@ -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);

Просмотреть файл

@ -252,6 +252,8 @@ let SnowlUtils = {
// 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 @@ this._log.info("row: "+ row.value + " is not selected");
// 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._log.info("change selection right click: tree.id = "+tree.id);
// 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;