Bug 439364 Remove GetResourceFromUri, r=philor, sr=Neil

This commit is contained in:
jminta%gmail.com 2008-06-17 02:38:18 +00:00
Родитель d8c582bd90
Коммит 147224e29e
5 изменённых файлов: 9 добавлений и 26 удалений

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

@ -998,10 +998,7 @@ function FolderPaneSelectionChange()
uriToLoad = srchFolderUri;
// we need to load the db for the actual folder so that many hdrs to download
// will return false...
var realFolderRes = GetResourceFromUri(uriToLoad);
// Make msgFolder point to the real folder, not the virtual folder, so that
// we pass the real folder into ChangeFolder.
realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
realFolder = GetMsgFolderFromUri(uriToLoad);
msgDatabase = realFolder.getMsgDatabase(msgWindow);
gVirtualFolderTerms = CreateGroupedSearchTerms(tempFilter.searchTerms);
}
@ -1194,8 +1191,7 @@ function setupXFVirtualFolderSearch(folderUrisToSearch, searchTerms, searchOnlin
for (i in folderUrisToSearch)
{
var realFolderRes = GetResourceFromUri(folderUrisToSearch[i]);
var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
var realFolder = GetMsgFolderFromUri(folderUrisToSearch[i]);
if (!realFolder.isServer)
gSearchSession.addScopeTerm(!searchOnline ? nsMsgSearchScope.offlineMail : GetScopeForFolder(realFolder), realFolder);
}

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

@ -368,8 +368,7 @@ function createSearchTermsWithList(aTermsArray)
var srchFolderUriArray = srchFolderUri.split('|');
for (i in srchFolderUriArray)
{
var realFolderRes = GetResourceFromUri(srchFolderUriArray[i]);
var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
var realFolder = GetMsgFolderFromUri(srchFolderUriArray[i]);
if (!realFolder.isServer)
gSearchSession.addScopeTerm(getScopeToUse(termsArray, realFolder, ioService.offline), realFolder);
}

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

@ -84,7 +84,7 @@ function RenameFolder(name,uri)
{
if (uri && (uri != "") && name && (name != ""))
{
var selectedFolder = GetResourceFromUri(uri);
var selectedFolder = GetMsgFolderFromUri(uri);
if (gDBView)
gCurrentlyDisplayedMessage = gDBView.currentlyDisplayedMessage;
@ -284,10 +284,11 @@ function MsgToggleMessagePane()
// on demand and hence needs to prior check of existence.
function GetMsgFolderFromUri(uri, checkFolderAttributes)
{
//dump("GetMsgFolderFromUri of " + uri + "\n");
var msgfolder = null;
try {
var resource = GetResourceFromUri(uri);
var rdfService = Components.classes['@mozilla.org/rdf/rdf-service;1']
.getService(Components.interfaces.nsIRDFService);
var resource = rdfService.GetResource(uri);
msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
if (checkFolderAttributes) {
if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) {
@ -296,17 +297,6 @@ function GetMsgFolderFromUri(uri, checkFolderAttributes)
}
}
catch (ex) {
//dump("failed to get the folder resource\n");
}
return msgfolder;
}
function GetResourceFromUri(uri)
{
var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService();
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
var resource = RDF.GetResource(uri);
return resource;
}

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

@ -50,8 +50,7 @@ function onLoad()
// get the folder for each search URI and set the searchThisFolder flag on it
for (var i in srchFolderUriArray)
{
var realFolderRes = GetResourceFromUri(srchFolderUriArray[i]);
var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
var realFolder = GetMsgFolderFromUri(srchFolderUriArray[i]);
if (realFolder)
realFolder.setInVFEditSearchScope(true, false);
}

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

@ -113,8 +113,7 @@ function updateOnlineSearchState()
var srchFolderUriArray = gSearchFolderURIs.split('|');
if (srchFolderUriArray[0])
{
var realFolderRes = GetResourceFromUri(srchFolderUriArray[0]);
var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
var realFolder = GetMsgFolderFromUri(srchFolderUriArray[0]);
enableCheckbox = realFolder.server.offlineSupportLevel; // anything greater than 0 is an online server like IMAP or news
}