From 57cf4099c8403d6c50987a3e8e33c42b8a5ce772 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 7 May 2008 22:27:51 +0000 Subject: [PATCH] we will need a setId after all svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=805235 --- querymatch.cpp | 11 ++++++++++- querymatch.h | 19 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/querymatch.cpp b/querymatch.cpp index c04d7e5b0..810dfbc52 100644 --- a/querymatch.cpp +++ b/querymatch.cpp @@ -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) diff --git a/querymatch.h b/querymatch.h index 11eca4fdf..c00ac0e9b 100644 --- a/querymatch.h +++ b/querymatch.h @@ -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);