#411: option to automatically use group icon for new entries

This commit is contained in:
antelle 2020-03-15 17:22:25 +01:00
parent 3a17a370f2
commit 3f9296e38c
6 changed files with 24 additions and 4 deletions

View File

@ -405,6 +405,7 @@
"setGenTableView": "Entries list table view", "setGenTableView": "Entries list table view",
"setGenColorfulIcons": "Colorful custom icons in the list", "setGenColorfulIcons": "Colorful custom icons in the list",
"setGenUseMarkdown": "Markdown in notes", "setGenUseMarkdown": "Markdown in notes",
"setGenUseGroupIconForEntries": "Automatically use group icon for new entries",
"setGenDirectAutotype": "If only one matching entry is found, select that one automatically for Autotype", "setGenDirectAutotype": "If only one matching entry is found, select that one automatically for Autotype",
"setGenFunction": "Function", "setGenFunction": "Function",
"setGenAutoSyncOnClose": "Automatically save and sync on close", "setGenAutoSyncOnClose": "Automatically save and sync on close",

View File

@ -63,6 +63,7 @@ AppSettingsModel.defineModelProperties(
generatorHidePassword: false, generatorHidePassword: false,
cacheConfigSettings: false, cacheConfigSettings: false,
allowIframes: false, allowIframes: false,
useGroupIconForEntries: false,
canOpen: true, canOpen: true,
canOpenDemo: true, canOpenDemo: true,

View File

@ -1,5 +1,6 @@
import kdbxweb from 'kdbxweb'; import kdbxweb from 'kdbxweb';
import { Model } from 'framework/model'; import { Model } from 'framework/model';
import { AppSettingsModel } from 'models/app-settings-model';
import { KdbxToHtml } from 'comp/format/kdbx-to-html'; import { KdbxToHtml } from 'comp/format/kdbx-to-html';
import { IconMap } from 'const/icon-map'; import { IconMap } from 'const/icon-map';
import { AttachmentModel } from 'models/attachment-model'; import { AttachmentModel } from 'models/attachment-model';
@ -786,6 +787,9 @@ class EntryModel extends Model {
static newEntry(group, file) { static newEntry(group, file) {
const model = new EntryModel(); const model = new EntryModel();
const entry = file.db.createEntry(group.group); const entry = file.db.createEntry(group.group);
if (AppSettingsModel.useGroupIconForEntries && group.icon && group.iconId) {
entry.icon = group.iconId;
}
model.setEntry(entry, group, file); model.setEntry(entry, group, file);
model.entry.times.update(); model.entry.times.update();
model.unsaved = true; model.unsaved = true;

View File

@ -41,6 +41,7 @@ class SettingsGeneralView extends View {
'change .settings__general-table-view': 'changeTableView', 'change .settings__general-table-view': 'changeTableView',
'change .settings__general-colorful-icons': 'changeColorfulIcons', 'change .settings__general-colorful-icons': 'changeColorfulIcons',
'change .settings__general-use-markdown': 'changeUseMarkdown', 'change .settings__general-use-markdown': 'changeUseMarkdown',
'change .settings__general-use-group-icon-for-entries': 'changeUseGroupIconForEntries',
'change .settings__general-direct-autotype': 'changeDirectAutotype', 'change .settings__general-direct-autotype': 'changeDirectAutotype',
'change .settings__general-titlebar-style': 'changeTitlebarStyle', 'change .settings__general-titlebar-style': 'changeTitlebarStyle',
'click .settings__general-update-btn': 'checkUpdate', 'click .settings__general-update-btn': 'checkUpdate',
@ -106,6 +107,7 @@ class SettingsGeneralView extends View {
releaseNotesLink: Links.ReleaseNotes, releaseNotesLink: Links.ReleaseNotes,
colorfulIcons: AppSettingsModel.colorfulIcons, colorfulIcons: AppSettingsModel.colorfulIcons,
useMarkdown: AppSettingsModel.useMarkdown, useMarkdown: AppSettingsModel.useMarkdown,
useGroupIconForEntries: AppSettingsModel.useGroupIconForEntries,
directAutotype: AppSettingsModel.directAutotype, directAutotype: AppSettingsModel.directAutotype,
supportsTitleBarStyles: Launcher && Features.supportsTitleBarStyles(), supportsTitleBarStyles: Launcher && Features.supportsTitleBarStyles(),
titlebarStyle: AppSettingsModel.titlebarStyle, titlebarStyle: AppSettingsModel.titlebarStyle,
@ -305,6 +307,12 @@ class SettingsGeneralView extends View {
Events.emit('refresh'); Events.emit('refresh');
} }
changeUseGroupIconForEntries(e) {
const useGroupIconForEntries = e.target.checked || false;
AppSettingsModel.useGroupIconForEntries = useGroupIconForEntries;
Events.emit('refresh');
}
changeDirectAutotype(e) { changeDirectAutotype(e) {
const directAutotype = e.target.checked || false; const directAutotype = e.target.checked || false;
AppSettingsModel.directAutotype = directAutotype; AppSettingsModel.directAutotype = directAutotype;

View File

@ -88,10 +88,6 @@
<input type="checkbox" class="settings__input input-base settings__general-colorful-icons" id="settings__general-colorful-icons" {{#if colorfulIcons}}checked{{/if}} /> <input type="checkbox" class="settings__input input-base settings__general-colorful-icons" id="settings__general-colorful-icons" {{#if colorfulIcons}}checked{{/if}} />
<label for="settings__general-colorful-icons">{{res 'setGenColorfulIcons'}}</label> <label for="settings__general-colorful-icons">{{res 'setGenColorfulIcons'}}</label>
</div> </div>
<div>
<input type="checkbox" class="settings__input input-base settings__general-use-markdown" id="settings__general-use-markdown" {{#if useMarkdown}}checked{{/if}} />
<label for="settings__general-use-markdown">{{res 'setGenUseMarkdown'}}</label>
</div>
<h2>{{res 'setGenFunction'}}</h2> <h2>{{res 'setGenFunction'}}</h2>
{{#if canAutoSaveOnClose}} {{#if canAutoSaveOnClose}}
@ -152,6 +148,15 @@
<label for="settings__general-direct-autotype">{{res 'setGenDirectAutotype'}}</label> <label for="settings__general-direct-autotype">{{res 'setGenDirectAutotype'}}</label>
</div> </div>
{{/if}} {{/if}}
<div>
<input type="checkbox" class="settings__input input-base settings__general-use-markdown" id="settings__general-use-markdown" {{#if useMarkdown}}checked{{/if}} />
<label for="settings__general-use-markdown">{{res 'setGenUseMarkdown'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__general-use-group-icon-for-entries"
id="settings__general-use-group-icon-for-entries" {{#if useGroupIconForEntries}}checked{{/if}} />
<label for="settings__general-use-group-icon-for-entries">{{res 'setGenUseGroupIconForEntries'}}</label>
</div>
<h2>{{res 'setGenLock'}}</h2> <h2>{{res 'setGenLock'}}</h2>
<div> <div>

View File

@ -9,6 +9,7 @@ Release notes
`+` #1309: back button in attachment preview `+` #1309: back button in attachment preview
`+` #1142: submit button on mobile password input `+` #1142: submit button on mobile password input
`+` #766: setting for no/unlimited history `+` #766: setting for no/unlimited history
`+` #411: option to automatically use group icon for new entries
`-` fix #1396: fixed hyperlinks in notes `-` fix #1396: fixed hyperlinks in notes
`-` fix #1323: version in the About dialog `-` fix #1323: version in the About dialog
`-` fix #734: OTP secrets with spaces `-` fix #734: OTP secrets with spaces