fix: allow aborting CF modpack importing

This commit is contained in:
flow 2022-04-07 18:56:34 -03:00
parent be2512bb4b
commit 167e32a69f
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
2 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,14 @@ InstanceImportTask::InstanceImportTask(const QUrl sourceUrl)
m_sourceUrl = sourceUrl; m_sourceUrl = sourceUrl;
} }
bool InstanceImportTask::abort()
{
m_filesNetJob->abort();
m_extractFuture.cancel();
return false;
}
void InstanceImportTask::executeTask() void InstanceImportTask::executeTask()
{ {
if (m_sourceUrl.isLocalFile()) if (m_sourceUrl.isLocalFile())

View File

@ -37,6 +37,9 @@ class InstanceImportTask : public InstanceTask
public: public:
explicit InstanceImportTask(const QUrl sourceUrl); explicit InstanceImportTask(const QUrl sourceUrl);
bool canAbort() const override { return true; }
bool abort() override;
protected: protected:
//! Entry point for tasks. //! Entry point for tasks.
virtual void executeTask() override; virtual void executeTask() override;