[plasma-framework] port away from deprecated KF5 APIs

Summary:
KDeclarative::setupBindings() is deprecated, replaced calls with its
implementation (setupContext + static setupEngine call), but see comment
about whether we can be sure this is done only once per engine, as
requested by the setupEngine API. It's 100% equivalent to the old code
though, can't be worse.

KPackage::contentsHash is deprecated, replaced call with implementation.

Depends on D25433 for the KActionCollection::changed signal.

Test Plan: Builds

Reviewers: mart, davidedmundson, broulik, apol

Reviewed By: apol

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D25434
This commit is contained in:
David Faure 2019-12-14 11:31:30 +01:00
parent 29f2171813
commit 00ddc6c1f0
6 changed files with 9 additions and 7 deletions

View File

@ -142,6 +142,7 @@ ecm_setup_qtplugin_macro_names(
PACKAGE_SETUP_AUTOMOC_VARIABLES
)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054000)
#add_definitions(-Wno-deprecated)

View File

@ -64,7 +64,8 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
if (!engine->rootContext()->contextObject()) {
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine);
kdeclarative.setupBindings();
kdeclarative.setupContext();
KDeclarative::KDeclarative::setupEngine(engine);
}
}

View File

@ -224,7 +224,7 @@ void Package::setContentsPrefixPaths(const QStringList &prefixPaths)
QString Package::contentsHash() const
{
return d->internalPackage->contentsHash();
return QString::fromLocal8Bit(d->internalPackage->cryptographicHash(QCryptographicHash::Sha1));
}
void Package::addDirectoryDefinition(const char *key, const QString &path, const QString &name)

View File

@ -101,7 +101,8 @@ void ConfigViewPrivate::init()
} else {
kdeclarative.setTranslationDomain(QStringLiteral("plasma_applet_") + applet.data()->pluginMetaData().pluginId());
}
kdeclarative.setupBindings();
kdeclarative.setupContext();
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
q->setColor(Qt::transparent);

View File

@ -198,7 +198,8 @@ View::View(Plasma::Corona *corona, QWindow *parent)
kdeclarative.setDeclarativeEngine(engine());
//binds things like kconfig and icons
kdeclarative.setTranslationDomain(QStringLiteral("plasma_shell_") + pkg.metadata().pluginId());
kdeclarative.setupBindings();
kdeclarative.setupContext();
KDeclarative::KDeclarative::setupEngine(engine()); // ### how to make sure to do this only once per engine?
} else {
qWarning() << "Invalid home screen package";
}

View File

@ -166,9 +166,7 @@ void ContainmentInterface::init()
connect(m_containment.data(), &Plasma::Containment::containmentTypeChanged,
this, &ContainmentInterface::containmentTypeChanged);
connect(m_containment.data()->actions(), &KActionCollection::inserted,
this, &ContainmentInterface::actionsChanged);
connect(m_containment.data()->actions(), &KActionCollection::removed,
connect(m_containment.data()->actions(), &KActionCollection::changed,
this, &ContainmentInterface::actionsChanged);
}