[PC-BSD Commits] r2940 - in pcbsd: branches/7.0/SystemUpdater trunk/SystemUpdater

svn at pcbsd.org svn at pcbsd.org
Tue Oct 28 07:37:59 PST 2008


Author: kris
Date: 2008-10-28 08:25:53 -0700 (Tue, 28 Oct 2008)
New Revision: 2940

Added:
   pcbsd/branches/7.0/SystemUpdater/folder.png
   pcbsd/trunk/SystemUpdater/folder.png
Modified:
   pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp
   pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h
   pcbsd/branches/7.0/SystemUpdater/SystemUpdater.qrc
   pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui
   pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp
   pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h
   pcbsd/trunk/SystemUpdater/SystemUpdater.cpp
   pcbsd/trunk/SystemUpdater/SystemUpdater.h
   pcbsd/trunk/SystemUpdater/SystemUpdater.qrc
   pcbsd/trunk/SystemUpdater/SystemUpdater.ui
   pcbsd/trunk/SystemUpdater/UpdaterTray.cpp
   pcbsd/trunk/SystemUpdater/UpdaterTray.h
Log:

Commited large update to the Online System Updater tool. Adds 2 new features:

 * Support for proxy servers, which is passed on to rsync / wget and used by KIO to download
 * Support for specifying custom TMPDIR, in case user needs to use larger partition to download updates

Also fixed a bug in which a PBI upgrade could silently fail, and the user be left wondering where software
had gone to. Now if anything does go wrong, the updater will notify the user properly. 



Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp	2008-10-28 15:25:53 UTC (rev 2940)
@@ -23,6 +23,8 @@
     listViewSysUpdates->setColumnWidthMode( 1, Q3ListView::Manual );
     listViewSysUpdates->hideColumn( 1 );
 
+    disableConfUpdates = false;
+
    
    
     
@@ -35,11 +37,36 @@
     // Connect the system list box to a double-clicked slot
     connect( listViewSysUpdates, SIGNAL(doubleClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysDoubleClicked( Q3ListViewItem *, const QPoint &, int) ) );
     // Connect to a right-clicked slot as well
-        connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) );
+    connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) );
     
+    // Connect the pushViewDetails button
+    connect( pushDetails, SIGNAL( clicked() ), this, SLOT( slotViewDetailsClicked() ) );
+    
+    // Connect the Custom Tmpdir Checkbox
+    connect( checkTMPDIR, SIGNAL( clicked() ), this, SLOT( slotCustomTmpClicked() ) );
+    connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyClicked() ) );
+    connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) );
+    connect( pushConfigProxy, SIGNAL( clicked() ), this, SLOT( slotConfigKDEProxy() ) );
+
+    // Connect slots to emit signal when settings change
+    connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
+    connect( lineProxyServer, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
+    connect( spinProxyPort, SIGNAL( valueChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
+    
 }
 
 
+void systemUpdater::slotViewDetailsClicked()
+{
+   if ( listViewSysUpdates->currentItem() != 0 )
+   {
+        bool ok;
+        int idnum = listViewSysUpdates->currentItem()->text(1).toInt(&ok);        
+        emit signalOpenSysDetails(idnum);
+   }
+}
+
+
 void systemUpdater::slotClose()
 {
     
@@ -93,7 +120,10 @@
 
 void systemUpdater::slotConfigChanged()
 {
-  emit signalConfigChanged();
+  if (! disableConfUpdates )
+  {
+    emit signalConfigChanged();
+  }
 }
 
 
@@ -404,3 +434,119 @@
 {
     emit signalCheckPBIUpdatesClicked();
 }
+
+// Set if we are using a custom TmpDir
+void systemUpdater::setUseCustomTmp( bool enabled )
+{
+    checkTMPDIR->setChecked(enabled);
+    lineTMPDIR->setEnabled(enabled); 
+    pushTMPDIR->setEnabled(enabled); 
+}
+
+// Set the custom Tmpdir being used
+void systemUpdater::setUseCustomDirName( QString tmpdir )
+{
+    lineTMPDIR->setText(tmpdir);
+}
+
+// Set Proxy Usage
+void systemUpdater::setUseProxy( bool enabled )
+{
+    checkProxy->setChecked(enabled);
+    groupProxySettings->setEnabled(enabled);
+}
+
+// Set the Proxy being used
+void systemUpdater::setUseProxySettings( QString proxyURL, int portnum )
+{
+    lineProxyServer->setText(proxyURL);
+    spinProxyPort->setValue(portnum);
+}
+
+
+bool systemUpdater::getCustomTmpEnabled()
+{
+   return checkTMPDIR->isChecked();
+}
+
+
+QString systemUpdater::getCustomTmpDir()
+{
+   return lineTMPDIR->text();
+}
+
+bool systemUpdater::getProxyEnabled()
+{
+   return checkProxy->isChecked();
+}
+
+
+QString systemUpdater::getProxyUrl()
+{
+   return lineProxyServer->text();
+}
+
+int systemUpdater::getProxyPort()
+{
+  return spinProxyPort->value();
+}
+
+
+void systemUpdater::slotCustomTmpClicked()
+{
+    if ( checkTMPDIR->isChecked() )
+    {
+        lineTMPDIR->setEnabled(true); 
+        pushTMPDIR->setEnabled(true); 
+    } else {
+        lineTMPDIR->setEnabled(false); 
+        pushTMPDIR->setEnabled(false); 
+    }
+
+    slotConfigChanged();
+}
+
+void systemUpdater::slotProxyClicked()
+{
+    if ( checkProxy->isChecked() )
+    {
+        groupProxySettings->setEnabled(true);
+    } else {
+        groupProxySettings->setEnabled(false);
+    }
+
+    slotConfigChanged();
+}
+
+void systemUpdater::slotSelectCustomTmp()
+{
+
+   QString newDir = QFileDialog::getExistingDirectory(
+                    "/",
+                    this,
+                    tr("Select Temp directory"),
+                    tr("Select Temp directory"),
+                    TRUE );
+     
+     // Check if the user just hit cancel
+     if ( newDir.isEmpty() )
+     {
+        return; 
+     }
+
+   lineTMPDIR->setText(newDir);
+
+}
+
+void systemUpdater::slotDisableConfUpdates(bool status)
+{
+   // Set if we need to ignore updating the conf file, because a conf load is taking place
+   disableConfUpdates = status;
+}
+
+
+// Launches the kcmshell4 proxy command to allow the user to modify proxy settings
+void systemUpdater::slotConfigKDEProxy()
+{
+   emit signalLaunchKDEProxy();
+}

Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h	2008-10-28 15:25:53 UTC (rev 2940)
@@ -29,6 +29,7 @@
 
 public slots:
     void programInit();
+    void slotViewDetailsClicked();
     void slotClose();
     void slotUserClickedCheckSysUpdates();
     void setTextAvailSysUpdates( QString &text );
@@ -52,18 +53,31 @@
     void slotUpdatePBIClicked();
     void clearPBIList();
     void setRunAtStartupConfig( bool enabled );
+    void setUseCustomTmp( bool enabled );
+    void setUseCustomDirName( QString tmpdir );
+    void setUseProxy( bool enabled );
+    void setUseProxySettings( QString proxyURL, int portnum );
     bool getStartupConfig();
+    bool getCustomTmpEnabled();
+    QString getCustomTmpDir();
+    bool getProxyEnabled();
+    QString getProxyUrl();
+    int getProxyPort();
     void slotRescanPBIUpdatesClicked();
+    void slotDisableConfUpdates(bool status);
 
-
-
 private slots:
+    void slotCustomTmpClicked();
+    void slotProxyClicked();
+    void slotSelectCustomTmp();
+    void slotConfigKDEProxy();
 
 private:
   QMenu *popup;
   int popupidnum;
   QString standAlone[150];
   QString reboot[150];
+  bool disableConfUpdates;
 
 
 signals:
@@ -74,5 +88,6 @@
     void signalInstallSystemUpdates();
     void signalUpdatePBI();
     void signalCheckPBIUpdatesClicked();
+    void signalLaunchKDEProxy();
 } ;
 #endif // SYSTEMUPDATER_H

Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.qrc
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.qrc	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.qrc	2008-10-28 15:25:53 UTC (rev 2940)
@@ -1,6 +1,6 @@
 <RCC>
   <qresource>
+    <file>folder.png</file>
     <file>sysupdater.png</file>
   </qresource>
 </RCC>
-

Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui	2008-10-28 15:25:53 UTC (rev 2940)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>542</width>
-    <height>353</height>
+    <width>596</width>
+    <height>508</height>
    </rect>
   </property>
   <property name="font" >
@@ -74,14 +74,6 @@
       <number>0</number>
      </property>
      <widget class="QWidget" name="Widget8" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>524</width>
-        <height>275</height>
-       </rect>
-      </property>
       <attribute name="title" >
        <string>System Updates</string>
       </attribute>
@@ -106,7 +98,7 @@
         <layout class="QHBoxLayout" >
          <item>
           <layout class="QGridLayout" >
-           <item row="1" column="0" colspan="2" >
+           <item row="1" column="0" colspan="3" >
             <widget class="Q3ListView" name="listViewSysUpdates" >
              <property name="sizePolicy" >
               <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
@@ -150,7 +142,7 @@
              </column>
             </widget>
            </item>
-           <item row="0" column="0" colspan="2" >
+           <item row="0" column="0" colspan="3" >
             <widget class="QLabel" name="textLabel6" >
              <property name="sizePolicy" >
               <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
@@ -169,7 +161,7 @@
              </property>
             </widget>
            </item>
-           <item row="2" column="1" >
+           <item row="2" column="2" >
             <spacer name="spacer2" >
              <property name="orientation" >
               <enum>Qt::Horizontal</enum>
@@ -192,6 +184,13 @@
              </property>
             </widget>
            </item>
+           <item row="2" column="1" >
+            <widget class="QPushButton" name="pushDetails" >
+             <property name="text" >
+              <string>View Details</string>
+             </property>
+            </widget>
+           </item>
           </layout>
          </item>
          <item>
@@ -328,14 +327,6 @@
       </layout>
      </widget>
      <widget class="QWidget" name="Widget9" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>524</width>
-        <height>275</height>
-       </rect>
-      </property>
       <attribute name="title" >
        <string>PBI Updates</string>
       </attribute>
@@ -576,40 +567,185 @@
       </layout>
      </widget>
      <widget class="QWidget" name="TabPage" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>524</width>
-        <height>275</height>
-       </rect>
-      </property>
       <attribute name="title" >
        <string>Configuration</string>
       </attribute>
-      <layout class="QVBoxLayout" >
-       <item>
+      <layout class="QGridLayout" name="gridLayout_2" >
+       <item row="0" column="0" >
         <widget class="QCheckBox" name="checkSystemUpdatesConfig" >
          <property name="text" >
           <string>Check for system updates (Recommended)</string>
          </property>
         </widget>
        </item>
-       <item>
+       <item row="1" column="0" >
         <widget class="QCheckBox" name="checkPBIUpdatesConfig" >
          <property name="text" >
           <string>Check for updates to installed PBIs</string>
          </property>
         </widget>
        </item>
-       <item>
+       <item row="2" column="0" >
         <widget class="QCheckBox" name="checkRunAtStartup" >
          <property name="text" >
           <string>Run the System Updater at startup</string>
          </property>
         </widget>
        </item>
-       <item>
+       <item row="3" column="0" >
+        <layout class="QHBoxLayout" name="horizontalLayout" >
+         <item>
+          <widget class="QCheckBox" name="checkTMPDIR" >
+           <property name="text" >
+            <string>Specify custom temporary directory</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType" >
+            <enum>QSizePolicy::Minimum</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="lineTMPDIR" >
+           <property name="readOnly" >
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushTMPDIR" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize" >
+            <size>
+             <width>28</width>
+             <height>28</height>
+            </size>
+           </property>
+           <property name="maximumSize" >
+            <size>
+             <width>28</width>
+             <height>28</height>
+            </size>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="SystemUpdater.qrc" >
+             <normaloff>:/folder.png</normaloff>:/folder.png</iconset>
+           </property>
+           <property name="iconSize" >
+            <size>
+             <width>20</width>
+             <height>20</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="4" column="0" >
+        <widget class="QCheckBox" name="checkProxy" >
+         <property name="text" >
+          <string>Specify proxy for update check</string>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="0" >
+        <widget class="QGroupBox" name="groupProxySettings" >
+         <property name="title" >
+          <string>Proxy Settings</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout" >
+          <item row="0" column="0" >
+           <layout class="QHBoxLayout" name="horizontalLayout_2" >
+            <item>
+             <widget class="QLabel" name="label" >
+              <property name="text" >
+               <string>Proxy Server</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLineEdit" name="lineProxyServer" />
+            </item>
+            <item>
+             <widget class="QLabel" name="label_2" >
+              <property name="text" >
+               <string>Port</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="spinProxyPort" >
+              <property name="maximum" >
+               <number>9999</number>
+              </property>
+              <property name="value" >
+               <number>8080</number>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="6" column="0" >
+        <layout class="QHBoxLayout" name="horizontalLayout_3" >
+         <item>
+          <spacer name="horizontalSpacer_2" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushConfigProxy" >
+           <property name="text" >
+            <string>Configure Download Proxy</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_3" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item row="7" column="0" >
         <spacer name="spacer8" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
@@ -625,7 +761,7 @@
          </property>
         </spacer>
        </item>
-       <item>
+       <item row="8" column="0" >
         <spacer name="spacer9" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>

Modified: pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp	2008-10-28 15:25:53 UTC (rev 2940)
@@ -33,10 +33,11 @@
 /* Update interval in ms  - Every 12 hours */
 #define  UPDATE_MSEC 1000 * 60 * 60 * 12
 
+/* Change this to switch the default patch tmpdir */
+#define  PATCHTMPDIR_DEFAULT "/usr/local/tmp"
 
 
 
-
 /* The Update STATUS Flags */
 #define SYSTEM_UP2DATE 0
 #define SYSTEM_UPDATE_AVAIL 1
@@ -136,6 +137,7 @@
 
   // If the user wants to view details about a particular update
   connect( SystemUpdaterDialog, SIGNAL(signalOpenSysDetails(int)), this, SLOT(slotOpenSysDetails(int) ) );
+  connect( SystemUpdaterDialog, SIGNAL(signalLaunchKDEProxy()), this, SLOT(slotLaunchKDEProxyConfig() ) );
 
   // Signal if the user wants to start a system update
   connect( SystemUpdaterDialog, SIGNAL(signalInstallSystemUpdates()), this, SLOT(slotStartCheckAvailSysSpace() ) );
@@ -153,10 +155,9 @@
   connect( UpdaterStatusDialog, SIGNAL(buttonClosedPressed()), this, SLOT(contextMenuRefresh() ) );
  
 
-// Get the username of the person running X
+  // Get the username of the person running X
   username = getlogin();
 
-
   // Set the tray icon that we are checking for updates
   QIcon Icon;
   Icon.addFile("/PCBSD/SystemUpdater/images/working.png");
@@ -246,12 +247,30 @@
   getUpdatesDir = new Q3Process( this );
   getUpdatesDir->addArgument( "sh");
   getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh");
+  if ( useProxyServer )
+  {
+     QString proxyArgPort;
+     proxyArgPort.setNum(proxyServerPort);
 
+     QString proxyArgUrl = proxyServerUrl;
+
+     // Check if we need to remove a http://
+     if ( proxyServerUrl.indexOf("http://") == 0 )
+     {
+        proxyArgUrl.remove(0, 7);
+     }
+
+     getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort );
+
+  } else {
+     getUpdatesDir->addArgument( "DISABLE" );
+  }
+
   // Connect the exited signal and start the process
   connect( getUpdatesDir, SIGNAL(processExited()), this, SLOT(slotSysUpdateCheckFinished() ) );
   //connect( SetupScript, SIGNAL(readyReadStdout()), this, SLOT(readyReadScriptOutput2() ) );
   if ( ! getUpdatesDir->start() ) {
-        QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );
+        QMessageBox::information( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );
   }
 
 
