From 4574aa3639c9a0b38075615c9b68e373843c59b1 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sat, 17 Oct 2015 13:32:57 -0700 Subject: [PATCH] Make the origin also contain the file name, not only the device name --- core/filetransferjob.cpp | 13 ++++++------- core/filetransferjob.h | 4 ++-- plugins/share/shareplugin.cpp | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/core/filetransferjob.cpp b/core/filetransferjob.cpp index 46c84e270..662909313 100644 --- a/core/filetransferjob.cpp +++ b/core/filetransferjob.cpp @@ -33,7 +33,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer& origin, qint64 : KJob() , mOrigin(origin) , mReply(Q_NULLPTR) - , mDeviceName("KDE Connect") //TODO: Actually fetch the device name + , mFrom("KDE Connect") , mDestination(destination) , mSpeedBytes(0) , mWritten(0) @@ -47,6 +47,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer& origin, qint64 if (size >= 0) { setTotalAmount(Bytes, size); } + setCapabilities(Killable); qCDebug(KDECONNECT_CORE) << "FileTransferJob Downloading payload to" << destination; } @@ -59,9 +60,8 @@ void FileTransferJob::start() void FileTransferJob::doStart() { - description(this, i18n("Receiving file over KDE-Connect"), - QPair(i18nc("File transfer origin", "From"), - mDeviceName) + description(this, i18n("Receiving file over KDE Connect"), + QPair(i18nc("File transfer origin", "From"), mFrom) ); if (mDestination.isLocalFile() && QFile::exists(mDestination.toLocalFile())) { @@ -77,9 +77,8 @@ void FileTransferJob::startTransfer() { setProcessedAmount(Bytes, 0); mTime = QTime::currentTime(); - description(this, i18n("Receiving file over KDE-Connect"), - QPair(i18nc("File transfer origin", "From"), - mDeviceName), + description(this, i18n("Receiving file over KDE Connect"), + QPair(i18nc("File transfer origin", "From"), mFrom), QPair(i18nc("File transfer destination", "To"), mDestination.toLocalFile())); QNetworkRequest req(mDestination); diff --git a/core/filetransferjob.h b/core/filetransferjob.h index 859a30321..2d26ba408 100644 --- a/core/filetransferjob.h +++ b/core/filetransferjob.h @@ -53,7 +53,7 @@ public: FileTransferJob(const QSharedPointer& origin, qint64 size, const QUrl &destination); virtual void start() Q_DECL_OVERRIDE; QUrl destination() const { return mDestination; } - void setDeviceName(const QString &deviceName) { mDeviceName = deviceName; } + void setOriginName(QString from) { mFrom = from; } private Q_SLOTS: void doStart(); @@ -67,7 +67,7 @@ private: QSharedPointer mOrigin; QNetworkReply* mReply; - QString mDeviceName; + QString mFrom; QUrl mDestination; QTime mTime; qulonglong mSpeedBytes; diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index b4331b32a..e462a8bb7 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -96,7 +96,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) } FileTransferJob* job = np.createPayloadTransferJob(destination); - job->setDeviceName(device()->name()); + job->setOriginName(device()->name() + ": " + filename); connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*))); KIO::getJobTracker()->registerJob(job); job->start();