OS <[EMAIL PROTECTED]> writes:

> 
> I am using kdebase 1.1.2-44mdk and menu 2.1.5-8mdk and I get absolutely no
> menus at all.

Then there's a problem with a menu entry, but for sure it's not in
 KDE. I have run countless checks to get sure that all my packages
 worked all right an they do.

Please run update-menus by hand as root and report the errors. Then
 the maintainers of the culprit packages will have to correct
 them. Menus work perfectly otherwise.

> 
> Forgive me, but your reply makes it sound like menu is your plaything and the
> rest of us will have to find work arounds ! You may have a Perl script, so why
> isn't included in meun ?!
> 

Because my perl script is only made to convert .kdelnk entries into
menu entries, but it doesn't handle hand-made menu entries, gnome
.desktop files and anything else. I did it in order to obtain
foolproof menu entries and it works for that.

As to your RealPlayer menu entry, a solution would be that you create
a small filesystem with the /var/lib/rpm/* files in it, do rpm -i
--root /the/fs, then run my script on it. Here it is:

----- BEGIN
#!/usr/bin/perl

# (c) ? Whats that?
#
# Script to convert .kdelnk entries to menu entries


sub usage {
        die "Usage: $0 <directory> <package name> [default value for \"needs=\"]";
}

sub ask_section {

# NOTE NOTE NOTE! This menu structure is no more valid as to the "KDE
# Config" section, but the rest is valid
        my %menus = (
                "Configuration" => {
                        "Hardware" => undef,
                        "Packaging" => undef,
                        "Networking" => undef,
                        "Printing" => undef,
                        "Boot and Init" => undef,
                        "Other" => undef
                },
                "Applications" => {
                        "Development" => {
                                "Interpreters" => undef,
                                "Code generators" => undef,
                                "Development environments" => undef,
                                "Tools" => undef
                        },
                        "Sciences" => {
                                "Astronomy" => undef,
                                "Biology" => undef,
                                "Chemistry" => undef,
                                "Computer science" => undef,
                                "Geosciences " => undef,
                                "Mathematics" => undef,
                                "Physics" => undef,
                                "Other" => undef
                        },
                        "Communications" => undef,
                        "Editors" => undef,
                        "Emulators" => undef,
                        "Archiving" => {
                                 "Compression" => undef,
                                 "Cd burning" => undef,
                                 "Backup" => undef,
                                 "Other" => undef
                        },
                        "Monitoring" => undef,
                        "Publishing" => undef,
                        "Terminals" => undef,
                        "Shells" => undef,
                        "File tools" => undef,
                        "Text tools" => undef
                },
                "Documentation" => undef,
                "Office" => undef,
                "Networking" => {
                        "File transfer" => undef,
                        "IRC" => undef,
                        "ICQ" => undef,
                        "Chat" => undef,
                        "News" => undef,
                        "Mail" => undef,
                        "WWW" => undef,
                        "Remote access" => undef,
                        "Other" => undef
                },
                "Amusement" => {
                        "Adventure" => undef,
                        "Arcade" => undef,
                        "Boards" => undef,
                        "Cards" => undef,
                        "Puzzles" => undef,
                        "Sports" => undef,
                        "Strategy" => undef,
                        "Other" => undef,
                        "Toys" => undef
                },
                "Multimedia" => {
                        "Sound" => undef,
                        "Graphics" => undef,
                        "Video" => undef
                },
                "KDE Config" => {
                        "File Manager" => undef,
                        "Desktop" => undef,
                        "Input Devices" => undef,
                        "System Information" => undef,
                        "Window Manager" => undef,
                        "Sounds" => undef,
                        "Other" => undef
                }
        );
        
        my @a;
        
        my $current = \%menus;
        
        while ( defined $current ) {
                my @list = ( "None" , sort keys %$current);
                my $choice;
                
                foreach ( 0 .. $#list ) { print "$_: $list[$_]\n" };
        
                print "Your choice: ";
                $choice = <STDIN>;
                chomp $choice;
        
                if ( $choice !~ /^\d+$/ || $choice > $#list ) {
                        print "Out of range (or not a number)\n";
                        next;
                }
        
                $current = ( $choice == 0 ) ? undef : $current->{$list[$choice]};
        
                push @a, $list[$choice] if $choice;
        }

        return join("/",@a);
}

my %matches = (
        "Name" => "title",
        "Comment" => "longtitle",
        "Exec" => "command",
        "Icon" => "icon"
);

my %ignoring = (
        "Type" => undef,
        "MiniIcon" => undef,
        "BinaryPattern" => undef,
        "Protocols" => undef,
        "TerminalOptions" => undef,
        "Path" => undef,
        "Extensions" => undef,
        "DocPath" => undef,
        "WmCommand" => undef
);
        
my $dir = $ARGV[0];
my $package = $ARGV[1];
my $default_needs = $ARGV[2] || "x11";

my @files = split("\n", `find $dir -type f -name \"*kdelnk\"`);

usage() unless ( $dir && -d $dir );
usage() unless $package;

open DEST, ">" . $ENV{"HOME"} . "/tmp/" . $package . "_menu" or die "Cannot open 
$package for writing: $!";

foreach $this_file (@files) {
        open FROM, "<$this_file" or die "Cannot open $this_file for reading: $!";

        my $res = "?package($package): ";

        while(<FROM>) {
                chomp;
                ($var, $val) = split /=/;
                next unless ( $var ne "" && $val ne "" );
                next if exists $ignoring{$var} ;
                next if ( $var =~ /\[/ );
                $val =~ s/\"/\\\"/g ;
                $var = ( defined $matches{$var} ) ? $matches{$var} : "kde_" . lc($var) 
;

                if ( $var =~ m/terminal/i ) {
                        $var = "needs";
                        $val = ( $val eq "0" ) ? $default_needs : "text";
                }
                
                $res .= "$var=\"$val\" ";
        }

        $res .= "needs=\"$default_needs\" " unless ( $res =~ m/needs/ );

        print $res, "\n";

        $res .= "section=\"" . ask_section() . "\"";

        print DEST  $res . "\n";

        close FROM;
}

close DEST;
----- END

-- 
fg

# rm *;o
o: command not found

Reply via email to