Por filetranasferjob to QUrl

Pretty much a straight forward port from KUrl to QUrl, since we are only
forwarding arguments there was not much to port but a simple /kurl/qurl/
This commit is contained in:
Àlex Fiestas 2014-09-21 22:22:06 +02:00
parent e96fe74b64
commit 473a34b76f
4 changed files with 8 additions and 8 deletions

View file

@ -28,7 +28,7 @@
#include "kdebugnamespace.h" #include "kdebugnamespace.h"
FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const KUrl& destination): KJob() FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const QUrl &destination): KJob()
{ {
Q_ASSERT(destination.isLocalFile()); Q_ASSERT(destination.isLocalFile());
//TODO: Make a precondition before calling this function that destination file exists //TODO: Make a precondition before calling this function that destination file exists
@ -61,7 +61,7 @@ void FileTransferJob::doStart()
QPair<QString, QString>(i18nc("File transfer origin", "From"), QPair<QString, QString>(i18nc("File transfer origin", "From"),
QString(mDeviceName)) QString(mDeviceName))
); );
KUrl destCheck = mDestination; QUrl destCheck = mDestination;
if (QFile::exists(destCheck.path())) { if (QFile::exists(destCheck.path())) {
QFileInfo destInfo(destCheck.path()); QFileInfo destInfo(destCheck.path());
KIO::RenameDialog *dialog = new KIO::RenameDialog(Q_NULLPTR, KIO::RenameDialog *dialog = new KIO::RenameDialog(Q_NULLPTR,

View file

@ -26,7 +26,7 @@
#include <QTemporaryFile> #include <QTemporaryFile>
#include <KJob> #include <KJob>
#include <KUrl> #include <QUrl>
#include <KIO/FileJob> #include <KIO/FileJob>
#include <KIO/Job> #include <KIO/Job>
#include <KSharedPtr> #include <KSharedPtr>
@ -37,9 +37,9 @@ class FileTransferJob
Q_OBJECT Q_OBJECT
public: public:
FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const KUrl& destination); FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const QUrl &destination);
virtual void start(); virtual void start();
KUrl destination() const { return mDestination; } QUrl destination() const { return mDestination; }
void setDeviceName(const QString &deviceName) {mDeviceName = deviceName;}; void setDeviceName(const QString &deviceName) {mDeviceName = deviceName;};
public Q_SLOTS: public Q_SLOTS:

View file

@ -207,7 +207,7 @@ bool NetworkPackage::decrypt(QCA::PrivateKey& key, NetworkPackage* out) const
} }
FileTransferJob* NetworkPackage::createPayloadTransferJob(const KUrl& destination) const FileTransferJob* NetworkPackage::createPayloadTransferJob(const QUrl &destination) const
{ {
return new FileTransferJob(payload(), payloadSize(), destination); return new FileTransferJob(payload(), payloadSize(), destination);
} }

View file

@ -30,7 +30,7 @@
#include <QIODevice> #include <QIODevice>
#include <QtCrypto> #include <QtCrypto>
#include <QSharedPointer> #include <QSharedPointer>
#include <KUrl> #include <QUrl>
#include "kdeconnectcore_export.h" #include "kdeconnectcore_export.h"
#include "kdebugnamespace.h" #include "kdebugnamespace.h"
@ -77,7 +77,7 @@ public:
void setPayload(const QSharedPointer<QIODevice>& device, int payloadSize) { mPayload = device; mPayloadSize = payloadSize; Q_ASSERT(mPayloadSize >= -1); } void setPayload(const QSharedPointer<QIODevice>& device, int payloadSize) { mPayload = device; mPayloadSize = payloadSize; Q_ASSERT(mPayloadSize >= -1); }
bool hasPayload() const { return (mPayloadSize != 0); } bool hasPayload() const { return (mPayloadSize != 0); }
int payloadSize() const { return mPayloadSize; } //-1 means it is an endless stream int payloadSize() const { return mPayloadSize; } //-1 means it is an endless stream
FileTransferJob* createPayloadTransferJob(const KUrl& destination) const; FileTransferJob* createPayloadTransferJob(const QUrl &destination) const;
//To be called by a particular DeviceLink //To be called by a particular DeviceLink
QVariantMap payloadTransferInfo() const { return mPayloadTransferInfo; } QVariantMap payloadTransferInfo() const { return mPayloadTransferInfo; }