[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KGet Patch
From:       Tim Edwards <tkedwards () optusnet ! com ! au>
Date:       2004-04-26 8:50:52
Message-ID: 1082969452.6574.101.camel () coolserver
[Download RAW message or body]

I originally sent this message to the authors:

Hi,

While using KGet I've noticed that when the total size of all the files
being downloaded is over ~2gb (i.e the highest number in bytes that a
32-bit signed int can represent) it doesn't display the total size
correctly in the task bar.

I've created a patch to solve this problem (see attachment). If you
agree with it I hope you can integrate it into the KDE CVS module for
KGet.

Note: This patch was created on the KDE_3_1_BRANCH of kdenetwork/kget
from the KDE.org CVS.

Thanks
Feel free to contact me

Tim Edwards

["kgetpatchfile_20040421" (kgetpatchfile_20040421)]

*** /home/tim/kdedevelopment/kget/kget/transfer.cpp	2004-04-17 16:56:29.000000000 +1000
--- transfer.cpp	2004-04-18 16:38:24.000000000 +1000
***************
*** 605,611 ****
  
  
  
! void Transfer::slotTotalSize(unsigned long bytes)
  {
  #ifdef _DEBUG
      sDebugIn<<" totalSize is = "<<totalSize << endl;
--- 605,611 ----
  
  
  
! void Transfer::slotTotalSize(KIO::filesize_t bytes)
  {
  #ifdef _DEBUG
      sDebugIn<<" totalSize is = "<<totalSize << endl;
***************
*** 614,620 ****
      if (totalSize == 0) {
          totalSize = bytes;
          if (totalSize != 0) {
!             logMessage(i18n("Total size is %1 bytes").arg(totalSize));
              setText(view->lv_total, KIO::convertSize(totalSize));
              dlgIndividual->setTotalSize(totalSize);
              dlgIndividual->setPercent(0);
--- 614,620 ----
      if (totalSize == 0) {
          totalSize = bytes;
          if (totalSize != 0) {
!             logMessage(i18n("Total size is %1 bytes").arg((double)totalSize,0,'f'));
              setText(view->lv_total, KIO::convertSize(totalSize));
              dlgIndividual->setTotalSize(totalSize);
              dlgIndividual->setPercent(0);
***************
*** 639,645 ****
  
  
  
! void Transfer::slotProcessedSize(unsigned long bytes)
  {
      //sDebug<< ">>>>Entering"<<endl;
  
--- 639,645 ----
  
  
  
! void Transfer::slotProcessedSize(KIO::filesize_t bytes)
  {
      //sDebug<< ">>>>Entering"<<endl;
  
***************
*** 757,764 ****
      config->writeEntry("Mode", mode);
      config->writeEntry("Status", status);
      config->writeEntry("CanResume", canResume);
!     config->writeEntry("TotalSize", totalSize);
!     config->writeEntry("ProcessedSize", processedSize);
      config->writeEntry("ScheduledTime", startTime);
      sDebugOut << endl;
  }
--- 757,764 ----
      config->writeEntry("Mode", mode);
      config->writeEntry("Status", status);
      config->writeEntry("CanResume", canResume);
!     config->writeEntry("TotalSize", (QVariant &)totalSize);
!     config->writeEntry("ProcessedSize", (QVariant &)processedSize);
      config->writeEntry("ScheduledTime", startTime);
      sDebugOut << endl;
  }
*** /home/tim/kdedevelopment/kget/kget/transfer.h	2004-04-17 16:56:29.000000000 +1000
--- transfer.h	2004-04-18 13:56:27.000000000 +1000
***************
*** 90,100 ****
          return remainingTime;
      }
  
!     unsigned long getTotalSize()
      {
          return totalSize;
      }
!     unsigned long getProcessedSize()
      {
          return processedSize;
      }
--- 90,100 ----
          return remainingTime;
      }
  
!     KIO::filesize_t getTotalSize()
      {
          return totalSize;
      }
!     KIO::filesize_t getProcessedSize()
      {
          return processedSize;
      }
***************
*** 181,188 ****
      void slotQueue();
      void slotFinished();
  
!     void slotTotalSize(unsigned long bytes);
!     void slotProcessedSize(unsigned long);
  
      void slotStartTime(const QDateTime &);
  
--- 181,188 ----
      void slotQueue();
      void slotFinished();
  
!     void slotTotalSize(KIO::filesize_t bytes);
!     void slotProcessedSize(KIO::filesize_t);
  
      void slotStartTime(const QDateTime &);
  
***************
*** 206,213 ****
      // schedule time
      QDateTime startTime;
  
!     unsigned long totalSize;
!     unsigned long processedSize;
      int percent;
  
  
--- 206,213 ----
      // schedule time
      QDateTime startTime;
  
!     KIO::filesize_t totalSize;
!     KIO::filesize_t processedSize;
      int percent;
  
  
*** /home/tim/kdedevelopment/kget/kget/kmainwidget.cpp	2004-04-17 16:56:27.000000000 +1000
--- kmainwidget.cpp	2004-04-18 15:33:19.000000000 +1000
***************
*** 2041,2047 ****
      QString tmpstr;
  
      int totalFiles = 0;
!     int totalSize = 0;
      int totalSpeed = 0;
      QTime remTime;
  
--- 2041,2047 ----
      QString tmpstr;
  
      int totalFiles = 0;
!     KIO::filesize_t totalSize = 0;
      int totalSpeed = 0;
      QTime remTime;
  


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic