Fix KDevPluginController::query() with empty constraint

When KDevPluginController::query() was called with empty constrain it
were resulting in incorrect query string being passed to TDETrader,
which were resulting in at least warnings like the next one:

```
[tdeio (TDETrader)] [6751] WARNING: Parsing ' and [X-TDevelop-Version] == 5' gave syntax error
```

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit c8d7b46522)
r14.1.x
Alexander Golubev 9 months ago committed by Slávek Banko
parent e4efa087f1
commit c891bb5d06
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -27,8 +27,17 @@ KDevPluginController::KDevPluginController()
TDETrader::OfferList KDevPluginController::query(const TQString &serviceType,
const TQString &constraint)
{
return TDETrader::self()->query(serviceType,
TQString("%1 and [X-TDevelop-Version] == %2").arg(constraint).arg(TDEVELOP_PLUGIN_VERSION));
TQString versionConstraint =
TQString::fromLatin1("[X-TDevelop-Version] == %1").arg(TDEVELOP_PLUGIN_VERSION);
TQString newConstraint;
if (!constraint.isEmpty()) {
newConstraint = TQString("( %1 ) and %2").arg(constraint).arg(versionConstraint);
} else {
newConstraint = versionConstraint;
}
return TDETrader::self()->query(serviceType, newConstraint);
}
TDETrader::OfferList KDevPluginController::queryPlugins(const TQString &constraint)

Loading…
Cancel
Save