зеркало из https://github.com/mozilla/pjs.git
bug 290043, Tidy address book code, patch by Mark Banner, r=bienvenu, sr=mscott, a=chofmann
This commit is contained in:
Родитель
aadabda24f
Коммит
2607d79d3e
|
@ -40,17 +40,15 @@
|
|||
|
||||
interface nsIAddrDBListener;
|
||||
|
||||
[scriptable, uuid(A4186D8A-1DD0-11d3-A303-001083003D0C)]
|
||||
[scriptable, uuid(0d8fe8e3-ad48-4dbd-b0c2-a1d374e39b93)]
|
||||
interface nsIAddrDBAnnouncer : nsISupports {
|
||||
|
||||
void addListener(in nsIAddrDBListener listener);
|
||||
void removeListener(in nsIAddrDBListener listener);
|
||||
|
||||
void notifyCardAttribChange(in unsigned long abCode,
|
||||
in nsIAddrDBListener instigator);
|
||||
void notifyCardAttribChange(in unsigned long abCode);
|
||||
void notifyCardEntryChange (in unsigned long abCode,
|
||||
in nsIAbCard card,
|
||||
in nsIAddrDBListener instigator);
|
||||
in nsIAbCard card);
|
||||
|
||||
void notifyAnnouncerGoingAway();
|
||||
};
|
||||
|
|
|
@ -40,17 +40,14 @@
|
|||
|
||||
interface nsIAddrDBAnnouncer;
|
||||
|
||||
[scriptable, uuid(A4186D89-1DD0-11d3-A303-001083003D0C)]
|
||||
[scriptable, uuid(96876e1d-50a8-4264-8cd0-953d75d0e81b)]
|
||||
interface nsIAddrDBListener : nsISupports {
|
||||
|
||||
void onCardAttribChange(in unsigned long abCode,
|
||||
in nsIAddrDBListener instigator);
|
||||
void onCardAttribChange(in unsigned long abCode);
|
||||
void onCardEntryChange (in unsigned long abCode,
|
||||
in nsIAbCard card,
|
||||
in nsIAddrDBListener instigator);
|
||||
in nsIAbCard card);
|
||||
void onListEntryChange (in unsigned long abCode,
|
||||
in nsIAbDirectory list,
|
||||
in nsIAddrDBListener instigator);
|
||||
void onAnnouncerGoingAway(in nsIAddrDBAnnouncer instigator);
|
||||
in nsIAbDirectory list);
|
||||
void onAnnouncerGoingAway();
|
||||
|
||||
};
|
||||
|
|
|
@ -841,13 +841,13 @@ NS_IMETHODIMP nsAbMDBDirectory::EditMailListToDatabase(const char *uri, nsIAbCar
|
|||
|
||||
// nsIAddrDBListener methods
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::OnCardAttribChange(PRUint32 abCode, nsIAddrDBListener *instigator)
|
||||
NS_IMETHODIMP nsAbMDBDirectory::OnCardAttribChange(PRUint32 abCode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::OnCardEntryChange
|
||||
(PRUint32 abCode, nsIAbCard *card, nsIAddrDBListener *instigator)
|
||||
(PRUint32 abCode, nsIAbCard *card)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(card);
|
||||
nsCOMPtr<nsISupports> cardSupports(do_QueryInterface(card));
|
||||
|
@ -873,7 +873,7 @@ NS_IMETHODIMP nsAbMDBDirectory::OnCardEntryChange
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::OnListEntryChange
|
||||
(PRUint32 abCode, nsIAbDirectory *list, nsIAddrDBListener *instigator)
|
||||
(PRUint32 abCode, nsIAbDirectory *list)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -898,7 +898,7 @@ NS_IMETHODIMP nsAbMDBDirectory::OnListEntryChange
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbMDBDirectory::OnAnnouncerGoingAway(nsIAddrDBAnnouncer *instigator)
|
||||
NS_IMETHODIMP nsAbMDBDirectory::OnAnnouncerGoingAway()
|
||||
{
|
||||
if (mDatabase)
|
||||
mDatabase->RemoveListener(this);
|
||||
|
|
|
@ -269,7 +269,7 @@ NS_IMETHODIMP nsAddrDatabase::RemoveListener(nsIAddrDBListener *listener)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAddrDatabase::NotifyCardAttribChange(PRUint32 abCode, nsIAddrDBListener *instigator)
|
||||
NS_IMETHODIMP nsAddrDatabase::NotifyCardAttribChange(PRUint32 abCode)
|
||||
{
|
||||
if (!m_ChangeListeners)
|
||||
return NS_OK;
|
||||
|
@ -279,13 +279,13 @@ NS_IMETHODIMP nsAddrDatabase::NotifyCardAttribChange(PRUint32 abCode, nsIAddrDBL
|
|||
nsIAddrDBListener *changeListener =
|
||||
(nsIAddrDBListener *) m_ChangeListeners->ElementAt(i);
|
||||
|
||||
nsresult rv = changeListener->OnCardAttribChange(abCode, instigator);
|
||||
nsresult rv = changeListener->OnCardAttribChange(abCode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAddrDatabase::NotifyCardEntryChange(PRUint32 abCode, nsIAbCard *card, nsIAddrDBListener *instigator)
|
||||
NS_IMETHODIMP nsAddrDatabase::NotifyCardEntryChange(PRUint32 abCode, nsIAbCard *card)
|
||||
{
|
||||
if (!m_ChangeListeners)
|
||||
return NS_OK;
|
||||
|
@ -298,7 +298,7 @@ NS_IMETHODIMP nsAddrDatabase::NotifyCardEntryChange(PRUint32 abCode, nsIAbCard *
|
|||
|
||||
if (changeListener)
|
||||
{
|
||||
nsresult rv = changeListener->OnCardEntryChange(abCode, card, instigator);
|
||||
nsresult rv = changeListener->OnCardEntryChange(abCode, card);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else
|
||||
|
@ -308,7 +308,7 @@ NS_IMETHODIMP nsAddrDatabase::NotifyCardEntryChange(PRUint32 abCode, nsIAbCard *
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsAddrDatabase::NotifyListEntryChange(PRUint32 abCode, nsIAbDirectory *dir, nsIAddrDBListener *instigator)
|
||||
nsresult nsAddrDatabase::NotifyListEntryChange(PRUint32 abCode, nsIAbDirectory *dir)
|
||||
{
|
||||
if (!m_ChangeListeners)
|
||||
return NS_OK;
|
||||
|
@ -320,7 +320,7 @@ nsresult nsAddrDatabase::NotifyListEntryChange(PRUint32 abCode, nsIAbDirectory *
|
|||
nsIAddrDBListener *changeListener =
|
||||
(nsIAddrDBListener *) m_ChangeListeners->ElementAt(i);
|
||||
|
||||
nsresult rv = changeListener->OnListEntryChange(abCode, dir, instigator);
|
||||
nsresult rv = changeListener->OnListEntryChange(abCode, dir);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -339,7 +339,7 @@ NS_IMETHODIMP nsAddrDatabase::NotifyAnnouncerGoingAway(void)
|
|||
nsIAddrDBListener *changeListener =
|
||||
(nsIAddrDBListener *) m_ChangeListeners->ElementAt(i);
|
||||
|
||||
nsresult rv = changeListener->OnAnnouncerGoingAway(this);
|
||||
nsresult rv = changeListener->OnAnnouncerGoingAway();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -1551,7 +1551,7 @@ NS_IMETHODIMP nsAddrDatabase::CreateNewCardAndAddToDB(nsIAbCard *newCard, PRBool
|
|||
// do notification
|
||||
if (notify)
|
||||
{
|
||||
NotifyCardEntryChange(AB_NotifyInserted, newCard, NULL);
|
||||
NotifyCardEntryChange(AB_NotifyInserted, newCard);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1631,7 +1631,7 @@ NS_IMETHODIMP nsAddrDatabase::CreateNewListCardAndAddToDB(nsIAbDirectory *aList,
|
|||
addressList->AppendElement(newCard);
|
||||
|
||||
if (notify)
|
||||
NotifyCardEntryChange(AB_NotifyInserted, newCard, nsnull);
|
||||
NotifyCardEntryChange(AB_NotifyInserted, newCard);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -1683,13 +1683,13 @@ NS_IMETHODIMP nsAddrDatabase::AddListCardColumnsToRow
|
|||
NS_IF_ADDREF(*pNewCard = newCard);
|
||||
|
||||
if (cardWasAdded) {
|
||||
NotifyCardEntryChange(AB_NotifyInserted, newCard, nsnull);
|
||||
NotifyCardEntryChange(AB_NotifyInserted, newCard);
|
||||
}
|
||||
else if (!aInMailingList) {
|
||||
NotifyCardEntryChange(AB_NotifyInserted, pCard, nsnull);
|
||||
NotifyCardEntryChange(AB_NotifyInserted, pCard);
|
||||
}
|
||||
else {
|
||||
NotifyCardEntryChange(AB_NotifyPropertyChanged, pCard, nsnull);
|
||||
NotifyCardEntryChange(AB_NotifyPropertyChanged, pCard);
|
||||
}
|
||||
|
||||
//add a column with address row id to the list row
|
||||
|
@ -1853,7 +1853,7 @@ NS_IMETHODIMP nsAddrDatabase::CreateMailListAndAddToDB(nsIAbDirectory *newList,
|
|||
|
||||
nsCOMPtr<nsIAbCard> listCard;
|
||||
CreateABListCard(listRow, getter_AddRefs(listCard));
|
||||
NotifyCardEntryChange(AB_NotifyInserted, listCard, NULL);
|
||||
NotifyCardEntryChange(AB_NotifyInserted, listCard);
|
||||
|
||||
NS_RELEASE(listRow);
|
||||
return NS_OK;
|
||||
|
@ -1931,7 +1931,7 @@ NS_IMETHODIMP nsAddrDatabase::DeleteCard(nsIAbCard *card, PRBool notify)
|
|||
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
if (notify)
|
||||
NotifyCardEntryChange(AB_NotifyDeleted, card, NULL);
|
||||
NotifyCardEntryChange(AB_NotifyDeleted, card);
|
||||
}
|
||||
else
|
||||
DeleteRowFromDeletedCardsTable(cardRow);
|
||||
|
@ -2020,7 +2020,7 @@ NS_IMETHODIMP nsAddrDatabase::DeleteCardFromMailList(nsIAbDirectory *mailList, n
|
|||
|
||||
err = DeleteCardFromListRow(pListRow, cardRowID);
|
||||
if (NS_SUCCEEDED(err) && aNotify) {
|
||||
NotifyCardEntryChange(AB_NotifyDeleted, card, NULL);
|
||||
NotifyCardEntryChange(AB_NotifyDeleted, card);
|
||||
}
|
||||
NS_RELEASE(pListRow);
|
||||
return NS_OK;
|
||||
|
@ -2221,7 +2221,7 @@ NS_IMETHODIMP nsAddrDatabase::EditCard(nsIAbCard *card, PRBool notify)
|
|||
NS_ENSURE_SUCCESS(err, err);
|
||||
|
||||
if (notify)
|
||||
NotifyCardEntryChange(AB_NotifyPropertyChanged, card, nsnull);
|
||||
NotifyCardEntryChange(AB_NotifyPropertyChanged, card);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2309,10 +2309,10 @@ NS_IMETHODIMP nsAddrDatabase::EditMailList(nsIAbDirectory *mailList, nsIAbCard *
|
|||
|
||||
if (notify)
|
||||
{
|
||||
NotifyListEntryChange(AB_NotifyPropertyChanged, mailList, nsnull);
|
||||
NotifyListEntryChange(AB_NotifyPropertyChanged, mailList);
|
||||
|
||||
if (listCard) {
|
||||
NotifyCardEntryChange(AB_NotifyPropertyChanged, listCard, nsnull);
|
||||
NotifyCardEntryChange(AB_NotifyPropertyChanged, listCard);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ protected:
|
|||
nsresult CreateCardFromDeletedCardsTable(nsIMdbRow* cardRow, mdb_id listRowID, nsIAbCard **result);
|
||||
nsresult DeleteCardFromListRow(nsIMdbRow* pListRow, mdb_id cardRowID);
|
||||
void DeleteCardFromAllMailLists(mdb_id cardRowID);
|
||||
nsresult NotifyListEntryChange(PRUint32 abCode, nsIAbDirectory *dir, nsIAddrDBListener *instigator);
|
||||
nsresult NotifyListEntryChange(PRUint32 abCode, nsIAbDirectory *dir);
|
||||
|
||||
nsresult AddLowercaseColumn(nsIMdbRow * row, mdb_token columnToken, const char* utf8String);
|
||||
nsresult GetRowFromAttribute(const char *aName, const char *aUTF8Value, PRBool aCaseInsensitive, nsIMdbRow **aCardRow);
|
||||
|
|
Загрузка…
Ссылка в новой задаче