@@ -268,7 +287,7 @@
   // Check to see if the update download was successful and warn if not
   if ( getUpdatesDir->exitStatus() != 0 )
   {
-	QMessageBox::warning( this->contextMenu(), tr("Update Error!"), tr("Could not contact the PC-BSD update server!"), QMessageBox::Ok );
+	QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under 'configure'"), QMessageBox::Ok );
   } 
 
    // Now traverse the directory, see if we have updates.
@@ -279,7 +298,7 @@
   // Connect the exited signal and start the process
   connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) );
   if ( ! readSysUpdates->start() ) {
-        QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok );
+        QMessageBox::information( 0, tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok );
   }
 
 
@@ -643,11 +662,6 @@
   checkSysUpdatesFrequently = enableSysCheck;
 
 
-
- 
-
-
-
   // Check if the user wants to check for PBI updates and save it 
   bool enablePBICheck = SystemUpdaterDialog->getPBIUpdateConfig();
   settings.writeEntry( "/PC-BSD/SystemUpdater/CheckPBIUpdatesConfig", enablePBICheck );
@@ -661,24 +675,39 @@
 
   checkPBIUpdatesFrequently = enablePBICheck;
 
-}
 
+  // Check if the user has enabled a custom tmpdir 
+  useCustomTmpDir = SystemUpdaterDialog->getCustomTmpEnabled();  
+  settings.writeEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", useCustomTmpDir );
 
+  // Load the custom tmpdir string
+  customTmpDir = SystemUpdaterDialog->getCustomTmpDir();
+  settings.writeEntry( "/PC-BSD/SystemUpdater/customTmpDir", customTmpDir );
 
+  useProxyServer = SystemUpdaterDialog->getProxyEnabled();
+  settings.setValue( "/PC-BSD/SystemUpdater/useProxyServer", useProxyServer );
+ 
+  proxyServerUrl = SystemUpdaterDialog->getProxyUrl();
+  settings.setValue( "/PC-BSD/SystemUpdater/proxyServerUrl", proxyServerUrl );
 
