[PC-BSD Commits] r3841 - in pcbsd: trunk/kcmPBMsource trunk/system-overlay/PCBSD/SystemUpdater/bin trunk-current/kcmPBMsource trunk-current/system-overlay/PCBSD/SystemUpdater/bin

svn at pcbsd.org svn at pcbsd.org
Fri Apr 24 06:50:24 PDT 2009


Author: kris
Date: 2009-04-24 06:50:24 -0700 (Fri, 24 Apr 2009)
New Revision: 3841

Modified:
   pcbsd/trunk-current/kcmPBMsource/pbm.cpp
   pcbsd/trunk-current/kcmPBMsource/pbm.h
   pcbsd/trunk-current/kcmPBMsource/pbm.ui
   pcbsd/trunk-current/kcmPBMsource/updaterDialog.cpp
   pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh
   pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh
   pcbsd/trunk/kcmPBMsource/pbm.cpp
   pcbsd/trunk/kcmPBMsource/pbm.h
   pcbsd/trunk/kcmPBMsource/pbm.ui
   pcbsd/trunk/kcmPBMsource/updaterDialog.cpp
   pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh
   pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh
Log:

Improvements to the online updater tool. Now the user can ignore single updates if they so choose, and the tool will stay synced with the Tray Icon, so when you make an update / ignore an update the tray icon will refresh to reflect that status



Modified: pcbsd/trunk/kcmPBMsource/pbm.cpp
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.cpp	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk/kcmPBMsource/pbm.cpp	2009-04-24 13:50:24 UTC (rev 3841)
@@ -31,7 +31,10 @@
 #include <QWebView>
 #include <QSettings>
 #include <QFileDialog>
+#include <QDateTime>
 
+#include <kmenu.h>
+
 /* Local includes */
 #include "ui_pbm.h"
 #include "pbm.h"
@@ -147,11 +150,141 @@
   connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
 
   connect( pushInstallSysUpdates, SIGNAL( clicked() ), this, SLOT( slotInstallUpdatesClicked() ) );
+
+  // When the user changes the ignored status, rescan for updates
+  connect( checkShowIgnore, SIGNAL( clicked() ), this, SLOT( slotPopulateSysUpdates() ) );
    
+  // Connect the rightclick slot
+ connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) );
 
 }
 
