+ const props = {
+ style: this.props.style,
+ className: 'settingItem'
+ }
+ if (this.props.id) {
+ props.id = this.props.id
+ }
+ return
)
})
+ const homepageValue = getSetting(settings.HOMEPAGE, this.props.settings)
+ const homepage = homepageValue && homepageValue.trim()
+ const disableShowHomeButton = !homepage || !homepage.length
+ const disableBookmarksBarSelect = !getSetting(settings.SHOW_BOOKMARKS_TOOLBAR, this.props.settings)
const defaultLanguage = this.props.languageCodes.find((lang) => lang.includes(navigator.language)) || 'en-US'
+
return
@@ -604,7 +629,26 @@ class GeneralTab extends ImmutableComponent {
+ onChange={changeSetting.bind(null, this.onChangeSetting, settings.HOMEPAGE)} />
+
+
+ {
+ isDarwin ? null :
+ }
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- {
- isDarwin ? null :
- }
-
-
-
-
}
}
diff --git a/js/components/main.js b/js/components/main.js
index 14ccc4aae98..e4364831ec5 100644
--- a/js/components/main.js
+++ b/js/components/main.js
@@ -53,6 +53,7 @@ const dragTypes = require('../constants/dragTypes')
const keyCodes = require('../../app/common/constants/keyCodes')
const keyLocations = require('../../app/common/constants/keyLocations')
const isWindows = process.platform === 'win32'
+const bookmarksToolbarMode = require('../../app/common/constants/bookmarksToolbarMode')
// State handling
const basicAuthState = require('../../app/common/state/basicAuthState')
@@ -812,8 +813,9 @@ class Main extends ImmutableComponent {
const nonPinnedFrames = this.props.windowState.get('frames').filter((frame) => !frame.get('pinnedLocation'))
const tabsPerPage = Number(getSetting(settings.TABS_PER_PAGE))
const showBookmarksToolbar = getSetting(settings.SHOW_BOOKMARKS_TOOLBAR)
- const showFavicon = getSetting(settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON)
- const showOnlyFavicon = getSetting(settings.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON)
+ const btbMode = getSetting(settings.BOOKMARKS_TOOLBAR_MODE)
+ const showFavicon = (btbMode === bookmarksToolbarMode.TEXT_AND_FAVICONS || btbMode === bookmarksToolbarMode.FAVICONS_ONLY)
+ const showOnlyFavicon = btbMode === bookmarksToolbarMode.FAVICONS_ONLY
const siteInfoIsVisible = this.props.windowState.getIn(['ui', 'siteInfo', 'isVisible'])
const braveShieldsDisabled = this.braveShieldsDisabled
const braveryPanelIsVisible = !braveShieldsDisabled && this.props.windowState.get('braveryPanelDetail')
diff --git a/js/constants/settings.js b/js/constants/settings.js
index c4dcf954903..f754f54f713 100644
--- a/js/constants/settings.js
+++ b/js/constants/settings.js
@@ -11,6 +11,9 @@ const settings = {
DEFAULT_DOWNLOAD_SAVE_PATH: 'general.downloads.default-save-path',
AUTO_HIDE_MENU: 'general.autohide-menu',
DISABLE_TITLE_MODE: 'general.disable-title-mode',
+ BOOKMARKS_TOOLBAR_MODE: 'general.bookmarks-toolbar-mode',
+ SHOW_BOOKMARKS_TOOLBAR: 'bookmarks.toolbar.show',
+ LANGUAGE: 'general.language',
// Search tab
DEFAULT_SEARCH_ENGINE: 'search.default-search-engine',
OFFER_SEARCH_SUGGESTIONS: 'search.offer-search-suggestions',
@@ -37,16 +40,6 @@ const settings = {
SHUTDOWN_CLEAR_SITE_SETTINGS: 'shutdown.clear-site-settings',
// Autofill
AUTOFILL_ENABLED: 'privacy.autofill-enabled',
- // Security Tab: DEPRECATED but still required (for now)
- PASSWORD_MANAGER_ENABLED: 'security.passwords.manager-enabled',
- ONE_PASSWORD_ENABLED: 'security.passwords.one-password-enabled',
- DASHLANE_ENABLED: 'security.passwords.dashlane-enabled',
- LAST_PASS_ENABLED: 'security.passwords.last-pass-enabled',
- // Other settings
- SHOW_BOOKMARKS_TOOLBAR: 'bookmarks.toolbar.show',
- SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
- SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon',
- LANGUAGE: 'general.language',
// Payments Tab
PAYMENTS_ENABLED: 'payments.enabled',
PAYMENTS_NOTIFICATIONS: 'payments.notifications',
@@ -61,7 +54,21 @@ const settings = {
SEND_USAGE_STATISTICS: 'advanced.send-usage-statistics',
ADBLOCK_CUSTOM_RULES: 'adblock.customRules',
MINIMUM_VISIT_TIME: 'advanced.minimum-visit-time',
- MINIMUM_VISTS: 'advanced.minimum-visits'
+ MINIMUM_VISTS: 'advanced.minimum-visits',
+
+ // DEPRECATED settings
+ // ########################
+ // these constants should not appear outside of this file, ../settings.js, and our tests
+ // NOTE: these settings rely on default values being set in ./appConfig.js
+ // ########################
+ // > phased out with 0.11.4
+ PASSWORD_MANAGER_ENABLED: 'security.passwords.manager-enabled',
+ ONE_PASSWORD_ENABLED: 'security.passwords.one-password-enabled',
+ DASHLANE_ENABLED: 'security.passwords.dashlane-enabled',
+ LAST_PASS_ENABLED: 'security.passwords.last-pass-enabled',
+ // > phased out with 0.12.5
+ SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
+ SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon'
}
module.exports = settings
diff --git a/js/contextMenus.js b/js/contextMenus.js
index 18162997302..296629458af 100644
--- a/js/contextMenus.js
+++ b/js/contextMenus.js
@@ -34,6 +34,7 @@ const urlParse = require('url').parse
const eventUtil = require('./lib/eventUtil')
const currentWindow = require('../app/renderer/currentWindow')
const config = require('./constants/config')
+const bookmarksToolbarMode = require('../app/common/constants/bookmarksToolbarMode')
const isDarwin = process.platform === 'darwin'
@@ -337,7 +338,8 @@ function showBookmarkFolderInit (allBookmarkItems, parentBookmarkFolder, activeF
}
function bookmarkItemsInit (allBookmarkItems, items, activeFrame) {
- const showFavicon = getSetting(settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON) === true
+ const btbMode = getSetting(settings.BOOKMARKS_TOOLBAR_MODE)
+ const showFavicon = (btbMode === bookmarksToolbarMode.TEXT_AND_FAVICONS || btbMode === bookmarksToolbarMode.FAVICONS_ONLY)
return items.map((site) => {
const isFolder = siteUtil.isFolder(site)
let faIcon
diff --git a/js/settings.js b/js/settings.js
index ca873624fb3..6e222665045 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -6,24 +6,45 @@ const appConfig = require('./constants/appConfig')
const Immutable = require('immutable')
const settings = require('./constants/settings')
const {passwordManagers, defaultPasswordManager, extensionIds, displayNames} = require('./constants/passwordManagers')
+const bookmarksToolbarMode = require('../app/common/constants/bookmarksToolbarMode')
-// Retrofit the new single setting; we don't want to erase values set by the user.
const passwordManagerDefault = (settingKey, settingsCollection) => {
const onePasswordEnabled = resolveValue(settings.ONE_PASSWORD_ENABLED, settingsCollection) === true
- if (onePasswordEnabled) { return passwordManagers.ONE_PASSWORD }
+ if (onePasswordEnabled) return passwordManagers.ONE_PASSWORD
const dashlaneEnabled = resolveValue(settings.DASHLANE_ENABLED, settingsCollection) === true
- if (dashlaneEnabled) { return passwordManagers.DASHLANE }
+ if (dashlaneEnabled) return passwordManagers.DASHLANE
const lastPassEnabled = resolveValue(settings.LAST_PASS_ENABLED, settingsCollection) === true
- if (lastPassEnabled) { return passwordManagers.LAST_PASS }
+ if (lastPassEnabled) return passwordManagers.LAST_PASS
const disabled = resolveValue(settings.PASSWORD_MANAGER_ENABLED, settingsCollection) === false
- if (disabled) { return passwordManagers.UNMANAGED }
+ if (disabled) return passwordManagers.UNMANAGED
return defaultPasswordManager
}
+const bookmarksBarDefault = (settingKey, settingsCollection) => {
+ const faviconsOnly = resolveValue(settings.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON, settingsCollection) === true
+ if (faviconsOnly) return bookmarksToolbarMode.FAVICONS_ONLY
+
+ const favicons = resolveValue(settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON, settingsCollection) === true
+ if (favicons) return bookmarksToolbarMode.TEXT_AND_FAVICONS
+
+ return bookmarksToolbarMode.TEXT_ONLY
+}
+
+// Retrofit a new setting based on old values; we don't want to lose existing user settings.
+const getDefaultSetting = (settingKey, settingsCollection) => {
+ switch (settingKey) {
+ case settings.ACTIVE_PASSWORD_MANAGER:
+ return passwordManagerDefault(settingKey, settingsCollection)
+ case settings.BOOKMARKS_TOOLBAR_MODE:
+ return bookmarksBarDefault(settingKey, settingsCollection)
+ }
+ return undefined
+}
+
const resolveValue = (settingKey, settingsCollection) => {
const appSettings = (process.type === 'browser'
? require('./stores/appStore').getState().get('settings')
@@ -38,13 +59,9 @@ const resolveValue = (settingKey, settingsCollection) => {
}
module.exports.getSetting = (settingKey, settingsCollection) => {
- if (settingKey === settings.ACTIVE_PASSWORD_MANAGER) {
- const currentValue = resolveValue(settingKey, settingsCollection)
- return !currentValue
- ? passwordManagerDefault(settingKey, settingsCollection)
- : currentValue
- }
- return resolveValue(settingKey, settingsCollection)
+ const setting = resolveValue(settingKey, settingsCollection)
+ if (setting) return setting
+ return getDefaultSetting(settingKey, settingsCollection)
}
module.exports.getActivePasswordManager = (settingsCollection) => {
diff --git a/less/about/preferences.less b/less/about/preferences.less
index 37228c50795..d36982acd8d 100644
--- a/less/about/preferences.less
+++ b/less/about/preferences.less
@@ -169,6 +169,7 @@ body {
width: 100%;
background: transparent;
padding: 10px 0 0 20px;
+ -webkit-user-select: none;
&:before,
&::before {
@@ -376,6 +377,10 @@ span.browserButton.primaryButton {
margin-top: 20px;
padding: 5px 20px;
}
+
+ &.importNowButton {
+ margin-top: 5px;
+ }
}
.settingsList {
@@ -418,7 +423,6 @@ span.browserButton.primaryButton {
height: 2.25em;
font-size: 0.9em;
padding: 0.4em;
- margin: 10px 0;
border: solid 1px @lightGray;
background: white;
color: @darkGray;
@@ -530,12 +534,14 @@ table.sortableTable {
}
.default {
- width: 150px;
+ width: 95x;
}
.searchEngine {
width: 304px !important;
+ padding-left: 10px;
}
.engineGoKey {
+ padding-left: 4px;
width: 250px;
}
}
@@ -1019,6 +1025,7 @@ div.nextPaymentSubmission {
.switchControlRightText, .switchControlLeftText {
opacity: 0.3;
}
+ cursor: default;
}
&:not(.disabled) {
diff --git a/test/unit/settingsTest.js b/test/unit/settingsTest.js
index 8ec9e0bff2d..33afa0e6913 100644
--- a/test/unit/settingsTest.js
+++ b/test/unit/settingsTest.js
@@ -2,6 +2,7 @@
const settings = require('../../js/settings')
const settingsConst = require('../../js/constants/settings')
const {passwordManagers, extensionIds, displayNames} = require('../../js/constants/passwordManagers')
+const bookmarksToolbarMode = require('../../app/common/constants/bookmarksToolbarMode')
const appConfig = require('../../js/constants/appConfig')
const Immutable = require('immutable')
const assert = require('assert')
@@ -27,60 +28,82 @@ describe('settings unit test', function () {
assert.equal(response, appConfig.defaultSettings[settingsConst.TABS_PER_PAGE])
})
- describe('key is ACTIVE_PASSWORD_MANAGER and value is falsey', function () {
- it('returns `1Password` if ONE_PASSWORD_ENABLED was true', function () {
- settingsCollection[settingsConst.ONE_PASSWORD_ENABLED] = true
- const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.ONE_PASSWORD)
- })
+ describe('when setting default value for new config entries (based on previous session data)', function () {
+ describe('ACTIVE_PASSWORD_MANAGER', function () {
+ it('returns `1Password` if ONE_PASSWORD_ENABLED was true', function () {
+ settingsCollection[settingsConst.ONE_PASSWORD_ENABLED] = true
+ const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.ONE_PASSWORD)
+ })
- it('returns `Dashlane` if DASHLANE_ENABLED was true', function () {
- settingsCollection[settingsConst.DASHLANE_ENABLED] = true
- const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.DASHLANE)
- })
+ it('returns `Dashlane` if DASHLANE_ENABLED was true', function () {
+ settingsCollection[settingsConst.DASHLANE_ENABLED] = true
+ const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.DASHLANE)
+ })
- it('returns `LastPass` if LAST_PASS_ENABLED was true', function () {
- settingsCollection[settingsConst.LAST_PASS_ENABLED] = true
- const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.LAST_PASS)
- })
+ it('returns `LastPass` if LAST_PASS_ENABLED was true', function () {
+ settingsCollection[settingsConst.LAST_PASS_ENABLED] = true
+ const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.LAST_PASS)
+ })
- it('returns `BuiltIn` if PASSWORD_MANAGER_ENABLED was true', function () {
- settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
- const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.BUILT_IN)
- })
+ it('returns `BuiltIn` if PASSWORD_MANAGER_ENABLED was true', function () {
+ settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
+ const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.BUILT_IN)
+ })
- it('returns `1Password`/`Dashlane`/`LastPass`, even if PASSWORD_MANAGER_ENABLED was true', function () {
- // 1Password
- settingsCollection[settingsConst.ONE_PASSWORD_ENABLED] = true
- settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
- let response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.ONE_PASSWORD)
- // Dashlane
- settingsCollection = {}
- settingsCollection[settingsConst.DASHLANE_ENABLED] = true
- settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
- response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.DASHLANE)
- // LastPass
- settingsCollection = {}
- settingsCollection[settingsConst.LAST_PASS_ENABLED] = true
- settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
- response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.LAST_PASS)
- })
+ it('returns `1Password`/`Dashlane`/`LastPass`, even if PASSWORD_MANAGER_ENABLED was true', function () {
+ // 1Password
+ settingsCollection[settingsConst.ONE_PASSWORD_ENABLED] = true
+ settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
+ let response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.ONE_PASSWORD)
+ // Dashlane
+ settingsCollection = {}
+ settingsCollection[settingsConst.DASHLANE_ENABLED] = true
+ settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
+ response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.DASHLANE)
+ // LastPass
+ settingsCollection = {}
+ settingsCollection[settingsConst.LAST_PASS_ENABLED] = true
+ settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
+ response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.LAST_PASS)
+ })
+
+ it('returns `Unmanaged` if PASSWORD_MANAGER_ENABLED was false', function () {
+ settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = false
+ const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.UNMANAGED)
+ })
- it('returns `Unmanaged` if PASSWORD_MANAGER_ENABLED was false', function () {
- settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = false
- const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.UNMANAGED)
+ it('defaults to `BuiltIn` if no other conditions are met', function () {
+ const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
+ assert.equal(response, passwordManagers.BUILT_IN)
+ })
})
- it('defaults to `BuiltIn` if no other conditions are met', function () {
- const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
- assert.equal(response, passwordManagers.BUILT_IN)
+ describe('BOOKMARKS_TOOLBAR_MODE', function () {
+ it('returns `FAVICONS_ONLY` if SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON was true', function () {
+ settingsCollection[settingsConst.SHOW_BOOKMARKS_TOOLBAR_FAVICON] = true
+ settingsCollection[settingsConst.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON] = true
+ const response = settings.getSetting(settingsConst.BOOKMARKS_TOOLBAR_MODE, settingsCollection)
+ assert.equal(response, bookmarksToolbarMode.FAVICONS_ONLY)
+ })
+
+ it('returns `TEXT_AND_FAVICONS` if SHOW_BOOKMARKS_TOOLBAR_FAVICON was true', function () {
+ settingsCollection[settingsConst.SHOW_BOOKMARKS_TOOLBAR_FAVICON] = true
+ const response = settings.getSetting(settingsConst.BOOKMARKS_TOOLBAR_MODE, settingsCollection)
+ assert.equal(response, bookmarksToolbarMode.TEXT_AND_FAVICONS)
+ })
+
+ it('defaults to `TEXT_ONLY` if no other conditions are met', function () {
+ const response = settings.getSetting(settingsConst.BOOKMARKS_TOOLBAR_MODE, settingsCollection)
+ assert.equal(response, bookmarksToolbarMode.TEXT_ONLY)
+ })
})
})
})