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
What does `file --mime-type [path to file]` say? What happens when you try to open it with `xdg-open`?
(In reply to Nate Graham from comment #1) > What does `file --mime-type [path to file]` say? ``` $ file --mime-type MyDocument.docm MyDocument.docm: application/vnd.openxmlformats-officedocument.wordprocessingml.document ``` But that is arguably a bug or at least shortcoming of `file` itself, most likely because its file format signatures aren't specific enough to distinguish these subtypes. Because of that, it also thinks that the extension used is not among the ones valid for the detected mimetype: `MyDocument.docm: docx`. > What happens when you try to open it with `xdg-open`? As expected, this just opens the application chooser dialog, which again shows the `application/vnd.ms-word.document.macroEnabled.12` mimetype in the remember association checkbox label, since it uses the same code paths that `xdg-mime query` does.
Thanks. I can confirm the issue.