Warning, file /sdk/kde-dev-scripts/rc2kcfgxt.pl was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #! /usr/bin/env perl 0002 # 0003 # rc2kcfgxt.pl version 4 by Adriaan de Groot 0004 # 0005 # This code is released to the Public Domain. 0006 # 0007 0008 # 0009 # Usage: rc2kcfgtxt.pl < rcfile > xmlfile 0010 # 0011 # Reads an rcfile (say, kmailrc) and writes out an KConfigXT XML 0012 # file that represents a reasonable guess for representing the 0013 # rc file. No guarantees about well-formedness of the XML are made. 0014 # 0015 0016 # 0017 # rc2kcfgxt.pl only guesses types Bool, UInt, and IntList. 0018 # Everything else is a String. You may need to edit the various 0019 # types. As of 4-1-2003, valid types are: 0020 # 0021 # type (String|StringList|Font|Rect|Size|Color| 0022 # Point|Int|UInt|Bool|Double|DateTime| 0023 # Int64|UInt64|IntList|Enum|Path) #REQUIRED 0024 # 0025 0026 $group="" ; 0027 $key=""; 0028 0029 print <<EOF; 0030 <?xml version="1.0" encoding="UTF-8"?> 0031 <!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd"> 0032 <kcfg> 0033 EOF 0034 0035 while(<>) 0036 { 0037 chomp; 0038 next unless $_; 0039 if (/\[([-A-Za-z 0-9]+)\]/) 0040 { 0041 $grp = $1; 0042 print " </group>\n" if ($group && (not $group =~ /^MainWindow/)); 0043 $group=$grp; 0044 next if ($group =~ /^MainWindow/); 0045 print " <group name=\"$group\">\n"; 0046 next; 0047 } 0048 0049 next if $group =~ /^MainWindow/ ; 0050 0051 @l = split /=/; 0052 $key = shift @l; 0053 $value = join "=",@l; 0054 $cfgkeyexpr = ""; 0055 0056 # Escape value values that are special to XML 0057 $value =~ s/</</; 0058 $value =~ s/>/>/; 0059 $value =~ s/"/"/; 0060 0061 if ($key =~ /[ -,.<>;:!\]\[|}{]/) 0062 { 0063 $cfgkeyexpr = "key=\"$key\""; 0064 @key_parts = split /[ -,.<>;:!\]\[|}{]/,$key; 0065 $key = ""; 0066 foreach $i (@key_parts) 0067 { 0068 next unless $i; 0069 $i =~ /([a-zA-Z0-9_])([a-zA-Z0-9_]*)/; 0070 $first = $1; 0071 $second = $2; 0072 $first =~ tr/a-z/A-Z/; 0073 $key .= $first . $second; 0074 } 0075 } 0076 0077 # Find key type 0078 $type=""; 0079 $type="Bool" if ( $value =~ /^(true|false|TRUE|FALSE)$/); 0080 $type="UInt" if ( $value =~ /^[0-9]+$/); 0081 $type="IntList" if ( ( not $type ) && ( $value =~ /^[0-9,]+$/ )); 0082 $type="String" unless $type; 0083 0084 print <<EOF; 0085 <entry name="$key" $cfgkeyexpr type="$type"> 0086 <label> 0087 </label> 0088 <default>$value</default> 0089 </entry> 0090 EOF 0091 } 0092 0093 print " </group>\n" if ($group && (not $group =~ /^MainWindow/)); 0094 0095 print "\n</kcfg>\n";