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

List:       kde-commits
Subject:    KDE/kdenetwork/kget
From:       Lukas Appelhans <l.appelhans () gmx ! de>
Date:       2012-06-14 11:08:31
Message-ID: 20120614110831.09BFFAC779 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1300601 by lappelhans:

Update source in TransferMultiSegKIO when appropriate
BUG:298422


 M  +1 -0      core/datasourcefactory.cpp  
 M  +7 -6      core/transfer.h  
 M  +11 -0     transfer-plugins/multisegmentkio/transfermultisegkio.cpp  
 M  +13 -16    ui/transferdetails.cpp  


--- trunk/KDE/kdenetwork/kget/core/datasourcefactory.cpp #1300600:1300601
@@ -532,6 +532,7 @@
     //first remove the not set DataSources
     QList<KUrl> oldUrls = m_sources.keys();
     QList<KUrl> newUrls = mirrors.keys();
+    
     foreach (const KUrl &url, oldUrls)
     {
         if (!newUrls.contains(url))
--- trunk/KDE/kdenetwork/kget/core/transfer.h #1300600:1300601
@@ -48,12 +48,13 @@
         {
             Tc_None           = 0x00000000,
             // These flags respect the Model columns order NOTE: The model only \
checks the last 8 bits, so all values which need to be updated by the model should \
                look like: 0x000000xx
-            Tc_FileName       = 0x00000001,
-            Tc_Status         = 0x00000002,
-            Tc_TotalSize      = 0x00000004,
-            Tc_Percent        = 0x00000008,
-            Tc_DownloadSpeed  = 0x00000010,
-            Tc_RemainingTime  = 0x00000020,
+            Tc_Source         = 0x00000001,
+            Tc_FileName       = 0x00000002,
+            Tc_Status         = 0x00000004,
+            Tc_TotalSize      = 0x00000008,
+            Tc_Percent        = 0x00000010,
+            Tc_DownloadSpeed  = 0x00000020,
+            Tc_RemainingTime  = 0x00000040,
             // Misc
             Tc_UploadSpeed    = 0x00000100,
             Tc_UploadLimit    = 0x00000200,
--- trunk/KDE/kdenetwork/kget/transfer-plugins/multisegmentkio/transfermultisegkio.cpp \
#1300600:1300601 @@ -257,7 +257,18 @@
     Q_UNUSED(file)
 
     m_dataSourceFactory->setMirrors(mirrors);
+    
+    m_source = KUrl();
+    QHash< KUrl, QPair<bool, int> >::const_iterator it = mirrors.begin();
+    QHash< KUrl, QPair<bool, int> >::const_iterator end = mirrors.end();
+    for (; it != end; it++) {
+        if (it.value().first) {
+            m_source = it.key();
+            break;
 }
+    }
+    setTransferChange(Tc_Source, true);
+}
 
 Verifier *TransferMultiSegKio::verifier(const KUrl &file)
 {
--- trunk/KDE/kdenetwork/kget/ui/transferdetails.cpp #1300600:1300601
@@ -61,47 +61,44 @@
 
     Q_UNUSED(transfer)
 
-    if(flags & Transfer::Tc_Status)
-    {
+    if(flags & Transfer::Tc_Status) {
         frm.statusPixmapContentLabel->setPixmap(m_transfer->statusPixmap());
         frm.statusTextContentLabel->setText(m_transfer->statusText());
 
-        if (m_transfer->status() == Job::Finished)
-        {
+        if (m_transfer->status() == Job::Finished) {
             frm.speedContentLabel->setText(i18n("Average speed: %1/s", \
KIO::convertSize(m_transfer->averageDownloadSped())));  }
     }
 
-    if((flags & Transfer::Tc_TotalSize) || (flags & Transfer::Tc_DownloadedSize))
-    {
+    if ((flags & Transfer::Tc_TotalSize) || (flags & Transfer::Tc_DownloadedSize)) {
         frm.completedContentLabel->setText(i18n("%1 of %2", \
KIO::convertSize(m_transfer->downloadedSize()), \
KIO::convertSize(m_transfer->totalSize())));  }
 
-    if(flags & Transfer::Tc_Percent)
-    {
+    if (flags & Transfer::Tc_Percent) {
         frm.progressBar->setValue(m_transfer->percent());
     }
 
-    if ((flags & Transfer::Tc_DownloadSpeed) && (m_transfer->status() != \
                Job::Finished))
-    {
+    if ((flags & Transfer::Tc_DownloadSpeed) && (m_transfer->status() != \
Job::Finished)) {  int speed = m_transfer->downloadSpeed();
 
-        if(speed==0)
-        {
+        if (speed == 0) {
             if(m_transfer->status() == Job::Running)
                 frm.speedContentLabel->setText(i18n("Stalled") );
             else
                 frm.speedContentLabel->setText(QString());
-        }
-        else
+        } else {
             frm.speedContentLabel->setText(i18n("%1/s", KIO::convertSize(speed)));
     }
+    }
 
-    if(flags & Transfer::Tc_FileName)
-    {
+    if(flags & Transfer::Tc_FileName) {
         frm.destContentEdit->setText(m_transfer->dest().pathOrUrl());
     }
 
+    if (flags & Transfer::Tc_Source) {
+        frm.sourceContentEdit->setText(m_transfer->source().pathOrUrl());
+    }
+
     frm.remainingTimeLabel->setText(KIO::convertSeconds(m_transfer->remainingTime()));
  }
 


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

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