sysui/desktop/share/create_mime_xml.pl |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 515f26384510701be0b3ef21ddd445d1022198cc
Author: Petr Mladek <pmla...@suse.cz>
Date:   Mon Sep 5 18:57:34 2011 +0200

    better detect OASIS MIME types (bnc#711977)
    
    check more elements; also set sub-class-of application/xml for Flat XML

diff --git a/sysui/desktop/share/create_mime_xml.pl 
b/sysui/desktop/share/create_mime_xml.pl
index e1fc890..5141dff 100755
--- a/sysui/desktop/share/create_mime_xml.pl
+++ b/sysui/desktop/share/create_mime_xml.pl
@@ -45,9 +45,24 @@ foreach $component (sort(keys %mimehash)) {
     print (sort({customsort($a) cmp customsort($b)} @{$mimehash{$component}}));
     print '    <glob pattern="'.$glob.'"/>';
     if ( $component =~ /oasis/ ) {
-        print '    <magic'.( $mimetype =~ /-/  ? ' priority="60"' : '').'>';
-        print '        <match type="string" offset="38" 
value="'.$mimetype.'"/>';
-        print '    </magic>';
+        if ( $component =~ /flat-xml/ ) {
+            print '    <sub-class-of type="application/xml"/>';
+            print '    <magic'.( $mimetype =~ /-/  ? ' priority="60"' : 
'').'>';
+            print '        <match value="&lt;?xml" type="string" offset="0">';
+            print '            <match value="office:document" type="string" 
offset="4:100">';
+            print '                <match value="office:mimetype=&quot;' . 
$mimetype . '&quot;" type="string" offset="100:4000"/>';
+            print '            </match>';
+            print '        </match>';
+            print '    </magic>';
+        } else {
+            print '    <magic'.( $mimetype =~ /-/  ? ' priority="60"' : 
'').'>';
+            print '        <match value="PK\003\004" type="string" 
offset="0">';
+            print '            <match value="mimetype" type="string" 
offset="30">';
+            print '                <match value="' . $mimetype . '" 
type="string" offset="38"/>';
+            print '            </match>';
+            print '        </match>';
+            print '    </magic>';
+        }
     }
     print '  </mime-type>';
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to