ec

 view release on metacpan or  search on metacpan

ec  view on Meta::CPAN

    if ($config->{usesig}) {
	$ct -> insert ('end', "\n$sigsep\n");
	$ct -> insert ('end', content_as_str($config->{sigfile}));
    }
    return $cw;
}

sub composemenu {
    my ($w) = @_;
    my $cm = $w -> Menu(-type => 'menubar');
    my $composefilemenu = $cm -> Menu;
    my $composeeditmenu = $cm -> Menu;
    my $composeattachmentsmenu = $cm -> Menu;
    my $composeattachmentfilesmenu = $cm -> Menu;
    $w -> Advertise ('composeattachmentfilesmenu' => 
		     $composeattachmentfilesmenu);
    my $optionalfieldsmenu = $cm -> Menu;
    $cm -> add('cascade', -label => 'File', -menu => $composefilemenu);
    $cm -> add('cascade', -label => 'Edit', -menu => $composeeditmenu);
    $cm -> add('cascade', -label => 'Attachments', 
	       -menu => $composeattachmentsmenu);
    $composefilemenu -> add('command', -label => 'Insert File...',
			    -accelerator => 'Alt-I',
			    -command => sub {InsertFileDialog($w)});
    $composefilemenu -> add ('separator');
    $composefilemenu -> add ('command', -label => 'Minimize', 
			    -state => 'normal',
			    -accelerator => 'Alt-Z',
			    -command => sub{$w->toplevel->iconify});
    $composefilemenu -> add ('command', -label => 'Close',
			     -accelerator => 'Alt-W',
			     -command => sub { $w -> WmDeleteWindow});
    EditMenuItems ($composeeditmenu, ($w -> Subwidget ('text')));
    $composeattachmentsmenu -> add ('command', -label => 'Attach File...',
	    -command => sub {compose_attachment_dialog($w)});
    $composeattachmentsmenu -> add ('cascade', 
		    -label => 'Remove Attachment...',
		    -menu => $composeattachmentfilesmenu);
    my $optionalfields = OptionalFields ($w -> Subwidget ('text'));
    $optionalfieldsmenu -> AddItems (@$optionalfields);
    $composeeditmenu -> add ('separator');
    $composeeditmenu -> add ('cascade',  -label => 'Insert Field',
			   -state => 'normal', 
			   -menu => $optionalfieldsmenu);
    return $cm;
}

sub OptionalFields {
    my ($t) = @_;
    return
	[
	 [command=>'Bcc:', -command=>sub{insertfield($t,$bccfield)}],
	 [command=>'Cc:', -command=>sub{insertfield($t,$ccfield)}],
	 [command=>'Fcc:', -command=>sub{insertfield($t,$fccfield)}],
	 [command=>'Reply-To:', -command=>sub{insertfield($t,$replytofield)}],
	 ]
}

sub standard_keybindings {
    my ($w) = @_;
    $w->bind ('<Alt-c>',sub{$w -> Subwidget ('text') -> clipboardCopy});
    $w->bind ('<Alt-x>',sub{$w -> Subwidget ('text') -> clipboardCut});
    $w->bind ('<Alt-v>',sub{$w -> Subwidget ('text') -> clipboardPaste});
    $w->bind ('<Alt-u>',sub{$w -> Subwidget ('text') -> undo});
    $w->bind ('<Alt-i>',sub{InsertFileDialog ($w)});
    $w->bind ('<Alt-w>',sub{$w -> WmDeleteWindow});
    $w->bind ('<Alt-z>',sub{$w -> toplevel -> iconify});
    $w->bind ('<Alt-a>',sub{selectallmessages ($w)});
    return $w;
}

sub insertfield {
  my ($t, $field) = @_;
  my ($point);
  $point = $t -> search ('--', $msgsep, '1.0', 'end');
  $t -> insert ($point, "$field \n", 'header');
}

sub composewidgets {
    my ($mw) = @_;
    my $b_org = 55;
    my $cw = new MainWindow (-title => "New Message");
    my $ct = $cw -> Scrolled ('TextUndo', -height => 24,
			      -scrollbars => 'osoe',
			      -background => 'white',
			      -wrap => 'word',
			      -width => 80);
    $ct -> Subwidget ('xscrollbar') -> configure (-width => 10);
    $ct -> Subwidget ('yscrollbar') -> configure (-width => 10);
    $cw -> Advertise ('text' => $ct);
    $ct -> tagConfigure ('header', '-font', $config->{headerfont})
	if defined $config -> {headerfont};
    my $menu = composemenu ($cw);
    $menu -> pack (-anchor => 'w', -fill => 'x');
    $ct -> pack (-expand => 1, -fill => 'both');
    my $c = $cw -> Canvas (-height => 40, -width => 600);
    $cw -> Advertise ('button_bar' => $c);
    my $servermsg = $c -> createText (500, 20, 
				      -text => 'Composing message.',
				      -justify => 'right');
    $cw -> Advertise ('servermsg' => $servermsg);
    my $sendbutton = $cw -> Button (-text => 'Send',
				   -width => 8,
				   -underline => 0,
				   -command => sub{ bind_sendmsg( $cw, $ct,
							  $c, $servermsg)});
    my $closebutton = $cw -> Button (-text => 'Cancel',
				  -width => 8,
				   -command => sub{$cw -> WmDeleteWindow});
    my $cdcanv = $c -> createWindow (55, 18, -window => $sendbutton);
    my $cncanv = $c -> createWindow ($b_org + $closebutton -> reqwidth, 
				     18, -window => $closebutton);
    $c -> pack(-expand => '1', -fill => 'x');
    $cw -> bind ('<Alt-s>',sub{bind_sendmsg( $cw, $ct, $c, $servermsg)});
    standard_keybindings ($cw);
    return $cw;
}

