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

List:       kde-commits
Subject:    [apper] libapper: Add support to display the download size remaining when downloading
From:       Daniel Nicoletti <dantti12 () gmail ! com>
Date:       2012-06-30 22:53:46
Message-ID: 20120630225346.21A7BA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit e785be92b34b1b26f1de763a07513dcec1c29e14 by Daniel Nicoletti.
Committed on 01/07/2012 at 00:53.
Pushed by dantti into branch 'master'.

Add support to display the download size remaining when downloading

M  +10   -2    libapper/PkTransaction.cpp

http://commits.kde.org/apper/e785be92b34b1b26f1de763a07513dcec1c29e14

diff --git a/libapper/PkTransaction.cpp b/libapper/PkTransaction.cpp
index 1748ef3..854845a 100644
--- a/libapper/PkTransaction.cpp
+++ b/libapper/PkTransaction.cpp
@@ -432,11 +432,19 @@ void PkTransaction::updateUi()
             d->busySeq->setSequence(sequence);
             d->busySeq->start();
         }
-    } else if (status == Transaction::StatusDownload && transaction->speed() != 0) {
+    } else if (status == Transaction::StatusDownload) {
         uint speed = transaction->speed();
-        if (speed) {
+        qulonglong downloadRemaining = transaction->downloadSizeRemaining();
+        if (speed != 0 && downloadRemaining != 0) {
+            ui->currentL->setText(i18n("Downloading packages at %1/s, %2 remaining",
+                                       KGlobal::locale()->formatByteSize(speed),
+                                       KGlobal::locale()->formatByteSize(downloadRemaining)));
+        } else if (speed != 0 && downloadRemaining == 0) {
             ui->currentL->setText(i18n("Downloading packages at %1/s",
                                          KGlobal::locale()->formatByteSize(speed)));
+        } else if (speed == 0 && downloadRemaining != 0) {
+            ui->currentL->setText(i18n("Downloading packages, %1 remaining",
+                                         KGlobal::locale()->formatByteSize(downloadRemaining)));
         }
     }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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