Commit 29358e52 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Clean up KPackage related code & CMake linking

Plasma::Package is completely deprecated, consequently we should not
rely on it's headers. Also, we do not need to save the package structure
in a static variable, because KPackage caches the instances internally.

With those changes, we do not need to link to plasma-frameworks for the
core engine lib and the package structure.
parent 941c5178
......@@ -32,8 +32,6 @@
#include <kuiserverjobtracker.h>
#include <Plasma/Containment>
#include <Plasma/Package>
#include <Plasma/PluginLoader>
#include "comicmodel.h"
#include "comicupdater.h"
......
......@@ -27,14 +27,13 @@ add_library(plasma_engine_comic STATIC ${comic_engine_SRCS})
target_link_libraries(plasma_engine_comic plasmacomicprovidercore
Qt::Qml
KF5::WidgetsAddons
KF5::Plasma
KF5::Package
KF5::I18n
)
kcoreaddons_add_plugin(plasma_packagestructure_comic SOURCES comic_package.cpp INSTALL_NAMESPACE "kpackage/packagestructure")
target_link_libraries(plasma_packagestructure_comic
KF5::WidgetsAddons
KF5::Plasma
KF5::Package
KF5::I18n
)
set_target_properties(plasma_packagestructure_comic PROPERTIES OUTPUT_NAME plasma_comic)
......@@ -48,7 +47,7 @@ set(comic_provider_core_SRCS
add_library(plasmacomicprovidercore STATIC ${comic_provider_core_SRCS})
target_link_libraries(plasmacomicprovidercore
KF5::WidgetsAddons
Qt::Gui
KF5::KIOCore
KF5::I18n
)
......@@ -16,7 +16,6 @@
#include <QUrl>
#include <KPackage/PackageLoader>
#include <Plasma/DataContainer>
#include <qloggingcategory.h>
#include "cachedprovider.h"
......
......@@ -7,9 +7,6 @@
#include "comicproviderkross.h"
#include "comic_package.h"
#include <KPackage/PackageLoader>
KPackage::PackageStructure *ComicProviderKross::m_packageStructure(nullptr);
ComicProviderKross::ComicProviderKross(QObject *parent, const KPluginMetaData &data, IdentifierType type, const QVariant &identifier)
: ComicProvider(parent, data, type, identifier)
......@@ -109,11 +106,3 @@ void ComicProviderKross::redirected(int id, const QUrl &newUrl)
{
m_wrapper.redirected(id, newUrl);
}
KPackage::PackageStructure *ComicProviderKross::packageStructure()
{
if (!m_packageStructure) {
m_packageStructure = KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Comic"));
}
return m_packageStructure;
}
......@@ -12,7 +12,6 @@
#include "comicproviderwrapper.h"
#include "types.h"
#include <KPackage/PackageStructure>
#include <QImage>
#include <QUrl>
......@@ -25,8 +24,6 @@ public:
ComicProviderKross(QObject *parent, const KPluginMetaData &data, IdentifierType type, const QVariant &identifier);
~ComicProviderKross() override;
static KPackage::PackageStructure *packageStructure();
bool isLeftToRight() const override;
bool isTopToBottom() const override;
IdentifierType identifierType() const override;
......@@ -48,7 +45,6 @@ protected:
private:
mutable ComicProviderWrapper m_wrapper;
static KPackage::PackageStructure *m_packageStructure;
};
#endif
......@@ -10,7 +10,8 @@
#include "comicproviderkross.h"
#include "types.h"
#include <Plasma/Package>
#include <KPackage/Package>
#include <KPackage/PackageLoader>
#include <QFile>
#include <QFileInfo>
#include <QJSEngine>
......@@ -284,7 +285,7 @@ void ComicProviderWrapper::init()
qCDebug(PLASMA_COMIC) << "ComicProviderWrapper::init() package is" << mProvider->pluginName() << " at " << path;
if (!path.isEmpty()) {
mPackage = new KPackage::Package(ComicProviderKross::packageStructure());
mPackage = new KPackage::Package(KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Comic")));
mPackage->setPath(path);
if (mPackage->isValid()) {
......
Supports Markdown
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