+void PBM::slotSysRightClicked(Q3ListViewItem *item, const QPoint &point, int col)
+{
 
+   bool ok;
+   QString tmp;
+
+    if (item) {
+           bool ok;
+           int idnum = item->text(1).toInt(&ok);        
+
+           // Save the working PopupItem
+           workingPopupItem = idnum;
+
+          // Check if this patch is ignored or not
+          QFile file( "/PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum] );
+          if ( ! file.exists() ) {
+              popup = new KMenu();
+              popup->insertItem( tr("Ignore this update") , this, SLOT(slotIgnoreSysUpdate() )  );
+              popup->insertSeparator();
+              popup->insertItem( tr("View update details") , this, SLOT(slotViewDetailsClicked() )  );
+              popup->exec( QCursor::pos() );
+          } else {
+              popup = new KMenu();
+              popup->insertItem( tr("Un-Ignore this update") , this, SLOT(slotUnIgnoreSysUpdate() )  );
+              popup->insertSeparator();
+              popup->insertItem( tr("View update details") , this, SLOT(slotViewDetailsClicked() )  );
+              popup->exec( QCursor::pos() );
+          }
+
+
+    }
+
+}
+
+void PBM::slotPopulateSysUpdates()
+{
+  QString newMsg, tmp;
+
+  // Clear out the system list view box
+  listViewSysUpdates->clear();
+
+  if ( checkShowIgnore->isChecked() )
+  {
+    textSysUpdatesLabel->setText(tr("No updates are currently being ignored"));
+  } else {
+    textSysUpdatesLabel->setText(tr("The system is fully updated!"));
+  }
+
+  for (int i = 0; i<500; i++)
+  {
+    if ( SysUpdateName[i].isEmpty() )
+    {
+      break;
+    }
+
+
+    // See if we are displaying the ignored updates, or not
+    if ( checkShowIgnore->isChecked() )
+    {
+      if ( SysUpdateIgnore[i] == "YES" ) 
+      {
+        newMsg = SysUpdateName[i] + " - " + SysUpdateSize[i] + "MB (" + SysUpdateDate[i] + ")";
+        Q3CheckListItem *item = new Q3CheckListItem ( listViewSysUpdates, newMsg, Q3CheckListItem::CheckBox  ) ;
+        item->setText(1, tmp.setNum(i) );
+        QString newLabel = "<font color=\"#ff0000\">" + tr("The following system updates are being ignored:") + "</font>";
+        textSysUpdatesLabel->setText(newLabel);
+      }
+
+
+    // Displaying updates which aren't ignored
+    } else {
+      if ( SysUpdateIgnore[i] == "NO" ) 
+      {
+        newMsg = SysUpdateName[i] + " - " + SysUpdateSize[i] + "MB (" + SysUpdateDate[i] + ")";
+        Q3CheckListItem *item = new Q3CheckListItem ( listViewSysUpdates, newMsg, Q3CheckListItem::CheckBox  ) ;
+        item->setText(1, tmp.setNum(i) );
+        textSysUpdatesLabel->setText(tr("The following system updates are available:"));
+      }
+
+    } // End of our check for ignored status
+    
+  } // End of  the for loop
+
+}
+
+void PBM::slotIgnoreSysUpdate()
+{
+   int idnum = workingPopupItem;        
+
+   QFile file( "/PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[idnum] );
+   if ( file.exists() ) {
+      system("cp /PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[idnum] + " /PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum]);
+   }
+
+   SysUpdateIgnore[idnum] = "YES";
+   slotPopulateSysUpdates();
+   slotUpdateSysTrayTrigger();
+
+}
+
+void PBM::slotUpdateSysTrayTrigger()
+{
+   // Save our date file with timestamp of last updates
+   QFile fileup( "/PCBSD/SystemUpdater/conf/.last-update" );
+   if ( fileup.open( QIODevice::WriteOnly ) )
+   {
+      Q3TextStream streamup( &fileup );
+      streamup <<  QDateTime::currentDateTime().toString("ddd MMMM d yyyy - h:m:sap");
+      fileup.close();
+   }
+}
+
+void PBM::slotUnIgnoreSysUpdate()
+{
+   int idnum = workingPopupItem;        
+
+   QFile file( "/PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum] );
+   if ( file.exists() ) {
+     system("rm /PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum]);
+   }
+
+   SysUpdateIgnore[idnum] = "NO";
+   slotPopulateSysUpdates();
+   slotUpdateSysTrayTrigger();
+}
+
 void PBM::RemoveButtonSlot()
 {
    //Stop the scanner from interfering
@@ -892,13 +1025,12 @@
   // Check to see if the update download was successful and warn if not
   if ( sysFetchJob->error() != 0 )
   {
-
      QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under Configuration"), QMessageBox::Ok );
-
+    readSysUpdates->addArgument("NONE");
   } else {
-     // Add the patchdata URL
-     readSysUpdates->addArgument(sysPatchsetTmpFile);
-  } 
+    // Add the patchdata URL
+    readSysUpdates->addArgument(sysPatchsetTmpFile);
+  }
 
   // Connect the exited signal and start the process
   connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) );
@@ -934,38 +1066,68 @@
 
         while ( !stream.atEnd() ) {
             line = stream.readLine(); // line of text excluding '\n'
-	    if ( line.find("PATCH:" ) == 0)
+	    if ( line.find("PATCH:" ) == 0 )
             {
                 line.replace("PATCH: ", "");
+                SysUpdateIgnore[key] = "NO";
                 loadPatchData(line, key);
-		newMsg = SysUpdateName[key] + " - " + SysUpdateSize[key] + "MB (" + SysUpdateDate[key] + ")";
-                Q3CheckListItem *item = new Q3CheckListItem ( listViewSysUpdates, newMsg, Q3CheckListItem::CheckBox  ) ;
-                item->setText(1, tmp.setNum(key) );
 		//listViewSysUpdates->insertSysListBoxItem( newMsg, tmp.setNum(key), SysUpdateAlone[key], SysUpdateReboot[key] );
 		key++;
             }
-
+	    if ( line.find("PATCHIGNORE:" ) == 0 )
+            {
+                line.replace("PATCHIGNORE: ", "");
+                SysUpdateIgnore[key] = "YES";
+                loadPatchData(line, key);
+		key++;
+            }
 		
 
         }
+
+        SysUpdateName[key] = "";
+        SysUpdateIgnore[key] = "";
+        SysUpdatePatchFile[key] = "";
+        SysUpdateDate[key] = "";
+        SysUpdateMD5[key] = "";
+        SysUpdateSize[key] = "";
+        SysUpdateURL[key] = "";
+        SysUpdateAlone[key] = "";
+        SysUpdateReboot[key] = "";
+        SysUpdateDetailsURL[key] = "";
+        
 	file.close();
+   
+        // Populate our list view now
+	slotPopulateSysUpdates();
 
        
     }
 
     programstatus = SYSTEM_UPDATE_AVAIL;
