Mime ddata support in runners
svn path=/trunk/KDE/kdelibs/; revision=1093881
This commit is contained in:
parent
3a2a21d34a
commit
da3fcc1b67
@ -22,6 +22,7 @@
|
||||
#include <QAction>
|
||||
#include <QHash>
|
||||
#include <QMenu>
|
||||
#include <QMimeData>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QTimer>
|
||||
@ -184,6 +185,11 @@ void AbstractRunner::clearActions()
|
||||
d->actions.clear();
|
||||
}
|
||||
|
||||
QMimeData * AbstractRunner::setupMimeDataForMatch(const QueryMatch *match)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AbstractRunner::hasRunOptions()
|
||||
{
|
||||
return d->hasRunOptions;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <plasma/version.h>
|
||||
|
||||
class QAction;
|
||||
class QMimeData;
|
||||
|
||||
class KCompletion;
|
||||
|
||||
@ -443,6 +444,12 @@ class PLASMA_EXPORT AbstractRunner : public QObject
|
||||
protected Q_SLOTS:
|
||||
void init();
|
||||
|
||||
/**
|
||||
* Reimplement this slot if you want your runner
|
||||
* to support serialization and drag and drop
|
||||
*/
|
||||
QMimeData * setupMimeDataForMatch(const Plasma::QueryMatch *match);
|
||||
|
||||
private:
|
||||
friend class RunnerScript;
|
||||
|
||||
|
@ -542,6 +542,28 @@ QList<QAction*> RunnerManager::actionsForMatch(const QueryMatch &match)
|
||||
return QList<QAction*>();
|
||||
}
|
||||
|
||||
QMimeData * RunnerManager::mimeDataForMatch(const QString &id) const
|
||||
{
|
||||
return mimeDataForMatch(d->context.match(id));
|
||||
}
|
||||
|
||||
|
||||
QMimeData * RunnerManager::mimeDataForMatch(const QueryMatch &match) const
|
||||
{
|
||||
AbstractRunner *runner = match.runner();
|
||||
QMimeData * mimeData;
|
||||
if (runner && QMetaObject::invokeMethod(
|
||||
runner,
|
||||
"setupMimeDataForMatch", Qt::DirectConnection,
|
||||
Q_RETURN_ARG(QMimeData*, mimeData),
|
||||
Q_ARG(const Plasma::QueryMatch *, & match)
|
||||
)) {
|
||||
return mimeData;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RunnerManager::setupMatchSession()
|
||||
{
|
||||
d->teardownRequested = false;
|
||||
|
@ -168,6 +168,18 @@ class PLASMA_EXPORT RunnerManager : public QObject
|
||||
*/
|
||||
QStringList allowedRunners() const;
|
||||
|
||||
/**
|
||||
* @return mime data of the specified match
|
||||
* @since 4.5
|
||||
*/
|
||||
QMimeData * mimeDataForMatch(const QueryMatch &match) const;
|
||||
|
||||
/**
|
||||
* @return mime data of the specified match
|
||||
* @since 4.5
|
||||
*/
|
||||
QMimeData * mimeDataForMatch(const QString &id) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Call this method when the runners should be prepared for a query session.
|
||||
|
Loading…
Reference in New Issue
Block a user