From bd52d8fa9689c8e8dd164618bfe489a003037866 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Fri, 1 Jan 2016 16:41:57 +0100 Subject: Restored Icon and Title behaviour or they were missed in mpan, using Shared::GUI::Dialog solves this problem --- lib/ManaTools/MainDisplay.pm | 10 ++++------ lib/ManaTools/Module/DisplayManager.pm | 6 ++++++ lib/ManaTools/Module/Firewall.pm | 13 +++++++++++++ lib/ManaTools/Module/Hosts.pm | 5 +++++ lib/ManaTools/Module/LogViewer.pm | 6 ++++++ lib/ManaTools/Module/Proxy.pm | 6 ++++++ lib/ManaTools/Module/Services.pm | 6 ++++++ lib/ManaTools/Module/Users.pm | 9 +++++---- lib/ManaTools/Shared/GUI/Dialog.pm | 5 ++++- 9 files changed, 55 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/ManaTools/MainDisplay.pm b/lib/ManaTools/MainDisplay.pm index ca986c97..1c35a99b 100644 --- a/lib/ManaTools/MainDisplay.pm +++ b/lib/ManaTools/MainDisplay.pm @@ -379,19 +379,17 @@ sub _setupGui { # fill $self->settings from settings.conf $self->_loadSettings(); + $DB::single = 1; $self->title($self->settings()->{title}); yui::YUI::app()->setApplicationTitle($self->title); - my $icon = defined($self->settings()->{icon}) ? - $self->settings()->{icon} : - $self->icon(); - - yui::YUI::app()->setApplicationIcon($icon); + $self->icon($self->settings()->{icon}) if $self->settings()->{icon}; + yui::YUI::app()->setApplicationIcon($self->icon); my $dialog = ManaTools::Shared::GUI::Dialog->new( module => $self, dialogType => ManaTools::Shared::GUI::Dialog::mainDialog, title => $self->title(), - icon => $icon, + icon => $self->icon, buttons => { ManaTools::Shared::GUI::Dialog::aboutButton => sub { my $event = shift; ## ManaTools::Shared::GUI::Event diff --git a/lib/ManaTools/Module/DisplayManager.pm b/lib/ManaTools/Module/DisplayManager.pm index b2f4338a..701e0941 100644 --- a/lib/ManaTools/Module/DisplayManager.pm +++ b/lib/ManaTools/Module/DisplayManager.pm @@ -180,6 +180,12 @@ sub _manageProxyDialog { ## set new title to get it in dialog my $newTitle = $self->loc->N("Display Manager"); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($newTitle); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon()); + my $factory = yui::YUI::widgetFactory; my $optional = yui::YUI::optionalWidgetFactory; diff --git a/lib/ManaTools/Module/Firewall.pm b/lib/ManaTools/Module/Firewall.pm index a5081a82..a5407e59 100644 --- a/lib/ManaTools/Module/Firewall.pm +++ b/lib/ManaTools/Module/Firewall.pm @@ -518,6 +518,12 @@ sub ask_WatchedServices { ## set new title to get it in dialog yui::YUI::app()->setApplicationTitle($dlg_data->{title}); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($dlg_data->{title}); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($dlg_data->{icon}); + my $factory = yui::YUI::widgetFactory; my $optional = yui::YUI::optionalWidgetFactory; @@ -722,6 +728,13 @@ sub ask_AllowedServices { $self->dialog($factory->createMainDialog()); my $layout = $factory->createVBox($self->dialog); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($dlg_data->{title}); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($dlg_data->{icon}); + + my $hbox_header = $factory->createHBox($layout); my $headLeft = $factory->createHBox($factory->createLeft($hbox_header)); my $headRight = $factory->createHBox($factory->createRight($hbox_header)); diff --git a/lib/ManaTools/Module/Hosts.pm b/lib/ManaTools/Module/Hosts.pm index 47a2bc1d..131542ee 100644 --- a/lib/ManaTools/Module/Hosts.pm +++ b/lib/ManaTools/Module/Hosts.pm @@ -399,6 +399,11 @@ sub _manageHostsDialog { my $factory = yui::YUI::widgetFactory; my $optional = yui::YUI::optionalWidgetFactory; +## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($self->name()); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon()); $self->dialog($factory->createMainDialog()); my $layout = $factory->createVBox($self->dialog); diff --git a/lib/ManaTools/Module/LogViewer.pm b/lib/ManaTools/Module/LogViewer.pm index 9b74c44c..bc845fe4 100644 --- a/lib/ManaTools/Module/LogViewer.pm +++ b/lib/ManaTools/Module/LogViewer.pm @@ -141,6 +141,12 @@ sub _logViewerPanel { my $appTitle = yui::YUI::app()->applicationTitle(); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($self->name()); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon()); + my $factory = yui::YUI::widgetFactory; my $optFactory = yui::YUI::optionalWidgetFactory; diff --git a/lib/ManaTools/Module/Proxy.pm b/lib/ManaTools/Module/Proxy.pm index edacbcec..277e096f 100644 --- a/lib/ManaTools/Module/Proxy.pm +++ b/lib/ManaTools/Module/Proxy.pm @@ -234,6 +234,12 @@ sub _manageProxyDialog { ## set new title to get it in dialog my $newTitle = $self->loc->N("Proxies configuration"); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($self->name()); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon()); + my $factory = yui::YUI::widgetFactory; my $optional = yui::YUI::optionalWidgetFactory; diff --git a/lib/ManaTools/Module/Services.pm b/lib/ManaTools/Module/Services.pm index 700ee285..ca41582c 100644 --- a/lib/ManaTools/Module/Services.pm +++ b/lib/ManaTools/Module/Services.pm @@ -342,6 +342,12 @@ sub _servicePanel { my $appTitle = yui::YUI::app()->applicationTitle(); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($self->name()); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon()); + my $mageiaPlugin = "mga"; my $factory = yui::YUI::widgetFactory; my $mgaFactory = yui::YExternalWidgets::externalWidgetFactory($mageiaPlugin); diff --git a/lib/ManaTools/Module/Users.pm b/lib/ManaTools/Module/Users.pm index 85cf6074..81b6108c 100644 --- a/lib/ManaTools/Module/Users.pm +++ b/lib/ManaTools/Module/Users.pm @@ -2433,10 +2433,11 @@ sub _manageUsersDialog { ## push application title my $appTitle = yui::YUI::app()->applicationTitle(); -# ## set new title to get it in dialog -# yui::YUI::app()->setApplicationTitle($self->name); -# ## set icon if not already set by external launcher -# yui::YUI::app()->setApplicationIcon($self->icon); + ## TODO remove title and icon when using Shared::Module::GUI::Dialog + ## set new title to get it in dialog + yui::YUI::app()->setApplicationTitle($self->name()); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon()); my $factory = yui::YUI::widgetFactory; diff --git a/lib/ManaTools/Shared/GUI/Dialog.pm b/lib/ManaTools/Shared/GUI/Dialog.pm index 76095360..62f4b6ee 100644 --- a/lib/ManaTools/Shared/GUI/Dialog.pm +++ b/lib/ManaTools/Shared/GUI/Dialog.pm @@ -454,6 +454,7 @@ sub addButtons { sub call { my $self = shift; my $oldAppTitle = yui::YUI::app()->applicationTitle(); + my $oldAppIcon = yui::YUI::app()->applicationIcon(); ## set new title to get it in dialog yui::YUI::app()->setApplicationTitle($self->title()); @@ -502,8 +503,10 @@ sub call { # end dialog $ydialog->destroy(); - #restore old application title + # restore old application title and icon yui::YUI::app()->setApplicationTitle($oldAppTitle) if $oldAppTitle; + yui::YUI::app()->setApplicationIcon($self->icon()) if $oldAppIcon; + return $result; } -- cgit v1.2.1