Allow building the project without deprecations

This commit is contained in:
Alexander Lohnau 2021-05-06 07:47:13 +02:00
parent 23105b27bc
commit 5dfa851f7b
No known key found for this signature in database
GPG Key ID: 6C45BA731AA2ED36
27 changed files with 122 additions and 185 deletions

View File

@ -40,9 +40,13 @@ PLASMA_UNIT_TESTS(
framesvgtest
iconitemtest
themetest
configmodeltest
)
if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.83.0)
PLASMA_UNIT_TESTS(configmodeltest)
endif()
if(HAVE_X11)
set(dialognativetest_srcs dialognativetest.cpp)
ecm_add_test(${dialognativetest_srcs} TEST_NAME dialognativetest LINK_LIBRARIES Qt5::Gui Qt5::Test Qt5::Qml Qt5::Quick KF5::WindowSystem KF5::Plasma KF5::PlasmaQuick)

View File

@ -44,10 +44,6 @@ set(Plasma_LIB_SRCS
private/storage.cpp
private/storagethread.cpp
#packages
package.cpp
packagestructure.cpp
#graphics
framesvg.cpp
svg.cpp
@ -60,6 +56,13 @@ set(Plasma_LIB_SRCS
scripting/scriptengine.cpp
)
if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.83.0)
#packages
set(Plasma_LIB_SRCS ${Plasma_LIB_SRCS} package.cpp packagestructure.cpp)
endif()
if(HAVE_X11)
set(Plasma_LIB_SRCS ${Plasma_LIB_SRCS} private/effectwatcher.cpp)
endif()
@ -83,10 +86,9 @@ ecm_generate_export_header(KF5Plasma
GROUP_BASE_NAME KF
VERSION ${KF_VERSION}
DEPRECATED_BASE_VERSION 0
EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
DEPRECATION_VERSIONS 5.6 5.19 5.28 5.30 5.36 5.46 5.67 5.77 5.78 5.81 5.83
)
# TODO: add support for EXCLUDE_DEPRECATED_BEFORE_AND_AT to all Plasma libs
# needs fixing of undeprecated API being still implemented using own deprecated API
if(HAVE_X11)
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} Qt5::X11Extras ${X11_LIBRARIES} XCB::XCB)

View File

