move our data files into a common place with some decent organization

svn path=/trunk/KDE/kdelibs/; revision=1019549
This commit is contained in:
Aaron J. Seigo 2009-09-03 20:40:22 +00:00
parent 2d9352d7b8
commit e41352c6ec
21 changed files with 81 additions and 25 deletions

View File

@ -318,28 +318,28 @@ if(PHONON_FOUND)
endif(PHONON_FOUND)
install(FILES
servicetypes/plasma-animator.desktop
servicetypes/plasma-applet.desktop
servicetypes/plasma-applet-popupapplet.desktop
servicetypes/plasma-containment.desktop
servicetypes/plasma-containmentactions.desktop
servicetypes/plasma-dataengine.desktop
servicetypes/plasma-packagestructure.desktop
servicetypes/plasma-runner.desktop
servicetypes/plasma-scriptengine.desktop
servicetypes/plasma-wallpaper.desktop
data/servicetypes/plasma-animator.desktop
data/servicetypes/plasma-applet.desktop
data/servicetypes/plasma-applet-popupapplet.desktop
data/servicetypes/plasma-containment.desktop
data/servicetypes/plasma-containmentactions.desktop
data/servicetypes/plasma-dataengine.desktop
data/servicetypes/plasma-packagestructure.desktop
data/servicetypes/plasma-runner.desktop
data/servicetypes/plasma-scriptengine.desktop
data/servicetypes/plasma-wallpaper.desktop
DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES
servicetypes/plasma-applet-extenderapplet.desktop
data/servicetypes/plasma-applet-extenderapplet.desktop
DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES scripting/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
install(FILES data/knewstuff/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
install(FILES kconfig_updates/plasma_popupapplet_fix_groups.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
install(PROGRAMS kconfig_updates/plasma_popupapplet_fix_groups.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
install(FILES operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/kconfig_updates/plasma_popupapplet_fix_groups.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
install(PROGRAMS data/kconfig_updates/plasma_popupapplet_fix_groups.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
########### next target ###############

View File

@ -1109,6 +1109,16 @@ void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
break;
}
}
if (!event->isAccepted()) {
foreach (const QString &format, formats) {
KPluginInfo::List wallpaperList = Wallpaper::listWallpaperInfoForMimetype(format);
if (!wallpaperList.isEmpty()) {
event->setAccepted(true);
break;
}
}
}
}
if (event->isAccepted() && view()) {
@ -1199,13 +1209,17 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
//kDebug() << "can decode" << mimeName << args;
//kDebug() << "protocol:" << url.protocol();
KPluginInfo::List appletList = Applet::listAppletInfoForMimetype(mimeName);
KPluginInfo::List wallpaperList;
if (q->drawWallpaper()) {
wallpaperList = Wallpaper::listWallpaperInfoForMimetype(mimeName);
}
if (!appletList.isEmpty()) {
if (!appletList.isEmpty() || !wallpaperList.isEmpty()) {
// The mimetype is known, i.e. there are applet that can load this mimetype
// Offer the applets in a popupmenu
kDebug() << "Local file.";
QMenu choices;
QHash<QAction *, QString> actionsToPlugins;
//kDebug() << "Local file.";
KMenu choices;
QHash<QAction *, QString> actionsToApplets;
foreach (const KPluginInfo &info, appletList) {
QAction *action;
if (!info.icon().isEmpty()) {
@ -1214,13 +1228,34 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
action = choices.addAction(info.name());
}
actionsToPlugins.insert(action, info.pluginName());
actionsToApplets.insert(action, info.pluginName());
}
actionsToApplets.insert(choices.addAction(i18n("Icon")), "icon");
QHash<QAction *, QString> actionsToWallpapers;
if (!wallpaperList.isEmpty()) {
choices.addTitle(i18n("Set As Wallpaper"));
foreach (const KPluginInfo &info, wallpaperList) {
QAction *action;
if (!info.icon().isEmpty()) {
action = choices.addAction(KIcon(info.icon()), info.name());
} else {
action = choices.addAction(info.name());
}
actionsToWallpapers.insert(action, info.pluginName());
}
}
actionsToPlugins.insert(choices.addAction(i18n("Icon")), "icon");
QAction *choice = choices.exec(screenPos);
if (choice) {
q->addApplet(actionsToPlugins[choice], args, geom);
QString plugin = actionsToApplets.value(choice);
if (plugin.isEmpty()) {
//set wallpapery stuff
plugin = actionsToWallpapers.value(choice);
} else {
q->addApplet(actionsToApplets[choice], args, geom);
}
}
} else if (url.protocol() != "data") { // Why not data:?

View File

@ -25,7 +25,7 @@
#include <QPaintEngine>
#include <QPixmap>
#include "effects/blur.cpp"
#include "private/effects/blur.cpp"
namespace Plasma
{

View File

@ -77,7 +77,6 @@ Wallpaper::~Wallpaper()
KPluginInfo::List Wallpaper::listWallpaperInfo(const QString &formFactor)
{
QString constraint;
if (!formFactor.isEmpty()) {
constraint.append("[X-Plasma-FormFactors] ~~ '").append(formFactor).append("'");
}
@ -86,6 +85,18 @@ KPluginInfo::List Wallpaper::listWallpaperInfo(const QString &formFactor)
return KPluginInfo::fromServices(offers);
}
KPluginInfo::List Wallpaper::listWallpaperInfoForMimetype(const QString &mimetype, const QString &formFactor)
{
QString constraint = QString("'%1' in [X-Plasma-DropMimeTypes]").arg(mimetype);
if (!formFactor.isEmpty()) {
constraint.append("[X-Plasma-FormFactors] ~~ '").append(formFactor).append("'");
}
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Wallpaper", constraint);
kDebug() << offers.count() << constraint;
return KPluginInfo::fromServices(offers);
}
Wallpaper *Wallpaper::load(const QString &wallpaperName, const QVariantList &args)
{
if (wallpaperName.isEmpty()) {

View File

@ -86,10 +86,20 @@ class PLASMA_EXPORT Wallpaper : public QObject
/**
* Returns a list of all known wallpapers.
*
* @arg formFactor the format of the wallpaper being search for (e.g. desktop)
* @return list of wallpapers
**/
static KPluginInfo::List listWallpaperInfo(const QString &formFactor = QString());
/**
* Returns a list of all known wallapers that can accept the given mimetype
* @arg mimetype the mimetype to search for
* @arg formFactor the format of the wallpaper being search for (e.g. desktop)
* @return list of wallpapers
*/
static KPluginInfo::List listWallpaperInfoForMimetype(const QString &mimetype,
const QString &formFactor = QString());
/**
* Attempts to load a wallpaper
*