summaryrefslogtreecommitdiff
path: root/ui/qt5/horizonwizard.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-06 04:49:30 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-06 04:49:30 -0600
commitd3728b38b12b2f9762ba26fc6fc302cb79f7ee6c (patch)
tree3c0d47166a89110fa504aa1557f69de6e89073bc /ui/qt5/horizonwizard.cc
parentd71a5c29f6d22d2fb18bd483333eaf37b827fd0d (diff)
downloadhorizon-d3728b38b12b2f9762ba26fc6fc302cb79f7ee6c.tar.gz
horizon-d3728b38b12b2f9762ba26fc6fc302cb79f7ee6c.tar.bz2
horizon-d3728b38b12b2f9762ba26fc6fc302cb79f7ee6c.tar.xz
horizon-d3728b38b12b2f9762ba26fc6fc302cb79f7ee6c.zip
Qt UI: Implement UI.Writeout and UI.Commit requirements
Diffstat (limited to 'ui/qt5/horizonwizard.cc')
-rw-r--r--ui/qt5/horizonwizard.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc
index 6b44d49..4c12d72 100644
--- a/ui/qt5/horizonwizard.cc
+++ b/ui/qt5/horizonwizard.cc
@@ -25,11 +25,15 @@
#ifdef HAS_INSTALL_ENV
# include <libudev.h>
# include <net/if.h> /* ifreq */
+# include "commitpage.hh"
extern "C" {
# include <skalibs/tai.h> /* STAMP */
}
# include <sys/ioctl.h> /* ioctl */
# include <unistd.h> /* close */
+#else
+# include <QFileDialog>
+# include "writeoutpage.hh"
#endif /* HAS_INSTALL_ENV */
#include "intropage.hh"
@@ -201,6 +205,11 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) {
setPage(Page_Boot, new BootPage);
setPage(Page_Root, new RootPassphrasePage);
setPage(Page_Accounts, new AccountPage);
+#ifndef HAS_INSTALL_ENV
+ setPage(Page_Write, new WriteoutPage);
+#else /* HAS_INSTALL_ENV */
+ setPage(Page_Commit, new CommitPage);
+#endif /* !HAS_INSTALL_ENV */
QObject::connect(this, &QWizard::helpRequested, [=](void) {
if(help_id_map.find(currentId()) == help_id_map.end()) {
@@ -402,5 +411,28 @@ QString HorizonWizard::toHScript() {
#include <iostream>
void HorizonWizard::accept() {
- std::cout << toHScript().toStdString() << std::endl;
+ QFile file;
+#ifdef HAS_INSTALL_ENV
+ file.setFileName("/etc/horizon/installfile");
+#else /* !HAS_INSTALL_ENV */
+ QFileDialog fileChooser(this);
+ fileChooser.setAcceptMode(QFileDialog::AcceptSave);
+ fileChooser.setNameFilter(tr("Installation Scripts (installfile)"));
+ fileChooser.setViewMode(QFileDialog::List);
+
+ if(fileChooser.exec()) {
+ file.setFileName(fileChooser.selectedFiles().at(0));
+ } else {
+ return;
+ }
+#endif /* HAS_INSTALL_ENV */
+ if(!file.open(QFile::WriteOnly)) {
+ QMessageBox::critical(this, tr("Couldn't Save Script"),
+ tr("An issue occurred while saving the installation script: %1").arg(file.errorString()));
+ return;
+ }
+ file.write(toHScript().toUtf8());
+ file.close();
+
+ done(QDialog::Accepted);
}