Bug 1503218 - Add notification for address cards created through drag-n-drop; r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 31 Oct 2018 23:22:34 +1300
changeset 33626 d7ee8a2c861b29c1295cbab99a6748614fb08a13
parent 33625 02c01fa93db94df7d3a2fed728d5994c4e0e634f
child 33627 0363b10132179b85f1ed33c720eda3bba858317d
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersmkmelin
bugs1503218
Bug 1503218 - Add notification for address cards created through drag-n-drop; r=mkmelin
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)