From 147224e29eee7148bd868441f84315fdf099a7ad Mon Sep 17 00:00:00 2001 From: "jminta%gmail.com" Date: Tue, 17 Jun 2008 02:38:18 +0000 Subject: [PATCH] Bug 439364 Remove GetResourceFromUri, r=philor, sr=Neil --- mail/base/content/commandglue.js | 8 ++------ mail/base/content/searchBar.js | 3 +-- mail/base/content/widgetglue.js | 18 ++++-------------- .../content/virtualFolderListDialog.js | 3 +-- .../content/virtualFolderProperties.js | 3 +-- 5 files changed, 9 insertions(+), 26 deletions(-) diff --git a/mail/base/content/commandglue.js b/mail/base/content/commandglue.js index 17dadce8691..55cafb82050 100644 --- a/mail/base/content/commandglue.js +++ b/mail/base/content/commandglue.js @@ -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); } diff --git a/mail/base/content/searchBar.js b/mail/base/content/searchBar.js index 865c2d39c04..c39f7eb8e9e 100644 --- a/mail/base/content/searchBar.js +++ b/mail/base/content/searchBar.js @@ -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); } diff --git a/mail/base/content/widgetglue.js b/mail/base/content/widgetglue.js index e6acecb002d..6d04c56cbd3 100644 --- a/mail/base/content/widgetglue.js +++ b/mail/base/content/widgetglue.js @@ -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; -} - diff --git a/mailnews/base/resources/content/virtualFolderListDialog.js b/mailnews/base/resources/content/virtualFolderListDialog.js index 9ad0f2534a8..38f195e0b66 100644 --- a/mailnews/base/resources/content/virtualFolderListDialog.js +++ b/mailnews/base/resources/content/virtualFolderListDialog.js @@ -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); } diff --git a/mailnews/base/resources/content/virtualFolderProperties.js b/mailnews/base/resources/content/virtualFolderProperties.js index 5c9f52fdd4f..7ac42b324fd 100644 --- a/mailnews/base/resources/content/virtualFolderProperties.js +++ b/mailnews/base/resources/content/virtualFolderProperties.js @@ -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 }