Renaming methods around operation calls to get better discoverability of
the API. KConfigGroup instances are the whole operation description, not simply the parameters. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=814507
This commit is contained in:
parent
b74e3dd632
commit
dd95e5a8e6
15
service.cpp
15
service.cpp
@ -90,7 +90,7 @@ QString Service::destination() const
|
||||
return d->destination;
|
||||
}
|
||||
|
||||
QStringList Service::operationList() const
|
||||
QStringList Service::operationNames() const
|
||||
{
|
||||
if (!d->config) {
|
||||
return QStringList();
|
||||
@ -99,17 +99,17 @@ QStringList Service::operationList() const
|
||||
return d->config->config()->groupList();
|
||||
}
|
||||
|
||||
KConfigGroup Service::operationParameters(const QString &operation)
|
||||
KConfigGroup Service::operationDescription(const QString &operationName)
|
||||
{
|
||||
if (!d->config) {
|
||||
return KConfigGroup();
|
||||
}
|
||||
|
||||
KConfigGroup params(d->config->config(), operation);
|
||||
KConfigGroup params(d->config->config(), operationName);
|
||||
return params;
|
||||
}
|
||||
|
||||
ServiceJob* Service::startOperation(const KConfigGroup ¶meters)
|
||||
ServiceJob* Service::startOperationCall(const KConfigGroup &description)
|
||||
{
|
||||
// TODO: nested groups?
|
||||
if (!d->config) {
|
||||
@ -118,16 +118,17 @@ ServiceJob* Service::startOperation(const KConfigGroup ¶meters)
|
||||
|
||||
d->config->writeConfig();
|
||||
QMap<QString, QVariant> params;
|
||||
QString op = parameters.name();
|
||||
foreach (const QString &key, parameters.keyList()) {
|
||||
QString op = description.name();
|
||||
foreach (const QString &key, description.keyList()) {
|
||||
KConfigSkeletonItem *item = d->config->findItem(op, key);
|
||||
if (item) {
|
||||
params.insert(key, item->property());
|
||||
}
|
||||
}
|
||||
|
||||
ServiceJob *job = createJob(parameters.name(), params);
|
||||
ServiceJob *job = createJob(description.name(), params);
|
||||
connect(job, SIGNAL(finished(KJob*)), this, SLOT(jobFinished(KJob*)));
|
||||
job->start();
|
||||
return job;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
/**
|
||||
* @return the possible operations for this profile
|
||||
*/
|
||||
QStringList operationList() const;
|
||||
QStringList operationNames() const;
|
||||
|
||||
/**
|
||||
* Retrieves the parameters for a given operation
|
||||
@ -106,7 +106,7 @@ public:
|
||||
* @param operation the operation to retrieve parameters for
|
||||
* @return KConfigGroup containing the parameters
|
||||
*/
|
||||
KConfigGroup operationParameters(const QString &operation);
|
||||
KConfigGroup operationDescription(const QString &operationName);
|
||||
|
||||
/**
|
||||
* Called to create a ServiceJob which is associated with a given
|
||||
@ -115,7 +115,7 @@ public:
|
||||
* @return a started ServiceJob; the consumer may connect to relevant
|
||||
* signals before returning to the event loop
|
||||
*/
|
||||
ServiceJob* startOperation(const KConfigGroup ¶meters);
|
||||
ServiceJob* startOperationCall(const KConfigGroup &description);
|
||||
|
||||
/**
|
||||
* The name of this service
|
||||
|
Loading…
Reference in New Issue
Block a user