sub bind_sendmsg {
    sendmsg (@_);
    return 1;
}

ec  view on Meta::CPAN

sub self_help {
    my $helpwindow;
    my $textwidget;
    my $helpfile = inc_path ('EC/ec.help');
    $help_text = content_as_str ($helpfile);
    $help_text = "Unable to open help file $helpfile"
      if ! $help_text;
    $helpwindow = new MainWindow (-title => "EC Help");
    my $textframe = $helpwindow -> Frame(-container => 0,
					  -borderwidth => 1) -> pack;
    my $buttonframe = $helpwindow -> Frame (-container => 0,
					  -borderwidth => 1) -> pack;
    $textwidget = $textframe
	-> Scrolled ('Text', -scrollbars => 'e') -> 
			 pack(-fill => 'both', -expand => 1);
    $textwidget -> Subwidget ('yscrollbar') -> configure (-width=>10);
    $textwidget -> Subwidget ('xscrollbar') -> configure (-width=>10);
    $textwidget -> insert ('end', $help_text);

    my $b = $buttonframe -> Button (-text => 'Dismiss',
		    -default => 'active', 
		    -command => sub{$helpwindow -> DESTROY}) -> pack;
    $b -> focus;
}

sub sample {
    my( $f ) = @_;
    my $helpwindow;
    my $textwidget;
    my $filename;
    if ($f =~ /ecconfig/) {
	$filename = $cfgfilename;
    } else {
	return;
    }
    my $help_text = content_as_str ($filename);
    $helpwindow = new MainWindow (-title => "$filename");
    my $textframe = $helpwindow -> Frame (-container => 0,
					-borderwidth => 1) -> pack;
    my $buttonframe = $helpwindow -> Frame (-container => 0,
					  -borderwidth => 1) -> pack;
    $textwidget = $textframe
	-> Scrolled ('TextUndo', -scrollbars => 'e')
	    -> pack (-fill => 'both', -expand => 1);
    $textwidget -> Subwidget ('yscrollbar') -> configure (-width=>10);
    $textwidget -> Subwidget ('xscrollbar') -> configure (-width=>10);
    $textwidget -> insert ('end', $help_text);
    $buttonframe -> Button (-text => 'Dismiss',
			  -command => sub{$helpwindow -> DESTROY}) ->
			    pack;
}

sub EditMenuItems {
    my ($m,$w) = @_;
    $m -> add ('command', -label => 'Undo',
		-state => 'normal',
		-accelerator => 'Alt-U',
		-command => sub{$w -> undo});
    $m -> add ('separator');
    $m -> add ('command', -label => 'Cut', -state => 'normal',
	       -accelerator => 'Alt-X', -command => sub{$w -> clipboardCut});
    $m -> add ('command', -label => 'Copy', -accelerator => 'Alt-C',
	       -state => 'normal',-command => sub{$w -> clipboardCopy});
    $m -> add ('command', -label => 'Paste', -accelerator => 'Alt-V',
	       -state => 'normal', -command => sub{$w -> clipboardPaste});
    $m -> add ('command', -label => 'Select All',
	       -accelerator => 'Ctrl-/', -state => 'normal',
	       -command => sub{$w -> selectAll});
}

sub show_warn_dialog {
    my $mw = shift;
    my $ref = shift;
    if (not defined $ref) {
	$ref = $mw -> ECWarning (@_);
    } 
    $ref -> configure(@_) if $#_;
    return $ref -> Show (@_);
}

sub fileselect {
    my $mw = shift;
    my $ref = shift;
    if (not defined $ref) {
	$ref = $mw -> SimpleFileSelect (@_);
    }
    $ref -> configure (@_) if $#_;
    return $ref -> Show (@_);
}

sub InsertFileDialog {
    my ($w)=@_;
    my $l;
    my $t = $w -> Subwidget( 'text' );
    my $name = fileselect ($w, $insertfiledialog, 
			 -directory => $config->{maildir},
			 -acceptlabel => 'Insert' );
    watchcursor ($w);
    eval {
	if (defined($name) and length($name)) {
	    chomp $name;
	    $defaultuserdir = $name;
	    $defaultuserdir =~ s/(.*)\/.*?$/$1/;
	    $t -> insert( 'insert', content_as_str( $name ) );
	    return 1;
	}
    };
    defaultcursor ($w);
    return 0;
}

