Bug 358333 Hook up nsIAbDirectory::supportsMailingLists to Address Book UI. p=Paul Tomlin,r=me,mscott,sr=neil

This commit is contained in:
bugzilla%standard8.demon.co.uk 2006-11-20 19:07:55 +00:00
Родитель 07086ce19b
Коммит 48185cb855
12 изменённых файлов: 122 добавлений и 36 удалений

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

@ -74,6 +74,7 @@ var ResultsPaneController =
case "button_edit":
case "cmd_printcard":
case "cmd_printcardpreview":
case "cmd_newlist":
return true;
default:
return false;
@ -110,6 +111,15 @@ var ResultsPaneController =
case "cmd_printcardpreview":
case "button_edit":
return (GetSelectedCardIndex() != -1);
case "cmd_newlist":
var selectedDir = GetSelectedDirectory();
if (selectedDir) {
var abDir = GetDirectoryFromURI(selectedDir);
if (abDir) {
return abDir.supportsMailingLists;
}
}
return false;
default:
return false;
}
@ -135,6 +145,9 @@ var ResultsPaneController =
case "cmd_printcardpreview":
AbPrintPreviewCard();
break;
case "cmd_newlist":
AbNewList();
break;
}
},
@ -159,6 +172,7 @@ var DirPaneController =
case "button_edit":
case "cmd_printcard":
case "cmd_printcardpreview":
case "cmd_newlist":
return true;
default:
return false;
@ -214,6 +228,15 @@ var DirPaneController =
return (GetSelectedCardIndex() != -1);
case "button_edit":
return (GetSelectedDirectory() != null);
case "cmd_newlist":
selectedDir = GetSelectedDirectory();
if (selectedDir) {
var abDir = GetDirectoryFromURI(selectedDir);
if (abDir) {
return abDir.supportsMailingLists;
}
}
return false;
default:
return false;
}
@ -234,7 +257,10 @@ var DirPaneController =
break;
case "button_edit":
AbEditSelectedDirectory();
break;
break;
case "cmd_newlist":
AbNewList();
break;
}
},
@ -655,6 +681,7 @@ function DirPaneSelectionChange()
gPreviousDirTreeIndex = dirTree.currentIndex;
ChangeDirectoryByURI(GetSelectedDirectory());
}
goUpdateCommand('cmd_newlist');
}
function GetAbResultsBoxObject()

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

@ -68,14 +68,14 @@
sortActive="true"
sortDirection="ascending"
sortResource="http://home.netscape.com/NC-rdf#DirTreeNameSort">
<template>
<rule nc:IsWriteable="false"/>
<rule nc:IsMailList="false">
<template>
<rule nc:IsWriteable="false"/>
<rule nc:SupportsMailingLists="true">
<menuitem uri="..."
label="rdf:http://home.netscape.com/NC-rdf#DirName"
value="rdf:http://home.netscape.com/NC-rdf#DirUri"/>
</rule>
</template>
</template>
</menupopup>
</menulist>
</hbox>

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

@ -319,6 +319,7 @@ function CommandUpdate_AddressBook()
{
goUpdateCommand('cmd_delete');
goUpdateCommand('button_delete');
goUpdateCommand('cmd_newlist');
}
function ResultsPaneSelectionChanged()

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

