summaryrefslogtreecommitdiff
path: root/wizard
diff options
context:
space:
mode:
Diffstat (limited to 'wizard')
-rw-r--r--wizard/hdmap.cpp23
-rw-r--r--wizard/hdmap.h2
-rw-r--r--wizard/rootpartition.cpp29
-rw-r--r--wizard/rootpartition.h3
4 files changed, 55 insertions, 2 deletions
diff --git a/wizard/hdmap.cpp b/wizard/hdmap.cpp
index 526ebef..491e5b6 100644
--- a/wizard/hdmap.cpp
+++ b/wizard/hdmap.cpp
@@ -8,8 +8,11 @@ wpHdMap::wpHdMap(QWidget *parent) : QWizardPage(parent)
setupUi(this);
backend = Backend::instance();
connect(backend, SIGNAL(receivedDataLine(QString,QString)), this, SLOT(receivedDataLine(QString,QString)));
+ connect(backend, SIGNAL(receivedCommand(QString,QString)), this, SLOT(receivedCommand(QString,QString)));
connect(backend, SIGNAL(finishedCommand(QString)), this, SLOT(backendFinishedCommand(QString)));
tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
+
+ checkPassed = false;
}
void wpHdMap::initializePage()
@@ -39,6 +42,11 @@ void wpHdMap::receivedDataLine(QString data, QString line)
}
}
+void wpHdMap::receivedCommand(QString command, QString args)
+{
+ if(command == "error") checkPassed = false;
+}
+
void wpHdMap::backendFinishedCommand(QString command)
{
if(command == "fill_hdmap")
@@ -65,6 +73,12 @@ void wpHdMap::backendFinishedCommand(QString command)
if(hdmap.at(row).section(":",3,3) == "auto") automount->setChecked(true); else automount->setChecked(false);
tableWidget->setCellWidget(row, 3, automount);
}
+
+ checkPassed = false;
+ }
+ else if(command == "check_partitions_for_install" && checkPassed)
+ {
+ this->wizard()->next();
}
}
@@ -82,6 +96,11 @@ bool wpHdMap::isComplete() const
bool wpHdMap::validatePage()
{
if(!isComplete()) return false;
+ if(checkPassed)
+ {
+ checkPassed = false;
+ return true;
+ }
QStringList* hdmap = new QStringList();
for(int row = 0; row < tableWidget->rowCount(); row++)
{
@@ -93,5 +112,7 @@ bool wpHdMap::validatePage()
}
backend->cfg("hdmap", hdmap->join("\n"));
// backend->exec(QString("hdmap_set %1").arg(hdmap->join("\n")));
- return true;
+ backend->exec("check_partitions_for_install");
+ checkPassed = true; // if an error occurrs receivedCommand will set it to false.
+ return false;
}
diff --git a/wizard/hdmap.h b/wizard/hdmap.h
index 306266c..ec4ba5b 100644
--- a/wizard/hdmap.h
+++ b/wizard/hdmap.h
@@ -18,11 +18,13 @@ class wpHdMap : public QWizardPage, Ui::wpHdMap
private:
Backend* backend;
QStringList filesystems;
+ bool checkPassed;
private slots:
void receivedDataLine(QString data, QString line);
void updateComplete();
void backendFinishedCommand(QString command);
+ void receivedCommand(QString command, QString args);
};
diff --git a/wizard/rootpartition.cpp b/wizard/rootpartition.cpp
index dbecf43..b020370 100644
--- a/wizard/rootpartition.cpp
+++ b/wizard/rootpartition.cpp
@@ -11,6 +11,8 @@ wpRootPartition::wpRootPartition(QWidget *parent) : QWizardPage(parent)
connect(backend, SIGNAL(receivedDataLine(QString,QString)), this, SLOT(receivedDataLine(QString,QString)));
connect(rootPartitionDev, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete()));
connect(chkAdvanced, SIGNAL(stateChanged(int)), this, SLOT(updateComplete()));
+
+ checkPassed = false;
}
void wpRootPartition::initializePage()
@@ -24,6 +26,8 @@ void wpRootPartition::clearPage()
rootPartitionDev->clear();
backend->exec("send_possible_root_filesystems");
rootPartitionFs->clear();
+
+ checkPassed = false;
}
void wpRootPartition::receivedDataLine(QString data, QString line)
@@ -50,15 +54,38 @@ bool wpRootPartition::isComplete() const
return true;
}
+void wpRootPartition::backendFinishedCommand(QString command)
+{
+ if(command == "check_partitions_for_install" && checkPassed)
+ {
+ this->wizard()->next();
+ }
+}
+
+void wpRootPartition::receivedCommand(QString command, QString args)
+{
+ if(command == "error") checkPassed = false;
+}
+
bool wpRootPartition::validatePage()
{
if(!isComplete()) return false;
+ if(checkPassed)
+ {
+ checkPassed = false;
+ return true;
+ }
if(rootPartitionDev->currentItem())
backend->exec(QString("hdmap_set %1:/:%2:auto")
.arg(rootPartitionDev->currentItem()->text().section(" ",0,0))
.arg(chkFormat->isChecked() ? rootPartitionFs->currentText() : ""));
backend->exec("fill_hdmap");
- return true;
+
+ if(chkAdvanced->isChecked()) return true;
+
+ backend->exec("check_partitions_for_install");
+ checkPassed = true; // if an error occurrs receivedCommand will set it to false.
+ return false;
}
int wpRootPartition::nextId() const
diff --git a/wizard/rootpartition.h b/wizard/rootpartition.h
index 393ec22..41b9df5 100644
--- a/wizard/rootpartition.h
+++ b/wizard/rootpartition.h
@@ -18,10 +18,13 @@ class wpRootPartition : public QWizardPage, Ui::wpRootPartition
private:
Backend* backend;
+ bool checkPassed;
private slots:
void receivedDataLine(QString data, QString line);
void updateComplete();
+ void backendFinishedCommand(QString command);
+ void receivedCommand(QString command, QString args);
};