KDEDesktopMimeType Class Reference

`#include <kmimetype.h>`

Inheritance diagram for KDEDesktopMimeType:

## Classes

struct | Service

## Public Types

enum | ServiceType { ST_MOUNT, ST_UNMOUNT, ST_USER_DEFINED }
Public Types inherited from KMimeType
typedef KSharedPtr< KMimeType > | Ptr
typedef QValueList< Ptr > | List
Public Types inherited from KServiceType
typedef KSharedPtr< KServiceType > | Ptr
typedef QValueList< Ptr > | List

## Public Member Functions

| KDEDesktopMimeType (KDesktopFile *config)
| KDEDesktopMimeType (QDataStream &_str, int offset)
virtual QString | icon (const QString &_url, bool _is_local) const
virtual QString | icon (const KURL &_url, bool _is_local) const
virtual QPixmap | pixmap (const KURL &_url, KIcon::Group _group, int _force_size=0, int _state=0, QString *_path=0L) const
virtual QString | comment (const QString &_url, bool _is_local) const
virtual QString | comment (const KURL &_url, bool _is_local) const
Public Member Functions inherited from KMimeType
| KMimeType (const QString &_fullpath, const QString &_type, const QString &_icon, const QString &_comment, const QStringList &_patterns)
| KMimeType (const QString &_fullpath)
| KMimeType (KDesktopFile *config)
| KMimeType (QDataStream &_str, int offset)
QString | comment () const
const QStringList & | patterns () const
virtual void | load (QDataStream &qs)
virtual void | save (QDataStream &qs)
virtual QVariant | property (const QString &_name) const
virtual QStringList | propertyNames () const
QString | parentMimeType () const
bool | is (const QString &mimeTypeName) const
Public Member Functions inherited from KServiceType
| KServiceType (const QString &_fullpath, const QString &_name, const QString &_icon, const QString &_comment)
| KServiceType (const QString &_fullpath)
| KServiceType (KDesktopFile *config)
| KServiceType (QDataStream &_str, int offset)
QString | icon () const
QString | comment () const
QString | name () const
QString | desktopEntryPath () const
bool | isDerived () const
QString | parentServiceType () const
bool | inherits (const QString &servTypeName) const
bool | isValid () const
virtual QVariant::Type | propertyDef (const QString &_name) const
virtual QStringList | propertyDefNames () const
virtual const QMap< QString, QVariant::Type > & | propertyDefs () const
Ptr | parentType ()
void | addService (KService::Ptr service)
KService::List | services ()

## Static Public Member Functions

static QValueList< Service > | builtinServices (const KURL &_url)
static QValueList< Service > | userDefinedServices (const QString &path, bool bLocalFiles)
static QValueList< Service > | userDefinedServices (const QString &path, KConfig &config, bool bLocalFiles)
static QValueList< Service > | userDefinedServices (const QString &path, KConfig &config, bool bLocalFiles, const KURL::List &file_list)
static void | executeService (const QString &path, KDEDesktopMimeType::Service &service) KDE_DEPRECATED
static void | executeService (const KURL::List &urls, KDEDesktopMimeType::Service &service)
static pid_t | run (const KURL &_url, bool _is_local)
Static Public Member Functions inherited from KMimeType
static QPixmap | pixmapForURL (const KURL &_url, mode_t _mode=0, KIcon::Group _group=KIcon::Desktop, int _force_size=0, int _state=0, QString *_path=0L)
static QString | iconForURL (const KURL &_url, mode_t _mode=0)
static QString | favIconForURL (const KURL &url)
static Ptr | mimeType (const QString &_name)
static Ptr | findByURL (const KURL &_url, mode_t _mode=0, bool _is_local_file=false, bool _fast_mode=false)
static Ptr | findByURL (const KURL &_url, mode_t _mode, bool _is_local_file, bool _fast_mode, bool *accurate)
static Ptr | findByPath (const QString &path, mode_t mode=0, bool fast_mode=false)
static Ptr | findByContent (const QByteArray &data, int *accuracy=0)
static Ptr | findByFileContent (const QString &fileName, int *accuracy=0)
static Format | findFormatByFileContent (const QString &fileName)
static List | allMimeTypes ()
static const QString & | defaultMimeType ()
static KMimeType::Ptr | defaultMimeTypePtr ()
static KMimeType::Ptr | diagnoseFileName (const QString &file, QString &pattern)
Static Public Member Functions inherited from KServiceType
static Ptr | serviceType (const QString &_name)
static KService::List | offers (const QString &_servicetype)
static List | allServiceTypes ()

