SearchContext -> RunnerContext
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=803041
This commit is contained in:
parent
bbddbccd1b
commit
f55bbb73f9
@ -41,9 +41,9 @@ set(plasma_LIB_SRCS
|
|||||||
packages.cpp
|
packages.cpp
|
||||||
plasma.cpp
|
plasma.cpp
|
||||||
plasma_export.h
|
plasma_export.h
|
||||||
|
runnercontext.cpp
|
||||||
runnermanager.cpp
|
runnermanager.cpp
|
||||||
searchmatch.cpp
|
searchmatch.cpp
|
||||||
searchcontext.cpp
|
|
||||||
shadowitem.cpp
|
shadowitem.cpp
|
||||||
svg.cpp
|
svg.cpp
|
||||||
panelsvg.cpp
|
panelsvg.cpp
|
||||||
@ -114,9 +114,9 @@ set(plasma_LIB_INCLUDES
|
|||||||
dialog.h
|
dialog.h
|
||||||
plasma.h
|
plasma.h
|
||||||
plasma_export.h
|
plasma_export.h
|
||||||
|
runnercontext.h
|
||||||
runnermanager.h
|
runnermanager.h
|
||||||
searchmatch.h
|
searchmatch.h
|
||||||
searchcontext.h
|
|
||||||
shadowitem_p.h
|
shadowitem_p.h
|
||||||
svg.h
|
svg.h
|
||||||
panelsvg.h
|
panelsvg.h
|
||||||
@ -172,7 +172,7 @@ install(FILES
|
|||||||
includes/DataContainer
|
includes/DataContainer
|
||||||
includes/DataEngine
|
includes/DataEngine
|
||||||
includes/DataEngineManager
|
includes/DataEngineManager
|
||||||
includes/SearchContext
|
includes/RunnerContext
|
||||||
includes/SearchMatch
|
includes/SearchMatch
|
||||||
includes/Svg
|
includes/Svg
|
||||||
includes/PanelSvg
|
includes/PanelSvg
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "scripting/runnerscript.h"
|
#include "scripting/runnerscript.h"
|
||||||
|
|
||||||
#include "searchcontext.h"
|
#include "runnercontext.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
bool hasConfig;
|
bool hasConfig;
|
||||||
Priority priority;
|
Priority priority;
|
||||||
Speed speed;
|
Speed speed;
|
||||||
SearchContext::Types blackListed;
|
RunnerContext::Types blackListed;
|
||||||
RunnerScript* script;
|
RunnerScript* script;
|
||||||
KPluginInfo runnerDescription;
|
KPluginInfo runnerDescription;
|
||||||
AbstractRunner* runner;
|
AbstractRunner* runner;
|
||||||
@ -118,14 +118,14 @@ KConfigGroup AbstractRunner::config() const
|
|||||||
return KConfigGroup(&runners, group);
|
return KConfigGroup(&runners, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRunner::performMatch( Plasma::SearchContext &globalContext )
|
void AbstractRunner::performMatch( Plasma::RunnerContext &globalContext )
|
||||||
{
|
{
|
||||||
static const int reasonableRunTime = 1500;
|
static const int reasonableRunTime = 1500;
|
||||||
static const int fastEnoughTime = 250;
|
static const int fastEnoughTime = 250;
|
||||||
|
|
||||||
d->runtime.restart();
|
d->runtime.restart();
|
||||||
//TODO :this is a copy ctor
|
//TODO :this is a copy ctor
|
||||||
SearchContext localContext(globalContext,0);
|
RunnerContext localContext(globalContext,0);
|
||||||
match(&localContext);
|
match(&localContext);
|
||||||
// automatically rate limit runners that become slooow
|
// automatically rate limit runners that become slooow
|
||||||
const int runtime = d->runtime.elapsed();
|
const int runtime = d->runtime.elapsed();
|
||||||
@ -202,12 +202,12 @@ void AbstractRunner::setPriority(Priority priority)
|
|||||||
d->priority = priority;
|
d->priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchContext::Types AbstractRunner::ignoredTypes() const
|
RunnerContext::Types AbstractRunner::ignoredTypes() const
|
||||||
{
|
{
|
||||||
return d->blackListed;
|
return d->blackListed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRunner::setIgnoredTypes(SearchContext::Types types)
|
void AbstractRunner::setIgnoredTypes(RunnerContext::Types types)
|
||||||
{
|
{
|
||||||
d->blackListed = types;
|
d->blackListed = types;
|
||||||
}
|
}
|
||||||
@ -225,14 +225,14 @@ QMutex* AbstractRunner::bigLock() const
|
|||||||
return &Private::bigLock;
|
return &Private::bigLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRunner::run(const Plasma::SearchContext *search, const Plasma::SearchMatch *action)
|
void AbstractRunner::run(const Plasma::RunnerContext *search, const Plasma::SearchMatch *action)
|
||||||
{
|
{
|
||||||
if (d->script) {
|
if (d->script) {
|
||||||
return d->script->run(search, action);
|
return d->script->run(search, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRunner::match(Plasma::SearchContext *search)
|
void AbstractRunner::match(Plasma::RunnerContext *search)
|
||||||
{
|
{
|
||||||
if (d->script) {
|
if (d->script) {
|
||||||
return d->script->match(search);
|
return d->script->match(search);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <KDE/KService>
|
#include <KDE/KService>
|
||||||
|
|
||||||
#include <plasma/plasma_export.h>
|
#include <plasma/plasma_export.h>
|
||||||
#include <plasma/searchcontext.h>
|
#include <plasma/runnercontext.h>
|
||||||
#include <plasma/searchmatch.h>
|
#include <plasma/searchmatch.h>
|
||||||
|
|
||||||
class KCompletion;
|
class KCompletion;
|
||||||
@ -70,14 +70,14 @@ class PLASMA_EXPORT AbstractRunner : public QObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main query method. It should trigger creation of
|
* This is the main query method. It should trigger creation of
|
||||||
* SearchMatch instances through SearchContext::addInformationalMatch,
|
* SearchMatch instances through RunnerContext::addInformationalMatch,
|
||||||
* SearchContext::addExactMatch, and SearchContext::addPossibleMatch.
|
* RunnerContext::addExactMatch, and RunnerContext::addPossibleMatch.
|
||||||
*
|
*
|
||||||
* If the runner can run precisely the requested term (SearchContext::searchTerm),
|
* If the runner can run precisely the requested term (RunnerContext::searchTerm),
|
||||||
* it should create an exact match (SearchContext::addExactMatch).
|
* it should create an exact match (RunnerContext::addExactMatch).
|
||||||
* The first runner that creates a SearchMatch will be the
|
* The first runner that creates a SearchMatch will be the
|
||||||
* default runner. Other runner's matches will be suggested in the
|
* default runner. Other runner's matches will be suggested in the
|
||||||
* interface. Non-exact matches should be offered via SearchContext::addPossibleMatch.
|
* interface. Non-exact matches should be offered via RunnerContext::addPossibleMatch.
|
||||||
*
|
*
|
||||||
* The match will be activated if the user selects it.
|
* The match will be activated if the user selects it.
|
||||||
*
|
*
|
||||||
@ -89,14 +89,14 @@ class PLASMA_EXPORT AbstractRunner : public QObject
|
|||||||
* to return from this method right away, nor to create all matches
|
* to return from this method right away, nor to create all matches
|
||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
virtual void match(Plasma::SearchContext *search);
|
virtual void match(Plasma::RunnerContext *search);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggers a call to match.
|
* Triggers a call to match.
|
||||||
*
|
*
|
||||||
* @arg globalContext the search context used in executing this match.
|
* @arg globalContext the search context used in executing this match.
|
||||||
*/
|
*/
|
||||||
void performMatch(Plasma::SearchContext &globalContext);
|
void performMatch(Plasma::RunnerContext &globalContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the runner has options that the user can interact with to modify
|
* If the runner has options that the user can interact with to modify
|
||||||
@ -132,7 +132,7 @@ class PLASMA_EXPORT AbstractRunner : public QObject
|
|||||||
* Called whenever an exact or possible match associated with this
|
* Called whenever an exact or possible match associated with this
|
||||||
* runner is triggered.
|
* runner is triggered.
|
||||||
*/
|
*/
|
||||||
virtual void run(const Plasma::SearchContext *context, const Plasma::SearchMatch *action);
|
virtual void run(const Plasma::RunnerContext *context, const Plasma::SearchMatch *action);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The nominal speed of the runner.
|
* The nominal speed of the runner.
|
||||||
@ -147,17 +147,17 @@ class PLASMA_EXPORT AbstractRunner : public QObject
|
|||||||
Priority priority() const;
|
Priority priority() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the OR'ed value of all the Information types (as defined in SearchContext::Type)
|
* Returns the OR'ed value of all the Information types (as defined in RunnerContext::Type)
|
||||||
* this runner is not interested in.
|
* this runner is not interested in.
|
||||||
* @return OR'ed value of black listed types
|
* @return OR'ed value of black listed types
|
||||||
*/
|
*/
|
||||||
SearchContext::Types ignoredTypes() const;
|
RunnerContext::Types ignoredTypes() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the types this runner will ignore
|
* Sets the types this runner will ignore
|
||||||
* @param types OR'ed listed of ignored types
|
* @param types OR'ed listed of ignored types
|
||||||
*/
|
*/
|
||||||
void setIgnoredTypes(SearchContext::Types types);
|
void setIgnoredTypes(RunnerContext::Types types);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the engine name for the Runner
|
* Returns the engine name for the Runner
|
||||||
|
1
includes/RunnerContext
Normal file
1
includes/RunnerContext
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "../../plasma/runnercontext.h"
|
@ -1 +0,0 @@
|
|||||||
#include "../../plasma/searchcontext.h"
|
|
@ -17,7 +17,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "searchcontext.h"
|
#include "runnercontext.h"
|
||||||
|
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
|
|
||||||
@ -37,18 +37,18 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
class SearchContext::Private : public QSharedData
|
class RunnerContext::Private : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(SearchContext *context, SearchContext::DataPolicy p)
|
Private(RunnerContext *context, RunnerContext::DataPolicy p)
|
||||||
: QSharedData(),
|
: QSharedData(),
|
||||||
type(SearchContext::UnknownType),
|
type(RunnerContext::UnknownType),
|
||||||
q(context),
|
q(context),
|
||||||
policy(p)
|
policy(p)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Private(const SearchContext::Private& p)
|
Private(const RunnerContext::Private& p)
|
||||||
: QSharedData(),
|
: QSharedData(),
|
||||||
term(p.term),
|
term(p.term),
|
||||||
mimeType(p.mimeType),
|
mimeType(p.mimeType),
|
||||||
@ -131,20 +131,20 @@ class SearchContext::Private : public QSharedData
|
|||||||
QList<SearchMatch*> matches;
|
QList<SearchMatch*> matches;
|
||||||
QString term;
|
QString term;
|
||||||
QString mimeType;
|
QString mimeType;
|
||||||
SearchContext::Type type;
|
RunnerContext::Type type;
|
||||||
SearchContext * q;
|
RunnerContext * q;
|
||||||
const SearchContext::DataPolicy policy;
|
const RunnerContext::DataPolicy policy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SearchContext::SearchContext(QObject *parent, DataPolicy policy)
|
RunnerContext::RunnerContext(QObject *parent, DataPolicy policy)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
d(new Private(this, policy))
|
d(new Private(this, policy))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//copy ctor
|
//copy ctor
|
||||||
SearchContext::SearchContext(SearchContext &other, QObject *parent)
|
RunnerContext::RunnerContext(RunnerContext &other, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
other.d->lockForRead();
|
other.d->lockForRead();
|
||||||
@ -152,35 +152,35 @@ SearchContext::SearchContext(SearchContext &other, QObject *parent)
|
|||||||
other.d->unlock();
|
other.d->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchContext::~SearchContext()
|
RunnerContext::~RunnerContext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchContext::reset()
|
void RunnerContext::reset()
|
||||||
{
|
{
|
||||||
// Locks are needed as other contexts can be copied of this one
|
// Locks are needed as other contexts can be copied of this one
|
||||||
|
|
||||||
// We will detach if we are a copy of someone. But we will reset
|
// We will detach if we are a copy of someone. But we will reset
|
||||||
// if we are the 'main' context others copied from. Resetting
|
// if we are the 'main' context others copied from. Resetting
|
||||||
// one SearchContext makes all the copies oneobsolete.
|
// one RunnerContext makes all the copies oneobsolete.
|
||||||
d.detach();
|
d.detach();
|
||||||
|
|
||||||
//kDebug() << "reset searchContext";
|
//kDebug() << "reset searchContext";
|
||||||
d->lockForWrite();
|
d->lockForWrite();
|
||||||
d->type = SearchContext::UnknownType;
|
d->type = RunnerContext::UnknownType;
|
||||||
d->term.clear();
|
d->term.clear();
|
||||||
d->mimeType.clear();
|
d->mimeType.clear();
|
||||||
d->unlock();
|
d->unlock();
|
||||||
|
|
||||||
// we still have to remove all the matches, since if the
|
// we still have to remove all the matches, since if the
|
||||||
// ref count was 1 (e.g. only the SearchContext is using
|
// ref count was 1 (e.g. only the RunnerContext is using
|
||||||
// the dptr) then we won't get a copy made
|
// the dptr) then we won't get a copy made
|
||||||
removeAllMatches();
|
removeAllMatches();
|
||||||
|
|
||||||
//kDebug() << "match count" << d->matches.count();
|
//kDebug() << "match count" << d->matches.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchContext::setSearchTerm(const QString &term)
|
void RunnerContext::setSearchTerm(const QString &term)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ void SearchContext::setSearchTerm(const QString &term)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString SearchContext::searchTerm() const
|
QString RunnerContext::searchTerm() const
|
||||||
{
|
{
|
||||||
d->lockForRead();
|
d->lockForRead();
|
||||||
QString term = d->term;
|
QString term = d->term;
|
||||||
@ -203,17 +203,17 @@ QString SearchContext::searchTerm() const
|
|||||||
return term;
|
return term;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchContext::Type SearchContext::type() const
|
RunnerContext::Type RunnerContext::type() const
|
||||||
{
|
{
|
||||||
return d->type;
|
return d->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SearchContext::mimeType() const
|
QString RunnerContext::mimeType() const
|
||||||
{
|
{
|
||||||
return d->mimeType;
|
return d->mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SearchContext::addMatches(const QString& term, const QList<SearchMatch*> &matches)
|
bool RunnerContext::addMatches(const QString& term, const QList<SearchMatch*> &matches)
|
||||||
{
|
{
|
||||||
if (searchTerm() != term || matches.isEmpty()) {
|
if (searchTerm() != term || matches.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
@ -230,7 +230,7 @@ bool SearchContext::addMatches(const QString& term, const QList<SearchMatch*> &m
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SearchContext::addMatch(const QString &term, SearchMatch *match)
|
bool RunnerContext::addMatch(const QString &term, SearchMatch *match)
|
||||||
{
|
{
|
||||||
if (searchTerm() != term) {
|
if (searchTerm() != term) {
|
||||||
return false;
|
return false;
|
||||||
@ -246,7 +246,7 @@ bool SearchContext::addMatch(const QString &term, SearchMatch *match)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<SearchMatch *> SearchContext::matches() const
|
QList<SearchMatch *> RunnerContext::matches() const
|
||||||
{
|
{
|
||||||
d->lockForRead();
|
d->lockForRead();
|
||||||
QList<SearchMatch *> matches = d->matches;
|
QList<SearchMatch *> matches = d->matches;
|
||||||
@ -254,7 +254,7 @@ QList<SearchMatch *> SearchContext::matches() const
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchContext::removeAllMatches()
|
void RunnerContext::removeAllMatches()
|
||||||
{
|
{
|
||||||
d->lockForWrite();
|
d->lockForWrite();
|
||||||
if (!d->matches.isEmpty()) {
|
if (!d->matches.isEmpty()) {
|
||||||
@ -273,4 +273,4 @@ void SearchContext::removeAllMatches()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "searchcontext.moc"
|
#include "runnercontext.moc"
|
@ -17,8 +17,8 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SEARCHCONTEXT_H
|
#ifndef RUNNERCONTEXT_H
|
||||||
#define SEARCHCONTEXT_H
|
#define RUNNERCONTEXT_H
|
||||||
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
@ -36,11 +36,11 @@ class SearchMatch;
|
|||||||
class AbstractRunner;
|
class AbstractRunner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short The SearchContext class provides information related to a search,
|
* @short The RunnerContext class provides information related to a search,
|
||||||
* including the search term, metadata on the search term and collected
|
* including the search term, metadata on the search term and collected
|
||||||
* matches.
|
* matches.
|
||||||
*/
|
*/
|
||||||
class PLASMA_EXPORT SearchContext : public QObject
|
class PLASMA_EXPORT RunnerContext : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -62,17 +62,17 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
SingleConsumer
|
SingleConsumer
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit SearchContext(QObject *parent = 0, DataPolicy policy = Shared);
|
explicit RunnerContext(QObject *parent = 0, DataPolicy policy = Shared);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a SearchContext with a DataPolicy of SingleConsumer that
|
* Constructs a RunnerContext with a DataPolicy of SingleConsumer that
|
||||||
* contains the search metadata (though none of the currently registered
|
* contains the search metadata (though none of the currently registered
|
||||||
* matches) from the passed in SearchContext. Primarily useful for creating
|
* matches) from the passed in RunnerContext. Primarily useful for creating
|
||||||
* a thread-local copy of a Shared SearchContext.
|
* a thread-local copy of a Shared RunnerContext.
|
||||||
*/
|
*/
|
||||||
explicit SearchContext(SearchContext& other, QObject *parent = 0);
|
explicit RunnerContext(RunnerContext& other, QObject *parent = 0);
|
||||||
|
|
||||||
~SearchContext();
|
~RunnerContext();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,7 +109,7 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends lists of matches to the list of matches.
|
* Appends lists of matches to the list of matches.
|
||||||
* The SearchContext takes over ownership of the matches on successful addition.
|
* The RunnerContext takes over ownership of the matches on successful addition.
|
||||||
*
|
*
|
||||||
* This method is thread safe and causes the matchesChanged() signal to be emitted.
|
* This method is thread safe and causes the matchesChanged() signal to be emitted.
|
||||||
*
|
*
|
||||||
@ -119,7 +119,7 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a match to the existing list of matches.
|
* Appends a match to the existing list of matches.
|
||||||
* The SearchContext takes over ownership of the match on successful addition.
|
* The RunnerContext takes over ownership of the match on successful addition.
|
||||||
*
|
*
|
||||||
* If you are going to be adding multiple matches, it is better to use
|
* If you are going to be adding multiple matches, it is better to use
|
||||||
* addMatches instead.
|
* addMatches instead.
|
||||||
@ -132,14 +132,14 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
bool addMatch(const QString &term, SearchMatch *match);
|
bool addMatch(const QString &term, SearchMatch *match);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes the matches from this SearchContext and copies to them another.
|
* Takes the matches from this RunnerContext and copies to them another.
|
||||||
* If successful, the matches are removed from this SearchContext and
|
* If successful, the matches are removed from this RunnerContext and
|
||||||
* ownership passed to the other SearchContext
|
* ownership passed to the other RunnerContext
|
||||||
*
|
*
|
||||||
* @arg other the SearchContext to move this object's Matches to
|
* @arg other the RunnerContext to move this object's Matches to
|
||||||
* @return true if matches were added, false if matches were e.g. outdated
|
* @return true if matches were added, false if matches were e.g. outdated
|
||||||
*/
|
*/
|
||||||
bool moveMatchesTo(SearchContext &other);
|
bool moveMatchesTo(RunnerContext &other);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all available matches for the current search term.
|
* Retrieves all available matches for the current search term.
|
||||||
@ -147,7 +147,7 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
QList<SearchMatch *> matches() const;
|
QList<SearchMatch *> matches() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all matches from this SearchContext.
|
* Removes all matches from this RunnerContext.
|
||||||
*/
|
*/
|
||||||
void removeAllMatches();
|
void removeAllMatches();
|
||||||
|
|
||||||
@ -161,6 +161,6 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS (Plasma::SearchContext::Types)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::RunnerContext::Types)
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -143,7 +143,7 @@ void RunnerRestrictionPolicy::destructed(Job* job)
|
|||||||
class FindMatchesJob : public Job
|
class FindMatchesJob : public Job
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FindMatchesJob(const QString& term, Plasma::AbstractRunner* runner, Plasma::SearchContext* context, QObject* parent = 0);
|
FindMatchesJob(const QString& term, Plasma::AbstractRunner* runner, Plasma::RunnerContext* context, QObject* parent = 0);
|
||||||
|
|
||||||
int priority() const;
|
int priority() const;
|
||||||
|
|
||||||
@ -151,12 +151,12 @@ protected:
|
|||||||
void run();
|
void run();
|
||||||
private:
|
private:
|
||||||
QString m_term;
|
QString m_term;
|
||||||
Plasma::SearchContext* m_context;
|
Plasma::RunnerContext* m_context;
|
||||||
Plasma::AbstractRunner* m_runner;
|
Plasma::AbstractRunner* m_runner;
|
||||||
};
|
};
|
||||||
|
|
||||||
FindMatchesJob::FindMatchesJob( const QString& term, Plasma::AbstractRunner* runner,
|
FindMatchesJob::FindMatchesJob( const QString& term, Plasma::AbstractRunner* runner,
|
||||||
Plasma::SearchContext* context, QObject* parent )
|
Plasma::RunnerContext* context, QObject* parent )
|
||||||
: ThreadWeaver::Job(parent),
|
: ThreadWeaver::Job(parent),
|
||||||
m_term(term),
|
m_term(term),
|
||||||
m_context(context),
|
m_context(context),
|
||||||
@ -263,7 +263,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
RunnerManager *q;
|
RunnerManager *q;
|
||||||
SearchContext context;
|
RunnerContext context;
|
||||||
AbstractRunner::List runners;
|
AbstractRunner::List runners;
|
||||||
QList<ThreadWeaver::Job*> searchJobs;
|
QList<ThreadWeaver::Job*> searchJobs;
|
||||||
QStringList prioritylist;
|
QStringList prioritylist;
|
||||||
@ -317,7 +317,7 @@ AbstractRunner* RunnerManager::runner(const QString &name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SearchContext* RunnerManager::searchContext() const
|
RunnerContext* RunnerManager::searchContext() const
|
||||||
{
|
{
|
||||||
return &d->context;
|
return &d->context;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
class SearchMatch;
|
class SearchMatch;
|
||||||
class AbstractRunner;
|
class AbstractRunner;
|
||||||
class SearchContext;
|
class RunnerContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short The RunnerManager class decides what installed runners are runnable,
|
* @short The RunnerManager class decides what installed runners are runnable,
|
||||||
@ -59,7 +59,7 @@ class PLASMA_EXPORT RunnerManager : public QObject
|
|||||||
* Retrieves the current context
|
* Retrieves the current context
|
||||||
* @return pointer to the current context
|
* @return pointer to the current context
|
||||||
*/
|
*/
|
||||||
SearchContext* searchContext() const;
|
RunnerContext* searchContext() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all available matches found so far for the previously launched query
|
* Retrieves all available matches found so far for the previously launched query
|
||||||
|
@ -52,12 +52,12 @@ AbstractRunner* RunnerScript::runner() const
|
|||||||
return d->runner;
|
return d->runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunnerScript::match(Plasma::SearchContext *search)
|
void RunnerScript::match(Plasma::RunnerContext *search)
|
||||||
{
|
{
|
||||||
Q_UNUSED(search)
|
Q_UNUSED(search)
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunnerScript::run(const Plasma::SearchContext *search, const Plasma::SearchMatch *action)
|
void RunnerScript::run(const Plasma::RunnerContext *search, const Plasma::SearchMatch *action)
|
||||||
{
|
{
|
||||||
Q_UNUSED(search)
|
Q_UNUSED(search)
|
||||||
Q_UNUSED(action)
|
Q_UNUSED(action)
|
||||||
|
@ -29,7 +29,7 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
|
|
||||||
class AbstractRunner;
|
class AbstractRunner;
|
||||||
class SearchContext;
|
class RunnerContext;
|
||||||
class SearchMatch;
|
class SearchMatch;
|
||||||
|
|
||||||
class PLASMA_EXPORT RunnerScript : public ScriptEngine
|
class PLASMA_EXPORT RunnerScript : public ScriptEngine
|
||||||
@ -59,16 +59,16 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the script should create SearchMatch instances through
|
* Called when the script should create SearchMatch instances through
|
||||||
* SearchContext::addInformationalMatch, SearchContext::addExactMatch, and
|
* RunnerContext::addInformationalMatch, RunnerContext::addExactMatch, and
|
||||||
* SearchContext::addPossibleMatch.
|
* RunnerContext::addPossibleMatch.
|
||||||
*/
|
*/
|
||||||
virtual void match(Plasma::SearchContext *search);
|
virtual void match(Plasma::RunnerContext *search);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called whenever an exact or possible match associated with this
|
* Called whenever an exact or possible match associated with this
|
||||||
* runner is triggered.
|
* runner is triggered.
|
||||||
*/
|
*/
|
||||||
virtual void run(const Plasma::SearchContext *search, const Plasma::SearchMatch *action);
|
virtual void run(const Plasma::RunnerContext *search, const Plasma::SearchMatch *action);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +144,7 @@ bool SearchMatch::operator<(const SearchMatch& other) const
|
|||||||
return d->relevance < other.d->relevance;
|
return d->relevance < other.d->relevance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchMatch::run(const SearchContext *context) const
|
void SearchMatch::run(const RunnerContext *context) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(context);
|
Q_ASSERT(context);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class QString;
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
class SearchContext;
|
class RunnerContext;
|
||||||
class AbstractRunner;
|
class AbstractRunner;
|
||||||
|
|
||||||
class PLASMA_EXPORT SearchMatch
|
class PLASMA_EXPORT SearchMatch
|
||||||
@ -54,10 +54,10 @@ class PLASMA_EXPORT SearchMatch
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a PossibleMatch associated with a given SearchContext
|
* Constructs a PossibleMatch associated with a given RunnerContext
|
||||||
* and runner.
|
* and runner.
|
||||||
*
|
*
|
||||||
* @arg search the SearchContext this match belongs to
|
* @arg search the RunnerContext this match belongs to
|
||||||
* @arg runner the runner this match belongs to
|
* @arg runner the runner this match belongs to
|
||||||
*/
|
*/
|
||||||
explicit SearchMatch(AbstractRunner *runner);
|
explicit SearchMatch(AbstractRunner *runner);
|
||||||
@ -108,7 +108,7 @@ class PLASMA_EXPORT SearchMatch
|
|||||||
|
|
||||||
bool operator<(const SearchMatch& other) const;
|
bool operator<(const SearchMatch& other) const;
|
||||||
|
|
||||||
void run(const SearchContext *context) const;
|
void run(const RunnerContext *context) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
|
Loading…
Reference in New Issue
Block a user