New helper program proposal: calligra

David Faure faure at kde.org
Mon Dec 27 18:01:17 GMT 2010


On Monday 27 December 2010, Jaroslaw Staniek wrote:
> On 22 December 2010 16:51, Jaroslaw Staniek <staniek at kde.org> wrote:
> > On 22 December 2010 16:05, Cyrille Berger Skott <cberger at cberger.net> 
wrote:
> >> Hi,
> >> 
> >> For sake of clarity, since I haven't seen your commit (might just be
> >> lack of time ;P), I don't have an objection to this :)
> > 
> > OK, I'll have to contribute then :)
> 
> OK, I am at point where something should be cleared up.
> We are using KMimeTypeTrader::query() to find app for given mimetype.
> What we need extra is a way to mark app service files like
> words.desktop as "calligra" apps, so they are selected instead of
> other apps, e.g. openoffice.org, that user probably set as default or
> that have higher priority. Marking the calligra apps avoids hardcoding
> this rule in the code.
> 
> SOLUTION 1.
> One idea is to create a subtype of "Application" service type:
> 
> [Desktop Entry]
> Type=ServiceType
> X-KDE-ServiceType=Calligra/Application
> X-KDE-Derived=Application
> Comment=Calligra Application
> 
> For example, for an .odt file we have, trader->query(mimetype->name(),
> "Application") returns on my system:
> 
>  query for mimeType  "application/vnd.oasis.opendocument.text" ,
> "Application"  : returning  22  offers
>  - "OpenOffice.org Writer"
>  - "Okular"
>  - "OpenDocument format"
>  - "AbiWord"
>  - "Okular"
>  - "Ark"
>  - "ZIP archive plugin"
>  - "ark_servicemenu"
>  - "Archive Mounter"
>  - "Ark Extract Here"
>  - "encryptfile"
>  - "preview"
>  - "Kleopatra Sign/Encrypt Files"
>  - "KHTML"
>  - "Konqueror"
>  - "WebKit"
>  - "Embedded Advanced Text Editor"
>  - "KWrite"
>  - "Kate"
>  - "Subversion"
>  - "Emacs"
>  - "Text Files"
> 
> Then, I would expect that if we could simple execute:
> 
>  trader->query(mimetype->name(), "Calligra/Application");
> 
> this output:
> 
>  - "Words"
> 
> This is clean way similar to how various servicetypes derive from
> KParts. But I see we cannot derive from the Application type.
> So I am requesting for comments, and CC'ing to dfaure ;)

Just don't derive from Application, and you'll be set.

> SOLUTION 2.
> We want to find preferred/default calligra app for any mimetype we support.
> 
> So perhaps we need extra .desktop file, e.g. with:
> X-KDE-ServiceTypes=Calligra/Application
> MimeType=... (only default mimetypes here, unlike in the app.desktop
> files where all supported mimetypes are listed)

This is the same solution, not a different one.
Define a Calligra/Application servicetype, and mention it in the applications 
desktop files (although, having a separate file might be a good idea, so that it 
doesn't become unavailable if someone removes it from the K menu).

> This way, selection of calligra app per mimetype wont be random but
> well defined.
> E.g. we want to have .txt file opened in Words.
> Perhaps there's more simple solution?

Tagging desktop files with a servicetype seems like a pretty simple solution to 
me :-)

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).



More information about the calligra-devel mailing list