@ -39,7 +39,9 @@
#include "debug_p.h"
#include "private/associatedapplicationmanager_p.h"
#include "private/containment_p.h"
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
#include "private/package_p.h"
#endif
#include <cmath>
#include <limits>
@ -64,10 +66,12 @@ Applet::Applet(const KPluginMetaData &info, QObject *parent, uint appletId)
d->setupPackage();
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 28)
Applet::Applet(const KPluginInfo &info, QObject *parent, uint appletId)
: Applet(info.toMetaData(), parent, appletId)
{
}
#endif
Applet::Applet(QObject *parent, const QString &serviceID, uint appletId)
: QObject(parent)
@ -314,12 +318,14 @@ KConfigLoader *Applet::configScheme() const
return d->configLoader;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 6)
Package Applet::package() const
{
Package p;
p.d->internalPackage = new KPackage::Package(d->package);
return p;
}
#endif
KPackage::Package Applet::kPackage() const
{
@ -454,10 +460,12 @@ void Applet::setUserBackgroundHints(Plasma::Types::BackgroundHints hint)
}
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 28)
KPluginInfo Applet::pluginInfo() const
{
return KPluginInfo(d->appletDescription);
}
#endif
KPluginMetaData Applet::pluginMetaData() const
{
@ -845,6 +853,7 @@ bool Applet::hasValidAssociatedApplication() const
return AssociatedApplicationManager::self()->appletHasValidAssociatedApplication(this);
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 19)
Applet *Applet::loadPlasmoid(const QString &path, uint appletId)
{
const KPluginMetaData md = appletMetadataForDirectory(path);
@ -860,6 +869,7 @@ Applet *Applet::loadPlasmoid(const QString &path, uint appletId)
return nullptr;
}
#endif
void Applet::timerEvent(QTimerEvent *event)
{

View File

@ -47,10 +47,12 @@ ContainmentActions::~ContainmentActions()
delete d;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 67)
KPluginInfo ContainmentActions::pluginInfo() const
{
return KPluginInfo(d->containmentActionsDescription);
}
#endif
KPluginMetaData ContainmentActions::metadata() const
{

View File

@ -24,13 +24,16 @@
#include "containment.h"
#include "debug_p.h"
#include "packagestructure.h"
#include "pluginloader.h"
#include "private/applet_p.h"
#include "private/containment_p.h"
#include "private/package_p.h"
#include "private/timetracker.h"
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
#include "packagestructure.h"
#include "private/package_p.h"
#endif
using namespace Plasma;
namespace Plasma
@ -59,6 +62,7 @@ Corona::~Corona()
delete d;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 6)
Plasma::Package Corona::package() const
{
return Package(d->package);
@ -69,6 +73,7 @@ void Corona::setPackage(const Plasma::Package &package)
setKPackage(*package.d->internalPackage);
Q_EMIT packageChanged(package);
}
#endif
KPackage::Package Corona::kPackage() const
{
@ -177,6 +182,7 @@ QList<Plasma::Containment *> Corona::importLayout(const KConfigGroup &conf)
return d->importLayout(conf, true);
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 46)
Containment *Corona::containmentForScreen(int screen) const
{
for (Containment *containment : qAsConst(d->containments)) {
@ -194,6 +200,7 @@ Containment *Corona::containmentForScreen(int screen, const QString &defaultPlug
{
return containmentForScreen(screen, QString(), defaultPluginIfNonExistent, defaultArgs);
}
#endif
Containment *Corona::containmentForScreen(int screen, const QString &activity, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
{

View File

@ -29,7 +29,9 @@ class PLASMA_EXPORT Corona : public QObject
Q_OBJECT
Q_PROPERTY(bool isStartupCompleted READ isStartupCompleted NOTIFY startupCompleted)
Q_PROPERTY(bool editMode READ isEditMode WRITE setEditMode NOTIFY editModeChanged)
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 83)
Q_PROPERTY(Package package READ package NOTIFY packageChanged)
#endif
Q_PROPERTY(KPackage::Package kPackage READ kPackage NOTIFY kPackageChanged)
public:

View File

@ -32,10 +32,12 @@
namespace Plasma
{
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 67)
DataEngine::DataEngine(const KPluginInfo &plugin, QObject *parent)
: DataEngine(plugin.toMetaData(), parent)
{
}
#endif
DataEngine::DataEngine(const KPluginMetaData &plugin, QObject *parent)
: QObject(parent)
@ -87,10 +89,12 @@ Service *DataEngine::serviceForSource(const QString &source)
return new NullService(source, this);
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 67)
KPluginInfo DataEngine::pluginInfo() const
{
return KPluginInfo(d->dataEngineDescription);
}
#endif
KPluginMetaData DataEngine::metadata() const
{
@ -382,11 +386,12 @@ void DataEngine::forceImmediateUpdateOfAllVisualizations()
}
}
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
Package DataEngine::package() const
{
return d->package ? *d->package : Package();
}
#endif
void DataEngine::setStorageEnabled(const QString &source, bool store)
{
@ -406,7 +411,6 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginMetaData &md, c
, minPollingInterval(-1)
, valid(false)
, script(nullptr)
, package(nullptr)
{
updateTimer.start();
@ -416,6 +420,8 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginMetaData &md, c
}
if (dataEngineDescription.isValid()) {
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
QString api = dataEngineDescription.value(QStringLiteral("X-Plasma-API"));
if (!api.isEmpty()) {
@ -438,6 +444,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginMetaData &md, c
package = nullptr;
}
}
#endif
}
}
@ -445,8 +452,10 @@ DataEnginePrivate::~DataEnginePrivate()
{
delete script;
script = nullptr;
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
delete package;
package = nullptr;
#endif
}
void DataEnginePrivate::internalUpdateSource(DataContainer *source)
@ -593,10 +602,6 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool
// package exists and that we have a script engine
void DataEnginePrivate::setupScriptSupport()
{
if (!package) {
return;
}
/*
#ifndef NDEBUG
// qCDebug(LOG_PLASMA) << "sletting up script support, package is in" << package->path()

View File

@ -212,12 +212,15 @@ public:
*/
bool isEmpty() const;
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 83)
/**
* Accessor for the associated Package object if any.
*
* @return the Package object, or 0 if none
**/
PLASMA_DEPRECATED_VERSION(5, 83, "Use kpackage API instead")
Package package() const;
#endif
Q_SIGNALS:
/**

View File

@ -25,8 +25,10 @@
#include "debug_p.h"
#include "package.h"
#include "private/applet_p.h"
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
#include "private/package_p.h"
#include "private/packagestructure_p.h"
#endif
#include "private/service_p.h" // for NullService
#include "private/storage_p.h"
#include <plasma/version.h>
@ -46,7 +48,9 @@ public:
static QSet<QString> knownCategories();
static QSet<QString> s_customCategories;
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
QHash<QString, QPointer<PackageStructure>> structures;
#endif
bool isDefaultLoader;
static QString s_dataEnginePluginDir;
@ -122,9 +126,11 @@ PluginLoader::PluginLoader()
PluginLoader::~PluginLoader()
{
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
for (const auto &wp : qAsConst(d->structures)) {
delete wp;
}
#endif
delete d;
}
@ -240,7 +246,7 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
return nullptr;
}
return new DataEngine(KPluginInfo(p.metadata().fileName()), nullptr);
return new DataEngine(p.metadata(), nullptr);
}
QStringList PluginLoader::listAllEngines(const QString &parentApp)
@ -404,6 +410,7 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
return actions;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
Package PluginLoader::loadPackage(const QString &packageFormat, const QString &specialization)
{
if (!d->isDefaultLoader) {
@ -463,6 +470,7 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s
return Package();
}
#endif
QList<KPluginMetaData> PluginLoader::listAppletMetaData(const QString &category, const QString &parentApp)
{
@ -530,6 +538,7 @@ QList<KPluginMetaData> PluginLoader::listAppletMetaData(const QString &category,
return KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 28)
KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QString &parentApp)
{
const auto plugins = listAppletMetaData(category, parentApp);
@ -555,6 +564,7 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS
return KPluginInfo::fromMetaData(plugins.toVector());
#endif
}
#endif
QList<KPluginMetaData> PluginLoader::listAppletMetaDataForMimeType(const QString &mimeType)
{
@ -563,11 +573,12 @@ QList<KPluginMetaData> PluginLoader::listAppletMetaDataForMimeType(const QString
};
return KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
KPluginInfo::List PluginLoader::listAppletInfoForMimeType(const QString &mimeType)
{
return KPluginInfo::fromMetaData(listAppletMetaDataForMimeType(mimeType).toVector());
}
#endif
QList<KPluginMetaData> PluginLoader::listAppletMetaDataForUrl(const QUrl &url)
{
@ -602,10 +613,12 @@ QList<KPluginMetaData> PluginLoader::listAppletMetaDataForUrl(const QUrl &url)
return filtered;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 36)
KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
{
return KPluginInfo::fromMetaData(listAppletMetaDataForUrl(url).toVector());
}
#endif
QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool visibleOnly)
{
@ -725,6 +738,7 @@ KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeT
}
#endif
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
QStringList PluginLoader::listContainmentTypes()
{
const KPluginInfo::List containmentInfos = listContainments();
@ -739,6 +753,7 @@ QStringList PluginLoader::listContainmentTypes()
return types.values();
}
#endif
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 77)
KPluginInfo::List PluginLoader::listDataEngineInfo(const QString &parentApp)
@ -839,12 +854,14 @@ Service *PluginLoader::internalLoadService(const QString &name, const QVariantLi
return nullptr;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
Package PluginLoader::internalLoadPackage(const QString &name, const QString &specialization)
{
Q_UNUSED(name);
Q_UNUSED(specialization);
return Package();
}
#endif
KPluginInfo::List PluginLoader::internalAppletInfo(const QString &category) const
{

View File

@ -326,10 +326,15 @@ public:
static KPluginInfo::List listContainmentsOfType(const QString &type, const QString &category = QString(), const QString &parentApp = QString());
#endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 83)
/**
* @return a list of all known types of containments on this system
*/
PLASMA_DEPRECATED_VERSION(5,
83,
"Use PluginLoader::listContainmentsMetaDataOfType and aggregate the values of the X-Plasma-ContainmentType property instead")
static QStringList listContainmentTypes();
#endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 83)
/**
@ -470,6 +475,7 @@ protected:
**/
virtual ContainmentActions *internalLoadContainmentActions(Containment *parent, const QString &containmentActionsName, const QVariantList &args);
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
/**
* A re-implementable method that allows subclasses to override
* the default behaviour of loadPackage. If the service requested is not recognized,
@ -486,7 +492,7 @@ protected:
**/
PLASMA_DEPRECATED_VERSION(5, 30, "Use KPackage API")
virtual Package internalLoadPackage(const QString &name, const QString &specialization);
#endif
/**
* A re-implementable method that allows subclasses to provide additional applets
* for listAppletInfo. If the application has no applets to give to the application,

View File

@ -32,7 +32,9 @@
#include "debug_p.h"
#include "pluginloader.h"
#include "private/containment_p.h"
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
#include "private/package_p.h"
#endif
#include "scripting/appletscript.h"
#include "scripting/scriptengine.h"
#include "timetracker.h"

View File

@ -85,7 +85,9 @@ public:
bool valid;
DataEngineScript *script;
QString serviceName;
Package *package;
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
Package *package = nullptr;
#endif
QString waitingSourceRequest;
};

View File

@ -9,7 +9,9 @@
#include "kconfig.h"
#include "applet.h"
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
#include "package.h"
#endif
#include "private/applet_p.h"
namespace Plasma
@ -91,11 +93,13 @@ QString AppletScript::mainScript() const
return d->applet->kPackage().filePath("mainscript");
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
Package AppletScript::package() const
{
Q_ASSERT(d->applet);
return d->applet->package();
}
#endif
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 81)
KPluginInfo AppletScript::description() const

View File

@ -135,12 +135,16 @@ protected:
*/
QString mainScript() const override;
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
/**
* @return the Package associated with this plasmoid which can
* be used to request resources, such as images and
* interface files.
*/
PLASMA_DEPRECATED_VERSION(5, 83, "Use kpackage API instead")
Package package() const override;
#endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 81)
/**

View File

@ -6,7 +6,9 @@
#include "dataenginescript.h"
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
#include "package.h"
#endif
#include "private/dataengine_p.h"
#include "private/service_p.h"
@ -62,6 +64,7 @@ Service *DataEngineScript::serviceForSource(const QString &source)
return new NullService(source, d->dataEngine);
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
QString DataEngineScript::mainScript() const
{
Q_ASSERT(d->dataEngine);
@ -78,6 +81,7 @@ KPluginInfo DataEngineScript::description() const
{
return KPluginInfo(metadata());
}
#endif
KPluginMetaData DataEngineScript::metadata() const
{

View File

@ -84,6 +84,7 @@ public:
virtual Service *serviceForSource(const QString &source);
protected:
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
/**
* @return absolute path to the main script file for this plasmoid
*/
@ -94,7 +95,9 @@ protected:
* be used to request resources, such as images and
* interface files.
*/
PLASMA_DEPRECATED_VERSION(5, 83, "Use kpackage API instead")
Package package() const override;
#endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 67)
/**

View File

@ -51,10 +51,12 @@ bool ScriptEngine::init()
return true;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
Package ScriptEngine::package() const
{
return Package();
}
#endif
QString ScriptEngine::mainScript() const
{

View File

@ -52,12 +52,16 @@ protected:
*/
virtual QString mainScript() const;
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 83)
/**
* @return the Package associated with this plasmoid which can
* be used to request resources, such as images and
* interface files.
* @deprecated Since 5.83 Use kpackage API instead
*/
PLASMA_DEPRECATED_VERSION(5, 83, "Use kpackage API instead")
virtual Package package() const;
#endif
private:
ScriptEnginePrivate *const d;

