aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/AdminPanel/Rpmdragora/gui.pm31
-rw-r--r--lib/AdminPanel/rpmdragora.pm12
-rwxr-xr-xmodules/rpmdragora/rpmdragora57
3 files changed, 37 insertions, 63 deletions
diff --git a/lib/AdminPanel/Rpmdragora/gui.pm b/lib/AdminPanel/Rpmdragora/gui.pm
index 02ecac2..f8fc396 100644
--- a/lib/AdminPanel/Rpmdragora/gui.pm
+++ b/lib/AdminPanel/Rpmdragora/gui.pm
@@ -656,7 +656,7 @@ sub add_tree_item {
=item B<$pkg_name>: package name
-=item B<$root>: string containing a path-like sequence (e.g. "foo|bar")
+=item B<$select>: select given package
=head3 DESCRIPTION
@@ -666,7 +666,7 @@ sub add_tree_item {
#=============================================================
sub add_package_item {
- my ($item_list, $pkg_name, $root) = @_;
+ my ($item_list, $pkg_name, $select) = @_;
return if !$pkg_name;
@@ -683,7 +683,6 @@ sub add_package_item {
$release = "" if !defined($release);
$arch = "" if !defined($arch);
-# TODO FIXME summary is not visible in necurses (adding a new column as in dragoraUpdate)
my $newTableItem = new yui::YCBTableItem(
$name,
get_summary($pkg_name),
@@ -692,15 +691,16 @@ sub add_package_item {
$arch
);
+ $newTableItem->setSelected($select);
+
set_node_state($newTableItem, $state);
-# TODO FIXME evaluate if $ptree is really needed.
$item_list->push($newTableItem);
$newTableItem->DISOWN();
}
else {
- warn $pkg_name . " is not a leaf package and that is not managed!";
+ carp $pkg_name . " is not a leaf package and that is not managed!";
}
}
@@ -938,14 +938,16 @@ sub fast_toggle {
interactive_msg($loc->N("Warning"), '<b>' . $loc->N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n");
}
# toggle_nodes($w->{tree}->window, $w->{detail_list_model}, \&set_leaf_state, $w->{detail_list_model}->get($iter, $pkg_columns{state}),
- my $state;
-#pasmatt checked should be to install no?
- if($item->checked()){
- $state = "to_install";
- }else{
- $state = "to_remove";
- }
- toggle_nodes($w->{tree}, $w->{detail_list}, \&set_leaf_state, $state, $name);
+ my $val = $pkgs->{$name}{selected};
+ my $old_status = $val ? 'to_install' : 'to_update';
+
+# my $old_state;
+# if($item->checked()){
+# $old_state = "to_install";
+# }else{
+# $old_state = "to_remove";
+# }
+ toggle_nodes($w->{tree}, $w->{detail_list}, \&set_leaf_state, $old_status, $name);
update_size($common);
};
@@ -1000,6 +1002,7 @@ sub ask_browse_tree_given_widgets_for_rpmdragora {
yui::YUI::app()->busyCursor();
$DB::single = 1;
+ my $lastItem = $w->{detail_list}->selectedItem() ? $w->{detail_list}->selectedItem()->label() : "";
$w->{detail_list}->startMultipleChanges();
$w->{detail_list}->deleteAllItems();
my $itemColl = new yui::YItemCollection;
@@ -1007,7 +1010,7 @@ sub ask_browse_tree_given_widgets_for_rpmdragora {
@table_item_list = ();
my $index = 0;
foreach(@nodes){
- add_package_item($itemColl, $_->[0], $_->[1]);
+ add_package_item($itemColl, $_->[0], ($lastItem eq $_->[0]));
warn "Unmanaged param " . $_->[2] if defined $_->[2];
$ptree{$_->[0]} = [ $index ];
$index++;
diff --git a/lib/AdminPanel/rpmdragora.pm b/lib/AdminPanel/rpmdragora.pm
index 3ae4f31..0cf9265 100644
--- a/lib/AdminPanel/rpmdragora.pm
+++ b/lib/AdminPanel/rpmdragora.pm
@@ -341,10 +341,15 @@ sub interactive_list {
my $mainw = $factory->createPopupDialog();
my $vbox = $factory->createVBox($mainw);
my $lbltitle = $factory->createLabel($vbox, $loc->N("Dependencies"));
- my $radiobuttongroup = $factory->createRadioButtonGroup($vbox);
+ my $left = $factory->createLeft($factory->createHBox($vbox));
+ my $radiobuttongroup = $factory->createRadioButtonGroup($left);
my $rbbox = $factory->createVBox($radiobuttongroup);
- foreach my $item(@$list){
+ foreach my $item (@$list) {
my $radiobutton = $factory->createRadioButton($rbbox,$item);
+ if ($item eq $list->[0]) {
+ # select first by default
+ $radiobutton->setValue(1);
+ }
$radiobutton->setNotify(0);
$radiobuttongroup->addRadioButton($radiobutton);
}
@@ -364,7 +369,8 @@ sub interactive_list {
my $widget = $event->widget();
if($widget == $submitButton) {
- $choice = $radiobuttongroup->currentButton->label();
+ # NOTE if for any reason radio button is not checked let's take the first package
+ $choice = $radiobuttongroup->currentButton() ? $radiobuttongroup->currentButton()->label() : $list->[0];
$choice =~s/\&//g;
last;
}
diff --git a/modules/rpmdragora/rpmdragora b/modules/rpmdragora/rpmdragora
index 71499e3..9a91a7f 100755
--- a/modules/rpmdragora/rpmdragora
+++ b/modules/rpmdragora/rpmdragora
@@ -161,51 +161,9 @@ sub detaillist_changeditem_callback {
my $changedItem = $detail_list->changedItem();
return if (!$changedItem);
- # handles installist and droplist
- my $index=0;
- if ($changedItem->checked()) {
- # to be installed if not in to be removed list
- my $found = 0;
- foreach $index (0 .. scalar(@itemsToBeRemoved) -1) {
- my $currItem = $itemsToBeRemoved[$index];
-#pasmatt why? changedItem is YCBTableItem now so it's what you're looking for
-# if(ref $currItem eq "yui::YCBTableItem") {
- if ($currItem->label() eq $changedItem->label()) {
- $found = 1;
- splice (@itemsToBeRemoved, $index ,1);
- last;
- }
-# }
- }
- if ($found == 0) {
- push(@itemsToBeInstalled, $changedItem);
- # $pkgs->{$options->{table_item_list}[$changedItem->index()]}{selected} = 1;
- # toggle_veloce($options->{table_item_list}[$changedItem->index()],"to_install");
- fast_toggle($changedItem);
- }
- }
- else {
- # to be removed if not in to be installed list
- my $found = 0;
- foreach $index (0 .. scalar(@itemsToBeInstalled)-1) {
- my $currItem = $itemsToBeInstalled[$index];
-# if(ref $currItem eq "yui::YCBTableItem") {
- if ($currItem->label() eq $changedItem->label()) {
- $found = 1;
- splice (@itemsToBeInstalled, $index ,1);
- last;
- }
-# }
- }
- if ($found == 0) {
- push(@itemsToBeRemoved, $changedItem);
- # $pkgs->{$options->{table_item_list}[$changedItem->index()]}{selected} = 0;
- # toggle_veloce($options->{table_item_list}[$changedItem->index()],"to_remove");
- fast_toggle($changedItem);
- }
- }
- print "itemsToBeRemoved counts ".scalar(@itemsToBeRemoved)." items\n";
- print "itemsToBeInstalled counts ".scalar(@itemsToBeInstalled)." items\n";
+ fast_toggle($changedItem);
+
+ return;
}
sub detaillist_callback {
@@ -1219,8 +1177,15 @@ sub run_treeview_dialog {
}
elsif ($widget == $detail_list){
$info_options = {};
+ my $wEvent = yui::toYWidgetEvent($event);
+
+ if ($wEvent->reason() == $yui::YEvent::ValueChanged) {
+ yui::YUI::app()->busyCursor();
+ detaillist_changeditem_callback($detail_list, \%$options);
+ yui::YUI::app()->normalCursor();
+ tree_callback($tree->currentItem(),\%$options);
+ }
detaillist_callback($detail_list->selectedItem(), $info, \%$options);
- detaillist_changeditem_callback($detail_list, \%$options);
}
elsif ($widget == $QuitButton) {
quit();