[PC-BSD Commits] r7632 - pcbsd/current/src-qt4/pc-sysinstaller

svn at pcbsd.org svn at pcbsd.org
Thu Sep 23 11:10:17 PDT 2010


Author: kris
Date: 2010-09-23 11:10:17 -0700 (Thu, 23 Sep 2010)
New Revision: 7632

Modified:
   pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
Log:

Added check to pc-sysinstaller, make sure at least a single desktop is selected to do the installation :)



Modified: pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp	2010-09-23 17:49:02 UTC (rev 7631)
+++ pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp	2010-09-23 18:10:17 UTC (rev 7632)
@@ -436,7 +436,7 @@
 {
   QList<QStringList> metaPkgs;
   found=false;
-  QString tmp, mName, mDesc, mIcon, mParent;
+  QString tmp, mName, mDesc, mIcon, mParent, mDesktop;
   QStringList package;
 
   QProcess pcmp;
@@ -461,14 +461,18 @@
 		mParent = tmp.replace("Parent: ", "");
 		continue;
 	}
+	if ( tmp.indexOf("Desktop: ") == 0) {
+		mDesktop = tmp.replace("Desktop: ", "");
+		continue;
+	}
 	if ( tmp.indexOf("Required Packages:") == 0) {
 		// Now add this meta-pkg to the string list
 		package.clear();
-		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent;
-		package << mName << mDesc << mIcon << mParent;
+		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent << mDesktop;
+		package << mName << mDesc << mIcon << mParent << mDesktop;
 		metaPkgs.append(package);
 		found = true;
-		mName=""; mDesc=""; mIcon=""; mParent="";
+		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop="";
 	}
     }
   }

Modified: pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp	2010-09-23 17:49:02 UTC (rev 7631)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp	2010-09-23 18:10:17 UTC (rev 7632)
@@ -83,7 +83,27 @@
     connect(treeWidgetDesktopPackages, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotDeskPkgsChanged(QTreeWidgetItem *, int)));
 }
 
+// Check if we have any desktop packages selected
+bool SysInstaller::haveMetaDesktopChecked()
+{
+        QTreeWidgetItemIterator it(treeWidgetDesktopPackages);
+        while (*it) {
+         if ((*it)->checkState(0) == Qt::Checked )
+	   for (int z=0; z < listDeskPkgs.count(); ++z)
+	     if ( (*it)->text(0) == listDeskPkgs.at(z).at(0) && listDeskPkgs.at(z).at(4) == "YES" )
+		return true;
+         ++it;
+        }
 
+        QMessageBox::warning(this, tr("No Desktop"),
+          tr("No desktops have been selected! Please choose at least one desktop to continue."),
+          QMessageBox::Ok,
+          QMessageBox::Ok);
+
+	return false;
+}
+
+
 // Check the "parent" app to see if all its children are checked or not
 bool SysInstaller::allChildrenPkgsChecked(QString parent)
 {

Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp	2010-09-23 17:49:02 UTC (rev 7631)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp	2010-09-23 18:10:17 UTC (rev 7632)
@@ -306,6 +306,11 @@
        return;
    }
 
+   // If we are on the meta-pkg screen, and have no desktops selected
+   if ( stackWidget->currentIndex() == 5 && ! haveMetaDesktopChecked() )
+      return;
+
+
    // Check if we are doing FreeBSD install and hide a checkbox
    if ( stackWidget->currentIndex() == 3 \
      && radioInstallFreeBSD->isChecked() \

Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h	2010-09-23 17:49:02 UTC (rev 7631)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h	2010-09-23 18:10:17 UTC (rev 7632)
@@ -165,6 +165,7 @@
     bool allChildrenPkgsUnchecked(QString parent);
     void checkAllChildrenPkgs(QString parent);
     void uncheckAllChildrenPkgs(QString parent);
+    bool haveMetaDesktopChecked();
 
     QStackedWidget *stackWidget;
     dialogFileSystem *dfs;



More information about the Commits mailing list