mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
Allow to cancel download request
This commit is contained in:
@@ -121,6 +121,8 @@ namespace
|
||||
explicit DownloadHandlerImpl(const Net::DownloadRequest &downloadRequest, QObject *parent);
|
||||
~DownloadHandlerImpl() override;
|
||||
|
||||
void cancel() override;
|
||||
|
||||
QString url() const;
|
||||
const Net::DownloadRequest downloadRequest() const;
|
||||
|
||||
@@ -416,6 +418,17 @@ namespace
|
||||
delete m_reply;
|
||||
}
|
||||
|
||||
void DownloadHandlerImpl::cancel()
|
||||
{
|
||||
if (m_reply) {
|
||||
m_reply->abort();
|
||||
}
|
||||
else {
|
||||
setError(errorCodeToString(QNetworkReply::OperationCanceledError));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadHandlerImpl::assignNetworkReply(QNetworkReply *reply)
|
||||
{
|
||||
Q_ASSERT(reply);
|
||||
|
||||
Reference in New Issue
Block a user