From 150a939cfe47d4f4b351f284367be73febc1a740 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 1 Oct 2009 11:32:21 +0000 Subject: (do_search) enable to disable use of regular expression (default is: disabled) --- NEWS | 2 ++ rpmdrake | 11 ++++++++++- rpmdrake.pm | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 43fa8eaa..cb996f40 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ o added dependencies section in package details panel (#39491) o enable to apply priority updates without trying to select any package + o search + * enable to disable use of regular expression (default is: disabled) Version 5.17 - 1 June 2009, Thierry Vignaud diff --git a/rpmdrake b/rpmdrake index 73d4879f..7f356d8b 100755 --- a/rpmdrake +++ b/rpmdrake @@ -56,6 +56,9 @@ my %elems; sub do_search($$$$$$$) { my ($find_entry, $tree, $tree_model, $options, $current_search_type, $urpm, $pkgs) = @_; my $entry = $find_entry->get_text or return; + if (!$use_regexp->[0]) { + $entry = quotemeta $entry; + } # remove leading/trailing spacing when pasting: if ($entry !~ /\S\s\S/) { # if spacing in middle, likely a string search in description @@ -523,6 +526,7 @@ sub run_treeview_dialog { my $auto_string = N("/_Options") . N("/_Select dependencies without asking"); my $noclean_string = N("/_Options") . "/" . N("Clear download cache after successfull install"); my $updates_string = N("/_Options") . N("/_Compute updates on startup"); + my $regexp_search_string = N("/_Options") . "/" . N("Use _regular expressions in searches"); my ($menu, $factory) = create_factory_menu( $w->{real_window}, [ N("/_File"), undef, undef, undef, '' ], @@ -566,9 +570,13 @@ sub run_treeview_dialog { [ N("/_Options") . N("/_Show automatically selected packages"), undef, sub { $dont_show_selections->[0] = !$checkbox_show_autoselect->get_active; }, undef, '' ], + [ $updates_string, undef, sub { $compute_updates->[0] = $check_boxes{$updates_string}->get_active; }, undef, '' ], + [ $regexp_search_string, undef, sub { + $use_regexp->[0] = $check_boxes{$regexp_search_string}->get_active; + }, undef, '' ], ), [ N("/_View"), undef, undef, undef, '' ], (map { @@ -618,7 +626,8 @@ sub run_treeview_dialog { %check_boxes = map { $_ => $factory->get_widget("
" . $get_path->($_)); - } ($auto_string, $noclean_string, $updates_string); + } ($auto_string, $noclean_string, $updates_string, $regexp_search_string); + $check_boxes{$regexp_search_string}->set_active($use_regexp->[0]); if (!$>) { $check_boxes{$auto_string}->set_active($::rpmdrake_options{auto}); $check_boxes{$updates_string}->set_active($compute_updates->[0]); diff --git a/rpmdrake.pm b/rpmdrake.pm index c593fe22..d8177885 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -60,6 +60,7 @@ our @EXPORT = qw( $rpmdrake_width $tree_flat $tree_mode + $use_regexp $typical_width add_distrib_update_media add_medium_and_check @@ -158,7 +159,7 @@ $ENV{HOME} = $> == 0 ? $root->[7] : $ENV{HOME} || '/root'; $ENV{HOME} = $::env if $::env = $Rpmdrake::init::rpmdrake_options{env}[0]; our $configfile = "$ENV{HOME}/.rpmdrake"; -our ($changelog_first_config, $compute_updates, $filter, $max_info_in_descr, $mode, $tree_flat, $tree_mode); +our ($changelog_first_config, $compute_updates, $filter, $max_info_in_descr, $mode, $tree_flat, $tree_mode, $use_regexp); our ($mandrakeupdate_wanted_categories, $ignore_debug_media, $offered_to_add_sources, $no_confirmation); our ($rpmdrake_height, $rpmdrake_width, $mandrivaupdate_height, $mandrivaupdate_width); our %config = ( @@ -178,6 +179,7 @@ our %config = ( rpmdrake_width => { var => \$rpmdrake_width, default => [ 0 ] }, tree_flat => { var => \$tree_flat, default => [ 0 ] }, tree_mode => { var => \$tree_mode, default => [ qw(gui_pkgs) ] }, + use_regexp => { var => \$use_regexp, default => [ 0 ] }, ); sub readconf() { -- cgit v1.2.1