View File

@ -325,6 +325,7 @@ void Theme::insertIntoCache(const QString &key, const QPixmap &pix, const QStrin
}
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 78)
bool Theme::findInRectsCache(const QString &image, const QString &element, QRectF &rect) const
{
if (!d->useCache()) {
@ -375,6 +376,7 @@ void Theme::releaseRectsCache(const QString &image)
Q_UNUSED(image);
// No op: the internal svg cache always writes the invalid elements in the proper place
}
#endif
void Theme::setCacheLimit(int kbytes)
{
@ -383,10 +385,12 @@ void Theme::setCacheLimit(int kbytes)
d->pixmapCache = nullptr;
}
#if PLASMA_BUILD_DEPRECATED_SINCE(5, 67)
KPluginInfo Theme::pluginInfo() const
{
return KPluginInfo(d->pluginMetaData);
}
#endif
QFont Theme::defaultFont() const
{

View File

@ -16,7 +16,6 @@ set(plasmaquick_LIB_SRC
configview.cpp
packageurlinterceptor.cpp
private/configcategory_p.cpp
private/packages.cpp
../declarativeimports/core/framesvgitem.cpp
../declarativeimports/core/units.cpp
)
@ -89,10 +88,9 @@ ecm_generate_export_header(KF5PlasmaQuick
GROUP_BASE_NAME KF
VERSION ${KF_VERSION}
DEPRECATED_BASE_VERSION 0
EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
DEPRECATION_VERSIONS 5.12 5.25 5.36
)
# TODO: add support for EXCLUDE_DEPRECATED_BEFORE_AND_AT to all Plasma libs
# needs fixing of undeprecated API being still implemented using own deprecated API
set(plasmaquick_LIB_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}/plasmaquick_export.h

View File

@ -25,9 +25,12 @@
#include <kdeclarative/qmlobjectsharedengine.h>
#include <packageurlinterceptor.h>
#include <private/package_p.h>
#include <qloggingcategory.h>
#if PLASMAQUICK_BUILD_DEPRECATED_SINCE(5, 36)
#include <private/package_p.h>
#endif
namespace PlasmaQuick
{
QHash<QObject *, AppletQuickItem *> AppletQuickItemPrivate::s_rootObjects = QHash<QObject *, AppletQuickItem *>();
@ -715,6 +718,7 @@ void AppletQuickItem::init()
}
}
#if PLASMAQUICK_BUILD_DEPRECATED_SINCE(5, 36)
Plasma::Package AppletQuickItem::appletPackage() const
{
return Plasma::Package(d->appletPackage);
@ -734,6 +738,7 @@ void AppletQuickItem::setCoronaPackage(const Plasma::Package &package)
{
d->coronaPackage = package.kPackage();
}
#endif
int AppletQuickItem::switchWidth() const
{

View File

@ -1169,7 +1169,10 @@ void Dialog::focusOutEvent(QFocusEvent *ev)
const QWindow *focusWindow = QGuiApplication::focusWindow();
bool childHasFocus = focusWindow && ((focusWindow->isActive() && isAncestorOf(focusWindow)) || (focusWindow->type() & Qt::Popup) == Qt::Popup);
const bool viewClicked = qobject_cast<const KQuickAddons::QuickViewSharedEngine *>(focusWindow) || qobject_cast<const View *>(focusWindow)
const bool viewClicked = qobject_cast<const KQuickAddons::QuickViewSharedEngine *>(focusWindow)
#if PLASMAQUICK_BUILD_DEPRECATED_SINCE(5, 83)
|| qobject_cast<const View *>(focusWindow)
#endif
|| qobject_cast<const ConfigView *>(focusWindow);
if (viewClicked || (!parentHasFocus && !childHasFocus)) {

View File

@ -1,123 +0,0 @@
/*
SPDX-FileCopyrightText: 2007-2009 Aaron Seigo <aseigo@kde.org>
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "packages.h"
#include <QDebug>
#include <KLocalizedString>
#include <kdeclarative/kdeclarative.h>
#include "../plasma/config-plasma.h"
#include <Plasma/Package>
void LookAndFeelPackage::initPackage(Plasma::Package *package)
{
// https://community.kde.org/Plasma/lookAndFeelPackage
package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/"));
// Defaults
package->addFileDefinition("defaults", QStringLiteral("defaults"), i18n("Default settings for theme, etc."));
// Colors
package->addFileDefinition("colors", QStringLiteral("colors"), i18n("Color scheme to use for applications."));
// Directories
package->addDirectoryDefinition("previews", QStringLiteral("previews"), i18n("Preview Images"));
package->addFileDefinition("loginmanagerpreview", QStringLiteral("previews/loginmanager.png"), i18n("Preview for the Login Manager"));
package->addFileDefinition("lockscreenpreview", QStringLiteral("previews/lockscreen.png"), i18n("Preview for the Lock Screen"));
package->addFileDefinition("userswitcherpreview", QStringLiteral("previews/userswitcher.png"), i18n("Preview for the Userswitcher"));
package->addFileDefinition("desktopswitcherpreview", QStringLiteral("previews/desktopswitcher.png"), i18n("Preview for the Virtual Desktop Switcher"));
package->addFileDefinition("splashpreview", QStringLiteral("previews/splash.png"), i18n("Preview for Splash Screen"));
package->addFileDefinition("runcommandpreview", QStringLiteral("previews/runcommand.png"), i18n("Preview for KRunner"));
package->addFileDefinition("windowdecorationpreview", QStringLiteral("previews/windowdecoration.png"), i18n("Preview for the Window Decorations"));
package->addFileDefinition("windowswitcherpreview", QStringLiteral("previews/windowswitcher.png"), i18n("Preview for Window Switcher"));
package->addDirectoryDefinition("loginmanager", QStringLiteral("loginmanager"), i18n("Login Manager"));
package->addFileDefinition("loginmanagermainscript", QStringLiteral("loginmanager/LoginManager.qml"), i18n("Main Script for Login Manager"));
package->addDirectoryDefinition("logout", QStringLiteral("logout"), i18n("Logout Dialog"));
package->addFileDefinition("logoutmainscript", QStringLiteral("logout/Logout.qml"), i18n("Main Script for Logout Dialog"));
package->addDirectoryDefinition("lockscreen", QStringLiteral("lockscreen"), i18n("Screenlocker"));
package->addFileDefinition("lockscreenmainscript", QStringLiteral("lockscreen/LockScreen.qml"), i18n("Main Script for Lock Screen"));
package->addDirectoryDefinition("userswitcher", QStringLiteral("userswitcher"), i18n("UI for fast user switching"));
package->addFileDefinition("userswitchermainscript", QStringLiteral("userswitcher/UserSwitcher.qml"), i18n("Main Script for User Switcher"));
package->addDirectoryDefinition("desktopswitcher", QStringLiteral("desktopswitcher"), i18n("Virtual Desktop Switcher"));
package->addFileDefinition("desktopswitchermainscript",
QStringLiteral("desktopswitcher/DesktopSwitcher.qml"),
i18n("Main Script for Virtual Desktop Switcher"));
package->addDirectoryDefinition("osd", QStringLiteral("osd"), i18n("On-Screen Display Notifications"));
package->addFileDefinition("osdmainscript", QStringLiteral("osd/Osd.qml"), i18n("Main Script for On-Screen Display Notifications"));
package->addDirectoryDefinition("splash", QStringLiteral("splash"), i18n("Splash Screen"));
package->addFileDefinition("splashmainscript", QStringLiteral("splash/Splash.qml"), i18n("Main Script for Splash Screen"));
package->addDirectoryDefinition("runcommand", QStringLiteral("runcommand"), i18n("KRunner UI"));
package->addFileDefinition("runcommandmainscript", QStringLiteral("runcommand/RunCommand.qml"), i18n("Main Script KRunner"));
package->addDirectoryDefinition("windowdecoration", QStringLiteral("windowdecoration"), i18n("Window Decoration"));
package->addFileDefinition("windowdecorationmainscript",
QStringLiteral("windowdecoration/WindowDecoration.qml"),
i18n("Main Script for Window Decoration"));
package->addDirectoryDefinition("windowswitcher", QStringLiteral("windowswitcher"), i18n("Window Switcher"));
package->addFileDefinition("windowswitchermainscript", QStringLiteral("windowswitcher/WindowSwitcher.qml"), i18n("Main Script for Window Switcher"));
}
void QmlWallpaperPackage::initPackage(Plasma::Package *package)
{
package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File"));
package->setRequired("mainscript", true);
QStringList platform = KDeclarative::KDeclarative::runtimePlatform();
if (!platform.isEmpty()) {
QMutableStringListIterator it(platform);
while (it.hasNext()) {
it.next();
it.setValue(QStringLiteral("platformcontents/") + it.value());
}
platform.append(QStringLiteral("contents"));
package->setContentsPrefixPaths(platform);
}
package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/"));
package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images"));
package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images"));
QStringList mimetypes;
mimetypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg");
package->setMimeTypes("images", mimetypes);
package->setMimeTypes("theme", mimetypes);
package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
mimetypes.clear();
mimetypes << QStringLiteral("text/xml");
package->setMimeTypes("config", mimetypes);
package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files"));
package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts"));
mimetypes.clear();
mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes);
package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
}
void LayoutTemplatePackage::initPackage(Plasma::Package *package)
{
package->setServicePrefix(QStringLiteral("plasma-layout-template"));
package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates"));
package->addFileDefinition("mainscript", QStringLiteral("layout.js"), i18n("Main Script File"));
package->setRequired("mainscript", true);
}

View File

@ -1,36 +0,0 @@
/*
SPDX-FileCopyrightText: 2007 Aaron Seigo <aseigo@kde.org>
SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef SHELLPACKAGES_H
#define SHELLPACKAGES_H
#include <Plasma/PackageStructure>
#include <Plasma/Plasma>
class LookAndFeelPackage : public Plasma::PackageStructure
{
Q_OBJECT
public:
void initPackage(Plasma::Package *package) override;
};
class QmlWallpaperPackage : public Plasma::PackageStructure
{
Q_OBJECT
public:
void initPackage(Plasma::Package *package) override;
};
class LayoutTemplatePackage : public Plasma::PackageStructure
{
Q_OBJECT
public:
void initPackage(Plasma::Package *package) override;
};
#endif // LOOKANDFEELPACKAGE_H

View File

@ -6,6 +6,7 @@
#include "shellpluginloader.h"
#if PLASMAQUICK_BUILD_DEPRECATED_SINCE(5, 25)
#include <KPackage/PackageLoader>
#include <QDebug>
@ -32,3 +33,4 @@ void ShellPluginLoader::init()
{
Plasma::PluginLoader::setPluginLoader(new ShellPluginLoader);
}
#endif

View File

@ -7,6 +7,7 @@
#include "view.h"
#include "configview.h"
#if PLASMAQUICK_BUILD_DEPRECATED_SINCE(5, 12)
#include <QDebug>
#include <QQmlContext>
#include <QQmlEngine>
@ -261,5 +262,5 @@ void View::showConfigurationInterface(Plasma::Applet *applet)
}
}
#include "moc_view.cpp"
#endif

View File

@ -114,7 +114,7 @@ void WallpaperInterface::syncWallpaperPackage()
}
m_actions->clear();
m_pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper")).kPackage();
m_pkg = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper"));
m_pkg.setPath(m_wallpaperPlugin);
if (!m_pkg.isValid()) {
qWarning() << "Error loading the wallpaper, no valid package loaded";