Index: kprconverter.pl =================================================================== RCS file: /home/kde/koffice/kpresenter/kprconverter.pl,v retrieving revision 1.5 diff -b -u -p -r1.5 kprconverter.pl --- kprconverter.pl 2000/08/29 13:20:03 1.5 +++ kprconverter.pl 2000/08/30 19:34:32 @@ -1,18 +1,32 @@ # converts a KPresenter document from the old format to the new one (v2) # due to the new text object + +use Time::Local; + open(INPUT, "<$ARGV[0]") || die "Cannot open $ARGV[0]"; open(OUTPUT, ">$ARGV[1]") || die "Cannot create $ARGV[1]"; $objType=""; $insideParag=0; $insideObj=0; +$insidePixmaps=0; # are we inside the tags? $currentText=""; $currentTextType=0; while () { if (/$/ syntaxVersion=\"2\">/; } + elsif (//) + { + $insidePixmaps=1; + } + elsif (/<\/PIXMAPS>/) + { + $insidePixmaps=0; + } elsif (/) } } $_=$toprint; + } + elsif ($insidePixmaps) + { + if(/\s+name=\"/) + { + # Aha - this file is not version 2 but was created as "proper" tgz storage... medieval times :) + print "Found a name attribute, no need to create one.\n"; + } + elsif (//) + { + # Okay - plain old kpresenter magic... + $key=$1; + # Note: The .*? is needed because it would be too greedy otherwise + $filename=$1 if($key =~ /filename=\"(.*?)\"/); + # Get the values - really straightforward + $year=$1 if($key =~ /year=\"(\d+)\"/); + $month=$1 if($key =~ /month=\"(\d+)\"/); + $day=$1 if($key =~ /day=\"(\d+)\"/); + $hour=$1 if($key =~ /hour=\"(\d+)\"/); + $minute=$1 if($key =~ /minute=\"(\d+)\"/); + $second=$1 if($key =~ /second=\"(\d+)\"/); + # In Perl the month is <0...11>!!! + $timestamp=timegm($second, $minute, $hour, $day, $month-1, $year); + # Unfortunately we even have to mess with that string... + $timestring=scalar gmtime($timestamp); + # There are still some spaces too much when day<10 + $timestring =~ s/ / /; + # Okay. Now let's cat the whole caboodle... + $nameattrib=$url . $filename . "_" . $timestring; + # ...and put it in place. + s/\/>/ name=\"$nameattrib\" \/>/; + } } print OUTPUT $_; Index: kpresenter_doc.cc =================================================================== RCS file: /home/kde/koffice/kpresenter/kpresenter_doc.cc,v retrieving revision 1.235 diff -b -u -p -r1.235 kpresenter_doc.cc --- kpresenter_doc.cc 2000/08/28 16:24:27 1.235 +++ kpresenter_doc.cc 2000/08/30 19:34:56 @@ -1240,7 +1240,11 @@ bool KPresenterDoc::completeLoading( KoS if ( _store->open( u ) ) { KoStoreDevice dev(_store ); QImageIO io( &dev, 0 ); - io.read( ); + if(!io.read()) + // okay - has to be a funky - old xpm in a very old kpr file... + // Don't ask me why this is needed... + img=QImage(_store->read(_store->size())); + else img = io.image(); _store->close();