From 46baa77f917281bdbe8570ff14ab0bc6a5f19371 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Mon, 21 Jul 2014 23:08:26 +0200 Subject: double click on a media allows to change its status (enable/disable) --- lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm') diff --git a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm index 10feb8d5..113c7791 100644 --- a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm +++ b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm @@ -1460,6 +1460,20 @@ sub mainwindow() { } $helpMenu{ widget }->rebuildMenuTree(); +# my %contextMenu = ( +# enable => N("Enable/Disable"), +# update => N("Check as updates"), +# ); +# @ordered_menu_lines = qw(enable update); +# my $itemColl = new yui::YItemCollection; +# foreach (@ordered_menu_lines) { +# # last if (!$::expert && $_ eq "update"); +# my $item = new yui::YMenuItem($contextMenu{$_}); +# $item->DISOWN(); +# $itemColl->push($item); +# } +# yui::YUI::app()->openContextMenu($itemColl) or die "Cannot create contextMenu"; + my $hbox_content = $factory->createHBox($vbox); my $leftContent = $factory->createLeft($hbox_content); $leftContent->setWeight($yui::YD_HORIZ,3); @@ -1675,6 +1689,23 @@ sub mainwindow() { } elsif ($widget == $mirrorTbl) { $selection_changed = 1; + # contextMenu in libyui does not work as expected let's enable/disable + # medium by double clicking on it + my $wEvent = yui::YMGAWidgetFactory::getYWidgetEvent($event); + if ($wEvent && $wEvent->reason() == $yui::YEvent::Activated) { + my $item = $mirrorTbl->selectedItem(); + if ($item) { + if (interactive_msg("rpmdragora", N("Do you want to change the status of %s?", $item->label()), + yesno => 1)) { + my $row = $item->index(); + $urpm->{media}[$row]{ignore} = !$urpm->{media}[$row]{ignore} || undef; + urpm::media::write_config($urpm); + $changed = 1; + } + } + + } + } } if ($changed) { -- cgit v1.2.1