see if a wallpaper plugin can handle (import, display, etc) a given mimetype; this may be different from the drop types supported!

svn path=/trunk/KDE/kdelibs/; revision=1217338
This commit is contained in:
Aaron J. Seigo 2011-01-26 20:08:35 +00:00
parent fd20134a3e
commit f721ef40fc
2 changed files with 15 additions and 0 deletions

View File

@ -176,6 +176,12 @@ KPluginInfo::List Wallpaper::listWallpaperInfoForMimetype(const QString &mimetyp
return KPluginInfo::fromServices(offers);
}
bool Wallpaper::supportsMimetype(const QString &mimetype) const
{
return d->wallpaperDescription.isValid() &&
d->wallpaperDescription.service()->hasMimeType(mimetype);
}
Wallpaper *Wallpaper::load(const QString &wallpaperName, const QVariantList &args)
{
if (wallpaperName.isEmpty()) {

View File

@ -21,6 +21,7 @@
#ifndef PLASMA_WALLPAPER_H
#define PLASMA_WALLPAPER_H
#include <kmimetype.h>
#include <kplugininfo.h>
#include <plasma/plasma.h>
@ -177,6 +178,14 @@ class PLASMA_EXPORT Wallpaper : public QObject
*/
KServiceAction renderingMode() const;
/**
* @return true if the mimetype is supported by this wallpaper and
* can be used in renderering. Uses the MimeType= entry from
* the .desktop file, and can include mimetypes that may not be
* suitable for drag-and-drop purposes.
* @since 4.7
*/
bool supportsMimetype(const QString &mimetype) const;
/**
* Sets the rendering mode for this wallpaper.