From fa82fdf0e7b92df2bf487a0601a472ccd5786ca1 Mon Sep 17 00:00:00 2001 From: "ducarroz%netscape.com" Date: Wed, 22 Sep 1999 01:37:43 +0000 Subject: [PATCH] Fix problem with autocomplete, bug 14281 --- .../addrbook/public/nsIAutoCompleteListener.idl | 2 +- .../addrbook/public/nsIAutoCompleteSession.idl | 2 +- mailnews/addrbook/src/nsAbAutoCompleteSession.cpp | 8 ++++---- .../resources/content/addressAutoComplete.js | 14 ++++++-------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mailnews/addrbook/public/nsIAutoCompleteListener.idl b/mailnews/addrbook/public/nsIAutoCompleteListener.idl index 7ab912baee54..45afc0b2bf92 100644 --- a/mailnews/addrbook/public/nsIAutoCompleteListener.idl +++ b/mailnews/addrbook/public/nsIAutoCompleteListener.idl @@ -21,6 +21,6 @@ [scriptable, uuid(CA2A6B08-3625-11d3-988E-001083010E9B)] interface nsIAutoCompleteListener : nsISupports { - void OnAutoCompleteResult(in wstring aDocId, in wstring aOriginalString, in wstring aMatch); + void OnAutoCompleteResult(in nsISupports aParam, in wstring aOriginalString, in wstring aMatch); }; diff --git a/mailnews/addrbook/public/nsIAutoCompleteSession.idl b/mailnews/addrbook/public/nsIAutoCompleteSession.idl index c8b7a1c9c03a..1acb07b78f7a 100644 --- a/mailnews/addrbook/public/nsIAutoCompleteSession.idl +++ b/mailnews/addrbook/public/nsIAutoCompleteSession.idl @@ -23,6 +23,6 @@ interface nsIAutoCompleteListener; [scriptable, uuid(CA2A6B07-3625-11d3-988E-001083010E9B)] interface nsIAutoCompleteSession : nsISupports { - void AutoComplete(in wstring doc_id, in wstring aSearchString, in nsIAutoCompleteListener aResultListener); + void AutoComplete(in nsISupports aParam, in wstring aSearchString, in nsIAutoCompleteListener aResultListener); }; diff --git a/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp b/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp index 49fbee863940..d2b158a9e76c 100644 --- a/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp +++ b/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp @@ -116,7 +116,7 @@ nsresult nsAbAutoCompleteSession::PopulateTableWithAB(nsIEnumerator * aABCards) break; } - return rv; + return NS_OK; } nsresult nsAbAutoCompleteSession::InitializeTable() @@ -168,7 +168,7 @@ nsAbAutoCompleteSession::~nsAbAutoCompleteSession() } } -NS_IMETHODIMP nsAbAutoCompleteSession::AutoComplete(const PRUnichar *aDocId, const PRUnichar *aSearchString, nsIAutoCompleteListener *aResultListener) +NS_IMETHODIMP nsAbAutoCompleteSession::AutoComplete(nsISupports *aParam, const PRUnichar *aSearchString, nsIAutoCompleteListener *aResultListener) { // mscott - right now I'm not even going to bother to make this synchronous... // I'll beef it up with some test data later but we want to see if this idea works for right now... @@ -204,7 +204,7 @@ NS_IMETHODIMP nsAbAutoCompleteSession::AutoComplete(const PRUnichar *aDocId, con m_searchNameCompletionEntryTable[nIndex].emailAddress, &fullAddress); nsString searchResult(fullAddress); // iterate over the table looking for a match - rv = aResultListener->OnAutoCompleteResult(aDocId, aSearchString, searchResult.GetUnicode()); + rv = aResultListener->OnAutoCompleteResult(aParam, aSearchString, searchResult.GetUnicode()); break; } } @@ -217,7 +217,7 @@ NS_IMETHODIMP nsAbAutoCompleteSession::AutoComplete(const PRUnichar *aDocId, con if (atSignIndex < 0) { searchResult += m_domain; - rv = aResultListener->OnAutoCompleteResult(aDocId, aSearchString, searchResult.GetUnicode()); + rv = aResultListener->OnAutoCompleteResult(aParam, aSearchString, searchResult.GetUnicode()); } } } diff --git a/mailnews/compose/resources/content/addressAutoComplete.js b/mailnews/compose/resources/content/addressAutoComplete.js index 591594bdfca5..d61c8450dbff 100644 --- a/mailnews/compose/resources/content/addressAutoComplete.js +++ b/mailnews/compose/resources/content/addressAutoComplete.js @@ -1,16 +1,14 @@ var AddressAutoCompleteListener = { - OnAutoCompleteResult: function(doc_id, aOriginalString, aMatch) { - dump("textId = " + doc_id + "\n"); + OnAutoCompleteResult: function(aItem, aOriginalString, aMatch) { + dump("aItem = " + aItem + "\n"); - var field = document.getElementById(doc_id); - - if ( field ) + if ( aItem ) { - dump("value = " + field.value + "\n"); + dump("value = " + aItem.value + "\n"); dump("aOriginalString = " + aOriginalString + "\n"); dump("aMatch = " + aMatch + "\n"); - field.value = aMatch; + aItem.value = aMatch; } } }; @@ -41,5 +39,5 @@ function AutoCompleteAddress(inputElement) ac = ac.QueryInterface(Components.interfaces.nsIAutoCompleteSession); } - ac.AutoComplete(inputElement.getAttribute('id'), inputElement.value, AddressAutoCompleteListener); + ac.AutoComplete(inputElement, inputElement.value, AddressAutoCompleteListener); }