fix 392330, view picker not updated when we switch tabs, and issues with account manager in tabs, r/sr=standard8

This commit is contained in:
David Bienvenu 2008-11-17 07:29:18 -08:00
Родитель 1952a18c59
Коммит bf12bf2692
2 изменённых файлов: 45 добавлений и 35 удалений

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

@ -1348,7 +1348,7 @@ let mailTabType = {
aTab.messenger = messenger; aTab.messenger = messenger;
aTab.dbView = gDBView; aTab.dbView = gDBView;
aTab.searchSession = gSearchSession; aTab.searchSession = gSearchSession;
aTab.msgSelectedFolder = gMsgFolderSelected;
if (!gDBView) if (!gDBView)
return; return;
@ -1358,18 +1358,16 @@ let mailTabType = {
{ {
var curMsgHdr = gDBView.hdrForFirstSelectedMessage; var curMsgHdr = gDBView.hdrForFirstSelectedMessage;
aTab.selectedMsgId = curMsgHdr.messageId; aTab.selectedMsgId = curMsgHdr.messageId;
aTab.msgSelectedFolder = curMsgHdr.folder;
}
catch (ex)
{
aTab.msgSelectedFolder = gMsgFolderSelected
} }
catch (ex) {}
} }
else else
{ {
aTab.selectedMsgId = null; aTab.selectedMsgId = null;
aTab.msgSelectedFolder = null; aTab.msgSelectedFolder = gDBView.msgFolder;
} }
if (aTab.msgSelectedFolder)
aTab.mailView = GetMailViewForFolder(aTab.msgSelectedFolder);
}, },
_folderAndThreadPaneVisible: true, _folderAndThreadPaneVisible: true,
@ -1387,10 +1385,10 @@ let mailTabType = {
gDBView = aTab.dbView; gDBView = aTab.dbView;
gSearchSession = aTab.searchSession; gSearchSession = aTab.searchSession;
// restore selection in folder pane;
let folderToSelect = gDBView ? gDBView.msgFolder : aTab.msgSelectedFolder;
// restore view state if we had one // restore view state if we had one
if (gDBView) var row = gFolderTreeView.getIndexOfFolder(folderToSelect);
{
var row = gFolderTreeView.getIndexOfFolder(gDBView.msgFolder);
var treeBoxObj = document.getElementById("folderTree").treeBoxObject; var treeBoxObj = document.getElementById("folderTree").treeBoxObject;
var folderTreeSelection = treeBoxObj.view.selection; var folderTreeSelection = treeBoxObj.view.selection;
@ -1398,15 +1396,21 @@ let mailTabType = {
// the call to ensureRowIsVisible(). // the call to ensureRowIsVisible().
if ((row >= 0) && !folderTreeSelection.isSelected(row)) if ((row >= 0) && !folderTreeSelection.isSelected(row))
{ {
gMsgFolderSelected = gDBView.msgFolder; gMsgFolderSelected = folderToSelect;
folderTreeSelection.selectEventsSuppressed = true; folderTreeSelection.selectEventsSuppressed = true;
folderTreeSelection.select(row); folderTreeSelection.select(row);
treeBoxObj.ensureRowIsVisible(row); treeBoxObj.ensureRowIsVisible(row);
folderTreeSelection.selectEventsSuppressed = false; folderTreeSelection.selectEventsSuppressed = false;
} }
if (gDBView)
{
// This sets the thread pane tree's view to the gDBView view. // This sets the thread pane tree's view to the gDBView view.
UpdateSortIndicators(gDBView.sortType, gDBView.sortOrder); UpdateSortIndicators(gDBView.sortType, gDBView.sortOrder);
RerootThreadPane(); RerootThreadPane();
// Only refresh the view picker if the views toolbar is visible.
if (document.getElementById("mailviews-container"))
UpdateViewPickerByValue(aTab.mailView);
// We need to restore the selection to what it was when we switched away // We need to restore the selection to what it was when we switched away
// from this tab. We need to remember the selected keys, instead of the // from this tab. We need to remember the selected keys, instead of the
// selected indices, since the view might have changed. But maybe the // selected indices, since the view might have changed. But maybe the
@ -1434,14 +1438,13 @@ let mailTabType = {
// existing API call that accomplishes it. // existing API call that accomplishes it.
} }
catch (ex) {dump(ex);} catch (ex) {dump(ex);}
ShowThreadPane();
} }
// make sure the folder tree knows that we don't have a view else if (gMsgFolderSelected.isServer)
else
{ {
var tree = GetThreadTree(); UpdateStatusQuota(null);
tree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject) // Load AccountCentral page here.
.view = null; ShowAccountCentral();
ClearMessagePane();
} }
} }
}; };

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

@ -124,9 +124,20 @@ function ViewChangeByMenuitem(aMenuitem)
function ViewChangeByValue(aValue) function ViewChangeByValue(aValue)
{
ViewChange(aValue, GetLabelForValue(aValue));
}
function ViewChangeByFolder(aFolder)
{
var result = GetMailViewForFolder(aFolder);
ViewChangeByValue(result);
}
function GetLabelForValue(aValue)
{ {
var label = ""; var label = "";
var viewPickerPopup = document.getElementById("viewPickerPopup"); let viewPickerPopup = document.getElementById("viewPickerPopup");
if (viewPickerPopup) if (viewPickerPopup)
{ {
// grab the label for the menulist from one of its menuitems // grab the label for the menulist from one of its menuitems
@ -139,17 +150,14 @@ function ViewChangeByValue(aValue)
} }
label = selectedItems && selectedItems.length && selectedItems.item(0).label; label = selectedItems && selectedItems.length && selectedItems.item(0).label;
} }
ViewChange(aValue, label); return label;
} }
function UpdateViewPickerByValue(aValue)
function ViewChangeByFolder(aFolder)
{ {
var result = GetMailViewForFolder(aFolder); UpdateViewPicker(aValue, GetLabelForValue(aValue));
ViewChangeByValue(result);
} }
function UpdateViewPicker(aValue, aLabel) function UpdateViewPicker(aValue, aLabel)
{ {
var viewPicker = document.getElementById("viewPicker"); var viewPicker = document.getElementById("viewPicker");
@ -160,7 +168,6 @@ function UpdateViewPicker(aValue, aLabel)
} }
} }
function GetFolderInfo(aFolder) function GetFolderInfo(aFolder)
{ {
if (aFolder) if (aFolder)