+  proxyServerPort = SystemUpdaterDialog->getProxyPort();
+  settings.setValue( "/PC-BSD/SystemUpdater/proxyServerPort", proxyServerPort );
 
 
+}
 
 void UpdaterTray::loadUpdaterPrefs() {
   // Load the user preferences for the System Updater
+  bool ok;
   QSettings settings;
-  //settings.setPath( "PC-BSD", "SystemUpdater" );
+  
+  // Disable updating the conf file until we are done loading it
+  SystemUpdaterDialog->slotDisableConfUpdates(true);
 
   bool enableSysCheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckSysUpdatesConfig", TRUE );
   SystemUpdaterDialog->setSystemUpdateConfig(enableSysCheck);
   checkSysUpdatesFrequently = enableSysCheck;
   
-
   bool enablePBICheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckPBIUpdatesConfig", TRUE );
   SystemUpdaterDialog->setPBIUpdateConfig(enablePBICheck);
   checkPBIUpdatesFrequently = enablePBICheck;
@@ -687,25 +716,42 @@
   SystemUpdaterDialog->setRunAtStartupConfig(enableStartup);
   contextMenu()->setItemChecked ( 6, enableStartup );
 
-}
+  // Check if we are using a custom tmpdir
+  useCustomTmpDir = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", false );
+  SystemUpdaterDialog->setUseCustomTmp( useCustomTmpDir );
 
+  // Load a custom tmpdir
+  customTmpDir= PATCHTMPDIR_DEFAULT;
+  customTmpDir = settings.value("/PC-BSD/SystemUpdater/customTmpDir", customTmpDir).toString();
+  SystemUpdaterDialog->setUseCustomDirName( customTmpDir );
+  
+  // Load if the user wants to use a proxy server
+  useProxyServer = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useProxyServer", false );
+  SystemUpdaterDialog->setUseProxy( useProxyServer );
+  
+  // Load Proxy Server Settings
+  proxyServerUrl = settings.value( "/PC-BSD/SystemUpdater/proxyServerUrl" ).toString();
 
+  settings.value("/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok);
+  if ( ok ) {
+     proxyServerPort = settings.value( "/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok);
+  } else {
+     proxyServerPort = 8080;
+  }
+  SystemUpdaterDialog->setUseProxySettings( proxyServerUrl, proxyServerPort );
 
+  SystemUpdaterDialog->slotDisableConfUpdates(false);
 
+}
 
 
 
-
 void UpdaterTray::slotSysUpdateTimer() {
   slotStartUpdateCheck();
 }
 
 
 
-
-
-
-
 void UpdaterTray::loadPatchData(QString patchFile, int patchNum) {
     QString line;
 
@@ -793,9 +839,21 @@
     int i = 0, matchLength = 0, selectedPart = 0, z = 0, progSize = 0;
     bool ok;
 
+   // Lets set the patch tmpdir variable now
+   if ( useCustomTmpDir )
+   {
+     patchTmpDir = customTmpDir;
+   } else {
+     patchTmpDir = PATCHTMPDIR_DEFAULT;
+   }
 
+   // Make sure this tmpdir exists
+   system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null");
+
+
+
     // Get the output of the .df command
-    command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' /tmp' > /PCBSD/tmp/.dfoutput";
+    command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' /proc' | grep -v ' /tmp' > '" + patchTmpDir + "/.dfoutput'";
     FILE *filecmd = popen(command,"r"); 
     pclose(filecmd);
 
@@ -815,22 +873,29 @@
 
     i = 0;
     // Open our df file, and read it line-by-line
-    QFile file( "/PCBSD/tmp/.dfoutput" );
+    QFile file( patchTmpDir + "/.dfoutput" );
     if ( file.open( IO_ReadOnly ) ) {
         QTextStream stream( &file );
         while ( !stream.atEnd() ) {
                    tmp = stream.readLine(); // line of text excluding '\n'
              CheckDFParts[i] =  tmp.simplifyWhiteSpace();
 
-            //QMessageBox::critical( this->contextMenu(), tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok);
+            //QMessageBox::critical( 0, tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok);
             i++;
         }
         // Make sure the last in our array is empty
         CheckDFParts[i]="";
+        file.close();
+        file.remove();
     }
 
 
-    installLoc = "/PCBSD/tmp";
+    if ( useCustomTmpDir )
+    {
+       installLoc = customTmpDir;
+    } else {
+       installLoc = PATCHTMPDIR_DEFAULT;
+    }
 
     // Now determine which partition we have selected
     i = 0;
@@ -863,7 +928,7 @@
         if ( (z - progSize) <= 1 )
         {
             // Not enough room, warn the user how much they will need
-            QMessageBox::critical( this->contextMenu(), tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates"), QMessageBox::Ok );
+            QMessageBox::critical( 0, tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates. Please select a different partition or free up some space to continue."), QMessageBox::Ok );
 	    return;
         } else {
 	    // We have enough free space, lets do this
@@ -871,7 +936,7 @@
         }
 
     } else {
-        QMessageBox::critical( this->contextMenu(), tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok);
+        QMessageBox::critical( 0, tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok);
     }
 
 }
@@ -889,8 +954,20 @@
 // Now start the actual  update process
 void UpdaterTray::slotStartSystemUpdate()
 {
-   // The user is ready to start some system updates
+  // The user is ready to start some system updates
   
+
+  // Lets set the patch tmpdir variable now
+  if ( useCustomTmpDir )
+  {
+    patchTmpDir = customTmpDir;
+  } else {
+    patchTmpDir = PATCHTMPDIR_DEFAULT;
+  }
+
+  // Make sure this tmpdir exists
+  system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 
+  
   // Change the program status and update the tray icon
   programstatus = SYSTEM_UPDATING;
 
@@ -944,7 +1021,7 @@
      // Show the updater status dialog, so user can see any errors
     UpdaterStatusDialog->show();
 
-    QMessageBox::warning( this->contextMenu(), tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok );
+    QMessageBox::warning( 0, tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok );
     requiresSysReboot = 1;
  }
 
@@ -964,7 +1041,7 @@
 
 void UpdaterTray::slotDownloadSysUpdate()
 {
-   QString status, id, tmp;
+   QString status, id, tmp, command;
    bool startNewDownload = false, ok;
    int getNextItem = 0;
 
@@ -1053,16 +1130,21 @@
    status = tr("Downloading updates...");
    UpdaterStatusDialog->setLabelSysUpdateStatus(status);
 
-    UpdaterStatusDialog->setProgressTotalSteps(100);
+   UpdaterStatusDialog->setProgressTotalSteps(100);
+   
+   command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'";
+   FILE *file = popen(command,"r"); 
+   pclose(file);
 
     // Make sure that any old patch is removed first
-    QFile tmpfile("/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma");
+    QFile tmpfile( patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma");
     if ( tmpfile.exists() )
     {
       tmpfile.remove();
     }
-     
-    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
+
+
+    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
     
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
@@ -1078,26 +1160,26 @@
 
     QString tmp;
 
-    // This function starts the internal checksum to ensure the PBI is intact
+    // This function starts the internal checksum to ensure the update is intact
 
     tmp = tr("Checking data integrity...");
     UpdaterStatusDialog->setLabelSysUpdateStatus( tmp );
 
     // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.syschecksum.sh" );
+    QFile file4( patchTmpDir + "/.syschecksum.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
-        stream4 << "cat /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma | md5 >&1";
+        stream4 << "cat '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | md5 >&1";
         file4.close();
     }
 
     checksumProc = new Q3Process( this );
     checksumProc->addArgument( "sh" );
-    checksumProc->addArgument( "/PCBSD/tmp/.syschecksum.sh" );
+    checksumProc->addArgument( patchTmpDir + "/.syschecksum.sh" );
     //connect( checksumProc, SIGNAL(processExited()), this, SLOT( slotChecksumFinished() ) );
     connect( checksumProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadSysMD5() ) );
     if ( !checksumProc->start() ) {
-      QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok );
+      QMessageBox::information( 0, tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok );
     }
 
 
@@ -1123,7 +1205,7 @@
     {
 
        // Remove the bad patch
-       command = "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma ";
+       command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'";
        FILE *file = popen(command,"r"); 
        pclose(file);
 
@@ -1133,7 +1215,7 @@
            // Show the updater status dialog, so user can see any errors
            UpdaterStatusDialog->show();
 
-           QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok );
+           QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok );
 
            if ( UpdaterStatusDialog->isShown() )
            {
@@ -1215,7 +1297,7 @@
 
         if ( requiresSysReboot == 1) 
         {
-           QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok);
+           QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok);
         } else {
            QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed!"), QMessageBox::Ok );
         }
@@ -1248,21 +1330,21 @@
     UpdaterStatusDialog->setLabelSysUpdateStatus( tmp );
 
 
-    // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.extractsys.sh" );
+    // Make the extract script now
+    QFile file4( patchTmpDir + "/.extractsys.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
         stream4 << "#!/bin/sh\n";
-        stream4 << "mkdir -p /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);
-        stream4 << "\necho \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile\n";
-        stream4 << "lzma -so d /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma | tar xvC /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + " -f - >&1";
+        stream4 << "mkdir -p '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+        stream4 << "echo \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile'\n";
+        stream4 << "lzma -so d '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | tar xvC '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "' -f - >&1";
         file4.close();
     }
 
     // start the extraction process
     extractProc = new Q3Process( this );
     extractProc->addArgument( "sh" );
-    extractProc->addArgument( "/PCBSD/tmp/.extractsys.sh" );
+    extractProc->addArgument( patchTmpDir + "/.extractsys.sh" );
 
     connect( extractProc, SIGNAL(processExited()), this, SLOT(slotSysExtractFinished() ) );
     
@@ -1270,7 +1352,7 @@
                 // Show the updater status dialog, so user can see any errors
                 UpdaterStatusDialog->show();
 
-                QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok );
+                QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok );
                 if ( UpdaterStatusDialog->isShown() )
                 {
                    UpdaterStatusDialog->hide();
@@ -1293,28 +1375,28 @@
     QString tmp;
 
     // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.installsys.sh" );
+    QFile file4( patchTmpDir + "/.installsys.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
         stream4 << "#!/bin/sh\n";
-        stream4 << "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma\n\n";
-        stream4 << "cd /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);
-        stream4 << "\nPATCHDIR=\"/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n";
-	stream4 << "cd $PATCHDIR\n";
+        stream4 << "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'\n\n";
+        stream4 << "cd '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+        stream4 << "PATCHDIR=\"" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n";
+	stream4 << "cd \"${PATCHDIR}\"\n";
         stream4 << "sh update.sh >&1 2>&1\n";
 	stream4 << "if [ \"$?\" = \"0\" ]\n";
         stream4 << "then\n";
         stream4 << "  cp /PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[currentSysWorkingItem] + " /PCBSD/SystemUpdater/system-updates/installed/" + SysUpdatePatchFile[currentSysWorkingItem] + "\n";
-	stream4 << "  rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";
-	stream4 << "  rm /PCBSD/tmp/.extractsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.installsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.syschecksum.sh\n";
+	stream4 << "  rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.extractsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.installsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.syschecksum.sh'\n";
         stream4 << "  exit 0\n";
 	stream4 << "else\n";
-	stream4 << "  rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";
-	stream4 << "  rm /PCBSD/tmp/.extractsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.installsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.syschecksum.sh\n";
+	stream4 << "  rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.extractsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.installsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.syschecksum.sh'\n";
 	stream4 << "  exit 1\n";
         stream4 << "fi\n";
         file4.close();
@@ -1323,14 +1405,14 @@
     // start the extraction process
     installProc = new Q3Process( this );
     installProc->addArgument( "sh" );
-    installProc->addArgument( "/PCBSD/tmp/.installsys.sh" );
+    installProc->addArgument( patchTmpDir + "/.installsys.sh" );
 
     connect( installProc, SIGNAL(processExited()), this, SLOT(slotSysInstallFinished() ) );
     connect( installProc, SIGNAL(readyReadStdout ()), this, SLOT(slotReadInstallScriptOutput() ) );
 
     
 	    if ( ! installProc->start() ) {
-                QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok );
+                QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok );
 		exit(15);	
 	    } 
 
@@ -1566,6 +1648,26 @@
   checkPBIProc->addArgument( progName );
   checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI]  );
 
+  if ( useProxyServer )
+  {
+     QString proxyArgPort;
+     proxyArgPort.setNum(proxyServerPort);
+    
+     QString proxyArgUrl = proxyServerUrl;
+
+     // Check if we need to remove a http://
+     if ( proxyServerUrl.indexOf("http://") == 0 )
+     {
+        proxyArgUrl.remove(0, 7);
+     }
+
+     checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort );
+
+  } else {
+     checkPBIProc->addArgument( "DISABLE" );
+  }
+
+
   connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) );
   connect( checkPBIProc, SIGNAL(processExited()), this, SLOT(slotPBICheckUpdate() ) );
   if ( !checkPBIProc->start() ) {
@@ -1700,7 +1802,17 @@
   SystemUpdaterDialog->hide();
   UpdaterStatusDialog->show();
 
+  // Lets set the patch tmpdir variable now
+  if ( useCustomTmpDir )
+  {
+    patchTmpDir = customTmpDir;
+  } else {
+    patchTmpDir = PATCHTMPDIR_DEFAULT;
+  }
 
+  // Make sure this tmpdir exists
+  system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null");
+
   // Get our list of PBIs ready to be updated
   workingPBIUpdates.clear();
   workingPBIUpdates = SystemUpdaterDialog->getListOfCheckedPBIItems();
@@ -1764,7 +1876,7 @@
            // Show the updater status dialog, so user can see any errors
            UpdaterStatusDialog->show();
           
-          QMessageBox::critical( this->contextMenu(), tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok );
+          QMessageBox::critical( 0, tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok );
 
           // Set the status that this failed
           tmp=tr("Failed Download!");
@@ -1864,15 +1976,15 @@
     UpdaterStatusDialog->setProgressTotalSteps(100);
 
     // Make sure that any old PBI is removed first
-    QFile tmpfile("/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi");
+    system("rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' >/dev/null 2>/dev/null");
+    QFile tmpfile( patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi");
     if ( tmpfile.exists() )
     {
       tmpfile.remove();
     }
-     
+
+    copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
     
-    copyJob = KIO::copy(URL, "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
-    
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
     connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
@@ -1920,12 +2032,16 @@
    if ( firstInstall == 0)
    {
 
-       if ( upgradePBIProc->exitStatus() != 0)
+       if ( upgradePBIProc->exitStatus() == 255)
        {
-         QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("The updated version of " + PBIProgName[currentWorkingPBI] + " " + tr("failed the integrity check! Please try updating this PBI again later.") ), QMessageBox::Ok );
+         QMessageBox::critical( 0, tr("Online Update"), tr("The updated version of %s failed the integrity check! Please try updating this PBI again later.", PBIProgName[currentWorkingPBI] ), QMessageBox::Ok );
          // Update the status on the previous download to finished
          status = tr("Failed!");
          UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) );
+       } else if ( upgradePBIProc->exitStatus() == 256 ) {
+          QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading %s You may need to re-install this PBI manually.", PBIProgName[currentWorkingPBI]), QMessageBox::Ok );
+         status = tr("Failed!");
+         UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) );
        } else {
          // Update the status on the previous download to finished
          status = tr("Upgrade complete!");
@@ -1957,7 +2073,7 @@
           UpdaterStatusDialog->show();
 
 
-           QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok );
+           QMessageBox::information( 0, tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok );
            if ( UpdaterStatusDialog->isShown() )
            {
              UpdaterStatusDialog->hide();
@@ -2010,16 +2126,16 @@
 
 
     // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.upgradepbi.sh" );
+    QFile file4( patchTmpDir + "/.upgradepbi.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
         stream4 << "#!/bin/sh\n";
         stream4 << "DISPLAY="" ; export DISPLAY\n";
         stream4 << "\n";
-        stream4 << "MD5=\"`cat /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi | md5`\"\n";
+        stream4 << "MD5=\"`cat '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' | md5`\"\n";
         stream4 << "if [ \"${MD5}\" != \"" + PBIProgMD5[currentWorkingPBI] + "\" ]\n";
         stream4 << "then\n";
-        stream4 << "  rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";
+        stream4 << "  rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
         stream4 << "  exit 255\n";
         stream4 << "fi\n";
         stream4 << "\n";
@@ -2036,31 +2152,35 @@
         stream4 << "\n";
         stream4 << "echo 'SETSTEPS: 2'\n";
         stream4 << "echo 'MSG: Installing " + NewProgDirName + "'\n";
-        stream4 << "chmod 755 /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";
-        stream4 << "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi -text -accept\n";
-        stream4 << "\n";
+        stream4 << "chmod 755 '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
+        stream4 << "'" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' -text -accept\n";
+        stream4 << "if [ \"$?\" != \"0\" ]\n";
+        stream4 << "then\n";
+        stream4 << "  rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
+        stream4 << "  rm '" + patchTmpDir + "/.upgradepbi.sh'\n";
+        stream4 << "  exit 256\n";
+        stream4 << "fi\n";
         stream4 << "echo 'SETSTEPS: 3'\n";
         stream4 << "echo 'MSG: Finished installing " + NewProgDirName + "'\n";
-        stream4 << "rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";
+        stream4 << "rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
+        stream4 << "rm '" + patchTmpDir + "/.upgradepbi.sh'\n";
+        stream4 << "exit 0\n";
         file4.close();
     }
 
     // start the extraction process
     upgradePBIProc = new Q3Process( this );
     upgradePBIProc->addArgument( "sh" );
-    upgradePBIProc->addArgument( "/PCBSD/tmp/.upgradepbi.sh" );
+    upgradePBIProc->addArgument( patchTmpDir + "/.upgradepbi.sh" );
 
     connect( upgradePBIProc, SIGNAL(processExited()), this, SLOT(slotStartPBIInstall() ) );
     connect( upgradePBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStdout() ) );
     
 	    if ( ! upgradePBIProc->start() ) {
-                QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok );
+                QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok );
 		exit(15);	
 	    } 
 
-
-
-
 }
 
 // Read the output from the PBI install
@@ -2076,6 +2196,7 @@
      {
          tmp = upgradePBIProc->readLineStdout();
 
+
          if ( tmp.find("TOTALSTEPS:" ) == 0)
          {
              value = tmp.replace("TOTALSTEPS: ", "");
@@ -2104,3 +2225,11 @@
      }
 
 }
+
+
+void UpdaterTray::slotLaunchKDEProxyConfig()
+{
+   QString command;
+   command = "su " + username + " -c 'kcmshell4 proxy' &";
+   system(command); 
+}

Modified: pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h	2008-10-28 15:25:53 UTC (rev 2940)
@@ -53,6 +53,7 @@
    void slotReadPBIStdout();
    void slotChangeRunStartup();
    void slotTrayActivated(QSystemTrayIcon::ActivationReason reason);
+   void slotLaunchKDEProxyConfig();
    
 protected:
    
@@ -61,8 +62,13 @@
    QString getLineFromCommandOutput( QString command );
    void loadUpdaterPrefs();
    void loadPatchData(QString patchFile, int patchNum);
-
    KJob *copyJob;
