https://bugs.kde.org/show_bug.cgi?id=460731

            Bug ID: 460731
           Summary: MIME type associations of LibreOffice not picked up
                    for macro-enabled subtypes of MS Office document types
    Classification: Frameworks and Libraries
           Product: frameworks-kservice
           Version: 5.99.0
          Platform: Archlinux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: fa...@kde.org
          Reporter: prettyvani...@posteo.at
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

SUMMARY
File associations for MS Office document types that use a file extension with
added 'm' to indicate the macro-enabled subtype of the format are currently not
picked up by sycoca or at least not properly queried for. Files with these
extensions are thus not associated with any program when trying to open them in
Dolphin.

MIME type definitions for these formats look like this (leaving out comment
language variants):
```
<mime-type type="application/vnd.ms-word.document.macroEnabled.12">
    <comment>Word document</comment>
    <generic-icon name="x-office-document"/>
    <glob pattern="*.docm"/>
    <sub-class-of
type="application/vnd.openxmlformats-officedocument.wordprocessingml.document"/>
</mime-type>
```

LibreOffice for example supports and specifies these in the desktop files of
all its applications:
```
MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text-master-template;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/msword;application/vnd.ms-word;application/x-doc;application/x-hwp;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.lotus-wordpro;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroEnabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroEnabled.12;application/vnd.ms-works;application/vnd.stardivision.writer-global;application/x-extension-txt;application/x-t602;text/plain;application/vnd.oasis.opendocument.text-flat-xml;application/x-fictionbook+xml;application/macwriteii;application/x-aportisdoc;application/prs.plucker;application/vnd.palm;application/clarisworks;application/x-sony-bbeb;application/x-abiword;application/x-iwork-pages-sffpages;application/x-mswrite;application/x-starwriter;
```

The MIME Info cache in `/usr/share/applications/mimeinfo.cache` picks these up
as expected:
```
[...]
application/vnd.ms-excel=libreoffice-calc.desktop;
application/vnd.ms-excel.sheet.binary.macroEnabled.12=libreoffice-calc.desktop;
application/vnd.ms-excel.sheet.macroEnabled.12=libreoffice-calc.desktop;
application/vnd.ms-excel.template.macroEnabled.12=libreoffice-calc.desktop;
application/vnd.ms-powerpoint=libreoffice-impress.desktop;
application/vnd.ms-powerpoint.presentation.macroEnabled.12=libreoffice-impress.desktop;
application/vnd.ms-powerpoint.slideshow.macroEnabled.12=libreoffice-impress.desktop;
application/vnd.ms-powerpoint.template.macroEnabled.12=libreoffice-impress.desktop;
application/vnd.ms-publisher=libreoffice-draw.desktop;
application/vnd.ms-word=libreoffice-writer.desktop;
application/vnd.ms-word.document.macroEnabled.12=libreoffice-writer.desktop;
application/vnd.ms-word.template.macroEnabled.12=libreoffice-writer.desktop;
application/vnd.ms-works=libreoffice-calc.desktop;libreoffice-writer.desktop;
[...]
```

These are also not overridden in the corresponding mimeinfo.cache file in the
user directory.

STEPS TO REPRODUCE
1. A MS Office file with file extension marking macro-enablement (e.g.
`MyDocument.docm`, renaming a `*.doc` should suffice)
2. Install LibreOffice (or another program specifying support for
`application/vnd.ms-word.document.macroEnabled.12` et. al. mimetypes
3. Try opening the document in Dolphin, which will not have the expected
association

OBSERVED RESULT
`ktraderclient5`, which uses kservices classes and is used by `xdg-mime`
doesn't report any offers for the mimetype (but does for
`application/vnd.ms-word`):
```
$ ktraderclient5 --mimetype application/vnd.ms-excel.template.macroEnabled.12
mimetype is : application/vnd.ms-excel.template.macroEnabled.12
got 0 offers.
```

`xdg-mime` detects the association when unsetting the environment variables it
uses to detect a KDE environment, where it would use `ktraderclient5`:
```
$ XDG_CURRENT_DESKTOP="" KDE_FULL_SESSION="" xdg-mime query default
application/vnd.ms-word.document.macroEnabled.12
libreoffice-writer.desktop
```

EXPECTED RESULT
The file association for macro-enabled document subtypes should be picked up
and LibreOffice opened when opening such a file in Dolphin.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 5.26.1
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to