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; uriToLoad = srchFolderUri;
// we need to load the db for the actual folder so that many hdrs to download // we need to load the db for the actual folder so that many hdrs to download
// will return false... // will return false...
var realFolderRes = GetResourceFromUri(uriToLoad); realFolder = GetMsgFolderFromUri(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);
msgDatabase = realFolder.getMsgDatabase(msgWindow); msgDatabase = realFolder.getMsgDatabase(msgWindow);
gVirtualFolderTerms = CreateGroupedSearchTerms(tempFilter.searchTerms); gVirtualFolderTerms = CreateGroupedSearchTerms(tempFilter.searchTerms);
} }
@ -1194,8 +1191,7 @@ function setupXFVirtualFolderSearch(folderUrisToSearch, searchTerms, searchOnlin
for (i in folderUrisToSearch) for (i in folderUrisToSearch)
{ {
var realFolderRes = GetResourceFromUri(folderUrisToSearch[i]); var realFolder = GetMsgFolderFromUri(folderUrisToSearch[i]);
var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
if (!realFolder.isServer) if (!realFolder.isServer)
gSearchSession.addScopeTerm(!searchOnline ? nsMsgSearchScope.offlineMail : GetScopeForFolder(realFolder), realFolder); gSearchSession.addScopeTerm(!searchOnline ? nsMsgSearchScope.offlineMail : GetScopeForFolder(realFolder), realFolder);
} }

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

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

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

@ -84,7 +84,7 @@ function RenameFolder(name,uri)
{ {
if (uri && (uri != "") && name && (name != "")) if (uri && (uri != "") && name && (name != ""))
{ {
var selectedFolder = GetResourceFromUri(uri); var selectedFolder = GetMsgFolderFromUri(uri);
if (gDBView) if (gDBView)
gCurrentlyDisplayedMessage = gDBView.currentlyDisplayedMessage; gCurrentlyDisplayedMessage = gDBView.currentlyDisplayedMessage;
@ -284,10 +284,11 @@ function MsgToggleMessagePane()
// on demand and hence needs to prior check of existence. // on demand and hence needs to prior check of existence.
function GetMsgFolderFromUri(uri, checkFolderAttributes) function GetMsgFolderFromUri(uri, checkFolderAttributes)
{ {
//dump("GetMsgFolderFromUri of " + uri + "\n");
var msgfolder = null; var msgfolder = null;
try { 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); msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
if (checkFolderAttributes) { if (checkFolderAttributes) {
if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) { if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) {
@ -296,17 +297,6 @@ function GetMsgFolderFromUri(uri, checkFolderAttributes)
} }
} }
catch (ex) { catch (ex) {
//dump("failed to get the folder resource\n");
} }
return msgfolder; 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 // get the folder for each search URI and set the searchThisFolder flag on it
for (var i in srchFolderUriArray) for (var i in srchFolderUriArray)
{ {
var realFolderRes = GetResourceFromUri(srchFolderUriArray[i]); var realFolder = GetMsgFolderFromUri(srchFolderUriArray[i]);
var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
if (realFolder) if (realFolder)
realFolder.setInVFEditSearchScope(true, false); realFolder.setInVFEditSearchScope(true, false);
} }

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

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