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

svn at pcbsd.org svn at pcbsd.org
Fri Mar 18 09:39:06 PDT 2011


Author: kris
Date: 2011-03-18 09:39:06 -0700 (Fri, 18 Mar 2011)
New Revision: 9723

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

Update to AppCafe, when installing new applications also add the desktop
  icon by default. 

Enable desktop-icon-install option via context menu for PBIs as well



Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-03-18 09:22:50 UTC (rev 9722)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-03-18 16:39:06 UTC (rev 9723)
@@ -96,6 +96,7 @@
     
    // Get the username of the person running X
    RealUserName = getlogin();
+   qDebug() << "RealUser:" << RealUserName;
 
   /**********************************************************************/
 

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2011-03-18 09:22:50 UTC (rev 9722)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2011-03-18 16:39:06 UTC (rev 9723)
@@ -56,6 +56,7 @@
     void checkRoot();
 
     // Slots for the PBI tab
+    void slotAddDesktopIcons();
     bool checkPBISelectedUpdates();
     void markAllPBIDirty();
     void markPBIForUpdate(PBI *item);
@@ -100,17 +101,18 @@
 
 private:
     void RemovePBI( PBI * pbi );
-    void generateCopyLabel();
+    void installDesktopIcon( PBI * pbi );
     bool checkPBILoaded(QString name);
     bool checkPBILoadedFuzzy(QString name);
+    bool checkOkToClose();
+    void generateCopyLabel();
     PBI *getPBIFromName(QString name);
-    void startPBIDirLoad();
-    void scheduleNewPBIDownload(QString, int);
-    void saveStatePBI();
     void loadStatePBI();
     void purgeAllDeletedPBI();  
-    bool checkOkToClose();
+    void saveStatePBI();
+    void scheduleNewPBIDownload(QString, int);
     void setupMenuBar();
+    void startPBIDirLoad();
 
     // PBI Browser 
     AvailPBI *pbiAvail;

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2011-03-18 09:22:50 UTC (rev 9722)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2011-03-18 16:39:06 UTC (rev 9723)
@@ -315,6 +315,11 @@
      QMessageBox::critical( 0, tr("Online Update"), tr("An error occurred while installing") + " " + \
      item->getName() + " " + tr("You may need to update this PBI manually."), QMessageBox::Ok );
   } else {
+
+     // If this is a new install, also add the desktop icon
+     if ( item->getWorkingStatus() == PBINEWDOWNLOAD )
+	installDesktopIcon(item);
+
      // Update the status on the previous download to finished
      item->setStatusText("");
      item->setNewDownload(false);
@@ -359,8 +364,9 @@
          popup->addAction( tr("View details"), this, SLOT(slotViewPBIClicked()));
 
          if ( ! item->isNewDownload() ) {
+           popup->addAction( tr("Install Desktop Icons"), this, SLOT(slotAddDesktopIcons()));
+           popup->addSeparator();
            popup->addAction( tr("Uninstall"), this, SLOT(RemoveButtonSlot()));
-           popup->addSeparator();
            popup->exec( QCursor::pos() );
          } else {
            // If this is a new download, offer cancel option
@@ -527,3 +533,27 @@
 	}
 
 }
+
+void PBM::slotAddDesktopIcons()
+{
+	QTreeWidgetItemIterator it(SoftwareListBox);
+   	while (*it) {
+      		PBI *pbi = dynamic_cast<PBI*>(*it);
+      		if ((*it)->isSelected())
+      		{
+			installDesktopIcon(pbi);
+			return;
+		}
+      		it++;
+	}
+
+}
+
+
+// Installs desktop icons for this PBI
+void PBM::installDesktopIcon(PBI *pbi)
+{
+  installPBIDesktopIcon = new QProcess();
+  // qDebug() << "su"  << RealUserName << "-c pbi_icon add-desktop" << pbi->getProgIndexName();
+  installPBIDesktopIcon->start(QString("su"), QStringList() << RealUserName << "-c" << "pbi_icon add-desktop " + pbi->getProgIndexName() );
+}



More information about the Commits mailing list