@ -101,6 +101,7 @@
commandupdater="true"
events="focus"
oncommandupdate="goUpdateGlobalEditMenuItems()"/>
<command id="cmd_newlist" oncommand="goDoCommand('cmd_newlist');"/>
<command id="cmd_printcardpreview" oncommand="goDoCommand('cmd_printcardpreview');"/>
<command id="cmd_printcard" oncommand="goDoCommand('cmd_printcard');"/>
<command id="cmd_properties" oncommand="goDoCommand('button_edit');"/>
@ -193,7 +194,7 @@
<menuitem id="dirTreeContext-newlist"
label="&newlistButton.label;"
accesskey="&newlistButton.accesskey;"
oncommand="AbNewList();"/>
command="cmd_newlist"/>
<menuseparator/>
<menuitem id="dirTreeContext-delete"
label="&deleteButton.label;"
@ -247,7 +248,7 @@
<menu id="menu_New" label="&newMenu.label;" accesskey="&newMenu.accesskey;">
<menupopup id="menu_NewPopup">
<menuitem label="&newCard.label;" accesskey="&newCard.accesskey;" key="key_newCard" oncommand="AbNewCard();"/>
<menuitem label="&newListCmd.label;" accesskey="&newListCmd.accesskey;" oncommand="AbNewList();"/>
<menuitem label="&newListCmd.label;" accesskey="&newListCmd.accesskey;" command="cmd_newlist"/>
<menuitem label="&newAddressBookCmd.label;" accesskey="&newAddressBookCmd.accesskey;" oncommand="AbNewAddressBook()"/>
<menuitem label="&newLDAPDirectoryCmd.label;" id="addLDAP" accesskey="&newLDAPDirectoryCmd.accesskey;" oncommand="AbNewLDAPDirectory()"/>
<menuseparator/>
@ -506,7 +507,7 @@
<toolbarpalette id="AddressBookToolbarPalette">
<toolbarbutton class="toolbarbutton-1" id="button-newcard" label="&newcardButton.label;" tooltiptext="&newcardButton.tooltip;" oncommand="AbNewCard();"/>
<toolbarbutton class="toolbarbutton-1" id="button-newlist" label="&newlistButton.label;" tooltiptext="&newlistButton.tooltip;" oncommand="AbNewList();"/>
<toolbarbutton class="toolbarbutton-1" id="button-newlist" label="&newlistButton.label;" tooltiptext="&newlistButton.tooltip;" command="cmd_newlist"/>
<toolbarbutton class="toolbarbutton-1" id="button-editcard" label="&editButton.label;" tooltiptext="&editButton.tooltip;" oncommand="goDoCommand('button_edit');"/>
<toolbarbutton class="toolbarbutton-1" id="button-newmessage" label="&newmsgButton.label;" tooltiptext="&newmsgButton.tooltip;" oncommand="AbNewMessage();"/>
<toolbarbutton class="toolbarbutton-1" id="button-newim" label="&newIM.label;" tooltiptext="&newIM.tooltip;" oncommand="AbIMSelected();"/>

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

@ -74,6 +74,7 @@ var ResultsPaneController =
case "cmd_delete":
case "button_delete":
case "button_edit":
case "cmd_newlist":
return true;
default:
return false;
@ -121,6 +122,15 @@ var ResultsPaneController =
return (enabled && (numSelected > 0));
case "button_edit":
return (GetSelectedCardIndex() != -1);
case "cmd_newlist":
var selectedDir = GetSelectedDirectory();
if (selectedDir) {
var abDir = GetDirectoryFromURI(selectedDir);
if (abDir) {
return abDir.supportsMailingLists;
}
}
return false;
default:
return false;
}
@ -140,6 +150,9 @@ var ResultsPaneController =
case "button_edit":
AbEditSelectedCard();
break;
case "cmd_newlist":
AbNewList();
break;
}
},
@ -162,6 +175,7 @@ var DirPaneController =
case "cmd_delete":
case "button_delete":
case "button_edit":
case "cmd_newlist":
return true;
default:
return false;
@ -170,6 +184,8 @@ var DirPaneController =
isCommandEnabled: function(command)
{
var selectedDir;
switch (command) {
case "cmd_selectAll":
// the dirTree pane
@ -180,7 +196,7 @@ var DirPaneController =
return (gAbView != null);
case "cmd_delete":
case "button_delete":
var selectedDir = GetSelectedDirectory();
selectedDir = GetSelectedDirectory();
if (command == "cmd_delete" && selectedDir) {
goSetMenuValue(command, GetDirectoryFromURI(selectedDir).isMailList ? "valueList" : "valueAddressBook");
}
@ -210,6 +226,15 @@ var DirPaneController =
return false;
case "button_edit":
return (GetSelectedDirectory() != null);
case "cmd_newlist":
selectedDir = GetSelectedDirectory();
if (selectedDir) {
var abDir = GetDirectoryFromURI(selectedDir);
if (abDir) {
return abDir.supportsMailingLists;
}
}
return false;
default:
return false;
}
@ -229,6 +254,9 @@ var DirPaneController =
case "button_edit":
AbEditSelectedDirectory();
break;
case "cmd_newlist":
AbNewList();
break;
}
},

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

@ -63,8 +63,8 @@
sortDirection="ascending"
sortResource="http://home.netscape.com/NC-rdf#DirTreeNameSort">
<template>
<rule nc:IsWriteable="false"/>
<rule nc:IsMailList="false">
<rule nc:IsWriteable="false"/>
<rule nc:SupportsMailingLists="true">
<menuitem uri="..."
label="rdf:http://home.netscape.com/NC-rdf#DirName"
value="rdf:http://home.netscape.com/NC-rdf#DirUri"/>

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

@ -95,6 +95,8 @@ function AbPanelLoad()
UpgradeAddressBookResultsPaneUI("mailnews.ui.addressbook_panel_results.version");
SetupAbCommandUpdateHandlers();
LoadPreviouslySelectedAB();
// add a listener, so we can switch directories if
@ -176,4 +178,3 @@ function UpdateCardView()
{
// do nothing for ab panel
}

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

@ -63,13 +63,18 @@
<stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
</stringbundleset>
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/addressbook.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/abCommon.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/abResultsPane.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/abSelectAddressesDialog.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/addressbook-panel.js"/>
<popup id="composeMail">
<commandset id="addressbook-panel-commandset">
<command id="cmd_newlist" oncommand="AbNewList();"/>
</commandset>
<popup id="composeMail" onpopupshowing="CommandUpdate_AddressBook();">
<menuitem label="&toButton.label;" accesskey="&toButton.accesskey;" oncommand="AbPanelAdd('addr_to');" default="true"/>
<menuitem label="&ccButton.label;" accesskey="&ccButton.accesskey;" oncommand="AbPanelAdd('addr_cc');"/>
<menuitem label="&bccButton.label;" accesskey="&bccButton.accesskey;" oncommand="AbPanelAdd('addr_bcc');"/>
@ -79,7 +84,7 @@
<menuitem label="&deleteAddrBookCard.label;" accesskey="&deleteAddrBookCard.accesskey;" oncommand="AbDelete();"/>
<menuseparator/>
<menuitem label="&newAddrBookCard.label;" accesskey="&newAddrBookCard.accesskey;" oncommand="AbPanelNewCard();"/>
<menuitem label="&newAddrBookMailingList.label;" accesskey="&newAddrBookMailingList.accesskey;" oncommand="AbPanelNewList();"/>
<menuitem label="&newAddrBookMailingList.label;" accesskey="&newAddrBookMailingList.accesskey;" command="cmd_newlist"/>
<menuseparator/>
<menuitem label="&addrBookCardProperties.label;" accesskey="&addrBookCardProperties.accesskey;" oncommand="AbEditSelectedCard();"/>
</popup>

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

@ -303,6 +303,7 @@ function CommandUpdate_AddressBook()
{
goUpdateCommand('cmd_delete');
goUpdateCommand('button_delete');
goUpdateCommand('cmd_newlist');
}
function ResultsPaneSelectionChanged()

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

@ -207,7 +207,7 @@
<menu id="menu_New">
<menupopup id="menu_NewPopup">
<menuitem label="&newCard.label;" accesskey="&newCard.accesskey;" oncommand="AbNewCard();"/>
<menuitem label="&newListCmd.label;" accesskey="&newListCmd.accesskey;" oncommand="AbNewList();"/>
<menuitem label="&newListCmd.label;" accesskey="&newListCmd.accesskey;" command="cmd_newlist"/>
<menuitem label="&newAddressBookCmd.label;" accesskey="&newAddressBookCmd.accesskey;" oncommand="AbNewAddressBook()"/>
<menuitem label="&newLDAPDirectoryCmd.label;" id="addLDAP" accesskey="&newLDAPDirectoryCmd.accesskey;" oncommand="AbNewLDAPDirectory()"/>
<menuseparator/>

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

