From db7cd49a868a49e46e35190f4ed73a197c8b892a Mon Sep 17 00:00:00 2001 From: Matteo Pasotti Date: Sat, 25 Jan 2014 00:27:31 +0100 Subject: asking confirmation before dropping the selected host; writing changes when pressing the ok button --- AdminPanel/Hosts/GHosts.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/AdminPanel/Hosts/GHosts.pm b/AdminPanel/Hosts/GHosts.pm index 91959297..d55daaf1 100644 --- a/AdminPanel/Hosts/GHosts.pm +++ b/AdminPanel/Hosts/GHosts.pm @@ -28,7 +28,7 @@ use utf8; use Glib; use yui; -#use AdminPanel::Shared; +use AdminPanel::Shared; use AdminPanel::Hosts::hosts; =head1 VERSION @@ -174,7 +174,6 @@ sub setupTable { $tblItem = new yui::YTableItem($host->{'ip'},$host->{'hosts'}[0],$aliases); $self->table->addItem($tblItem); } - } sub manageHostsDialog { @@ -256,6 +255,15 @@ sub manageHostsDialog { } elsif ($widget == $remButton) { # implement deletion dialog + if(AdminPanel::Shared::ask_YesOrNo("Confirmation","Are you sure to drop this host?") == 1){ + my $tblItem = yui::toYTableItem($self->table->selectedItem()); + # drop the host using the ip + $self->cfgHosts->_dropHost($tblItem->cell(0)->label()); + } + }elsif ($widget == $okButton) { + # write changes + $self->cfgHosts->_writeHosts(); + last; } } } -- cgit v1.2.1