we will need a setId after all

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=805235
This commit is contained in:
Aaron J. Seigo 2008-05-07 22:27:51 +00:00
parent c85cac84df
commit 57cf4099c8
2 changed files with 27 additions and 3 deletions

View File

@ -109,7 +109,16 @@ void QueryMatch::setSubtext(const QString& subtext)
void QueryMatch::setData(const QVariant& data)
{
d->data = data;
d->id = d->runner->id() + '_' + data.toString();
setId(data.toString());
}
void QueryMatch::setId(const QString &id)
{
d->id = d->runner->id();
if (!id.isEmpty()) {
d->id.append('_').append(id);
}
}
void QueryMatch::setIcon(const QIcon& icon)

View File

@ -121,11 +121,26 @@ class PLASMA_EXPORT QueryMatch
/**
* Sets data to be used internally by the associated
* AbstractRunner. When set, it is also used to form
* part of the id() for this match.
* AbstractRunner.
*
* When set, it is also used to form
* part of the id() for this match. If that is innapropriate
* as an id, the runner may generate its own id and set that
* with setId(const QString&) directly after calling setData
*/
void setData(const QVariant& data);
/**
* Sets the id for this match; useful if the id does not
* match data().toString(). The id must be unique to all
* matches from this runner, and should remain constant
* for the same query for best results.
*
* @param id the new identifying string to use to refer
* to this entry
*/
void setId(const QString &id);
void setText(const QString& text);
void setSubtext(const QString& text);
void setIcon(const QIcon& icon);