-    textSysUpdatesLabel->setText(tr("The following system updates are available:"));
     UpdaterLabel->setText("");
 
 
   } else {
     // We have no updates available, indicate that now.
     programstatus = SYSTEM_UP2DATE;
-    textSysUpdatesLabel->setText(tr("The system is fully updated!"));
-    // Clear out the system list view box
-    listViewSysUpdates->clear();
+
+    // Unset our variables
+    SysUpdateName[0] = "";
+    SysUpdateIgnore[0] = "";
+    SysUpdatePatchFile[0] = "";
+    SysUpdateDate[0] = "";
+    SysUpdateMD5[0] = "";
+    SysUpdateSize[0] = "";
+    SysUpdateURL[0] = "";
+    SysUpdateAlone[0] = "";
+    SysUpdateReboot[0] = "";
+    SysUpdateDetailsURL[0] = "";
+
     UpdaterLabel->setText("");
 
+    // Clear out the system list view box
+    slotPopulateSysUpdates();
   }
 
 
@@ -1513,6 +1675,9 @@
       if ( ! startNewInstall )
       {
         // The updates are finished!
+
+        // Save our date file with timestamp of last updates
+        slotUpdateSysTrayTrigger();
     
         if ( requiresSysReboot == 1) 
         {

Modified: pcbsd/trunk/kcmPBMsource/pbm.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.h	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk/kcmPBMsource/pbm.h	2009-04-24 13:50:24 UTC (rev 3841)
@@ -22,6 +22,7 @@
 #include <kio/copyjob.h>
 #include <khtml_part.h>
 #include <khtmlview.h>
+#include <kmenu.h>
 
 class PBM : public QDialog, private Ui::PBM
 {
@@ -87,6 +88,12 @@
     void slotInstallUpdatesClicked();
     void slotCheckSysUpdatesFlags();
     void slotReadPBIBuffer();
+    void slotSysRightClicked(Q3ListViewItem *item, const QPoint &point, int col);
+    void slotIgnoreSysUpdate();
+    void slotUnIgnoreSysUpdate();
+    void slotPopulateSysUpdates();
+    void slotUpdateSysTrayTrigger();
+
 private:
     void RemoveFiles( PBI * pbi );
     void loadComponents();
@@ -112,6 +119,7 @@
     Q3Process *RemoveFile4;
     Q3Process *RemoveFile5;
     KDirWatch *fileWatcher;
+    KMenu *popup;
 
     KJob *copyJob;
     KJob *sysFetchJob;
@@ -124,6 +132,7 @@
     int currentWorkingPBI;
     QStringList workingSysUpdates;
     QStringList workingPBIUpdates;
+    int workingPopupItem;
 
     int firstDownload;
     long totalSeconds;
@@ -148,15 +157,16 @@
     Q3Process *upgradePBIProc;
 
     // System Updater Variables
-    QString SysUpdateName[150];
-    QString SysUpdatePatchFile[150];
-    QString SysUpdateDate[150];
-    QString SysUpdateMD5[150];
-    QString SysUpdateSize[150];
-    QString SysUpdateURL[150];
-    QString SysUpdateAlone[150];
-    QString SysUpdateReboot[150];
-    QString SysUpdateDetailsURL[150];
+    QString SysUpdateName[500];
+    QString SysUpdateIgnore[500];
+    QString SysUpdatePatchFile[500];
+    QString SysUpdateDate[500];
+    QString SysUpdateMD5[500];
+    QString SysUpdateSize[500];
+    QString SysUpdateURL[500];
+    QString SysUpdateAlone[500];
+    QString SysUpdateReboot[500];
+    QString SysUpdateDetailsURL[500];
 
 
 

Modified: pcbsd/trunk/kcmPBMsource/pbm.ui
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui	2009-04-24 13:50:24 UTC (rev 3841)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>479</width>
-    <height>622</height>
+    <height>630</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -29,7 +29,7 @@
       <layout class="QGridLayout" name="gridLayout" >
        <item row="0" column="0" >
         <layout class="QGridLayout" name="_2" >
-         <item row="1" column="0" colspan="3" >
+         <item row="1" column="0" colspan="4" >
           <widget class="Q3ListView" name="listViewSysUpdates" >
            <property name="sizePolicy" >
             <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
@@ -73,7 +73,7 @@
            </column>
           </widget>
          </item>
-         <item row="0" column="0" colspan="3" >
+         <item row="0" column="0" colspan="4" >
           <widget class="QLabel" name="textSysUpdatesLabel" >
            <property name="sizePolicy" >
             <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
@@ -92,7 +92,7 @@
            </property>
           </widget>
          </item>
-         <item row="2" column="2" >
+         <item row="2" column="3" >
           <spacer name="spacer2" >
            <property name="orientation" >
             <enum>Qt::Horizontal</enum>
@@ -122,6 +122,13 @@
            </property>
           </widget>
          </item>
+         <item row="2" column="2" >
+          <widget class="QCheckBox" name="checkShowIgnore" >
+           <property name="text" >
+            <string>Show ignored updates</string>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item row="1" column="0" >

Modified: pcbsd/trunk/kcmPBMsource/updaterDialog.cpp
===================================================================
--- pcbsd/trunk/kcmPBMsource/updaterDialog.cpp	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk/kcmPBMsource/updaterDialog.cpp	2009-04-24 13:50:24 UTC (rev 3841)
@@ -17,6 +17,7 @@
 
 void updaterStatus::programInit()
 {
+    setWindowTitle(tr("Update Progress"));
     listInstallView->clear();
     listInstallView->setColumnWidthMode( 3, Q3ListView::Manual );
     listInstallView->hideColumn( 3 );

Modified: pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh
===================================================================
--- pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh	2009-04-24 13:50:24 UTC (rev 3841)
@@ -15,6 +15,9 @@
 # Get the system version we are checking for updates to
 SYSVER="${1}" ; export SYSVER
 
+# Patch data location
+PDATALOC="${2}"
+
 # Check if we have an update folder for the version we are on
 if [ ! -d "${PROGDIR}/system-updates/available/${SYSVER}" ]
 then
@@ -22,7 +25,7 @@
 fi
 
 # If we have new update-data file, extract it
-if [ ! -z "${2}" ]
+if [ "${PDATALOC}" != "NONE" ]
 then
     cd ${PROGDIR}/system-updates/available/${SYSVER}
 
@@ -30,10 +33,10 @@
     rm *.upd
 
     # Extract the patch data 
-    tar xvzf ${2} >/dev/null 2>/dev/null
+    tar xvzf ${PDATALOC} >/dev/null 2>/dev/null
 
     # Remove patchset data, done with it for now
-    rm ${2}
+    rm ${PDATALOC}
 fi
 
 
@@ -43,6 +46,12 @@
   mkdir -p ${PROGDIR}/system-updates/installed/${SYSVER}
 fi
 
+# Make the ignore directory for this version
+if [ ! -d "${PROGDIR}/system-updates/ignored/${SYSVER}" ]
+then
+  mkdir -p ${PROGDIR}/system-updates/ignored/${SYSVER}
+fi
+
 # CD to the patch directory for this version
 cd ${PROGDIR}/system-updates/available/${SYSVER}
 
@@ -58,7 +67,12 @@
    if [ ! -e "${PROGDIR}/system-updates/installed/${SYSVER}/${i}" ]
    then
       PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
-      echo "PATCH: ${SYSVER}/${i}" >> /tmp/.pcbsdavailupdates
+      if [ -e "${PROGDIR}/system-updates/ignored/${SYSVER}/${i}" ]
+      then
+        echo "PATCHIGNORE: ${SYSVER}/${i}" >> /tmp/.pcbsdavailupdates
+      else
+        echo "PATCH: ${SYSVER}/${i}" >> /tmp/.pcbsdavailupdates
+      fi
    fi
 done 
 

Modified: pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh
===================================================================
--- pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh	2009-04-24 13:50:24 UTC (rev 3841)
@@ -20,7 +20,7 @@
 TGZFILE="${2}"
 
 # Set the users patch tmpdir
-PDIR="/home/${3}/.pcbsdupdir"
+PDIR="`mktemp -d ${HOME}/.updatetmp.XXXXX`"
 
 # Check if we have an update folder for the version we are on
 if [ ! -d "${PROGDIR}/system-updates/available/${SYSVER}" ]
@@ -53,7 +53,7 @@
 # Now check which updates are available, and make a list of ones not installed 
 for i in `ls *.upd`
 do
-   if [ ! -e "${PROGDIR}/system-updates/installed/${SYSVER}/${i}" ]
+   if [ ! -e "${PROGDIR}/system-updates/installed/${SYSVER}/${i}" -a ! -e "${PROGDIR}/system-updates/ignored/${SYSVER}/${i}" ]
    then
       PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
    fi

Modified: pcbsd/trunk-current/kcmPBMsource/pbm.cpp
===================================================================
--- pcbsd/trunk-current/kcmPBMsource/pbm.cpp	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk-current/kcmPBMsource/pbm.cpp	2009-04-24 13:50:24 UTC (rev 3841)
@@ -31,7 +31,10 @@
 #include <QWebView>
 #include <QSettings>
 #include <QFileDialog>
+#include <QDateTime>
 
+#include <kmenu.h>
+
 /* Local includes */
 #include "ui_pbm.h"
 #include "pbm.h"
@@ -147,11 +150,141 @@
   connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
 
   connect( pushInstallSysUpdates, SIGNAL( clicked() ), this, SLOT( slotInstallUpdatesClicked() ) );
+
+  // When the user changes the ignored status, rescan for updates
+  connect( checkShowIgnore, SIGNAL( clicked() ), this, SLOT( slotPopulateSysUpdates() ) );
    
+  // Connect the rightclick slot
+ connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) );
 
 }
 
+void PBM::slotSysRightClicked(Q3ListViewItem *item, const QPoint &point, int col)
+{
 
+   bool ok;
+   QString tmp;
+
+    if (item) {
+           bool ok;
+           int idnum = item->text(1).toInt(&ok);        
+
+           // Save the working PopupItem
+           workingPopupItem = idnum;
+
+          // Check if this patch is ignored or not
+          QFile file( "/PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum] );
+          if ( ! file.exists() ) {
+              popup = new KMenu();
+              popup->insertItem( tr("Ignore this update") , this, SLOT(slotIgnoreSysUpdate() )  );
+              popup->insertSeparator();
+              popup->insertItem( tr("View update details") , this, SLOT(slotViewDetailsClicked() )  );
+              popup->exec( QCursor::pos() );
+          } else {
+              popup = new KMenu();
+              popup->insertItem( tr("Un-Ignore this update") , this, SLOT(slotUnIgnoreSysUpdate() )  );
+              popup->insertSeparator();
+              popup->insertItem( tr("View update details") , this, SLOT(slotViewDetailsClicked() )  );
+              popup->exec( QCursor::pos() );
+          }
+
+
+    }
+
+}
+
+void PBM::slotPopulateSysUpdates()
+{
+  QString newMsg, tmp;
+
+  // Clear out the system list view box
+  listViewSysUpdates->clear();
+
+  if ( checkShowIgnore->isChecked() )
+  {
+    textSysUpdatesLabel->setText(tr("No updates are currently being ignored"));
+  } else {
+    textSysUpdatesLabel->setText(tr("The system is fully updated!"));
+  }
+
+  for (int i = 0; i<500; i++)
+  {
+    if ( SysUpdateName[i].isEmpty() )
+    {
+      break;
+    }
+
+
+    // See if we are displaying the ignored updates, or not
+    if ( checkShowIgnore->isChecked() )
+    {
+      if ( SysUpdateIgnore[i] == "YES" ) 
+      {
+        newMsg = SysUpdateName[i] + " - " + SysUpdateSize[i] + "MB (" + SysUpdateDate[i] + ")";
+        Q3CheckListItem *item = new Q3CheckListItem ( listViewSysUpdates, newMsg, Q3CheckListItem::CheckBox  ) ;
+        item->setText(1, tmp.setNum(i) );
+        QString newLabel = "<font color=\"#ff0000\">" + tr("The following system updates are being ignored:") + "</font>";
+        textSysUpdatesLabel->setText(newLabel);
+      }
+
+
+    // Displaying updates which aren't ignored
+    } else {
+      if ( SysUpdateIgnore[i] == "NO" ) 
+      {
+        newMsg = SysUpdateName[i] + " - " + SysUpdateSize[i] + "MB (" + SysUpdateDate[i] + ")";
+        Q3CheckListItem *item = new Q3CheckListItem ( listViewSysUpdates, newMsg, Q3CheckListItem::CheckBox  ) ;
+        item->setText(1, tmp.setNum(i) );
+        textSysUpdatesLabel->setText(tr("The following system updates are available:"));
+      }
+
+    } // End of our check for ignored status
+    
+  } // End of  the for loop
+
+}
+
+void PBM::slotIgnoreSysUpdate()
+{
+   int idnum = workingPopupItem;        
+
+   QFile file( "/PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[idnum] );
+   if ( file.exists() ) {
+      system("cp /PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[idnum] + " /PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum]);
+   }
+
+   SysUpdateIgnore[idnum] = "YES";
+   slotPopulateSysUpdates();
+   slotUpdateSysTrayTrigger();
+
+}
+
+void PBM::slotUpdateSysTrayTrigger()
+{
+   // Save our date file with timestamp of last updates
+   QFile fileup( "/PCBSD/SystemUpdater/conf/.last-update" );
+   if ( fileup.open( QIODevice::WriteOnly ) )
+   {
+      Q3TextStream streamup( &fileup );
+      streamup <<  QDateTime::currentDateTime().toString("ddd MMMM d yyyy - h:m:sap");
+      fileup.close();
+   }
+}
+
+void PBM::slotUnIgnoreSysUpdate()
+{
+   int idnum = workingPopupItem;        
+
+   QFile file( "/PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum] );
+   if ( file.exists() ) {
+     system("rm /PCBSD/SystemUpdater/system-updates/ignored/" + SysUpdatePatchFile[idnum]);
+   }
+
+   SysUpdateIgnore[idnum] = "NO";
+   slotPopulateSysUpdates();
+   slotUpdateSysTrayTrigger();
+}
+
 void PBM::RemoveButtonSlot()
 {
    //Stop the scanner from interfering
@@ -892,13 +1025,12 @@
   // Check to see if the update download was successful and warn if not
   if ( sysFetchJob->error() != 0 )
   {
-
      QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under Configuration"), QMessageBox::Ok );
-
+    readSysUpdates->addArgument("NONE");
   } else {
-     // Add the patchdata URL
-     readSysUpdates->addArgument(sysPatchsetTmpFile);
-  } 
+    // Add the patchdata URL
+    readSysUpdates->addArgument(sysPatchsetTmpFile);
+  }
 
   // Connect the exited signal and start the process
   connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) );
@@ -934,38 +1066,68 @@
 
         while ( !stream.atEnd() ) {
             line = stream.readLine(); // line of text excluding '\n'
-	    if ( line.find("PATCH:" ) == 0)
+	    if ( line.find("PATCH:" ) == 0 )
             {
                 line.replace("PATCH: ", "");
+                SysUpdateIgnore[key] = "NO";
                 loadPatchData(line, key);
-		newMsg = SysUpdateName[key] + " - " + SysUpdateSize[key] + "MB (" + SysUpdateDate[key] + ")";
-                Q3CheckListItem *item = new Q3CheckListItem ( listViewSysUpdates, newMsg, Q3CheckListItem::CheckBox  ) ;
-                item->setText(1, tmp.setNum(key) );
 		//listViewSysUpdates->insertSysListBoxItem( newMsg, tmp.setNum(key), SysUpdateAlone[key], SysUpdateReboot[key] );
 		key++;
             }
-
+	    if ( line.find("PATCHIGNORE:" ) == 0 )
+            {
+                line.replace("PATCHIGNORE: ", "");
+                SysUpdateIgnore[key] = "YES";
+                loadPatchData(line, key);
+		key++;
+            }
 		
 
         }
+
+        SysUpdateName[key] = "";
+        SysUpdateIgnore[key] = "";
+        SysUpdatePatchFile[key] = "";
+        SysUpdateDate[key] = "";
+        SysUpdateMD5[key] = "";
+        SysUpdateSize[key] = "";
+        SysUpdateURL[key] = "";
+        SysUpdateAlone[key] = "";
+        SysUpdateReboot[key] = "";
+        SysUpdateDetailsURL[key] = "";
+        
 	file.close();
+   
+        // Populate our list view now
+	slotPopulateSysUpdates();
 
        
     }
 
     programstatus = SYSTEM_UPDATE_AVAIL;
