diff --git a/applet.cpp b/applet.cpp index e636ddb21..b55548384 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1139,7 +1139,7 @@ KPluginInfo::List Applet::listAppletInfo(const QString &category, KPluginInfo::List Applet::listAppletInfoForMimetype(const QString &mimetype) { - QString constraint = QString("'%1' in MimeTypes").arg(mimetype); + QString constraint = QString("'%1' in [X-Plasma-DropMimeTypes]").arg(mimetype); //kDebug() << "listAppletInfoForMimetype with" << mimetype << constraint; KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint); return KPluginInfo::fromServices(offers); diff --git a/containment.cpp b/containment.cpp index 80aec9adb..3ecce7a05 100644 --- a/containment.cpp +++ b/containment.cpp @@ -676,7 +676,7 @@ KPluginInfo::List Containment::listContainments(const QString &category, KPluginInfo::List Containment::listContainmentsForMimetype(const QString &mimetype) { - QString constraint = QString("'%1' in MimeTypes").arg(mimetype); + QString constraint = QString("'%1' in [X-Plasma-DropMimeTypes]").arg(mimetype); //kDebug() << mimetype << constraint; KService::List offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint); return KPluginInfo::fromServices(offers); @@ -713,7 +713,24 @@ void Containment::dropEvent(QGraphicsSceneDragDropEvent *event) } else { //TODO: should we show a dialog here to choose which plasmoid load if //!appletList.isEmpty() - addApplet(appletList.first().pluginName(), args, geom); + QMenu choices; + QHash actionsToPlugins; + foreach (const KPluginInfo &info, appletList) { + QAction *action; + if (!info.icon().isEmpty()) { + action = choices.addAction(KIcon(info.icon()), info.name()); + } else { + action = choices.addAction(info.name()); + } + + actionsToPlugins.insert(action, info.pluginName()); + } + + actionsToPlugins.insert(choices.addAction(i18n("Icon")), "icon"); + QAction *choice = choices.exec(event->screenPos()); + if (choice) { + addApplet(actionsToPlugins[choice], args, geom); + } } } event->acceptProposedAction(); diff --git a/servicetypes/plasma-applet.desktop b/servicetypes/plasma-applet.desktop index ea59221b5..3f9bf0ef1 100644 --- a/servicetypes/plasma-applet.desktop +++ b/servicetypes/plasma-applet.desktop @@ -59,3 +59,6 @@ Comment[zh_TW]=Plasma 小程式 [PropertyDef::X-Plasma-API] Type=QString +[PropertyDef::X-Plasma-DropMimeTypes] +Type=QStringList +