From bac10ee82b202cef7070442e3d37debd7a4f580b Mon Sep 17 00:00:00 2001 From: Chani Armitage Date: Wed, 13 May 2009 23:28:00 +0000 Subject: [PATCH] change X-Plasma-Requires- to be a string (Required/Optional/Unused) instead of a bool. now I can tell the difference between something that will only use a feature when allowed, and something that doesn't care about that feature at all. svn path=/trunk/KDE/kdelibs/; revision=967779 --- applet.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/applet.cpp b/applet.cpp index 954f9653c..da5cc36b5 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1751,10 +1751,20 @@ KPluginInfo::List Applet::listAppletInfo(const QString &category, while (it.hasNext()) { KService::Ptr p = it.next(); QString prop = QString("X-Plasma-Requires-").append(key); - QVariant req = p->property(prop, QVariant::Bool); - //FIXME before release, switch the if statement: - //if (!req.isValid() || req.toBool()) { - if (req.isValid() && req.toBool()) { + QVariant req = p->property(prop, QVariant::String); + //valid values: Required/Optional/Unused + QString reqValue; + if (req.isValid()) { + reqValue = req.toString(); + } else { + //TODO if it's a scripted language default to not-required because the bindings disable it + //this isn't actually implemented in any bindings yet but should be possible for + //anything but c++ + } + //TODO 4.3 be very strict about what we accept + //if (!(reqValue == "Optional" || reqValue == "Unused")) { + //for testing purposes I'm being lax right now + if (reqValue == "Required") { it.remove(); } }