From c6e84cd7d9ff9f78db573a32ccfb2702978e4b16 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 15 Oct 2012 20:41:27 +0200 Subject: [PATCH] we need path *and* key --- .../plasmaextracomponents/fallbackcomponent.cpp | 14 ++++++++------ .../plasmaextracomponents/fallbackcomponent.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/declarativeimports/plasmaextracomponents/fallbackcomponent.cpp b/declarativeimports/plasmaextracomponents/fallbackcomponent.cpp index eeb3af87b..f6f8b5246 100644 --- a/declarativeimports/plasmaextracomponents/fallbackcomponent.cpp +++ b/declarativeimports/plasmaextracomponents/fallbackcomponent.cpp @@ -60,9 +60,9 @@ QString FallbackComponent::filePath(const QString &key) QString resolved; foreach (const QString &path, m_candidates) { - kDebug() << "Searching for:" << path; - if (m_possiblePaths.contains(key)) { - resolved = *m_possiblePaths.object(key); + kDebug() << "Searching for:" << path + path; + if (m_possiblePaths.contains(path + key)) { + resolved = *m_possiblePaths.object(path + key); if (!resolved.isEmpty()) { break; } else { @@ -71,13 +71,15 @@ QString FallbackComponent::filePath(const QString &key) } QDir tmpPath(m_basePath); + if (tmpPath.isAbsolute()) { - resolved = m_basePath + path; + resolved = m_basePath + path + key; } else { - resolved = KStandardDirs::locate("data", m_basePath + '/' + path); + + resolved = KStandardDirs::locate("data", m_basePath + '/' + path + key); } - m_possiblePaths.insert(key, new QString(resolved)); + m_possiblePaths.insert(path + key, new QString(resolved)); if (!resolved.isEmpty()) { break; } diff --git a/declarativeimports/plasmaextracomponents/fallbackcomponent.h b/declarativeimports/plasmaextracomponents/fallbackcomponent.h index 17d183841..1543fc4bf 100644 --- a/declarativeimports/plasmaextracomponents/fallbackcomponent.h +++ b/declarativeimports/plasmaextracomponents/fallbackcomponent.h @@ -55,7 +55,7 @@ public: * * @param key the name of the file to search for **/ - Q_INVOKABLE QString filePath(const QString& key); + Q_INVOKABLE QString filePath(const QString& key = QString()); QString basePath() const; void setBasePath(const QString &basePath);