Commit 43e897a5 authored by David Redondo's avatar David Redondo 🏎

Use kpackage instead of deprecated package

parent 180ebece
......@@ -285,12 +285,12 @@ void ScriptEngine::exception(const QJSValue &value)
QStringList ScriptEngine::pendingUpdateScripts(Plasma::Corona *corona)
{
if (!corona->package().metadata().isValid()) {
if (!corona->kPackage().isValid()) {
qWarning() << "Warning: corona package invalid";
return QStringList();
}
const QString appName = corona->package().metadata().pluginName();
const QString appName = corona->kPackage().metadata().pluginId();
QStringList scripts;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "plasma/shells/" + appName + QStringLiteral("/contents/updates"), QStandardPaths::LocateDirectory);
......
......@@ -199,7 +199,8 @@ QJSValue ScriptEngine::V1::desktopForScreen(const QJSValue &param) const
}
const uint screen = param.toInt();
return m_engine->wrap(m_engine->m_corona->containmentForScreen(screen));
const auto containments = m_engine->m_corona->containmentsForScreen(screen);
return m_engine->wrap(containments.empty() ? nullptr : containments[0]);
}
QJSValue ScriptEngine::V1::createActivity(const QJSValue &nameParam, const QString &pluginParam)
......@@ -231,7 +232,7 @@ QJSValue ScriptEngine::V1::createActivity(const QJSValue &nameParam, const QStri
sc->insertActivity(id, plugin);
} else if (ac) {
if (plugin.isEmpty() || plugin == QLatin1String("undefined")) {
KConfigGroup shellCfg = KConfigGroup(KSharedConfig::openConfig(m_engine->m_corona->package().filePath("defaults")), "Desktop");
KConfigGroup shellCfg = KConfigGroup(KSharedConfig::openConfig(m_engine->m_corona->kPackage().filePath("defaults")), "Desktop");
plugin = shellCfg.readEntry("Containment", "org.kde.desktopcontainment");
}
ac->insertActivity(id, plugin);
......
......@@ -130,7 +130,7 @@ ShellCorona::ShellCorona(QObject *parent)
m_reconsiderOutputsTimer.setInterval(1000);
connect(&m_reconsiderOutputsTimer, &QTimer::timeout, this, &ShellCorona::reconsiderOutputs);
m_desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
m_desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(kPackage().filePath("defaults")), "Desktop");
m_lnfDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(m_lookAndFeelPackage.filePath("defaults")), "Desktop");
m_lnfDefaultsConfig = KConfigGroup(&m_lnfDefaultsConfig, QStringLiteral("org.kde.plasma.desktop"));
......@@ -949,7 +949,7 @@ void ShellCorona::loadDefaultLayout()
script = m_lookAndFeelPackage.filePath("layouts", QString(shell() + "-layout.js").toLatin1());
}
if (script.isEmpty()) {
script = package().filePath("defaultlayout");
script = kPackage().filePath("defaultlayout");
}
QFile file(script);
......
......@@ -121,7 +121,7 @@ void StandaloneAppCorona::load()
void StandaloneAppCorona::loadDefaultLayout()
{
const QString script = package().filePath("defaultlayout");
const QString script = kPackage().filePath("defaultlayout");
QFile file(script);
if (file.open(QIODevice::ReadOnly | QIODevice::Text) ) {
QString code = file.readAll();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment