fix for #83023. implement "advanced directory" search, re-using

the existing search code.  r/sr=bienvenu.
This commit is contained in:
sspitzer%netscape.com 2002-02-13 08:01:04 +00:00
parent 38cbf3c390
commit e650435580
20 changed files with 715 additions and 143 deletions

View File

@ -50,7 +50,6 @@
// used for when creating new directories
// either from user input, or during bootstrapping
[scriptable, uuid(f94812de-1dd1-11b2-b0ab-9eb5e055f712)]
interface nsIAbDirectoryProperties : nsISupports {
attribute AString description;
attribute string URI;

View File

@ -53,7 +53,9 @@ function AbResultsPaneOnClick(event)
if (gAbView) {
var node = document.getElementById(gAbView.URI);
sortDirection = node.getAttribute("sortDirection");
if (node) {
sortDirection = node.getAttribute("sortDirection");
}
if (sortDirection == kDefaultDescending)
sortDirection = kDefaultAscending;
else

View File

@ -449,7 +449,14 @@ function AbResultsPaneDoubleClick(card)
function onAdvancedAbSearch()
{
dump("XXX onAdvancedAbSearch\n");
var selectedItems = dirTree.selectedItems;
if (selectedItems.length != 1)
return;
var selectedABURI = selectedItems[0].getAttribute('id');
window.openDialog("chrome://messenger/content/ABSearchDialog.xul", "",
"chrome,resizable,status,centerscreen,dialog=no", {directory: selectedABURI} );
}
function onEnterInSearchBar()

View File

@ -554,7 +554,7 @@
<binding id="searchoperator" name="searchOperator"
extends="chrome://messenger/content/mailWidgets.xml#search-menulist-abstract">
<implementation>
<field name="searchAttribute">null</field>
<field name="searchAttribute">Components.interfaces.nsMsgSearchAttrib.Default</field>
<field name="stringBundle">
<![CDATA[
srGetStrBundle("chrome://messenger/locale/search-operators.properties");

View File

@ -1028,6 +1028,19 @@ function MsgSearchMessages()
"chrome,resizable,status,centerscreen,dialog=no", { folder: preselectedFolder });
}
function MsgSearchAddresses()
{
var windowManagerInterface = GetWindowMediator();
var abSearchWindow = windowManagerInterface.getMostRecentWindow("mailnews:absearch");
if (abSearchWindow)
abSearchWindow.focus();
else
window.openDialog("chrome://messenger/content/ABSearchDialog.xul", "",
"chrome,resizable,status,centerscreen,dialog=no", {directory: null});
}
function MsgFilters(emailAddress)
{
var preselectedFolder = GetFirstSelectedMsgFolder();

View File

@ -1100,6 +1100,7 @@ Rights Reserved.
<menuitem label="&searchMailCmd.label;" key="key_searchMail" accesskey="&searchMailCmd.accesskey;" oncommand="MsgSearchMessages()"/>
<menuseparator/>
<menuitem label="&searchInternetCmd.label;" accesskey="&searchInternetCmd.accesskey;" oncommand="openTopWin(xlateURL('urn:clienturl:srchmenu:srchinternet'));"/>
<menuitem label="&searchAddressesCmd.label;" accesskey="&searchAddressesCmd.accesskey;" oncommand="MsgSearchAddresses(null)"/>
</menupopup>
</menu>
<menu label="&goMenu.label;" accesskey="&goMenu.accesskey;">

View File

@ -86,11 +86,9 @@ interface nsIMsgSearchSession : nsISupports {
void addScopeTerm(in nsMsgSearchScopeValue scope,
in nsIMsgFolder folder);
void addDirectoryScopeTerm(in nsMsgSearchScopeValue scope);
void clearScopes();
/* special cases for LDAP since LDAP isn't really a folderInfo */
[noscript] void AddLdapScope(in nsMsgDIRServer server);
/* void AddAllLdapScopes(XP_List* dirServerList); */
/* Call this function everytime the scope changes! It informs the FE if
the current scope support custom header use. FEs should not display the

View File

@ -49,7 +49,7 @@ interface nsIMsgSearchValidityTable : nsISupports {
in nsMsgSearchOpValue op, in boolean enabled);
void setValidButNotShown(in nsMsgSearchAttribValue attrib,
in nsMsgSearchOpValue op, in boolean valid);
boolean getAvailable(in nsMsgSearchAttribValue attrib,
in nsMsgSearchOpValue op);
boolean getEnabled(in nsMsgSearchAttribValue attrib,
@ -70,4 +70,5 @@ interface nsIMsgSearchValidityTable : nsISupports {
[retval, array, size_is(length)]
out nsMsgSearchOpValue operators);
void setDefaultAttrib(in nsMsgSearchAttribValue defaultAttrib);
};

View File

@ -160,6 +160,8 @@ protected:
PRUint16 bitValidButNotShown : 1;
} vtBits;
vtBits m_table [nsMsgSearchAttrib::kNumMsgSearchAttributes][nsMsgSearchOp::kNumMsgSearchOperators];
private:
nsMsgSearchAttribValue m_defaultAttrib;
};
// Using getters and setters seems a little nicer then dumping the 2-D array
@ -192,7 +194,9 @@ public:
nsresult GetTable (int, nsMsgSearchValidityTable**);
#ifdef DOING_EXNEWSSEARCH
nsresult PostProcessValidityTable (nsINntpIncomingServer *);
#endif
protected:
@ -203,9 +207,14 @@ protected:
nsCOMPtr<nsIMsgSearchValidityTable> m_offlineMailTable;
nsCOMPtr<nsIMsgSearchValidityTable> m_onlineMailTable;
nsCOMPtr<nsIMsgSearchValidityTable> m_onlineMailFilterTable;
nsCOMPtr<nsIMsgSearchValidityTable> m_newsTable;
#ifdef DOING_EXNEWSSEARCH
nsCOMPtr<nsIMsgSearchValidityTable> m_newsExTable;
#endif
nsCOMPtr<nsIMsgSearchValidityTable> m_localNewsTable; // used for local news searching or offline news searching...
nsCOMPtr<nsIMsgSearchValidityTable> m_ldapTable;
nsCOMPtr<nsIMsgSearchValidityTable> m_localABTable;
nsresult NewTable (nsIMsgSearchValidityTable **);
@ -214,10 +223,15 @@ protected:
nsresult InitOnlineMailFilterTable ();
nsresult InitNewsTable ();
nsresult InitLocalNewsTable();
#ifdef DOING_EXNEWSSEARCH
nsresult InitNewsExTable (nsINntpIncomingServer *host = nsnull);
#endif
nsresult InitOtherHeadersInTable(nsIMsgSearchValidityTable *table, const char *customHeaders);
void EnableLdapAttribute (nsMsgSearchAttribValue, PRBool enabled = PR_TRUE);
nsresult InitLdapTable();
nsresult InitLocalABTable();
nsresult EnableDirectoryAttribute(nsIMsgSearchValidityTable *table, nsMsgSearchAttribValue aSearchAttrib);
};
#endif

View File

@ -56,14 +56,15 @@ interface nsMsgSearchScope {
const nsMsgSearchScopeValue news = 4;
const nsMsgSearchScopeValue newsEx = 5;
const nsMsgSearchScopeValue LDAP = 6;
const nsMsgSearchScopeValue allSearchableGroups = 7;
const nsMsgSearchScopeValue LocalAB = 7;
const nsMsgSearchScopeValue allSearchableGroups = 8;
};
typedef long nsMsgSearchAttribValue;
[scriptable, uuid(68c8710a-304e-11d3-97bf-00a0c900d445)]
interface nsMsgSearchAttrib {
const nsMsgSearchAttribValue Default = -1;
const nsMsgSearchAttribValue Subject = 0; /* mail and news */
const nsMsgSearchAttribValue Sender = 1;
const nsMsgSearchAttribValue Body = 2;
@ -75,54 +76,34 @@ interface nsMsgSearchAttrib {
const nsMsgSearchAttribValue CC = 7;
const nsMsgSearchAttribValue ToOrCC = 8;
const nsMsgSearchAttribValue CommonName = 9; /* LDAP only */
const nsMsgSearchAttribValue RFC822Address = 10;
const nsMsgSearchAttribValue PhoneNumber = 11;
const nsMsgSearchAttribValue Organization = 12;
const nsMsgSearchAttribValue OrgUnit = 13;
const nsMsgSearchAttribValue Locality = 14;
const nsMsgSearchAttribValue StreetAddress = 15;
const nsMsgSearchAttribValue Size = 16;
const nsMsgSearchAttribValue AnyText = 17; /* any header or body */
const nsMsgSearchAttribValue Keywords = 18;
const nsMsgSearchAttribValue Location = 9; /* result list only */
const nsMsgSearchAttribValue MessageKey = 10; /* message result elems */
const nsMsgSearchAttribValue AgeInDays = 11;
const nsMsgSearchAttribValue FolderInfo = 12; /* for "view thread context" from result */
const nsMsgSearchAttribValue Size = 13;
const nsMsgSearchAttribValue AnyText = 14;
const nsMsgSearchAttribValue Keywords = 15;
const nsMsgSearchAttribValue DistinguishedName = 19; /* LDAP result elem only */
const nsMsgSearchAttribValue ObjectClass = 20;
const nsMsgSearchAttribValue JpegFile = 21;
const nsMsgSearchAttribValue Name = 16;
const nsMsgSearchAttribValue Email = 17;
const nsMsgSearchAttribValue PhoneNumber = 18;
const nsMsgSearchAttribValue City = 19;
const nsMsgSearchAttribValue Street = 20;
const nsMsgSearchAttribValue Nickname = 21;
const nsMsgSearchAttribValue WorkPhone = 22;
const nsMsgSearchAttribValue HomePhone = 23;
const nsMsgSearchAttribValue Fax = 24;
const nsMsgSearchAttribValue Pager = 25;
const nsMsgSearchAttribValue Mobile = 26;
const nsMsgSearchAttribValue ScreenName = 27;
const nsMsgSearchAttribValue Title = 28;
const nsMsgSearchAttribValue Organization = 29;
const nsMsgSearchAttribValue Department = 30;
const nsMsgSearchAttribValue AdditionalEmail = 31;
const nsMsgSearchAttribValue Location = 22; /* result list only */
const nsMsgSearchAttribValue MessageKey = 23; /* message result elems */
// 32 - 48, reserved for ab / LDAP;
const nsMsgSearchAttribValue AgeInDays = 24; /* for purging old news articles */
const nsMsgSearchAttribValue GivenName = 25; /* for sorting LDAP results */
const nsMsgSearchAttribValue Surname = 26;
const nsMsgSearchAttribValue FolderInfo = 27; /* for "view thread context" from result */
const nsMsgSearchAttribValue Custom1 = 28; /* custom LDAP attributes */
const nsMsgSearchAttribValue Custom2 = 29;
const nsMsgSearchAttribValue Custom3 = 30;
const nsMsgSearchAttribValue Custom4 = 31;
const nsMsgSearchAttribValue Custom5 = 32;
const nsMsgSearchAttribValue MessageId = 33;
/* the following are LDAP specific attributes */
const nsMsgSearchAttribValue nsnMsgSearchAttribCarlicense = 34;
const nsMsgSearchAttribValue BusinessCategory = 35;
const nsMsgSearchAttribValue DepartmentNumber = 36;
const nsMsgSearchAttribValue Description = 37;
const nsMsgSearchAttribValue EmployeeType = 38;
const nsMsgSearchAttribValue FaxNumber = 39;
const nsMsgSearchAttribValue Manager = 40;
const nsMsgSearchAttribValue PostalAddress = 41;
const nsMsgSearchAttribValue PostalCode = 42;
const nsMsgSearchAttribValue Secretary = 43;
const nsMsgSearchAttribValue Title = 44;
const nsMsgSearchAttribValue Nickname = 45;
const nsMsgSearchAttribValue HomePhone = 46;
const nsMsgSearchAttribValue Pager = 47;
const nsMsgSearchAttribValue Cellular = 48;
//49 is for showing customize... in ui headers start from 50 onwards up until 99.
const nsMsgSearchAttribValue OtherHeader = 49; /* for mail and news. MUST ALWAYS BE LAST attribute since we can have an arbitrary # of these... */
@ -219,12 +200,6 @@ typedef struct nsMsgSearchValue
[ptr] native nsMsgSearchTerm(nsMsgSearchTerm);
[ptr] native nsMsgDIRServer(nsMsgDIRServer);
%{C++
class nsMsgDIRServer;
%}
%{C++
#define IS_STRING_ATTRIBUTE(_a) \
(!(_a == nsMsgSearchAttrib::Priority || _a == nsMsgSearchAttrib::Date || \

View File

@ -0,0 +1,316 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 addressbook.
*
* The Initial Developer of the Original Code is
* Seth Spitzer <sspitzer@netscape.com>
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
var gSearchSession;
var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
var nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
var nsIAbDirectory = Components.interfaces.nsIAbDirectory;
var gStatusText;
var gSearchBundle;
var gAddressBookBundle;
var gSearchStopButton;
var gPropertiesButton;
var gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
var gSearchAbViewListener = {
onSelectionChanged: function() {
},
onCountChanged: function(total) {
var statusText = gAddressBookBundle.getFormattedString("matchesFound", [total]);
gStatusText.setAttribute("label", statusText);
}
};
function searchOnLoad()
{
UpgradeAddressBookResultsPaneUI("mailnews.ui.advanced_directory_search_results.version");
initializeSearchWidgets();
initializeSearchWindowWidgets();
gSearchBundle = document.getElementById("bundle_search");
gAddressBookBundle = document.getElementById("bundle_addressBook");
gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
if (window.arguments && window.arguments[0])
SelectDirectory(window.arguments[0].directory);
onMore(null);
}
function searchOnUnload()
{
CloseAbView();
}
function initializeSearchWindowWidgets()
{
gSearchStopButton = document.getElementById("search-button");
gPropertiesButton = document.getElementById("propertiesButton");
gStatusText = document.getElementById('statusText');
}
function onSearchStop()
{
// ???
}
function onAbSearchReset(event)
{
CloseAbView();
onReset(event);
}
function SelectDirectory(aURI)
{
var selectedAB = aURI;
if (!selectedAB)
selectedAB = kPersonalAddressbookURI;
// set popup with address book names
var abPopup = document.getElementById('abPopup');
if ( abPopup )
{
var menupopup = document.getElementById('abPopup-menupopup');
if ( selectedAB && menupopup && menupopup.childNodes )
{
for ( var index = menupopup.childNodes.length - 1; index >= 0; index-- )
{
if ( menupopup.childNodes[index].getAttribute('value') == selectedAB )
{
abPopup.label = menupopup.childNodes[index].getAttribute('label');
abPopup.value = menupopup.childNodes[index].getAttribute('value');
break;
}
}
}
}
setSearchScope(GetScopeForDirectoryURI(selectedAB));
}
function GetScopeForDirectoryURI(aURI)
{
var directory = gRDF.GetResource(aURI).QueryInterface(nsIAbDirectory);
if (directory.isRemote)
return nsMsgSearchScope.LDAP;
else
return nsMsgSearchScope.LocalAB;
}
function onEnterInSearchTerm()
{
// on enter
// if not searching, start the search
// if searching, stop and then start again
if (gSearchStopButton.getAttribute("label") == gSearchBundle.getString("labelForSearchButton")) {
onSearch();
}
else {
onSearchStop();
onSearch();
}
}
function onSearch()
{
gStatusText.setAttribute("label", "");
gPropertiesButton.setAttribute("disabled","true");
gSearchSession.clearScopes();
var currentAbURI = document.getElementById('abPopup').getAttribute('value');
gSearchSession.addDirectoryScopeTerm(GetScopeForDirectoryURI(currentAbURI));
saveSearchTerms(gSearchSession.searchTerms, gSearchSession);
var searchUri = currentAbURI + "?(";
var count = gSearchSession.searchTerms.Count();
for (var i=0; i<count; i++) {
var searchTerm = gSearchSession.searchTerms.GetElementAt(i).QueryInterface(nsIMsgSearchTerm);
// get the "and" / "or" value from the first term
if (i == 0) {
if (searchTerm.booleanAnd)
searchUri += "and";
else
searchUri += "or";
}
var str = "(";
switch (searchTerm.attrib) {
case nsMsgSearchAttrib.Name:
str += "DisplayName"; // search first, last, display too?
break;
case nsMsgSearchAttrib.Email:
str += "PrimaryEmail";
break;
case nsMsgSearchAttrib.PhoneNumber:
str += "WorkPhone"; // search home phone too?
break;
case nsMsgSearchAttrib.Organization:
str += "Company";
break;
case nsMsgSearchAttrib.Department:
str += "Department";
break;
case nsMsgSearchAttrib.City:
str += "WorkCity";
break;
case nsMsgSearchAttrib.Street:
str += "WorkAddress";
break;
case nsMsgSearchAttrib.Nickname:
str += "NickName";
break;
case nsMsgSearchAttrib.WorkPhone:
str += "WorkPhone";
break;
case nsMsgSearchAttrib.HomePhone:
str += "HomePhone";
break;
case nsMsgSearchAttrib.Fax:
str += "FaxNumber";
break;
case nsMsgSearchAttrib.Pager:
str += "PagerNumber";
break;
case nsMsgSearchAttrib.Mobile:
str += "CellularNumber";
break;
case nsMsgSearchAttrib.Title:
str += "JobTitle";
break;
case nsMsgSearchAttrib.AdditionalEmail:
str += "SecondEmail";
break;
// XXX todo, what about the others? what about generic, like _AimScreenName
default:
str += "DisplayName";
break;
}
str += ",";
switch (searchTerm.op) {
case nsMsgSearchOp.Contains:
str += "c";
break;
case nsMsgSearchOp.DoesntContain:
str += "!c";
break;
case nsMsgSearchOp.Is:
str += "=";
break;
case nsMsgSearchOp.Isnt:
str += "!=";
break;
case nsMsgSearchOp.BeginsWith:
str += "bw";
break;
case nsMsgSearchOp.EndsWith:
str += "ew";
break;
case nsMsgSearchOp.SoundsLike:
str += "~=";
break;
default:
str += "c";
break;
}
// append the term to the searchUri
searchUri += str + "," + escape(searchTerm.value.str) + ")";
}
searchUri += ")";
SetAbView(searchUri, null, null);
}
// used to toggle functionality for Search/Stop button.
function onSearchButton(event)
{
if (event.target.label == gSearchBundle.getString("labelForSearchButton"))
onSearch();
else
onSearchStop();
}
function GetAbViewListener()
{
return gSearchAbViewListener;
}
function onProperties()
{
AbEditSelectedCard();
}
function AbResultsPaneDoubleClick(card)
{
AbEditCard(card);
}
function UpdateCardView()
{
if (GetNumSelectedCards() == 1) {
gPropertiesButton.removeAttribute("disabled");
}
else {
gPropertiesButton.setAttribute("disabled","true");
}
}
function onChooseDirectory(event)
{
var directoryURI = event.id;
if (directoryURI) {
SelectDirectory(directoryURI);
}
}

View File

@ -0,0 +1,117 @@
<?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.
-->
<?xml-stylesheet href="chrome://messenger/skin/searchDialog.css" type="text/css"?>
<?xul-overlay href="chrome://messenger/content/addressbook/abResultsPaneOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/searchTermOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/mailWindowOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % abResultsPaneOverlayDTD SYSTEM "chrome://messenger/locale/addressbook
/abResultsPaneOverlay.dtd">
%abResultsPaneOverlayDTD;
<!ENTITY % SearchDialogDTD SYSTEM "chrome://messenger/locale/SearchDialog.dtd">
%SearchDialogDTD;
]>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
onload="searchOnLoad();"
onunload="searchOnUnload();"
onclose="onSearchStop();"
windowtype="mailnews:absearch"
title="&abSearchDialogTitle.label;"
width="640" height="470"
persist="screenX screenY width height">
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
<stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
</stringbundleset>
<!-- XXX: only mailWidgets.xml requires strres.js (<script> isn't valid in XBL yet - see hyatt)-->
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
<script src="chrome://messenger/content/mailWindow.js"/>
<script src="chrome://messenger/content/msgMail3PaneWindow.js"/>
<script src="chrome://global/content/globalOverlay.js"/>
<script src="chrome://messenger/content/mailCommands.js"/>
<script src="chrome://messenger/content/mailWindowOverlay.js"/>
<script src="chrome://messenger/content/commandglue.js"/>
<script src="chrome://messenger/content/ABSearchDialog.js"/>
<script src="chrome://messenger/content/addressbook/abCommon.js"/>
<dummy class="usesMailWidgets"/>
<vbox flex="1">
<vbox>
<hbox align="center">
<label value="&abSearchHeading.label;" accesskey="&abSearchHeading.accesskey;"/>
<menulist id="abPopup">
<menupopup id="abPopup-menupopup" ref="moz-abdirectory://"
datasources="rdf:addressdirectory">
<template>
<rule nc:IsMailList="false">
<menuitem uri="..."
oncommand="onChooseDirectory(event.target)"
label="rdf:http://home.netscape.com/NC-rdf#DirName"
value="rdf:http://home.netscape.com/NC-rdf#DirUri"/>
</rule>
</template>
</menupopup>
</menulist>
<spacer flex="10"/>
<button label="&searchButton.label;" id="search-button" oncommand="onSearchButton(event);" default="true" accesskey="&searchButton.accesskey;"/>
</hbox>
<hbox align="center">
<spacer flex="1"/>
<button label="&resetButton.label;" oncommand="onAbSearchReset(event);" accesskey="&resetButton.accesskey;"/>
</hbox>
</vbox>
<hbox flex="1">
<vbox id="searchTermListBox" flex="1"/>
</hbox>
</vbox>
<splitter id="gray_horizontal_splitter" collapse="after" persist="state">
<grippy/>
</splitter>
<vbox flex="1">
<vbox id="searchResultListBox" flex="1" >
<outliner id="abResultsOutliner" flex="1" persist="height" context="threadPaneContext"/>
</vbox>
<hbox align="start">
<button label="&propertiesButton.label;" id="propertiesButton" oncommand="onProperties()" accesskey="&propertiesButton.accesskey;" disabled="true"/>
<spacer flex="1" />
</hbox>
</vbox>
<statusbar class="chromeclass-status" id="status-bar"/>
</window>

View File

@ -503,16 +503,6 @@ function IsThreadAndMessagePaneSplitterCollapsed()
return true;
}
function setMsgDatasourceWindow(ds, msgwindow)
{
try {
var msgDatasource = ds.QueryInterface(nsIMsgRDFDataSource);
msgDatasource.window = msgwindow;
} catch (ex) {
dump("error setting DS on " + ds + ": " + ex + "\n");
}
}
// used to toggle functionality for Search/Stop button.
function onSearchButton(event)
{

View File

@ -1,5 +1,5 @@
<!-- extracted from SearchDialog.xul -->
<!-- for SearchDialog.xul -->
<!ENTITY searchHeading.label "Search for messages in:">
<!ENTITY searchHeading.accesskey "S">
<!ENTITY searchSubfolders.label "Search subfolders">
@ -24,3 +24,10 @@
<!ENTITY fileButton.accesskey "i">
<!ENTITY goToFolderButton.label "Open Message Folder">
<!ENTITY goToFolderButton.accesskey "r">
<!-- for ABSearchDialog.xul -->
<!ENTITY abSearchHeading.label "Search for names in:">
<!ENTITY abSearchHeading.accesskey "S">
<!ENTITY propertiesButton.label "Properties">
<!ENTITY propertiesButton.accesskey "P">
<!ENTITY abSearchDialogTitle.label "Advanced Directory Search">

View File

@ -1,6 +1,4 @@
# LOCALIZATION NOTE FILE: Translate only items 0 to 10
# Other items may be used in version 6.1 or later
#these need to match nsMsgSearchAttrib interface in nsMsgSearchCore.idl
0=Subject
1=Sender
2=Body
@ -10,48 +8,47 @@
6=To
7=Cc
8=To or cc
24=Age in days
# Note to vendor: if you plan to use these other strings - lowercase them to be consistent (as above).
9=Common name
10=RFC822address
11=PhoneNumber
12=Organization
13=OrgUnit
14=Locality
15=StreetAddress
16=Size
17=AnyText
18=Keywords
19=DistinguishedName
20=ObjectClass
21=JpegFile
22=Location
23=MessageKey
25=GivenName
26=Surname
27=FolderInfo
28=Custom1
29=Custom2
30=Custom3
31=Custom4
32=Custom5
33=MessageId
34=nsnMsgSearchAttribCarlicense
35=BusinessCategory
36=DepartmentNumber
37=Description
38=EmployeeType
39=FaxNumber
40=Manager
41=PostalAddress
42=PostalCode
43=Secretary
44=Title
45=Nickname
46=HomePhone
47=Pager
48=Cellular
# 9-15, not visible
9=Location
10=Message Key
11=Age In Days
12=Folder Info
13=Size
14=AnyText
15=Keywords
# for AB and LDAP
16=Name
17=Email
18=Phone Number
19=City
20=Street
21=Nickname
22=Work Phone
23=Home Phone
24=Fax
25=Pager
26=Mobile
27=Screen Name
28=Title
29=Organization
30=Department
31=Additional Email
32=reserved for AB
33=reserved for AB
34=reserved for AB
35=reserved for AB
36=reserved for AB
37=reserved for AB
38=reserved for AB
39=reserved for AB
40=reserved for AB
41=reserved for AB
42=reserved for AB
43=reserved for AB
44=reserved for AB
45=reserved for AB
46=reserved for AB
47=reserved for AB
48=reserved for AB
# don't use above 49
49=Customize...

View File

@ -858,6 +858,9 @@ nsMsgSearchValidityTable::nsMsgSearchValidityTable ()
SetValidButNotShown (i,j, PR_FALSE);
}
m_numAvailAttribs = 0; // # of attributes marked with at least one available operator
// assume default is Subject, which it is for mail and news search
// it's not for LDAP, so we'll call SetDefaultAttrib()
m_defaultAttrib = nsMsgSearchAttrib::Subject;
}
NS_IMPL_ISUPPORTS1(nsMsgSearchValidityTable, nsIMsgSearchValidityTable)
@ -958,10 +961,16 @@ nsMsgSearchValidityTable::GetAvailableOperators(nsMsgSearchAttribValue aAttribut
PRUint32 *aLength,
nsMsgSearchOpValue **aResult)
{
nsMsgSearchAttribValue attr;
if (aAttribute == nsMsgSearchAttrib::Default)
attr = m_defaultAttrib;
else
attr = aAttribute;
PRUint32 totalOperators=0;
PRInt32 i;
for (i=0; i<nsMsgSearchOp::kNumMsgSearchOperators; i++) {
if (m_table[aAttribute][i].bitAvailable)
if (m_table[attr][i].bitAvailable)
totalOperators++;
}
@ -971,7 +980,7 @@ nsMsgSearchValidityTable::GetAvailableOperators(nsMsgSearchAttribValue aAttribut
PRUint32 numStored = 0;
for (i=0; i<nsMsgSearchOp::kNumMsgSearchOperators;i++) {
if (m_table[aAttribute][i].bitAvailable)
if (m_table[attr][i].bitAvailable)
array[numStored++] = i;
}
@ -981,6 +990,13 @@ nsMsgSearchValidityTable::GetAvailableOperators(nsMsgSearchAttribValue aAttribut
return NS_OK;
}
NS_IMETHODIMP
nsMsgSearchValidityTable::SetDefaultAttrib(nsMsgSearchAttribValue aAttribute)
{
m_defaultAttrib = aAttribute;
return NS_OK;
}
nsMsgSearchValidityManager::nsMsgSearchValidityManager ()
{
@ -1055,13 +1071,16 @@ nsresult nsMsgSearchValidityManager::GetTable (int whichTable, nsIMsgSearchValid
*ppOutTable = m_newsExTable;
break;
#endif
#ifdef DOING_LDAP
case nsMsgSearchScope::LDAP:
if (!m_ldapTable)
err = InitLdapTable ();
*ppOutTable = m_ldapTable;
break;
#endif
case nsMsgSearchScope::LocalAB:
if (!m_localABTable)
err = InitLocalABTable ();
*ppOutTable = m_localABTable;
break;
default:
NS_ASSERTION(PR_FALSE, "invalid table type");
err = NS_MSG_ERROR_INVALID_SEARCH_TERM;
@ -1121,3 +1140,108 @@ nsMsgSearchValidityManager::InitOtherHeadersInTable (nsIMsgSearchValidityTable *
}
return NS_OK;
}
nsresult nsMsgSearchValidityManager::EnableDirectoryAttribute(nsIMsgSearchValidityTable *table, nsMsgSearchAttribValue aSearchAttrib)
{
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::Contains, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::Contains, 1);
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::DoesntContain, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::DoesntContain, 1);
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::Is, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::Is, 1);
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::Isnt, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::Isnt, 1);
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::BeginsWith, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::BeginsWith, 1);
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::EndsWith, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::EndsWith, 1);
table->SetAvailable (aSearchAttrib, nsMsgSearchOp::SoundsLike, 1);
table->SetEnabled (aSearchAttrib, nsMsgSearchOp::SoundsLike, 1);
return NS_OK;
}
nsresult nsMsgSearchValidityManager::InitLdapTable()
{
NS_ASSERTION(!m_ldapTable,"don't call this twice!");
nsresult rv = NewTable (getter_AddRefs(m_ldapTable));
NS_ENSURE_SUCCESS(rv,rv);
rv = m_ldapTable->SetDefaultAttrib(nsMsgSearchAttrib::Name);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::Name);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::Email);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::PhoneNumber);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::Organization);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::Department);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::City);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_ldapTable, nsMsgSearchAttrib::Street);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}
nsresult nsMsgSearchValidityManager::InitLocalABTable()
{
NS_ASSERTION(!m_localABTable,"don't call this twice!");
nsresult rv = NewTable (getter_AddRefs(m_localABTable));
NS_ENSURE_SUCCESS(rv,rv);
rv = m_localABTable->SetDefaultAttrib(nsMsgSearchAttrib::Name);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Name);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Email);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Nickname);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::WorkPhone);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::HomePhone);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Fax);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Pager);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Mobile);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::ScreenName);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Title);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Organization);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::Department);
NS_ENSURE_SUCCESS(rv,rv);
rv = EnableDirectoryAttribute(m_localABTable, nsMsgSearchAttrib::AdditionalEmail);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}

