mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Fix bug20235 AB Formatting checkbox not remembered, r=habgas
This commit is contained in:
parent
42ce930293
commit
1a89572c34
@ -79,6 +79,7 @@ interface nsIAddrDatabase : nsIAddrDBAnnouncer {
|
||||
[noscript] void addNickName(in nsIMdbRow row, in string value);
|
||||
[noscript] void addPrimaryEmail(in nsIMdbRow row, in string value);
|
||||
[noscript] void add2ndEmail(in nsIMdbRow row, in string value);
|
||||
[noscript] void addSendPlainText(in nsIMdbRow row, in boolean value);
|
||||
[noscript] void addWorkPhone(in nsIMdbRow row, in string value);
|
||||
[noscript] void addHomePhone(in nsIMdbRow row, in string value);
|
||||
[noscript] void addFaxNumber(in nsIMdbRow row, in string value);
|
||||
|
@ -179,8 +179,15 @@ function GetCardValues(cardproperty, doc)
|
||||
|
||||
doc.getElementById('PrimaryEmail').value = cardproperty.primaryEmail;
|
||||
doc.getElementById('SecondEmail').value = cardproperty.secondEmail;
|
||||
//doc.getElementById('SendPlainText').value = cardproperty.sendPlainText;
|
||||
|
||||
|
||||
var checkbox = doc.getElementById('SendPlainText');
|
||||
if (checkbox)
|
||||
{
|
||||
if (cardproperty.sendPlainText)
|
||||
checkbox.checked = true;
|
||||
else
|
||||
checkbox.removeAttribute('checked', 'false');
|
||||
}
|
||||
doc.getElementById('WorkPhone').value = cardproperty.workPhone;
|
||||
doc.getElementById('HomePhone').value = cardproperty.homePhone;
|
||||
doc.getElementById('FaxNumber').value = cardproperty.faxNumber;
|
||||
@ -227,7 +234,10 @@ function SetCardValues(cardproperty, doc)
|
||||
|
||||
cardproperty.primaryEmail = doc.getElementById('PrimaryEmail').value;
|
||||
cardproperty.secondEmail = doc.getElementById('SecondEmail').value;
|
||||
//cardproperty.SendPlainText = doc.getElementById('SendPlainText').value;
|
||||
|
||||
var checkbox = doc.getElementById('SendPlainText');
|
||||
if (checkbox)
|
||||
cardproperty.sendPlainText = checkbox.checked;
|
||||
|
||||
cardproperty.workPhone = doc.getElementById('WorkPhone').value;
|
||||
cardproperty.homePhone = doc.getElementById('HomePhone').value;
|
||||
|
@ -711,6 +711,11 @@ NS_IMETHODIMP nsAbCardProperty::CopyCard(nsIAbCard* srcCard)
|
||||
srcCard->GetSecondEmail(&str);
|
||||
SetSecondEmail(str);
|
||||
PR_FREEIF(str);
|
||||
|
||||
PRBool bValue = PR_FALSE;
|
||||
srcCard->GetSendPlainText(&bValue);
|
||||
SetSendPlainText(bValue);
|
||||
|
||||
srcCard->GetWorkPhone(&str);
|
||||
SetWorkPhone(str);
|
||||
PR_FREEIF(str);
|
||||
|
@ -890,6 +890,7 @@ nsresult nsAddrDatabase::InitMDBInfo()
|
||||
GetStore()->StringToToken(GetEnv(), kNicknameColumn, &m_NickNameColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kPriEmailColumn, &m_PriEmailColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), k2ndEmailColumn, &m_2ndEmailColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kPlainTextColumn, &m_PlainTextColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kWorkPhoneColumn, &m_WorkPhoneColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kHomePhoneColumn, &m_HomePhoneColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kFaxColumn, &m_FaxColumnToken);
|
||||
@ -1023,6 +1024,11 @@ nsresult nsAddrDatabase::AddAttributeColumnsToRow(nsIAbCard *card, nsIMdbRow *ca
|
||||
}
|
||||
}
|
||||
PR_FREEIF(pUnicodeStr);
|
||||
|
||||
PRBool bValue = PR_FALSE;
|
||||
card->GetSendPlainText(&bValue);
|
||||
AddSendPlainText(cardRow, bValue);
|
||||
|
||||
card->GetWorkPhone(&pUnicodeStr);
|
||||
unicharLength = nsCRT::strlen(pUnicodeStr);
|
||||
if (pUnicodeStr && unicharLength)
|
||||
@ -1837,6 +1843,19 @@ mdb_err nsAddrDatabase::AddIntColumn(nsIMdbRow* cardRow, mdb_column inColumn, PR
|
||||
return cardRow->AddColumn(GetEnv(), inColumn, &yarn);
|
||||
}
|
||||
|
||||
mdb_err nsAddrDatabase::AddBoolColumn(nsIMdbRow* cardRow, mdb_column inColumn, PRBool bValue)
|
||||
{
|
||||
struct mdbYarn yarn;
|
||||
char yarnBuf[100];
|
||||
|
||||
yarn.mYarn_Buf = (void *) yarnBuf;
|
||||
if (bValue)
|
||||
GetIntYarn(1, &yarn);
|
||||
else
|
||||
GetIntYarn(0, &yarn);
|
||||
return cardRow->AddColumn(GetEnv(), inColumn, &yarn);
|
||||
}
|
||||
|
||||
nsresult nsAddrDatabase::GetStringColumn(nsIMdbRow *cardRow, mdb_token outToken, nsString& str)
|
||||
{
|
||||
nsresult err = NS_ERROR_FAILURE;
|
||||
@ -2209,6 +2228,11 @@ nsresult nsAddrDatabase::GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow)
|
||||
PR_Free(unicodeStr);
|
||||
}
|
||||
|
||||
PRBool bValue = PR_FALSE;
|
||||
err = GetBoolColumn(cardRow, m_PlainTextColumnToken, &bValue);
|
||||
if (NS_SUCCEEDED(err))
|
||||
newCard->SetSendPlainText(bValue);
|
||||
|
||||
err = GetStringColumn(cardRow, m_WorkPhoneColumnToken, tempString);
|
||||
if (NS_SUCCEEDED(err) && tempString.Length())
|
||||
{
|
||||
|
@ -119,6 +119,9 @@ public:
|
||||
NS_IMETHOD Add2ndEmail(nsIMdbRow * row, const char * value)
|
||||
{ return AddCharStringColumn(row, m_2ndEmailColumnToken, value); }
|
||||
|
||||
NS_IMETHOD AddSendPlainText(nsIMdbRow * row, PRBool value)
|
||||
{ return AddBoolColumn(row, m_PlainTextColumnToken, value); }
|
||||
|
||||
NS_IMETHOD AddWorkPhone(nsIMdbRow * row, const char * value)
|
||||
{ return AddCharStringColumn(row, m_WorkPhoneColumnToken, value); }
|
||||
|
||||
@ -252,6 +255,7 @@ protected:
|
||||
mdb_err AddCharStringColumn(nsIMdbRow* cardRow, mdb_column inColumn, const char* str);
|
||||
mdb_err AddStringColumn(nsIMdbRow* cardRow, mdb_column inColumn, nsString* str);
|
||||
mdb_err AddIntColumn(nsIMdbRow* cardRow, mdb_column inColumn, PRUint32 nValue);
|
||||
mdb_err AddBoolColumn(nsIMdbRow* cardRow, mdb_column inColumn, PRBool bValue);
|
||||
nsresult GetStringColumn(nsIMdbRow *cardRow, mdb_token outToken, nsString& str);
|
||||
nsresult GetIntColumn(nsIMdbRow *cardRow, mdb_token outToken,
|
||||
PRUint32* pValue, PRUint32 defaultValue);
|
||||
|
Loading…
Reference in New Issue
Block a user