we need path *and* key
This commit is contained in:
parent
05936e77d8
commit
c6e84cd7d9
@ -60,9 +60,9 @@ QString FallbackComponent::filePath(const QString &key)
|
|||||||
QString resolved;
|
QString resolved;
|
||||||
|
|
||||||
foreach (const QString &path, m_candidates) {
|
foreach (const QString &path, m_candidates) {
|
||||||
kDebug() << "Searching for:" << path;
|
kDebug() << "Searching for:" << path + path;
|
||||||
if (m_possiblePaths.contains(key)) {
|
if (m_possiblePaths.contains(path + key)) {
|
||||||
resolved = *m_possiblePaths.object(key);
|
resolved = *m_possiblePaths.object(path + key);
|
||||||
if (!resolved.isEmpty()) {
|
if (!resolved.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -71,13 +71,15 @@ QString FallbackComponent::filePath(const QString &key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QDir tmpPath(m_basePath);
|
QDir tmpPath(m_basePath);
|
||||||
|
|
||||||
if (tmpPath.isAbsolute()) {
|
if (tmpPath.isAbsolute()) {
|
||||||
resolved = m_basePath + path;
|
resolved = m_basePath + path + key;
|
||||||
} else {
|
} 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()) {
|
if (!resolved.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param key the name of the file to search for
|
* @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;
|
QString basePath() const;
|
||||||
void setBasePath(const QString &basePath);
|
void setBasePath(const QString &basePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user