Bug 1546425 - Allow to disable autocomplete per directory. r=aceman a=jorgk
--- 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;
}