Fixing bug 108229. Fixed GetMsgFolderFromUri routine to allow copies and folders settings to display and hold preferences properly. Redundant definitions are removed and the routine is now defined in widgetglue.js. r=naving, sr=sspitzer

This commit is contained in:
racham%netscape.com 2001-12-10 07:44:03 +00:00
Родитель 237606c46d
Коммит aa8a1eb738
13 изменённых файлов: 57 добавлений и 59 удалений

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

@ -126,7 +126,11 @@ function SetFolderDisplay(pickerMode, disableMode,
var folderPickedElement = document.getElementById(folderPickedField);
var uri = folderPickedElement.getAttribute("value");
var msgFolder = GetMsgFolderFromUri(uri);
// Get message folder from the given uri. Second argument (false) siginifies
// that there is no need to check for the existence of special folders as
// these folders are created on demand at runtime in case of imap accounts.
// For POP3 accounts, special folders are created at the account creation time.
var msgFolder = GetMsgFolderFromUri(uri, false);
SetFolderPicker(msgFolder.server.serverURI, accountPickerId);
SetPickerEnabling(accountPickerId, folderPickerId);
break;

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

@ -61,17 +61,11 @@ function GetMsgFolderFromResource(folderResource)
return null;
}
function GetMsgFolderFromURI(folderURI)
{
var folderResource = RDF.GetResource(folderURI);
return GetMsgFolderFromResource(folderResource);
}
function GetServer(uri)
{
if (!uri) return null;
try {
var folder = GetMsgFolderFromUri(uri);
var folder = GetMsgFolderFromUri(uri, true);
return folder.server;
}
catch (ex) {

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

@ -19,30 +19,6 @@
*/
function GetMsgFolderFromUri(uri)
{
//dump("GetMsgFolderFromUri of " + uri + "\n");
try {
var resource = GetResourceFromUri(uri);
var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
if (msgfolder && (msgfolder.parent || msgfolder.isServer))
return msgfolder;
}
catch (ex) {
//dump("failed to get the folder resource\n");
}
return null;
}
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;
}
function DoRDFCommand(dataSource, command, srcArray, argumentArray)
{
var commandResource = RDF.GetResource(command);
@ -301,7 +277,7 @@ function Subscribe(preselectedMsgFolder)
function SubscribeOKCallback(changeTable)
{
for (var serverURI in changeTable) {
var folder = GetMsgFolderFromUri(serverURI);
var folder = GetMsgFolderFromUri(serverURI, true);
var server = folder.server;
var subscribableServer =
server.QueryInterface(Components.interfaces.nsISubscribableServer);

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

@ -189,7 +189,7 @@ function GetSelectedServer()
function GetSelectedMsgFolder()
{
var folderURI = window.parent.GetSelectedFolderURI();
var msgFolder = window.parent.GetMsgFolderFromURI(folderURI);
var msgFolder = window.parent.GetMsgFolderFromUri(folderURI, true);
return msgFolder;
}

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

@ -40,7 +40,6 @@ Rights Reserved.
<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
<script type="application/x-javascript" src="chrome://messenger/content/AccountManager.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/accountUtils.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/commandglue.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailWindowOverlay.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailWindow.js"/>

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

@ -55,7 +55,7 @@ function MsgFolderPickerOnLoad(pickerID)
// verify that the value we are attempting to
// pre-flight the menu with is valid for this
// picker type
var msgfolder = GetMsgFolderFromUri(uri);
var msgfolder = GetMsgFolderFromUri(uri, true);
if (!msgfolder) return;
var verifyFunction = null;
@ -90,7 +90,7 @@ function SetFolderPicker(uri,pickerID)
gMessengerBundle = document.getElementById("bundle_messenger");
var picker = document.getElementById(pickerID);
var msgfolder = GetMsgFolderFromUri(uri);
var msgfolder = GetMsgFolderFromUri(uri, true);
if (!msgfolder) return;

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

@ -30,7 +30,7 @@ Rights Reserved.
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
</stringbundleset>
<script type="application/x-javascript" src="chrome://messenger/content/msgFolderPickerOverlay.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/widgetglue.js"/>
<menulist label="&newfolderclickhere.label;" id="msgNewFolderPicker"
sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"

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

@ -39,7 +39,7 @@ function SetServerTypeSpecificTextValues()
{
if (!gServerURI) return;
var serverType = GetMsgFolderFromUri(gServerURI).server.type;
var serverType = GetMsgFolderFromUri(gServerURI, true).server.type;
// set the server specific ui elements
var stringName = "foldersheaderfor-" + serverType;
@ -117,7 +117,7 @@ function SetUpTree(forceToServer)
gStatusBar = document.getElementById('statusbar-icon');
if (!gServerURI) return;
var folder = GetMsgFolderFromUri(gServerURI);
var folder = GetMsgFolderFromUri(gServerURI, true);
var server = folder.server;
try {
@ -198,7 +198,7 @@ function SubscribeOnLoad()
if (window.arguments[0].preselectedURI) {
var uri = window.arguments[0].preselectedURI;
//dump("subscribe: got a uri," + uri + "\n");
var folder = GetMsgFolderFromUri(uri);
var folder = GetMsgFolderFromUri(uri, true);
//dump("folder="+folder+"\n");
//dump("folder.server="+folder.server+"\n");
try {

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

@ -44,6 +44,7 @@ Rights Reserved.
<script type="application/x-javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailWindow.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/subscribe.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/widgetglue.js"/>
<grid flex="1" style="width: 40em; height: 25em;">
<columns>

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

@ -172,7 +172,7 @@ function MsgCompactFolder(isAll)
function MsgFolderProperties()
{
var preselectedURI = GetSelectedFolderURI();
var serverType = GetMsgFolderFromUri(preselectedURI).server.type;
var serverType = GetMsgFolderFromUri(preselectedURI, true).server.type;
var folderOutliner = GetFolderOutliner();
var name = GetFolderNameFromUri(preselectedURI, folderOutliner);
@ -254,3 +254,40 @@ function MsgSetFolderCharset()
{
MsgFolderProperties()
}
// Given a URI we would like to return corresponding message folder here.
// An additonal input param which specifies whether or not to check folder
// attributes (like if there exists a parent or is it a server) is also passed
// to this routine. Qualifying against those checks would return an existing
// folder. Callers who don't want to check those attributes will specify the
// same and then this routine will simply return a msgfolder. This scenario
// applies to a new imap account creation where special folders are created
// 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 msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
if (checkFolderAttributes) {
if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) {
msgfolder = null;
}
}
}
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;
}

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

@ -427,13 +427,13 @@ function GetFirstSelectedMsgFolder()
{
var selectedFolder = gActionTargetElement.getAttribute("uri");
var msgFolder = GetMsgFolderFromUri(selectedFolder);
var msgFolder = GetMsgFolderFromUri(selectedFolder, true);
return msgFolder;
}
function SearchNewFolderOkCallback(name,uri)
{
var msgFolder = GetMsgFolderFromUri(uri);
var msgFolder = GetMsgFolderFromUri(uri, true);
var msgWindow = GetFilterEditorMsgWindow();
msgFolder.createSubfolder(name, msgWindow);

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

@ -51,6 +51,7 @@ Contributor(s):
<script type="application/x-javascript" src="chrome://messenger/content/mailWindowOverlay.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/FilterEditor.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/widgetglue.js"/>
<hbox align="start">
<label value="&filterName.label;"/>

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

@ -2468,20 +2468,6 @@ var attachmentBucketObserver = {
}
};
function GetMsgFolderFromUri(uri)
{
try {
var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService();
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
var resource = RDF.GetResource(uri);
var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
if (msgfolder && ( msgfolder.parent || msgfolder.isServer))
return msgfolder;
}//try
catch (ex) { }//catch
return null;
}
function DisplaySaveFolderDlg(folderURI)
{
try{
@ -2492,7 +2478,7 @@ function DisplaySaveFolderDlg(folderURI)
}//catch
if (showDialog){
var msgfolder = GetMsgFolderFromUri(folderURI);
var msgfolder = GetMsgFolderFromUri(folderURI, true);
if (!msgfolder)
return;
var checkbox = {value:0};