summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-18 20:57:13 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-18 20:57:13 -0600
commit708395a4e360226d2759b8b35f3cb9c02985b19f (patch)
tree7c8d986adc8f7c84142eae39e87fee5684169884 /ui
parent0bac046242cff4c98c78958ceb958176a8d05fc5 (diff)
downloadhorizon-708395a4e360226d2759b8b35f3cb9c02985b19f.tar.gz
horizon-708395a4e360226d2759b8b35f3cb9c02985b19f.tar.bz2
horizon-708395a4e360226d2759b8b35f3cb9c02985b19f.tar.xz
horizon-708395a4e360226d2759b8b35f3cb9c02985b19f.zip
Qt UI: Prompt for confirmation if erase disk is chosen
Thanks @djt for suggesting this.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/partitionchoicepage.cc13
-rw-r--r--ui/qt5/partitionchoicepage.hh1
2 files changed, 14 insertions, 0 deletions
diff --git a/ui/qt5/partitionchoicepage.cc b/ui/qt5/partitionchoicepage.cc
index 3045b79..ce0a473 100644
--- a/ui/qt5/partitionchoicepage.cc
+++ b/ui/qt5/partitionchoicepage.cc
@@ -13,6 +13,7 @@
#include "partitionchoicepage.hh"
#include <QLabel>
+#include <QMessageBox>
#include <QVBoxLayout>
PartitionChoicePage::PartitionChoicePage(QWidget *parent)
@@ -141,3 +142,15 @@ int PartitionChoicePage::nextId() const {
return HorizonWizard::Page_Network;
}
}
+
+bool PartitionChoicePage::validatePage() {
+ if(buttons->checkedButton() == eraseButton) {
+ return (QMessageBox::critical(this, tr("Erase Disk"),
+ tr("You have chosen to ERASE %1. "
+ "All data on %1 will be permanently erased.\n\n"
+ "Do you wish to continue?").arg(QString::fromStdString(horizonWizard()->chosen_disk)),
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes);
+ }
+
+ return true;
+}
diff --git a/ui/qt5/partitionchoicepage.hh b/ui/qt5/partitionchoicepage.hh
index 2e879ba..0483d65 100644
--- a/ui/qt5/partitionchoicepage.hh
+++ b/ui/qt5/partitionchoicepage.hh
@@ -25,6 +25,7 @@ public:
void initializePage() override;
bool isComplete() const override;
int nextId() const override;
+ bool validatePage() override;
private:
QLabel *descLabel;
QButtonGroup *buttons;