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

Fix build with QtWebEngine 5.9

This commit is contained in:
David Rosca 2019-04-18 16:34:59 +02:00
parent 5e6f92f7bc
commit ff9c70dccb
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -36,6 +36,7 @@
#include <QFileIconProvider>
#include <QDesktopServices>
#include <QWebEngineDownloadItem>
#include <QtWebEngineWidgetsVersion>
#ifdef Q_OS_WIN
#include "Shlwapi.h"
@ -234,9 +235,11 @@ void DownloadItem::updateDownloadInfo(double currSpeed, qint64 received, qint64
// | m_remTime | |m_currSize| |m_fileSize| |m_speed|
// Remaining 26 minutes - 339MB of 693 MB (350kB/s)
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (m_download->isPaused()) {
return;
}
#endif
int estimatedTime = ((total - received) / 1024) / (currSpeed / 1024);
QString speed = currentSpeedToString(currSpeed);
@ -280,6 +283,7 @@ void DownloadItem::stop()
void DownloadItem::pauseResume()
{
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (m_download->isPaused()) {
m_download->resume();
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-pause")).pixmap(20, 20));
@ -288,6 +292,7 @@ void DownloadItem::pauseResume()
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-start")).pixmap(20, 20));
ui->downloadInfo->setText(tr("Paused - %1").arg(m_download->url().host()));
}
#endif
}
void DownloadItem::mouseDoubleClickEvent(QMouseEvent* e)
@ -307,11 +312,13 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos)
menu.addSeparator();
menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (m_download->isPaused()) {
menu.addAction(QIcon::fromTheme("media-playback-start"), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
} else {
menu.addAction(QIcon::fromTheme("media-playback-pause"), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
}
#endif
menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);