From d3eaf21903112d0ef3678ee4370ca6bd749b7528 Mon Sep 17 00:00:00 2001 From: "shliang%netscape.com" Date: Fri, 11 Apr 2003 00:10:18 +0000 Subject: [PATCH] 125197 - and/or search tables for ab searches - r=cavin, sr=sspitzer --- .../base/resources/content/mailWidgets.xml | 4 + .../base/search/public/nsMsgSearchAdapter.h | 6 +- .../base/search/public/nsMsgSearchCore.idl | 39 +++++---- .../resources/content/ABSearchDialog.js | 68 +++++++-------- .../resources/content/ABSearchDialog.xul | 83 +++++++++---------- .../resources/content/searchTermOverlay.js | 12 +-- .../locale/en-US/search-attributes.properties | 34 ++++---- .../base/search/src/nsMsgSearchAdapter.cpp | 58 ++++++++++--- 8 files changed, 172 insertions(+), 132 deletions(-) diff --git a/mailnews/base/resources/content/mailWidgets.xml b/mailnews/base/resources/content/mailWidgets.xml index 36c97dfdfdf..d0b7ce87f1b 100644 --- a/mailnews/base/resources/content/mailWidgets.xml +++ b/mailnews/base/resources/content/mailWidgets.xml @@ -625,6 +625,10 @@ diff --git a/mailnews/base/search/public/nsMsgSearchAdapter.h b/mailnews/base/search/public/nsMsgSearchAdapter.h index 1d321507eb5..0099427b15c 100644 --- a/mailnews/base/search/public/nsMsgSearchAdapter.h +++ b/mailnews/base/search/public/nsMsgSearchAdapter.h @@ -214,7 +214,9 @@ protected: #endif nsCOMPtr m_localNewsTable; // used for local news searching or offline news searching... nsCOMPtr m_ldapTable; + nsCOMPtr m_ldapAndTable; nsCOMPtr m_localABTable; + nsCOMPtr m_localABAndTable; nsCOMPtr m_newsFilterTable; nsresult NewTable (nsIMsgSearchValidityTable **); @@ -234,8 +236,10 @@ protected: nsresult SetOtherHeadersInTable(nsIMsgSearchValidityTable *table, const char *customHeaders); nsresult InitLdapTable(); + nsresult InitLdapAndTable(); nsresult InitLocalABTable(); - nsresult SetUpABTable(nsIMsgSearchValidityTable *aTable, PRBool isLocal); + nsresult InitLocalABAndTable(); + nsresult SetUpABTable(nsIMsgSearchValidityTable *aTable, PRBool isOrTable); nsresult EnableDirectoryAttribute(nsIMsgSearchValidityTable *table, nsMsgSearchAttribValue aSearchAttrib); }; diff --git a/mailnews/base/search/public/nsMsgSearchCore.idl b/mailnews/base/search/public/nsMsgSearchCore.idl index 74ebdd4e001..d058be0a06b 100644 --- a/mailnews/base/search/public/nsMsgSearchCore.idl +++ b/mailnews/base/search/public/nsMsgSearchCore.idl @@ -60,6 +60,8 @@ interface nsMsgSearchScope { const nsMsgSearchScopeValue LocalAB = 8; const nsMsgSearchScopeValue allSearchableGroups = 9; const nsMsgSearchScopeValue newsFilter = 10; + const nsMsgSearchScopeValue LocalABAnd = 11; + const nsMsgSearchScopeValue LDAPAnd = 12; }; typedef long nsMsgSearchAttribValue; @@ -86,25 +88,26 @@ interface nsMsgSearchAttrib { const nsMsgSearchAttribValue AnyText = 14; const nsMsgSearchAttribValue Keywords = 15; - 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 Name = 16; + const nsMsgSearchAttribValue DisplayName = 17; + const nsMsgSearchAttribValue Nickname = 18; + const nsMsgSearchAttribValue ScreenName = 19; + const nsMsgSearchAttribValue Email = 20; + const nsMsgSearchAttribValue AdditionalEmail = 21; + const nsMsgSearchAttribValue PhoneNumber = 22; + const nsMsgSearchAttribValue WorkPhone = 23; + const nsMsgSearchAttribValue HomePhone = 24; + const nsMsgSearchAttribValue Fax = 25; + const nsMsgSearchAttribValue Pager = 26; + const nsMsgSearchAttribValue Mobile = 27; + const nsMsgSearchAttribValue City = 28; + const nsMsgSearchAttribValue Street = 29; + const nsMsgSearchAttribValue Title = 30; + const nsMsgSearchAttribValue Organization = 31; + const nsMsgSearchAttribValue Department = 32; - // 32 - 45, reserved for ab / LDAP; - const nsMsgSearchAttribValue HasAttachmentStatus = 46; + // 33 - 45, reserved for ab / LDAP; + const nsMsgSearchAttribValue HasAttachmentStatus = 46; const nsMsgSearchAttribValue JunkStatus = 47; const nsMsgSearchAttribValue Label = 48; /* mail only...can search by label */ //49 is for showing customize... in ui headers start from 50 onwards up until 99. diff --git a/mailnews/base/search/resources/content/ABSearchDialog.js b/mailnews/base/search/resources/content/ABSearchDialog.js index 3bffd258597..3bfdfb0182c 100644 --- a/mailnews/base/search/resources/content/ABSearchDialog.js +++ b/mailnews/base/search/resources/content/ABSearchDialog.js @@ -149,11 +149,20 @@ function SelectDirectory(aURI) function GetScopeForDirectoryURI(aURI) { var directory = gRDF.GetResource(aURI).QueryInterface(nsIAbDirectory); + var booleanAnd = gSearchBooleanRadiogroup.selectedItem.value == "and"; - if (directory.isRemote) - return nsMsgSearchScope.LDAP; - else - return nsMsgSearchScope.LocalAB; + if (directory.isRemote) { + if (booleanAnd) + return nsMsgSearchScope.LDAPAnd; + else + return nsMsgSearchScope.LDAP; + } + else { + if (booleanAnd) + return nsMsgSearchScope.LocalABAnd; + else + return nsMsgSearchScope.LocalAB; + } } function onEnterInSearchTerm() @@ -188,30 +197,31 @@ function onSearch() var count = gSearchSession.searchTerms.Count(); for (var i=0; i - -