From b61bca0f3d4415f32a25a1e37103c1bb4f183687 Mon Sep 17 00:00:00 2001 From: Oliver Henshaw Date: Sun, 26 May 2013 14:32:21 +0100 Subject: [PATCH] add qml import paths in correct order addImportPath prepends the path to importPathList so we must add our paths in reverse order. Based on the fix for kdeclarative.cpp in kdelibs 400b9f2e9d10386bb175b6123fe0cdaafeaffe61 REVIEW: 110670 --- clients/aurorae/src/aurorae.cpp | 16 ++++++++++++---- kcmkwin/kwindecoration/kwindecoration.cpp | 8 ++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 3da750b1b8..6881ae9ed0 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -88,9 +88,13 @@ void AuroraeFactory::initAurorae(KConfig &conf, KConfigGroup &group) m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry("ButtonSize", KDecorationDefines::BorderNormal)); m_theme->setTabDragMimeType(tabDragMimeType()); // setup the QML engine + /* use logic from KDeclarative::setupBindings(): + "addImportPath adds the path at the beginning, so to honour user's + paths we need to traverse the list in reverse order" */ QStringListIterator paths(KGlobal::dirs()->findDirs("module", "imports")); - while (paths.hasNext()) { - m_engine->addImportPath(paths.next()); + paths.toBack(); + while (paths.hasPrevious()) { + m_engine->addImportPath(paths.previous()); } m_component->loadUrl(QUrl(KStandardDirs::locate("data", "kwin/aurorae/aurorae.qml"))); m_engine->rootContext()->setContextProperty("auroraeTheme", m_theme); @@ -123,9 +127,13 @@ void AuroraeFactory::initQML(const KConfigGroup &group) } m_engineType = QMLEngine; // setup the QML engine + /* use logic from KDeclarative::setupBindings(): + "addImportPath adds the path at the beginning, so to honour user's + paths we need to traverse the list in reverse order" */ QStringListIterator paths(KGlobal::dirs()->findDirs("module", "imports")); - while (paths.hasNext()) { - m_engine->addImportPath(paths.next()); + paths.toBack(); + while (paths.hasPrevious()) { + m_engine->addImportPath(paths.previous()); } m_component->loadUrl(QUrl::fromLocalFile(file)); m_themeName = themeName; diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index 788483e252..6bb8a744f5 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -135,9 +135,13 @@ void KWinDecorationModule::init() m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_ui->decorationList->setResizeMode(QDeclarativeView::SizeRootObjectToView); + /* use logic from KDeclarative::setupBindings(): + "addImportPath adds the path at the beginning, so to honour user's + paths we need to traverse the list in reverse order" */ QStringListIterator paths(KGlobal::dirs()->findDirs("module", "imports")); - while (paths.hasNext()) { - m_ui->decorationList->engine()->addImportPath(paths.next()); + paths.toBack(); + while (paths.hasPrevious()) { + m_ui->decorationList->engine()->addImportPath(paths.previous()); } m_ui->decorationList->rootContext()->setContextProperty("decorationModel", m_proxyModel); m_ui->decorationList->rootContext()->setContextProperty("decorationBaseModel", m_model);