File indexing completed on 2024-04-14 05:35:08

0001 #!/usr/bin/perl
0002 
0003 # Montel Laurent <montel@kde.org> 
0004 # This program allows to add custom widget to ui files
0005 # for example : add-customwidget.pl OptionsDlgWidget.ui KIntSpinBox knuminput.h
0006 
0007 use File::Basename;
0008 use lib dirname( $0 );
0009 use functionUtilkde; 
0010 my $numberArgument = @ARGV;
0011 "@ARGV" =~ /-h/ || ( $numberArgument ne 3 ) and die "usage: add-customwidget.pl <file> <name of custom widget> <include file for custom widget> \n";
0012 
0013 my $namecustom=$ARGV[1];
0014 my $nameheader=$ARGV[2];
0015 functionUtilkde::substInFile {
0016         s!</includes>!</includes>\n<customwidgets>\n\t<customwidget>\n\t\t<class>$namecustom</class>\n\t\t<header location="global">$nameheader</header>\n\t\t<container>0</container>\n\t</customwidget>\n</customwidgets>\n!;
0017 } $ARGV[0];
0018 
0019 functionUtilkde::diffFile( "$ARGV[0]" );