Fix incorrect filename for duplicate copies on notification displays

The filename is just changed after notification is displayed.

BUG: 484727
This commit is contained in:
Daozhong Ma 2024-03-30 17:42:40 +00:00
parent 3980dc0b24
commit 8b6a585014
2 changed files with 7 additions and 7 deletions

View file

@ -41,12 +41,12 @@ void CompositeFileTransferJob::startNextSubJob()
m_currentJob = qobject_cast<FileTransferJob *>(subjobs().at(0)); m_currentJob = qobject_cast<FileTransferJob *>(subjobs().at(0));
m_currentJobSentPayloadSize = 0; m_currentJobSentPayloadSize = 0;
m_currentJob->start();
Q_EMIT description(this, Q_EMIT description(this,
i18ncp("@title job", "Receiving file", "Receiving files", m_totalJobs), 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 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)}); {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); connect(m_currentJob, &FileTransferJob::processedAmountChanged, this, &CompositeFileTransferJob::slotProcessedAmount);
} }

View file

@ -41,12 +41,6 @@ FileTransferJob::FileTransferJob(const NetworkPacket *np, const QUrl &destinatio
} }
void FileTransferJob::start() 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_destination.isLocalFile() && QFile::exists(m_destination.toLocalFile())) {
if (m_autoRename) { if (m_autoRename) {
@ -61,9 +55,15 @@ void FileTransferJob::doStart()
return; return;
} }
} }
QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection);
// qCDebug(KDECONNECT_CORE) << "FileTransferJob start";
}
void FileTransferJob::doStart()
{
if (m_origin->bytesAvailable()) if (m_origin->bytesAvailable())
startTransfer(); startTransfer();
connect(m_origin.data(), &QIODevice::readyRead, this, &FileTransferJob::startTransfer); connect(m_origin.data(), &QIODevice::readyRead, this, &FileTransferJob::startTransfer);
} }