@ -61,16 +61,17 @@
#include "nsServiceManagerUtils.h"
#include "nsCRT.h"
#define NC_RDF_DIRNAME "http://home.netscape.com/NC-rdf#DirName"
#define NC_RDF_DIRURI "http://home.netscape.com/NC-rdf#DirUri"
#define NC_RDF_ISMAILLIST "http://home.netscape.com/NC-rdf#IsMailList"
#define NC_RDF_ISREMOTE "http://home.netscape.com/NC-rdf#IsRemote"
#define NC_RDF_ISWRITEABLE "http://home.netscape.com/NC-rdf#IsWriteable"
#define NC_RDF_DIRTREENAMESORT "http://home.netscape.com/NC-rdf#DirTreeNameSort"
#define NC_RDF_DIRNAME "http://home.netscape.com/NC-rdf#DirName"
#define NC_RDF_DIRURI "http://home.netscape.com/NC-rdf#DirUri"
#define NC_RDF_ISMAILLIST "http://home.netscape.com/NC-rdf#IsMailList"
#define NC_RDF_ISREMOTE "http://home.netscape.com/NC-rdf#IsRemote"
#define NC_RDF_ISWRITEABLE "http://home.netscape.com/NC-rdf#IsWriteable"
#define NC_RDF_DIRTREENAMESORT "http://home.netscape.com/NC-rdf#DirTreeNameSort"
#define NC_RDF_SUPPORTSMAILINGLISTS "http://home.netscape.com/NC-rdf#SupportsMailingLists"
//Directory Commands
#define NC_RDF_MODIFY "http://home.netscape.com/NC-rdf#Modify"
#define NC_RDF_DELETECARDS "http://home.netscape.com/NC-rdf#DeleteCards"
#define NC_RDF_MODIFY "http://home.netscape.com/NC-rdf#Modify"
#define NC_RDF_DELETECARDS "http://home.netscape.com/NC-rdf#DeleteCards"
////////////////////////////////////////////////////////////////////////
@ -170,6 +171,9 @@ nsAbDirectoryDataSource::Init()
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DELETECARDS),
getter_AddRefs(kNC_DeleteCards));
NS_ENSURE_SUCCESS(rv,rv);
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SUPPORTSMAILINGLISTS),
getter_AddRefs(kNC_SupportsMailingLists));
NS_ENSURE_SUCCESS(rv,rv);
rv = createNode(NS_LITERAL_STRING("true").get(), getter_AddRefs(kTrueLiteral));
NS_ENSURE_SUCCESS(rv,rv);
rv = createNode(NS_LITERAL_STRING("false").get(), getter_AddRefs(kFalseLiteral));
@ -240,7 +244,8 @@ NS_IMETHODIMP nsAbDirectoryDataSource::GetTargets(nsIRDFResource* source,
(kNC_IsRemote == property) ||
(kNC_IsSecure == property) ||
(kNC_IsWriteable == property) ||
(kNC_DirTreeNameSort == property))
(kNC_DirTreeNameSort == property) ||
(kNC_SupportsMailingLists == property))
{
return NS_NewSingletonEnumerator(targets, property);
}
@ -290,7 +295,8 @@ nsAbDirectoryDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc
aArc == kNC_IsRemote ||
aArc == kNC_IsSecure ||
aArc == kNC_IsWriteable ||
aArc == kNC_DirTreeNameSort);
aArc == kNC_DirTreeNameSort ||
aArc == kNC_SupportsMailingLists);
}
else {
*result = PR_FALSE;
@ -333,6 +339,7 @@ nsAbDirectoryDataSource::getDirectoryArcLabelsOut(nsIAbDirectory *directory,
(*arcs)->AppendElement(kNC_IsSecure);
(*arcs)->AppendElement(kNC_IsWriteable);
(*arcs)->AppendElement(kNC_DirTreeNameSort);
(*arcs)->AppendElement(kNC_SupportsMailingLists);
return NS_OK;
}
@ -508,6 +515,8 @@ nsresult nsAbDirectoryDataSource::createDirectoryNode(nsIAbDirectory* directory,
rv = createDirectoryIsWriteableNode(directory, target);
else if ((kNC_DirTreeNameSort == property))
rv = createDirectoryTreeNameSortNode(directory, target);
else if ((kNC_SupportsMailingLists == property))
rv = createDirectorySupportsMailingListsNode(directory, target);
return rv;
}
@ -515,12 +524,10 @@ nsresult nsAbDirectoryDataSource::createDirectoryNode(nsIAbDirectory* directory,
nsresult nsAbDirectoryDataSource::createDirectoryNameNode(nsIAbDirectory *directory,
nsIRDFNode **target)
{
nsresult rv = NS_OK;
nsXPIDLString name;
rv = directory->GetDirName(getter_Copies(name));
NS_ENSURE_SUCCESS(rv, rv);
rv = createNode(name.get(), target);
nsXPIDLString name;
nsresult rv = directory->GetDirName(getter_Copies(name));
NS_ENSURE_SUCCESS(rv, rv);
rv = createNode(name.get(), target);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}
@ -607,15 +614,26 @@ nsresult
nsAbDirectoryDataSource::createDirectoryIsMailListNode(nsIAbDirectory* directory,
nsIRDFNode **target)
{
nsresult rv;
PRBool isMailList;
rv = directory->GetIsMailList(&isMailList);
nsresult rv = directory->GetIsMailList(&isMailList);
NS_ENSURE_SUCCESS(rv, rv);
NS_IF_ADDREF(*target = (isMailList ? kTrueLiteral : kFalseLiteral));
return NS_OK;
}
nsresult
nsAbDirectoryDataSource::createDirectorySupportsMailingListsNode(nsIAbDirectory* directory,
nsIRDFNode **target)
{
PRBool supportsMailingLists;
nsresult rv = directory->GetSupportsMailingLists(&supportsMailingLists);
NS_ENSURE_SUCCESS(rv, rv);
NS_IF_ADDREF(*target = (supportsMailingLists ? kTrueLiteral : kFalseLiteral));
return NS_OK;
}
nsresult
nsAbDirectoryDataSource::createDirectoryTreeNameSortNode(nsIAbDirectory* directory, nsIRDFNode **target)
{
@ -807,7 +825,8 @@ nsresult nsAbDirectoryDataSource::DoDirectoryHasAssertion(nsIAbDirectory *direct
rv = directory->HasDirectory(newDirectory, hasAssertion);
}
else if ((kNC_IsMailList == property) || (kNC_IsRemote == property) ||
(kNC_IsSecure == property) || (kNC_IsWriteable == property))
(kNC_IsSecure == property) || (kNC_IsWriteable == property) ||
(kNC_SupportsMailingLists == property))
{
nsCOMPtr<nsIRDFResource> dirResource(do_QueryInterface(directory, &rv));
NS_ENSURE_SUCCESS(rv, rv);

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

@ -125,6 +125,8 @@ protected:
nsIRDFNode **target);
nsresult createDirectoryIsWriteableNode(nsIAbDirectory *directory,
nsIRDFNode **target);
nsresult createDirectorySupportsMailingListsNode(nsIAbDirectory* directory,
nsIRDFNode **target);
nsresult createDirectoryTreeNameSortNode(nsIAbDirectory *directory,
nsIRDFNode **target);
nsresult getDirectoryArcLabelsOut(nsIAbDirectory *directory,
@ -155,6 +157,7 @@ protected:
nsCOMPtr<nsIRDFResource> kNC_IsSecure;
nsCOMPtr<nsIRDFResource> kNC_IsWriteable;
nsCOMPtr<nsIRDFResource> kNC_DirTreeNameSort;
nsCOMPtr<nsIRDFResource> kNC_SupportsMailingLists;
nsCOMPtr<nsICollation> mCollationKeyGenerator;
// commands