[PC-BSD Commits] r5650 - pcbsd/trunk/SoftwareManager

svn at pcbsd.org svn at pcbsd.org
Thu Dec 17 13:50:31 PST 2009


Author: kris
Date: 2009-12-17 13:50:31 -0800 (Thu, 17 Dec 2009)
New Revision: 5650

Modified:
   pcbsd/trunk/SoftwareManager/pbi.cpp
   pcbsd/trunk/SoftwareManager/softmanager-pbiupdate.cpp
Log:

Fixed some bugs when downloading PBIs, and cleanup of tmp files



Modified: pcbsd/trunk/SoftwareManager/pbi.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/pbi.cpp	2009-12-17 21:28:14 UTC (rev 5649)
+++ pcbsd/trunk/SoftwareManager/pbi.cpp	2009-12-17 21:50:31 UTC (rev 5650)
@@ -90,6 +90,14 @@
   QFile tmppart(this->downloadFile + ".part");
   if ( tmppart.exists() )
     tmppart.remove();
+
+  QFile tmpdl(this->downloadFile + ".tmp.part");
+  if ( tmpdl.exists() )
+    tmpdl.remove();
+
+  QFile tmpdl2(this->downloadFile + ".tmp");
+  if ( tmpdl2.exists() )
+    tmpdl2.remove();
 }
 
 bool PBI::isNewDownload()

Modified: pcbsd/trunk/SoftwareManager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-pbiupdate.cpp	2009-12-17 21:28:14 UTC (rev 5649)
+++ pcbsd/trunk/SoftwareManager/softmanager-pbiupdate.cpp	2009-12-17 21:50:31 UTC (rev 5650)
@@ -389,34 +389,20 @@
   }
 
    // Update the status if the attempted download worked
-   if ( item->getDownloadAttempts() == 2 )
-   {
-       // The download failed, maybe resume is failing? Remove the .part file in that case
-       if ( QFile::exists(item->getDownloadFile() + ".tmp.part") )
-       {
-          QFile::remove(item->getDownloadFile() + ".tmp.part" );
-       }
+   if ( item->getDownloadAttempts() >= 1)
        item->setStatusText(tr("Download failed... Attempting to re-download..."));
-   } else if ( item->getDownloadAttempts() == 1) {
-       item->setStatusText(tr("Download failed... Attempting to re-download..."));
-   } else {
+   else
        item->setStatusText(tr("Downloading..."));
-   }
 
+   // Remove any leftover tmp file
+   item->removeTmpFile();
+
    // Start the copy job
-   if(QFile::exists(item->getDownloadFile() + ".part") ) {
-     copyJob = KIO::file_copy(item->getDownloadURL(), item->getDownloadFile() + ".tmp", -1, KIO::HideProgressInfo | KIO::Resume);
-     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), this, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
-     connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), this, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
-     connect(copyJob, SIGNAL(processedSize(KJob*, qulonglong)), this, SLOT(slotJobUpdateProcessedSize( KJob*, qulonglong)));
-     connect(copyJob, SIGNAL(result(KJob*)), this, SLOT(slotDownloadPBIDone()));
-   } else {
-     copyJob = KIO::file_copy(item->getDownloadURL(), item->getDownloadFile() + ".tmp", -1, KIO::HideProgressInfo);
-     connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), this, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
-     connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), this, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
-     connect(copyJob, SIGNAL(processedSize(KJob*, qulonglong)), this, SLOT(slotJobUpdateProcessedSize( KJob*, qulonglong)));
-     connect(copyJob, SIGNAL(result(KJob*)), this, SLOT(slotDownloadPBIDone()));
-   }
+   copyJob = KIO::file_copy(item->getDownloadURL(), item->getDownloadFile() + ".tmp", -1, KIO::HideProgressInfo);
+   connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), this, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
+   connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), this, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
+   connect(copyJob, SIGNAL(processedSize(KJob*, qulonglong)), this, SLOT(slotJobUpdateProcessedSize( KJob*, qulonglong)));
+   connect(copyJob, SIGNAL(result(KJob*)), this, SLOT(slotDownloadPBIDone()));
     
 }
 



More information about the Commits mailing list