Support canceling file transfer from pseudo job

Allows to click cancel on the job popup rather than only from
within NeoChat.
This commit is contained in:
Kai Uwe Broulik
2025-01-03 13:56:33 +01:00
parent 7b7f4d264c
commit 3b8c3afa3e
3 changed files with 16 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ FileTransferPseudoJob::FileTransferPseudoJob(Operation operation, const QString
, m_eventId(eventId)
, m_operation(operation)
{
setCapabilities(KJob::Killable);
}
void FileTransferPseudoJob::fileTransferProgress(const QString &id, qint64 progress, qint64 total)
@@ -58,3 +59,9 @@ void FileTransferPseudoJob::start()
{i18nc("The URL being downloaded/uploaded", "Source"), m_path},
{i18nc("The location being downloaded to", "Destination"), m_path});
}
bool FileTransferPseudoJob::doKill()
{
Q_EMIT cancelRequested(m_eventId);
return true;
}