summaryrefslogtreecommitdiff
path: root/wizard/rootpartition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'wizard/rootpartition.cpp')
-rw-r--r--wizard/rootpartition.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/wizard/rootpartition.cpp b/wizard/rootpartition.cpp
new file mode 100644
index 0000000..6341a0f
--- /dev/null
+++ b/wizard/rootpartition.cpp
@@ -0,0 +1,58 @@
+#include <QtGui>
+#include "rootpartition.h"
+#include "../listdelegate.h"
+#include "../listitem.h"
+
+wpRootPartition::wpRootPartition(QWidget *parent) : QWizardPage(parent)
+{
+ setupUi(this);
+ backend = Backend::instance();
+ connect(backend, SIGNAL(receivedDataLine(QString,QString)), this, SLOT(receivedDataLine(QString,QString)));
+ connect(rootPartitionDev, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete()));
+}
+
+void wpRootPartition::initializePage()
+{
+ clearPage();
+}
+
+void wpRootPartition::clearPage()
+{
+ backend->exec("send_possible_root_partitions");
+ rootPartitionDev->clear();
+ backend->exec("send_possible_root_filesystems");
+ rootPartitionFs->clear();
+}
+
+void wpRootPartition::receivedDataLine(QString data, QString line)
+{
+ if(data == "possible_root_partitions")
+ {
+ QListWidgetItem *item = new QListWidgetItem(QIcon::fromTheme("drive-harddisk"), line);
+ rootPartitionDev->addItem(item);
+ }
+ if(data == "possible_root_filesystems")
+ {
+ rootPartitionFs->addItem(line);
+ }
+}
+
+void wpRootPartition::updateComplete()
+{
+ emit completeChanged();
+}
+
+bool wpRootPartition::isComplete() const
+{
+ if(!rootPartitionDev->currentItem()) return false;
+ return true;
+}
+
+bool wpRootPartition::validatePage()
+{
+ if(!isComplete()) return false;
+ backend->exec(QString("hdmap_set %1:/:%2:auto")
+ .arg(rootPartitionDev->currentItem()->text().section(" ",0,0))
+ .arg(chkFormat->isChecked() ? rootPartitionFs->currentText() : ""));
+ return true;
+}