aboutsummaryrefslogtreecommitdiffstats
path: root/modules/logviewer
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@mageia.org>2013-01-04 00:14:13 +0000
committerAngelo Naselli <anaselli@mageia.org>2013-01-04 00:14:13 +0000
commita6460817c21c30c85bcf57db4cf8988f174ee82f (patch)
treef10291bb1904b2dd5079384c11fe30c7c0d4ca71 /modules/logviewer
parent3b984aed39e86b00bf7bd7c2e6ed9d6911f5e97b (diff)
downloadmanatools-a6460817c21c30c85bcf57db4cf8988f174ee82f.tar
manatools-a6460817c21c30c85bcf57db4cf8988f174ee82f.tar.gz
manatools-a6460817c21c30c85bcf57db4cf8988f174ee82f.tar.bz2
manatools-a6460817c21c30c85bcf57db4cf8988f174ee82f.tar.xz
manatools-a6460817c21c30c85bcf57db4cf8988f174ee82f.zip
added some usefull routines (NOTE they must be moved soon to a common place to be used by other modules)
Diffstat (limited to 'modules/logviewer')
-rwxr-xr-xmodules/logviewer/logviewer.pl122
1 files changed, 117 insertions, 5 deletions
diff --git a/modules/logviewer/logviewer.pl b/modules/logviewer/logviewer.pl
index 18d3a748..4bbfb9c1 100755
--- a/modules/logviewer/logviewer.pl
+++ b/modules/logviewer/logviewer.pl
@@ -229,11 +229,11 @@ while(1) {
# unblock file chooser frame notification
$fileChooserFrame->setNotify(1);
}
- elsif ($widget == $mailALertButton) {
- alert_config();
- }
+ elsif ($widget == $mailALertButton) {
+ alert_config();
+ }
else {
- print "Unmanaged WidgetEvent\n";
+ warningMsgBox(N("Unmanaged WidgetEvent"));
}
}
}
@@ -422,10 +422,122 @@ sub quit() {
## alert config call back
sub alert_config() {
## TODO
- print "To be implemented yet \n";
+ infoMsgBox(N("To be implemented yet"));
return;
}
+
+### Begin interactive functions ###
+# NOTE next routines (from BEGIN to END) have to be moved to a package and
+# factory got by using yui::YUI::widgetFactory
+
+sub warningMsgBox() {
+ my ($st) = @_;
+ my $msg_box = $factory->createPopupDialog($yui::YDialogWarnColor);
+ my $layout = $factory->createVBox($msg_box);
+ my $align = $factory->createAlignment($layout, 3, 0);
+ $factory->createLabel( $align, $st, 1, 0);
+ $align = $factory->createAlignment($layout, 3, 0);
+ $factory->createPushButton($align, N("Ok"));
+ $msg_box->waitForEvent();
+
+ destroy $msg_box;
+}
+
+sub infoMsgBox() {
+ my ($st) = @_;
+ my $msg_box = $factory->createPopupDialog($yui::YDialogInfoColor);
+ my $layout = $factory->createVBox($msg_box);
+ my $align = $factory->createAlignment($layout, 3, 0);
+ $factory->createLabel( $align, $st, 1, 0);
+ $align = $factory->createAlignment($layout, 3, 0);
+ $factory->createPushButton($align, N("Ok"));
+ $msg_box->waitForEvent();
+
+ destroy $msg_box;
+}
+
+sub msgBox() {
+ my ($st) = @_;
+ my $msg_box = $factory->createPopupDialog($yui::YDialogNormalColor);
+ my $layout = $factory->createVBox($msg_box);
+ my $align = $factory->createAlignment($layout, 3, 0);
+ $factory->createLabel( $align, $st, 1, 0);
+ $align = $factory->createAlignment($layout, 3, 0);
+ $factory->createPushButton($align, N("Ok"));
+ $msg_box->waitForEvent();
+
+ destroy $msg_box;
+}
+
+sub ask_OkCancel() {
+ my ($title, $text) = @_;
+ my $retVal = 0;
+
+ my $msg_box = $factory->createPopupDialog($yui::YDialogNormalColor);
+ my $layout = $factory->createVBox($msg_box);
+
+ my $align = $factory->createAlignment($layout, 3, 0);
+ ## title with headings true
+ $factory->createLabel( $align, $title, 1, 0);
+ my $align = $factory->createLeft($layout);
+ $factory->createLabel( $align, $text, 0, 0);
+
+ $align = $factory->createRight($layout);
+ my $hbox = $factory->createHBox($align);
+ my $okButton = $factory->createPushButton($hbox, N("Ok"));
+ my $cancelButton = $factory->createPushButton($hbox, N("Cancel"));
+
+ my $event = $msg_box->waitForEvent();
+
+ my $eventType = $event->eventType();
+
+ if ($eventType == $yui::YEvent::WidgetEvent) {
+ # widget selected
+ my $widget = $event->widget();
+ $retVal = ($widget == $okButton);
+ }
+
+ destroy $msg_box;
+
+ return $retVal;
+}
+
+sub ask_YesOrNo() {
+ my ($title, $text) = @_;
+ my $retVal = "No";
+
+ my $msg_box = $factory->createPopupDialog($yui::YDialogNormalColor);
+ my $layout = $factory->createVBox($msg_box);
+
+ my $align = $factory->createAlignment($layout, 3, 0);
+ ## title with headings true
+ $factory->createLabel( $align, $title, 1, 0);
+ my $align = $factory->createLeft($layout);
+ $factory->createLabel( $align, $text, 0, 0);
+
+ $align = $factory->createRight($layout);
+ my $hbox = $factory->createHBox($align);
+ my $yesButton = $factory->createPushButton($hbox, N("Yes"));
+ my $noButton = $factory->createPushButton($hbox, N("No"));
+
+ my $event = $msg_box->waitForEvent();
+
+ my $eventType = $event->eventType();
+
+ if ($eventType == $yui::YEvent::WidgetEvent) {
+ # widget selected
+ my $widget = $event->widget();
+ $retVal = ($widget == $yesButton) ? "Yes" : "No";
+ }
+
+ destroy $msg_box;
+
+ return $retVal;
+}
+
+### END interactive functions ###
+
### NOTE next code has to be removed after getting mail alert functionality
=comment