diff --git a/plugins/share/kdeconnect_share.json b/plugins/share/kdeconnect_share.json --- a/plugins/share/kdeconnect_share.json +++ b/plugins/share/kdeconnect_share.json @@ -88,10 +88,14 @@ "Version": "0.1", "Website": "http://albertvaka.wordpress.com" }, + "X-KdeConnect-IngoingPackageType": [ + "kdeconnect.share.ack" + ], "X-KdeConnect-OutgoingPackageType": [ "kdeconnect.share.request" ], "X-KdeConnect-SupportedPackageType": [ - "kdeconnect.share.request" + "kdeconnect.share.request", + "kdeconnect.share.ack" ] } diff --git a/plugins/share/shareplugin.h b/plugins/share/shareplugin.h --- a/plugins/share/shareplugin.h +++ b/plugins/share/shareplugin.h @@ -27,6 +27,7 @@ #include #define PACKAGE_TYPE_SHARE_REQUEST QStringLiteral("kdeconnect.share.request") +#define PACKAGE_TYPE_SHARE_ACK QStringLiteral("kdeconnect.share.ack") class SharePlugin : public KdeConnectPlugin diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "core/filetransferjob.h" @@ -84,10 +85,26 @@ } */ - qCDebug(KDECONNECT_PLUGIN_SHARE) << "File transfer"; + if (np.type() == PACKAGE_TYPE_SHARE_ACK) { + qCDebug(KDECONNECT_PLUGIN_SHARE) << "Received ACK for " << np.get(QStringLiteral("filename")) << ": " << np.get(QStringLiteral("success")); + + KNotification* noti = new KNotification(QStringLiteral("notification"), KNotification::CloseOnTimeout, this); + noti->setComponentName(QStringLiteral("kdeconnect")); + noti->setTitle(device()->name()); + + if (np.get(QStringLiteral("success"))) { + noti->setText(np.get(QStringLiteral("filename")) + i18n(" was sent successfully")); + noti->setIconName(QStringLiteral("dialog-ok")); + } else { + noti->setText(np.get(QStringLiteral("filename")) + i18n(" could not be sent")); + noti->setIconName(QStringLiteral("preferences-desktop-notification")); + } + noti->sendEvent(); + return true; + } if (np.hasPayload()) { - //qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file"; + qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file"; const QString filename = np.get(QStringLiteral("filename"), QString::number(QDateTime::currentMSecsSinceEpoch())); const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash); QUrl destination(dir.toString() + '/' + filename);