Commit 4574aa36 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora
Browse files

Make the origin also contain the file name, not only the device name

parent 53e6381d
...@@ -33,7 +33,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 ...@@ -33,7 +33,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
: KJob() : KJob()
, mOrigin(origin) , mOrigin(origin)
, mReply(Q_NULLPTR) , mReply(Q_NULLPTR)
, mDeviceName("KDE Connect") //TODO: Actually fetch the device name , mFrom("KDE Connect")
, mDestination(destination) , mDestination(destination)
, mSpeedBytes(0) , mSpeedBytes(0)
, mWritten(0) , mWritten(0)
...@@ -47,6 +47,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 ...@@ -47,6 +47,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
if (size >= 0) { if (size >= 0) {
setTotalAmount(Bytes, size); setTotalAmount(Bytes, size);
} }
setCapabilities(Killable); setCapabilities(Killable);
qCDebug(KDECONNECT_CORE) << "FileTransferJob Downloading payload to" << destination; qCDebug(KDECONNECT_CORE) << "FileTransferJob Downloading payload to" << destination;
} }
...@@ -59,9 +60,8 @@ void FileTransferJob::start() ...@@ -59,9 +60,8 @@ void FileTransferJob::start()
void FileTransferJob::doStart() void FileTransferJob::doStart()
{ {
description(this, i18n("Receiving file over KDE-Connect"), description(this, i18n("Receiving file over KDE Connect"),
QPair<QString, QString>(i18nc("File transfer origin", "From"), QPair<QString, QString>(i18nc("File transfer origin", "From"), mFrom)
mDeviceName)
); );
if (mDestination.isLocalFile() && QFile::exists(mDestination.toLocalFile())) { if (mDestination.isLocalFile() && QFile::exists(mDestination.toLocalFile())) {
...@@ -77,9 +77,8 @@ void FileTransferJob::startTransfer() ...@@ -77,9 +77,8 @@ void FileTransferJob::startTransfer()
{ {
setProcessedAmount(Bytes, 0); setProcessedAmount(Bytes, 0);
mTime = QTime::currentTime(); mTime = QTime::currentTime();
description(this, i18n("Receiving file over KDE-Connect"), description(this, i18n("Receiving file over KDE Connect"),
QPair<QString, QString>(i18nc("File transfer origin", "From"), QPair<QString, QString>(i18nc("File transfer origin", "From"), mFrom),
mDeviceName),
QPair<QString, QString>(i18nc("File transfer destination", "To"), mDestination.toLocalFile())); QPair<QString, QString>(i18nc("File transfer destination", "To"), mDestination.toLocalFile()));
QNetworkRequest req(mDestination); QNetworkRequest req(mDestination);
......
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 size, const QUrl &destination); FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 size, const QUrl &destination);
virtual void start() Q_DECL_OVERRIDE; virtual void start() Q_DECL_OVERRIDE;
QUrl destination() const { return mDestination; } QUrl destination() const { return mDestination; }
void setDeviceName(const QString &deviceName) { mDeviceName = deviceName; } void setOriginName(QString from) { mFrom = from; }
private Q_SLOTS: private Q_SLOTS:
void doStart(); void doStart();
...@@ -67,7 +67,7 @@ private: ...@@ -67,7 +67,7 @@ private:
QSharedPointer<QIODevice> mOrigin; QSharedPointer<QIODevice> mOrigin;
QNetworkReply* mReply; QNetworkReply* mReply;
QString mDeviceName; QString mFrom;
QUrl mDestination; QUrl mDestination;
QTime mTime; QTime mTime;
qulonglong mSpeedBytes; qulonglong mSpeedBytes;
......
...@@ -96,7 +96,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) ...@@ -96,7 +96,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np)
} }
FileTransferJob* job = np.createPayloadTransferJob(destination); FileTransferJob* job = np.createPayloadTransferJob(destination);
job->setDeviceName(device()->name()); job->setOriginName(device()->name() + ": " + filename);
connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*))); connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*)));
KIO::getJobTracker()->registerJob(job); KIO::getJobTracker()->registerJob(job);
job->start(); job->start();
......
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