"Fossies" - the Fresh Open Source Software Archive 
Member "namefix.pl/libs/gui/dialog.pm" (30 Jan 2010, 3180 Bytes) of package /linux/privat/old/namefix.pl_4.0.2.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "dialog.pm" see the
Fossies "Dox" file reference documentation.
1 use strict;
2 use warnings;
3 use File::stat;
4 use Time::localtime;
5
6 #--------------------------------------------------------------------------------------------------------------
7 # Show dialog
8 #--------------------------------------------------------------------------------------------------------------
9
10 # no plogging is this func will be called from plog at times
11 # also its a very simple funtion non related to renaming
12
13 sub show_dialog
14 {
15 my $title = shift;
16 my $text = shift;
17
18 if(!$text)
19 {
20 return 0;
21 }
22
23 my $row = 1;
24
25 my $top = $main::mw -> Toplevel();
26 $top -> title("$title");
27
28 my $txt = $top -> Scrolled
29 (
30 "ROText",
31 -scrollbars=>"osoe",
32 -wrap=>'none',
33 -font=>$main::dialog_font
34 )
35 -> grid
36 (
37 -row => $row++,
38 -column => 1,
39 -columnspan => 2
40 );
41
42 $txt->menu(undef);
43 $txt -> insert('end', "$text");
44
45 $top -> Button
46 (
47 -text=>"Close",
48 -activebackground => "white",
49 -command => sub
50 {
51 destroy $top;
52 }
53 )
54 -> grid
55 (
56 -row => $row++,
57 -column => 1,
58 -columnspan => 2
59 );
60
61 $top->resizable(0,0);
62 }
63
64 sub show_file_prop
65 {
66 my $title = "File Properties";
67 my $text = "";
68 my $ff = shift;
69
70 my $row = 1;
71
72 my $top = $main::mw -> Toplevel();
73 $top -> title("$title");
74
75 my $txt = $top -> Scrolled
76 (
77 "ROText",
78 -scrollbars=>"osoe",
79 -wrap=>'none',
80 -font=>$main::dialog_font,
81 -height=>5,
82 )
83 -> grid
84 (
85 -row => $row++,
86 -column => 1,
87 -columnspan => 2
88 );
89
90 $top -> Button
91 (
92 -text=>"Close",
93 -activebackground => "white",
94 -command => sub
95 {
96 destroy $top;
97 }
98 )
99 -> grid
100 (
101 -row => $row++,
102 -column => 1,
103 -columnspan => 2
104 );
105
106 # $top->resizable(0,0);
107
108
109 my $size = stat($ff)->size;
110 my $ff_date = ctime(stat($ff)->mtime);
111
112 my @txt =
113 (
114 "File: $ff",
115 "Size: $size",
116 "Date Created: $ff_date",
117 "",
118 );
119
120 my $txt_str = join("\n", @txt);
121
122 # display text last
123 $txt->menu(undef);
124 $txt -> insert('end', "$txt_str");
125
126
127 }
128
129
130 sub show_del_dialog
131 {
132 my $ff = shift;
133 my $top = $main::mw -> Toplevel();
134 my $ffl = (length $ff) + 2;
135
136 $top -> title("Confirm Delete");
137
138 my $txt = $top -> Scrolled
139 (
140 "ROText",
141 -scrollbars=>"osoe",
142 -wrap=>'none',
143 -font=>$main::dialog_font,
144 -height=>4,
145 -width=>$ffl
146 )
147 -> grid
148 (
149 -row => 1,
150 -column => 1,
151 -columnspan => 2
152 );
153
154 $txt->menu(undef);
155 $txt -> insert('end', "Do you want to delete\n\"$ff\"");
156
157 $top -> Button
158 (
159 -text=>"Yes",
160 -activebackground => "white",
161 -command => sub
162 {
163 unlink($ff);
164 &ls_dir;
165 destroy $top;
166
167 }
168 )
169 -> grid
170 (
171 -row => 2,
172 -column => 1,
173 );
174
175 $top -> Button
176 (
177 -text=>"No",
178 -activebackground => "white",
179 -command => sub
180 {
181 destroy $top;
182 }
183 )
184 -> grid
185 (
186 -row => 2,
187 -column => 2,
188 );
189 }
190
191
192
193 1;