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
This commit is contained in:
Àlex Fiestas 2014-03-03 21:07:02 +01:00
parent 3b276855a0
commit 93c0763e63
2 changed files with 7 additions and 0 deletions

View file

@ -37,6 +37,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int si
mOrigin = origin;
mSize = size;
mWritten = 0;
mDeviceName = i18nc("Device name that will appear on the jobs", "KDE-Connect");
kDebug(kdeconnect_kded()) << "FileTransferJob Downloading payload to" << destination;
}
@ -49,6 +50,10 @@ void 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
mDestination->start();
}

View file

@ -40,6 +40,7 @@ public:
virtual void start();
KUrl destination() { return mDestination->url(); }
void setDeviceName(const QString &deviceName) {mDeviceName = deviceName;};
public Q_SLOTS:
void readyRead();
void open(KIO::Job*);
@ -49,6 +50,7 @@ public Q_SLOTS:
private:
QSharedPointer<QIODevice> mOrigin;
KIO::FileJob* mDestination;
QString mDeviceName;
int mSize;
int mWritten;