1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Downloader: Drop code for FTP downloads

FTP listing and downloading is now supported by QtWebEngine itself
This commit is contained in:
David Rosca 2015-05-24 19:27:53 +02:00
parent 278b725571
commit 406e0f670a
2 changed files with 0 additions and 40 deletions

View File

@ -25,7 +25,6 @@
#include "networkmanager.h" #include "networkmanager.h"
#include "qztools.h" #include "qztools.h"
#include "datapaths.h" #include "datapaths.h"
#include "schemehandlers/ftpschemehandler.h"
#include <QMenu> #include <QMenu>
#include <QClipboard> #include <QClipboard>
@ -49,7 +48,6 @@ DownloadItem::DownloadItem(QListWidgetItem *item, QWebEngineDownloadItem* downlo
, ui(new Ui::DownloadItem) , ui(new Ui::DownloadItem)
, m_item(item) , m_item(item)
, m_download(downloadItem) , m_download(downloadItem)
, m_ftpDownloader(0)
, m_path(path) , m_path(path)
, m_fileName(fileName) , m_fileName(fileName)
, m_downUrl(downloadItem->url()) , m_downUrl(downloadItem->url())
@ -88,32 +86,6 @@ void DownloadItem::startDownloading()
updateDownloadInfo(0, m_download->receivedBytes(), m_download->totalBytes()); 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() void DownloadItem::updateIcon()
{ {
if (m_validIcon) if (m_validIcon)
@ -173,10 +145,6 @@ void DownloadItem::finished()
ui->button->hide(); ui->button->hide();
ui->frame->hide(); ui->frame->hide();
#if QTWEBENGINE_DISABLED
m_ftpDownloader->deleteLater();
#endif
m_item->setSizeHint(sizeHint()); m_item->setSizeHint(sizeHint());
m_downloading = false; m_downloading = false;
@ -289,11 +257,6 @@ void DownloadItem::stop()
return; return;
} }
m_downloadStopped = true; m_downloadStopped = true;
#if QTWEBENGINE_DISABLED
host = m_ftpDownloader->url().host();
m_ftpDownloader->abort();
m_ftpDownloader->close();
#endif
ui->progressBar->hide(); ui->progressBar->hide();
ui->button->hide(); ui->button->hide();
m_item->setSizeHint(sizeHint()); m_item->setSizeHint(sizeHint());

View File

@ -36,7 +36,6 @@ class QListWidgetItem;
class QWebEngineDownloadItem; class QWebEngineDownloadItem;
class DownloadManager; class DownloadManager;
class FtpDownloader;
class QUPZILLA_EXPORT DownloadItem : public QWidget class QUPZILLA_EXPORT DownloadItem : public QWidget
{ {
@ -73,7 +72,6 @@ private slots:
private: private:
void startDownloading(); void startDownloading();
void startDownloadingFromFtp(const QUrl &url);
void updateIcon(); void updateIcon();
void updateDownloadInfo(double currSpeed, qint64 received, qint64 total); void updateDownloadInfo(double currSpeed, qint64 received, qint64 total);
@ -83,7 +81,6 @@ private:
QListWidgetItem* m_item; QListWidgetItem* m_item;
QWebEngineDownloadItem* m_download; QWebEngineDownloadItem* m_download;
FtpDownloader* m_ftpDownloader;
QString m_path; QString m_path;
QString m_fileName; QString m_fileName;
QTime m_downTimer; QTime m_downTimer;