Dolphin doesn't show icons for custom mime types

Following this post,

I created the following R-mime.xml file:

<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/R-script">
        <comment>R script</comment>
        <generic-icon name="text-x-R"/>
        <sub-class-of type="text/plain"/>
        <glob pattern="*.R"/>
    </mime-type>
</mime-info>

I have run:

sudo xdg-mime install --mode system R-mime.xml

I have set the icon theme to Papirus (Fedora 41 KDE spin):

The relevant icons are there:

➜  find /usr/share/icons -name "*text-x-R*"
/usr/share/icons/Papirus/16x16/mimetypes/text-x-R.svg
/usr/share/icons/Papirus/22x22/mimetypes/text-x-R.svg
/usr/share/icons/Papirus/24x24/mimetypes/text-x-R.svg
/usr/share/icons/Papirus/32x32/mimetypes/text-x-R.svg
/usr/share/icons/Papirus/48x48/mimetypes/text-x-R.svg
/usr/share/icons/Papirus/64x64/mimetypes/text-x-R.svg

Yet Dolphin shows a generic icon for .R files:

image

Just a guess on my part. If there is not a valid MIME type for the R files maybe Dolphin will not show the icon?

Maybe you need this package R-mime.x86_64: Map Filenames to MIME Types?