Bug 1546425 - Allow to disable autocomplete per directory. r=aceman a=jorgk
authorJohn Bieling <john.bieling@gmx.de>
Tue, 23 Apr 2019 17:41:40 +0200
changeset 32198 0ba26e8ccd61fc0092d36f412cd1be0c0baf362f
parent 32197 cd0440b2fedd3d5de4ee3f646f3c45eb4843a5b6
child 32199 b07a7d287e54f3a17935f1d885474ea62b12cfa2
push id190
push usermozilla@jorgk.com
push dateSun, 12 May 2019 19:49:38 +0000
treeherdercomm-esr60@29e8a0eb1dcb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, jorgk
bugs1546425
Bug 1546425 - Allow to disable autocomplete per directory. r=aceman a=jorgk
mailnews/addrbook/src/nsAbDirProperty.cpp
--- a/mailnews/addrbook/src/nsAbDirProperty.cpp
+++ b/mailnews/addrbook/src/nsAbDirProperty.cpp
@@ -467,17 +467,26 @@ NS_IMETHODIMP nsAbDirProperty::UseForAut
   NS_ENSURE_ARG_POINTER(aResult);
 
   // Is local autocomplete enabled?
   nsresult rv;
   nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID,
                                                    &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return prefBranch->GetBoolPref("mail.enable_autocomplete", aResult);
+  rv = prefBranch->GetBoolPref("mail.enable_autocomplete", aResult);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  // If autocomplete is generally enabled, check if it has been disabled explicitly for this directory.
+  if (*aResult)
+  {
+    (void) GetBoolValue("enable_autocomplete", true, aResult);
+  }
+
+  return rv;
 }
 
 NS_IMETHODIMP nsAbDirProperty::GetDirPrefId(nsACString &aDirPrefId)
 {
   aDirPrefId = m_DirPrefId;
   return NS_OK;
 }