Commit 93a65424 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

[comic dataengine] Port away from KDELibs4Support

parent dd513334
......@@ -18,6 +18,7 @@ include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(GenerateExportHeader)
set(REQUIRED_QT_VERSION 5.9.0)
set(KF5_MIN_VERSION 5.42.0)
......
......@@ -9,9 +9,7 @@ find_package(KF5Kross REQUIRED)
add_library(plasma_engine_comic MODULE ${comic_engine_SRCS})
target_link_libraries(plasma_engine_comic plasmacomicprovidercore
KF5::KDELibs4Support
KF5::WidgetsAddons
KF5::Solid
KF5::Plasma
KF5::KrossCore
KF5::KrossUi
......@@ -48,9 +46,9 @@ set(comic_provider_core_SRCS
)
add_library(plasmacomicprovidercore SHARED ${comic_provider_core_SRCS})
generate_export_header(plasmacomicprovidercore EXPORT_FILE_NAME plasma_comic_export.h EXPORT_MACRO_NAME PLASMA_COMIC_EXPORT)
target_link_libraries(plasmacomicprovidercore
KF5::KDELibs4Support
KF5::WidgetsAddons
KF5::KIOCore
KF5::KrossCore
......@@ -76,7 +74,6 @@ set(plasma_comic_krossprovider_SRCS
add_library(plasma_comic_krossprovider MODULE ${plasma_comic_krossprovider_SRCS})
target_link_libraries(plasma_comic_krossprovider plasmacomicprovidercore
KF5::KDELibs4Support
Qt5::Gui
KF5::KIOCore
KF5::KrossCore
......
......@@ -35,7 +35,7 @@ static QString identifierToPath(const QString &identifier)
{
const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/plasma_engine_comic/");
return QString(dataDir + QString::fromAscii(QUrl::toPercentEncoding(identifier)));
return QString(dataDir + QString::fromLatin1(QUrl::toPercentEncoding(identifier)));
}
......
......@@ -48,14 +48,13 @@ ComicEngine::~ComicEngine()
void ComicEngine::init()
{
connect(Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
this, SLOT(networkStatusChanged(Solid::Networking::Status)));
connect(&m_networkConfigurationManager, &QNetworkConfigurationManager::onlineStateChanged,
this, &ComicEngine::onOnlineStateChanged);
}
void ComicEngine::networkStatusChanged(Solid::Networking::Status status)
void ComicEngine::onOnlineStateChanged(bool isOnline)
{
if ((status == Solid::Networking::Connected || status == Solid::Networking::Unknown) &&
!mIdentifierError.isEmpty()) {
if (isOnline && !mIdentifierError.isEmpty()) {
sourceRequestEvent(mIdentifierError);
}
}
......@@ -131,8 +130,7 @@ bool ComicEngine::updateSourceEvent(const QString &identifier)
}
// check if there is a connection
Solid::Networking::Status status = Solid::Networking::status();
if (status != Solid::Networking::Connected && status != Solid::Networking::Unknown) {
if (!m_networkConfigurationManager.isOnline()) {
mIdentifierError = identifier;
setData(identifier, QLatin1String("Error"), true);
setData(identifier, QLatin1String("Error automatically fixable"), true);
......@@ -321,7 +319,7 @@ QString ComicEngine::lastCachedIdentifier(const QString &identifier) const
{
const QString id = identifier.left(identifier.indexOf(QLatin1Char(':')));
QString data = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/plasma_engine_comic/");
data += QString::fromAscii(QUrl::toPercentEncoding(id));
data += QString::fromLatin1(QUrl::toPercentEncoding(id));
QSettings settings(data + QLatin1String(".conf"), QSettings::IniFormat);
QString previousIdentifier = settings.value(QLatin1String("lastCachedStripIdentifier"), QString()).toString();
......
......@@ -20,7 +20,8 @@
#define COMIC_DATAENGINE_H
#include <Plasma/DataEngine>
#include <Solid/Networking>
// Qt
#include <QNetworkConfigurationManager>
class ComicProvider;
......@@ -58,7 +59,7 @@ class ComicEngine : public Plasma::DataEngine
private Q_SLOTS:
void finished(ComicProvider*);
void error(ComicProvider*);
void networkStatusChanged(Solid::Networking::Status);
void onOnlineStateChanged(bool);
private:
bool mEmptySuffix;
......@@ -67,6 +68,7 @@ class ComicEngine : public Plasma::DataEngine
QString mIdentifierError;
QStringList mProviders;
QHash<QString, ComicProvider*> m_jobs;
QNetworkConfigurationManager m_networkConfigurationManager;
};
#endif
......@@ -29,9 +29,9 @@
#include <QDebug>
#include <QStandardPaths>
#include <Plasma/Package>
#include <Kross/Action>
#include <Kross/Interpreter>
#include <Kross/Manager>
#include <Kross/Core/Action>
#include <Kross/Core/Interpreter>
#include <Kross/Core/Manager>
#include <Plasma/PluginLoader>
......@@ -480,12 +480,12 @@ void ComicProviderWrapper::setTopToBottom(bool ttb)
QString ComicProviderWrapper::textCodec() const
{
return QString::fromAscii(mTextCodec);
return QString::fromLatin1(mTextCodec);
}
void ComicProviderWrapper::setTextCodec(const QString &textCodec)
{
mTextCodec = textCodec.toAscii();
mTextCodec = textCodec.toLatin1();
}
QString ComicProviderWrapper::comicAuthor() const
......
#ifndef PLASMA_COMIC_EXPORT_H
#define PLASMA_COMIC_EXPORT_H
/* needed for KDE_EXPORT macros */
#include <kdemacros.h>
#if defined _WIN32 || defined _WIN64
#ifndef PLASMA_COMIC_EXPORT
# ifdef MAKE_PLASMACOMICPROVIDERCORE_LIB
# define PLASMA_COMIC_EXPORT KDE_EXPORT
# else
# define PLASMA_COMIC_EXPORT KDE_IMPORT
# endif
#endif
#else /* UNIX*/
/* export statements for unix */
#define PLASMA_COMIC_EXPORT KDE_EXPORT
#endif
#endif
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