summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakhelp
blob: 9d069ada8a40fefcec28a04d369eba65ee5d7480 (plain)
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
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);

use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use interactive;
use common;
use lang;
use any;

my $in = interactive->vnew;

my $lang = lang::lang2LANG(lang::read('',$>)) || 'en';
if (!member($lang, qw(de en es fr it ru))) { $lang = 'en' };
my $path_to_help = "/usr/share/doc/mandrake/" . $lang . "/";

-d $path_to_help or $in->ask_warn('drakhelp', N("Documentation not available. \n Please install package mandrake_doc-%s \n",$lang));

if ((my $wm = any::running_window_manager()) eq 'kwin') {
    system("mdklaunchhelp " . $path_to_help . $ARGV[0] . "&");
} else {
    on_request_help($path_to_help . $ARGV[0])
}

sub on_request_help {
    my ($link) = @_;
    my $browser = $ENV{BROWSER} || find { -x "/usr/bin/$_" } qw(mozilla konqueror galeon) or $in->ask_warn('drakhelp', N("No browser is installed on your system, Please install one if you want to browse the help system"));
    standalone::explanations("Connection to help system at $link");
    system("$browser $link &");
}