-    textSysUpdatesLabel->setText(tr("The following system updates are available:"));
     UpdaterLabel->setText("");
 
 
   } else {
     // We have no updates available, indicate that now.
     programstatus = SYSTEM_UP2DATE;
-    textSysUpdatesLabel->setText(tr("The system is fully updated!"));
-    // Clear out the system list view box
-    listViewSysUpdates->clear();
+
+    // Unset our variables
+    SysUpdateName[0] = "";
+    SysUpdateIgnore[0] = "";
+    SysUpdatePatchFile[0] = "";
+    SysUpdateDate[0] = "";
+    SysUpdateMD5[0] = "";
+    SysUpdateSize[0] = "";
+    SysUpdateURL[0] = "";
+    SysUpdateAlone[0] = "";
+    SysUpdateReboot[0] = "";
+    SysUpdateDetailsURL[0] = "";
+
     UpdaterLabel->setText("");
 
+    // Clear out the system list view box
+    slotPopulateSysUpdates();
   }
 
 
@@ -1513,6 +1675,9 @@
       if ( ! startNewInstall )
       {
         // The updates are finished!
+
+        // Save our date file with timestamp of last updates
+        slotUpdateSysTrayTrigger();
     
         if ( requiresSysReboot == 1) 
         {

Modified: pcbsd/trunk-current/kcmPBMsource/pbm.h
===================================================================
--- pcbsd/trunk-current/kcmPBMsource/pbm.h	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk-current/kcmPBMsource/pbm.h	2009-04-24 13:50:24 UTC (rev 3841)
@@ -22,6 +22,7 @@
 #include <kio/copyjob.h>
 #include <khtml_part.h>
 #include <khtmlview.h>
+#include <kmenu.h>
 
 class PBM : public QDialog, private Ui::PBM
 {
@@ -87,6 +88,12 @@
     void slotInstallUpdatesClicked();
     void slotCheckSysUpdatesFlags();
     void slotReadPBIBuffer();
+    void slotSysRightClicked(Q3ListViewItem *item, const QPoint &point, int col);
+    void slotIgnoreSysUpdate();
+    void slotUnIgnoreSysUpdate();
+    void slotPopulateSysUpdates();
+    void slotUpdateSysTrayTrigger();
+
 private:
     void RemoveFiles( PBI * pbi );
     void loadComponents();
@@ -112,6 +119,7 @@
     Q3Process *RemoveFile4;
     Q3Process *RemoveFile5;
     KDirWatch *fileWatcher;
+    KMenu *popup;
 
     KJob *copyJob;
     KJob *sysFetchJob;
@@ -124,6 +132,7 @@
     int currentWorkingPBI;
     QStringList workingSysUpdates;
     QStringList workingPBIUpdates;
+    int workingPopupItem;
 
     int firstDownload;
     long totalSeconds;
@@ -148,15 +157,16 @@
     Q3Process *upgradePBIProc;
 
     // System Updater Variables
-    QString SysUpdateName[150];
-    QString SysUpdatePatchFile[150];
-    QString SysUpdateDate[150];
-    QString SysUpdateMD5[150];
-    QString SysUpdateSize[150];
-    QString SysUpdateURL[150];
-    QString SysUpdateAlone[150];
-    QString SysUpdateReboot[150];
-    QString SysUpdateDetailsURL[150];
+    QString SysUpdateName[500];
+    QString SysUpdateIgnore[500];
+    QString SysUpdatePatchFile[500];
+    QString SysUpdateDate[500];
+    QString SysUpdateMD5[500];
+    QString SysUpdateSize[500];
+    QString SysUpdateURL[500];
+    QString SysUpdateAlone[500];
+    QString SysUpdateReboot[500];
+    QString SysUpdateDetailsURL[500];
 
 
 

Modified: pcbsd/trunk-current/kcmPBMsource/pbm.ui
===================================================================
--- pcbsd/trunk-current/kcmPBMsource/pbm.ui	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk-current/kcmPBMsource/pbm.ui	2009-04-24 13:50:24 UTC (rev 3841)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>479</width>
-    <height>622</height>
+    <height>630</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -29,7 +29,7 @@
       <layout class="QGridLayout" name="gridLayout" >
        <item row="0" column="0" >
         <layout class="QGridLayout" name="_2" >
-         <item row="1" column="0" colspan="3" >
+         <item row="1" column="0" colspan="4" >
           <widget class="Q3ListView" name="listViewSysUpdates" >
            <property name="sizePolicy" >
             <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
@@ -73,7 +73,7 @@
            </column>
           </widget>
          </item>
-         <item row="0" column="0" colspan="3" >
+         <item row="0" column="0" colspan="4" >
           <widget class="QLabel" name="textSysUpdatesLabel" >
            <property name="sizePolicy" >
             <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
@@ -92,7 +92,7 @@
            </property>
           </widget>
          </item>
-         <item row="2" column="2" >
+         <item row="2" column="3" >
           <spacer name="spacer2" >
            <property name="orientation" >
             <enum>Qt::Horizontal</enum>
@@ -122,6 +122,13 @@
            </property>
           </widget>
          </item>
+         <item row="2" column="2" >
+          <widget class="QCheckBox" name="checkShowIgnore" >
+           <property name="text" >
+            <string>Show ignored updates</string>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item row="1" column="0" >

Modified: pcbsd/trunk-current/kcmPBMsource/updaterDialog.cpp
===================================================================
--- pcbsd/trunk-current/kcmPBMsource/updaterDialog.cpp	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk-current/kcmPBMsource/updaterDialog.cpp	2009-04-24 13:50:24 UTC (rev 3841)
@@ -17,6 +17,7 @@
 
 void updaterStatus::programInit()
 {
+    setWindowTitle(tr("Update Progress"));
     listInstallView->clear();
     listInstallView->setColumnWidthMode( 3, Q3ListView::Manual );
     listInstallView->hideColumn( 3 );

Modified: pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh
===================================================================
--- pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdates.sh	2009-04-24 13:50:24 UTC (rev 3841)
@@ -15,6 +15,9 @@
 # Get the system version we are checking for updates to
 SYSVER="${1}" ; export SYSVER
 
+# Patch data location
+PDATALOC="${2}"
+
 # Check if we have an update folder for the version we are on
 if [ ! -d "${PROGDIR}/system-updates/available/${SYSVER}" ]
 then
@@ -22,7 +25,7 @@
 fi
 
 # If we have new update-data file, extract it
-if [ ! -z "${2}" ]
+if [ "${PDATALOC}" != "NONE" ]
 then
     cd ${PROGDIR}/system-updates/available/${SYSVER}
 
@@ -30,10 +33,10 @@
     rm *.upd
 
     # Extract the patch data 
-    tar xvzf ${2} >/dev/null 2>/dev/null
+    tar xvzf ${PDATALOC} >/dev/null 2>/dev/null
 
     # Remove patchset data, done with it for now
-    rm ${2}
+    rm ${PDATALOC}
 fi
 
 
@@ -43,6 +46,12 @@
   mkdir -p ${PROGDIR}/system-updates/installed/${SYSVER}
 fi
 
+# Make the ignore directory for this version
+if [ ! -d "${PROGDIR}/system-updates/ignored/${SYSVER}" ]
+then
+  mkdir -p ${PROGDIR}/system-updates/ignored/${SYSVER}
+fi
+
 # CD to the patch directory for this version
 cd ${PROGDIR}/system-updates/available/${SYSVER}
 
@@ -58,7 +67,12 @@
    if [ ! -e "${PROGDIR}/system-updates/installed/${SYSVER}/${i}" ]
    then
       PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
-      echo "PATCH: ${SYSVER}/${i}" >> /tmp/.pcbsdavailupdates
+      if [ -e "${PROGDIR}/system-updates/ignored/${SYSVER}/${i}" ]
+      then
+        echo "PATCHIGNORE: ${SYSVER}/${i}" >> /tmp/.pcbsdavailupdates
+      else
+        echo "PATCH: ${SYSVER}/${i}" >> /tmp/.pcbsdavailupdates
+      fi
    fi
 done 
 

Modified: pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh
===================================================================
--- pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh	2009-04-23 19:53:28 UTC (rev 3840)
+++ pcbsd/trunk-current/system-overlay/PCBSD/SystemUpdater/bin/readSysUpdatesUser.sh	2009-04-24 13:50:24 UTC (rev 3841)
@@ -20,7 +20,7 @@
 TGZFILE="${2}"
 
 # Set the users patch tmpdir
-PDIR="/home/${3}/.pcbsdupdir"
+PDIR="`mktemp -d ${HOME}/.updatetmp.XXXXX`"
 
 # Check if we have an update folder for the version we are on
 if [ ! -d "${PROGDIR}/system-updates/available/${SYSVER}" ]
@@ -53,7 +53,7 @@
 # Now check which updates are available, and make a list of ones not installed 
 for i in `ls *.upd`
 do
-   if [ ! -e "${PROGDIR}/system-updates/installed/${SYSVER}/${i}" ]
+   if [ ! -e "${PROGDIR}/system-updates/installed/${SYSVER}/${i}" -a ! -e "${PROGDIR}/system-updates/ignored/${SYSVER}/${i}" ]
    then
       PATCHFOUND="`expr ${PATCHFOUND} + 1`" 
    fi



More information about the Commits mailing list