Merge remote-tracking branch 'origin/KDE/4.10'

This commit is contained in:
David Faure 2012-11-02 14:26:38 +01:00
commit 2857183e22
6 changed files with 71 additions and 11 deletions

View File

@ -23,6 +23,7 @@
#include <QDir>
#include <QMap>
#include <QMutableListIterator>
#include <QFileInfo>
#include <kconfiggroup.h>
@ -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)

View File

@ -34,7 +34,9 @@
#include <knewstuff3/downloaddialog.h>
#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"));

View File

@ -483,6 +483,37 @@ bool RunnerContext::removeMatch(const QString matchId)
return true;
}
bool RunnerContext::removeMatches(Plasma::AbstractRunner *runner)
{
if (!isValid()) {
return false;
}
QList<QueryMatch> 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<QueryMatch> RunnerContext::matches() const
{
LOCK_FOR_READ(d)

View File

@ -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.
*

View File

@ -170,7 +170,7 @@ public:
#ifdef Q_WS_X11
static EffectWatcher *s_blurEffectWatcher;
#endif
Theme *q;
QString themeName;
QList<QString> fallbackThemes;

View File

@ -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;