JaM
view release on metacpan or search on metacpan
lib/JaM/GUI/Mail.pm view on Meta::CPAN
$sw->set_policy('automatic', 'automatic');
my $html = JaM::GUI::HTMLSurface->new (
image_dir => "/tmp",
button3_callback => sub { $self->popup_menu(@_) },
mail_link_callback => sub { $self->open_mail_link_window ( @_ ) }
);
my $widget = $html->widget;
$sw->show;
$sw->add($widget);
# Add a handler to put a message in the html widget when it is realized
$self->gtk_mail_html ($widget);
$self->gtk_mail_html_object ($html);
$self->widget ($sw);
# build popup menu for right click
my $item;
my $popup = $self->gtk_popup (Gtk::Menu->new);
$item = Gtk::MenuItem->new ("Show only common header fields");
$popup->append($item);
$item->signal_connect ("activate", sub { $self->cb_show_all_header(0) } );
$item->show;
$item = Gtk::MenuItem->new ("Show complete header");
$popup->append($item);
$item->signal_connect ("activate", sub { $self->cb_show_all_header(1) } );
$item->show;
return $self;
}
sub show {
my $self = shift;
my %par = @_;
my ($mail_id) = @par{'mail_id'};
$self->clear;
my $html = $self->gtk_mail_html_object;
$html->widget->freeze;
if ( not $mail_id ) {
$html->begin;
$html->end;
$html->widget->thaw;
$self->mail(undef);
return;
}
my $mail = JaM::Mail->load (
dbh => $self->dbh,
mail_id => $mail_id,
);
$self->mail ($mail);
$html->begin (
charset => $self->mail->head->mime_attr('content-type.charset')
);
# first print the header
$self->print_entity_head (
entity => $mail,
widget => $html,
);
# print primary body, if given
if ( $mail->body ) {
if ( $mail->content_type eq 'text/html' ) {
$self->put_mail_text (
widget => $html,
data => "\nWARNING: FILTERED HTML MAIL!!!\n\n".
$self->html_filter($mail->body->as_string),
wrap_length => $self->config('wrap_line_length_show'),
);
} else {
$self->put_mail_text (
widget => $html,
data => $mail->body->as_string,
wrap_length => $self->config('wrap_line_length_show'),
);
}
}
# print child entitities
$self->print_child_entities (
first_time => 1,
widget => $html,
entity => $mail,
wrap_length => $self->config('wrap_line_length_show'),
);
$html->end;
$html->widget->thaw;
$mail->status ( 'R' ) if not $self->no_status_change_on_show;
1;
}
sub clear {
my $self = shift;
my $html = $self->gtk_mail_html_object;
$html->begin;
$html->end;
$self->mail(undef);
1;
}
sub move_to_folder {
my $self = shift;
my %par = @_;
my ($mail, $mail_ids, $folder_object) = @par{'mail','mail_ids','folder_object'};
if ( not $mail_ids and not $mail ) {
$mail ||= $self->mail;
}
( run in 0.341 second using v1.01-cache-2.11-cpan-d7f47b0818f )