diff --git a/src/vorta/views/repo_add_dialog.py b/src/vorta/views/repo_add_dialog.py index dbb88a299e..3c0ddaff82 100644 --- a/src/vorta/views/repo_add_dialog.py +++ b/src/vorta/views/repo_add_dialog.py @@ -27,7 +27,7 @@ def __init__(self, parent=None): self.saveButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) self.saveButton.setText(self.tr("Add")) - self.buttonBox.rejected.connect(self.close) + self.buttonBox.rejected.connect(lambda: (QApplication.instance().jobs_manager.cancel_all_jobs(), self.close())) self.buttonBox.accepted.connect(self.run) self.chooseLocalFolderButton.clicked.connect(self.choose_local_backup_folder) self.useRemoteRepoButton.clicked.connect(self.use_remote_repo_action) @@ -242,10 +242,10 @@ def run(self): params = BorgInfoRepoJob.prepare(self.values) if params['ok']: self.saveButton.setEnabled(False) - thread = BorgInfoRepoJob(params['cmd'], params) - thread.updated.connect(self._set_status) - thread.result.connect(self.run_result) - self.thread = thread # Needs to be connected to self for tests to work. - self.thread.run() + job = BorgInfoRepoJob(params['cmd'], params) + job.updated.connect(self._set_status) + job.result.connect(self.run_result) + self.job = job # Needs to be connected to self for tests to work. + QApplication.instance().jobs_manager.add_job(job) else: self._set_status(params['message'])