mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 04:27:41 +00:00
Bug #106018 --> when auto completing put matches which share
the default domain FIRST when there are multiple matches of the same type. r=ducarroz sr=sspitzer
This commit is contained in:
parent
14cafa22ea
commit
11fe60ad99
@ -70,7 +70,7 @@ void nsAbAutoCompleteSession::ResetMatchTypeConters()
|
||||
{
|
||||
PRInt32 i;
|
||||
for (i = 0; i < LAST_MATCH_TYPE; mMatchTypeConters[i++] = 0)
|
||||
;
|
||||
mDefaultDomainMatchTypeCounters[i] = 0;
|
||||
}
|
||||
|
||||
PRBool nsAbAutoCompleteSession::ItsADuplicate(PRUnichar* fullAddrStr, nsIAutoCompleteResults* results)
|
||||
@ -229,10 +229,29 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
|
||||
rv = results->GetItems(getter_AddRefs(array));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRInt32 insertPosition = 0;
|
||||
PRInt32 index = 0;
|
||||
PRInt32 i;
|
||||
for (i = 0; i <= type; insertPosition += mMatchTypeConters[i++])
|
||||
;
|
||||
// break off at the first of our type....
|
||||
for (i = 0; i < type; index += mMatchTypeConters[i++])
|
||||
;
|
||||
|
||||
// use domain matches as the distinguisher amongst matches of the same type.
|
||||
PRInt32 insertPosition = index + mMatchTypeConters[i];
|
||||
|
||||
if (type != DEFAULT_MATCH && !bIsMailList)
|
||||
{
|
||||
nsAutoString emailaddr(pEmailStr);
|
||||
PRInt32 foundIndex = emailaddr.Find(mDefaultDomain, PR_TRUE);
|
||||
if (foundIndex > 0)
|
||||
{
|
||||
// okay the match contains the default domain, we want to insert it
|
||||
// AFTER any exisiting matches of the same type which also have a domain
|
||||
// match....
|
||||
insertPosition = index + mDefaultDomainMatchTypeCounters[type];
|
||||
mDefaultDomainMatchTypeCounters[type]++;
|
||||
}
|
||||
}
|
||||
|
||||
rv = array->InsertElementAt(newItem, insertPosition);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mMatchTypeConters[type] ++;
|
||||
|
@ -113,6 +113,7 @@ protected:
|
||||
nsCOMPtr<nsIMsgHeaderParser> mParser;
|
||||
nsString mDefaultDomain;
|
||||
PRUint32 mMatchTypeConters[LAST_MATCH_TYPE];
|
||||
PRUint32 mDefaultDomainMatchTypeCounters[LAST_MATCH_TYPE];
|
||||
|
||||
// how to process the comment column, if at all. this value
|
||||
// comes from "mail.autoComplete.commentColumn", or, if that
|
||||
@ -135,7 +136,6 @@ class nsAbAutoCompleteParam : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
// NS_DEFINE_STATIC_IID_ACCESSOR(NS_ABAUTOCOMPLETEPARAM_IID)
|
||||
|
||||
nsAbAutoCompleteParam(const PRUnichar* nickName,
|
||||
const PRUnichar* displayName,
|
||||
@ -144,7 +144,7 @@ public:
|
||||
const PRUnichar* emailAddress,
|
||||
const PRUnichar* notes,
|
||||
const PRUnichar* dirName,
|
||||
PRBool isMailList,
|
||||
PRBool isMailList,
|
||||
nsAbAutoCompleteSession::MatchType type)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@ -154,7 +154,7 @@ public:
|
||||
mLastName = nsCRT::strdup(lastName ? lastName : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get()));
|
||||
mEmailAddress = nsCRT::strdup(emailAddress ? emailAddress : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get()));
|
||||
mNotes = nsCRT::strdup(notes ? notes : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get()));
|
||||
mDirName = nsCRT::strdup(dirName ? dirName : NS_STATIC_CAST(const PRUnichar *, NS_LITERAL_STRING("").get()));
|
||||
mDirName = nsCRT::strdup(dirName ? dirName : NS_STATIC_CAST(const PRUnichar *, NS_LITERAL_STRING("").get()));
|
||||
mIsMailList = isMailList;
|
||||
mType = type;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user