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 33994 e305f7284ec8eb2449ba95f82042ca7075767ae2
parent 33993 be92684912cce5982af2389b70bf03649b15a0be
child 33995 c6411719c75a4c91d0454aeb529d293b3f3d9ae3
push id2402
push usermozilla@jorgk.com
push dateThu, 25 Apr 2019 10:26:20 +0000
treeherdercomm-beta@09de02716c0e [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;
 }