Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMimeType Class Reference
[QtBaseModule]

The QMimeType class provides MIME type information. More...

    #include <QMimeType>

Public Types

Public Functions

Static Public Members


Detailed Description

The QMimeType class provides MIME type information.

A QMimeType object is a light-weight value which provides MIME type information.


Member Type Documentation

enum QMimeType::IconType

IconType describes the properties of the content an icon represents.

ConstantValueDescription
QMimeType::Default0The icon is displayed for content with no special properties.
QMimeType::DrmValid1The icon is displayed for drm protected content with current valid rights.
QMimeType::DrmInvalid2The icon is displayed for drm protected content with no current valid rights.


Member Function Documentation

QMimeType::QMimeType ()

Constructs a null QMimeType.

QMimeType::QMimeType ( const QString & ext_or_id )

Constructs a QMimeType object. If the parameter ext_or_id is a MIME type, it is interpreted as a filename if all of the following conditions hold:

Otherwise, if it is interpreted as a file name, the file extension (ie, for /foo/bar.txt this will be .txt) is used to determine the MIME type. If it does not appear to be a registered file extension, or a valid file, then it is treated as an unknown MIME type.

QMimeType::QMimeType ( const QContent & lnk )

Constructs a QMimeType from the type() of lnk.

QMimeType::QMimeType ( const QMimeType & other )

Constructs a copy of the QMimeType other.

void QMimeType::addAssociation ( const QString & mimeType, const QString & application, const QString & icon, QDrmRights::Permission permission )   [static]

Adds an association to the system between a mimeType and an application, with icon and permission.

QContent QMimeType::application () const

Returns the QContent of the default application associated with this MIME type, or an invalid QContent if none is associated.

See also QtopiaService::binding().

QContentList QMimeType::applications () const

Returns a list of QContent objects of the applications associated with this MIME type, or an empty list if none is associated.

QContentList QMimeType::applicationsFor ( const QContent & content )   [static]

Returns a list of applications that have registered associations with the mimetype of the content object.

QContentList QMimeType::applicationsFor ( const QMimeType & mimeType )   [static]

This is an overloaded member function, provided for convenience.

Returns a list of applications that have registered associations with the mimeType.

QContent QMimeType::defaultApplicationFor ( const QContent & content )   [static]

Returns the system marked default from the list of applications that have registered associations with the mimetype of the content object.

See also setDefaultApplicationFor().

QContent QMimeType::defaultApplicationFor ( const QMimeType & mimeType )   [static]

This is an overloaded member function, provided for convenience.

Returns the system marked default from the list of applications that have registered associations with the mimeType.

QString QMimeType::description () const

Returns a description of the MIME Type. This is usually based on the application() associated with the type.

QString QMimeType::extension () const

Returns the first extension associated with the MIME type.

QStringList QMimeType::extensions () const

Returns the list of file extensions associated with the MIME type.

QMimeType QMimeType::fromExtension ( const QString & extension )   [static]

Constructs a QMimeType from a file extension.

To note, do not include the period.

QMimeType QMimeType::fromFileName ( const QString & fileName )   [static]

Constructs a QMimeType from a fileName.

QMimeType QMimeType::fromId ( const QString & mimeId )   [static]

Constructs a QMimeType from the mime type ID string mimeId.

This does not perform any validation of the mime type ID, if validation is required consider using the QMimeType() constructor instead.

QIcon QMimeType::icon ( IconType iconType = Default ) const

Returns an iconType icon appropriate for the MIME type.

QString QMimeType::id () const

Returns the MIME type identifier. eg. image/jpeg

bool QMimeType::isNull () const

Returns true if the QMimeType is null.

QDrmRights::Permission QMimeType::permission () const

Returns the permission type used by the associated application to open a file of this MIME type. If no application is associated or the application does not support DRM, then QDrmRights::Unrestricted is returned.

QList<QDrmRights::Permission> QMimeType::permissions () const

Returns the permissions used by the associated applications. Permissions are mapped one to one with the list returned by applications().

void QMimeType::removeAssociation ( const QString & mimeType, const QString & application )   [static]

Removes an association from the system between a mimeType and an application.

void QMimeType::setDefaultApplicationFor ( const QString & mimeType, const QContent & content )   [static]

Set the system marked default from the list of applications that have registered associations with the mimeType to the content object.

See also defaultApplicationFor().

QMimeType & QMimeType::operator= ( const QMimeType & other )

Assigns the value of the QMimeType other to a mime type.

bool QMimeType::operator== ( const QMimeType & other ) const

Compares the mime type with the QMimeType other and returns true if they are equal.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3