diff --git a/querymatch.cpp b/querymatch.cpp index 2723c0574..d19c4a5ea 100644 --- a/querymatch.cpp +++ b/querymatch.cpp @@ -65,6 +65,8 @@ class QueryMatchPrivate : public QSharedData subtext = other.subtext; icon = other.icon; data = other.data; + mimeType = other.mimeType; + urls = other.urls; } ~QueryMatchPrivate() @@ -78,6 +80,8 @@ class QueryMatchPrivate : public QSharedData QString id; QString text; QString subtext; + QString mimeType; + QList urls; QIcon icon; QVariant data; qreal relevance; @@ -210,6 +214,30 @@ QIcon QueryMatch::icon() const return d->icon; } +void QueryMatch::setMimeType(const QString &mimeType) +{ + QWriteLocker locker(d->lock); + d->mimeType = mimeType; +} + +QString QueryMatch::mimeType() const +{ + QReadLocker locker(d->lock); + return d->mimeType; +} + +void QueryMatch::setUrls(const QList &urls) +{ + QWriteLocker locker(d->lock); + d->urls = urls; +} + +QList QueryMatch::urls() const +{ + QReadLocker locker(d->lock); + return d->urls; +} + void QueryMatch::setEnabled(bool enabled) { d->enabled = enabled; diff --git a/querymatch.h b/querymatch.h index 7e3133c30..48b2dacf6 100644 --- a/querymatch.h +++ b/querymatch.h @@ -21,6 +21,7 @@ #define PLASMA_QUERYMATCH_H #include +#include #include #include @@ -92,6 +93,15 @@ class PLASMA_EXPORT QueryMatch */ AbstractRunner *runner() const; + /** + * Requests this match to activae using the given context + * + * @param context the context to use in conjunction with this run + * + * @sa AbstractRunner::run + */ + void run(const RunnerContext &context) const; + /** * @return true if the match is valid and can therefore be run, * an invalid match does not have an associated AbstractRunner @@ -124,15 +134,6 @@ class PLASMA_EXPORT QueryMatch */ qreal relevance() const; - /** - * Requests this match to activae using the given context - * - * @param context the context to use in conjunction with this run - * - * @sa AbstractRunner::run - */ - void run(const RunnerContext &context) const; - /** * Sets data to be used internally by the associated * AbstractRunner. @@ -208,6 +209,28 @@ class PLASMA_EXPORT QueryMatch */ QIcon icon() const; + /** + * Sets the MimeType, if any, associated with this match. + * This overrides the MimeType provided by QueryContext, and should only be + * set when it is different from the QueryContext MimeType + */ + void setMimeType(const QString &mimeType); + + /** + * @return the mimtype for this match, or QString() is none + */ + QString mimeType() const; + + /** + * Sets the urls, if any, associated with this match + */ + void setUrls(const QList &urls); + + /** + * @return the mimtype for this match, or QString() is none + */ + QList urls() const; + /** * Sets whether or not this match can be activited *