## Protected Member Functions

virtual QPixmap | pixmap (KIcon::Group group, int force_size=0, int state=0, QString *path=0L) const
virtual void | virtual_hook (int id, void *data)
Protected Member Functions inherited from KMimeType
void | loadInternal (QDataStream &)
void | init (KDesktopFile *)
int | patternsAccuracy () const
Protected Member Functions inherited from KServiceType
void | init (KDesktopFile *config)

## Static Protected Member Functions

static pid_t | runFSDevice (const KURL &_url, const KSimpleConfig &cfg)
static pid_t | runApplication (const KURL &_url, const QString &_serviceFile)
static pid_t | runLink (const KURL &_url, const KSimpleConfig &cfg)
static pid_t | runMimeType (const KURL &_url, const KSimpleConfig &cfg)
Static Protected Member Functions inherited from KMimeType
static void | errorMissingMimeType (const QString &_type)
static void | buildDefaultType ()
static void | checkEssentialMimeTypes ()

## Additional Inherited Members

Protected Attributes inherited from KMimeType
QStringList | m_lstPatterns
Protected Attributes inherited from KServiceType
QString | m_strName
QString | m_strIcon
QString | m_strComment
QMap< QString, QVariant > | m_mapProps
QMap< QString, QVariant::Type > | m_mapPropDefs
bool | m_bValid:1
bool | m_bDerived:1
Static Protected Attributes inherited from KMimeType
static bool | s_bChecked = false
static Ptr | s_pDefaultType = 0L

## Detailed Description

Mime type for desktop files.

Handles mount/umount icon, and user-defined properties. Mimetype for a .desktop file

Definition at line 506 of file kmimetype.h.

## Constructor & Destructor Documentation

KDEDesktopMimeType::KDEDesktopMimeType | ( | KDesktopFile * | config | ) |

inline

Construct a desktop mimetype and take all information from a desktop file.

Parameters

  config | the desktop configuration file that describes the mime type

Definition at line 534 of file kmimetype.h.

## Member Function Documentation

QValueList< KDEDesktopMimeType::Service > KDEDesktopMimeType::builtinServices | ( | const KURL & | _url | ) |

static

Returns a list of services for the given .desktop file that are handled by kio itself.

Namely mount/unmount for FSDevice files.

Returns
  the list of services

Definition at line 914 of file kmimetype.cpp.

QString KDEDesktopMimeType::comment | ( | const QString & | ,
|  | bool |
| ) |  | const

virtual

Returns the descriptive comment associated with the MIME type.

The arguments are unused, but provided so that KMimeType derived classes can use them.

Returns
  The descriptive comment associated with the MIME type, if any.

Reimplemented from KMimeType.

Definition at line 761 of file kmimetype.cpp.

QString KDEDesktopMimeType::comment | ( | const KURL & | ,
|  | bool |
| ) |  | const

virtual

Returns the descriptive comment associated with the MIME type.

The arguments are unused, but provided so that KMimeType derived classes can use them.

Returns
  The descriptive comment associated with the MIME type, if any.

Reimplemented from KMimeType.

Definition at line 770 of file kmimetype.cpp.

void KDEDesktopMimeType::executeService | ( | const QString & | path,
|  | KDEDesktopMimeType::Service & | service
| ) |  |

static

Parameters

  path | is the path of the desktop entry.
  service | the service to execute

Deprecated:
  , see the other executeService

Definition at line 1081 of file kmimetype.cpp.

void KDEDesktopMimeType::executeService | ( | const KURL::List & | urls,
|  | KDEDesktopMimeType::Service & | service
| ) |  |

static

Execute `service` on the list of `urls`.

Parameters

  urls | the list of urls
  service | the service to execute

Definition at line 1090 of file kmimetype.cpp.

QString KDEDesktopMimeType::icon | ( | const QString & | ,
|  | bool |
| ) |  | const

virtual

Return the filename of the icon associated with the mimetype.

The arguments are unused, but provided so that KMimeType-derived classes can use them (e.g. KFolderType uses the URL to return one out of 2 icons)

Returns
  The path to the icon associated with this MIME type.

Reimplemented from KMimeType.

Definition at line 695 of file kmimetype.cpp.

