diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 6bf89c05b..4075b704d 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -295,7 +295,7 @@ int main(int argc, char** argv) const QString fileName = parser.value(QStringLiteral("photo")); if (!fileName.isEmpty()) { QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto")); - msg.setArguments({fileName}); + msg.setArguments({QUrl::fromLocalFile(fileName).toString()}); blockOnReply(QDBusConnection::sessionBus().asyncCall(msg)); } else { QTextStream(stderr) << i18n("Please specify a filename for the photo") << endl; diff --git a/plugins/photo/photoplugin.cpp b/plugins/photo/photoplugin.cpp index b9aba0574..ba4513435 100644 --- a/plugins/photo/photoplugin.cpp +++ b/plugins/photo/photoplugin.cpp @@ -35,18 +35,18 @@ bool PhotoPlugin::receivePacket(const NetworkPacket& np) return true; } - const QString& fileName = requestedFiles.takeFirst(); - FileTransferJob* job = np.createPayloadTransferJob(QUrl::fromLocalFile(fileName)); - connect(job, &FileTransferJob::result, this, [this, fileName] { - Q_EMIT photoReceived(fileName); + const QString url = requestedFiles.takeFirst(); + FileTransferJob* job = np.createPayloadTransferJob(QUrl(url)); + connect(job, &FileTransferJob::result, this, [this, url] { + Q_EMIT photoReceived(url); }); job->start(); return true; } -void PhotoPlugin::requestPhoto(const QString& fileName) +void PhotoPlugin::requestPhoto(const QString& url) { - requestedFiles.append(fileName); + requestedFiles.append(url); NetworkPacket np(PACKET_TYPE_PHOTO_REQUEST); sendPacket(np); } diff --git a/plugins/photo/photoplugin.h b/plugins/photo/photoplugin.h index 80a94061e..ef496c796 100644 --- a/plugins/photo/photoplugin.h +++ b/plugins/photo/photoplugin.h @@ -24,7 +24,7 @@ public: explicit PhotoPlugin(QObject* parent, const QVariantList& args); ~PhotoPlugin() override; - Q_SCRIPTABLE void requestPhoto(const QString& fileName); + Q_SCRIPTABLE void requestPhoto(const QString& url); bool receivePacket(const NetworkPacket& np) override; void connected() override {} @@ -32,7 +32,7 @@ public: QString dbusPath() const override; Q_SIGNALS: - Q_SCRIPTABLE void photoReceived(const QString& fileName); + Q_SCRIPTABLE void photoReceived(const QString& url); private: QStringList requestedFiles;