diff --git a/packagestructure.cpp b/packagestructure.cpp index 5b3edb6e1..7552edea1 100644 --- a/packagestructure.cpp +++ b/packagestructure.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -548,6 +549,17 @@ QStringList PackageStructure::contentsPrefixPaths() const void PackageStructure::setContentsPrefixPaths(const QStringList &prefixPaths) { d->contentsPrefixPaths = prefixPaths; + + // the code assumes that the prefixes have a trailing slash + // so let's make that true here + QMutableStringListIterator it(d->contentsPrefixPaths); + while (it.hasNext()) { + it.next(); + + if (!it.value().endsWith('/')) { + it.setValue(it.value() % '/'); + } + } } bool PackageStructure::installPackage(const QString &package, const QString &packageRoot) diff --git a/private/packages.cpp b/private/packages.cpp index 2519341ae..10effd0fd 100644 --- a/private/packages.cpp +++ b/private/packages.cpp @@ -34,7 +34,9 @@ #include #endif -#include "plasma/private/wallpaper_p.h" +#include "kdeclarative.h" + +#include "private/wallpaper_p.h" namespace Plasma { @@ -42,12 +44,15 @@ namespace Plasma PlasmoidPackage::PlasmoidPackage(QObject *parent) : Plasma::PackageStructure(parent, QString("Plasmoid")) { - QString pathsString(getenv("PLASMA_CUSTOM_PREFIX_PATHS")); - if (!pathsString.isEmpty()) { - QStringList prefixPaths(pathsString.split(":")); - if (!prefixPaths.isEmpty()) { - setContentsPrefixPaths(prefixPaths); + QStringList platform = KDeclarative::runtimePlatform(); + if (!platform.isEmpty()) { + QMutableStringListIterator it(platform); + while (it.hasNext()) { + it.next(); + it.setValue("platformcontents/" + it.value()); } + platform.append("contents"); + setContentsPrefixPaths(platform); } addDirectoryDefinition("images", "images", i18n("Images")); diff --git a/runnercontext.cpp b/runnercontext.cpp index 5d57540d9..abd6a4bc7 100644 --- a/runnercontext.cpp +++ b/runnercontext.cpp @@ -483,6 +483,37 @@ bool RunnerContext::removeMatch(const QString matchId) return true; } +bool RunnerContext::removeMatches(Plasma::AbstractRunner *runner) +{ + if (!isValid()) { + return false; + } + + QList presentMatchList; + + LOCK_FOR_READ(d) + foreach(const QueryMatch &match, d->matches) { + if (match.runner() == runner) { + presentMatchList << match; + } + } + UNLOCK(d) + + if (presentMatchList.isEmpty()) { + return false; + } + + LOCK_FOR_WRITE(d) + foreach (const QueryMatch &match, presentMatchList) { + d->matchesById.remove(match.id()); + d->matches.removeAll(match); + } + UNLOCK(d) + + emit d->q->matchesChanged(); + return true; +} + QList RunnerContext::matches() const { LOCK_FOR_READ(d) diff --git a/runnercontext.h b/runnercontext.h index 4bc7ee92b..741ac59c7 100644 --- a/runnercontext.h +++ b/runnercontext.h @@ -163,9 +163,9 @@ class PLASMA_EXPORT RunnerContext : public QObject * @param matchId the id of match to remove * * @return true if the match was removed, false otherwise. - * @since 4.4 + * @since 4.4 */ - bool removeMatch(const QString matchId); + bool removeMatch(const QString matchId); /** * Removes lists of matches from the existing list of matches. @@ -179,6 +179,18 @@ class PLASMA_EXPORT RunnerContext : public QObject */ bool removeMatches(const QStringList matchIdList); + /** + * Removes lists of matches from a given AbstractRunner + * + * This method is thread safe and causes the matchesChanged() signal to be emitted. + * + * @param runner the AbstractRunner from which to remove matches + * + * @return true if at least one match was removed, false otherwise. + * @since 4.10 + */ + bool removeMatches(AbstractRunner *runner); + /** * Retrieves all available matches for the current search term. * diff --git a/theme.cpp b/theme.cpp index 409abe1ff..2ce1671f0 100644 --- a/theme.cpp +++ b/theme.cpp @@ -170,7 +170,7 @@ public: #ifdef Q_WS_X11 static EffectWatcher *s_blurEffectWatcher; #endif - + Theme *q; QString themeName; QList fallbackThemes; diff --git a/theme.h b/theme.h index 29c81df98..718c6934e 100644 --- a/theme.h +++ b/theme.h @@ -193,12 +193,12 @@ class PLASMA_EXPORT Theme : public QObject Q_INVOKABLE QFont font(FontRole role) const; /** - * Returns the font metrics for the font to be used by themed items + * @return the font metrics for the font to be used by themed items */ Q_INVOKABLE QFontMetrics fontMetrics() const; /** - * Returns if the window manager effects (e.g. translucency, compositing) is active or not + * @return true if the window manager effects (e.g. translucency, compositing) is active or not */ Q_INVOKABLE bool windowTranslucencyEnabled() const;