View File

@ -724,7 +724,7 @@ nsresult nsMsgSearchValidityManager::InitNewsTable ()
return err;
}
#ifdef DOING_EXNEWSSEARCH
nsresult nsMsgSearchValidityManager::InitNewsExTable (nsINntpIncomingServer *newsHost)
{
nsresult err = NS_OK;
@ -809,8 +809,8 @@ nsresult nsMsgSearchValidityManager::InitNewsExTable (nsINntpIncomingServer *new
return err;
}
nsresult nsMsgSearchValidityManager::PostProcessValidityTable (nsINntpIncomingServer *host)
{
return InitNewsExTable (host);
}
#endif

View File

@ -197,16 +197,23 @@ nsMsgSearchSession::AddScopeTerm(nsMsgSearchScopeValue scope,
return NS_ERROR_NULL_POINTER;
}
nsresult err = NS_OK;
nsMsgSearchScopeTerm *pScopeTerm = new nsMsgSearchScopeTerm(this, scope, folder);
if (pScopeTerm)
m_scopeList.AppendElement(pScopeTerm);
else
err = NS_ERROR_OUT_OF_MEMORY;
if (!pScopeTerm)
return NS_ERROR_OUT_OF_MEMORY;
return err;
m_scopeList.AppendElement(pScopeTerm);
return NS_OK;
}
NS_IMETHODIMP
nsMsgSearchSession::AddDirectoryScopeTerm(nsMsgSearchScopeValue scope)
{
nsMsgSearchScopeTerm *pScopeTerm = new nsMsgSearchScopeTerm(this, scope, nsnull);
if (!pScopeTerm)
return NS_ERROR_OUT_OF_MEMORY;
m_scopeList.AppendElement(pScopeTerm);
return NS_OK;
}
NS_IMETHODIMP nsMsgSearchSession::ClearScopes()
@ -215,12 +222,6 @@ NS_IMETHODIMP nsMsgSearchSession::ClearScopes()
return NS_OK;
}
/* [noscript] void AddLdapScope (in nsMsgDIRServer server); */
NS_IMETHODIMP nsMsgSearchSession::AddLdapScope(nsMsgDIRServer * server)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [noscript] boolean ScopeUsesCustomHeaders (in nsMsgSearchScope scope, in voidStar selection, in boolean forFilters); */
NS_IMETHODIMP
nsMsgSearchSession::ScopeUsesCustomHeaders(nsMsgSearchScopeValue scope,

View File

@ -375,7 +375,12 @@ pref("mailnews.ui.addressbook_panel_results.version", 1);
// 1 -> 2 is for the ab results pane outliner landing
// to hide the non default columns in the select addresses dialog
// see abCommon.js and abSelectAddressesDialog.js
pref("mailnews.ui.select_addresses_results.version", 1);
pref("mailnews.ui.select_addresses_results.version", 1);
// for manual upgrades of certain UI features.
// 1 -> 2 is for the ab results pane
// to hide the non default columns in the advanced directory search dialog
// see abCommon.js and ABSearchDialog.js
pref("mailnews.ui.advanced_directory_search_results.version", 1);
//If set to a number greater than 0, msg compose windows will be recycled in order to open them quickly
pref("mail.compose.max_recycled_windows", 0);

View File

@ -375,7 +375,12 @@ pref("mailnews.ui.addressbook_panel_results.version", 1);
// 1 -> 2 is for the ab results pane outliner landing
// to hide the non default columns in the select addresses dialog
// see abCommon.js and abSelectAddressesDialog.js
pref("mailnews.ui.select_addresses_results.version", 1);
pref("mailnews.ui.select_addresses_results.version", 1);
// for manual upgrades of certain UI features.
// 1 -> 2 is for the ab results pane
// to hide the non default columns in the advanced directory search dialog
// see abCommon.js and ABSearchDialog.js
pref("mailnews.ui.advanced_directory_search_results.version", 1);
//If set to a number greater than 0, msg compose windows will be recycled in order to open them quickly
pref("mail.compose.max_recycled_windows", 0);