part of fix for 95685 reduce bloat by closing db if a folder is unselected, r=naving (who did part of this patch), sr=sspitzer

This commit is contained in:
bienvenu%netscape.com 2001-10-08 01:05:58 +00:00
Родитель e81378a6b3
Коммит 11f4e3e94c
4 изменённых файлов: 38 добавлений и 0 удалений

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

@ -2,16 +2,31 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
<<<<<<< nsIMsgFolder.idl
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
=======
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
>>>>>>> 1.131
*
<<<<<<< nsIMsgFolder.idl
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
=======
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
>>>>>>> 1.131
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
@ -361,6 +376,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
void markMessagesFlagged(in nsISupportsArray messages, in boolean markFlagged);
void markThreadRead(in nsIMsgThread thread);
nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
void setMsgDatabase (in nsIMsgDatabase msgDatabase);
nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo);
nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey);

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

@ -289,6 +289,12 @@ function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
// now create the db view, which will sort it.
CreateDBView(newFolder, viewType, viewFlags, sortType, sortOrder);
if (oldFolder)
{
if (!IsSpecialFolder(oldFolder, MSG_FOLDER_FLAG_INBOX))
if (oldFolder.URI != newFolder.URI)
oldFolder.setMsgDatabase(null);
}
// that should have initialized gDBView, now re-root the thread pane
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
if (outlinerView)
@ -671,6 +677,7 @@ function FolderPaneSelectionChange()
sortOrder = dbFolderInfo.sortOrder;
viewFlags = dbFolderInfo.viewFlags;
viewType = dbFolderInfo.viewType;
msgDatabase = null;
}
}
catch (ex)

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

@ -647,6 +647,20 @@ nsMsgDBFolder::GetMsgDatabase(nsIMsgWindow *aMsgWindow,
return NS_OK;
}
NS_IMETHODIMP
nsMsgDBFolder::SetMsgDatabase(nsIMsgDatabase *aMsgDatabase)
{
if (mDatabase)
{
mDatabase->RemoveListener(this);
mDatabase->ClearCachedHdrs();
}
mDatabase = aMsgDatabase;
if (aMsgDatabase)
aMsgDatabase->AddListener(this);
return NS_OK;
}
NS_IMETHODIMP
nsMsgDBFolder::OnReadChanged(nsIDBChangeListener * aInstigator)
{

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

@ -78,6 +78,7 @@ public:
NS_IMETHOD GetMsgDatabase(nsIMsgWindow *aMsgWindow,
nsIMsgDatabase** aMsgDatabase);
NS_IMETHOD SetMsgDatabase(nsIMsgDatabase *msgDatabase);
NS_DECL_ISUPPORTS_INHERITED