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

svn at pcbsd.org svn at pcbsd.org
Wed Oct 29 11:55:34 PST 2008


Author: kris
Date: 2008-10-29 12:55:33 -0700 (Wed, 29 Oct 2008)
New Revision: 2941

Modified:
   pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp
   pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h
   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.ui
   pcbsd/trunk/SystemUpdater/UpdaterTray.cpp
   pcbsd/trunk/SystemUpdater/UpdaterTray.h
Log:

Update to the SystemUpdater tool, which fixes lots of Proxy issues, and speedup of all KIO calls



Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp	2008-10-29 19:55:33 UTC (rev 2941)
@@ -44,14 +44,11 @@
     
     // 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() ) );
     
 }
 
@@ -449,21 +446,6 @@
     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();
@@ -475,23 +457,6 @@
    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() )
@@ -506,18 +471,6 @@
     slotConfigChanged();
 }
 
-void systemUpdater::slotProxyClicked()
-{
-    if ( checkProxy->isChecked() )
-    {
-        groupProxySettings->setEnabled(true);
-    } else {
-        groupProxySettings->setEnabled(false);
-    }
-
-    slotConfigChanged();
-}
-
 void systemUpdater::slotSelectCustomTmp()
 {
 

Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h	2008-10-29 19:55:33 UTC (rev 2941)
@@ -55,20 +55,14 @@
     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();
 

Modified: pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui	2008-10-29 19:55:33 UTC (rev 2941)
@@ -662,53 +662,6 @@
         </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" >
@@ -726,7 +679,7 @@
          <item>
           <widget class="QPushButton" name="pushConfigProxy" >
            <property name="text" >
-            <string>Configure Download Proxy</string>
+            <string>Configure Proxy Settings</string>
            </property>
           </widget>
          </item>
@@ -745,7 +698,7 @@
          </item>
         </layout>
        </item>
-       <item row="7" column="0" >
+       <item row="5" column="0" >
         <spacer name="spacer8" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
@@ -761,7 +714,7 @@
          </property>
         </spacer>
        </item>
-       <item row="8" column="0" >
+       <item row="6" 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-28 15:25:53 UTC (rev 2940)
+++ pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp	2008-10-29 19:55:33 UTC (rev 2941)
@@ -107,6 +107,7 @@
 QString PBIProgURL2[900];
 QString PBIProgURL3[900];
 QString PBIProgMD5[900];
+QString PBIProgLoc[900];
 int     PBIProgUpdate[900];
 int     PBIProgFailed[900];
 
@@ -158,28 +159,25 @@
   // 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");
-  setIcon(Icon);
-
   // Setup our Context Menu
-  contextMenu()->clear();
-  //contextMenu()->insertTitle(PixmapIcon, tr("PC-BSD Update Manager"), 1);
   contextMenu()->insertSeparator();
   contextMenu()->insertItem( tr("Start the Update Manager"), this, SLOT(slotOpenUpdateManager()), 0, 5);
   contextMenu()->insertItem( tr("Run at startup"), this, SLOT(slotChangeRunStartup()), 0, 6);
   contextMenu()->setItemChecked ( 6, TRUE );
-  //contextMenu()->insertItem( tr("Checking for System Updates..."), this, SLOT(slotStartUpdateCheckManual(), 0, 6);
+  
+  // Set the tray icon that we are checking for updates
+  QIcon Icon;
+  Icon.addFile("/PCBSD/SystemUpdater/images/working.png");
+  setIcon(Icon);
 
   // Load the program preferences
   loadUpdaterPrefs();
 
   // Start the monitor service for system updates
-  slotScheduledSystemCheck();
+  QTimer::singleShot(1000, this, SLOT(slotScheduledSystemCheck()));
 
   // Start the monitor service for PBI updates
-  slotScheduledPBICheck();
+  QTimer::singleShot(1000, this, SLOT(slotScheduledPBICheck()));
   
 }
 
@@ -215,7 +213,12 @@
 
 
 
