[PC-BSD Commits] r7762 - pcbsd/current/src-qt4/pc-sysmanager

svn at pcbsd.org svn at pcbsd.org
Sat Oct 9 01:44:42 PDT 2010


Author: kris
Date: 2010-10-09 01:44:42 -0700 (Sat, 09 Oct 2010)
New Revision: 7762

Modified:
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui
Log:

Now probe for status of meta-pkgs properly, and display this status



Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2010-10-09 08:12:49 UTC (rev 7761)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2010-10-09 08:44:42 UTC (rev 7762)
@@ -707,7 +707,7 @@
 	deskItem->setToolTip(0, metaPkgList.at(z).at(1));
 	deskItem->setCheckState(0, Qt::Unchecked);
 
-	if ( metaPkgList.at(z).at(0) == "kde4" )
+	if ( isMetaPkgInstalled(metaPkgList.at(z).at(0)) )
 		deskItem->setCheckState(0, Qt::Checked);
     }
 
@@ -717,11 +717,10 @@
 	QTreeWidgetItem *deskItem = new QTreeWidgetItem(QStringList() << metaPkgList.at(z).at(0) );
 	deskItem->setIcon(0, QIcon(metaPkgList.at(z).at(2)));
 	deskItem->setToolTip(0, metaPkgList.at(z).at(1));
+	deskItem->setCheckState(0, Qt::Unchecked);
 
-	if ( metaPkgList.at(z).at(3) == "kde4" )
+	if ( isMetaPkgInstalled(metaPkgList.at(z).at(0)) )
 		deskItem->setCheckState(0, Qt::Checked);
-	else
-		deskItem->setCheckState(0, Qt::Unchecked);
 
 	// Now locate the parent app
         QTreeWidgetItemIterator it(treeMetaPkgs);
@@ -738,6 +737,24 @@
 
 }
 
+
+// Check if a meta-pkg is installed
+bool PBSystemTab::isMetaPkgInstalled(QString mPkg)
+{
+  QString tmp;
+  QProcess pcmp;
+  pcmp.start(QString("pc-metapkgmanager"), QStringList() << "status" << mPkg);
+  if (pcmp.waitForFinished()) {
+    while (pcmp.canReadLine()) {
+        tmp = pcmp.readLine().simplified();
+	if ( tmp.indexOf("is installed") != -1 || tmp.indexOf("partially installed") != -1)
+		return true;
+    }
+  }
+
+  return false;
+}
+
 // Function which checks for our GUI package schema data
 QList<QStringList> PBSystemTab::getPackageData()
 {

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2010-10-09 08:12:49 UTC (rev 7761)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2010-10-09 08:44:42 UTC (rev 7762)
@@ -141,6 +141,7 @@
     void populateMetaPkgs();
     QList<QStringList> getPackageData();
     QList<QStringList> metaPkgList;
+    bool isMetaPkgInstalled(QString mPkg);
 
     updaterStatus *UpdaterStatusDialog;
     

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui	2010-10-09 08:12:49 UTC (rev 7761)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui	2010-10-09 08:44:42 UTC (rev 7762)
@@ -720,6 +720,12 @@
       <layout class="QGridLayout" name="gridLayout_11">
        <item row="0" column="0">
         <widget class="QTreeWidget" name="treeMetaPkgs">
+         <property name="iconSize">
+          <size>
+           <width>32</width>
+           <height>32</height>
+          </size>
+         </property>
          <column>
           <property name="text">
            <string>Available Meta Packages</string>



More information about the Commits mailing list