diff --git a/qt/main_window.cpp b/qt/main_window.cpp index 045c1b7..56360c6 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -560,6 +560,22 @@ void MainWindow::slotProgWrite() int index; QString chipName; + // Add confirmation dialog + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Confirm write")); + msgBox.setText(tr("Are you sure you want to write the chip?")); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Cancel); + + // If the user clicks cancel, exit the function. + if (msgBox.exec() != QMessageBox::Ok) + { + qInfo() << "User canceled the write operation"; + return; + } + + workFile.setFileName(ui->filePathLineEdit->text()); if (!workFile.open(QIODevice::ReadOnly)) {