Commit 93c0763e authored by Àlex Fiestas's avatar Àlex Fiestas

Emit a description in filetransferjob

This basically allows Plasma (or any other job trakcer) to show
a nice description showing FROM and TO, kinda:

From: Nexus5
To: ~/afiestas/Downloads/foo.mkv
parent 3b276855
...@@ -37,6 +37,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int si ...@@ -37,6 +37,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int si
mOrigin = origin; mOrigin = origin;
mSize = size; mSize = size;
mWritten = 0; mWritten = 0;
mDeviceName = i18nc("Device name that will appear on the jobs", "KDE-Connect");
kDebug(kdeconnect_kded()) << "FileTransferJob Downloading payload to" << destination; kDebug(kdeconnect_kded()) << "FileTransferJob Downloading payload to" << destination;
} }
...@@ -49,6 +50,10 @@ void FileTransferJob::start() ...@@ -49,6 +50,10 @@ void FileTransferJob::start()
{ {
//kDebug(kdeconnect_kded()) << "FileTransferJob start"; //kDebug(kdeconnect_kded()) << "FileTransferJob start";
description(this, i18n("Receiving file over KDE-Connect"),
QPair<QString, QString>(i18nc("File transfer origin", "From"),
QString(mDeviceName)),
QPair<QString, QString>(i18nc("File transfer destination", "To"), mDestination->url().path()));
//Open destination file //Open destination file
mDestination->start(); mDestination->start();
} }
......
...@@ -40,6 +40,7 @@ public: ...@@ -40,6 +40,7 @@ public:
virtual void start(); virtual void start();
KUrl destination() { return mDestination->url(); } KUrl destination() { return mDestination->url(); }
void setDeviceName(const QString &deviceName) {mDeviceName = deviceName;};
public Q_SLOTS: public Q_SLOTS:
void readyRead(); void readyRead();
void open(KIO::Job*); void open(KIO::Job*);
...@@ -49,6 +50,7 @@ public Q_SLOTS: ...@@ -49,6 +50,7 @@ public Q_SLOTS:
private: private:
QSharedPointer<QIODevice> mOrigin; QSharedPointer<QIODevice> mOrigin;
KIO::FileJob* mDestination; KIO::FileJob* mDestination;
QString mDeviceName;
int mSize; int mSize;
int mWritten; int mWritten;
......
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