Commit 724a5a14 authored by Nicolas Fella's avatar Nicolas Fella

Don't use KIO in core when building for Sailfish

parent 1c6d4565
Pipeline #9557 passed with stage
in 8 minutes and 2 seconds
......@@ -66,7 +66,7 @@ else()
if(NOT WIN32 AND NOT APPLE)
find_package(KF5PulseAudioQt)
endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII -DHAVE_KIO)
endif()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Quick Network)
......
......@@ -49,7 +49,6 @@ target_link_libraries(kdeconnectcore
PUBLIC
Qt5::Network
KF5::CoreAddons
KF5::KIOCore
qca-qt5
PRIVATE
Qt5::DBus
......@@ -57,6 +56,10 @@ PRIVATE
KF5::ConfigCore
)
if(${KF5KIO_FOUND})
target_link_libraries(kdeconnectcore PUBLIC KF5::KIOCore)
endif()
if (BLUETOOTH_ENABLED)
target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_BLUETOOTH)
target_link_libraries(kdeconnectcore PRIVATE Qt5::Bluetooth)
......
......@@ -21,13 +21,16 @@
#include "compositeuploadjob.h"
#include <core_debug.h>
#include <KLocalizedString>
#include <kio/global.h>
#include <KJobTrackerInterface>
#include "lanlinkprovider.h"
#include <daemon.h>
#include "plugins/share/shareplugin.h"
CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNotification)
#ifdef HAVE_KIO
#include <kio/global.h>
#endif
CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNotification)
: KCompositeJob()
, m_server(new Server(this))
, m_socket(nullptr)
......@@ -44,9 +47,9 @@ CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNoti
, m_updatePacketPending(false)
{
setCapabilities(Killable);
if (displayNotification) {
KIO::getJobTracker()->registerJob(this);
Daemon::instance()->jobTracker()->registerJob(this);
}
}
......@@ -283,13 +286,13 @@ void CompositeUploadJob::slotResult(KJob *job) {
void CompositeUploadJob::emitDescription(const QString& currentFileName) {
QPair<QString, QString> field2;
if (m_totalJobs > 1) {
field2.first = i18n("Progress");
field2.second = i18n("Sending file %1 of %2", m_currentJobNum, m_totalJobs);
}
Q_EMIT description(this, i18n("Sending to %1", Daemon::instance()->getDevice(this->m_deviceId)->name()),
Q_EMIT description(this, i18n("Sending to %1", Daemon::instance()->getDevice(this->m_deviceId)->name()),
{ i18n("File"), currentFileName }, field2
);
}
......@@ -21,7 +21,6 @@
#include "compositefiletransferjob.h"
#include <core_debug.h>
#include <KLocalizedString>
#include <kio/global.h>
#include <KJobTrackerInterface>
#include <daemon.h>
#include "filetransferjob.h"
......
......@@ -32,6 +32,7 @@ class NetworkPacket;
class DeviceLink;
class Device;
class QNetworkAccessManager;
class KJobTrackerInterface;
class KDECONNECTCORE_EXPORT Daemon
: public QObject
......@@ -53,6 +54,7 @@ public:
virtual void reportError(const QString& title, const QString& description) = 0;
virtual void quit() = 0;
virtual QNetworkAccessManager* networkAccessManager();
virtual KJobTrackerInterface* jobTracker() = 0;
Device* getDevice(const QString& deviceId);
......
......@@ -85,6 +85,11 @@ public:
return m_nam;
}
KJobTrackerInterface* jobTracker() override
{
return KIO::getJobTracker();
}
Q_SCRIPTABLE void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) override
{
KNotification* notification = new KNotification(eventId); //KNotification::Persistent
......
......@@ -11,13 +11,16 @@ include_directories(
set(kdeconnect_libraries
kdeconnectcore
KF5::I18n
KF5::KIOWidgets
Qt5::DBus
Qt5::Network
Qt5::Test
qca-qt5
)
if(${KF5KIO_FOUND})
list(APPEND kdeconnect_libraries KF5::KIOWidgets)
endif()
set(kdeconnect_sms_libraries
kdeconnectsmshelper
Qt5::Test
......
......@@ -24,12 +24,22 @@
#include <core/daemon.h>
#include <core/backends/pairinghandler.h>
#include <QCoreApplication>
#include <KJobTrackerInterface>
#ifdef HAVE_KIO
#include <KIO/AccessManager>
#else
#include <QNetworkAccessManager>
#endif
class TestDaemon : public Daemon
{
public:
TestDaemon(QObject* parent = nullptr)
: Daemon(parent, true)
, m_nam(nullptr)
, m_jobTrackerInterface(nullptr)
{
// Necessary to force the event loop to run because the test harness seems to behave differently
// and we need the QTimer::SingleShot in Daemon's constructor to fire
......@@ -52,7 +62,11 @@ public:
QNetworkAccessManager* networkAccessManager() override
{
if (!m_nam) {
#ifdef HAVE_KIO
m_nam = new KIO::AccessManager(this);
#else
m_nam = new QNetworkAccessManager(this);
#endif
}
return m_nam;
}
......@@ -66,8 +80,17 @@ public:
qDebug() << "quit was called";
}
KJobTrackerInterface* jobTracker() override
{
if (!m_jobTrackerInterface) {
m_jobTrackerInterface = new KJobTrackerInterface();
}
return m_jobTrackerInterface;
}
private:
QNetworkAccessManager* m_nam;
KJobTrackerInterface* m_jobTrackerInterface;
};
#endif
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