Virtual MimeTypes support patch

Albert Astals Cid aacid at
Mon Oct 23 18:44:11 BST 2006

A Dilluns 23 Octubre 2006 12:59, David Faure va escriure:
> Hi Albert,
> KService::virtualMimeType() allows only one virtual mimetype per service; I
> wonder if this shouldn't be a list instead, just in case (e.g. someone
> merges kdvi and kghostview, you end up with the need to support two virtual
> mimetypes, from the plugins for both apps).

Ok, i'll add the possibility of having more than one mimetype.

> On Saturday, October 21, 2006 07:10:33 PM Albert Astals Cid wrote:
> > +  QMap<QString,QVariant>::const_iterator it = m_mapProps.find(
> > QLatin1String("X-KDE-Virtual-MimeType") ); +  if (it != m_mapProps.end())
> > return it.value().toString();
> > +  else return QString();
> The simpler qt4 way of writing this is
>  return m_mapProps.value( QLatin1String("X-KDE-Virtual-MimeType")
> ).toString(); (if not found, value() returns a QVariant() since the value
> type is QVariant)

Good :-)

> > +            // remove the Application service as
> > it.value()->serviceTypes() already has one +           
> > service->accessServiceTypes().removeLast();
> Dangerous, the last servicetype might not be Application! A part could use
> the same "virtual mimetypes" mechanism... I think this should be
> generalized into "only add those servicetypes that the service doesn't
> already have".

Ok, i'll change that code to add the missing mimetypes.

> > +     if (virtualMimeType.startsWith("virtual/"))
> If not, the virtual mimetype is just ignored; I guess this needs a kWarning
> at least.


> To answer Thiago: I still hope that we find the time to switch kde4 to
> xdg-shared-mime, so this mechanism (which, I note, is properly designed for
> interoperability since it installs Type=Application desktop files and
> doesn't reuse the plugin .desktop files - that's good) should be
> standardized at the xdg level.

Well, i asked on xdg list and [almost] noone showed interest on this, so i 
just went and coded it for the DE i use.

> I would add NoDisplay=true to the files though, we don't want them in
> menus... Hmm, and they'll still show up in konq's RMB popup, unless we add
> a check for "Exec not empty". 

You are speaking of other DE that are not KDE right? Because the virtual 
mimetype "providers" never end up beign added as they are dropped at the 
buildsycoca stage.

> This is in fact a strange misuse of the 
> desktop file standard (apps without exec), it needs to be agreed on at xdg
> to avoid such side effects.

Ok, can you please try to push that? It should not be too difficult to add for 
other DE if i with zero knowledge of how kbuildsycoca works have been able of 
adding it with a quite small patch.


More information about the kde-core-devel mailing list