kio Library API Documentation

KDEDesktopMimeType Class Reference

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

#include <kmimetype.h>

Inheritance diagram for KDEDesktopMimeType:

KMimeType KServiceType KSycocaEntry KShared List of all members.

Public Methods

virtual QString icon (const QString &_url, bool _is_local) const
 Return the filename of the icon associated with the mimetype.

virtual QString icon (const KURL &_url, bool _is_local) const
 This function differs from the above only in that a KURL may be provided instead of a QString for convenience.

virtual QPixmap pixmap (const KURL &_url, KIcon::Group _group, int _force_size=0, int _state=0, QString *_path=0L) const
 Find the pixmap for a given file of this mimetype.

virtual QString comment (const QString &_url, bool _is_local) const
 The arguments are unused, but provided so that KMimeType derived classes can use them.

virtual QString comment (const KURL &_url, bool _is_local) const
 This function differs from the above only in that a KURL may be provided instead of a QString for convenience.


Static Public Methods

QValueList< ServicebuiltinServices (const KURL &_url)
QValueList< ServiceuserDefinedServices (const QString &path, bool bLocalFiles)
void executeService (const QString &_path, KDEDesktopMimeType::Service &_service)
void executeService (const KURL::List &urls, KDEDesktopMimeType::Service &service)
 Execute service on the list of urls.

pid_t run (const KURL &_url, bool _is_local)
 Invokes the default action for the desktop entry.


Protected Methods

virtual QPixmap pixmap (KIcon::Group a, int b, int c, QString *d) const
 Use this function only if you don't have a special URL for which you search a pixmap.

virtual void virtual_hook (int id, void *data)

Detailed Description

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

Definition at line 339 of file kmimetype.h.


Member Function Documentation

QString KDEDesktopMimeType::icon const QString   _url,
bool    _is_local
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 557 of file kmimetype.cpp.

References KServiceType::icon(), and QString::isEmpty().

Referenced by icon().

QString KDEDesktopMimeType::icon const KURL   _url,
bool    _is_local
const [virtual]
 

This function differs from the above only in that a KURL may be provided instead of a QString for convenience.

Reimplemented from KMimeType.

Definition at line 566 of file kmimetype.cpp.

References KIO::findDeviceMountPoint(), icon(), KServiceType::icon(), QString::isEmpty(), QString::isNull(), and KURL::path().

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.
_state  The icon state, one of: KIcon::DefaultState, KIcon::ActiveState or KIcon::DisabledState.
_path  Output parameter to get the full path. Seldom needed.

Reimplemented from KMimeType.

Definition at line 596 of file kmimetype.cpp.

References KIcon::Group, KServiceType::icon(), KGlobal::iconLoader(), KURL::isLocalFile(), QPixmap::isNull(), and KIconLoader::loadIcon().

QString KDEDesktopMimeType::comment const QString   _url,
bool    _is_local
const [virtual]
 

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 608 of file kmimetype.cpp.

References KMimeType::comment(), and QString::isEmpty().

Referenced by comment().

QString KDEDesktopMimeType::comment const KURL   _url,
bool    _is_local
const [virtual]
 

This function differs from the above only in that a KURL may be provided instead of a QString for convenience.

Reimplemented from KMimeType.

Definition at line 617 of file kmimetype.cpp.

References comment(), KMimeType::comment(), QString::isEmpty(), and KURL::path().

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.

Definition at line 756 of file kmimetype.cpp.

References QValueList::append(), KMessageBox::error(), KIO::findDeviceMountPoint(), QString::isEmpty(), KURL::isLocalFile(), KDEDesktopMimeType::Service::m_strName, KDEDesktopMimeType::Service::m_type, KIO::mount(), KURL::path(), and KIO::unmount().

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.
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).

Definition at line 809 of file kmimetype.cpp.

References QValueList::append(), QString::contains(), KStdAccel::end(), KMessageBox::error(), KStandardDirs::findExe(), QString::isEmpty(), KDEDesktopMimeType::Service::m_display, KDEDesktopMimeType::Service::m_strExec, KDEDesktopMimeType::Service::m_strIcon, KDEDesktopMimeType::Service::m_strName, KDEDesktopMimeType::Service::m_type, and QString::prepend().

void KDEDesktopMimeType::executeService const QString   _path,
KDEDesktopMimeType::Service   _service
[static]
 

Parameters:
_path  is the path of the desktop entry.
Deprecated:
, see the other executeService

Definition at line 879 of file kmimetype.cpp.

References KURL::setPath().

void KDEDesktopMimeType::executeService const KURL::List   urls,
KDEDesktopMimeType::Service   service
[static]
 

Execute service on the list of urls.

Definition at line 888 of file kmimetype.cpp.

References KMessageBox::error(), KIO::findDeviceMountPoint(), QString::isEmpty(), KDEDesktopMimeType::Service::m_strExec, KDEDesktopMimeType::Service::m_strIcon, KDEDesktopMimeType::Service::m_strName, KDEDesktopMimeType::Service::m_type, and KRun::run().

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.

Returns:
true on success and false on failure.
See also:
KRun::runURL

Definition at line 631 of file kmimetype.cpp.

References KMessageBox::error(), QString::isEmpty(), and KURL::path().

Referenced by KRun::runURL().

virtual QPixmap KDEDesktopMimeType::pixmap KIcon::Group    a,
int    b,
int    c,
QString   d
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.
_state  The icon state, one of: KIcon::DefaultState, KIcon::ActiveState or KIcon::DisabledState.
_path  Output parameter to get the full path. Seldom needed.

Reimplemented from KMimeType.

Definition at line 411 of file kmimetype.h.

References KIcon::Group, and KMimeType::pixmap().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:34 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001