+   bool useCustomTmpDir;
+   QString customTmpDir;
+   bool useProxyServer;
+   QString proxyServerUrl;
+   int proxyServerPort;
+   QString patchTmpDir;
 };
 
 


Property changes on: pcbsd/branches/7.0/SystemUpdater/folder.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.cpp
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.cpp	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.cpp	2008-10-28 15:25:53 UTC (rev 2940)
@@ -23,6 +23,8 @@
     listViewSysUpdates->setColumnWidthMode( 1, Q3ListView::Manual );
     listViewSysUpdates->hideColumn( 1 );
 
+    disableConfUpdates = false;
+
    
    
     
@@ -35,11 +37,36 @@
     // Connect the system list box to a double-clicked slot
     connect( listViewSysUpdates, SIGNAL(doubleClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysDoubleClicked( Q3ListViewItem *, const QPoint &, int) ) );
     // Connect to a right-clicked slot as well
-        connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) );
+    connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) );
     
+    // Connect the pushViewDetails button
+    connect( pushDetails, SIGNAL( clicked() ), this, SLOT( slotViewDetailsClicked() ) );
+    
+    // Connect the Custom Tmpdir Checkbox
+    connect( checkTMPDIR, SIGNAL( clicked() ), this, SLOT( slotCustomTmpClicked() ) );
+    connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyClicked() ) );
+    connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) );
+    connect( pushConfigProxy, SIGNAL( clicked() ), this, SLOT( slotConfigKDEProxy() ) );
+
+    // Connect slots to emit signal when settings change
+    connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
+    connect( lineProxyServer, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
+    connect( spinProxyPort, SIGNAL( valueChanged(const QString &) ), this, SLOT( slotConfigChanged() ) );
+    
 }
 
 
+void systemUpdater::slotViewDetailsClicked()
+{
+   if ( listViewSysUpdates->currentItem() != 0 )
+   {
+        bool ok;
+        int idnum = listViewSysUpdates->currentItem()->text(1).toInt(&ok);        
+        emit signalOpenSysDetails(idnum);
+   }
+}
+
+
 void systemUpdater::slotClose()
 {
     
@@ -93,7 +120,10 @@
 
 void systemUpdater::slotConfigChanged()
 {
-  emit signalConfigChanged();
+  if (! disableConfUpdates )
+  {
+    emit signalConfigChanged();
+  }
 }
 
 
@@ -404,3 +434,119 @@
 {
     emit signalCheckPBIUpdatesClicked();
 }
+
+// Set if we are using a custom TmpDir
+void systemUpdater::setUseCustomTmp( bool enabled )
+{
+    checkTMPDIR->setChecked(enabled);
+    lineTMPDIR->setEnabled(enabled); 
+    pushTMPDIR->setEnabled(enabled); 
+}
+
+// Set the custom Tmpdir being used
+void systemUpdater::setUseCustomDirName( QString tmpdir )
+{
+    lineTMPDIR->setText(tmpdir);
+}
+
+// Set Proxy Usage
+void systemUpdater::setUseProxy( bool enabled )
+{
+    checkProxy->setChecked(enabled);
+    groupProxySettings->setEnabled(enabled);
+}
+
+// Set the Proxy being used
+void systemUpdater::setUseProxySettings( QString proxyURL, int portnum )
+{
+    lineProxyServer->setText(proxyURL);
+    spinProxyPort->setValue(portnum);
+}
+
+
+bool systemUpdater::getCustomTmpEnabled()
+{
+   return checkTMPDIR->isChecked();
+}
+
+
+QString systemUpdater::getCustomTmpDir()
+{
+   return lineTMPDIR->text();
+}
+
+bool systemUpdater::getProxyEnabled()
+{
+   return checkProxy->isChecked();
+}
+
+
+QString systemUpdater::getProxyUrl()
+{
+   return lineProxyServer->text();
+}
+
+int systemUpdater::getProxyPort()
+{
+  return spinProxyPort->value();
+}
+
+
+void systemUpdater::slotCustomTmpClicked()
+{
+    if ( checkTMPDIR->isChecked() )
+    {
+        lineTMPDIR->setEnabled(true); 
+        pushTMPDIR->setEnabled(true); 
+    } else {
+        lineTMPDIR->setEnabled(false); 
+        pushTMPDIR->setEnabled(false); 
+    }
+
+    slotConfigChanged();
+}
+
+void systemUpdater::slotProxyClicked()
+{
+    if ( checkProxy->isChecked() )
+    {
+        groupProxySettings->setEnabled(true);
+    } else {
+        groupProxySettings->setEnabled(false);
+    }
+
+    slotConfigChanged();
+}
+
+void systemUpdater::slotSelectCustomTmp()
+{
+
+   QString newDir = QFileDialog::getExistingDirectory(
+                    "/",
+                    this,
+                    tr("Select Temp directory"),
+                    tr("Select Temp directory"),
+                    TRUE );
+     
+     // Check if the user just hit cancel
+     if ( newDir.isEmpty() )
+     {
+        return; 
+     }
+
+   lineTMPDIR->setText(newDir);
+
+}
+
+void systemUpdater::slotDisableConfUpdates(bool status)
+{
+   // Set if we need to ignore updating the conf file, because a conf load is taking place
+   disableConfUpdates = status;
+}
+
+
+// Launches the kcmshell4 proxy command to allow the user to modify proxy settings
+void systemUpdater::slotConfigKDEProxy()
+{
+   emit signalLaunchKDEProxy();
+}

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.h
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.h	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.h	2008-10-28 15:25:53 UTC (rev 2940)
@@ -29,6 +29,7 @@
 
 public slots:
     void programInit();
+    void slotViewDetailsClicked();
     void slotClose();
     void slotUserClickedCheckSysUpdates();
     void setTextAvailSysUpdates( QString &text );
@@ -52,18 +53,31 @@
     void slotUpdatePBIClicked();
     void clearPBIList();
     void setRunAtStartupConfig( bool enabled );
+    void setUseCustomTmp( bool enabled );
+    void setUseCustomDirName( QString tmpdir );
+    void setUseProxy( bool enabled );
+    void setUseProxySettings( QString proxyURL, int portnum );
     bool getStartupConfig();
+    bool getCustomTmpEnabled();
+    QString getCustomTmpDir();
+    bool getProxyEnabled();
+    QString getProxyUrl();
+    int getProxyPort();
     void slotRescanPBIUpdatesClicked();
+    void slotDisableConfUpdates(bool status);
 
-
-
 private slots:
+    void slotCustomTmpClicked();
+    void slotProxyClicked();
+    void slotSelectCustomTmp();
+    void slotConfigKDEProxy();
 
 private:
   QMenu *popup;
   int popupidnum;
   QString standAlone[150];
   QString reboot[150];
+  bool disableConfUpdates;
 
 
 signals:
@@ -74,5 +88,6 @@
     void signalInstallSystemUpdates();
     void signalUpdatePBI();
     void signalCheckPBIUpdatesClicked();
+    void signalLaunchKDEProxy();
 } ;
 #endif // SYSTEMUPDATER_H

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.qrc
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.qrc	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.qrc	2008-10-28 15:25:53 UTC (rev 2940)
@@ -1,6 +1,6 @@
 <RCC>
   <qresource>
+    <file>folder.png</file>
     <file>sysupdater.png</file>
   </qresource>
 </RCC>
-

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.ui
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.ui	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.ui	2008-10-28 15:25:53 UTC (rev 2940)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>542</width>
-    <height>353</height>
+    <width>596</width>
+    <height>508</height>
    </rect>
   </property>
   <property name="font" >
@@ -74,14 +74,6 @@
       <number>0</number>
      </property>
      <widget class="QWidget" name="Widget8" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>524</width>
-        <height>275</height>
-       </rect>
-      </property>
       <attribute name="title" >
        <string>System Updates</string>
       </attribute>
@@ -106,7 +98,7 @@
         <layout class="QHBoxLayout" >
          <item>
           <layout class="QGridLayout" >
-           <item row="1" column="0" colspan="2" >
+           <item row="1" column="0" colspan="3" >
             <widget class="Q3ListView" name="listViewSysUpdates" >
              <property name="sizePolicy" >
               <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
@@ -150,7 +142,7 @@
              </column>
             </widget>
            </item>
-           <item row="0" column="0" colspan="2" >
+           <item row="0" column="0" colspan="3" >
             <widget class="QLabel" name="textLabel6" >
              <property name="sizePolicy" >
               <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
@@ -169,7 +161,7 @@
              </property>
             </widget>
            </item>
-           <item row="2" column="1" >
+           <item row="2" column="2" >
             <spacer name="spacer2" >
              <property name="orientation" >
               <enum>Qt::Horizontal</enum>
@@ -192,6 +184,13 @@
              </property>
             </widget>
            </item>
+           <item row="2" column="1" >
+            <widget class="QPushButton" name="pushDetails" >
+             <property name="text" >
+              <string>View Details</string>
+             </property>
+            </widget>
+           </item>
           </layout>
          </item>
          <item>
@@ -328,14 +327,6 @@
       </layout>
      </widget>
      <widget class="QWidget" name="Widget9" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>524</width>
-        <height>275</height>
-       </rect>
-      </property>
       <attribute name="title" >
        <string>PBI Updates</string>
       </attribute>
@@ -576,40 +567,185 @@
       </layout>
      </widget>
      <widget class="QWidget" name="TabPage" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>524</width>
-        <height>275</height>
-       </rect>
-      </property>
       <attribute name="title" >
        <string>Configuration</string>
       </attribute>
-      <layout class="QVBoxLayout" >
-       <item>
+      <layout class="QGridLayout" name="gridLayout_2" >
+       <item row="0" column="0" >
         <widget class="QCheckBox" name="checkSystemUpdatesConfig" >
          <property name="text" >
           <string>Check for system updates (Recommended)</string>
          </property>
         </widget>
        </item>
-       <item>
+       <item row="1" column="0" >
         <widget class="QCheckBox" name="checkPBIUpdatesConfig" >
          <property name="text" >
           <string>Check for updates to installed PBIs</string>
          </property>
         </widget>
        </item>
-       <item>
+       <item row="2" column="0" >
         <widget class="QCheckBox" name="checkRunAtStartup" >
          <property name="text" >
           <string>Run the System Updater at startup</string>
          </property>
         </widget>
        </item>
-       <item>
+       <item row="3" column="0" >
+        <layout class="QHBoxLayout" name="horizontalLayout" >
+         <item>
+          <widget class="QCheckBox" name="checkTMPDIR" >
+           <property name="text" >
+            <string>Specify custom temporary directory</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType" >
+            <enum>QSizePolicy::Minimum</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="lineTMPDIR" >
+           <property name="readOnly" >
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushTMPDIR" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize" >
+            <size>
+             <width>28</width>
+             <height>28</height>
+            </size>
+           </property>
+           <property name="maximumSize" >
+            <size>
+             <width>28</width>
+             <height>28</height>
+            </size>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="SystemUpdater.qrc" >
+             <normaloff>:/folder.png</normaloff>:/folder.png</iconset>
+           </property>
+           <property name="iconSize" >
+            <size>
+             <width>20</width>
+             <height>20</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="4" column="0" >
+        <widget class="QCheckBox" name="checkProxy" >
+         <property name="text" >
+          <string>Specify proxy for update check</string>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="0" >
+        <widget class="QGroupBox" name="groupProxySettings" >
+         <property name="title" >
+          <string>Proxy Settings</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout" >
+          <item row="0" column="0" >
+           <layout class="QHBoxLayout" name="horizontalLayout_2" >
+            <item>
+             <widget class="QLabel" name="label" >
+              <property name="text" >
+               <string>Proxy Server</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLineEdit" name="lineProxyServer" />
+            </item>
+            <item>
+             <widget class="QLabel" name="label_2" >
+              <property name="text" >
+               <string>Port</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="spinProxyPort" >
+              <property name="maximum" >
+               <number>9999</number>
+              </property>
+              <property name="value" >
+               <number>8080</number>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="6" column="0" >
+        <layout class="QHBoxLayout" name="horizontalLayout_3" >
+         <item>
+          <spacer name="horizontalSpacer_2" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushConfigProxy" >
+           <property name="text" >
+            <string>Configure Download Proxy</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_3" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item row="7" column="0" >
         <spacer name="spacer8" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
@@ -625,7 +761,7 @@
          </property>
         </spacer>
        </item>
-       <item>
+       <item row="8" column="0" >
         <spacer name="spacer9" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>

Modified: pcbsd/trunk/SystemUpdater/UpdaterTray.cpp
===================================================================
--- pcbsd/trunk/SystemUpdater/UpdaterTray.cpp	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/trunk/SystemUpdater/UpdaterTray.cpp	2008-10-28 15:25:53 UTC (rev 2940)
@@ -33,10 +33,11 @@
 /* Update interval in ms  - Every 12 hours */
 #define  UPDATE_MSEC 1000 * 60 * 60 * 12
 
+/* Change this to switch the default patch tmpdir */
+#define  PATCHTMPDIR_DEFAULT "/usr/local/tmp"
 
 
 
-
 /* The Update STATUS Flags */
 #define SYSTEM_UP2DATE 0
 #define SYSTEM_UPDATE_AVAIL 1
@@ -136,6 +137,7 @@
 
   // If the user wants to view details about a particular update
   connect( SystemUpdaterDialog, SIGNAL(signalOpenSysDetails(int)), this, SLOT(slotOpenSysDetails(int) ) );
+  connect( SystemUpdaterDialog, SIGNAL(signalLaunchKDEProxy()), this, SLOT(slotLaunchKDEProxyConfig() ) );
 
   // Signal if the user wants to start a system update
   connect( SystemUpdaterDialog, SIGNAL(signalInstallSystemUpdates()), this, SLOT(slotStartCheckAvailSysSpace() ) );
@@ -153,10 +155,9 @@
   connect( UpdaterStatusDialog, SIGNAL(buttonClosedPressed()), this, SLOT(contextMenuRefresh() ) );
  
 
-// Get the username of the person running X
+  // Get the username of the person running X
   username = getlogin();
 
-
   // Set the tray icon that we are checking for updates
   QIcon Icon;
   Icon.addFile("/PCBSD/SystemUpdater/images/working.png");
@@ -246,12 +247,30 @@
   getUpdatesDir = new Q3Process( this );
   getUpdatesDir->addArgument( "sh");
   getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh");
+  if ( useProxyServer )
+  {
+     QString proxyArgPort;
+     proxyArgPort.setNum(proxyServerPort);
 
+     QString proxyArgUrl = proxyServerUrl;
+
+     // Check if we need to remove a http://
+     if ( proxyServerUrl.indexOf("http://") == 0 )
+     {
+        proxyArgUrl.remove(0, 7);
+     }
+
+     getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort );
+
+  } else {
+     getUpdatesDir->addArgument( "DISABLE" );
+  }
+
   // Connect the exited signal and start the process
   connect( getUpdatesDir, SIGNAL(processExited()), this, SLOT(slotSysUpdateCheckFinished() ) );
   //connect( SetupScript, SIGNAL(readyReadStdout()), this, SLOT(readyReadScriptOutput2() ) );
   if ( ! getUpdatesDir->start() ) {
-        QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );
+        QMessageBox::information( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );
   }
 
 
@@ -268,7 +287,7 @@
   // Check to see if the update download was successful and warn if not
   if ( getUpdatesDir->exitStatus() != 0 )
   {
-	QMessageBox::warning( this->contextMenu(), tr("Update Error!"), tr("Could not contact the PC-BSD update server!"), QMessageBox::Ok );
+	QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under 'configure'"), QMessageBox::Ok );
   } 
 
    // Now traverse the directory, see if we have updates.
@@ -279,7 +298,7 @@
   // Connect the exited signal and start the process
   connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) );
   if ( ! readSysUpdates->start() ) {
-        QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok );
+        QMessageBox::information( 0, tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok );
   }
 
 
@@ -643,11 +662,6 @@
   checkSysUpdatesFrequently = enableSysCheck;
 
 
-
- 
-
-
-
   // Check if the user wants to check for PBI updates and save it 
   bool enablePBICheck = SystemUpdaterDialog->getPBIUpdateConfig();
   settings.writeEntry( "/PC-BSD/SystemUpdater/CheckPBIUpdatesConfig", enablePBICheck );
@@ -661,24 +675,39 @@
 
   checkPBIUpdatesFrequently = enablePBICheck;
 
-}
 
+  // Check if the user has enabled a custom tmpdir 
+  useCustomTmpDir = SystemUpdaterDialog->getCustomTmpEnabled();  
+  settings.writeEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", useCustomTmpDir );
 
+  // Load the custom tmpdir string
+  customTmpDir = SystemUpdaterDialog->getCustomTmpDir();
+  settings.writeEntry( "/PC-BSD/SystemUpdater/customTmpDir", customTmpDir );
 
+  useProxyServer = SystemUpdaterDialog->getProxyEnabled();
+  settings.setValue( "/PC-BSD/SystemUpdater/useProxyServer", useProxyServer );
+ 
+  proxyServerUrl = SystemUpdaterDialog->getProxyUrl();
+  settings.setValue( "/PC-BSD/SystemUpdater/proxyServerUrl", proxyServerUrl );
 
+  proxyServerPort = SystemUpdaterDialog->getProxyPort();
+  settings.setValue( "/PC-BSD/SystemUpdater/proxyServerPort", proxyServerPort );
 
 
+}
 
 void UpdaterTray::loadUpdaterPrefs() {
   // Load the user preferences for the System Updater
+  bool ok;
   QSettings settings;
-  //settings.setPath( "PC-BSD", "SystemUpdater" );
+  
+  // Disable updating the conf file until we are done loading it
+  SystemUpdaterDialog->slotDisableConfUpdates(true);
 
   bool enableSysCheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckSysUpdatesConfig", TRUE );
   SystemUpdaterDialog->setSystemUpdateConfig(enableSysCheck);
   checkSysUpdatesFrequently = enableSysCheck;
   
-
   bool enablePBICheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckPBIUpdatesConfig", TRUE );
   SystemUpdaterDialog->setPBIUpdateConfig(enablePBICheck);
   checkPBIUpdatesFrequently = enablePBICheck;
@@ -687,25 +716,42 @@
   SystemUpdaterDialog->setRunAtStartupConfig(enableStartup);
   contextMenu()->setItemChecked ( 6, enableStartup );
 
-}
+  // Check if we are using a custom tmpdir
+  useCustomTmpDir = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", false );
+  SystemUpdaterDialog->setUseCustomTmp( useCustomTmpDir );
 
+  // Load a custom tmpdir
+  customTmpDir= PATCHTMPDIR_DEFAULT;
+  customTmpDir = settings.value("/PC-BSD/SystemUpdater/customTmpDir", customTmpDir).toString();
+  SystemUpdaterDialog->setUseCustomDirName( customTmpDir );
+  
+  // Load if the user wants to use a proxy server
+  useProxyServer = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useProxyServer", false );
+  SystemUpdaterDialog->setUseProxy( useProxyServer );
+  
+  // Load Proxy Server Settings
+  proxyServerUrl = settings.value( "/PC-BSD/SystemUpdater/proxyServerUrl" ).toString();
 
+  settings.value("/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok);
+  if ( ok ) {
+     proxyServerPort = settings.value( "/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok);
+  } else {
+     proxyServerPort = 8080;
+  }
+  SystemUpdaterDialog->setUseProxySettings( proxyServerUrl, proxyServerPort );
 
+  SystemUpdaterDialog->slotDisableConfUpdates(false);
 
+}
 
 
 
-
 void UpdaterTray::slotSysUpdateTimer() {
   slotStartUpdateCheck();
 }
 
 
 
-
-
-
-
 void UpdaterTray::loadPatchData(QString patchFile, int patchNum) {
     QString line;
 
@@ -793,9 +839,21 @@
     int i = 0, matchLength = 0, selectedPart = 0, z = 0, progSize = 0;
     bool ok;
 
+   // Lets set the patch tmpdir variable now
+   if ( useCustomTmpDir )
+   {
+     patchTmpDir = customTmpDir;
+   } else {
+     patchTmpDir = PATCHTMPDIR_DEFAULT;
+   }
 
+   // Make sure this tmpdir exists
+   system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null");
+
+
+
     // Get the output of the .df command
-    command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' /tmp' > /PCBSD/tmp/.dfoutput";
+    command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' /proc' | grep -v ' /tmp' > '" + patchTmpDir + "/.dfoutput'";
     FILE *filecmd = popen(command,"r"); 
     pclose(filecmd);
 
@@ -815,22 +873,29 @@
 
     i = 0;
     // Open our df file, and read it line-by-line
-    QFile file( "/PCBSD/tmp/.dfoutput" );
+    QFile file( patchTmpDir + "/.dfoutput" );
     if ( file.open( IO_ReadOnly ) ) {
         QTextStream stream( &file );
         while ( !stream.atEnd() ) {
                    tmp = stream.readLine(); // line of text excluding '\n'
              CheckDFParts[i] =  tmp.simplifyWhiteSpace();
 
-            //QMessageBox::critical( this->contextMenu(), tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok);
+            //QMessageBox::critical( 0, tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok);
             i++;
         }
         // Make sure the last in our array is empty
         CheckDFParts[i]="";
+        file.close();
+        file.remove();
     }
 
 
-    installLoc = "/PCBSD/tmp";
+    if ( useCustomTmpDir )
+    {
+       installLoc = customTmpDir;
+    } else {
+       installLoc = PATCHTMPDIR_DEFAULT;
+    }
 
     // Now determine which partition we have selected
     i = 0;
@@ -863,7 +928,7 @@
         if ( (z - progSize) <= 1 )
         {
             // Not enough room, warn the user how much they will need
-            QMessageBox::critical( this->contextMenu(), tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates"), QMessageBox::Ok );
+            QMessageBox::critical( 0, tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates. Please select a different partition or free up some space to continue."), QMessageBox::Ok );
 	    return;
         } else {
 	    // We have enough free space, lets do this
@@ -871,7 +936,7 @@
         }
 
     } else {
-        QMessageBox::critical( this->contextMenu(), tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok);
+        QMessageBox::critical( 0, tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok);
     }
 
 }
@@ -889,8 +954,20 @@
 // Now start the actual  update process
 void UpdaterTray::slotStartSystemUpdate()
 {
-   // The user is ready to start some system updates
+  // The user is ready to start some system updates
   
+
+  // Lets set the patch tmpdir variable now
+  if ( useCustomTmpDir )
+  {
+    patchTmpDir = customTmpDir;
+  } else {
+    patchTmpDir = PATCHTMPDIR_DEFAULT;
+  }
+
+  // Make sure this tmpdir exists
+  system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 
+  
   // Change the program status and update the tray icon
   programstatus = SYSTEM_UPDATING;
 
@@ -944,7 +1021,7 @@
      // Show the updater status dialog, so user can see any errors
     UpdaterStatusDialog->show();
 
-    QMessageBox::warning( this->contextMenu(), tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok );
+    QMessageBox::warning( 0, tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok );
     requiresSysReboot = 1;
  }
 
@@ -964,7 +1041,7 @@
 
 void UpdaterTray::slotDownloadSysUpdate()
 {
-   QString status, id, tmp;
+   QString status, id, tmp, command;
    bool startNewDownload = false, ok;
    int getNextItem = 0;
 
@@ -1053,16 +1130,21 @@
    status = tr("Downloading updates...");
    UpdaterStatusDialog->setLabelSysUpdateStatus(status);
 
-    UpdaterStatusDialog->setProgressTotalSteps(100);
+   UpdaterStatusDialog->setProgressTotalSteps(100);
+   
+   command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'";
+   FILE *file = popen(command,"r"); 
+   pclose(file);
 
     // Make sure that any old patch is removed first
-    QFile tmpfile("/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma");
+    QFile tmpfile( patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma");
     if ( tmpfile.exists() )
     {
       tmpfile.remove();
     }
-     
-    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
+
+
+    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
     
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
@@ -1078,26 +1160,26 @@
 
     QString tmp;
 
-    // This function starts the internal checksum to ensure the PBI is intact
+    // This function starts the internal checksum to ensure the update is intact
 
     tmp = tr("Checking data integrity...");
     UpdaterStatusDialog->setLabelSysUpdateStatus( tmp );
 
     // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.syschecksum.sh" );
+    QFile file4( patchTmpDir + "/.syschecksum.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
-        stream4 << "cat /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma | md5 >&1";
+        stream4 << "cat '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | md5 >&1";
         file4.close();
     }
 
     checksumProc = new Q3Process( this );
     checksumProc->addArgument( "sh" );
-    checksumProc->addArgument( "/PCBSD/tmp/.syschecksum.sh" );
+    checksumProc->addArgument( patchTmpDir + "/.syschecksum.sh" );
     //connect( checksumProc, SIGNAL(processExited()), this, SLOT( slotChecksumFinished() ) );
     connect( checksumProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadSysMD5() ) );
     if ( !checksumProc->start() ) {
-      QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok );
+      QMessageBox::information( 0, tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok );
     }
 
 
@@ -1123,7 +1205,7 @@
     {
 
        // Remove the bad patch
-       command = "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma ";
+       command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'";
        FILE *file = popen(command,"r"); 
        pclose(file);
 
@@ -1133,7 +1215,7 @@
            // Show the updater status dialog, so user can see any errors
            UpdaterStatusDialog->show();
 
-           QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok );
+           QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok );
 
            if ( UpdaterStatusDialog->isShown() )
            {
@@ -1215,7 +1297,7 @@
 
         if ( requiresSysReboot == 1) 
         {
-           QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok);
+           QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok);
         } else {
            QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed!"), QMessageBox::Ok );
         }
@@ -1248,21 +1330,21 @@
     UpdaterStatusDialog->setLabelSysUpdateStatus( tmp );
 
 
-    // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.extractsys.sh" );
+    // Make the extract script now
+    QFile file4( patchTmpDir + "/.extractsys.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
         stream4 << "#!/bin/sh\n";
-        stream4 << "mkdir -p /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);
-        stream4 << "\necho \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile\n";
-        stream4 << "lzma -so d /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma | tar xvC /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + " -f - >&1";
+        stream4 << "mkdir -p '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+        stream4 << "echo \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile'\n";
+        stream4 << "lzma -so d '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | tar xvC '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "' -f - >&1";
         file4.close();
     }
 
     // start the extraction process
     extractProc = new Q3Process( this );
     extractProc->addArgument( "sh" );
-    extractProc->addArgument( "/PCBSD/tmp/.extractsys.sh" );
+    extractProc->addArgument( patchTmpDir + "/.extractsys.sh" );
 
     connect( extractProc, SIGNAL(processExited()), this, SLOT(slotSysExtractFinished() ) );
     
@@ -1270,7 +1352,7 @@
                 // Show the updater status dialog, so user can see any errors
                 UpdaterStatusDialog->show();
 
