diff options
Diffstat (limited to 'tools/scripts')
| -rwxr-xr-x | tools/scripts/check_koffice_install.sh | 98 | ||||
| -rwxr-xr-x | tools/scripts/check_msword_import.sh | 89 | ||||
| -rwxr-xr-x | tools/scripts/gdb_output_to_text.pl | 10 | ||||
| -rw-r--r-- | tools/scripts/koffice-devel-gdb | 27 |
4 files changed, 224 insertions, 0 deletions
diff --git a/tools/scripts/check_koffice_install.sh b/tools/scripts/check_koffice_install.sh new file mode 100755 index 000000000..d15876f75 --- /dev/null +++ b/tools/scripts/check_koffice_install.sh @@ -0,0 +1,98 @@ +#!/bin/bash +if ! kde-config ; then + echo 'kde-config not found ! Aborting. You need a more recent KDE, or to fix your $PATH.' + exit 1 +fi + +instance=kword +applnks=`kde-config --path apps`:`kde-config --path xdgdata-apps` +services=`kde-config --path services` +found=0 + +function checkname() +{ + f=`echo $1 | sed -e 's,//,/,g'` + if [ -f $f ]; then + echo -n "Found: $f... " + mimetypes=`grep ^MimeType $f|sed -e 's/.*=//;s/;/,/g;'` + servicetypes=`grep ^ServiceTypes $f|sed -e 's/.*=//;s/$/,/g'` + fulllist="$mimetypes,$servicetypes" + if echo $fulllist | grep "KOfficePart," >/dev/null 2>/dev/null; then + echo "ok, this is a KOfficePart" + else + echo '**** KOfficePart not in list of types !' + echo Service Types: $fulllist + cat $f + exit 1 + fi + nativemime=`grep X-KDE-NativeMimeType $f` + echo Native mimetype : $nativemime + if echo $nativemime | grep "application/x-$instance" >/dev/null 2>/dev/null; then + found=1 + fi + fi +} + +IFS=: +for dir in $services; do + if test -n "$dir"; then + echo Looking for ${instance}part.desktop under services dir: $dir + f="$dir/${instance}part.desktop" + checkname $f + fi +done + +if [ $found = 0 ]; then + # The old way, as fallback + for dir in $applnks; do + if test -n "$dir"; then + echo Looking under applnk dir: $dir + f="$dir/Office/$instance.desktop" + checkname $f + fi + done +fi + +if [ $found = 0 ]; then + echo + echo Now looking by filename + echo + + for dir in $applnks; do + if test -n "$dir"; then + echo Looking under applnk dir: $dir + for f in `find $dir -name $instance.desktop`; do + checkname $f + done + fi + done +fi + +if [ $found = 0 ]; then + echo "***** No $instance.desktop with X-KDE-NativeMimetype in it was found! Installation problem." + echo $applnks +fi + +echo + +stfound=0 +for dir in `kde-config --path servicetypes`; do + echo Service Types dir $dir + f=`echo $dir/kofficepart.desktop | sed -e 's,//,/,g'` + if [ -f $f ]; then + echo Found $f + grep Native $f + stfound=1 + fi +done + +if [ $stfound = 0 ]; then + echo '****** kofficepart.desktop not found!' + kde-config --path servicetypes +else + echo + if [ $found = 1 ]; then + echo "Everything looks ok" + fi +fi + diff --git a/tools/scripts/check_msword_import.sh b/tools/scripts/check_msword_import.sh new file mode 100755 index 000000000..e7470df53 --- /dev/null +++ b/tools/scripts/check_msword_import.sh @@ -0,0 +1,89 @@ +#!/bin/bash +if ! kde-config ; then + echo 'kde-config not found ! Aborting. You need a more recent KDE, or to fix your $PATH.' + exit 1 +fi +IFS=: + +echo -n "KDE prefixes: " +kde-config --prefix + +# Check for the binary +found=0 +exedirs=`kde-config --path exe` +for dir in $exedirs; do + if [ -f "$dir/kword" ]; then + echo "kword found in $dir" + found=1 + fi +done + +if [ $found -eq 0 ]; then + echo "ERROR: kword not found - looked at $exedirs" +fi + +mimelnks=`kde-config --path mime` +# Relevant existing mimetypes +mimes="" + +for dir in $mimelnks; do + filename="application/msword.desktop" + if [ -f "$dir$filename" ]; then + echo -n "Found: $dir$filename... " + hidden=`grep ^Hidden $dir$filename` + if [ "$hidden" == "true" ]; then + echo "deleted"; + else + mimetype=`grep ^MimeType $dir$filename|sed -e 's/.*=//'` + mimes="$mimes:$mimetype"; # using ':' because of IFS + patterns=`grep ^Patterns $dir$filename|sed -e 's/.*=//'` + if [ -n "$patterns" ]; then + echo -n "(associated with $patterns)" + fi + echo + fi + fi + filename="application/msword2.desktop" + if [ -f "$dir$filename" ]; then + echo -n "Found: $dir$filename... " + hidden=`grep ^Hidden $dir$filename` + if [ "$hidden" == "true" ]; then + echo "deleted"; + else + mimetype=`grep ^MimeType $dir$filename|sed -e 's/.*=//'` + mimes="$mimes:$mimetype"; # using ':' because of IFS + patterns=`grep ^Patterns $dir$filename|sed -e 's/.*=//'` + if [ -n "$patterns" ]; then + echo -n "(associated with $patterns)" + fi + echo + fi + fi +done + +IFS=" " +mimes=`echo $mimes | sed -e 's/^://g'` +echo "Relevant mimetypes found: $mimes" + +IFS=: +foundmagicfile=0 +for dir in $mimelnks; do + magic=$dir/magic + if [ -f "$magic" ]; then + echo "$magic says: " + grep 'Microsoft\\ Word' $magic + foundmagicfile=1 + fi +done + +if [ $foundmagicfile -eq 0 ]; then + echo "ERROR: Magic file not found $magic" +fi + +for dir in `kde-config --path services`; do + echo Services dir $dir + for mime in $mimes; do + grep "Import=.*$mime" $dir/*.desktop + done +done + diff --git a/tools/scripts/gdb_output_to_text.pl b/tools/scripts/gdb_output_to_text.pl new file mode 100755 index 000000000..8a85833aa --- /dev/null +++ b/tools/scripts/gdb_output_to_text.pl @@ -0,0 +1,10 @@ +#!/usr/bin/perl +while (<>) { + if ( m/.* = [-\d]+ '(.+)'/ ) { + my $a = $1; + eval( "\$a=\"$a\"" ); + print $a; + } elsif ( m/.* = -1/ ) { + print "\n"; + } +} diff --git a/tools/scripts/koffice-devel-gdb b/tools/scripts/koffice-devel-gdb new file mode 100644 index 000000000..55adea725 --- /dev/null +++ b/tools/scripts/koffice-devel-gdb @@ -0,0 +1,27 @@ +# TODO write a print_kotextdocument that calls a print_kotextstring +# that uses something like printqstring does (to show the string on a single line) + +# Print the contents of a KoTextString (use when debugging a core file) +# To reassemble the output of this function into a string, use gdb_output_to_text.pl +define print_kotextstring_noprocess + set $s = sizeof(KoTextStringChar) + set $str = $arg0 + set $length = $str->data->shd->len / $s + set $arr = ((KoTextStringChar*)($str->data->shd->data)) + set $i = 0 + while $i < $length-1 + print (char)($arr[$i++].c.ucs & 0xff) + end +end + +# Print the contents of a KoTextDocument (use when debugging a core file) +define print_kotextdocument_noprocess + set $textdoc = $arg0 + set $p = $textdoc->fParag + while $p != $textdoc->lParag + print_kotextstring_noprocess $p->str + print -1 + set $p = $p->n + end +end + |
