line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::Icons; |
2
|
1
|
|
|
1
|
|
1934
|
use Kwiki::Plugin -Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use mixin 'Kwiki::Installer'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
const class_id => 'icons'; |
6
|
|
|
|
|
|
|
const css_file => 'icons.css'; |
7
|
|
|
|
|
|
|
const config_file => 'icons.yaml'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub class_title { |
10
|
|
|
|
|
|
|
$self->usage; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub register { |
14
|
|
|
|
|
|
|
my $registry = shift; |
15
|
|
|
|
|
|
|
$registry->add(preload => 'icons'); |
16
|
|
|
|
|
|
|
$registry->add(preference => $self->use_icons); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init { |
20
|
|
|
|
|
|
|
super; |
21
|
|
|
|
|
|
|
if ($self->preferences->can('use_icons') and |
22
|
|
|
|
|
|
|
$self->preferences->use_icons->value) { |
23
|
|
|
|
|
|
|
$self->template->add_path($self->icons_path); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub use_icons { |
28
|
|
|
|
|
|
|
my $p = $self->new_preference('use_icons'); |
29
|
|
|
|
|
|
|
$p->query('Use icons in toolbar?'); |
30
|
|
|
|
|
|
|
$p->type('boolean'); |
31
|
|
|
|
|
|
|
$p->edit('correct_template_path'); |
32
|
|
|
|
|
|
|
$p->default(1); |
33
|
|
|
|
|
|
|
return $p; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub correct_template_path { |
37
|
|
|
|
|
|
|
my $pref = shift; |
38
|
|
|
|
|
|
|
if ($pref->new_value) { |
39
|
|
|
|
|
|
|
$self->template->add_path($self->icons_path); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
|
|
|
|
|
|
$self->template->remove_path($self->icons_path); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub icons_path { |
47
|
|
|
|
|
|
|
$self->usage; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub usage { |
51
|
|
|
|
|
|
|
die "Don't use Kwiki::Icons directly. Use a subclass of it."; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__DATA__ |