From 8b6a58501484e3d8ffece603e85c9e2f90906d19 Mon Sep 17 00:00:00 2001 From: Daozhong Ma Date: Sat, 30 Mar 2024 17:42:40 +0000 Subject: [PATCH] Fix incorrect filename for duplicate copies on notification displays The filename is just changed after notification is displayed. BUG: 484727 --- core/compositefiletransferjob.cpp | 2 +- core/filetransferjob.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/compositefiletransferjob.cpp b/core/compositefiletransferjob.cpp index ecb7b9a14..2d620fbd0 100644 --- a/core/compositefiletransferjob.cpp +++ b/core/compositefiletransferjob.cpp @@ -41,12 +41,12 @@ void CompositeFileTransferJob::startNextSubJob() m_currentJob = qobject_cast(subjobs().at(0)); m_currentJobSentPayloadSize = 0; + m_currentJob->start(); Q_EMIT description(this, i18ncp("@title job", "Receiving file", "Receiving files", m_totalJobs), {i18nc("The source of a file operation", "Source"), Daemon::instance()->getDevice(this->m_deviceId)->name()}, {i18nc("The destination of a file operation", "Destination"), m_currentJob->destination().toDisplayString(QUrl::PreferLocalFile)}); - m_currentJob->start(); connect(m_currentJob, &FileTransferJob::processedAmountChanged, this, &CompositeFileTransferJob::slotProcessedAmount); } diff --git a/core/filetransferjob.cpp b/core/filetransferjob.cpp index cee1acc57..5a9246e21 100644 --- a/core/filetransferjob.cpp +++ b/core/filetransferjob.cpp @@ -41,12 +41,6 @@ FileTransferJob::FileTransferJob(const NetworkPacket *np, const QUrl &destinatio } void FileTransferJob::start() -{ - QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection); - // qCDebug(KDECONNECT_CORE) << "FileTransferJob start"; -} - -void FileTransferJob::doStart() { if (m_destination.isLocalFile() && QFile::exists(m_destination.toLocalFile())) { if (m_autoRename) { @@ -61,9 +55,15 @@ void FileTransferJob::doStart() return; } } + QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection); + // qCDebug(KDECONNECT_CORE) << "FileTransferJob start"; +} +void FileTransferJob::doStart() +{ if (m_origin->bytesAvailable()) startTransfer(); + connect(m_origin.data(), &QIODevice::readyRead, this, &FileTransferJob::startTransfer); }