[Kde-kiosk] KDE File Associations

Waldo Bastian kde-kiosk@mail.kde.org
Mon, 25 Mar 2002 08:54:09 -0800


On Monday 25 March 2002 05:50 am, Annemieke den Teuling wrote:
> > On Monday 25 March 2002 13:45, Janyne Kizer wrote:
> > > I am using KDE 2.2.1 and I am having a problem associating .doc fil=
es
> > > with StarOffice 5.2.  Where is this information stored?  I think th=
at I
> > > am missing a piece of the puzzle since the Mimelink stuff doesn't
> > > mention an application to execute in order to open the file.  I gue=
ss
> > > that I should also have mentioned that using the file association t
> > > seems to work from some users but not others
> > >
> > > Basically, what file(s) need to be edited to associate files with
> > > programs so that, for example, .doc files will be opened by StarOff=
ice
> > > automatically?  Can this be set on at the system level or is this
> > > something that needs to be set for each individual?  Thanks!
> >
> > I think you could just add 'MimeType=3Dapplication/msword' to the
> > .desktop file of StarOffice. After that either log in again or run
> > 'kbuildsycoca' from the console to update the System Configuration Ca=
che.
> >
> > But I'm sure Waldo knows much more about the mime type handling :-)
> >
> > Martijn
>
> Indeed, for known applications it is enough to put it in the
> $kde/share/applink/*.desktop file.
> For unknown applications (for example open-office *.sdc or *.sxw,*.sxc,
> etc) you need to make an entry in mimelnk.
> Example:*/share/mimelnk/application/x-calc.desktop
>
> [Desktop Entry]
> Comment=3DOpenOffice Calc
> Hidden=3Dfalse
> Icon=3D
> MimeType=3Dapplication/x-calc
> Patterns=3D*.sxc;*.stc
> Type=3DMimeTypeool
>
> I hope this is usefull.

Indeed. File associations are handled in three parts actually:

1) The mime-type description that describes the filetype, as Annemieke=20
explained already.

2) Then there is the .desktop file that describes the service/application=
,=20
e.g. "openoffice.desktop" which includes a list of mimetypes that are bei=
ng=20
supported by that application.

3) And there is share/config/profilerc (optional), which contains the use=
rs=20
preference. E.g. there are 6 applications that can open text/plan files,=20
profilerc is consulted to decide which one of those 6 is used to actually=
=20
open the file.

Below I have quoted what happens to be the contents of my profilerc.

GenericServiceType=3DApplication means that it starts up as a stand-alone=
=20
application, while GenericServiceType=3DKParts/ReadOnlyPart means that=20
it can only be embedded in e.g. Konqueror.

Cheers,
Waldo


[text/plain - 1]
AllowAsDefault=3Dtrue
Application=3DEditors/kwrite.desktop
GenericServiceType=3DApplication
Preference=3D5
ServiceType=3Dtext/plain

[text/plain - 2]
AllowAsDefault=3Dtrue
Application=3DEditors/KEdit.desktop
GenericServiceType=3DApplication
Preference=3D4
ServiceType=3Dtext/plain

[text/plain - 3]
AllowAsDefault=3Dtrue
Application=3DEditors/xedit.desktop
GenericServiceType=3DApplication
Preference=3D3
ServiceType=3Dtext/plain

[text/plain - 4]
AllowAsDefault=3Dtrue
Application=3DOffice/kword.desktop
GenericServiceType=3DApplication
Preference=3D2
ServiceType=3Dtext/plain

[text/plain - 5]
AllowAsDefault=3Dtrue
Application=3DEditors/kate.desktop
GenericServiceType=3DApplication
Preference=3D1
ServiceType=3Dtext/plain

[text/plain - 6]
AllowAsDefault=3Dtrue
Application=3Dksimpleedit.desktop
GenericServiceType=3DKParts/ReadOnlyPart
Preference=3D1
ServiceType=3Dtext/plain

--=20
bastian@kde.org  |   SuSE Labs KDE Developer  |  bastian@suse.com