Changes to use onselect in threadpane. Make Next Message and Next Unread Message work

as well.
This commit is contained in:
putterman%netscape.com 1999-08-23 02:58:28 +00:00
Родитель 0bcf491f93
Коммит ac339b80c0
7 изменённых файлов: 39 добавлений и 39 удалений

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

@ -120,7 +120,7 @@ function ComposeMessage(type, format)
var tree = GetThreadTree(); var tree = GetThreadTree();
if (tree) if (tree)
{ {
var nodeList = tree.getElementsByAttribute("selected", "true"); var nodeList = tree.selectedItems;
var appCore = FindMessenger(); var appCore = FindMessenger();
if (appCore) if (appCore)
appCore.SetWindow(window, statusFeedback); appCore.SetWindow(window, statusFeedback);
@ -172,7 +172,7 @@ function NewMessage()
function GetNewMessages() function GetNewMessages()
{ {
var folderTree = GetFolderTree();; var folderTree = GetFolderTree();;
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true"); var selectedFolderList = folderTree.selectedItems;
if(selectedFolderList.length > 0) if(selectedFolderList.length > 0)
{ {
var selectedFolder = selectedFolderList[0]; var selectedFolder = selectedFolderList[0];
@ -263,7 +263,7 @@ function MsgPreferences()
function GetSelectedFolderResource() function GetSelectedFolderResource()
{ {
var folderTree = GetFolderTree(); var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true"); var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0]; var selectedFolder = selectedFolderList[0];
var uri = selectedFolder.getAttribute('id'); var uri = selectedFolder.getAttribute('id');
@ -316,11 +316,13 @@ function ToggleMessageRead(treeItem)
messenger.MarkMessageRead(tree.database, treeItem, unread); messenger.MarkMessageRead(tree.database, treeItem, unread);
} }
function ThreadPaneSelectionChange() function ThreadPaneSelectionChange(selectedElement)
{ {
var doc = GetThreadPane().document; var tree = GetThreadTree();
var selArray = doc.getElementsByAttribute('selected', 'true'); var selArray = tree.selectedItems;
dump('In ThreadPaneSelectionChange(). Num Selected Items = ' + selArray.length);
dump('\n');
if ( selArray && (selArray.length == 1) ) if ( selArray && (selArray.length == 1) )
LoadMessage(selArray[0]); LoadMessage(selArray[0]);
else else
@ -336,38 +338,32 @@ function ClearMessagePane()
function GoNextMessage() function GoNextMessage()
{ {
var doc = GetThreadPane().document; var tree = GetThreadTree();
var selArray = doc.getElementsByAttribute('selected', 'true'); var selArray = tree.selectedItems;
if ( selArray && (selArray.length == 1) ) if ( selArray && (selArray.length == 1) )
{ {
var nextMessage = GetNextMessage(selArray[0]); var nextMessage = GetNextMessage(selArray[0]);
if(nextMessage) if(nextMessage)
{ {
var selectedVal = selArray[0].getAttribute('selected'); tree.clearItemSelection();
dump('selectedVal = ' + selectedVal); tree.selectItem(nextMessage);
selArray[0].removeAttribute('selected');
nextMessage.setAttribute('selected', 'true');
} }
} }
} }
function GoNextUnreadMessage() function GoNextUnreadMessage()
{ {
var doc = GetThreadPane().document; var tree = GetThreadTree();
var selArray = doc.getElementsByAttribute('selected', 'true'); var selArray = tree.selectedItems;
if ( selArray && (selArray.length == 1) ) if ( selArray && (selArray.length == 1) )
{ {
var nextMessage = GetNextUnreadMessage(selArray[0]); var nextMessage = GetNextUnreadMessage(selArray[0]);
if(nextMessage) if(nextMessage)
{ {
var selectedVal = selArray[0].getAttribute('selected'); tree.clearItemSelection();
dump('selectedVal = ' + selectedVal); tree.selectItem(nextMessage);
selArray[0].removeAttribute('selected');
nextMessage.setAttribute('selected', 'true');
} }
} }
} }

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

@ -32,7 +32,7 @@ Rights Reserved.
<html:div flex="100%"> <html:div flex="100%">
<tree style="height: 100%" datasources="rdf:null" id="threadTree" <tree style="height: 100%" datasources="rdf:null" id="threadTree"
onchange="top.ThreadPaneSelectionChange()" onselect="top.ThreadPaneSelectionChange(event.target)"
containment="http://home.netscape.com/NC-rdf#MessageChild"> containment="http://home.netscape.com/NC-rdf#MessageChild">
<template> <template>

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

@ -76,7 +76,7 @@ function MsgDeleteMessage(fromToolbar)
} }
dump("tree is valid\n"); dump("tree is valid\n");
//get the selected elements //get the selected elements
var messageList = tree.getElementsByAttribute("selected", "true"); var messageList = tree.selectedItems;
//get the current folder //get the current folder
messenger.DeleteMessages(tree, srcFolder, messageList); messenger.DeleteMessages(tree, srcFolder, messageList);
} }
@ -86,7 +86,7 @@ function MsgDeleteFolder()
{ {
//get the selected elements //get the selected elements
var tree = GetFolderTree(); var tree = GetFolderTree();
var folderList = tree.getElementsByAttribute("selected", "true"); var folderList = tree.selectedItems;
var i; var i;
var folder, parent; var folder, parent;
for(i = 0; i < folderList.length; i++) for(i = 0; i < folderList.length; i++)
@ -148,9 +148,11 @@ function MsgCopyMessage(destFolder)
if(tree) if(tree)
{ {
//Get the selected messages to copy //Get the selected messages to copy
var messageList = tree.getElementsByAttribute("selected", "true"); var messageList = tree.selectedItems;
//get the current folder //get the current folder
// dump('In copy messages. Num Selected Items = ' + messageList.length);
// dump('\n');
var srcFolder = GetThreadTreeFolder(); var srcFolder = GetThreadTreeFolder();
messenger.CopyMessages(tree.database, srcFolder, destFolder, messageList, false); messenger.CopyMessages(tree.database, srcFolder, destFolder, messageList, false);
} }
@ -166,7 +168,7 @@ function MsgMoveMessage(destFolder)
if(tree) if(tree)
{ {
//Get the selected messages to copy //Get the selected messages to copy
var messageList = tree.getElementsByAttribute("selected", "true"); var messageList = tree.selectedItems;
//get the current folder //get the current folder
var srcFolder = GetThreadTreeFolder(); var srcFolder = GetThreadTreeFolder();
messenger.CopyMessages(tree.database, srcFolder, destFolder, messageList, true); messenger.CopyMessages(tree.database, srcFolder, destFolder, messageList, true);
@ -236,7 +238,7 @@ function MsgSortBySubject()
function MsgNewFolder() function MsgNewFolder()
{ {
var folderTree = GetFolderTree(); var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true"); var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0]; var selectedFolder = selectedFolderList[0];
if (selectedFolder) if (selectedFolder)
{ {
@ -252,7 +254,7 @@ function MsgNewFolder()
function NewFolder(name) function NewFolder(name)
{ {
var folderTree = GetFolderTree(); var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true"); var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0]; var selectedFolder = selectedFolderList[0];
messenger.NewFolder(folderTree.database, selectedFolder, name); messenger.NewFolder(folderTree.database, selectedFolder, name);
@ -294,7 +296,7 @@ function MsgRenameFolder()
var tree = GetFolderTree(); var tree = GetFolderTree();
if (tree) if (tree)
{ {
var folderList = tree.getElementsByAttribute("selected", "true"); var folderList = tree.selectedItems;
if (folderList && folderList.length == 1) if (folderList && folderList.length == 1)
{ {
var folder = folderList[0]; var folder = folderList[0];
@ -316,7 +318,7 @@ function RenameFolder(name)
var tree = GetFolderTree(); var tree = GetFolderTree();
if (tree) if (tree)
{ {
var folderList = tree.getElementsByAttribute("selected", "true"); var folderList = tree.selectedItems;
if (folderList && folderList.length == 1) if (folderList && folderList.length == 1)
{ {
var folder = folderList[0]; var folder = folderList[0];
@ -331,7 +333,7 @@ function MsgEmptyTrash()
var tree = GetFolderTree(); var tree = GetFolderTree();
if (tree) if (tree)
{ {
var folderList = tree.getElementsByAttribute("selected", "true"); var folderList = tree.selectedItems;
if (folderList) if (folderList)
{ {
var folder; var folder;
@ -354,7 +356,7 @@ function MsgCompactFolder()
var tree = GetFolderTree(); var tree = GetFolderTree();
if (tree) if (tree)
{ {
var folderList = tree.getElementsByAttribute("selected", "true"); var folderList = tree.selectedItems;
if (folderList) if (folderList)
{ {
var i; var i;
@ -469,7 +471,7 @@ function MsgMarkMsgAsRead(markRead)
dump("\MsgMarkMsgAsRead from XUL\n"); dump("\MsgMarkMsgAsRead from XUL\n");
var tree = GetThreadTree(); var tree = GetThreadTree();
//get the selected elements //get the selected elements
var messageList = tree.getElementsByAttribute("selected", "true"); var messageList = tree.selectedItems;
messenger.MarkMessagesRead(tree.database, messageList, markRead); messenger.MarkMessagesRead(tree.database, messageList, markRead);
} }
@ -478,7 +480,7 @@ function MsgMarkByDate() {}
function MsgMarkAllRead() function MsgMarkAllRead()
{ {
var folderTree = GetFolderTree();; var folderTree = GetFolderTree();;
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true"); var selectedFolderList = folderTree.selectedItems;
if(selectedFolderList.length > 0) if(selectedFolderList.length > 0)
{ {
var selectedFolder = selectedFolderList[0]; var selectedFolder = selectedFolderList[0];

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

@ -183,9 +183,9 @@ Rights Reserved.
<!ENTITY goMenu.label ".Go"> <!ENTITY goMenu.label ".Go">
<!ENTITY firstUnreadMsgCmd.label ".First Unread Message"> <!ENTITY firstUnreadMsgCmd.label ".First Unread Message">
<!ENTITY firstFlaggedMsgCmd.label ".First Flagged Message"> <!ENTITY firstFlaggedMsgCmd.label ".First Flagged Message">
<!ENTITY nextMenu.label ".Next"> <!ENTITY nextMenu.label "Next">
<!ENTITY nextMsgCmd.label ".Message"> <!ENTITY nextMsgCmd.label "Message">
<!ENTITY nextUnreadMsgCmd.label ".Unread Message"> <!ENTITY nextUnreadMsgCmd.label "Unread Message">
<!ENTITY nextFlaggedMsgCmd.label ".Flagged Message"> <!ENTITY nextFlaggedMsgCmd.label ".Flagged Message">
<!ENTITY prevMenu.label ".Previous"> <!ENTITY prevMenu.label ".Previous">
<!ENTITY prevMsgCmd.label ".Message"> <!ENTITY prevMsgCmd.label ".Message">

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

@ -18,6 +18,7 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved. Rights Reserved.
--> -->
<!ENTITY threadColumn.label "Thread">
<!ENTITY senderColumn.label "Sender"> <!ENTITY senderColumn.label "Sender">
<!ENTITY subjectColumn.label "Subject"> <!ENTITY subjectColumn.label "Subject">
<!ENTITY dateColumn.label "Date"> <!ENTITY dateColumn.label "Date">

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

@ -183,9 +183,9 @@ Rights Reserved.
<!ENTITY goMenu.label ".Go"> <!ENTITY goMenu.label ".Go">
<!ENTITY firstUnreadMsgCmd.label ".First Unread Message"> <!ENTITY firstUnreadMsgCmd.label ".First Unread Message">
<!ENTITY firstFlaggedMsgCmd.label ".First Flagged Message"> <!ENTITY firstFlaggedMsgCmd.label ".First Flagged Message">
<!ENTITY nextMenu.label ".Next"> <!ENTITY nextMenu.label "Next">
<!ENTITY nextMsgCmd.label ".Message"> <!ENTITY nextMsgCmd.label "Message">
<!ENTITY nextUnreadMsgCmd.label ".Unread Message"> <!ENTITY nextUnreadMsgCmd.label "Unread Message">
<!ENTITY nextFlaggedMsgCmd.label ".Flagged Message"> <!ENTITY nextFlaggedMsgCmd.label ".Flagged Message">
<!ENTITY prevMenu.label ".Previous"> <!ENTITY prevMenu.label ".Previous">
<!ENTITY prevMsgCmd.label ".Message"> <!ENTITY prevMsgCmd.label ".Message">

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

@ -18,6 +18,7 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved. Rights Reserved.
--> -->
<!ENTITY threadColumn.label "Thread">
<!ENTITY senderColumn.label "Sender"> <!ENTITY senderColumn.label "Sender">
<!ENTITY subjectColumn.label "Subject"> <!ENTITY subjectColumn.label "Subject">
<!ENTITY dateColumn.label "Date"> <!ENTITY dateColumn.label "Date">