зеркало из https://github.com/mozilla/pjs.git
Select and scroll to first new message in a folder. r=bienvenu.
This commit is contained in:
Родитель
5d52afa8dc
Коммит
f783868075
|
@ -219,12 +219,13 @@ function ChangeFolderByURI(uri, isThreaded, sortID)
|
|||
window.title = msgfolder.name;
|
||||
|
||||
gBeforeFolderLoadTime = new Date();
|
||||
gCurrentLoadingFolderURI = uri;
|
||||
|
||||
if(msgfolder.manyHeadersToDownload())
|
||||
{
|
||||
try
|
||||
{
|
||||
gCurrentLoadingFolderURI = uri;
|
||||
gCurrentFolderToReroot = uri;
|
||||
gCurrentLoadingFolderIsThreaded = isThreaded;
|
||||
gCurrentLoadingFolderSortID = sortID;
|
||||
msgfolder.startFolderLoading();
|
||||
|
@ -237,11 +238,13 @@ function ChangeFolderByURI(uri, isThreaded, sortID)
|
|||
}
|
||||
else
|
||||
{
|
||||
gCurrentLoadingFolderURI = "";
|
||||
gCurrentFolderToReroot = "";
|
||||
gCurrentLoadingFolderIsThreaded = false;
|
||||
gCurrentLoadingFolderSortID = "";
|
||||
msgfolder.updateFolder(msgWindow);
|
||||
RerootFolder(uri, msgfolder, isThreaded, sortID);
|
||||
//Need to do this after rerooting folder. Otherwise possibility of receiving folder loaded
|
||||
//notification before folder has actually changed.
|
||||
msgfolder.updateFolder(msgWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,7 +599,7 @@ function GetNextMessageAfterDelete(messages)
|
|||
//search forward
|
||||
while(curMessage)
|
||||
{
|
||||
nextMessage = GetNextMessage(tree, curMessage, GoMessage, false);
|
||||
nextMessage = GetNextMessageUnthreaded(tree, curMessage, GoMessage, false);
|
||||
if(nextMessage)
|
||||
{
|
||||
if(!MessageInSelection(nextMessage, messages))
|
||||
|
|
|
@ -41,6 +41,7 @@ var gUnreadCount = null;
|
|||
var gTotalCount = null;
|
||||
|
||||
var gCurrentLoadingFolderURI;
|
||||
var gCurrentFolderToReroot;
|
||||
var gCurrentLoadingFolderIsThreaded = false;
|
||||
var gCurrentLoadingFolderSortID ="";
|
||||
|
||||
|
@ -110,16 +111,17 @@ var folderListener = {
|
|||
|
||||
OnFolderLoaded: function (folder)
|
||||
{
|
||||
dump('In OnFolderLoader\n');
|
||||
if(folder)
|
||||
{
|
||||
var resource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if(resource)
|
||||
{
|
||||
var uri = resource.Value;
|
||||
if(uri == gCurrentLoadingFolderURI)
|
||||
dump('In OnFolderLoaded for ' + uri);
|
||||
dump('\n');
|
||||
if(uri == gCurrentFolderToReroot)
|
||||
{
|
||||
gCurrentLoadingFolderURI="";
|
||||
gCurrentFolderToReroot="";
|
||||
var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if(msgFolder)
|
||||
{
|
||||
|
@ -130,7 +132,14 @@ var folderListener = {
|
|||
gCurrentLoadingFolderSortID = "";
|
||||
}
|
||||
}
|
||||
if(uri == gCurrentLoadingFolderURI)
|
||||
{
|
||||
gCurrentLoadingFolderURI = "";
|
||||
//Now let's select the first new message if there is one
|
||||
SelectFirstNewMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -536,6 +545,13 @@ function ThreadPaneOnClick(event)
|
|||
}
|
||||
|
||||
function OpenThread(treeitem)
|
||||
{
|
||||
treeitem.setAttribute('notreadytodisplay', 'true');
|
||||
OpenTreeItemAndDescendants(treeitem);
|
||||
treeitem.setAttribute('notreadytodisplay', 'false');
|
||||
}
|
||||
|
||||
function OpenTreeItemAndDescendants(treeitem)
|
||||
{
|
||||
var open = treeitem.getAttribute('open');
|
||||
if(open != "true")
|
||||
|
@ -566,7 +582,7 @@ function OpenThread(treeitem)
|
|||
{
|
||||
treechildrenChild.setAttribute('open', 'true');
|
||||
//Open up all of this items
|
||||
OpenThread(treechildrenChild);
|
||||
OpenTreeItemAndDescendants(treechildrenChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,18 @@ function ResourceGoFlaggedMessage(message)
|
|||
return(flaggedValue == 'flagged');
|
||||
}
|
||||
|
||||
function GoNewMessage(message)
|
||||
{
|
||||
var status = message.getAttribute('Status');
|
||||
return(status == 'new');
|
||||
}
|
||||
|
||||
function ResourceGoNewMessage(message)
|
||||
{
|
||||
var StatusValue = GetMessageValue(message, "http://home.netscape.com/NC-rdf#Status");
|
||||
return(StatusValue == 'new');
|
||||
}
|
||||
|
||||
function GetMessageValue(message, propertyURI)
|
||||
{
|
||||
var db = GetThreadTree().database;
|
||||
|
@ -105,16 +117,7 @@ function GoNextMessage(nextFunction, nextResourceFunction, nextThreadFunction, s
|
|||
else
|
||||
currentMessage = selArray[0];
|
||||
|
||||
var nextMessage;
|
||||
|
||||
if(messageView.showThreads)
|
||||
{
|
||||
nextMessage = GetNextMessageInThreads(tree, currentMessage, nextFunction, nextResourceFunction, nextThreadFunction, startFromBeginning);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextMessage = GetNextMessage(tree, currentMessage, nextFunction, startFromBeginning);
|
||||
}
|
||||
var nextMessage = GetNextMessage(tree, currentMessage, nextFunction, nextResourceFunction, nextThreadFunction, startFromBeginning);
|
||||
|
||||
//Only change the selection if there's a valid nextMessage
|
||||
if(nextMessage && (nextMessage != currentMessage))
|
||||
|
@ -122,14 +125,30 @@ function GoNextMessage(nextFunction, nextResourceFunction, nextThreadFunction, s
|
|||
}
|
||||
}
|
||||
|
||||
/*GetNextMessage does the iterating for the Next menu item.
|
||||
function GetNextMessage(tree, currentMessage, nextFunction, nextResourceFunction, nextThreadFunction, startFromBeginning)
|
||||
{
|
||||
var nextMessage;
|
||||
|
||||
if(messageView.showThreads)
|
||||
{
|
||||
nextMessage = GetNextMessageInThreads(tree, currentMessage, nextFunction, nextResourceFunction, nextThreadFunction, startFromBeginning);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextMessage = GetNextMessageUnthreaded(tree, currentMessage, nextFunction, startFromBeginning);
|
||||
}
|
||||
|
||||
return nextMessage;
|
||||
}
|
||||
|
||||
/*GetNextMessageUnthreaded does the iterating for the Next menu item.
|
||||
currentMessage is the message we are starting from.
|
||||
nextFunction is the function that will be used to detertime if a message matches criteria.
|
||||
It must take a node and return a boolean.
|
||||
startFromBeginning is a boolean that states whether or not we should start looking at the beginning
|
||||
if we reach then end
|
||||
*/
|
||||
function GetNextMessage(tree, currentMessage, nextFunction, startFromBeginning)
|
||||
function GetNextMessageUnthreaded(tree, currentMessage, nextFunction, startFromBeginning)
|
||||
{
|
||||
var foundMessage = false;
|
||||
|
||||
|
@ -566,5 +585,15 @@ function FindNextThread(startThread, nextThreadFunction, startFromBeginning, che
|
|||
return nextThread;
|
||||
}
|
||||
|
||||
function SelectFirstNewMessage()
|
||||
{
|
||||
var tree = GetThreadTree();
|
||||
|
||||
var newMessage = GetNextMessage(tree, null, GoNewMessage, ResourceGoNewMessage, null, false)
|
||||
|
||||
if(newMessage)
|
||||
SelectNextMessage(newMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -507,7 +507,14 @@ nsresult nsMsgLocalMailFolder::GetDatabase()
|
|||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::UpdateFolder(nsIMsgWindow *aWindow)
|
||||
{
|
||||
return GetDatabase(); // this will cause a reparse, if needed.
|
||||
nsresult rv = NS_OK;
|
||||
//If we don't currently have a database, get it. Otherwise, the folder has been updated (presumably this
|
||||
//changes when we download headers when opening inbox). If it's updated, send NotifyFolderLoaded.
|
||||
if(!mDatabase)
|
||||
rv = GetDatabase(); // this will cause a reparse, if needed.
|
||||
else
|
||||
NotifyFolderLoaded();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче