2 # convert which file to which file?
3 # I did nto bother to build in any checks. so that file better exists and it is readable and the data will
4 # be written to a writeable directory. Since this is an old config file, it is safe to assume, that is the
9 # Take your hands off the rest unless you darn well knwo what you are doing
10 ##################################################################################
11 ##################################################################################
16 #read in all the data, split it up into hashes. Thanks again to malte for much input
19 $sections{$section} = {%data} if $section;
24 $data{$1} = $2 if /^([^=]*)=(.*)$/;
27 $sections{$section} = {%data} if $section;
29 # do the data writing magic
30 #first of all be check how many old news souerces we have
32 $sources = $sections{'General'}->{'News sources'};
33 #gather all news sources into a very pretty string before we write the global section
34 #also give some feedback to the user
35 for my $i (0..($sources-1)) {
36 $all .= "," .$sections{"News source #$i"}->{'Name'};
40 # write the main section
41 print "[KNewsTicker]\n";
43 while (($key,$dat) = each(%{$sections{'General'}})) {
44 if ($key ne "News sources") {
45 if ($key eq "Interval") {
46 $key="Update interval";
48 if ($key eq "Scroll most recent only") {
49 $key="Scroll most recent headlines only";
53 print "News sources=".$all."\n";
58 # next merge the old scrolling section into the KNewticker Section
59 while (($key,$dat) = each(%{$sections{'Scrolling'}})) {
60 if ($key eq "Background") {
61 $key="Background color";
64 if ($key eq "Foreground") {
65 $key="Foreground color";
67 if ($key eq "Highlighted") {
68 $key="Highlighted color";
70 if ($key eq "Underline highlighted") {
71 $key="Underline highlighted headlines";
73 if (($key eq "Direction") && ($dat eq "Left")) {
74 $key ="Scrolling direction";
78 if (($key eq "Direction") && ($dat ne "Left")) {
80 $key ="Scrolling direction";
83 if ($key eq "Speed") {
84 $key="Scrolling speed";
92 # next we write the news sources, making sure we have the correct headers
93 for my $i (0..($sources-1)) {
95 print "\n[" .$sections{"News source #$i"}->{'Name'} ."]\n";
96 while (($key,$dat) = each(%{$sections{"News source #$i"}})) {
97 if ($key ne "Address") {
100 print "Source file=".$dat."\n";