-sub find_entries_simple {
- my $self = shift;
- my $text = shift;
- my $op = @_ && !is_ref($_[0]) ? shift : undef;
- my $fields = shift;
- is_arrayref($fields) or throw q{Usage: find_entries_simple($expression, [$op,] \@fields)};
- return $self->find_entries([\$text, $op, $fields], @_);
+ my $searching = $args{searching};
+ my $auto_type = $args{auto_type};
+ my $history = $args{history};
+
+ my $groups = $self->groups(%args);
+ my @entries;
+
+ return File::KDBX::Iterator->new(sub {
+ if (!@entries) {
+ while (my $group = $groups->next) {
+ next if $searching && !$group->effective_enable_searching;
+ next if $auto_type && !$group->effective_enable_auto_type;
+ @entries = @{$group->entries};
+ @entries = grep { $_->auto_type->{enabled} } @entries if $auto_type;
+ @entries = map { ($_, @{$_->history}) } @entries if $history;
+ return $group;
+ }
+ }
+ shift @entries;
+ });