Port away from deprecated KDeclarative::setupContext()
NO_CHANGELOG
This commit is contained in:
parent
d6a5b10b3b
commit
d1617d6d2d
@ -32,6 +32,7 @@ target_link_libraries(corebindingsplugin
|
||||
Qt5::Qml
|
||||
KF5::Declarative
|
||||
KF5::IconThemes
|
||||
KF5::I18n
|
||||
KF5::Service #for kplugininfo.h
|
||||
KF5::WindowSystem
|
||||
KF5::Plasma
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include <QQmlContext>
|
||||
|
||||
#include <KLocalizedContext>
|
||||
|
||||
#include <kdeclarative/kdeclarative.h>
|
||||
|
||||
#include <plasma/framesvg.h>
|
||||
@ -48,10 +50,10 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
|
||||
context->setContextProperty(QStringLiteral("units"), &Units::instance());
|
||||
|
||||
if (!engine->rootContext()->contextObject()) {
|
||||
KDeclarative::KDeclarative kdeclarative;
|
||||
kdeclarative.setDeclarativeEngine(engine);
|
||||
kdeclarative.setupContext();
|
||||
if (!context->contextObject()) {
|
||||
KLocalizedContext *localizedContextObject = new KLocalizedContext(engine);
|
||||
context->setContextObject(localizedContextObject);
|
||||
|
||||
KDeclarative::KDeclarative::setupEngine(engine);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <KAuthorized>
|
||||
#include <KLocalizedString>
|
||||
#include <KLocalizedContext>
|
||||
#include <kdeclarative/kdeclarative.h>
|
||||
#include <packageurlinterceptor.h>
|
||||
#include <KQuickAddons/ConfigModule>
|
||||
@ -80,15 +81,15 @@ void ConfigViewPrivate::init()
|
||||
|
||||
applet.data()->setUserConfiguring(true);
|
||||
|
||||
KDeclarative::KDeclarative kdeclarative;
|
||||
kdeclarative.setDeclarativeEngine(q->engine());
|
||||
KLocalizedContext *localizedContextObject = new KLocalizedContext(q->engine());
|
||||
const QString rootPath = applet.data()->pluginMetaData().value(QStringLiteral("X-Plasma-RootPath"));
|
||||
if (!rootPath.isEmpty()) {
|
||||
kdeclarative.setTranslationDomain(QStringLiteral("plasma_applet_") + rootPath);
|
||||
localizedContextObject->setTranslationDomain(QStringLiteral("plasma_applet_") + rootPath);
|
||||
} else {
|
||||
kdeclarative.setTranslationDomain(QStringLiteral("plasma_applet_") + applet.data()->pluginMetaData().pluginId());
|
||||
localizedContextObject->setTranslationDomain(QStringLiteral("plasma_applet_") + applet.data()->pluginMetaData().pluginId());
|
||||
}
|
||||
kdeclarative.setupContext();
|
||||
q->engine()->rootContext()->setContextObject(localizedContextObject);
|
||||
|
||||
KDeclarative::KDeclarative::setupEngine(q->engine()); // ### how to make sure to do this only once per engine?
|
||||
|
||||
//FIXME: problem on nvidia, all windows should be transparent or won't show
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <QScreen>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include <KLocalizedContext>
|
||||
|
||||
#include "plasma/pluginloader.h"
|
||||
#include <packageurlinterceptor.h>
|
||||
#include <kdeclarative/kdeclarative.h>
|
||||
@ -182,11 +184,11 @@ View::View(Plasma::Corona *corona, QWindow *parent)
|
||||
interceptor->setForcePlasmaStyle(true);
|
||||
engine()->setUrlInterceptor(interceptor);
|
||||
|
||||
KDeclarative::KDeclarative kdeclarative;
|
||||
kdeclarative.setDeclarativeEngine(engine());
|
||||
KLocalizedContext *localizedContextObject = new KLocalizedContext(engine());
|
||||
localizedContextObject->setTranslationDomain(QStringLiteral("plasma_shell_") + pkg.metadata().pluginId());
|
||||
engine()->rootContext()->setContextObject(localizedContextObject);
|
||||
|
||||
//binds things like kconfig and icons
|
||||
kdeclarative.setTranslationDomain(QStringLiteral("plasma_shell_") + pkg.metadata().pluginId());
|
||||
kdeclarative.setupContext();
|
||||
KDeclarative::KDeclarative::setupEngine(engine()); // ### how to make sure to do this only once per engine?
|
||||
} else {
|
||||
qWarning() << "Invalid home screen package";
|
||||
|
Loading…
x
Reference in New Issue
Block a user