[PC-BSD Commits] r15757 - pcbsd/current/src-qt4/pc-installgui

svn at pcbsd.org svn at pcbsd.org
Thu Mar 8 13:53:20 PST 2012


Author: kris
Date: 2012-03-08 21:53:20 +0000 (Thu, 08 Mar 2012)
New Revision: 15757

Modified:
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.h
Log:

Let the user right-click to enable / disable encryption on UFS file-systems
when installing in Advanced mode



Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2012-03-08 20:40:47 UTC (rev 15756)
+++ pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2012-03-08 21:53:20 UTC (rev 15757)
@@ -333,8 +333,9 @@
 
   treeMounts->clear();
   if (radioUFS->isChecked()) {
-    treeMounts->setHeaderLabels(QStringList() << "ID" << tr("Mount") << tr("Size") << tr("Type") );
-    treeMounts->setColumnCount(4);
+    treeMounts->setHeaderLabels(QStringList() << "ID" << tr("Mount") << tr("Size") << tr("Type") << "Pass" );
+    treeMounts->header()->setSectionHidden(4, true);
+    treeMounts->setColumnCount(5);
     labelFreeSpace->setVisible(true);
     lineFreeMB->setVisible(true);
     pushSizeMount->setVisible(true);
@@ -352,7 +353,7 @@
   if (radioUFS->isChecked()) {
     for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
       // Start adding the disk items to our tree widget
-      new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(i) << sysFinalDiskLayout.at(i).at(2) << sysFinalDiskLayout.at(i).at(4) << sysFinalDiskLayout.at(i).at(3));
+      new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(i) << sysFinalDiskLayout.at(i).at(2) << sysFinalDiskLayout.at(i).at(4) << sysFinalDiskLayout.at(i).at(3) << sysFinalDiskLayout.at(i).at(6));
       usedSpace = usedSpace +  sysFinalDiskLayout.at(i).at(4).toInt(&ok);
     }
     
@@ -586,11 +587,18 @@
   popup->addSeparator();
 
   if  ( radioUFS->isChecked() ) {
-    // No options to change for /swap
-    if ( treeMounts->currentItem()->text(1) == "SWAP" )
+    // No options to change for / or /boot
+    if ( treeMounts->currentItem()->text(1) == "/" )
       return;
-    // May eventually add options for UFS file-systems here
-    return;
+    if ( treeMounts->currentItem()->text(1) == "/boot" )
+      return;
+
+    if ( treeMounts->currentItem()->text(3).indexOf(".eli") != -1 )
+      popup->addAction( tr("Disable Encryption"), this, SLOT(slotUEnc()));
+    else
+      popup->addAction( tr("Enable Encryption"), this, SLOT(slotUEnc()));
+
+    // End of UFS options
   } else {
     // No options to change for /swap
     if ( treeMounts->currentItem()->text(1) == "/swap" )
@@ -705,8 +713,8 @@
     for ( int i = 0; i < mItems.size(); ++i) {
       fileSystem.clear();
       fsType=mItems.at(i)->text(3);
-      if ( fsType.indexOf(".eli") != -1 )
-        tmpPass=lineEncPW->text();
+      if ( fsType.indexOf(".eli") != -1 && mItems.at(i)->text(1) != "SWAP" )
+        tmpPass=mItems.at(i)->text(4);
       else
         tmpPass="";
 
@@ -896,3 +904,46 @@
 {
   system("xterm &");
 }
+
+void wizardDisk::slotUEnc()
+{
+  if ( ! treeMounts->currentItem() )
+    return;
+
+  if ( treeMounts->currentItem()->text(3).indexOf(".eli") != -1 )
+    treeMounts->currentItem()->setText(3, treeMounts->currentItem()->text(3).replace(".eli", "") );
+  else {
+    bool ok;
+
+    // If on /swap, we don't need password
+    if ( treeMounts->currentItem()->text(1) == "SWAP" ) {
+      treeMounts->currentItem()->setText(3, treeMounts->currentItem()->text(3) + ".eli" );
+      return;
+    }
+
+    QString text = QInputDialog::getText(this, tr("Please enter the password for this partition:"),
+                                         tr("Password:"), QLineEdit::Password,
+                                         QString(), &ok);
+    if (!ok || text.isEmpty())
+      return;
+
+    QString text2 = QInputDialog::getText(this, tr("Please confirm the password for this partition:"),
+                                         tr("Confirm Password:"), QLineEdit::Password,
+                                         QString(), &ok);
+    if (!ok || text.isEmpty())
+      return;
+
+    if ( text != text2 ) {
+      QMessageBox::critical(this, tr("Password Mismatch"),
+              tr("The passwords entered do not match!"),
+              QMessageBox::Ok,
+              QMessageBox::Ok);
+      return; 
+    }
+
+    // Save the password
+    treeMounts->currentItem()->setText(3, treeMounts->currentItem()->text(3) + ".eli" );
+    treeMounts->currentItem()->setText(4, text);
+  }
+
+}

Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.h
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/wizardDisk.h	2012-03-08 20:40:47 UTC (rev 15756)
+++ pcbsd/current/src-qt4/pc-installgui/wizardDisk.h	2012-03-08 21:53:20 UTC (rev 15757)
@@ -43,6 +43,7 @@
     void slotZChk();
     void slotZAtime();
     void slotZExec();
+    void slotUEnc();
 
 private:
     void populateDiskInfo();



More information about the Commits mailing list