From 406e0f670aa343c9114cde3da119ddcd76c44192 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 24 May 2015 19:27:53 +0200 Subject: [PATCH] Downloader: Drop code for FTP downloads FTP listing and downloading is now supported by QtWebEngine itself --- src/lib/downloads/downloaditem.cpp | 37 ------------------------------ src/lib/downloads/downloaditem.h | 3 --- 2 files changed, 40 deletions(-) diff --git a/src/lib/downloads/downloaditem.cpp b/src/lib/downloads/downloaditem.cpp index 7dada2647..d3feb6b8c 100644 --- a/src/lib/downloads/downloaditem.cpp +++ b/src/lib/downloads/downloaditem.cpp @@ -25,7 +25,6 @@ #include "networkmanager.h" #include "qztools.h" #include "datapaths.h" -#include "schemehandlers/ftpschemehandler.h" #include #include @@ -49,7 +48,6 @@ DownloadItem::DownloadItem(QListWidgetItem *item, QWebEngineDownloadItem* downlo , ui(new Ui::DownloadItem) , m_item(item) , m_download(downloadItem) - , m_ftpDownloader(0) , m_path(path) , m_fileName(fileName) , m_downUrl(downloadItem->url()) @@ -88,32 +86,6 @@ void DownloadItem::startDownloading() updateDownloadInfo(0, m_download->receivedBytes(), m_download->totalBytes()); } -void DownloadItem::startDownloadingFromFtp(const QUrl &url) -{ -#if QTWEBENGINE_DISABLED - if (!m_outputFile.isOpen() && !m_outputFile.open(QIODevice::WriteOnly)) { - stop(false); - ui->downloadInfo->setText(tr("Error: Cannot write to file!")); - return; - } - - m_ftpDownloader = new FtpDownloader(this); - connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished())); - connect(m_ftpDownloader, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64))); - connect(m_ftpDownloader, SIGNAL(errorOccured(QFtp::Error)), this, SLOT(error())); - connect(m_ftpDownloader, SIGNAL(ftpAuthenticationRequierd(QUrl,QAuthenticator*)), mApp->networkManager(), SLOT(ftpAuthentication(QUrl,QAuthenticator*))); - - m_ftpDownloader->download(url, &m_outputFile); - m_downloading = true; - - QTimer::singleShot(200, this, SLOT(updateDownload())); - - if (m_ftpDownloader->error() != QFtp::NoError) { - error(); - } -#endif -} - void DownloadItem::updateIcon() { if (m_validIcon) @@ -173,10 +145,6 @@ void DownloadItem::finished() ui->button->hide(); ui->frame->hide(); -#if QTWEBENGINE_DISABLED - m_ftpDownloader->deleteLater(); -#endif - m_item->setSizeHint(sizeHint()); m_downloading = false; @@ -289,11 +257,6 @@ void DownloadItem::stop() return; } m_downloadStopped = true; -#if QTWEBENGINE_DISABLED - host = m_ftpDownloader->url().host(); - m_ftpDownloader->abort(); - m_ftpDownloader->close(); -#endif ui->progressBar->hide(); ui->button->hide(); m_item->setSizeHint(sizeHint()); diff --git a/src/lib/downloads/downloaditem.h b/src/lib/downloads/downloaditem.h index 3d34b5bf5..15e3bc75b 100644 --- a/src/lib/downloads/downloaditem.h +++ b/src/lib/downloads/downloaditem.h @@ -36,7 +36,6 @@ class QListWidgetItem; class QWebEngineDownloadItem; class DownloadManager; -class FtpDownloader; class QUPZILLA_EXPORT DownloadItem : public QWidget { @@ -73,7 +72,6 @@ private slots: private: void startDownloading(); - void startDownloadingFromFtp(const QUrl &url); void updateIcon(); void updateDownloadInfo(double currSpeed, qint64 received, qint64 total); @@ -83,7 +81,6 @@ private: QListWidgetItem* m_item; QWebEngineDownloadItem* m_download; - FtpDownloader* m_ftpDownloader; QString m_path; QString m_fileName; QTime m_downTimer;