fix #377: auto-type filtering issues

This commit is contained in:
antelle 2017-01-29 19:03:38 +01:00
parent 1db38c595d
commit 2923fbd846
5 changed files with 17 additions and 9 deletions

View File

@ -14,7 +14,8 @@ let AutoTypeFilter = function(windowInfo, appModel) {
AutoTypeFilter.prototype.getEntries = function() {
let filter = {
text: this.text
text: this.text,
autoType: true
};
let entries = this.appModel.getEntriesByFilter(filter);
if (!this.ignoreWindowInfo && this.hasWindowInfo()) {

View File

@ -190,7 +190,8 @@ var EntryModel = Backbone.Model.extend({
return !filter ||
(!filter.tagLower || this.searchTags.indexOf(filter.tagLower) >= 0) &&
(!filter.textLower || (filter.advanced ? this.matchesAdv(filter) : this.searchText.indexOf(filter.textLower) >= 0)) &&
(!filter.color || filter.color === true && this.searchColor || this.searchColor === filter.color);
(!filter.color || filter.color === true && this.searchColor || this.searchColor === filter.color) &&
(!filter.autoType || this.autoTypeEnabled);
},
matchesAdv: function(filter) {

View File

@ -172,7 +172,7 @@ var FileModel = Backbone.Model.extend({
group.forEachOwnEntry(null, entry => {
entryMap[entry.id] = entry;
});
}, true);
}, { includeDisabled: true });
this.entryMap = entryMap;
this.groupMap = groupMap;
},
@ -282,15 +282,15 @@ var FileModel = Backbone.Model.extend({
if (!filter.group || filter.subGroups) {
top.forEachGroup(group => {
group.forEachOwnEntry(filter, callback);
});
}, filter);
}
}
},
forEachGroup: function(callback, includeDisabled) {
forEachGroup: function(callback, filter) {
this.get('groups').forEach(group => {
if (callback(group) !== false) {
group.forEachGroup(callback, includeDisabled);
group.forEachGroup(callback, filter);
}
});
},

View File

@ -107,11 +107,11 @@ var GroupModel = MenuItemModel.extend({
this.group.times.update();
},
forEachGroup: function(callback, includeDisabled) {
forEachGroup: function(callback, filter) {
var result = true;
this.get('items').forEach(group => {
if (includeDisabled || group.group.enableSearching !== false) {
result = callback(group) !== false && group.forEachGroup(callback, includeDisabled) !== false;
if (group.matches(filter)) {
result = callback(group) !== false && group.forEachGroup(callback, filter) !== false;
}
});
return result;
@ -125,6 +125,11 @@ var GroupModel = MenuItemModel.extend({
});
},
matches: function(filter) {
return (filter && filter.includeDisabled || this.group.enableSearching !== false) &&
(!filter || !filter.autoType || this.group.enableAutoType !== false);
},
getOwnSubGroups: function() {
return this.group.groups;
},

View File

@ -8,6 +8,7 @@ Release notes
`+` text fields context menu on desktop
`+` option to disable latest file removal
`-` fix #432: drag-drop in vivaldi
`-` fix auto-type enabled/disabled issues
##### v1.3.3 (2016-09-20)
`+` translations: fr, pl, pt