Make the origin also contain the file name, not only the device name
This commit is contained in:
parent
53e6381d30
commit
4574aa3639
3 changed files with 9 additions and 10 deletions
|
@ -33,7 +33,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& 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<QIODevice>& 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<QString, QString>(i18nc("File transfer origin", "From"),
|
||||
mDeviceName)
|
||||
description(this, i18n("Receiving file over KDE Connect"),
|
||||
QPair<QString, QString>(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<QString, QString>(i18nc("File transfer origin", "From"),
|
||||
mDeviceName),
|
||||
description(this, i18n("Receiving file over KDE Connect"),
|
||||
QPair<QString, QString>(i18nc("File transfer origin", "From"), mFrom),
|
||||
QPair<QString, QString>(i18nc("File transfer destination", "To"), mDestination.toLocalFile()));
|
||||
|
||||
QNetworkRequest req(mDestination);
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
FileTransferJob(const QSharedPointer<QIODevice>& 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<QIODevice> mOrigin;
|
||||
QNetworkReply* mReply;
|
||||
QString mDeviceName;
|
||||
QString mFrom;
|
||||
QUrl mDestination;
|
||||
QTime mTime;
|
||||
qulonglong mSpeedBytes;
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue