# class KDesktopFile

###

Module | kdecore
Namespace |
Class | KDesktopFile
Inherits | KConfig

\class KDesktopFile kdesktopfile.h <KDesktopFile>

%KDE Desktop File Management. This class implements %KDE's support for the freedesktop.org Desktop Entry Spec.

Author Pietro Iglio <iglio@kde.org>

See also KConfigBase KConfig

See also Desktop Entry Spec

### methods

- KDesktopFile (resourceType, fileName)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  resourceType | char |
  fileName | QString |

  Constructs a KDesktopFile object and make it either read-write or read-only.

  fileName - The name or path of the desktop file. If it is not absolute, it will be located using the resource type resType.

  readOnly - Whether the object should be read-only.

  resType - Allows you to change what sort of resource to search for if fileName is not absolute. For instance, you might want to specify "config".

- KDesktopFile (fileName)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  fileName | QString |

- KDesktopFile (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KDesktopFile |

  Virtual hook, used to add new "virtual" functions while maintaining binary compatibility. Unused in this class.

- KDesktopFile (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | char |
  a1 | QString |

- KDesktopFile (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |

- actionGroup (group)

  returns KConfigGroup

  Argument | Type | Default
  --- | --- | ---
  group | QString |

  Sets the desktop action group.

  group - the new action group

- actionGroup (group)

  returns KConfigGroup
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  group | QString |

- copyTo (file)

  returns KDesktopFile

  Argument | Type | Default
  --- | --- | ---
  file | QString |

  Copies all entries from this config object to a new KDesktopFile object that will save itself to file.

  Actual saving to file happens when the returned object is destructed or when sync() is called upon it.

  file - the new KDesktopFile object it will save itself to.

- desktopGroup ( )

  returns KConfigGroup

- fileName ( )

  returns QString

- hasActionGroup (group)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  group | QString |

  Returns true if the action group exists, false otherwise

  group - the action group to test Returns true if the action group exists

- hasApplicationType ( )

  returns bool

  Checks whether there is an entry "Type=Application". Returns true if there is a "Type=Application" entry

- hasDeviceType ( )

  returns bool

  Checks whether there is an entry "Type=FSDevice". Returns true if there is a "Type=FSDevice" entry

- hasLinkType ( )

  returns bool

  Checks whether there is a "Type=Link" entry.

  The link points to the "URL=" entry. Returns true if there is a "Type=Link" entry

- hasMimeTypeType ( )

  returns bool

  Checks whether there is an entry "Type=MimeType". Returns true if there is a "Type=MimeType" entry

- isAuthorizedDesktopFile (path)

  returns bool
  static

  Argument | Type | Default
  --- | --- | ---
  path | QString |

  Checks whether the user is authorized to run this desktop file. By default users are authorized to run all desktop files but the KIOSK framework can be used to activate certain restrictions. See README.kiosk for more information.

  path - the file to check Returns true if the user is authorized to run the file

- isDesktopFile (path)

  returns bool
  static

  Argument | Type | Default
  --- | --- | ---
  path | QString |

  Checks whether this is really a desktop file.

  The check is performed looking at the file extension (the file is not opened). Currently, the only valid extension is ".desktop".

  path - the path of the file to check Returns true if the file appears to be a desktop file.

- locateLocal (path)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  path | QString |

  Returns the location where changes for the .desktop file path should be written to.

- noDisplay ( )

  returns bool
  KDE 4.1.0 and later only

  Whether the entry should be suppressed in menus. This handles the NoDisplay key, but also OnlyShowIn / NotShowIn. Returns true to suppress this service @since 4.1

- readActions ( )

  returns QStringList

  Returns a list of the "Actions=" entries. Returns the list of actions

- readComment ( )

  returns QString

  Returns the value of the "Comment=" entry. Returns the comment or QString() if not specified

- readDevice ( )

  returns QString

  Returns the value of the "Dev=" entry. Returns the device or QString() if not specified

- readDocPath ( )

  returns QString

  Returns the value of the "X-DocPath=" Or "DocPath=" entry. Returns The value of the "X-DocPath=" Or "DocPath=" entry.

- readGenericName ( )

  returns QString

  Returns the value of the "GenericName=" entry. Returns the generic name or QString() if not specified

- readIcon ( )

  returns QString

  Returns the value of the "Icon=" entry. Returns the icon or QString() if not specified

- readName ( )

  returns QString

  Returns the value of the "Name=" entry. Returns the name or QString() if not specified

- readPath ( )

  returns QString

  Returns the value of the "Path=" entry. Returns the path or QString() if not specified

- readType ( )

  returns QString

  Returns the value of the "Type=" entry. Returns the type or QString() if not specified

- readUrl ( )

  returns QString

  Returns the value of the "URL=" entry. Returns the URL or QString() if not specified

- resource ( )

  returns char

- sortOrder ( )

  returns QStringList

  Returns the entry of the "SortOrder=" entry. Returns the value of the "SortOrder=" entry.

- tryExec ( )

  returns bool

  Checks whether the TryExec field contains a binary which is found on the local system. Returns true if TryExec contains an existing binary