зеркало из https://github.com/mozilla/gecko-dev.git
fix for bug #183331, searchBar.js
when restoring a "pre" quick search view, heed a similar scrolling logic that we have for folder loading. for mail views, this means switching back to the "all" view. fix for bug #186504, msgMail3PaneWindow.js when loading a folder, try to scroll to "new" messages first, before "remembering the last selected" message. both fixes by neil@parkwaycc.co.uk. r/sr=sspitzer
This commit is contained in:
Родитель
2b3526ff2e
Коммит
f2048388f3
|
@ -183,9 +183,22 @@ var folderListener = {
|
|||
}
|
||||
}
|
||||
if (uri == gCurrentLoadingFolderURI) {
|
||||
// NOTE,
|
||||
// if you change the scrolling code below,
|
||||
// double check the scrolling logic in
|
||||
// searchBar.js, restorePreSearchView()
|
||||
|
||||
gCurrentLoadingFolderURI = "";
|
||||
|
||||
// if we didn't just scroll,
|
||||
// scroll to the first new message
|
||||
// but don't select it
|
||||
if (!scrolled)
|
||||
scrolled = ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */);
|
||||
|
||||
if (!scrolled && pref.getBoolPref("mailnews.remember_selected_message")) {
|
||||
// if we failed to scroll to a new message,
|
||||
// reselect the last selected message
|
||||
var lastMessageLoaded = msgFolder.lastMessageLoaded;
|
||||
|
||||
if (lastMessageLoaded != nsMsgKey_None) {
|
||||
|
@ -193,30 +206,31 @@ var folderListener = {
|
|||
}
|
||||
}
|
||||
|
||||
// Now let's select the first new message if there is one
|
||||
if (!scrolled) {
|
||||
// if we didn't just scroll, scroll to the first new message
|
||||
// don't select it though
|
||||
scrolled = ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */);
|
||||
|
||||
// if we failed to find a new message,
|
||||
// if we still haven't scrolled,
|
||||
// scroll to the newest, which might be the top or the bottom
|
||||
// depending on our sort order and sort type
|
||||
if (!scrolled) {
|
||||
if (gDBView.sortOrder == nsMsgViewSortOrder.ascending) {
|
||||
switch (gDBView.sortType) {
|
||||
case nsMsgViewSortType.byDate:
|
||||
case nsMsgViewSortType.byId:
|
||||
case nsMsgViewSortType.byThread:
|
||||
scrolled = ScrollToMessage(nsMsgNavigationType.lastMessage, true, false /* selectMessage */);
|
||||
break;
|
||||
}
|
||||
if (gDBView.sortOrder == nsMsgViewSortOrder.ascending) {
|
||||
switch (gDBView.sortType) {
|
||||
case nsMsgViewSortType.byDate:
|
||||
case nsMsgViewSortType.byId:
|
||||
case nsMsgViewSortType.byThread:
|
||||
scrolled = ScrollToMessage(nsMsgNavigationType.lastMessage, true, false /* selectMessage */);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if still we haven't scrolled,
|
||||
// scroll to the top.
|
||||
if (!scrolled)
|
||||
EnsureRowInThreadTreeIsVisible(0);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE,
|
||||
// if you change the scrolling code above,
|
||||
// double check the scrolling logic in
|
||||
// searchBar.js, restorePreSearchView()
|
||||
|
||||
SetBusyCursor(window, false);
|
||||
}
|
||||
if (gNotifyDefaultInboxLoadedOnStartup && (folder.flags & 0x1000))
|
||||
|
|
|
@ -218,19 +218,60 @@ function restorePreSearchView()
|
|||
|
||||
RerootThreadPane();
|
||||
|
||||
//now restore selection
|
||||
var scrolled = false;
|
||||
|
||||
// now restore selection
|
||||
if (selectedHdr)
|
||||
{
|
||||
gDBView.selectMsgByKey(selectedHdr.messageKey);
|
||||
var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
|
||||
var selectedIndex = treeView.selection.currentIndex;
|
||||
if (selectedIndex >= 0) //scroll
|
||||
if (selectedIndex >= 0)
|
||||
{
|
||||
// scroll
|
||||
EnsureRowInThreadTreeIsVisible(selectedIndex);
|
||||
scrolled = true;
|
||||
}
|
||||
else
|
||||
ClearMessagePane();
|
||||
}
|
||||
else
|
||||
ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */);
|
||||
|
||||
// NOTE,
|
||||
// if you change the scrolling code below,
|
||||
// double check the scrolling logic in
|
||||
// msgMail3PaneWindow.js, "FolderLoaded" event code
|
||||
if (!scrolled)
|
||||
{
|
||||
// if we didn't just scroll,
|
||||
// scroll to the first new message
|
||||
// but don't select it
|
||||
scrolled = ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */);
|
||||
if (!scrolled)
|
||||
{
|
||||
// if we still haven't scrolled,
|
||||
// scroll to the newest, which might be the top or the bottom
|
||||
// depending on our sort order and sort type
|
||||
if (sortOrder == nsMsgViewSortOrder.ascending)
|
||||
{
|
||||
switch (sortType)
|
||||
{
|
||||
case nsMsgViewSortType.byDate:
|
||||
case nsMsgViewSortType.byId:
|
||||
case nsMsgViewSortType.byThread:
|
||||
scrolled = ScrollToMessage(nsMsgNavigationType.lastMessage, true, false /* selectMessage */);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if still we haven't scrolled,
|
||||
// scroll to the top.
|
||||
if (!scrolled)
|
||||
EnsureRowInThreadTreeIsVisible(0);
|
||||
}
|
||||
}
|
||||
// NOTE,
|
||||
// if you change the scrolling code above,
|
||||
// double check the scrolling logic in
|
||||
// msgMail3PaneWindow.js, "FolderLoaded" event code
|
||||
}
|
||||
|
||||
function onSearch(aSearchTerms)
|
||||
|
|
Загрузка…
Ссылка в новой задаче