~ubuntu-branches/ubuntu/maverick/padre/maverick

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package Padre::Wx::Dialog::Preferences::File;

use 5.008;
use strict;
use warnings;

use Padre::Wx::Dialog::Preferences ();

our $VERSION = '0.63';
our @ISA     = 'Padre::Wx::Dialog::Preferences';

=pod

=head1 NAME

Padre::Wx::Dialog::Preferences::File - Preferences for Padre::File modules

=head1 DESCRIPTION

This modules provides preference options for the Padre::File - modules.

It uses the Padre preferences panel.

=cut

sub panel {
	my $self     = shift;
	my $treebook = shift;
	my $parent   = shift;

	my $config = Padre->ide->config;

	my $table = [

		# Padre::File::HTTP
		[   [ 'Wx::StaticText', undef, Wx::gettext('File access via HTTP') ],
			[]
		],
		[   [ 'Wx::StaticText', undef, Wx::gettext('Timeout (in seconds):') ],
			[ 'Wx::SpinCtrl', 'file_http_timeout', $config->file_http_timeout, 10, 900 ]
		],

		# Padre::File::FTP
		[   [ 'Wx::StaticText', undef, Wx::gettext('File access via FTP') ],
			[]
		],
		[   [ 'Wx::StaticText', undef, Wx::gettext('Timeout (in seconds):') ],
			[ 'Wx::SpinCtrl', 'file_ftp_timeout', $config->file_ftp_timeout, 10, 900 ]
		],
		[   [   'Wx::CheckBox', 'file_ftp_passive', ( $config->file_ftp_passive ? 1 : 0 ),
				Wx::gettext('Use FTP passive mode')
			],
			[]
		],

		#		[   [ 'Wx::StaticText', undef,     Wx::gettext('Sample text input:') ],
		#			[ 'Wx::TextCtrl',   'text_sample', $config->text_sample ]
		#		],
	];

	my $panel = $self->_new_panel($treebook);
	$parent->fill_panel_by_table( $panel, $table );

	return $panel;
}

sub save {
	my $self = shift;
	my $data = shift;

	my $config = Padre->ide->config;

	# Padre::File::HTTP

	$config->set(
		'file_http_timeout',
		$data->{file_http_timeout}
	);

	# Padre::File::FTP

	$config->set(
		'file_ftp_timeout',
		$data->{file_ftp_timeout}
	);

	$config->set(
		'file_ftp_passive',
		$data->{file_ftp_passive}
	);

}



1;
__END__

=pod

=head1 NEW OPTIONS

Adding new options is done in three steps:

=over

=item 1.

Add a C<setting()> call for the new option to F<Config.pm>

=item 2.

Add the GUI part to the C<panel> method

=item 3.

Save the new value within the C<save> method

=back

=head1 COPYRIGHT & LICENSE

Copyright 2008-2010 The Padre development team as listed in Padre.pm.

This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the
LICENSE file included with this module.

=cut

# Copyright 2008-2010 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.