TL;DR
The problem is caused by the interaction of
something in $HOME/.local/share/mime/
and something in Plasma 5.22.3
Removing $HOME/.local/share/mime/
has removed my problem.
Some of the info in there might be needed, so I’ll put bits back gradually,
so as to find out which bit is the culprit.
The longer story:
The discovery trail led me through
api.kde.org/frameworks/kio/html/classKFileItem.html
to doc.qt.io/qt-5/qmimedatabase.html
, which says
that applications that want to define custom MIME types
need to install an XML file into [probably] /usr/share/mime/
There I found xml files that map filename extensions to mime types.
Knew such files must exist, but hadn’t seen them until this point.
(Many help sites mention only mimeapps.list
,
which maps mime types to the apps that open them.)
The testing login that I made earlier did not have the problem,
so I figured the problem must be in my $HOME folder.
With kfind I searched it for *mime*, and discovered $HOME/.local/share/mime/
.
It has the same kind of xml files as /usr/share/mime/
.
The testing user did not have such a folder, so I renamed mine to disable it.
Then when I refreshed the view in Dolphin. all the right icons appeared,
and files can now be opened in the usual way.