summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlexander Golubev <[email protected]>2024-02-02 11:37:10 +0300
committerSlávek Banko <[email protected]>2024-02-04 00:53:40 +0100
commitc891bb5d0682b26c64cee49cbdbfe398285c4c1b (patch)
treea2c5e0460c82a16369c49036ee18133eef7492ac /lib
parente4efa087f111e66561a464433f530b6c794e0161 (diff)
downloadtdevelop-c891bb5d0682b26c64cee49cbdbfe398285c4c1b.tar.gz
tdevelop-c891bb5d0682b26c64cee49cbdbfe398285c4c1b.zip
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 <[email protected]> (cherry picked from commit c8d7b46522918fbb19e77e7a12d7c1d0ed9ae390)
Diffstat (limited to 'lib')
-rw-r--r--lib/interfaces/kdevplugincontroller.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/interfaces/kdevplugincontroller.cpp b/lib/interfaces/kdevplugincontroller.cpp
index 1cc6caa3..2a1b0770 100644
--- a/lib/interfaces/kdevplugincontroller.cpp
+++ b/lib/interfaces/kdevplugincontroller.cpp
@@ -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)