-void UpdaterTray::slotStartUpdateCheck() {
+void UpdaterTray::slotStartUpdateCheck()
+{
+  QString SysUrl;
+  QString PatchSet;
+  QString Version;
+  QString Arch, line;
 
   // Check if the system is doing updates right now, if it is, ignore the request
   if ( programstatus == SYSTEM_UPDATING || programstatus == SYSTEM_CHECKING4UPDATES) {
@@ -243,38 +246,58 @@
   // Create the tooltip popup now
   displayTooltip();
 
-  // Run the getUpdatesDir.sh script to rsync with master server
-  getUpdatesDir = new Q3Process( this );
-  getUpdatesDir->addArgument( "sh");
-  getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh");
-  if ( useProxyServer )
-  {
-     QString proxyArgPort;
-     proxyArgPort.setNum(proxyServerPort);
+  // Run our KIO Job to fetch the system-update patch data for this version of PC-BSD
 
-     QString proxyArgUrl = proxyServerUrl;
+  // First, get some variables to figure out the full patch URL
+  QFile file( "/PCBSD/SystemUpdater/conf/sysupdate.conf" );
+  if ( file.open( IO_ReadOnly ) ) {
+      QTextStream stream( &file );
+      while ( !stream.atEnd() ) {
+          line = stream.readLine(); // line of text excluding '\n'
+          if ( line.find("UPDATESERVER: " ) == 0)
+          {
+              line.replace("UPDATESERVER: ", "");
+              SysUrl = line; 
+          }
+          
+          if ( line.find("PATCHSET: " ) == 0)
+          {
+              line.replace("PATCHSET: ", "");
+              PatchSet = line; 
+          }
+       }
+      file.close();
+   } 
 
-     // Check if we need to remove a http://
-     if ( proxyServerUrl.indexOf("http://") == 0 )
-     {
-        proxyArgUrl.remove(0, 7);
-     }
+   QString command = "pbreg get /PC-BSD/Version";
+   Version = getLineFromCommandOutput(command);
 
-     getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort );
+   command = "uname -p";
+   Arch = getLineFromCommandOutput(command);
+   if ( Arch.indexOf("i386") != -1 )
+   {
+      Arch = "i386";
+   }
+   if ( Arch.indexOf("amd64") != -1 )
+   {
+      Arch = "amd64";
+   }
 
-  } else {
-     getUpdatesDir->addArgument( "DISABLE" );
-  }
+   if ( SysUrl.isEmpty() || PatchSet.isEmpty() || Version.isEmpty() || Arch.isEmpty() )
+   {
+        // Bad patch file?
+        QMessageBox::information( 0, tr("Error!"), tr("Error parsing sysupdate.conf!!!"), QMessageBox::Ok );
+        return;
+   }
 
-  // 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( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );
-  }
+  QString patchfile = "patch-" + PatchSet + "-" + Version + "-" + Arch + ".tgz";
+  sysPatchsetTmpFile = "/PCBSD/tmp/" + patchfile;
+  QString patchurl = SysUrl + "/" + patchfile;
 
-
-
+  // Start our KIO copy now
+  sysFetchJob = KIO::file_copy( patchurl, sysPatchsetTmpFile, -1, KIO::HideProgressInfo | KIO::Overwrite);
+  connect(sysFetchJob, SIGNAL(result(KJob *)), this, SLOT(slotSysUpdateCheckFinished() ) );
+  
 }
 
 
@@ -284,17 +307,33 @@
 
 
 void UpdaterTray::slotSysUpdateCheckFinished() {
-  // Check to see if the update download was successful and warn if not
-  if ( getUpdatesDir->exitStatus() != 0 )
-  {
-	QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under 'configure'"), QMessageBox::Ok );
-  } 
 
+  QString command = "pbreg get /PC-BSD/Version";
+  QString Version = getLineFromCommandOutput(command);
+
    // Now traverse the directory, see if we have updates.
   readSysUpdates = new Q3Process( this );
   readSysUpdates->addArgument( "sh");
   readSysUpdates->addArgument( "/PCBSD/SystemUpdater/bin/readSysUpdates.sh");
+  readSysUpdates->addArgument( Version );
 
+  // Check to see if the update download was successful and warn if not
+  if ( sysFetchJob->error() != 0 )
+  {
+        // Check if we should show the updater dialog or not
+        if (! SystemUpdaterDialog->isShown() )
+        {
+           SystemUpdaterDialog->show();
+	   QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under Configuration"), QMessageBox::Ok );
+           SystemUpdaterDialog->hide();
+        } else {
+	   QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under Configuration"), QMessageBox::Ok );
+        }
+  } else {
+     // Add the patchdata URL
+     readSysUpdates->addArgument(sysPatchsetTmpFile);
+  } 
+
   // Connect the exited signal and start the process
   connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) );
   if ( ! readSysUpdates->start() ) {
@@ -624,8 +663,8 @@
 
    //QToolTip::clear();
    // Update the tooltop
-   QToolTip::remove(this->contextMenu());
-   QToolTip::add(this->contextMenu(), tooltipStr);
+   QToolTip::remove(contextMenu());
+   QToolTip::add(contextMenu(), tooltipStr);
 
 }
 
@@ -684,21 +723,10 @@
   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;
   
   // Disable updating the conf file until we are done loading it
@@ -725,21 +753,6 @@
   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);
 
 }
@@ -1144,7 +1157,7 @@
     }
 
 
-    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
+    copyJob = KIO::file_copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", -1, KIO::HideProgressInfo | KIO::Overwrite);
     
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
@@ -1616,13 +1629,15 @@
 // Start checking our list of PBIs which may be updatable
 void UpdaterTray::slotPBICheckUpdate()
 {
-   
 
+    QString tmp, line;
+    QString progName, Arch, Version, PBIUrl;
+
+
+    // Jump to the next PBI in our list
     currentWorkingPBI++;
-    QString tmp;
-    QString progName;
 
-
+    // Check if we are done with checking for updates
     if ( PBIProgName[currentWorkingPBI].isEmpty() )
     {
         // Go ahead and finish up the PBI update check now
@@ -1643,43 +1658,107 @@
   progName = tmp;
 
 
-  checkPBIProc = new Q3Process( this );
-  checkPBIProc->addArgument( "/PCBSD/SystemUpdater/bin/getPBIUpdateStatus.sh" );
-  checkPBIProc->addArgument( progName );
-  checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI]  );
 
-  if ( useProxyServer )
-  {
-     QString proxyArgPort;
-     proxyArgPort.setNum(proxyServerPort);
-    
-     QString proxyArgUrl = proxyServerUrl;
+  // First, get some variables to figure out the full patch URL
+  QFile file( "/Programs/" + progName + PBIProgVer[currentWorkingPBI] + "/PBI.UpdateURL.sh" );
+  if ( file.open( IO_ReadOnly ) ) {
+      QTextStream stream( &file );
+      while ( !stream.atEnd() ) {
+          line = stream.readLine(); // line of text excluding '\n'
+          if ( line.find("PBIUpdateURL=\"" ) == 0)
+          {
+              line.replace("PBIUpdateURL=\"", "");
+              line.truncate(line.indexOf("\""));
+              PBIUrl = line;
+              //QMessageBox::critical( 0, tr("Online Update"), PBIUrl, QMessageBox::Ok );
+          }
 
-     // Check if we need to remove a http://
-     if ( proxyServerUrl.indexOf("http://") == 0 )
-     {
-        proxyArgUrl.remove(0, 7);
-     }
+       }
+      file.close();
+   } 
 
-     checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort );
+   if ( PBIUrl.isEmpty() )
+   {
+     // No PBI update file for this program, jump to next program
+     QTimer::singleShot(1000, this, SLOT(slotPBICheckUpdate() ) );
+     return;
+   }
 
-  } else {
-     checkPBIProc->addArgument( "DISABLE" );
-  }
 
+   QString command = "pbreg get /PC-BSD/Version";
+   Version = getLineFromCommandOutput(command);
 
-  connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) );
-  connect( checkPBIProc, SIGNAL(processExited()), this, SLOT(slotPBICheckUpdate() ) );
-  if ( !checkPBIProc->start() ) {
+   command = "uname -p";
+   Arch = getLineFromCommandOutput(command);
+   if ( Arch.indexOf("i386") != -1 )
+   {
+      Arch = "i386";
+   }
+   if ( Arch.indexOf("amd64") != -1 )
+   {
+      Arch = "amd64";
+   }
 
-  }
+  QString postData = "PBIName=" + progName + "&PBIVer=" + PBIProgVer[currentWorkingPBI] + "&PCBSDVER=" + Version + "&OSARCH=" + Arch;
+  
+  checkPBIJob = KIO::http_post( PBIUrl, postData.utf8(), KIO::HideProgressInfo);
+  checkPBIJob->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded" );
 
 
+  connect(checkPBIJob, SIGNAL(result(KJob *)), this, SLOT(slotPBICheckUpdate() ) );
+  connect(checkPBIJob, SIGNAL(data(KIO::Job *, const QByteArray&)), this, SLOT(slotRecieveData(KIO::Job *, const QByteArray& ) ) );
+
 }
 
+void UpdaterTray::slotRecieveData(KIO::Job*, const QByteArray& data)
+{
+    QString output(data), line;
+    QStringList outputList;
+    if ( output.indexOf("Up2Date") == -1  && ! output.isEmpty())
+    {
+        outputList = QStringList::split("\n", output);
+        for ( int i = 0; i < outputList.size(); i++)
+        {
+            line = outputList.at(i);
+           
+             if (line.find("NewVer:" ) ==  0 )
+             {
+               PBIProgNewVer[currentWorkingPBI] = line.replace("NewVer: ", "");
+             }
+             if ( line.find("Mirror1:") == 0)
+             {
+              PBIProgURL1[currentWorkingPBI] = line.replace("Mirror1: ", "");
+             }
+             // Check for our other file locations
+             if ( line.find("Mirror2:") == 0)
+             {
+               PBIProgURL2[currentWorkingPBI] = line.replace("Mirror2: ", "");
+             }
+             if ( line.find("Mirror3:") == 0)
+             {
+                 PBIProgURL3[currentWorkingPBI] = line.replace("Mirror3: ", "");
+             }
+             if ( line.find("FileLoc:") == 0)
+             {
+                 PBIProgLoc[currentWorkingPBI] = line.replace("FileLoc: ", "");
+             }
+             if ( line.find("MD5:") == 0)
+             {
+                 PBIProgMD5[currentWorkingPBI] = line.replace("MD5: ", "");
+             } 
+        } // End of For loop reading line-by-line our data
 
+        // Check to ensure we have found all our variables
+        if ( ! PBIProgNewVer[currentWorkingPBI].isEmpty() && ! PBIProgURL1[currentWorkingPBI].isEmpty() && ! PBIProgURL2[currentWorkingPBI].isEmpty() && ! PBIProgURL3[currentWorkingPBI].isEmpty() && ! PBIProgLoc[currentWorkingPBI].isEmpty() && ! PBIProgMD5[currentWorkingPBI].isEmpty() )
+        {
+              // We have valid data! Set the flag that this PBI is in need of an update
+              PBIProgUpdate[currentWorkingPBI] = 1;
+        }
+    } // End of IF statement to find if this string has update data
+}
 
 
+
 // Read the results to see if this PBI needs an Update
 void UpdaterTray::slotReadPBIStatusResults()
 {
@@ -1962,6 +2041,9 @@
        status=tr("Downloading...");
        URL = PBIProgURL1[currentWorkingPBI];
    }
+
+   // Append the PBI location to our mirror URL now
+   URL = URL + PBIProgLoc[currentWorkingPBI];
    
    id.setNum(currentWorkingPBI);
    UpdaterStatusDialog->updateStatusListBoxItem(status, id);
@@ -1983,7 +2065,7 @@
       tmpfile.remove();
     }
 
-    copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
+    copyJob = KIO::file_copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", -1, KIO::HideProgressInfo | KIO::Overwrite);
     
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
@@ -2232,4 +2314,5 @@
    QString command;
    command = "su " + username + " -c 'kcmshell4 proxy' &";
    system(command); 
+   QMessageBox::information( 0, tr("Proxy Configuration!"), tr("You will need to restart the system updater for any proxy changes to take effect!"), QMessageBox::Ok );
 }

Modified: pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h
===================================================================
--- pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h	2008-10-29 19:55:33 UTC (rev 2941)
@@ -1,7 +1,6 @@
 
 #include <qpair.h>
 #include <qstring.h>
-
 #include <ksystemtrayicon.h>
 #include <kio/jobclasses.h>
 
@@ -54,6 +53,7 @@
    void slotChangeRunStartup();
    void slotTrayActivated(QSystemTrayIcon::ActivationReason reason);
    void slotLaunchKDEProxyConfig();
+   void slotRecieveData(KIO::Job*, const QByteArray& data);
    
 protected:
    
@@ -63,11 +63,11 @@
    void loadUpdaterPrefs();
    void loadPatchData(QString patchFile, int patchNum);
    KJob *copyJob;
+   KJob *sysFetchJob;
+   KIO::TransferJob *checkPBIJob;
+   QString sysPatchsetTmpFile;
    bool useCustomTmpDir;
    QString customTmpDir;
-   bool useProxyServer;
-   QString proxyServerUrl;
-   int proxyServerPort;
    QString patchTmpDir;
 };
 

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.cpp
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.cpp	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.cpp	2008-10-29 19:55:33 UTC (rev 2941)
@@ -44,14 +44,11 @@
     
     // 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() ) );
     
 }
 
@@ -449,21 +446,6 @@
     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();
@@ -475,23 +457,6 @@
    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() )
@@ -506,18 +471,6 @@
     slotConfigChanged();
 }
 
-void systemUpdater::slotProxyClicked()
-{
-    if ( checkProxy->isChecked() )
-    {
-        groupProxySettings->setEnabled(true);
-    } else {
-        groupProxySettings->setEnabled(false);
-    }
-
-    slotConfigChanged();
-}
-
 void systemUpdater::slotSelectCustomTmp()
 {
 

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.h
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.h	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.h	2008-10-29 19:55:33 UTC (rev 2941)
@@ -55,20 +55,14 @@
     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();
 

Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.ui
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.ui	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.ui	2008-10-29 19:55:33 UTC (rev 2941)
@@ -662,53 +662,6 @@
         </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" >
@@ -726,7 +679,7 @@
          <item>
           <widget class="QPushButton" name="pushConfigProxy" >
            <property name="text" >
-            <string>Configure Download Proxy</string>
+            <string>Configure Proxy Settings</string>
            </property>
           </widget>
          </item>
@@ -745,7 +698,7 @@
          </item>
         </layout>
        </item>
-       <item row="7" column="0" >
+       <item row="5" column="0" >
         <spacer name="spacer8" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
@@ -761,7 +714,7 @@
          </property>
         </spacer>
        </item>
-       <item row="8" column="0" >
+       <item row="6" 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-28 15:25:53 UTC (rev 2940)
+++ pcbsd/trunk/SystemUpdater/UpdaterTray.cpp	2008-10-29 19:55:33 UTC (rev 2941)
@@ -107,6 +107,7 @@
 QString PBIProgURL2[900];
 QString PBIProgURL3[900];
 QString PBIProgMD5[900];
+QString PBIProgLoc[900];
 int     PBIProgUpdate[900];
 int     PBIProgFailed[900];
 
@@ -158,28 +159,25 @@
   // 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");
-  setIcon(Icon);
-
   // Setup our Context Menu
-  contextMenu()->clear();
-  //contextMenu()->insertTitle(PixmapIcon, tr("PC-BSD Update Manager"), 1);
   contextMenu()->insertSeparator();
   contextMenu()->insertItem( tr("Start the Update Manager"), this, SLOT(slotOpenUpdateManager()), 0, 5);
   contextMenu()->insertItem( tr("Run at startup"), this, SLOT(slotChangeRunStartup()), 0, 6);
   contextMenu()->setItemChecked ( 6, TRUE );
-  //contextMenu()->insertItem( tr("Checking for System Updates..."), this, SLOT(slotStartUpdateCheckManual(), 0, 6);
+  
+  // Set the tray icon that we are checking for updates
+  QIcon Icon;
+  Icon.addFile("/PCBSD/SystemUpdater/images/working.png");
+  setIcon(Icon);
 
   // Load the program preferences
   loadUpdaterPrefs();
 
   // Start the monitor service for system updates
-  slotScheduledSystemCheck();
+  QTimer::singleShot(1000, this, SLOT(slotScheduledSystemCheck()));
 
   // Start the monitor service for PBI updates
-  slotScheduledPBICheck();
+  QTimer::singleShot(1000, this, SLOT(slotScheduledPBICheck()));
   
 }
 
@@ -215,7 +213,12 @@
 
 
 
-void UpdaterTray::slotStartUpdateCheck() {
+void UpdaterTray::slotStartUpdateCheck()
+{
+  QString SysUrl;
+  QString PatchSet;
+  QString Version;
+  QString Arch, line;
 
   // Check if the system is doing updates right now, if it is, ignore the request
   if ( programstatus == SYSTEM_UPDATING || programstatus == SYSTEM_CHECKING4UPDATES) {
@@ -243,38 +246,58 @@
   // Create the tooltip popup now
   displayTooltip();
 
-  // Run the getUpdatesDir.sh script to rsync with master server
-  getUpdatesDir = new Q3Process( this );
-  getUpdatesDir->addArgument( "sh");
-  getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh");
-  if ( useProxyServer )
-  {
-     QString proxyArgPort;
-     proxyArgPort.setNum(proxyServerPort);
+  // Run our KIO Job to fetch the system-update patch data for this version of PC-BSD
 
-     QString proxyArgUrl = proxyServerUrl;
+  // First, get some variables to figure out the full patch URL
+  QFile file( "/PCBSD/SystemUpdater/conf/sysupdate.conf" );
+  if ( file.open( IO_ReadOnly ) ) {
+      QTextStream stream( &file );
+      while ( !stream.atEnd() ) {
+          line = stream.readLine(); // line of text excluding '\n'
+          if ( line.find("UPDATESERVER: " ) == 0)
+          {
+              line.replace("UPDATESERVER: ", "");
+              SysUrl = line; 
+          }
+          
+          if ( line.find("PATCHSET: " ) == 0)
+          {
+              line.replace("PATCHSET: ", "");
+              PatchSet = line; 
+          }
+       }
+      file.close();
+   } 
 
-     // Check if we need to remove a http://
-     if ( proxyServerUrl.indexOf("http://") == 0 )
-     {
-        proxyArgUrl.remove(0, 7);
-     }
+   QString command = "pbreg get /PC-BSD/Version";
+   Version = getLineFromCommandOutput(command);
 
-     getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort );
+   command = "uname -p";
+   Arch = getLineFromCommandOutput(command);
+   if ( Arch.indexOf("i386") != -1 )
+   {
+      Arch = "i386";
+   }
+   if ( Arch.indexOf("amd64") != -1 )
+   {
+      Arch = "amd64";
+   }
 
-  } else {
-     getUpdatesDir->addArgument( "DISABLE" );
-  }
+   if ( SysUrl.isEmpty() || PatchSet.isEmpty() || Version.isEmpty() || Arch.isEmpty() )
+   {
+        // Bad patch file?
+        QMessageBox::information( 0, tr("Error!"), tr("Error parsing sysupdate.conf!!!"), QMessageBox::Ok );
+        return;
+   }
 
-  // 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( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );
-  }
+  QString patchfile = "patch-" + PatchSet + "-" + Version + "-" + Arch + ".tgz";
+  sysPatchsetTmpFile = "/PCBSD/tmp/" + patchfile;
+  QString patchurl = SysUrl + "/" + patchfile;
 
-
-
+  // Start our KIO copy now
+  sysFetchJob = KIO::file_copy( patchurl, sysPatchsetTmpFile, -1, KIO::HideProgressInfo | KIO::Overwrite);
+  connect(sysFetchJob, SIGNAL(result(KJob *)), this, SLOT(slotSysUpdateCheckFinished() ) );
+  
 }
 
 
@@ -284,17 +307,33 @@
 
 
 void UpdaterTray::slotSysUpdateCheckFinished() {
-  // Check to see if the update download was successful and warn if not
-  if ( getUpdatesDir->exitStatus() != 0 )
-  {
-	QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under 'configure'"), QMessageBox::Ok );
-  } 
 
+  QString command = "pbreg get /PC-BSD/Version";
+  QString Version = getLineFromCommandOutput(command);
+
    // Now traverse the directory, see if we have updates.
   readSysUpdates = new Q3Process( this );
   readSysUpdates->addArgument( "sh");
   readSysUpdates->addArgument( "/PCBSD/SystemUpdater/bin/readSysUpdates.sh");
+  readSysUpdates->addArgument( Version );
 
+  // Check to see if the update download was successful and warn if not
+  if ( sysFetchJob->error() != 0 )
+  {
+        // Check if we should show the updater dialog or not
+        if (! SystemUpdaterDialog->isShown() )
+        {
+           SystemUpdaterDialog->show();
+	   QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under Configuration"), QMessageBox::Ok );
+           SystemUpdaterDialog->hide();
+        } else {
+	   QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under Configuration"), QMessageBox::Ok );
+        }
+  } else {
+     // Add the patchdata URL
+     readSysUpdates->addArgument(sysPatchsetTmpFile);
+  } 
+
   // Connect the exited signal and start the process
   connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) );
   if ( ! readSysUpdates->start() ) {
@@ -624,8 +663,8 @@
 
    //QToolTip::clear();
    // Update the tooltop
-   QToolTip::remove(this->contextMenu());
-   QToolTip::add(this->contextMenu(), tooltipStr);
+   QToolTip::remove(contextMenu());
+   QToolTip::add(contextMenu(), tooltipStr);
 
 }
 
@@ -684,21 +723,10 @@
   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;
   
   // Disable updating the conf file until we are done loading it
@@ -725,21 +753,6 @@
   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);
 
 }
@@ -1144,7 +1157,7 @@
     }
 
 
-    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
+    copyJob = KIO::file_copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", -1, KIO::HideProgressInfo | KIO::Overwrite);
     
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
@@ -1616,13 +1629,15 @@
 // Start checking our list of PBIs which may be updatable
 void UpdaterTray::slotPBICheckUpdate()
 {
-   
 
+    QString tmp, line;
+    QString progName, Arch, Version, PBIUrl;
+
+
+    // Jump to the next PBI in our list
     currentWorkingPBI++;
-    QString tmp;
-    QString progName;
 
-
+    // Check if we are done with checking for updates
     if ( PBIProgName[currentWorkingPBI].isEmpty() )
     {
         // Go ahead and finish up the PBI update check now
@@ -1643,43 +1658,107 @@
   progName = tmp;
 
 
-  checkPBIProc = new Q3Process( this );
-  checkPBIProc->addArgument( "/PCBSD/SystemUpdater/bin/getPBIUpdateStatus.sh" );
-  checkPBIProc->addArgument( progName );
-  checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI]  );
 
-  if ( useProxyServer )
-  {
-     QString proxyArgPort;
-     proxyArgPort.setNum(proxyServerPort);
-    
-     QString proxyArgUrl = proxyServerUrl;
+  // First, get some variables to figure out the full patch URL
+  QFile file( "/Programs/" + progName + PBIProgVer[currentWorkingPBI] + "/PBI.UpdateURL.sh" );
+  if ( file.open( IO_ReadOnly ) ) {
+      QTextStream stream( &file );
+      while ( !stream.atEnd() ) {
+          line = stream.readLine(); // line of text excluding '\n'
+          if ( line.find("PBIUpdateURL=\"" ) == 0)
+          {
+              line.replace("PBIUpdateURL=\"", "");
+              line.truncate(line.indexOf("\""));
+              PBIUrl = line;
+              //QMessageBox::critical( 0, tr("Online Update"), PBIUrl, QMessageBox::Ok );
+          }
 
-     // Check if we need to remove a http://
-     if ( proxyServerUrl.indexOf("http://") == 0 )
-     {
-        proxyArgUrl.remove(0, 7);
-     }
+       }
+      file.close();
+   } 
 
-     checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort );
+   if ( PBIUrl.isEmpty() )
+   {
+     // No PBI update file for this program, jump to next program
+     QTimer::singleShot(1000, this, SLOT(slotPBICheckUpdate() ) );
+     return;
+   }
 
-  } else {
-     checkPBIProc->addArgument( "DISABLE" );
-  }
 
+   QString command = "pbreg get /PC-BSD/Version";
+   Version = getLineFromCommandOutput(command);
 
-  connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) );
-  connect( checkPBIProc, SIGNAL(processExited()), this, SLOT(slotPBICheckUpdate() ) );
-  if ( !checkPBIProc->start() ) {
+   command = "uname -p";
+   Arch = getLineFromCommandOutput(command);
+   if ( Arch.indexOf("i386") != -1 )
+   {
+      Arch = "i386";
+   }
+   if ( Arch.indexOf("amd64") != -1 )
+   {
+      Arch = "amd64";
+   }
 
-  }
+  QString postData = "PBIName=" + progName + "&PBIVer=" + PBIProgVer[currentWorkingPBI] + "&PCBSDVER=" + Version + "&OSARCH=" + Arch;
+  
+  checkPBIJob = KIO::http_post( PBIUrl, postData.utf8(), KIO::HideProgressInfo);
+  checkPBIJob->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded" );
 
 
+  connect(checkPBIJob, SIGNAL(result(KJob *)), this, SLOT(slotPBICheckUpdate() ) );
+  connect(checkPBIJob, SIGNAL(data(KIO::Job *, const QByteArray&)), this, SLOT(slotRecieveData(KIO::Job *, const QByteArray& ) ) );
+
 }
 
+void UpdaterTray::slotRecieveData(KIO::Job*, const QByteArray& data)
+{
+    QString output(data), line;
+    QStringList outputList;
+    if ( output.indexOf("Up2Date") == -1  && ! output.isEmpty())
+    {
+        outputList = QStringList::split("\n", output);
+        for ( int i = 0; i < outputList.size(); i++)
+        {
+            line = outputList.at(i);
+           
+             if (line.find("NewVer:" ) ==  0 )
+             {
+               PBIProgNewVer[currentWorkingPBI] = line.replace("NewVer: ", "");
+             }
+             if ( line.find("Mirror1:") == 0)
+             {
+              PBIProgURL1[currentWorkingPBI] = line.replace("Mirror1: ", "");
+             }
+             // Check for our other file locations
+             if ( line.find("Mirror2:") == 0)
+             {
+               PBIProgURL2[currentWorkingPBI] = line.replace("Mirror2: ", "");
+             }
+             if ( line.find("Mirror3:") == 0)
+             {
+                 PBIProgURL3[currentWorkingPBI] = line.replace("Mirror3: ", "");
+             }
+             if ( line.find("FileLoc:") == 0)
+             {
+                 PBIProgLoc[currentWorkingPBI] = line.replace("FileLoc: ", "");
+             }
+             if ( line.find("MD5:") == 0)
+             {
+                 PBIProgMD5[currentWorkingPBI] = line.replace("MD5: ", "");
+             } 
+        } // End of For loop reading line-by-line our data
 
+        // Check to ensure we have found all our variables
+        if ( ! PBIProgNewVer[currentWorkingPBI].isEmpty() && ! PBIProgURL1[currentWorkingPBI].isEmpty() && ! PBIProgURL2[currentWorkingPBI].isEmpty() && ! PBIProgURL3[currentWorkingPBI].isEmpty() && ! PBIProgLoc[currentWorkingPBI].isEmpty() && ! PBIProgMD5[currentWorkingPBI].isEmpty() )
+        {
+              // We have valid data! Set the flag that this PBI is in need of an update
+              PBIProgUpdate[currentWorkingPBI] = 1;
+        }
+    } // End of IF statement to find if this string has update data
+}
 
 
+
 // Read the results to see if this PBI needs an Update
 void UpdaterTray::slotReadPBIStatusResults()
 {
@@ -1962,6 +2041,9 @@
        status=tr("Downloading...");
        URL = PBIProgURL1[currentWorkingPBI];
    }
+
+   // Append the PBI location to our mirror URL now
+   URL = URL + PBIProgLoc[currentWorkingPBI];
    
    id.setNum(currentWorkingPBI);
    UpdaterStatusDialog->updateStatusListBoxItem(status, id);
@@ -1983,7 +2065,7 @@
       tmpfile.remove();
     }
 
-    copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
+    copyJob = KIO::file_copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", -1, KIO::HideProgressInfo | KIO::Overwrite);
     
     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
     connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
@@ -2232,4 +2314,5 @@
    QString command;
    command = "su " + username + " -c 'kcmshell4 proxy' &";
    system(command); 
+   QMessageBox::information( 0, tr("Proxy Configuration!"), tr("You will need to restart the system updater for any proxy changes to take effect!"), QMessageBox::Ok );
 }

Modified: pcbsd/trunk/SystemUpdater/UpdaterTray.h
===================================================================
--- pcbsd/trunk/SystemUpdater/UpdaterTray.h	2008-10-28 15:25:53 UTC (rev 2940)
+++ pcbsd/trunk/SystemUpdater/UpdaterTray.h	2008-10-29 19:55:33 UTC (rev 2941)
@@ -1,7 +1,6 @@
 
 #include <qpair.h>
 #include <qstring.h>
-
 #include <ksystemtrayicon.h>
 #include <kio/jobclasses.h>
 
@@ -54,6 +53,7 @@
    void slotChangeRunStartup();
    void slotTrayActivated(QSystemTrayIcon::ActivationReason reason);
    void slotLaunchKDEProxyConfig();
+   void slotRecieveData(KIO::Job*, const QByteArray& data);
    
 protected:
    
@@ -63,11 +63,11 @@
    void loadUpdaterPrefs();
    void loadPatchData(QString patchFile, int patchNum);
    KJob *copyJob;
+   KJob *sysFetchJob;
+   KIO::TransferJob *checkPBIJob;
+   QString sysPatchsetTmpFile;
    bool useCustomTmpDir;
    QString customTmpDir;
-   bool useProxyServer;
-   QString proxyServerUrl;
-   int proxyServerPort;
    QString patchTmpDir;
 };
 



More information about the Commits mailing list