fix for saving view and sort info across folder compacts r=naving, sr=sspitzer 82455 a=drivers

This commit is contained in:
bienvenu%netscape.com 2001-06-07 14:01:48 +00:00
parent fa81a23f17
commit 523249b37d
2 changed files with 62 additions and 2 deletions

View File

@ -187,11 +187,28 @@ function MsgCompactFolder(isAll)
}
else
{
// set this so we'll reload it when compact is done
gCurrentFolderToReroot = selectedFolderUri;
// save off the current sort and view info so we'll
// use it on the folder loaded notification
var resource = RDF.GetResource(selectedFolderUri);
var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
if (msgfolder)
{
var msgdb = msgfolder.getMsgDatabase(msgWindow);
if (msgdb)
{
var dbFolderInfo = msgdb.dBFolderInfo;
gCurrentLoadingFolderSortType = dbFolderInfo.sortType;
gCurrentLoadingFolderSortOrder = dbFolderInfo.sortOrder;
gCurrentLoadingFolderViewFlags = dbFolderInfo.viewFlags;
gCurrentLoadingFolderViewType = dbFolderInfo.viewType;
}
}
ClearThreadPaneSelection();
ClearThreadPane();
ClearMessagePane();
// set this so we'll reload it when compact is done
gCurrentFolderToReroot = selectedFolderUri;
}
}
var i;

View File

@ -902,7 +902,20 @@ public:
virtual ~nsTransferDBFolderInfo();
NS_IMETHOD GetMailboxName(nsString *boxName);
NS_IMETHOD SetMailboxName(nsString *boxName);
NS_IMETHOD GetViewType(nsMsgViewTypeValue *aViewType);
NS_IMETHOD SetViewType(nsMsgViewTypeValue aViewType);
NS_IMETHOD GetViewFlags(nsMsgViewFlagsTypeValue *aViewFlags);
NS_IMETHOD SetViewFlags(nsMsgViewFlagsTypeValue aViewFlags);
NS_IMETHOD GetSortType(nsMsgViewSortTypeValue *aSortType);
NS_IMETHOD SetSortType(nsMsgViewSortTypeValue aSortType);
NS_IMETHOD GetSortOrder(nsMsgViewSortOrderValue *aSortOrder);
NS_IMETHOD SetSortOrder(nsMsgViewSortOrderValue aSortOrder);
nsString m_boxName;
nsMsgViewTypeValue m_viewType;
nsMsgViewFlagsTypeValue m_viewFlags;
nsMsgViewSortTypeValue m_sortType;
nsMsgViewSortOrderValue m_sortOrder;
};
nsTransferDBFolderInfo::nsTransferDBFolderInfo() : nsDBFolderInfo(nsnull)
@ -926,6 +939,19 @@ NS_IMETHODIMP nsDBFolderInfo::GetTransferInfo(nsIDBFolderInfo **transferInfo)
GetMailboxName(&folderNameStr);
newInfo->SetMailboxName(&folderNameStr);
// ### add whatever other fields we want to copy here.
nsMsgViewTypeValue viewType;
nsMsgViewFlagsTypeValue viewFlags;
nsMsgViewSortTypeValue sortType;
nsMsgViewSortOrderValue sortOrder;
GetViewType(&viewType);
GetViewFlags(&viewFlags);
GetSortType(&sortType);
GetSortOrder(&sortOrder);
newInfo->SetViewType(viewType);
newInfo->SetViewFlags(viewFlags);
newInfo->SetSortType(sortType);
newInfo->SetSortOrder(sortOrder);
return NS_OK;
}
@ -941,6 +967,10 @@ NS_IMETHODIMP nsTransferDBFolderInfo::SetMailboxName(nsString *boxName)
return NS_OK;
}
NS_IMPL_GETSET(nsTransferDBFolderInfo, ViewType, nsMsgViewTypeValue, m_viewType);
NS_IMPL_GETSET(nsTransferDBFolderInfo, ViewFlags, nsMsgViewFlagsTypeValue, m_viewFlags);
NS_IMPL_GETSET(nsTransferDBFolderInfo, SortType, nsMsgViewSortTypeValue, m_sortType);
NS_IMPL_GETSET(nsTransferDBFolderInfo, SortOrder, nsMsgViewSortOrderValue, m_sortOrder);
/* void InitFromTransferInfo (in nsIDBFolderInfo transferInfo); */
NS_IMETHODIMP nsDBFolderInfo::InitFromTransferInfo(nsIDBFolderInfo *transferInfo)
@ -955,6 +985,19 @@ NS_IMETHODIMP nsDBFolderInfo::InitFromTransferInfo(nsIDBFolderInfo *transferInfo
SetMailboxName(&folderNameStr);
// ### add whatever other fields we want to copy here.
nsMsgViewTypeValue viewType;
nsMsgViewFlagsTypeValue viewFlags;
nsMsgViewSortTypeValue sortType;
nsMsgViewSortOrderValue sortOrder;
transferInfo->GetViewType(&viewType);
transferInfo->GetViewFlags(&viewFlags);
transferInfo->GetSortType(&sortType);
transferInfo->GetSortOrder(&sortOrder);
SetViewType(viewType);
SetViewFlags(viewFlags);
SetSortType(sortType);
SetSortOrder(sortOrder);
return NS_OK;
}