[PC-BSD Commits] r18421 - pcbsd/current/src-qt4/pc-softwaremanager

svn at pcbsd.org svn at pcbsd.org
Mon Aug 13 07:22:42 PDT 2012


Author: kris
Date: 2012-08-13 14:22:42 +0000 (Mon, 13 Aug 2012)
New Revision: 18421

Modified:
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-appinfo.cpp
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
Log:

Add method to install PATH links for PBIs as user / root



Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-appinfo.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-appinfo.cpp	2012-08-13 14:07:29 UTC (rev 18420)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-appinfo.cpp	2012-08-13 14:22:42 UTC (rev 18421)
@@ -23,6 +23,9 @@
       popup->addAction( tr("Install Desktop Icons"), this, SLOT(slotAddDesktopIcons()));
       popup->addAction( tr("Install Menu Icons"), this, SLOT(slotAddMenuIcons()));
       popup->addAction( tr("Install Menu Icons (All Users)"), this, SLOT(slotAddMenuIconsRoot()));
+      popup->addAction( tr("Install PATH links"), this, SLOT(slotAddPATHLink()));
+      popup->addAction( tr("Install PATH links (All Users)"), this, SLOT(slotAddPATHLinkRoot()));
+
       popup->addSeparator();
       popup->addAction( tr("Uninstall"), this, SLOT(RemoveButtonSlot()));
     } else {

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2012-08-13 14:07:29 UTC (rev 18420)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2012-08-13 14:22:42 UTC (rev 18421)
@@ -68,6 +68,8 @@
     void slotAddDesktopIcons();
     void slotAddMenuIcons();
     void slotAddMenuIconsRoot();
+    void slotAddPATHLink();
+    void slotAddPATHLinkRoot();
     bool checkPBISelectedUpdates();
     void markAllPBIDirty();
     void markPBIForUpdate(PBI *item);
@@ -125,6 +127,7 @@
     bool checkOkToClose();
     void installDesktopIcon( PBI * pbi );
     void installMenuIcon( PBI * pbi, bool asRoot );
+    void installPATHLink( PBI * pbi, bool asRoot );
     void generateCopyLabel();
     PBI *getPBIFromName(QString name);
     void loadStatePBI();

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2012-08-13 14:07:29 UTC (rev 18420)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2012-08-13 14:22:42 UTC (rev 18421)
@@ -483,6 +483,8 @@
              popup->addAction( tr("Install Menu Icons"), this, SLOT(slotAddMenuIcons()));
              popup->addAction( tr("Install Menu Icons (All Users)"), this, SLOT(slotAddMenuIconsRoot()));
            }
+           popup->addAction( tr("Install PATH links"), this, SLOT(slotAddPATHLink()));
+           popup->addAction( tr("Install PATH links (All Users)"), this, SLOT(slotAddPATHLinkRoot()));
            if(item->hasDesktopEntries() || item->hasMenuEntries() ){ popup->addSeparator(); }
            popup->addAction( tr("Uninstall"), this, SLOT(RemoveButtonSlot()));
            popup->exec( QCursor::pos() );
@@ -680,6 +682,34 @@
 
 }
 
+void PBM::slotAddPATHLink()
+{
+	QTreeWidgetItemIterator it(SoftwareListBox);
+   	while (*it) {
+      		PBI *pbi = dynamic_cast<PBI*>(*it);
+      		if ((*it)->isSelected())
+      		{
+			installPATHLink(pbi, false);
+			return;
+		}
+      		it++;
+	}
+}
+
+void PBM::slotAddPATHLinkRoot()
+{
+	QTreeWidgetItemIterator it(SoftwareListBox);
+   	while (*it) {
+      		PBI *pbi = dynamic_cast<PBI*>(*it);
+      		if ((*it)->isSelected())
+      		{
+			installPATHLink(pbi, true);
+			return;
+		}
+      		it++;
+	}
+}
+
 void PBM::slotAddMenuIcons()
 {
 	QTreeWidgetItemIterator it(SoftwareListBox);
@@ -708,7 +738,22 @@
 	}
 }
 
+// Installs PATH links for this PBI
+void PBM::installPATHLink(PBI *pbi, bool asRoot)
+{
+  installPBIDesktopIcon = new QProcess();
+  if ( wardenDir.isEmpty() ) {
+    if ( asRoot ) {
+      QString cmd = "pbi_icon add-pathlnk " + pbi->getProgIndexName();
+      installPBIDesktopIcon->start(QString("pc-su"), QStringList() << cmd );
+    } else {
+      installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-pathlnk " + pbi->getProgIndexName() );
+    }
+  } else
+    installPBIDesktopIcon->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon add-pathlnk " + pbi->getProgIndexName() );
+}
 
+
 // Installs desktop icons for this PBI
 void PBM::installMenuIcon(PBI *pbi, bool asRoot)
 {
@@ -719,10 +764,10 @@
       // + " ; pbi_icon add-mime " + pbi->getProgIndexName();
       installPBIDesktopIcon->start(QString("pc-su"), QStringList() << cmd );
     } else {
-      installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-menu " + pbi->getProgIndexName() + "; pbi_icon add mime " + pbi->getProgIndexName() );
+      installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-menu " + pbi->getProgIndexName() + "; pbi_icon add-mime " + pbi->getProgIndexName() );
     }
   } else
-    installPBIDesktopIcon->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon add-menu " + pbi->getProgIndexName() + "; pbi_icon add mime " + pbi->getProgIndexName() );
+    installPBIDesktopIcon->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon add-menu " + pbi->getProgIndexName() + "; pbi_icon add-mime " + pbi->getProgIndexName() );
 }
 
 // Installs desktop icons for this PBI



More information about the Commits mailing list