Bug 1503218 - Add notification for address cards created through drag-n-drop; r=mkmelin a=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 31 Oct 2018 23:22:34 +1300
changeset 33465 014f012b2825b1ee1e7989cef541d94256cadff7
parent 33464 593d228719d752e37377d322cced522032d3582b
child 33466 3a98ae26df27398c1f868eb016daebd384aeecb2
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersmkmelin, jorgk
bugs1503218
Bug 1503218 - Add notification for address cards created through drag-n-drop; r=mkmelin a=jorgk
mailnews/addrbook/src/nsAbMDBDirectory.cpp
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -752,16 +752,22 @@ NS_IMETHODIMP nsAbMDBDirectory::DropCard
     if (observerService) {
       nsAutoCString thisUID;
       this->GetUID(thisUID);
       observerService->NotifyObservers(newCard, "addrbook-list-member-added", NS_ConvertUTF8toUTF16(thisUID).get());
     }
   }
   else {
     mDatabase->CreateNewCardAndAddToDB(newCard, true /* notify */, this);
+    nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
+    if (observerService) {
+      nsAutoCString thisUID;
+      this->GetUID(thisUID);
+      observerService->NotifyObservers(newCard, "addrbook-contact-created", NS_ConvertUTF8toUTF16(thisUID).get());
+    }
   }
   mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::EditMailListToDatabase(nsIAbCard *listCard)
 {
   if (mIsQueryURI)