summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakhelp
blob: a7a0088dae6d98e75822a8a8867a8133193df1cd (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

use strict;
use diagnostics;

use lib qw(/usr/lib/libDrakX);
use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use interactive;
use common;
use any;
use ctxhelp;
use log;


sub usage {
    print STDERR N(" drakhelp 0.1
Copyright (C) 2003 MandrakeSoft.
This is free software and may be redistributed under the terms of the GNU GPL.

Usage: 
") . N(" --help                - display this help     
") . N(" --id <id_label>       - load the html help page which refers to id_label
");
    exit(0)
}
my ($opt, $idlabel) = @ARGV;
@ARGV == 2 && ($opt eq '--id' || $opt eq '--help') or usage();

my $in = interactive->vnew;
my ($lg, $instpath, $ancpath) = ctxhelp::path2help($idlabel);

-e $instpath or $in->do_pkgs->install('mandrake_doc-drakxtools-' . $lg);
-e $instpath or $in->ask_warn('Mandrake Help Center', N("%s cannot be displayed \n. No Help entry of this type\n", $instpath));

my $wm = any::running_window_manager();
my %launchhelp = (
		  'kwin' => sub { system("mdklaunchhelp " . $ancpath . "&") },
		  'gnome-session' => sub { system("yelp ghelp://" . $ancpath . "&") },
		  'other' => sub { 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"));
				   log::explanations("Loading help system : $ancpath");
				   system("$browser " . $ancpath . "&") 
				}
		 );
member($wm, 'kwin', 'gnome-session') or $wm = 'other';
-e $instpath and eval { $launchhelp{$wm}->() };