Skip to content

Commit d12d7ab

Browse files
committed
fix(WritingStep): Improve cancellation handling during writing and verification phases
- Added logic to skip verification if the image writer is in the verifying state when the next button is clicked. - Streamlined cancellation handling to ensure proper state management and user feedback during write failures. - Updated progress text to reflect the correct status after cancellation or failure.
1 parent a4fb64f commit d12d7ab

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/wizard/WritingStep.qml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,18 @@ WizardStepBase {
333333
// Handle next button clicks based on current state
334334
onNextClicked: {
335335
if (root.isWriting) {
336-
root.cancelPending = true
337-
root.isVerifying = false
338-
root.isFinalising = true
339-
progressBar.value = 100
340-
progressText.text = qsTr("Finalising…")
341-
imageWriter.cancelWrite()
336+
// If we're in verification phase, skip verification and let write complete successfully
337+
if (imageWriter.writeState === ImageWriter.Verifying) {
338+
imageWriter.skipCurrentVerification()
339+
} else {
340+
// Cancel the actual write operation
341+
root.cancelPending = true
342+
root.isVerifying = false
343+
root.isFinalising = true
344+
progressBar.value = 100
345+
progressText.text = qsTr("Finalising…")
346+
imageWriter.cancelWrite()
347+
}
342348
} else if (!root.isComplete) {
343349
// If warnings are disabled, skip the confirmation dialog
344350
if (wizardContainer.disableWarnings) {
@@ -525,17 +531,9 @@ WizardStepBase {
525531
function onError(msg) {
526532
root.isWriting = false
527533
wizardContainer.isWriting = false
528-
if (root.cancelPending) {
529-
// Treat verify-cancel as a benign finish
530-
root.cancelPending = false
531-
root.isFinalising = false
532-
root.isComplete = true
533-
progressText.text = qsTr("Verification cancelled")
534-
wizardContainer.nextStep()
535-
} else {
536-
root.isFinalising = false
537-
progressText.text = qsTr("Write failed: %1").arg(msg)
538-
}
534+
root.cancelPending = false
535+
root.isFinalising = false
536+
progressText.text = qsTr("Write failed: %1").arg(msg)
539537
}
540538

541539
function onFinalizing() {

0 commit comments

Comments
 (0)