OSDN Git Service

kget: ftp, sftp and http slaves can resume
authorIvailo Monev <xakepa10@gmail.com>
Sat, 26 Mar 2022 06:35:08 +0000 (08:35 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 26 Mar 2022 06:38:51 +0000 (08:38 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kget/transfer-plugins/checksumsearch/checksumsearch.h
kget/transfer-plugins/kio/transferKio.cpp
kget/transfer-plugins/kio/transferKio.h
kget/transfer-plugins/mmsthreads/mmsdownload.cpp

index b62bec3..92ec60c 100644 (file)
@@ -34,7 +34,7 @@ class ChecksumSearch : public QObject
         ~ChecksumSearch();
 
         /**
-         * Used to define in whiche way the url should be changed to try and find
+         * Used to define in which way the url should be changed to try and find
          * Checksums
          */
         enum UrlChangeMode
index 64c097a..6694fc5 100644 (file)
 */
 
 #include "transferKio.h"
-#include "core/verifier.h"
-#include "core/signature.h"
 #include "settings.h"
 
-#include <utime.h>
-
-#include <kiconloader.h>
 #include <kio/scheduler.h>
 #include <KIO/DeleteJob>
 #include <KIO/CopyJob>
 #include <KIO/NetAccess>
 #include <KLocale>
+#include <KProtocolManager>
 #include <KMessageBox>
 #include <KDebug>
 
-#include <QtCore/QFile>
-
 TransferKio::TransferKio(TransferGroup * parent, TransferFactory * factory,
                          Scheduler * scheduler, const KUrl & source, const KUrl & dest,
                          const QDomElement * e)
@@ -36,8 +30,9 @@ TransferKio::TransferKio(TransferGroup * parent, TransferFactory * factory,
       m_signature(nullptr),
       m_filemodel(nullptr)
 {
-    // TODO: check if it really can resume
-    setCapabilities(Transfer::Cap_Resuming);
+    if (KProtocolManager::autoResume()) {
+        setCapabilities(Transfer::Cap_Resuming);
+    }
 }
 
 void TransferKio::start()
@@ -70,7 +65,6 @@ void TransferKio::stop()
 
 void TransferKio::deinit(Transfer::DeleteOptions options)
 {
-    // if the transfer is not finished, we delete the *.part-file
     if (options & Transfer::DeleteFiles) {
         KIO::Job *del = KIO::del(m_dest, KIO::HideProgressInfo);
         KIO::NetAccess::synchronousRun(del, 0);
@@ -208,6 +202,7 @@ void TransferKio::slotResult( KJob * kioJob )
 
 void TransferKio::slotInfoMessage( KJob * kioJob, const QString & msg )
 {
+    kDebug(5001) << "slotInfoMessage";
     Q_UNUSED(kioJob);
 
     setLog(msg, Transfer::Log_Info);
index 189f652..15d66fd 100644 (file)
@@ -16,6 +16,8 @@
 #include <kio/job.h>
 
 #include "core/transfer.h"
+#include "core/verifier.h"
+#include "core/signature.h"
 #include "core/filemodel.h"
 
 /**
@@ -44,11 +46,6 @@ public:
 
     FileModel *fileModel() final;
 
-private:
-    void createJob();
-
-    KIO::FileCopyJob * m_copyjob;
-
 private slots:
     void slotResult( KJob * kioJob );
     void slotInfoMessage( KJob * kioJob, const QString & msg );
@@ -59,6 +56,9 @@ private slots:
     void slotVerified(bool isVerified);
 
 private:
+    void createJob();
+
+    KIO::FileCopyJob * m_copyjob;
     Verifier *m_verifier;
     Signature *m_signature;
     FileModel *m_filemodel;
index 40d15d4..9cad37f 100644 (file)
@@ -69,7 +69,7 @@ bool MmsDownload::isWorkingUrl()
 
 void MmsDownload::splitTransfer()
 {
-    /** We split the download in similar and each part is asigned to a thread and thi is saved in
+    /** We split the download in similar and each part is asigned to a thread and this is saved in
      * a map named m_mapEndIni. If we resume the download, then the temporal file will exist
      * and we dont have to split the download only use it.
      */