sub SaveFileAsDialog {
    my ($mw)=@_;
    my $text = $mw -> Subwidget ('text');
    my $msg = $text -> get ('1.0', 'end');
    my $name = fileselect ($mw, $savefiledialog,
			    -acceptlabel => 'Save');
    if (-f $name) {
	my $r = show_warn_dialog ($mw, $warndialog, 
           -message => "File $name already exists.  Overwrite it?");
	return 0 unless $r =~ /Ok/;
    }
    if (defined($name) and length($name)) {
	chomp $name;
	watchcursor ($mw);

ec  view on Meta::CPAN

additional configuration, ec routes mail to the F<Incoming> folder.
(Ec capitalizes the first letter of directory names when creating
folder names.)  The I<Folder> menu displays the number of unread and
total messages.  Ec can move messages from folder to folder, including
the F<Trash> folder, and also encode and decode Base64 MIME
attachments.

Ec permanently deletes messages stored in the F<Trash> folder after a
user configurable period of time (two days is the default).  Mail can
be undeleted by removing messages from the F<Trash> folder.  Refer to
the section, "Configuration Files," below.

=head1 USING EC

Ec displays two windows: a list to select messages for reading,
viewing, sorting, saving, and deleting, and a text window to compose
messages.

To view a message for reading, replying, or saving to a file, click
the left mouse button, button 1, on the message header in the list
window.

Moving and deleting also operates on multiple messages by clicking on
each message with the left mouse button, button 1, while pressing the
Control key.

=head2 Starting Ec

To start ec, type at the shell prompt in an B<xterm>:

   # ec

The program displays the main window with the F<Incoming> mail folder.
If the program displays an error message that it cannot connect to the
POP mail server, use the C<-v> command line option to produce a
transcript of the dialog with the server:

  # ec -v

You can select different mail folders from the I<Folder> menu, and
move messages from one folder to another by selecting the destination
folder from the I<Message - Move To> submenu.

The I<File - Browse URL> function pops up a dialog box with the URL
under the text cursor.  Clicking, "OK," opens the browser configured
in the F<.eccconfig> file, and loads the Web page.  If the browser is
already open or iconified, ec uses that browser window to view the
URL. Ec supports B<netscape> versions 4.5-4.7, B<amaya> version 2.4,
B<opera> version 5.0, and B<lynx> in an B<xterm>.  B<Lynx> may also
need its B<xterm> options defined in the F<.ecconfig> file.

The I<Attachments - Attach File...> option in the compose window
opens a window to select files.  I<Attachments - Remove Attachment>
displays a submenu of the message's file attachments.  Refer to the
section, "File Attachments," below.

There are a number of options for quoting messages when composing a
reply.  Refer to the F<.ecconfig> file for information about these
options.

Ec also uses the X clipboard to cut and paste between windows in ec as
well as windows in other applications.  For programs that do not have
I<Cut>, I<Copy>, or I<Paste> menu options, select text in the source
application's window by holding down the left mouse button and
dragging it across the text to highlight it, then changing to the
destination window and pressing the middle mouse button (or the left
and right buttons simultaneously on mice with only two buttons).

=head2 Sorting Messages

You can select whether to sort messages by Date (the default), the
sender, or the subject, either newest first or oldest first, by
selecting the sort field from the I<Options - Sort by> submenu and the
I<Options - Sort Order> submenu, and by clicking on the headings of
the message listing.

=head2 Entering Messages

The I<New> button below the message list and I<Message - Compose New
Message> menu item opens a composer window with a new message form
with header lines for the addressee, the subject, and the name of the
FCC (File Carbon Copy) file to save a copy of the message in.  If you
have a F<~/.signature> file (refer to the F<.ecconfig> file), ec
inserts the signature at the end of the message text.

Clicking the I<Reply> button, or selecting I<Message - Reply> from the
menu opens a compose window with the address and subject of the
original message filled in, and the message quoted in the text area.
There are several options which determine how ec fills in reply
addresses and quotes original messages.

Each message contains header information and body text, separated by a
boundary line:

  --- Enter the message text below this line. ---

This line must exist for ec to process the message, but it is not
included in the outgoing message.

Outgoing messages require at least a valid mail address to be entered
on the "To:" header line.

The I<Edit - Insert Field> submenu provides optional Cc: Bcc:, Fcc:
and Reply-to: headers fields.

Ec supports a limited form of address, "unfolding."  A To:, Cc:,
Reply-To:, or Bcc: line can contain more than one mail address.
Multiple addresses must be separated by commas.


=head2 File Attachments

Ec supports a subset of the Internet MIME specification which allows
files to be sent as attachments to messages.

To save a file that is attached to an incoming message, select the
file from the I<File - Attachments> menu.  Type the name of the file
to save the attachment to in the dialog box.

To attach files to outgoing messages, select the I<Attachments -
Attach File...> menu item in the compose window.  Then select the file



( run in 2.060 seconds using v1.01-cache-2.11-cpan-84e82930d8c )