-                QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok );
+                QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok );
                 if ( UpdaterStatusDialog->isShown() )
                 {
                    UpdaterStatusDialog->hide();
@@ -1293,28 +1375,28 @@
     QString tmp;
 
     // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.installsys.sh" );
+    QFile file4( patchTmpDir + "/.installsys.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
         stream4 << "#!/bin/sh\n";
-        stream4 << "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma\n\n";
-        stream4 << "cd /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);
-        stream4 << "\nPATCHDIR=\"/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n";
-	stream4 << "cd $PATCHDIR\n";
+        stream4 << "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'\n\n";
+        stream4 << "cd '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+        stream4 << "PATCHDIR=\"" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n";
+	stream4 << "cd \"${PATCHDIR}\"\n";
         stream4 << "sh update.sh >&1 2>&1\n";
 	stream4 << "if [ \"$?\" = \"0\" ]\n";
         stream4 << "then\n";
         stream4 << "  cp /PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[currentSysWorkingItem] + " /PCBSD/SystemUpdater/system-updates/installed/" + SysUpdatePatchFile[currentSysWorkingItem] + "\n";
-	stream4 << "  rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";
-	stream4 << "  rm /PCBSD/tmp/.extractsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.installsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.syschecksum.sh\n";
+	stream4 << "  rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.extractsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.installsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.syschecksum.sh'\n";
         stream4 << "  exit 0\n";
 	stream4 << "else\n";
-	stream4 << "  rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";
-	stream4 << "  rm /PCBSD/tmp/.extractsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.installsys.sh\n";
-	stream4 << "  rm /PCBSD/tmp/.syschecksum.sh\n";
+	stream4 << "  rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.extractsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.installsys.sh'\n";
+	stream4 << "  rm '" + patchTmpDir + "/.syschecksum.sh'\n";
 	stream4 << "  exit 1\n";
         stream4 << "fi\n";
         file4.close();
@@ -1323,14 +1405,14 @@
     // start the extraction process
     installProc = new Q3Process( this );
     installProc->addArgument( "sh" );
-    installProc->addArgument( "/PCBSD/tmp/.installsys.sh" );
+    installProc->addArgument( patchTmpDir + "/.installsys.sh" );
 
     connect( installProc, SIGNAL(processExited()), this, SLOT(slotSysInstallFinished() ) );
     connect( installProc, SIGNAL(readyReadStdout ()), this, SLOT(slotReadInstallScriptOutput() ) );
 
     
 	    if ( ! installProc->start() ) {
-                QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok );
+                QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok );
 		exit(15);	
 	    } 
 
@@ -1566,6 +1648,26 @@
   checkPBIProc->addArgument( progName );
   checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI]  );
 
+  if ( useProxyServer )
+  {
+     QString proxyArgPort;
+     proxyArgPort.setNum(proxyServerPort);
+    
+     QString proxyArgUrl = proxyServerUrl;
+
+     // Check if we need to remove a http://
+     if ( proxyServerUrl.indexOf("http://") == 0 )
+     {
+        proxyArgUrl.remove(0, 7);
+     }
+
+     checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort );
+
+  } else {
+     checkPBIProc->addArgument( "DISABLE" );
+  }
+
+
   connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) );
   connect( checkPBIProc, SIGNAL(processExited()), this, SLOT(slotPBICheckUpdate() ) );
   if ( !checkPBIProc->start() ) {
@@ -1700,7 +1802,17 @@
   SystemUpdaterDialog->hide();
   UpdaterStatusDialog->show();
 
+  // Lets set the patch tmpdir variable now
+  if ( useCustomTmpDir )
+  {
+    patchTmpDir = customTmpDir;
+  } else {
+    patchTmpDir = PATCHTMPDIR_DEFAULT;
+  }
 
+  // Make sure this tmpdir exists
+  system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null");
+
   // Get our list of PBIs ready to be updated
   workingPBIUpdates.clear();
   workingPBIUpdates = SystemUpdaterDialog->getListOfCheckedPBIItems();
@@ -1764,7 +1876,7 @@
            // Show the updater status dialog, so user can see any errors
            UpdaterStatusDialog->show();
           
-          QMessageBox::critical( this->contextMenu(), tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok );
+          QMessageBox::critical( 0, tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok );
 
           // Set the status that this failed
           tmp=tr("Failed Download!");
@@ -1864,15 +1976,15 @@
     UpdaterStatusDialog->setProgressTotalSteps(100);
 
     // Make sure that any old PBI is removed first
-    QFile tmpfile("/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi");
+    system("rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' >/dev/null 2>/dev/null");
+    QFile tmpfile( patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi");
     if ( tmpfile.exists() )
     {
       tmpfile.remove();
     }
-     
+
+    copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
     
-    copyJob = KIO::copy(URL, "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
-    
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
     connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
@@ -1920,12 +2032,16 @@
    if ( firstInstall == 0)
    {
 
-       if ( upgradePBIProc->exitStatus() != 0)
+       if ( upgradePBIProc->exitStatus() == 255)
        {
-         QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("The updated version of " + PBIProgName[currentWorkingPBI] + " " + tr("failed the integrity check! Please try updating this PBI again later.") ), QMessageBox::Ok );
+         QMessageBox::critical( 0, tr("Online Update"), tr("The updated version of %s failed the integrity check! Please try updating this PBI again later.", PBIProgName[currentWorkingPBI] ), QMessageBox::Ok );
          // Update the status on the previous download to finished
          status = tr("Failed!");
          UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) );
+       } else if ( upgradePBIProc->exitStatus() == 256 ) {
+          QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading %s You may need to re-install this PBI manually.", PBIProgName[currentWorkingPBI]), QMessageBox::Ok );
+         status = tr("Failed!");
+         UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) );
        } else {
          // Update the status on the previous download to finished
          status = tr("Upgrade complete!");
@@ -1957,7 +2073,7 @@
           UpdaterStatusDialog->show();
 
 
-           QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok );
+           QMessageBox::information( 0, tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok );
            if ( UpdaterStatusDialog->isShown() )
            {
              UpdaterStatusDialog->hide();
@@ -2010,16 +2126,16 @@
 
 
     // Make the checksum.sh script now
-    QFile file4( "/PCBSD/tmp/.upgradepbi.sh" );
+    QFile file4( patchTmpDir + "/.upgradepbi.sh" );
     if ( file4.open( IO_WriteOnly ) ) {
         QTextStream stream4( &file4 );
         stream4 << "#!/bin/sh\n";
         stream4 << "DISPLAY="" ; export DISPLAY\n";
         stream4 << "\n";
-        stream4 << "MD5=\"`cat /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi | md5`\"\n";
+        stream4 << "MD5=\"`cat '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' | md5`\"\n";
         stream4 << "if [ \"${MD5}\" != \"" + PBIProgMD5[currentWorkingPBI] + "\" ]\n";
         stream4 << "then\n";
-        stream4 << "  rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";
+        stream4 << "  rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
         stream4 << "  exit 255\n";
         stream4 << "fi\n";
         stream4 << "\n";
@@ -2036,31 +2152,35 @@
         stream4 << "\n";
         stream4 << "echo 'SETSTEPS: 2'\n";
         stream4 << "echo 'MSG: Installing " + NewProgDirName + "'\n";
-        stream4 << "chmod 755 /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";
-        stream4 << "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi -text -accept\n";
-        stream4 << "\n";
+        stream4 << "chmod 755 '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
+        stream4 << "'" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' -text -accept\n";
+        stream4 << "if [ \"$?\" != \"0\" ]\n";
+        stream4 << "then\n";
+        stream4 << "  rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
+        stream4 << "  rm '" + patchTmpDir + "/.upgradepbi.sh'\n";
+        stream4 << "  exit 256\n";
+        stream4 << "fi\n";
         stream4 << "echo 'SETSTEPS: 3'\n";
         stream4 << "echo 'MSG: Finished installing " + NewProgDirName + "'\n";
-        stream4 << "rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";
+        stream4 << "rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n";
+        stream4 << "rm '" + patchTmpDir + "/.upgradepbi.sh'\n";
+        stream4 << "exit 0\n";
         file4.close();
     }
 
     // start the extraction process
     upgradePBIProc = new Q3Process( this );
     upgradePBIProc->addArgument( "sh" );
-    upgradePBIProc->addArgument( "/PCBSD/tmp/.upgradepbi.sh" );
+    upgradePBIProc->addArgument( patchTmpDir + "/.upgradepbi.sh" );
 
     connect( upgradePBIProc, SIGNAL(processExited()), this, SLOT(slotStartPBIInstall() ) );
     connect( upgradePBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStdout() ) );
     
 	    if ( ! upgradePBIProc->start() ) {
-                QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok );
+                QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok );
 		exit(15);	
 	    } 
 
-
-
-
 }
 
 // Read the output from the PBI install
@@ -2076,6 +2196,7 @@
      {
          tmp = upgradePBIProc->readLineStdout();
 
+
          if ( tmp.find("TOTALSTEPS:" ) == 0)
          {
              value = tmp.replace("TOTALSTEPS: ", "");
@@ -2104,3 +2225,11 @@
      }
 
 }
+
+
+void UpdaterTray::slotLaunchKDEProxyConfig()
+{
+   QString command;
+   command = "su " + username + " -c 'kcmshell4 proxy' &";
+   system(command); 
+}

Modified: pcbsd/trunk/SystemUpdater/UpdaterTray.h
===================================================================
--- pcbsd/trunk/SystemUpdater/UpdaterTray.h	2008-10-27 14:11:20 UTC (rev 2939)
+++ pcbsd/trunk/SystemUpdater/UpdaterTray.h	2008-10-28 15:25:53 UTC (rev 2940)
@@ -53,6 +53,7 @@
    void slotReadPBIStdout();
    void slotChangeRunStartup();
    void slotTrayActivated(QSystemTrayIcon::ActivationReason reason);
+   void slotLaunchKDEProxyConfig();
    
 protected:
    
@@ -61,8 +62,13 @@
    QString getLineFromCommandOutput( QString command );
    void loadUpdaterPrefs();
    void loadPatchData(QString patchFile, int patchNum);
-
    KJob *copyJob;
+   bool useCustomTmpDir;
+   QString customTmpDir;
+   bool useProxyServer;
+   QString proxyServerUrl;
+   int proxyServerPort;
+   QString patchTmpDir;
 };
 
 


Property changes on: pcbsd/trunk/SystemUpdater/folder.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the Commits mailing list