fix for #17402, stationary -> stationery.

r=alecf

major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.

our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.

also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement.  Before we were
passing through to the back end the selected xul element, now we pass
the resource in.

other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)

bugs fixed: #14773, #14254, #20599, #20646
r=alecf

a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
This commit is contained in:
sspitzer%netscape.com 1999-12-03 08:10:09 +00:00
Родитель 1d46fd0590
Коммит eca3788d93
43 изменённых файлов: 799 добавлений и 164 удалений

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

@ -23,7 +23,7 @@ var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService(
function onInit() {
initFolderDisplay("identity.fccFolder", "fccFolderVerbose");
initFolderDisplay("identity.draftFolder", "draftFolderVerbose");
initFolderDisplay("identity.stationaryFolder", "stationaryFolderVerbose");
initFolderDisplay("identity.stationeryFolder", "stationeryFolderVerbose");
initFolderDisplay("identity.junkMailFolder", "junkMailFolderVerbose");
initBccSelf();
dump("document is " + document + "\n");

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

@ -9,7 +9,7 @@
<html:script src="chrome://messenger/content/am-copies.js"/>
<html:input type="hidden" name="identity.fccFolder" id="identity.fccFolder"/>
<html:input type="hidden" name="identity.draftFolder" id="identity.draftFolder"/>
<html:input type="hidden" name="identity.stationaryFolder" id="identity.stationaryFolder"/>
<html:input type="hidden" name="identity.stationeryFolder" id="identity.stationeryFolder"/>
<html:input type="hidden" name="identity.junkMailFolder" id="identity.junkMailFolder"/>
<html:input type="hidden" name="identity.email" id="identity.email"/>
@ -76,7 +76,7 @@
<html:select flex="66%"
onchange="dump('value=' + event.target.value + '\n')"
datasources="rdf:mailnewsfolders rdf:msgaccountmanager"
name="identity.stationaryFolder"
name="identity.stationeryFolder"
ref="msgaccounts:/">
<template>
<rule iscontainer="true" isempty="false">

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

@ -11,4 +11,4 @@
<!ENTITY specialFolderTitle.label "Special Folders">
<!ENTITY junkMailFolder.label "Keep junk mail in:">
<!ENTITY draftMailFolder.label "Keep message drafts in:">
<!ENTITY templateMailFolder.label "Keep message stationary in:">
<!ENTITY templateMailFolder.label "Keep message stationery in:">

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

@ -67,11 +67,11 @@ interface nsIMessenger : nsISupports {
void MarkMessageFlagged(in nsIRDFCompositeDataSource database, in nsIDOMXULElement message,
in boolean markFlagged);
void NewFolder(in nsIRDFCompositeDataSource database, in nsIDOMXULElement parentFolderElement,
void NewFolder(in nsIRDFCompositeDataSource database, in nsIRDFResource parentFolder,
in string name);
void RenameFolder(in nsIRDFCompositeDataSource db,
in nsIDOMXULElement folder, in string name);
in nsIRDFResource folder, in string name);
void CompactFolder(in nsIRDFCompositeDataSource db, in nsIDOMXULElement folder);
void EmptyTrash(in nsIRDFCompositeDataSource db, in nsIDOMXULElement folder);

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

@ -92,6 +92,10 @@ interface nsIMsgFolder : nsIFolder {
* is this folder the "phantom" server folder?
*/
readonly attribute boolean isServer;
readonly attribute boolean canSubscribe;
readonly attribute boolean canFileMessages;
readonly attribute boolean canCreateSubfolders;
readonly attribute boolean canRename;
/**
* the phantom server folder

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

@ -83,7 +83,7 @@ interface nsIMsgIdentity : nsISupports {
attribute string bccList;
attribute string draftFolder;
attribute string stationaryFolder;
attribute string stationeryFolder;
attribute string junkMailFolder;
wstring toString();

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

@ -31,7 +31,8 @@ sidebar-messenger.xul
sidebar-messenger.rdf
newFolderNameDialog.xul
newFolderNameDialog.js
renameFolderNameDialog.xul
msgViewNavigation.js
msgMail3PaneWindow.js
msgFolderPickerOverlay.xul
msgFolderPickerOverlay.js

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

@ -42,6 +42,9 @@ EXPORT_RESOURCE_SAMPLES = \
newFolderNameDialog.js \
msgViewNavigation.js \
msgMail3PaneWindow.js \
msgFolderPickerOverlay.js \
msgFolderPickerOverlay.xul \
renameFolderNameDialog.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -37,6 +37,9 @@ install::
$(MAKE_INSTALL) newFolderNameDialog.js $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) msgViewNavigation.js $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) msgMail3PaneWindow.js $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) msgFolderPickerOverlay.js $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) msgFolderPickerOverlay.xul $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) renameFolderNameDialog.xul $(DIST)\bin\chrome\messenger\content\default
clobber::
rm -f $(DIST)\chrome\messenger\content\default\messenger.xul
@ -52,4 +55,7 @@ clobber::
rm -f $(DIST)\chrome\messenger\content\default\newFolderNameDialog.js
rm -f $(DIST)\chrome\messenger\content\default\msgViewNavigation.js
rm -f $(DIST)\chrome\messenger\content\default\msgMail3PaneWindow.js
rm -f $(DIST)\chrome\messenger\content\default\msgFolderPickerOverlay.js
rm -f $(DIST)\chrome\messenger\content\default\msgFolderPickerOverlay.xul
rm -f $(DIST)\chrome\messenger\content\default\renameFolderNameDialog.xul

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

@ -31,6 +31,7 @@ Rights Reserved.
<window id="messengerWindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:nc="http://home.netscape.com/NC-rdf#"
title="&messengerWindow.title;"
titlemodifier="&titleModifier.label;"
titlemenuseparator="&titleSeperator.label;"
@ -400,7 +401,7 @@ Rights Reserved.
<menu value="&moveMsgMenu.label;" id="moveMenu" datasources="rdf:null" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild">
<menupopup/>
<template>
<rule iscontainer="true" isempty="false">
<rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
@ -419,7 +420,21 @@ Rights Reserved.
</menu>
</menupopup>
</rule>
<rule>
<rule nc:CanFileMessages="false" nc:ServerType="nntp">
<!-- don't show nntp servers in the file and copies menus -->
</rule>
<rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="MsgMoveMessage(event.target)"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
@ -433,7 +448,7 @@ Rights Reserved.
<menu value="&copyMsgMenu.label;" id="copyMenu" datasources="rdf:null" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild">
<menupopup/>
<template>
<rule iscontainer="true" isempty="false">
<rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
@ -441,7 +456,7 @@ Rights Reserved.
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&fileHereMenu.label;"
<menuitem uri="..." value="&copyHereMenu.label;"
oncommand="MsgCopyMessage(event.target)"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
@ -450,11 +465,26 @@ Rights Reserved.
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule>
</menupopup>
</rule>
<rule nc:CanFileMessages="false" nc:ServerType="nntp">
<!-- don't show nntp servers in the file and copies menus -->
</rule>
<rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="MsgCopyMessage(event.target)"
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="MsgCopyMessage(event.target)"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"

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

@ -0,0 +1,39 @@
// call this from dialog onload() to set the menu item to the correct value
function MsgFolderPickerOnLoad(pickerID)
{
dump("in MsgFolderPickerOnLoad()\n");
var uri = null;
try {
uri = window.arguments[0].preselectedURI;
}
catch (ex) {
uri = null;
}
if (uri) {
dump("on loading, set titled button to " + uri + "\n");
SetTitleButton(uri,pickerID);
}
}
function PickedMsgFolder(selection,pickerID)
{
var selectedUri = selection.getAttribute('id');
SetTitleButton(selectedUri,pickerID);
}
function SetTitleButton(uri,pickerID)
{
var picker = document.getElementById(pickerID);
var msgfolder = GetMsgFolderFromUri(uri);
var selectedValue = null;
if (msgfolder.isServer)
selectedValue = msgfolder.name;
else
selectedValue = msgfolder.name + " on " + msgfolder.server.prettyName;
picker.setAttribute("value",selectedValue);
picker.setAttribute("uri",uri);
}

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

@ -0,0 +1,197 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/msgFolderPickerOverlay.dtd">
<overlay id="msgFolderPicker"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script language="JavaScript" src="chrome://messenger/content/msgFolderPickerOverlay.js"/>
<menu style="border: thin solid black;" value="&subscribeclickhere.label;" uri="" id="msgSubscribeFolderPicker" datasources="rdf:msgaccountmanager rdf:mailnewsfolders" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
ref="msgaccounts:/">
<template>
<rule nc:CanSubscribe="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgSubscribeFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&subscribechoosethis.label;"
oncommand="PickedMsgFolder(event.target,'msgSubscribeFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:CanSubscribe="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgSubscribeFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</menu>
<menu style="border: thin solid red;" value="&newfolderclickhere.label;" uri="" id="msgNewFolderPicker" datasources="rdf:msgaccountmanager rdf:mailnewsfolders" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
ref="msgaccounts:/">
<template>
<rule nc:CanCreateSubfolders="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgNewFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&newfolderchoosethis.label;"
oncommand="PickedMsgFolder(event.target,'msgNewFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<!-- no subfolders for some inboxes -->
<rule nc:CanCreateSubfolders="false" iscontainer="true" isempty="true">
<menupopup>
<menuitem disabled="true" uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgNewFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
<rule nc:CanCreateSubfolders="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgNewFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</menu>
<menu style="border: thin solid blue;" value="&renamefolderclickhere.label;" uri="" id="msgRenameFolderPicker" datasources="rdf:msgaccountmanager rdf:mailnewsfolders" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
ref="msgaccounts:/">
<template>
<rule nc:CanRename="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgRenameFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&renamefolderchoosethis.label;"
oncommand="PickedMsgFolder(event.target,'msgRenameFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:CanRename="false" nc:ServerType="nntp">
<!-- don't show nntp servers in the rename dialog -->
</rule>
<rule nc:CanRename="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgRenameFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
</menu>
</menupopup>
</rule>
<rule nc:CanRename="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgRenameFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</menu>
<menu style="border: thin solid green;" value="&filemessagesclickhere.label;" uri="" id="msgFileMessagesFolderPicker" datasources="rdf:msgaccountmanager rdf:mailnewsfolders" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
ref="msgaccounts:/">
<template>
<rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgFileMessagesFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&filemessageschoosethis.label;"
oncommand="PickedMsgFolder(event.target,'msgFileMessagesFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:CanRename="false" nc:ServerType="nntp">
<!-- don't show nntp servers in the file picker -->
</rule>
<rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menu uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgFileMessagesFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="PickedMsgFolder(event.target,'msgFileMessagesFolderPicker')"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</menu>
</overlay>

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

@ -1,8 +1,11 @@
var okCallback = 0;
var pickerID = null;
function newFolderNameOnLoad()
function newFolderNameOnLoad(pickerDOMID)
{
doSetOKCancel(newFolderNameOKButton, 0);
pickerID = pickerDOMID;
doSetOKCancel(newFolderNameOKButtonCallback, 0);
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0])
@ -18,39 +21,30 @@ function newFolderNameOnLoad()
top.okCallback = window.arguments[0].okCallback;
}
// pre select the option, based on what they selected in the folder pane
var selectedParentFolder = document.getElementById('selectedparentfolder');
// dump("selectedParentFolder = " + selectedParentFolder + "\n");
// pre select the folderPicker, based on what they selected in the folder pane
if (window.arguments[0].preselectedURI) {
try {
options = selectedParentFolder.options;
for (i=1;i<options.length;i++) {
var uri = options[i].getAttribute('uri');
// dump(uri + " vs " + window.arguments[0].preselectedURI + "\n");
if (uri == window.arguments[0].preselectedURI) {
// dump("preselect: " + uri + " index = " + i + "\n");
selectedParentFolder.selectedIndex = i;
break;
}
}
dump("pick this one: " + window.arguments[0].preselectedURI + "\n");
}
catch (ex) {
// dump("failed to preflight the select thing.\n");
dump("failed to preflight the folderPicker thing.\n");
}
}
else {
// dump("passed null for preselectedURI, do nothing\n");
dump("passed null for preselectedURI, do nothing\n");
}
MsgFolderPickerOnLoad(pickerID);
}
function newFolderNameOKButton()
function newFolderNameOKButtonCallback()
{
if ( top.okCallback )
{
var name = document.getElementById('name').value;
top.okCallback(name);
var name = document.getElementById("name").value;
var picker = document.getElementById(pickerID);
var uri = picker.getAttribute("uri");
dump("uri,name in callback = " + uri + "," + name + "\n");
top.okCallback(name, uri);
}
return true;

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

@ -19,19 +19,20 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/newFolderNameDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical"
class="dialog"
onload="newFolderNameOnLoad()"
onload="newFolderNameOnLoad('msgNewFolderPicker');"
style="padding:10px">
<html:script language="JavaScript" src="chrome://global/content/strres.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/widgetglue.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/newFolderNameDialog.js"/>
<keyset id="keyset"/>
@ -41,27 +42,13 @@ Rights Reserved.
<spring flex="100%"/>
<html:div style="margin-bottom:.3em">&name.label;</html:div>
<html:input tabindex="0" type="text" id="name" style="width:100%"/>
<html:select id="selectedparentfolder"
datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
ref="msgaccounts:/">
<html:div flex="100%"/>
<template>
<rule nc:ServerType="pop3">
<html:option uri="..." value="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule nc:ServerType="none">
<html:option uri="..." value="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule nc:ServerType="imap">
<html:option uri="..." value="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
</template>
</html:select>
<box align="horizontal">
<menu id="msgNewFolderPicker"/>
<spring flex="100%"/>
</box>
<spring flex="100%"/>
<box id="okCancelButtons"/>
</box>

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

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<!--
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/
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.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/newFolderNameDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical"
class="dialog"
onload="newFolderNameOnLoad('msgRenameFolderPicker');"
style="padding:10px">
<html:script language="JavaScript" src="chrome://global/content/strres.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/widgetglue.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/newFolderNameDialog.js"/>
<keyset id="keyset"/>
<box align="vertical" style="width:36em; min-height:12em">
<spring flex="100%"/>
<html:div style="margin-bottom:.3em">&name.label;</html:div>
<html:input tabindex="0" type="text" id="name" style="width:100%"/>
<box align="horizontal">
<menu id="msgRenameFolderPicker"/>
<spring flex="100%"/>
</box>
<spring flex="100%"/>
<box id="okCancelButtons"/>
</box>
</window>

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

@ -19,19 +19,21 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/subscribeDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical"
class="dialog"
onload="newFolderNameOnLoad()"
onload="newFolderNameOnLoad('msgSubscribeFolderPicker')"
style="padding:10px">
<html:script language="JavaScript" src="chrome://global/content/strres.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/widgetglue.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/newFolderNameDialog.js"/>
<keyset id="keyset"/>
@ -44,17 +46,11 @@ Rights Reserved.
<html:input tabindex="0" type="text" id="name" style="width:100%"/>
<html:select id="selectedparentfolder"
datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
ref="msgaccounts:/">
<template>
<rule nc:ServerType="nntp" nc:IsServer="true" >
<html:option uri="..." value="..." label="rdf:http://home.netscape.com/NC-rdf#Name" />
</rule>
</template>
</html:select>
<box align="horizontal">
<menu id="msgSubscribeFolderPicker"/>
<spring flex="100%"/>
</box>
<spring flex="100%"/>
<box id="okCancelButtons"/>
</box>

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

@ -445,8 +445,9 @@ function MsgSubscribe()
MsgNewSubfolder("chrome://messenger/content/subscribeDialog.xul", windowTitle);
}
function MsgNewSubfolder(chromeWindowURL,windowTitle)
function GetSelectedFolderURI()
{
var uri = null;
var selectedFolder = null;
try {
var folderTree = GetFolderTree();
@ -457,39 +458,51 @@ function MsgNewSubfolder(chromeWindowURL,windowTitle)
selectedFolder = selectedFolderList[0];
}
else {
// dump("number of selected folder was " + selectedFolderList.length + "\n");
//dump("number of selected folder was " + selectedFolderList.length + "\n");
}
}
catch (ex) {
// dump("failed to get the selected folder\n");
uri = null;
}
try {
var preselectedURI = null;
if (selectedFolder) {
preselectedURI = selectedFolder.getAttribute('id');
uri = selectedFolder.getAttribute('id');
// dump("folder to preselect: " + preselectedURI + "\n");
}
var dialog = window.openDialog(
chromeWindowURL,
"",
"chrome",
{preselectedURI:preselectedURI, title:windowTitle,
okCallback:NewFolder});
}
catch (ex) {
// dump("failed to open the new folder dialog\n");
uri = null;
}
return uri;
}
function NewFolder(name)
function MsgNewSubfolder(chromeWindowURL,windowTitle)
{
var folderTree = GetFolderTree();
var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0];
var preselectedURI = GetSelectedFolderURI();
dump("preselectedURI = " + preselectedURI + "\n");
var dialog = window.openDialog(
chromeWindowURL,
"",
"chrome,modal",
{preselectedURI:preselectedURI, title:windowTitle,
okCallback:NewFolder});
}
messenger.NewFolder(folderTree.database, selectedFolder, name);
function NewFolder(name,uri)
{
var tree = GetFolderTree();
dump("uri,name = " + uri + "," + name + "\n");
if (uri && (uri != "") && name && (name != "")) {
var selectedFolder = GetResourceFromUri(uri);
dump("selectedFolder = " + selectedFolder + "\n");
messenger.NewFolder(tree.database, selectedFolder, name);
}
else {
dump("no name or nothing selected\n");
}
}
@ -589,41 +602,34 @@ function MsgUpdateMsgCount() {}
function MsgRenameFolder()
{
var tree = GetFolderTree();
if (tree)
{
var folderList = tree.selectedItems;
if (folderList && folderList.length == 1)
{
var folder = folderList[0];
if (folder)
{
var dialog = window.openDialog(
"chrome://messenger/content/newFolderNameDialog.xul",
var preselectedURI = GetSelectedFolderURI();
dump("preselectedURI = " + preselectedURI + "\n");
var windowTitle = Bundle.GetStringFromName("renameFolderDialogTitle");
var dialog = window.openDialog(
"chrome://messenger/content/renameFolderNameDialog.xul",
"newFolder",
"chrome,modal",
{title:"Rename Folder",
okCallback:RenameFolder});
}
}
}
{preselectedURI:preselectedURI, title:windowTitle,
okCallback:RenameFolder});
}
function RenameFolder(name)
function RenameFolder(name,uri)
{
dump("uri,name = " + uri + "," + name + "\n");
var tree = GetFolderTree();
if (tree)
{
var folderList = tree.selectedItems;
if (folderList && folderList.length == 1)
{
var folder = folderList[0];
if (folder)
{
if (uri && (uri != "") && name && (name != "")) {
var selectedFolder = GetResourceFromUri(uri);
tree.clearItemSelection();
messenger.RenameFolder(tree.database, folder, name);
}
messenger.RenameFolder(tree.database, selectedFolder, name);
}
else {
dump("no name or nothing selected\n");
}
}
else {
dump("no tree\n");
}
}
@ -812,7 +818,7 @@ function MsgMarkThreadAsRead() {}
function MsgMarkByDate() {}
function MsgMarkAllRead()
{
var folderTree = GetFolderTree();;
var folderTree = GetFolderTree();
var selectedFolderList = folderTree.selectedItems;
if(selectedFolderList.length > 0)
{
@ -900,3 +906,20 @@ var gMeterObserver;
dump( "meter mode=" + meter.getAttribute("mode") + "\n" );
dump( "meter value=" + meter.getAttribute("value") + "\n" );
}
function GetMsgFolderFromUri(uri)
{
var resource = GetResourceFromUri(uri);
var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
return msgfolder;
}
function GetResourceFromUri(uri)
{
var RDF = Components.classes['component://netscape/rdf/rdf-service'].getService();
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
var resource = RDF.GetResource(uri);
return resource;
}

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

@ -6,3 +6,4 @@ newFolderNameDialog.dtd
subscribeDialog.dtd
sidebar-messenger.dtd
sidebar-messenger-rdf.dtd
msgFolderPickerOverlay.dtd

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

@ -35,6 +35,7 @@ EXPORT_RESOURCE_CONTENT = \
$(srcdir)/subscribeDialog.dtd \
$(srcdir)/sidebar-messenger.dtd \
$(srcdir)/sidebar-messenger-rdf.dtd \
$(srcdir)/msgFolderPickerOverlay.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -35,6 +35,7 @@ install::
$(MAKE_INSTALL) subscribeDialog.dtd $(LOCALEDIR)
$(MAKE_INSTALL) sidebar-messenger.dtd $(LOCALEDIR)
$(MAKE_INSTALL) sidebar-messenger-rdf.dtd $(LOCALEDIR)
$(MAKE_INSTALL) msgFolderPickerOverlay.dtd $(LOCALEDIR)
clobber::
rm -f $(DIST)\bin\chrome\messenger\locale\en-US\*.*

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

@ -221,6 +221,7 @@ Rights Reserved.
<!ENTITY moveMsgMenu.label "Move Message">
<!ENTITY copyMsgMenu.label "Copy Message">
<!ENTITY fileHereMenu.label "File Here">
<!ENTITY copyHereMenu.label "Copy Here">
<!ENTITY addSenderToAddressBookCmd.label ".Add Sender to Address Book">
<!ENTITY addAllToAddressBookCmd.label ".Add All to Address Book">
<!ENTITY markMenu.label "Mark">

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

@ -24,3 +24,4 @@
#
newFolderDialogTitle=New Folder
subscribeDialogTitle=Subscribe
renameFolderDialogTitle=Rename Folder

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

@ -0,0 +1,29 @@
<!--
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/
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.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Labels -->
<!ENTITY subscribechoosethis.label "choose this news server">
<!ENTITY subscribeclickhere.label "click here to choose a news server">
<!ENTITY newfolderchoosethis.label "choose this for the parent">
<!ENTITY newfolderclickhere.label "click here to choose a parent">
<!ENTITY renamefolderchoosethis.label "choose this folder">
<!ENTITY renamefolderclickhere.label "click here to choose a folder">
<!ENTITY filemessageschoosethis.label "choose this folder">
<!ENTITY filemessagesclickhere.label "click here to choose a folder">

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

@ -19,4 +19,4 @@ Rights Reserved.
-->
<!-- Labels -->
<!ENTITY name.label "New Folder Name">
<!ENTITY name.label "New Folder Name">

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

@ -197,12 +197,10 @@ iframe {
list-style-image: url("chrome://messenger/skin/folder-newsgroup.gif");
}
.folderMenuItem[IsServer="true"][ServerType="nntp"] {
display: none;
.folderMenuItem[IsServer="true"][ServerType="nntp"] > .menu-left {
list-style-image: url("chrome://messenger/skin/server-news.gif");
}
#button_getmsg {
list-style-image:url("chrome://messenger/skin/getmsg.gif");
}

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

@ -650,7 +650,7 @@ nsMessenger::SaveAs(const char* url, PRBool asFile, nsIMsgIdentity* identity)
if (aListener)
{
if (identity)
rv = identity->GetStationaryFolder(
rv = identity->GetStationeryFolder(
getter_Copies(aListener->m_templateUri));
if (NS_FAILED(rv)) return rv;
needDummyHeader =
@ -1090,20 +1090,15 @@ nsMessenger::DoMarkMessagesFlagged(nsIRDFCompositeDataSource *database, nsISuppo
}
NS_IMETHODIMP
nsMessenger::NewFolder(nsIRDFCompositeDataSource *database, nsIDOMXULElement *parentFolderElement,
nsMessenger::NewFolder(nsIRDFCompositeDataSource *database, nsIRDFResource *parentFolderResource,
const char *name)
{
nsresult rv;
nsCOMPtr<nsIRDFResource> folderResource;
nsCOMPtr<nsISupportsArray> nameArray, folderArray;
if(!parentFolderElement || !name)
if(!parentFolderResource || !name)
return NS_ERROR_NULL_POINTER;
rv = parentFolderElement->GetResource(getter_AddRefs(folderResource));
if(NS_FAILED(rv))
return rv;
rv = NS_NewISupportsArray(getter_AddRefs(nameArray));
if(NS_FAILED(rv))
{
@ -1114,7 +1109,7 @@ nsMessenger::NewFolder(nsIRDFCompositeDataSource *database, nsIDOMXULElement *pa
if(NS_FAILED(rv))
return NS_ERROR_OUT_OF_MEMORY;
folderArray->AppendElement(folderResource);
folderArray->AppendElement(parentFolderResource);
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if(NS_SUCCEEDED(rv))
@ -1131,29 +1126,25 @@ nsMessenger::NewFolder(nsIRDFCompositeDataSource *database, nsIDOMXULElement *pa
NS_IMETHODIMP
nsMessenger::RenameFolder(nsIRDFCompositeDataSource* db,
nsIDOMXULElement* folder,
nsIRDFResource* folderResource,
const char* name)
{
nsresult rv = NS_ERROR_NULL_POINTER;
if (!db || !folder || !name || !*name) return rv;
if (!db || !folderResource || !name || !*name) return rv;
nsCOMPtr<nsISupports> streamSupport;
rv = NS_NewCharInputStream(getter_AddRefs(streamSupport), name);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupportsArray> folderArray;
nsCOMPtr<nsISupportsArray> argsArray;
nsCOMPtr<nsIRDFResource> folderResource;
rv = folder->GetResource(getter_AddRefs(folderResource));
if (NS_SUCCEEDED(rv))
{
rv = NS_NewISupportsArray(getter_AddRefs(folderArray));
if (NS_FAILED(rv)) return rv;
folderArray->AppendElement(folderResource);
rv = NS_NewISupportsArray(getter_AddRefs(argsArray));
if (NS_FAILED(rv)) return rv;
argsArray->AppendElement(streamSupport);
rv = DoCommand(db, NC_RDF_RENAME, folderArray, argsArray);
}
rv = NS_NewISupportsArray(getter_AddRefs(folderArray));
if (NS_FAILED(rv)) return rv;
folderArray->AppendElement(folderResource);
rv = NS_NewISupportsArray(getter_AddRefs(argsArray));
if (NS_FAILED(rv)) return rv;
argsArray->AppendElement(streamSupport);
rv = DoCommand(db, NC_RDF_RENAME, folderArray, argsArray);
}
return rv;
}

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

@ -61,7 +61,7 @@
#define BUF_STR_LEN 1024
#if defined(DEBUG_alecf) || defined(DEBUG_sspitzer) || defined(DEBUG_seth)
#if defined(DEBUG_alecf) || defined(DEBUG_sspitzer_) || defined(DEBUG_seth_)
#define DEBUG_ACCOUNTMANAGER 1
#endif
@ -1394,8 +1394,8 @@ nsMsgAccountManager::MigrateIdentity(nsIMsgIdentity *identity)
MIGRATE_SIMPLE_STR_PREF(PREF_4X_MAIL_DEFAULT_DRAFTS,identity,SetDraftFolder)
CONVERT_4X_URI(identity,DEFAULT_4X_DRAFTS_FOLDER_NAME,GetDraftFolder,SetDraftFolder)
MIGRATE_SIMPLE_STR_PREF(PREF_4X_MAIL_DEFAULT_TEMPLATES,identity,SetStationaryFolder)
CONVERT_4X_URI(identity,DEFAULT_4X_TEMPLATES_FOLDER_NAME,GetStationaryFolder,SetStationaryFolder)
MIGRATE_SIMPLE_STR_PREF(PREF_4X_MAIL_DEFAULT_TEMPLATES,identity,SetStationeryFolder)
CONVERT_4X_URI(identity,DEFAULT_4X_TEMPLATES_FOLDER_NAME,GetStationeryFolder,SetStationeryFolder)
// what about the new 5.0 spam folder pref?
return NS_OK;
@ -2169,7 +2169,7 @@ nsMsgAccountManager::CopyIdentity(nsIMsgIdentity *srcIdentity, nsIMsgIdentity *d
COPY_IDENTITY_WSTR_VALUE(srcIdentity,destIdentity,GetFullName,SetFullName)
COPY_IDENTITY_WSTR_VALUE(srcIdentity,destIdentity,GetOrganization,SetOrganization)
COPY_IDENTITY_STR_VALUE(srcIdentity,destIdentity,GetDraftFolder,SetDraftFolder)
COPY_IDENTITY_STR_VALUE(srcIdentity,destIdentity,GetStationaryFolder,SetStationaryFolder)
COPY_IDENTITY_STR_VALUE(srcIdentity,destIdentity,GetStationeryFolder,SetStationeryFolder)
return NS_OK;
}
@ -2834,10 +2834,15 @@ nsMsgAccountManager::findIdentitiesForServer(nsISupports* element, void *aData)
nsCOMPtr<nsIMsgIncomingServer> thisServer;
rv = account->GetIncomingServer(getter_AddRefs(thisServer));
if (NS_FAILED(rv)) return PR_TRUE;
nsXPIDLCString serverKey;
entry->server->GetKey(getter_Copies(serverKey));
NS_ASSERTION(thisServer, "thisServer is null");
NS_ASSERTION(entry, "entry is null");
NS_ASSERTION(entry->server, "entry->server is null");
// if this happens, bail.
if (!thisServer || !entry || !(entry->server)) return PR_TRUE;
entry->server->GetKey(getter_Copies(serverKey));
nsXPIDLCString thisServerKey;
thisServer->GetKey(getter_Copies(thisServerKey));
if (PL_strcmp(serverKey, thisServerKey)==0) {

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

@ -62,6 +62,10 @@ nsIRDFResource* nsMsgFolderDataSource::kNC_FolderTreeNameSort= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_SpecialFolder= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_ServerType = nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_IsServer = nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_CanSubscribe = nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_CanFileMessages = nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_CanCreateSubfolders = nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_CanRename = nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_TotalMessages= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_TotalUnreadMessages= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_Charset = nsnull;
@ -111,6 +115,10 @@ nsMsgFolderDataSource::~nsMsgFolderDataSource (void)
NS_RELEASE2(kNC_SpecialFolder, refcnt);
NS_RELEASE2(kNC_ServerType, refcnt);
NS_RELEASE2(kNC_IsServer, refcnt);
NS_RELEASE2(kNC_CanSubscribe, refcnt);
NS_RELEASE2(kNC_CanFileMessages, refcnt);
NS_RELEASE2(kNC_CanCreateSubfolders, refcnt);
NS_RELEASE2(kNC_CanRename, refcnt);
NS_RELEASE2(kNC_TotalMessages, refcnt);
NS_RELEASE2(kNC_TotalUnreadMessages, refcnt);
NS_RELEASE2(kNC_Charset, refcnt);
@ -156,6 +164,10 @@ nsresult nsMsgFolderDataSource::Init()
rdf->GetResource(NC_RDF_SPECIALFOLDER, &kNC_SpecialFolder);
rdf->GetResource(NC_RDF_SERVERTYPE, &kNC_ServerType);
rdf->GetResource(NC_RDF_ISSERVER, &kNC_IsServer);
rdf->GetResource(NC_RDF_CANSUBSCRIBE, &kNC_CanSubscribe);
rdf->GetResource(NC_RDF_CANFILEMESSAGES, &kNC_CanFileMessages);
rdf->GetResource(NC_RDF_CANCREATESUBFOLDERS, &kNC_CanCreateSubfolders);
rdf->GetResource(NC_RDF_CANRENAME, &kNC_CanRename);
rdf->GetResource(NC_RDF_TOTALMESSAGES, &kNC_TotalMessages);
rdf->GetResource(NC_RDF_TOTALUNREADMESSAGES, &kNC_TotalUnreadMessages);
rdf->GetResource(NC_RDF_CHARSET, &kNC_Charset);
@ -380,6 +392,10 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
(kNC_FolderTreeName == property) ||
(kNC_SpecialFolder == property) ||
(kNC_IsServer == property) ||
(kNC_CanSubscribe == property) ||
(kNC_CanFileMessages == property) ||
(kNC_CanCreateSubfolders == property) ||
(kNC_CanRename == property) ||
(kNC_ServerType == property))
{
nsSingletonEnumerator* cursor =
@ -495,6 +511,10 @@ nsMsgFolderDataSource::getFolderArcLabelsOut(nsISupportsArray **arcs)
(*arcs)->AppendElement(kNC_SpecialFolder);
(*arcs)->AppendElement(kNC_ServerType);
(*arcs)->AppendElement(kNC_IsServer);
(*arcs)->AppendElement(kNC_CanSubscribe);
(*arcs)->AppendElement(kNC_CanFileMessages);
(*arcs)->AppendElement(kNC_CanCreateSubfolders);
(*arcs)->AppendElement(kNC_CanRename);
(*arcs)->AppendElement(kNC_TotalMessages);
(*arcs)->AppendElement(kNC_TotalUnreadMessages);
(*arcs)->AppendElement(kNC_Charset);
@ -820,6 +840,14 @@ nsresult nsMsgFolderDataSource::createFolderNode(nsIMsgFolder* folder,
rv = createFolderServerTypeNode(folder, target);
else if ((kNC_IsServer == property))
rv = createFolderIsServerNode(folder, target);
else if ((kNC_CanSubscribe == property))
rv = createFolderCanSubscribeNode(folder, target);
else if ((kNC_CanFileMessages == property))
rv = createFolderCanFileMessagesNode(folder, target);
else if ((kNC_CanCreateSubfolders == property))
rv = createFolderCanCreateSubfoldersNode(folder, target);
else if ((kNC_CanRename == property))
rv = createFolderCanRenameNode(folder, target);
else if ((kNC_TotalMessages == property))
rv = createTotalMessagesNode(folder, target);
else if ((kNC_TotalUnreadMessages == property))
@ -875,7 +903,6 @@ nsresult nsMsgFolderDataSource::createFolderTreeNameNode(nsIMsgFolder *folder,
{
PRInt32 unreadMessages;
nsresult rv;
rv = folder->GetNumUnread(PR_FALSE, &unreadMessages);
if(NS_SUCCEEDED(rv))
{
@ -979,6 +1006,83 @@ nsMsgFolderDataSource::createFolderIsServerNode(nsIMsgFolder* folder,
return NS_OK;
}
nsresult
nsMsgFolderDataSource::createFolderCanSubscribeNode(nsIMsgFolder* folder,
nsIRDFNode **target)
{
nsresult rv;
PRBool canSubscribe;
rv = folder->GetCanSubscribe(&canSubscribe);
if (NS_FAILED(rv)) return rv;
*target = nsnull;
if (canSubscribe)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
return NS_OK;
}
nsresult
nsMsgFolderDataSource::createFolderCanFileMessagesNode(nsIMsgFolder* folder,
nsIRDFNode **target)
{
nsresult rv;
PRBool canFileMessages;
rv = folder->GetCanFileMessages(&canFileMessages);
if (NS_FAILED(rv)) return rv;
*target = nsnull;
if (canFileMessages)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
return NS_OK;
}
nsresult
nsMsgFolderDataSource::createFolderCanCreateSubfoldersNode(nsIMsgFolder* folder,
nsIRDFNode **target)
{
nsresult rv;
PRBool canCreateSubfolders;
rv = folder->GetCanCreateSubfolders(&canCreateSubfolders);
if (NS_FAILED(rv)) return rv;
*target = nsnull;
if (canCreateSubfolders)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
return NS_OK;
}
nsresult
nsMsgFolderDataSource::createFolderCanRenameNode(nsIMsgFolder* folder,
nsIRDFNode **target)
{
nsresult rv;
PRBool canRename;
rv = folder->GetCanRename(&canRename);
if (NS_FAILED(rv)) return rv;
*target = nsnull;
if (canRename)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
return NS_OK;
}
nsresult
nsMsgFolderDataSource::createTotalMessagesNode(nsIMsgFolder *folder,
nsIRDFNode **target)
@ -1412,6 +1516,10 @@ nsresult nsMsgFolderDataSource::DoFolderHasAssertion(nsIMsgFolder *folder,
(kNC_SpecialFolder == property) ||
(kNC_ServerType == property) ||
(kNC_IsServer == property) ||
(kNC_CanSubscribe == property) ||
(kNC_CanFileMessages == property) ||
(kNC_CanCreateSubfolders == property) ||
(kNC_CanRename == property) ||
(kNC_TotalMessages == property) ||
(kNC_TotalUnreadMessages == property) ||
(kNC_Charset == property) ||

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

@ -120,6 +120,14 @@ protected:
nsIRDFNode **target);
nsresult createFolderIsServerNode(nsIMsgFolder *folder,
nsIRDFNode **target);
nsresult createFolderCanSubscribeNode(nsIMsgFolder *folder,
nsIRDFNode **target);
nsresult createFolderCanFileMessagesNode(nsIMsgFolder *folder,
nsIRDFNode **target);
nsresult createFolderCanCreateSubfoldersNode(nsIMsgFolder *folder,
nsIRDFNode **target);
nsresult createFolderCanRenameNode(nsIMsgFolder *folder,
nsIRDFNode **target);
nsresult createTotalMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
nsresult createUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
nsresult createCharsetNode(nsIMsgFolder *folder, nsIRDFNode **target);
@ -178,6 +186,10 @@ protected:
static nsIRDFResource* kNC_SpecialFolder;
static nsIRDFResource* kNC_ServerType;
static nsIRDFResource* kNC_IsServer;
static nsIRDFResource* kNC_CanSubscribe;
static nsIRDFResource* kNC_CanFileMessages;
static nsIRDFResource* kNC_CanCreateSubfolders;
static nsIRDFResource* kNC_CanRename;
static nsIRDFResource* kNC_TotalMessages;
static nsIRDFResource* kNC_TotalUnreadMessages;
static nsIRDFResource* kNC_Charset;

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

@ -54,6 +54,10 @@ typedef struct _nsMsgRDFNotification {
#define NC_RDF_SPECIALFOLDER NC_NAMESPACE_URI "SpecialFolder"
#define NC_RDF_SERVERTYPE NC_NAMESPACE_URI "ServerType"
#define NC_RDF_ISSERVER NC_NAMESPACE_URI "IsServer"
#define NC_RDF_CANSUBSCRIBE NC_NAMESPACE_URI "CanSubscribe"
#define NC_RDF_CANFILEMESSAGES NC_NAMESPACE_URI "CanFileMessages"
#define NC_RDF_CANCREATESUBFOLDERS NC_NAMESPACE_URI "CanCreateSubfolders"
#define NC_RDF_CANRENAME NC_NAMESPACE_URI "CanRename"
#define NC_RDF_TOTALMESSAGES NC_NAMESPACE_URI "TotalMessages"
#define NC_RDF_TOTALUNREADMESSAGES NC_NAMESPACE_URI "TotalUnreadMessages"
#define NC_RDF_CHARSET NC_NAMESPACE_URI "Charset"

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

@ -462,6 +462,58 @@ nsMsgFolder::GetIsServer(PRBool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsMsgFolder::GetCanSubscribe(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
// by default, you can't subscribe.
// if otherwise, override it.
*aResult = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsMsgFolder::GetCanFileMessages(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
PRBool isServer = PR_FALSE;
nsresult rv = GetIsServer(&isServer);
if (NS_FAILED(rv)) return rv;
// by default, you can't file messages into servers, only to folders
// if otherwise, override it.
*aResult = !isServer;
return NS_OK;
}
NS_IMETHODIMP
nsMsgFolder::GetCanCreateSubfolders(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
// by default, you can create subfolders on server and folders
// if otherwise, override it.
*aResult = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsMsgFolder::GetCanRename(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
PRBool isServer = PR_FALSE;
nsresult rv = GetIsServer(&isServer);
if (NS_FAILED(rv)) return rv;
// by default, you can't rename servers, only folders
// if otherwise, override it.
*aResult = !isServer;
return NS_OK;
}
NS_IMETHODIMP nsMsgFolder::GetPrettyName(PRUnichar ** name)
{
if (!name)
@ -1565,20 +1617,21 @@ NS_IMETHODIMP nsMsgFolder::GetNewMessagesNotificationDescription(PRUnichar * *aD
NS_IMETHODIMP nsMsgFolder::GetRootFolder(nsIMsgFolder * *aRootFolder)
{
if(!aRootFolder)
return NS_ERROR_NULL_POINTER;
if (!aRootFolder) return NS_ERROR_NULL_POINTER;
nsresult rv;
nsCOMPtr<nsIMsgIncomingServer> server;
rv = GetServer(getter_AddRefs(server));
if(NS_FAILED(rv))
return rv;
if (NS_FAILED(rv)) return rv;
NS_ASSERTION(server, "server is null");
// if this happens, bail.
if (!server) return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIFolder> aRoot;
rv = server->GetRootFolder(getter_AddRefs(aRoot));
if(NS_FAILED(rv) || !aRoot)
return rv;
if (NS_FAILED(rv)) return rv;
if (!aRoot) return NS_ERROR_NULL_POINTER;
return aRoot->QueryInterface(nsCOMTypeInfo<nsIMsgFolder>::GetIID(), (void**)aRootFolder);
}

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

@ -75,6 +75,10 @@ public:
NS_IMETHOD GetShowDeletedMessages(PRBool *aShowDeletedMessages);
NS_IMETHOD GetServer(nsIMsgIncomingServer * *aServer);
NS_IMETHOD GetIsServer(PRBool *aIsServer);
NS_IMETHOD GetCanSubscribe(PRBool *aCanSubscribe);
NS_IMETHOD GetCanFileMessages(PRBool *aCanFileMessages);
NS_IMETHOD GetCanCreateSubfolders(PRBool *aCanCreateSubfolders);
NS_IMETHOD GetCanRename(PRBool *aCanRename);
NS_IMETHOD OnCloseFolder(void);
NS_IMETHOD Delete(void);
NS_IMETHOD DeleteSubFolders(nsISupportsArray *folders);
@ -103,7 +107,7 @@ public:
NS_IMETHOD GetKnowsSearchNntpExtension(PRBool *aKnowsSearchNntpExtension);
NS_IMETHOD GetAllowsPosting(PRBool *aAllowsPosting);
NS_IMETHOD GetDisplayRecipients(PRBool *aDisplayRecipients);
NS_IMETHOD GetRelativePathName(char * *aRelativePathName);
NS_IMETHOD GetRelativePathName(char * *aRelativePathName);
NS_IMETHOD GetSizeOnDisk(PRUint32 *aSizeOnDisk);
NS_IMETHOD RememberPassword(const char *password);
NS_IMETHOD GetRememberedPassword(char * *aRememberedPassword);

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

@ -393,7 +393,7 @@ NS_IMPL_IDPREF_BOOL(BccOthers, "bcc_other");
NS_IMPL_IDPREF_STR (BccList, "bcc_other_list");
NS_IMPL_IDPREF_STR (DraftFolder, "draft_folder");
NS_IMPL_IDPREF_STR (StationaryFolder, "stationary_folder");
NS_IMPL_IDPREF_STR (StationeryFolder, "stationery_folder");
NS_IMPL_IDPREF_STR (JunkMailFolder, "spam_folder");

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

@ -2082,7 +2082,7 @@ GetFolderURIFromUserPrefs(nsMsgDeliverMode aMode,
}
else if (aMode == nsMsgSaveAsTemplate) // SaveAsTemplate (Templates)
{
rv = identity->GetStationaryFolder(&uri);
rv = identity->GetStationeryFolder(&uri);
}
else
{

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

@ -857,6 +857,16 @@ NS_IMETHODIMP nsImapMailFolder::GetSizeOnDisk(PRUint32 * size)
return rv;
}
NS_IMETHODIMP
nsImapMailFolder::GetCanCreateSubfolders(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
// if it's the Inbox, then you can't create a subfolder.
// yes, I know this isn't true for all IMAP servers, but it works for now
*aResult = !(mFlags & MSG_FOLDER_FLAG_INBOX);
return NS_OK;
}
nsresult nsImapMailFolder::GetServerKey(char **serverKey)
{
// look for matching imap folders, then pop folders

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

@ -134,7 +134,9 @@ public:
NS_IMETHOD GetRequiresCleanup(PRBool *requiresCleanup);
NS_IMETHOD GetSizeOnDisk(PRUint32 * size);
NS_IMETHOD GetCanCreateSubfolders(PRBool *aResult);
NS_IMETHOD UserNeedsToAuthenticateForFolder(PRBool displayOnly, PRBool *authenticate);
NS_IMETHOD RememberPassword(const char *password);
NS_IMETHOD GetRememberedPassword(char ** password);

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

@ -23,7 +23,7 @@
#ifndef _NNTPCore_H__
#define _NNTPCore_H__
#if defined(DEBUG_seth) || defined(DEBUG_sspitzer)
#if defined (DEBUG_seth_) || defined(DEBUG_sspitzer_)
#define DEBUG_NEWS 1
#endif

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

@ -388,6 +388,49 @@ nsMsgNewsFolder::UpdateFolder(nsIMsgWindow *aWindow)
return GetNewMessages(aWindow);
}
NS_IMETHODIMP
nsMsgNewsFolder::GetCanSubscribe(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_FALSE;
PRBool isNewsServer = PR_FALSE;
nsresult rv = GetIsServer(&isNewsServer);
if (NS_FAILED(rv)) return rv;
// you can only subscribe to news servers, not news groups
*aResult = isNewsServer;
return NS_OK;
}
NS_IMETHODIMP
nsMsgNewsFolder::GetCanFileMessages(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
// you can't file messages into a news server or news group
*aResult = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsMsgNewsFolder::GetCanCreateSubfolders(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_FALSE;
// you can't create subfolders on a news server or a news group
return NS_OK;
}
NS_IMETHODIMP
nsMsgNewsFolder::GetCanRename(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_FALSE;
// you can't rename a news server or a news group
return NS_OK;
}
NS_IMETHODIMP
nsMsgNewsFolder::GetMessages(nsISimpleEnumerator* *result)
{

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

@ -94,6 +94,10 @@ public:
NS_IMETHOD GetNewMessages(nsIMsgWindow *aWindow);
NS_IMETHOD GetPath(nsIFileSpec** aPathName);
NS_IMETHOD GetCanSubscribe(PRBool *aResult);
NS_IMETHOD GetCanFileMessages(PRBool *aResult);
NS_IMETHOD GetCanCreateSubfolders(PRBool *aResult);
NS_IMETHOD GetCanRename(PRBool *aResult);
protected:
nsresult AddNewsgroupToNewsrcFile(const char *newsgroupname);

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

@ -221,6 +221,7 @@ Rights Reserved.
<!ENTITY moveMsgMenu.label "Move Message">
<!ENTITY copyMsgMenu.label "Copy Message">
<!ENTITY fileHereMenu.label "File Here">
<!ENTITY copyHereMenu.label "Copy Here">
<!ENTITY addSenderToAddressBookCmd.label ".Add Sender to Address Book">
<!ENTITY addAllToAddressBookCmd.label ".Add All to Address Book">
<!ENTITY markMenu.label "Mark">

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

@ -24,3 +24,4 @@
#
newFolderDialogTitle=New Folder
subscribeDialogTitle=Subscribe
renameFolderDialogTitle=Rename Folder

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

@ -0,0 +1,29 @@
<!--
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/
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.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Labels -->
<!ENTITY subscribechoosethis.label "choose this news server">
<!ENTITY subscribeclickhere.label "click here to choose a news server">
<!ENTITY newfolderchoosethis.label "choose this for the parent">
<!ENTITY newfolderclickhere.label "click here to choose a parent">
<!ENTITY renamefolderchoosethis.label "choose this folder">
<!ENTITY renamefolderclickhere.label "click here to choose a folder">
<!ENTITY filemessageschoosethis.label "choose this folder">
<!ENTITY filemessagesclickhere.label "click here to choose a folder">

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

@ -11,4 +11,4 @@
<!ENTITY specialFolderTitle.label "Special Folders">
<!ENTITY junkMailFolder.label "Keep junk mail in:">
<!ENTITY draftMailFolder.label "Keep message drafts in:">
<!ENTITY templateMailFolder.label "Keep message stationary in:">
<!ENTITY templateMailFolder.label "Keep message stationery in:">