aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-08-02 16:43:58 +0200
committerAngelo Naselli <anaselli@linux.it>2014-08-02 16:43:58 +0200
commit600ef5359a962b731c00cfdebb353cdeb75ddd65 (patch)
treef08824e808d0ca3e91bd952bffe6f6420fd7e719 /lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm
parent2c20be3482a8528b77aa22e9887397c37357636c (diff)
downloadmanatools-600ef5359a962b731c00cfdebb353cdeb75ddd65.tar
manatools-600ef5359a962b731c00cfdebb353cdeb75ddd65.tar.gz
manatools-600ef5359a962b731c00cfdebb353cdeb75ddd65.tar.bz2
manatools-600ef5359a962b731c00cfdebb353cdeb75ddd65.tar.xz
manatools-600ef5359a962b731c00cfdebb353cdeb75ddd65.zip
Added remove key function
Diffstat (limited to 'lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm')
-rw-r--r--lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm38
1 files changed, 35 insertions, 3 deletions
diff --git a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm
index 1cf8d909..308eb547 100644
--- a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm
+++ b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm
@@ -1249,7 +1249,7 @@ sub keys_callback() {
$keyTbl->setKeepSorting(1);
my ($current_medium, $current_medium_nb, @keys);
-
+
### internal subroutines
my $read_conf = sub {
$urpm->parse_pubkeys(root => $urpm->{root});
@@ -1261,9 +1261,10 @@ sub keys_callback() {
urpm::media::write_config($urpm);
$urpm = fast_open_urpmi_db();
$read_conf->();
-# $media_list->get_selection->signal_emit('changed');
};
+
$read_conf->();
+
my $key_name = sub {
exists $urpm->{keys}{$_[0]} ? $urpm->{keys}{$_[0]}{name}
: N("no name found, key doesn't exist in rpm keyring!");
@@ -1279,7 +1280,6 @@ sub keys_callback() {
yui::YUI::ui()->blockEvents();
$dialog->startMultipleChanges();
-
$keyTbl->deleteAllItems();
my $itemColl = new yui::YItemCollection;
foreach ( @{$keys[$current_medium_nb]} ) {
@@ -1311,6 +1311,7 @@ sub keys_callback() {
$key{$k} = $_;
push @list, $k;
}
+
my $choice = $sh_gui->ask_fromList({
title => N("Add a key"),
header => N("Choose a key to add to the medium %s", $current_medium),
@@ -1326,6 +1327,35 @@ sub keys_callback() {
return 0;
};
+ my $remove_key = sub {
+ my $sh_gui = AdminPanel::Shared::GUI->new();
+ my $keyItem = $keyTbl->selectedItem();
+ my $mediaItem = $mediaTbl->selectedItem();
+ if ($keyItem && $mediaItem) {
+ $current_medium = $mediaItem->label();
+ $current_medium_nb = $mediaItem->index();
+ my $current_key = $keyItem->label();
+ my $current_keyVal = yui::toYTableItem($keyItem)->cell(0)->label();
+ my $choice = $sh_gui->ask_YesOrNo({
+ title => N("Remove a key"),
+ text => N("Are you sure you want to remove the key <br>%s<br> from medium %s?<br>(name of the key: %s)",
+ $current_keyVal, $current_medium, $current_key
+ ),
+ richtext => 1,
+ });
+ if ($choice) {
+ $urpm->{media}[$current_medium_nb]{'key-ids'} = join(',',
+ difference2(\@{$keys[$current_medium_nb]}, [ $current_key ])
+ );
+ $write->();
+ return 1;
+ }
+ }
+
+ return 0;
+
+ };
+
#### end subroutines
$sel_changed->();
@@ -1369,6 +1399,8 @@ sub keys_callback() {
$sel_changed->() if $changed;
}
elsif ($widget == $remButton) {
+ $changed = $remove_key->();
+ $sel_changed->() if $changed;
}
elsif ($widget == $mediaTbl) {
$sel_changed->();