From 3cc339a852d03c94959c8f32fbb3a7760070c591 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 4 Nov 2010 21:16:12 +0000 Subject: [PATCH] use PLASMA_CUSTOM_PREFIX_PATHS environmant variable as optional custom fallback chain for plasmoidpackage (should it be for -all- packages?) svn path=/trunk/KDE/kdelibs/; revision=1193156 --- package.cpp | 8 ++++---- private/packages.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.cpp b/package.cpp index 2e97f1dd4..482fa1908 100644 --- a/package.cpp +++ b/package.cpp @@ -169,7 +169,7 @@ bool Package::isValid() const bool failed = true; foreach (const QString &path, d->structure->searchPath(dir)) { foreach (const QString &prefix, d->structure->contentsPrefixPaths()) { - if (QFile::exists(d->structure->path() + prefix + path)) { + if (QFile::exists(d->structure->path() + prefix + "/" + path)) { failed = false; break; } @@ -190,7 +190,7 @@ bool Package::isValid() const bool failed = true; foreach (const QString &path, d->structure->searchPath(file)) { foreach (const QString &prefix, d->structure->contentsPrefixPaths()) { - if (QFile::exists(d->structure->path() + prefix + path)) { + if (QFile::exists(d->structure->path() + prefix + "/" + path)) { failed = false; break; } @@ -233,7 +233,7 @@ QString Package::filePath(const char *fileType, const QString &filename) const //Nested loop, but in the medium case resolves to just one iteration foreach (const QString &contentsPrefix, d->structure->contentsPrefixPaths()) { - const QString prefix(d->structure->path() + contentsPrefix); + const QString prefix(d->structure->path() + contentsPrefix + "/"); foreach (const QString &path, paths) { QString file = prefix + path; @@ -387,7 +387,7 @@ QString Package::contentsHash() const } foreach (QString prefix, d->structure->contentsPrefixPaths()) { - const QString basePath = d->structure->path() + prefix; + const QString basePath = d->structure->path() + prefix + "/"; QDir dir(basePath); if (!dir.exists()) { diff --git a/private/packages.cpp b/private/packages.cpp index 682a4c3ba..5c9d61555 100644 --- a/private/packages.cpp +++ b/private/packages.cpp @@ -41,6 +41,14 @@ 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); + } + } + addDirectoryDefinition("images", "images", i18n("Images")); QStringList mimetypes; mimetypes << "image/svg+xml" << "image/png" << "image/jpeg";