@@ -35,6 +35,22 @@ void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
35 engine->setImportPathList(importPathList);
35 engine->setImportPathList(importPathList);
38+/* When you append and import path to the list of import paths it will be the *last*
39+ place where Qt will search for QML modules.
40+ The usual QQmlEngine::addImportPath() actually prepends the given path.*/
41+void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
43+ QStringList importPathList = engine->importPathList();
44+ Q_FOREACH(const QString& path, paths) {
46+ QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
47+ if (iter == importPathList.end()) {
48+ importPathList.append(path);
51+ engine->setImportPathList(importPathList);
38IndicatorsClient::IndicatorsClient(int &argc, char **argv)
54IndicatorsClient::IndicatorsClient(int &argc, char **argv)
39 : QObject(0),
55 : QObject(0),
@@ -56,6 +72,7 @@ void IndicatorsClient::setupUI()
56 m_view = new QQuickView;
72 m_view = new QQuickView;
57 m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
73 m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
58 prependImportPaths(m_view->engine(), ::overrideImportPaths());
74 prependImportPaths(m_view->engine(), ::overrideImportPaths());
75+ appendImportPaths(m_view->engine(), ::fallbackImportPaths());
60 m_view->setSource(QUrl("IndicatorsClient.qml"));
77 m_view->setSource(QUrl("IndicatorsClient.qml"));
61 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
78 m_view->setResizeMode(QQuickView::SizeRootObjectToView);