use QQuickViewSharedEngine::setTranslationDomain

setting the domain by just using kdeclarative would lead to
setting the domain on the wrong QQmlContext,
sometimes overwriting it on the global context, causing
unexpected crashes deep in qml
BUG:361513
reviewed-by: Ivan Čukić <ivan.cukic@kde.org>
This commit is contained in:
Marco Martin 2016-08-18 12:39:35 +02:00
parent 5f8f7db226
commit f1699fe543

View File

@ -189,14 +189,9 @@ ContainmentView::ContainmentView(Plasma::Corona *corona, QWindow *parent)
this, &ContainmentView::screenGeometryChanged); this, &ContainmentView::screenGeometryChanged);
if (corona->package().isValid()) { if (corona->package().isValid()) {
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
//binds things like kconfig and icons
KPluginInfo info = corona->package().metadata(); KPluginInfo info = corona->package().metadata();
if (info.isValid()) { if (info.isValid()) {
kdeclarative.setTranslationDomain("plasma_shell_" + info.pluginName()); setTranslationDomain("plasma_shell_" + info.pluginName());
kdeclarative.setupBindings();
} else { } else {
qWarning() << "Invalid corona package metadata"; qWarning() << "Invalid corona package metadata";
} }