Commit def41978 authored by David Rosca's avatar David Rosca
Browse files

ReceiveFileJob: Don't cancel the request right after accepting it

KNotification::closed is emitted also when one of the notification
actions was triggered.

BUG: 376773
FIXED-IN: 5.8.7

Differential Revision: https://phabricator.kde.org/D4744
parent 6048d0d2
......@@ -44,6 +44,7 @@ ReceiveFileJob::ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::Ob
, m_transfer(transfer)
, m_session(session)
, m_request(req)
, m_accepted(false)
{
setCapabilities(Killable);
}
......@@ -173,12 +174,13 @@ void ReceiveFileJob::slotAccept()
m_tempPath = createTempPath(m_transfer->name());
qCDebug(BLUEDAEMON) << "TempPath" << m_tempPath;
m_accepted = true;
m_request.accept(m_tempPath);
}
void ReceiveFileJob::slotCancel()
{
if (m_transfer->status() == BluezQt::ObexTransfer::Queued) {
if (!m_accepted && m_transfer->status() == BluezQt::ObexTransfer::Queued) {
qCDebug(BLUEDAEMON) << "Cancel Push";
m_request.reject();
setError(KJob::UserDefinedError);
......
......@@ -66,6 +66,7 @@ private:
BluezQt::ObexTransferPtr m_transfer;
BluezQt::ObexSessionPtr m_session;
BluezQt::Request<QString> m_request;
bool m_accepted;
};
#endif // RECEIVEFILEJOB_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment