Changeset 2941

Show
Ignore:
Timestamp:
10/29/08 12:55:33 (17 months ago)
Author:
kris
Message:

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

Location:
pcbsd
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp

    r2940 r2941  
    4545    // Connect the Custom Tmpdir Checkbox 
    4646    connect( checkTMPDIR, SIGNAL( clicked() ), this, SLOT( slotCustomTmpClicked() ) ); 
    47     connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyClicked() ) ); 
    4847    connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) ); 
    4948    connect( pushConfigProxy, SIGNAL( clicked() ), this, SLOT( slotConfigKDEProxy() ) ); 
     
    5150    // Connect slots to emit signal when settings change 
    5251    connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 
    53     connect( lineProxyServer, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 
    54     connect( spinProxyPort, SIGNAL( valueChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 
    5552     
    5653} 
     
    450447} 
    451448 
    452 // Set Proxy Usage 
    453 void systemUpdater::setUseProxy( bool enabled ) 
    454 { 
    455     checkProxy->setChecked(enabled); 
    456     groupProxySettings->setEnabled(enabled); 
    457 } 
    458  
    459 // Set the Proxy being used 
    460 void systemUpdater::setUseProxySettings( QString proxyURL, int portnum ) 
    461 { 
    462     lineProxyServer->setText(proxyURL); 
    463     spinProxyPort->setValue(portnum); 
    464 } 
    465  
    466  
    467449bool systemUpdater::getCustomTmpEnabled() 
    468450{ 
     
    475457   return lineTMPDIR->text(); 
    476458} 
    477  
    478 bool systemUpdater::getProxyEnabled() 
    479 { 
    480    return checkProxy->isChecked(); 
    481 } 
    482  
    483  
    484 QString systemUpdater::getProxyUrl() 
    485 { 
    486    return lineProxyServer->text(); 
    487 } 
    488  
    489 int systemUpdater::getProxyPort() 
    490 { 
    491   return spinProxyPort->value(); 
    492 } 
    493  
    494459 
    495460void systemUpdater::slotCustomTmpClicked() 
     
    502467        lineTMPDIR->setEnabled(false);  
    503468        pushTMPDIR->setEnabled(false);  
    504     } 
    505  
    506     slotConfigChanged(); 
    507 } 
    508  
    509 void systemUpdater::slotProxyClicked() 
    510 { 
    511     if ( checkProxy->isChecked() ) 
    512     { 
    513         groupProxySettings->setEnabled(true); 
    514     } else { 
    515         groupProxySettings->setEnabled(false); 
    516469    } 
    517470 
  • pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h

    r2940 r2941  
    5656    void setUseCustomTmp( bool enabled ); 
    5757    void setUseCustomDirName( QString tmpdir ); 
    58     void setUseProxy( bool enabled ); 
    59     void setUseProxySettings( QString proxyURL, int portnum ); 
    6058    bool getStartupConfig(); 
    6159    bool getCustomTmpEnabled(); 
    6260    QString getCustomTmpDir(); 
    63     bool getProxyEnabled(); 
    64     QString getProxyUrl(); 
    65     int getProxyPort(); 
    6661    void slotRescanPBIUpdatesClicked(); 
    6762    void slotDisableConfUpdates(bool status); 
     
    6964private slots: 
    7065    void slotCustomTmpClicked(); 
    71     void slotProxyClicked(); 
    7266    void slotSelectCustomTmp(); 
    7367    void slotConfigKDEProxy(); 
  • pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui

    r2940 r2941  
    663663       </item> 
    664664       <item row="4" column="0" > 
    665         <widget class="QCheckBox" name="checkProxy" > 
    666          <property name="text" > 
    667           <string>Specify proxy for update check</string> 
    668          </property> 
    669         </widget> 
    670        </item> 
    671        <item row="5" column="0" > 
    672         <widget class="QGroupBox" name="groupProxySettings" > 
    673          <property name="title" > 
    674           <string>Proxy Settings</string> 
    675          </property> 
    676          <layout class="QGridLayout" name="gridLayout" > 
    677           <item row="0" column="0" > 
    678            <layout class="QHBoxLayout" name="horizontalLayout_2" > 
    679             <item> 
    680              <widget class="QLabel" name="label" > 
    681               <property name="text" > 
    682                <string>Proxy Server</string> 
    683               </property> 
    684              </widget> 
    685             </item> 
    686             <item> 
    687              <widget class="QLineEdit" name="lineProxyServer" /> 
    688             </item> 
    689             <item> 
    690              <widget class="QLabel" name="label_2" > 
    691               <property name="text" > 
    692                <string>Port</string> 
    693               </property> 
    694              </widget> 
    695             </item> 
    696             <item> 
    697              <widget class="QSpinBox" name="spinProxyPort" > 
    698               <property name="maximum" > 
    699                <number>9999</number> 
    700               </property> 
    701               <property name="value" > 
    702                <number>8080</number> 
    703               </property> 
    704              </widget> 
    705             </item> 
    706            </layout> 
    707           </item> 
    708          </layout> 
    709         </widget> 
    710        </item> 
    711        <item row="6" column="0" > 
    712665        <layout class="QHBoxLayout" name="horizontalLayout_3" > 
    713666         <item> 
     
    727680          <widget class="QPushButton" name="pushConfigProxy" > 
    728681           <property name="text" > 
    729             <string>Configure Download Proxy</string> 
     682            <string>Configure Proxy Settings</string> 
    730683           </property> 
    731684          </widget> 
     
    746699        </layout> 
    747700       </item> 
    748        <item row="7" column="0" > 
     701       <item row="5" column="0" > 
    749702        <spacer name="spacer8" > 
    750703         <property name="orientation" > 
     
    762715        </spacer> 
    763716       </item> 
    764        <item row="8" column="0" > 
     717       <item row="6" column="0" > 
    765718        <spacer name="spacer9" > 
    766719         <property name="orientation" > 
  • pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp

    r2940 r2941  
    108108QString PBIProgURL3[900]; 
    109109QString PBIProgMD5[900]; 
     110QString PBIProgLoc[900]; 
    110111int     PBIProgUpdate[900]; 
    111112int     PBIProgFailed[900]; 
     
    159160  username = getlogin(); 
    160161 
     162  // Setup our Context Menu 
     163  contextMenu()->insertSeparator(); 
     164  contextMenu()->insertItem( tr("Start the Update Manager"), this, SLOT(slotOpenUpdateManager()), 0, 5); 
     165  contextMenu()->insertItem( tr("Run at startup"), this, SLOT(slotChangeRunStartup()), 0, 6); 
     166  contextMenu()->setItemChecked ( 6, TRUE ); 
     167   
    161168  // Set the tray icon that we are checking for updates 
    162169  QIcon Icon; 
     
    164171  setIcon(Icon); 
    165172 
    166   // Setup our Context Menu 
    167   contextMenu()->clear(); 
    168   //contextMenu()->insertTitle(PixmapIcon, tr("PC-BSD Update Manager"), 1); 
    169   contextMenu()->insertSeparator(); 
    170   contextMenu()->insertItem( tr("Start the Update Manager"), this, SLOT(slotOpenUpdateManager()), 0, 5); 
    171   contextMenu()->insertItem( tr("Run at startup"), this, SLOT(slotChangeRunStartup()), 0, 6); 
    172   contextMenu()->setItemChecked ( 6, TRUE ); 
    173   //contextMenu()->insertItem( tr("Checking for System Updates..."), this, SLOT(slotStartUpdateCheckManual(), 0, 6); 
    174  
    175173  // Load the program preferences 
    176174  loadUpdaterPrefs(); 
    177175 
    178176  // Start the monitor service for system updates 
    179   slotScheduledSystemCheck(); 
     177  QTimer::singleShot(1000, this, SLOT(slotScheduledSystemCheck())); 
    180178 
    181179  // Start the monitor service for PBI updates 
    182   slotScheduledPBICheck(); 
     180  QTimer::singleShot(1000, this, SLOT(slotScheduledPBICheck())); 
    183181   
    184182} 
     
    216214 
    217215 
    218 void UpdaterTray::slotStartUpdateCheck() { 
     216void UpdaterTray::slotStartUpdateCheck() 
     217{ 
     218  QString SysUrl; 
     219  QString PatchSet; 
     220  QString Version; 
     221  QString Arch, line; 
    219222 
    220223  // Check if the system is doing updates right now, if it is, ignore the request 
     
    244247  displayTooltip(); 
    245248 
    246   // Run the getUpdatesDir.sh script to rsync with master server 
    247   getUpdatesDir = new Q3Process( this ); 
    248   getUpdatesDir->addArgument( "sh"); 
    249   getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh"); 
    250   if ( useProxyServer ) 
    251   { 
    252      QString proxyArgPort; 
    253      proxyArgPort.setNum(proxyServerPort); 
    254  
    255      QString proxyArgUrl = proxyServerUrl; 
    256  
    257      // Check if we need to remove a http:// 
    258      if ( proxyServerUrl.indexOf("http://") == 0 ) 
    259      { 
    260         proxyArgUrl.remove(0, 7); 
    261      } 
    262  
    263      getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort ); 
    264  
    265   } else { 
    266      getUpdatesDir->addArgument( "DISABLE" ); 
    267   } 
    268  
    269   // Connect the exited signal and start the process 
    270   connect( getUpdatesDir, SIGNAL(processExited()), this, SLOT(slotSysUpdateCheckFinished() ) ); 
    271   //connect( SetupScript, SIGNAL(readyReadStdout()), this, SLOT(readyReadScriptOutput2() ) ); 
    272   if ( ! getUpdatesDir->start() ) { 
    273         QMessageBox::information( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok ); 
    274   } 
    275  
    276  
    277  
     249  // Run our KIO Job to fetch the system-update patch data for this version of PC-BSD 
     250 
     251  // First, get some variables to figure out the full patch URL 
     252  QFile file( "/PCBSD/SystemUpdater/conf/sysupdate.conf" ); 
     253  if ( file.open( IO_ReadOnly ) ) { 
     254      QTextStream stream( &file ); 
     255      while ( !stream.atEnd() ) { 
     256          line = stream.readLine(); // line of text excluding '\n' 
     257          if ( line.find("UPDATESERVER: " ) == 0) 
     258          { 
     259              line.replace("UPDATESERVER: ", ""); 
     260              SysUrl = line;  
     261          } 
     262           
     263          if ( line.find("PATCHSET: " ) == 0) 
     264          { 
     265              line.replace("PATCHSET: ", ""); 
     266              PatchSet = line;  
     267          } 
     268       } 
     269      file.close(); 
     270   }  
     271 
     272   QString command = "pbreg get /PC-BSD/Version"; 
     273   Version = getLineFromCommandOutput(command); 
     274 
     275   command = "uname -p"; 
     276   Arch = getLineFromCommandOutput(command); 
     277   if ( Arch.indexOf("i386") != -1 ) 
     278   { 
     279      Arch = "i386"; 
     280   } 
     281   if ( Arch.indexOf("amd64") != -1 ) 
     282   { 
     283      Arch = "amd64"; 
     284   } 
     285 
     286   if ( SysUrl.isEmpty() || PatchSet.isEmpty() || Version.isEmpty() || Arch.isEmpty() ) 
     287   { 
     288        // Bad patch file? 
     289        QMessageBox::information( 0, tr("Error!"), tr("Error parsing sysupdate.conf!!!"), QMessageBox::Ok ); 
     290        return; 
     291   } 
     292 
     293  QString patchfile = "patch-" + PatchSet + "-" + Version + "-" + Arch + ".tgz"; 
     294  sysPatchsetTmpFile = "/PCBSD/tmp/" + patchfile; 
     295  QString patchurl = SysUrl + "/" + patchfile; 
     296 
     297  // Start our KIO copy now 
     298  sysFetchJob = KIO::file_copy( patchurl, sysPatchsetTmpFile, -1, KIO::HideProgressInfo | KIO::Overwrite); 
     299  connect(sysFetchJob, SIGNAL(result(KJob *)), this, SLOT(slotSysUpdateCheckFinished() ) ); 
     300   
    278301} 
    279302 
     
    285308 
    286309void UpdaterTray::slotSysUpdateCheckFinished() { 
    287   // Check to see if the update download was successful and warn if not 
    288   if ( getUpdatesDir->exitStatus() != 0 ) 
    289   { 
    290         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 ); 
    291   }  
     310 
     311  QString command = "pbreg get /PC-BSD/Version"; 
     312  QString Version = getLineFromCommandOutput(command); 
    292313 
    293314   // Now traverse the directory, see if we have updates. 
     
    295316  readSysUpdates->addArgument( "sh"); 
    296317  readSysUpdates->addArgument( "/PCBSD/SystemUpdater/bin/readSysUpdates.sh"); 
     318  readSysUpdates->addArgument( Version ); 
     319 
     320  // Check to see if the update download was successful and warn if not 
     321  if ( sysFetchJob->error() != 0 ) 
     322  { 
     323        // Check if we should show the updater dialog or not 
     324        if (! SystemUpdaterDialog->isShown() ) 
     325        { 
     326           SystemUpdaterDialog->show(); 
     327           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 ); 
     328           SystemUpdaterDialog->hide(); 
     329        } else { 
     330           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 ); 
     331        } 
     332  } else { 
     333     // Add the patchdata URL 
     334     readSysUpdates->addArgument(sysPatchsetTmpFile); 
     335  }  
    297336 
    298337  // Connect the exited signal and start the process 
     
    625664   //QToolTip::clear(); 
    626665   // Update the tooltop 
    627    QToolTip::remove(this->contextMenu()); 
    628    QToolTip::add(this->contextMenu(), tooltipStr); 
     666   QToolTip::remove(contextMenu()); 
     667   QToolTip::add(contextMenu(), tooltipStr); 
    629668 
    630669} 
     
    685724  settings.writeEntry( "/PC-BSD/SystemUpdater/customTmpDir", customTmpDir ); 
    686725 
    687   useProxyServer = SystemUpdaterDialog->getProxyEnabled(); 
    688   settings.setValue( "/PC-BSD/SystemUpdater/useProxyServer", useProxyServer ); 
    689   
    690   proxyServerUrl = SystemUpdaterDialog->getProxyUrl(); 
    691   settings.setValue( "/PC-BSD/SystemUpdater/proxyServerUrl", proxyServerUrl ); 
    692  
    693   proxyServerPort = SystemUpdaterDialog->getProxyPort(); 
    694   settings.setValue( "/PC-BSD/SystemUpdater/proxyServerPort", proxyServerPort ); 
    695  
    696  
    697726} 
    698727 
    699728void UpdaterTray::loadUpdaterPrefs() { 
    700729  // Load the user preferences for the System Updater 
    701   bool ok; 
    702730  QSettings settings; 
    703731   
     
    726754  SystemUpdaterDialog->setUseCustomDirName( customTmpDir ); 
    727755   
    728   // Load if the user wants to use a proxy server 
    729   useProxyServer = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useProxyServer", false ); 
    730   SystemUpdaterDialog->setUseProxy( useProxyServer ); 
    731    
    732   // Load Proxy Server Settings 
    733   proxyServerUrl = settings.value( "/PC-BSD/SystemUpdater/proxyServerUrl" ).toString(); 
    734  
    735   settings.value("/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 
    736   if ( ok ) { 
    737      proxyServerPort = settings.value( "/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 
    738   } else { 
    739      proxyServerPort = 8080; 
    740   } 
    741   SystemUpdaterDialog->setUseProxySettings( proxyServerUrl, proxyServerPort ); 
    742  
    743756  SystemUpdaterDialog->slotDisableConfUpdates(false); 
    744757 
     
    11451158 
    11461159 
    1147     copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo); 
     1160    copyJob = KIO::file_copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", -1, KIO::HideProgressInfo | KIO::Overwrite); 
    11481161     
    11491162    connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); 
     
    16171630void UpdaterTray::slotPBICheckUpdate() 
    16181631{ 
    1619     
    1620  
     1632 
     1633    QString tmp, line; 
     1634    QString progName, Arch, Version, PBIUrl; 
     1635 
     1636 
     1637    // Jump to the next PBI in our list 
    16211638    currentWorkingPBI++; 
    1622     QString tmp; 
    1623     QString progName; 
    1624  
    1625  
     1639 
     1640    // Check if we are done with checking for updates 
    16261641    if ( PBIProgName[currentWorkingPBI].isEmpty() ) 
    16271642    { 
     
    16441659 
    16451660 
    1646   checkPBIProc = new Q3Process( this ); 
    1647   checkPBIProc->addArgument( "/PCBSD/SystemUpdater/bin/getPBIUpdateStatus.sh" ); 
    1648   checkPBIProc->addArgument( progName ); 
    1649   checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI]  ); 
    1650  
    1651   if ( useProxyServer ) 
    1652   { 
    1653      QString proxyArgPort; 
    1654      proxyArgPort.setNum(proxyServerPort); 
    1655      
    1656      QString proxyArgUrl = proxyServerUrl; 
    1657  
    1658      // Check if we need to remove a http:// 
    1659      if ( proxyServerUrl.indexOf("http://") == 0 ) 
    1660      { 
    1661         proxyArgUrl.remove(0, 7); 
    1662      } 
    1663  
    1664      checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort ); 
    1665  
    1666   } else { 
    1667      checkPBIProc->addArgument( "DISABLE" ); 
    1668   } 
    1669  
    1670  
    1671   connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) ); 
    1672   connect( checkPBIProc, SIGNAL(processExited()), this, SLOT(slotPBICheckUpdate() ) ); 
    1673   if ( !checkPBIProc->start() ) { 
    1674  
    1675   } 
    1676  
    1677  
    1678 } 
    1679  
     1661 
     1662  // First, get some variables to figure out the full patch URL 
     1663  QFile file( "/Programs/" + progName + PBIProgVer[currentWorkingPBI] + "/PBI.UpdateURL.sh" ); 
     1664  if ( file.open( IO_ReadOnly ) ) { 
     1665      QTextStream stream( &file ); 
     1666      while ( !stream.atEnd() ) { 
     1667          line = stream.readLine(); // line of text excluding '\n' 
     1668          if ( line.find("PBIUpdateURL=\"" ) == 0) 
     1669          { 
     1670              line.replace("PBIUpdateURL=\"", ""); 
     1671              line.truncate(line.indexOf("\"")); 
     1672              PBIUrl = line; 
     1673              //QMessageBox::critical( 0, tr("Online Update"), PBIUrl, QMessageBox::Ok ); 
     1674          } 
     1675 
     1676       } 
     1677      file.close(); 
     1678   }  
     1679 
     1680   if ( PBIUrl.isEmpty() ) 
     1681   { 
     1682     // No PBI update file for this program, jump to next program 
     1683     QTimer::singleShot(1000, this, SLOT(slotPBICheckUpdate() ) ); 
     1684     return; 
     1685   } 
     1686 
     1687 
     1688   QString command = "pbreg get /PC-BSD/Version"; 
     1689   Version = getLineFromCommandOutput(command); 
     1690 
     1691   command = "uname -p"; 
     1692   Arch = getLineFromCommandOutput(command); 
     1693   if ( Arch.indexOf("i386") != -1 ) 
     1694   { 
     1695      Arch = "i386"; 
     1696   } 
     1697   if ( Arch.indexOf("amd64") != -1 ) 
     1698   { 
     1699      Arch = "amd64"; 
     1700   } 
     1701 
     1702  QString postData = "PBIName=" + progName + "&PBIVer=" + PBIProgVer[currentWorkingPBI] + "&PCBSDVER=" + Version + "&OSARCH=" + Arch; 
     1703   
     1704  checkPBIJob = KIO::http_post( PBIUrl, postData.utf8(), KIO::HideProgressInfo); 
     1705  checkPBIJob->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded" ); 
     1706 
     1707 
     1708  connect(checkPBIJob, SIGNAL(result(KJob *)), this, SLOT(slotPBICheckUpdate() ) ); 
     1709  connect(checkPBIJob, SIGNAL(data(KIO::Job *, const QByteArray&)), this, SLOT(slotRecieveData(KIO::Job *, const QByteArray& ) ) ); 
     1710 
     1711} 
     1712 
     1713void UpdaterTray::slotRecieveData(KIO::Job*, const QByteArray& data) 
     1714{ 
     1715    QString output(data), line; 
     1716    QStringList outputList; 
     1717    if ( output.indexOf("Up2Date") == -1  && ! output.isEmpty()) 
     1718    { 
     1719        outputList = QStringList::split("\n", output); 
     1720        for ( int i = 0; i < outputList.size(); i++) 
     1721        { 
     1722            line = outputList.at(i); 
     1723            
     1724             if (line.find("NewVer:" ) ==  0 ) 
     1725             { 
     1726               PBIProgNewVer[currentWorkingPBI] = line.replace("NewVer: ", ""); 
     1727             } 
     1728             if ( line.find("Mirror1:") == 0) 
     1729             { 
     1730              PBIProgURL1[currentWorkingPBI] = line.replace("Mirror1: ", ""); 
     1731             } 
     1732             // Check for our other file locations 
     1733             if ( line.find("Mirror2:") == 0) 
     1734             { 
     1735               PBIProgURL2[currentWorkingPBI] = line.replace("Mirror2: ", ""); 
     1736             } 
     1737             if ( line.find("Mirror3:") == 0) 
     1738             { 
     1739                 PBIProgURL3[currentWorkingPBI] = line.replace("Mirror3: ", ""); 
     1740             } 
     1741             if ( line.find("FileLoc:") == 0) 
     1742             { 
     1743                 PBIProgLoc[currentWorkingPBI] = line.replace("FileLoc: ", ""); 
     1744             } 
     1745             if ( line.find("MD5:") == 0) 
     1746             { 
     1747                 PBIProgMD5[currentWorkingPBI] = line.replace("MD5: ", ""); 
     1748             }  
     1749        } // End of For loop reading line-by-line our data 
     1750 
     1751        // Check to ensure we have found all our variables 
     1752        if ( ! PBIProgNewVer[currentWorkingPBI].isEmpty() && ! PBIProgURL1[currentWorkingPBI].isEmpty() && ! PBIProgURL2[currentWorkingPBI].isEmpty() && ! PBIProgURL3[currentWorkingPBI].isEmpty() && ! PBIProgLoc[currentWorkingPBI].isEmpty() && ! PBIProgMD5[currentWorkingPBI].isEmpty() ) 
     1753        { 
     1754              // We have valid data! Set the flag that this PBI is in need of an update 
     1755              PBIProgUpdate[currentWorkingPBI] = 1; 
     1756        } 
     1757    } // End of IF statement to find if this string has update data 
     1758} 
    16801759 
    16811760 
     
    19632042       URL = PBIProgURL1[currentWorkingPBI]; 
    19642043   } 
     2044 
     2045   // Append the PBI location to our mirror URL now 
     2046   URL = URL + PBIProgLoc[currentWorkingPBI]; 
    19652047    
    19662048   id.setNum(currentWorkingPBI); 
     
    19842066    } 
    19852067 
    1986     copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo); 
     2068    copyJob = KIO::file_copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", -1, KIO::HideProgressInfo | KIO::Overwrite); 
    19872069     
    19882070    connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); 
     
    22332315   command = "su " + username + " -c 'kcmshell4 proxy' &"; 
    22342316   system(command);  
    2235 } 
     2317   QMessageBox::information( 0, tr("Proxy Configuration!"), tr("You will need to restart the system updater for any proxy changes to take effect!"), QMessageBox::Ok ); 
     2318} 
  • pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h

    r2940 r2941  
    22#include <qpair.h> 
    33#include <qstring.h> 
    4  
    54#include <ksystemtrayicon.h> 
    65#include <kio/jobclasses.h> 
     
    5554   void slotTrayActivated(QSystemTrayIcon::ActivationReason reason); 
    5655   void slotLaunchKDEProxyConfig(); 
     56   void slotRecieveData(KIO::Job*, const QByteArray& data); 
    5757    
    5858protected: 
     
    6464   void loadPatchData(QString patchFile, int patchNum); 
    6565   KJob *copyJob; 
     66   KJob *sysFetchJob; 
     67   KIO::TransferJob *checkPBIJob; 
     68   QString sysPatchsetTmpFile; 
    6669   bool useCustomTmpDir; 
    6770   QString customTmpDir; 
    68    bool useProxyServer; 
    69    QString proxyServerUrl; 
    70    int proxyServerPort; 
    7171   QString patchTmpDir; 
    7272}; 
  • pcbsd/trunk/SystemUpdater/SystemUpdater.cpp

    r2940 r2941  
    4545    // Connect the Custom Tmpdir Checkbox 
    4646    connect( checkTMPDIR, SIGNAL( clicked() ), this, SLOT( slotCustomTmpClicked() ) ); 
    47     connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyClicked() ) ); 
    4847    connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) ); 
    4948    connect( pushConfigProxy, SIGNAL( clicked() ), this, SLOT( slotConfigKDEProxy() ) ); 
     
    5150    // Connect slots to emit signal when settings change 
    5251    connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 
    53     connect( lineProxyServer, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 
    54     connect( spinProxyPort, SIGNAL( valueChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 
    5552     
    5653} 
     
    450447} 
    451448 
    452 // Set Proxy Usage 
    453 void systemUpdater::setUseProxy( bool enabled ) 
    454 { 
    455     checkProxy->setChecked(enabled); 
    456     groupProxySettings->setEnabled(enabled); 
    457 } 
    458  
    459 // Set the Proxy being used 
    460 void systemUpdater::setUseProxySettings( QString proxyURL, int portnum ) 
    461 { 
    462     lineProxyServer->setText(proxyURL); 
    463     spinProxyPort->setValue(portnum); 
    464 } 
    465  
    466  
    467449bool systemUpdater::getCustomTmpEnabled() 
    468450{ 
     
    475457   return lineTMPDIR->text(); 
    476458} 
    477  
    478 bool systemUpdater::getProxyEnabled() 
    479 { 
    480    return checkProxy->isChecked(); 
    481 } 
    482  
    483  
    484 QString systemUpdater::getProxyUrl() 
    485 { 
    486    return lineProxyServer->text(); 
    487 } 
    488  
    489 int systemUpdater::getProxyPort() 
    490 { 
    491   return spinProxyPort->value(); 
    492 } 
    493  
    494459 
    495460void systemUpdater::slotCustomTmpClicked() 
     
    502467        lineTMPDIR->setEnabled(false);  
    503468        pushTMPDIR->setEnabled(false);  
    504     } 
    505  
    506     slotConfigChanged(); 
    507 } 
    508  
    509 void systemUpdater::slotProxyClicked() 
    510 { 
    511     if ( checkProxy->isChecked() ) 
    512     { 
    513         groupProxySettings->setEnabled(true); 
    514     } else { 
    515         groupProxySettings->setEnabled(false); 
    516469    } 
    517470 
  • pcbsd/trunk/SystemUpdater/SystemUpdater.h

    r2940 r2941  
    5656    void setUseCustomTmp( bool enabled ); 
    5757    void setUseCustomDirName( QString tmpdir ); 
    58     void setUseProxy( bool enabled ); 
    59     void setUseProxySettings( QString proxyURL, int portnum ); 
    6058    bool getStartupConfig(); 
    6159    bool getCustomTmpEnabled(); 
    6260    QString getCustomTmpDir(); 
    63     bool getProxyEnabled(); 
    64     QString getProxyUrl(); 
    65     int getProxyPort(); 
    6661    void slotRescanPBIUpdatesClicked(); 
    6762    void slotDisableConfUpdates(bool status); 
     
    6964private slots: 
    7065    void slotCustomTmpClicked(); 
    71     void slotProxyClicked(); 
    7266    void slotSelectCustomTmp(); 
    7367    void slotConfigKDEProxy(); 
  • pcbsd/trunk/SystemUpdater/SystemUpdater.ui

    r2940 r2941  
    663663       </item> 
    664664       <item row="4" column="0" > 
    665         <widget class="QCheckBox" name="checkProxy" > 
    666          <property name="text" > 
    667           <string>Specify proxy for update check</string> 
    668          </property> 
    669         </widget> 
    670        </item> 
    671        <item row="5" column="0" > 
    672         <widget class="QGroupBox" name="groupProxySettings" > 
    673          <property name="title" > 
    674           <string>Proxy Settings</string> 
    675          </property> 
    676          <layout class="QGridLayout" name="gridLayout" > 
    677           <item row="0" column="0" > 
    678            <layout class="QHBoxLayout" name="horizontalLayout_2" > 
    679             <item> 
    680              <widget class="QLabel" name="label" > 
    681               <property name="text" > 
    682                <string>Proxy Server</string> 
    683               </property> 
    684              </widget> 
    685             </item> 
    686             <item> 
    687              <widget class="QLineEdit" name="lineProxyServer" /> 
    688             </item> 
    689             <item> 
    690              <widget class="QLabel" name="label_2" > 
    691               <property name="text" > 
    692                <string>Port</string> 
    693               </property> 
    694              </widget> 
    695             </item> 
    696             <item> 
    697              <widget class="QSpinBox" name="spinProxyPort" > 
    698               <property name="maximum" > 
    699                <number>9999</number> 
    700               </property> 
    701               <property name="value" > 
    702                <number>8080</number> 
    703               </property> 
    704              </widget> 
    705             </item> 
    706            </layout> 
    707           </item> 
    708          </layout> 
    709         </widget> 
    710        </item> 
    711        <item row="6" column="0" > 
    712665        <layout class="QHBoxLayout" name="horizontalLayout_3" > 
    713666         <item> 
     
    727680          <widget class="QPushButton" name="pushConfigProxy" > 
    728681           <property name="text" > 
    729             <string>Configure Download Proxy</string> 
     682            <string>Configure Proxy Settings</string> 
    730683           </property> 
    731684          </widget> 
     
    746699        </layout> 
    747700       </item> 
    748        <item row="7" column="0" > 
     701       <item row="5" column="0" > 
    749702        <spacer name="spacer8" > 
    750703         <property name="orientation" > 
     
    762715        </spacer> 
    763716       </item> 
    764        <item row="8" column="0" > 
     717       <item row="6" column="0" > 
    765718        <spacer name="spacer9" > 
    766719         <property name="orientation" > 
  • pcbsd/trunk/SystemUpdater/UpdaterTray.cpp

    r2940 r2941  
    108108QString PBIProgURL3[900]; 
    109109QString PBIProgMD5[900]; 
     110QString PBIProgLoc[900]; 
    110111int     PBIProgUpdate[900]; 
    111112int     PBIProgFailed[900]; 
     
    159160  username = getlogin(); 
    160161 
     162  // Setup our Context Menu 
     163  contextMenu()->insertSeparator(); 
     164  contextMenu()->insertItem( tr("Start the Update Manager"), this, SLOT(slotOpenUpdateManager()), 0, 5); 
     165  contextMenu()->insertItem( tr("Run at startup"), this, SLOT(slotChangeRunStartup()), 0, 6); 
     166  contextMenu()->setItemChecked ( 6, TRUE ); 
     167   
    161168  // Set the tray icon that we are checking for updates 
    162169  QIcon Icon; 
     
    164171  setIcon(Icon); 
    165172 
    166   // Setup our Context Menu 
    167   contextMenu()->clear(); 
    168   //contextMenu()->insertTitle(PixmapIcon, tr("PC-BSD Update Manager"), 1); 
    169   contextMenu()->insertSeparator(); 
    170   contextMenu()->insertItem( tr("Start the Update Manager"), this, SLOT(slotOpenUpdateManager()), 0, 5); 
    171   contextMenu()->insertItem( tr("Run at startup"), this, SLOT(slotChangeRunStartup()), 0, 6); 
    172   contextMenu()->setItemChecked ( 6, TRUE ); 
    173   //contextMenu()->insertItem( tr("Checking for System Updates..."), this, SLOT(slotStartUpdateCheckManual(), 0, 6); 
    174  
    175173  // Load the program preferences 
    176174  loadUpdaterPrefs(); 
    177175 
    178176  // Start the monitor service for system updates 
    179   slotScheduledSystemCheck(); 
     177  QTimer::singleShot(1000, this, SLOT(slotScheduledSystemCheck())); 
    180178 
    181179  // Start the monitor service for PBI updates 
    182   slotScheduledPBICheck(); 
     180  QTimer::singleShot(1000, this, SLOT(slotScheduledPBICheck())); 
    183181   
    184182} 
     
    216214 
    217215 
    218 void UpdaterTray::slotStartUpdateCheck() { 
     216void UpdaterTray::slotStartUpdateCheck() 
     217{ 
     218  QString SysUrl; 
     219  QString PatchSet; 
     220  QString Version; 
     221  QString Arch, line; 
    219222 
    220223  // Check if the system is doing updates right now, if it is, ignore the request 
     
    244247  displayTooltip(); 
    245248 
    246   // Run the getUpdatesDir.sh script to rsync with master server 
    247   getUpdatesDir = new Q3Process( this ); 
    248   getUpdatesDir->addArgument( "sh"); 
    249   getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh"); 
    250   if ( useProxyServer ) 
    251   { 
    252      QString proxyArgPort; 
    253      proxyArgPort.setNum(proxyServerPort); 
    254  
    255      QString proxyArgUrl = proxyServerUrl; 
    256  
    257      // Check if we need to remove a http:// 
    258      if ( proxyServerUrl.indexOf("http://") == 0 ) 
    259      { 
    260         proxyArgUrl.remove(0, 7); 
    261      } 
    262  
    263      getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort ); 
    264  
    265   } else { 
    266      getUpdatesDir->addArgument( "DISABLE" ); 
    267   } 
    268  
    269   // Connect the exited signal and start the process 
    270   connect( getUpdatesDir, SIGNAL(processExited()), this, SLOT(slotSysUpdateCheckFinished() ) ); 
    271   //connect( SetupScript, SIGNAL(readyReadStdout()), this, SLOT(readyReadScriptOutput2() ) ); 
    272   if ( ! getUpdatesDir->start() ) { 
    273         QMessageBox::information( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok ); 
    274   } 
    275  
    276  
    277  
     249  // Run our KIO Job to fetch the system-update patch data for this version of PC-BSD 
     250 
     251  // First, get some variables to figure out the full patch URL 
     252  QFile file( "/PCBSD/SystemUpdater/conf/sysupdate.conf" ); 
     253  if ( file.open( IO_ReadOnly ) ) { 
     254      QTextStream stream( &file ); 
     255      while ( !stream.atEnd() ) { 
     256          line = stream.readLine(); // line of text excluding '\n' 
     257          if ( line.find("UPDATESERVER: " ) == 0) 
     258          { 
     259              line.replace("UPDATESERVER: ", ""); 
     260              SysUrl = line;  
     261          } 
     262           
     263          if ( line.find("PATCHSET: " ) == 0) 
     264          { 
     265              line.replace("PATCHSET: ", ""); 
     266              PatchSet = line;  
     267          } 
     268       } 
     269      file.close(); 
     270   }  
     271 
     272   QString command = "pbreg get /PC-BSD/Version"; 
     273   Version = getLineFromCommandOutput(command); 
     274 
     275   command = "uname -p"; 
     276   Arch = getLineFromCommandOutput(command); 
     277   if ( Arch.indexOf("i386") != -1 ) 
     278   { 
     279      Arch = "i386"; 
     280   } 
     281   if ( Arch.indexOf("amd64") != -1 ) 
     282   { 
     283      Arch = "amd64"; 
     284   } 
     285 
     286   if ( SysUrl.isEmpty() || PatchSet.isEmpty() || Version.isEmpty() || Arch.isEmpty() ) 
     287   { 
     288        // Bad patch file? 
     289        QMessageBox::information( 0, tr("Error!"), tr("Error parsing sysupdate.conf!!!"), QMessageBox::Ok ); 
     290        return; 
     291   } 
     292 
     293  QString patchfile = "patch-" + PatchSet + "-" + Version + "-" + Arch + ".tgz"; 
     294  sysPatchsetTmpFile = "/PCBSD/tmp/" + patchfile; 
     295  QString patchurl = SysUrl + "/" + patchfile; 
     296 
     297  // Start our KIO copy now 
     298  sysFetchJob = KIO::file_copy( patchurl, sysPatchsetTmpFile, -1, KIO::HideProgressInfo | KIO::Overwrite); 
     299  connect(sysFetchJob, SIGNAL(result(KJob *)), this, SLOT(slotSysUpdateCheckFinished() ) ); 
     300   
    278301} 
    279302 
     
    285308 
    286309void UpdaterTray::slotSysUpdateCheckFinished() { 
    287   // Check to see if the update download was successful and warn if not 
    288   if ( getUpdatesDir->exitStatus() != 0 ) 
    289   { 
    290         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 ); 
    291   }  
     310 
     311  QString command = "pbreg get /PC-BSD/Version"; 
     312  QString Version = getLineFromCommandOutput(command); 
    292313 
    293314   // Now traverse the directory, see if we have updates. 
     
    295316  readSysUpdates->addArgument( "sh"); 
    296317  readSysUpdates->addArgument( "/PCBSD/SystemUpdater/bin/readSysUpdates.sh"); 
     318  readSysUpdates->addArgument( Version ); 
     319 
     320  // Check to see if the update download was successful and warn if not 
     321  if ( sysFetchJob->error() != 0 ) 
     322  { 
     323        // Check if we should show the updater dialog or not 
     324        if (! SystemUpdaterDialog->isShown() ) 
     325        { 
     326           SystemUpdaterDialog->show(); 
     327           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 ); 
     328           SystemUpdaterDialog->hide(); 
     329        } else { 
     330           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 ); 
     331        } 
     332  } else { 
     333     // Add the patchdata URL 
     334     readSysUpdates->addArgument(sysPatchsetTmpFile); 
     335  }  
    297336 
    298337  // Connect the exited signal and start the process 
     
    625664   //QToolTip::clear(); 
    626665   // Update the tooltop 
    627    QToolTip::remove(this->contextMenu()); 
    628    QToolTip::add(this->contextMenu(), tooltipStr); 
     666   QToolTip::remove(contextMenu()); 
     667   QToolTip::add(contextMenu(), tooltipStr); 
    629668 
    630669} 
     
    685724  settings.writeEntry( "/PC-BSD/SystemUpdater/customTmpDir", customTmpDir ); 
    686725 
    687   useProxyServer = SystemUpdaterDialog->getProxyEnabled(); 
    688   settings.setValue( "/PC-BSD/SystemUpdater/useProxyServer", useProxyServer ); 
    689   
    690   proxyServerUrl = SystemUpdaterDialog->getProxyUrl(); 
    691   settings.setValue( "/PC-BSD/SystemUpdater/proxyServerUrl", proxyServerUrl ); 
    692  
    693   proxyServerPort = SystemUpdaterDialog->getProxyPort(); 
    694   settings.setValue( "/PC-BSD/SystemUpdater/proxyServerPort", proxyServerPort ); 
    695  
    696  
    697726} 
    698727 
    699728void UpdaterTray::loadUpdaterPrefs() { 
    700729  // Load the user preferences for the System Updater 
    701   bool ok; 
    702730  QSettings settings; 
    703731   
     
    726754  SystemUpdaterDialog->setUseCustomDirName( customTmpDir ); 
    727755   
    728   // Load if the user wants to use a proxy server 
    729   useProxyServer = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useProxyServer", false ); 
    730   SystemUpdaterDialog->setUseProxy( useProxyServer ); 
    731    
    732   // Load Proxy Server Settings 
    733   proxyServerUrl = settings.value( "/PC-BSD/SystemUpdater/proxyServerUrl" ).toString(); 
    734  
    735   settings.value("/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 
    736   if ( ok ) { 
    737      proxyServerPort = settings.value( "/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 
    738   } else { 
    739      proxyServerPort = 8080; 
    740   } 
    741   SystemUpdaterDialog->setUseProxySettings( proxyServerUrl, proxyServerPort ); 
    742  
    743756  SystemUpdaterDialog->slotDisableConfUpdates(false); 
    744757 
     
    11451158 
    11461159 
    1147     copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo); 
     1160    copyJob = KIO::file_copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", -1, KIO::HideProgressInfo | KIO::Overwrite); 
    11481161     
    11491162    connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); 
     
    16171630void UpdaterTray::slotPBICheckUpdate() 
    16181631{ 
    1619     
    1620  
     1632 
     1633    QString tmp, line; 
     1634    QString progName, Arch, Version, PBIUrl; 
     1635 
     1636 
     1637    // Jump to the next PBI in our list 
    16211638    currentWorkingPBI++; 
    1622     QString tmp; 
    1623     QString progName; 
    1624  
    1625  
     1639 
     1640    // Check if we are done with checking for updates 
    16261641    if ( PBIProgName[currentWorkingPBI].isEmpty() ) 
    16271642    { 
     
    16441659 
    16451660 
    1646   checkPBIProc = new Q3Process( this ); 
    1647   checkPBIProc->addArgument( "/PCBSD/SystemUpdater/bin/getPBIUpdateStatus.sh" ); 
    1648   checkPBIProc->addArgument( progName ); 
    1649   checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI]  ); 
    1650  
    1651   if ( useProxyServer ) 
    1652   { 
    1653      QString proxyArgPort; 
    1654      proxyArgPort.setNum(proxyServerPort); 
    1655      
    1656      QString proxyArgUrl = proxyServerUrl; 
    1657  
    1658      // Check if we need to remove a http:// 
    1659      if ( proxyServerUrl.indexOf("http://") == 0 ) 
    1660      { 
    1661         proxyArgUrl.remove(0, 7); 
    1662      } 
    1663  
    1664      checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort ); 
    1665  
    1666   } else { 
    1667      checkPBIProc->addArgument( "DISABLE" ); 
    1668   } 
    1669  
    1670  
    1671   connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) ); 
    1672   connect( checkPBIProc, SIGNAL(processExited()), this, SLOT(slotPBICheckUpdate() ) ); 
    1673   if ( !checkPBIProc->start() ) { 
    1674  
    1675   } 
    1676  
    1677  
    1678 } 
    1679  
     1661 
     1662  // First, get some variables to figure out the full patch URL 
     1663  QFile file( "/Programs/" + progName + PBIProgVer[currentWorkingPBI] + "/PBI.UpdateURL.sh" ); 
     1664  if ( file.open( IO_ReadOnly ) ) { 
     1665      QTextStream stream( &file ); 
     1666      while ( !stream.atEnd() ) { 
     1667          line = stream.readLine(); // line of text excluding '\n' 
     1668          if ( line.find("PBIUpdateURL=\"" ) == 0) 
     1669          { 
     1670              line.replace("PBIUpdateURL=\"", ""); 
     1671              line.truncate(line.indexOf("\"")); 
     1672              PBIUrl = line; 
     1673              //QMessageBox::critical( 0, tr("Online Update"), PBIUrl, QMessageBox::Ok ); 
     1674          } 
     1675 
     1676       } 
     1677      file.close(); 
     1678   }  
     1679 
     1680   if ( PBIUrl.isEmpty() ) 
     1681   { 
     1682     // No PBI update file for this program, jump to next program 
     1683     QTimer::singleShot(1000, this, SLOT(slotPBICheckUpdate() ) ); 
     1684     return; 
     1685   } 
     1686 
     1687 
     1688   QString command = "pbreg get /PC-BSD/Version"; 
     1689   Version = getLineFromCommandOutput(command); 
     1690 
     1691   command = "uname -p"; 
     1692   Arch = getLineFromCommandOutput(command); 
     1693   if ( Arch.indexOf("i386") != -1 ) 
     1694   { 
     1695      Arch = "i386"; 
     1696   } 
     1697   if ( Arch.indexOf("amd64") != -1 ) 
     1698   { 
     1699      Arch = "amd64"; 
     1700   } 
     1701 
     1702  QString postData = "PBIName=" + progName + "&PBIVer=" + PBIProgVer[currentWorkingPBI] + "&PCBSDVER=" + Version + "&OSARCH=" + Arch; 
     1703   
     1704  checkPBIJob = KIO::http_post( PBIUrl, postData.utf8(), KIO::HideProgressInfo); 
     1705  checkPBIJob->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded" ); 
     1706 
     1707 
     1708  connect(checkPBIJob, SIGNAL(result(KJob *)), this, SLOT(slotPBICheckUpdate() ) ); 
     1709  connect(checkPBIJob, SIGNAL(data(KIO::Job *, const QByteArray&)), this, SLOT(slotRecieveData(KIO::Job *, const QByteArray& ) ) ); 
     1710 
     1711} 
     1712 
     1713void UpdaterTray::slotRecieveData(KIO::Job*, const QByteArray& data) 
     1714{ 
     1715    QString output(data), line; 
     1716    QStringList outputList; 
     1717    if ( output.indexOf("Up2Date") == -1  && ! output.isEmpty()) 
     1718    { 
     1719        outputList = QStringList::split("\n", output); 
     1720        for ( int i = 0; i < outputList.size(); i++) 
     1721        { 
     1722            line = outputList.at(i); 
     1723            
     1724             if (line.find("NewVer:" ) ==  0 ) 
     1725             { 
     1726               PBIProgNewVer[currentWorkingPBI] = line.replace("NewVer: ", ""); 
     1727             } 
     1728             if ( line.find("Mirror1:") == 0) 
     1729             { 
     1730              PBIProgURL1[currentWorkingPBI] = line.replace("Mirror1: ", ""); 
     1731             } 
     1732             // Check for our other file locations 
     1733             if ( line.find("Mirror2:") == 0) 
     1734             { 
     1735               PBIProgURL2[currentWorkingPBI] = line.replace("Mirror2: ", ""); 
     1736             } 
     1737             if ( line.find("Mirror3:") == 0) 
     1738             { 
     1739                 PBIProgURL3[currentWorkingPBI] = line.replace("Mirror3: ", ""); 
     1740             } 
     1741             if ( line.find("FileLoc:") == 0) 
     1742             { 
     1743                 PBIProgLoc[currentWorkingPBI] = line.replace("FileLoc: ", ""); 
     1744             } 
     1745             if ( line.find("MD5:") == 0) 
     1746             { 
     1747                 PBIProgMD5[currentWorkingPBI] = line.replace("MD5: ", ""); 
     1748             }  
     1749        } // End of For loop reading line-by-line our data 
     1750 
     1751        // Check to ensure we have found all our variables 
     1752        if ( ! PBIProgNewVer[currentWorkingPBI].isEmpty() && ! PBIProgURL1[currentWorkingPBI].isEmpty() && ! PBIProgURL2[currentWorkingPBI].isEmpty() && ! PBIProgURL3[currentWorkingPBI].isEmpty() && ! PBIProgLoc[currentWorkingPBI].isEmpty() && ! PBIProgMD5[currentWorkingPBI].isEmpty() ) 
     1753        { 
     1754              // We have valid data! Set the flag that this PBI is in need of an update 
     1755              PBIProgUpdate[currentWorkingPBI] = 1; 
     1756        } 
     1757    } // End of IF statement to find if this string has update data 
     1758} 
    16801759 
    16811760 
     
    19632042       URL = PBIProgURL1[currentWorkingPBI]; 
    19642043   } 
     2044 
     2045   // Append the PBI location to our mirror URL now 
     2046   URL = URL + PBIProgLoc[currentWorkingPBI]; 
    19652047    
    19662048   id.setNum(currentWorkingPBI); 
     
    19842066    } 
    19852067 
    1986     copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo); 
     2068    copyJob = KIO::file_copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", -1, KIO::HideProgressInfo | KIO::Overwrite); 
    19872069     
    19882070    connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); 
     
    22332315   command = "su " + username + " -c 'kcmshell4 proxy' &"; 
    22342316   system(command);  
    2235 } 
     2317   QMessageBox::information( 0, tr("Proxy Configuration!"), tr("You will need to restart the system updater for any proxy changes to take effect!"), QMessageBox::Ok ); 
     2318} 
  • pcbsd/trunk/SystemUpdater/UpdaterTray.h

    r2940 r2941  
    22#include <qpair.h> 
    33#include <qstring.h> 
    4  
    54#include <ksystemtrayicon.h> 
    65#include <kio/jobclasses.h> 
     
    5554   void slotTrayActivated(QSystemTrayIcon::ActivationReason reason); 
    5655   void slotLaunchKDEProxyConfig(); 
     56   void slotRecieveData(KIO::Job*, const QByteArray& data); 
    5757    
    5858protected: 
     
    6464   void loadPatchData(QString patchFile, int patchNum); 
    6565   KJob *copyJob; 
     66   KJob *sysFetchJob; 
     67   KIO::TransferJob *checkPBIJob; 
     68   QString sysPatchsetTmpFile; 
    6669   bool useCustomTmpDir; 
    6770   QString customTmpDir; 
    68    bool useProxyServer; 
    69    QString proxyServerUrl; 
    70    int proxyServerPort; 
    7171   QString patchTmpDir; 
    7272};