QString KDEDesktopMimeType::icon | ( | const KURL & | ,
|  | bool |
| ) |  | const

virtual

Return the filename of the icon associated with the mimetype.

The arguments are unused, but provided so that KMimeType-derived classes can use them (e.g. KFolderType uses the URL to return one out of 2 icons)

Returns
  The path to the icon associated with this MIME type.

Reimplemented from KMimeType.

Definition at line 704 of file kmimetype.cpp.

QPixmap KDEDesktopMimeType::pixmap | ( | const KURL & | _url,
|  | KIcon::Group | _group,
|  | int | _force_size = `0`,
|  | int | _state = `0`,
|  | QString * | _path = `0L`
| ) |  | const

virtual

Find the pixmap for a given file of this mimetype.

Convenience method that uses icon(), but also locates and load the pixmap.

Parameters

  _url | URL for the file.
  _group | The icon group where the icon is going to be used.
  _force_size | Override globallly configured icon size. Use 0 for the default size
  _state | The icon state, one of: KIcon::DefaultState, KIcon::ActiveState or KIcon::DisabledState.
  _path | Output parameter to get the full path. Seldom needed. Ignored if 0

Returns
  the pixmap of the URL, can be a default icon if not found

Reimplemented from KMimeType.

Definition at line 749 of file kmimetype.cpp.

virtual QPixmap KDEDesktopMimeType::pixmap | ( | KIcon::Group | group,
|  | int | force_size = `0`,
|  | int | state = `0`,
|  | QString * | path = `0L`
| ) |  | const

inline protected virtual

Use this function only if you don't have a special URL for which you search a pixmap.

This function is useful to find out, which icon is usually chosen for a certain mime type. Since no URL is passed, it is impossible to obey icon hints in desktop entries for example.

Parameters

  group | The icon group where the icon is going to be used.
  force_size | Override globallly configured icon size. Use 0 for the default size
  state | The icon state, one of: `KIcon::DefaultState`, `KIcon::ActiveState` or `KIcon::DisabledState`.
  path | Output parameter to get the full path. Seldom needed. Ignored if 0

Returns
  the pixmap of the mime type, can be a default icon if not found

Reimplemented from KMimeType.

Definition at line 606 of file kmimetype.h.

pid_t KDEDesktopMimeType::run | ( | const KURL & | _url,
|  | bool | _is_local
| ) |  |

static

Invokes the default action for the desktop entry.

If the desktop entry is not local, then only false is returned. Otherwise we would create a security problem. Only types Link and Mimetype could be followed.

Parameters

  _url | the url to run
  _is_local | true if the URL is local, false otherwise

Returns
  true on success and false on failure.

See also
  KRun::runURL

Definition at line 784 of file kmimetype.cpp.

QValueList< KDEDesktopMimeType::Service > KDEDesktopMimeType::userDefinedServices | ( | const QString & | path,
|  | bool | bLocalFiles
| ) |  |

static

Returns a list of services defined by the user as possible actions on the given .desktop file.

May include empty actions which represent where visual separators should appear in user-visible representations of those actions, such as separators in a menu.

Parameters

  path | the path to the desktop file describing the services
  bLocalFiles | true if those services are to be applied to local files only (if false, services that don't have u or U in the Exec line won't be taken into account).

Returns
  the list of user deviced actions

Definition at line 967 of file kmimetype.cpp.

QValueList< KDEDesktopMimeType::Service > KDEDesktopMimeType::userDefinedServices | ( | const QString & | path,
|  | KConfig & | config,
|  | bool | bLocalFiles
| ) |  |

static

Overload of userDefinedServices for speed purposes: it takes a KConfig* so that the caller can check things in the file without having it parsed twice.

Since
  3.4

Definition at line 973 of file kmimetype.cpp.

QValueList< KDEDesktopMimeType::Service > KDEDesktopMimeType::userDefinedServices | ( | const QString & | path,
|  | KConfig & | config,
|  | bool | bLocalFiles,
|  | const KURL::List & | file_list
| ) |  |

static

Overload of userDefinedServices but also allows you to pass a list of urls for this file.

This allows for the menu to be changed depending on the exact files via the X-KDE-GetActionMenu extension.

Since
  3.5

Definition at line 978 of file kmimetype.cpp.

The documentation for this class was generated from the following files:

- kmimetype.h
- kmimetype.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys