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

Added option to save image to disk from Site Info dialog.

Added dialog to ask what to do with about to download file. User can
open/save it.
This commit is contained in:
nowrep 2011-03-24 22:31:38 +01:00
parent 4aed402d09
commit b879bdaed8
16 changed files with 984 additions and 582 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
build build
DEBIAN DEBIAN
tools_ tools_
src0.* QupZilla-old-src.tar.gz
*.deb *.deb
*.pro.user *.pro.user
headers*.tar.gz headers*.tar.gz

Binary file not shown.

View File

@ -669,7 +669,7 @@ void QupZilla::savePage()
QNetworkRequest request(weView()->url()); QNetworkRequest request(weView()->url());
DownloadManager* dManager = mApp->downManager(); DownloadManager* dManager = mApp->downManager();
dManager->download(request); dManager->download(request, false);
} }
void QupZilla::printPage() void QupZilla::printPage()

View File

@ -18,7 +18,7 @@
#include "downloaditem.h" #include "downloaditem.h"
#include "ui_downloaditem.h" #include "ui_downloaditem.h"
DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString path, QString fileName, QPixmap fileIcon, QWidget* parent) DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString path, QString fileName, QPixmap fileIcon, bool openAfterFinishedDownload, QWidget* parent)
: QWidget(parent) : QWidget(parent)
,ui(new Ui::DownloadItem) ,ui(new Ui::DownloadItem)
,m_item(item) ,m_item(item)
@ -26,6 +26,7 @@ DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString
,m_path(path) ,m_path(path)
,m_fileName(fileName) ,m_fileName(fileName)
,m_downloading(false) ,m_downloading(false)
,m_openAfterFinish(openAfterFinishedDownload)
{ {
QString fullPath = path+fileName; QString fullPath = path+fileName;
if (QFile::exists(fullPath)) if (QFile::exists(fullPath))
@ -91,6 +92,9 @@ void DownloadItem::finished()
ui->button->hide(); ui->button->hide();
#endif #endif
m_downloading = false; m_downloading = false;
if (m_openAfterFinish)
openFile();
} }
void DownloadItem::downloadProgress(qint64 received, qint64 total) void DownloadItem::downloadProgress(qint64 received, qint64 total)

View File

@ -42,7 +42,7 @@ class DownloadItem : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit DownloadItem(QListWidgetItem* item, QNetworkReply* reply ,QString path, QString fileName, QPixmap fileIcon, QWidget* parent = 0); explicit DownloadItem(QListWidgetItem* item, QNetworkReply* reply ,QString path, QString fileName, QPixmap fileIcon, bool openAfterFinishedDownload, QWidget* parent = 0);
bool isDownloading() { return m_downloading; } bool isDownloading() { return m_downloading; }
bool isCancelled(); bool isCancelled();
QTime remainingTime() { return m_remTime; } QTime remainingTime() { return m_remTime; }
@ -86,6 +86,7 @@ private:
QFile m_outputFile; QFile m_outputFile;
bool m_downloading; bool m_downloading;
bool m_openAfterFinish;
double m_currSpeed; double m_currSpeed;
qint64 m_received; qint64 m_received;
qint64 m_total; qint64 m_total;

View File

@ -129,34 +129,53 @@ void DownloadManager::clearList()
qDeleteAll(items); qDeleteAll(items);
} }
void DownloadManager::download(const QNetworkRequest &request) void DownloadManager::download(const QNetworkRequest &request, bool askWhatToDo)
{ {
handleUnsupportedContent(m_networkManager->get(request)); handleUnsupportedContent(m_networkManager->get(request), askWhatToDo);
} }
void DownloadManager::handleUnsupportedContent(QNetworkReply* reply) void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, bool askWhatToDo)
{ {
// DownloadOptionsDialog* dialog = new DownloadOptionsDialog();
// dialog->show();
// dialog->setAttribute(Qt::WA_DeleteOnClose);
QString path; QString path;
QString fileName; QString fileName;
QString userFileName; QString userFileName;
QString _fileName = getFileName(reply); QString _fileName = getFileName(reply);
if (m_downloadPath.isEmpty()) QFileInfo info(reply->url().toString());
userFileName = QFileDialog::getSaveFileName(mApp->getWindow(), tr("Save file as..."),m_lastDownloadPath+_fileName); QTemporaryFile tempFile("XXXXXX."+info.suffix());
else tempFile.open();
userFileName = m_downloadPath+_fileName; QFileInfo tempInfo(tempFile.fileName());
QPixmap fileIcon = m_iconProvider->icon(tempInfo).pixmap(30,30);
QString mimeType = m_iconProvider->type(tempInfo);
if (userFileName.isEmpty()) { bool openFileOptionsChoosed = false;
reply->abort(); if (askWhatToDo) {
return; DownloadOptionsDialog* dialog = new DownloadOptionsDialog(_fileName, fileIcon, mimeType, reply->url(), mApp->activeWindow());
switch (dialog->exec()) {
case 0: //Cancelled
return;
break;
case 1: //Open
openFileOptionsChoosed = true;
break;
case 2: //Save
break;
}
} }
if (!openFileOptionsChoosed) {
if (m_downloadPath.isEmpty())
userFileName = QFileDialog::getSaveFileName(mApp->getWindow(), tr("Save file as..."),m_lastDownloadPath+_fileName);
else
userFileName = m_downloadPath+_fileName;
if (userFileName.isEmpty()) {
reply->abort();
return;
}
} else
userFileName = QDir::tempPath()+"/"+_fileName;
int pos = userFileName.lastIndexOf("/"); int pos = userFileName.lastIndexOf("/");
if (pos!=-1) { if (pos!=-1) {
int size = userFileName.size(); int size = userFileName.size();
@ -164,20 +183,16 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply)
fileName = userFileName.right(size-pos-1); fileName = userFileName.right(size-pos-1);
} }
m_lastDownloadPath = path; if (!path.contains(QDir::tempPath()))
m_lastDownloadPath = path;
QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat);
settings.beginGroup("DownloadManager"); settings.beginGroup("DownloadManager");
settings.setValue("lastDownloadPath",m_lastDownloadPath); settings.setValue("lastDownloadPath",m_lastDownloadPath);
settings.endGroup(); settings.endGroup();
QFileInfo info(reply->url().toString());
QTemporaryFile tempFile("XXXXXX."+info.suffix());
tempFile.open();
QFileInfo tempInfo(tempFile.fileName());
QPixmap fileIcon = m_iconProvider->icon(tempInfo).pixmap(30,30);
QListWidgetItem* item = new QListWidgetItem(ui->list); QListWidgetItem* item = new QListWidgetItem(ui->list);
DownloadItem* downItem = new DownloadItem(item, reply, path, fileName, fileIcon, this); DownloadItem* downItem = new DownloadItem(item, reply, path, fileName, fileIcon, openFileOptionsChoosed, this);
connect(downItem, SIGNAL(deleteItem(DownloadItem*)), this, SLOT(deleteItem(DownloadItem*))); connect(downItem, SIGNAL(deleteItem(DownloadItem*)), this, SLOT(deleteItem(DownloadItem*)));
ui->list->setItemWidget(item, downItem); ui->list->setItemWidget(item, downItem);
item->setSizeHint(downItem->sizeHint()); item->setSizeHint(downItem->sizeHint());

View File

@ -53,8 +53,8 @@ public:
explicit DownloadManager(QWidget* parent = 0); explicit DownloadManager(QWidget* parent = 0);
~DownloadManager(); ~DownloadManager();
void download(const QNetworkRequest &request); void download(const QNetworkRequest &request, bool askWhatToDo = true);
void handleUnsupportedContent(QNetworkReply* reply); void handleUnsupportedContent(QNetworkReply* reply, bool askWhatToDo = true);
bool canClose(); bool canClose();
void show() { m_timer.start(1000*2, this); QWidget::show(); } void show() { m_timer.start(1000*2, this); QWidget::show(); }

View File

@ -18,11 +18,27 @@
#include "downloadoptionsdialog.h" #include "downloadoptionsdialog.h"
#include "ui_downloadoptionsdialog.h" #include "ui_downloadoptionsdialog.h"
DownloadOptionsDialog::DownloadOptionsDialog(QWidget* parent) : DownloadOptionsDialog::DownloadOptionsDialog(QString fileName, QPixmap fileIcon, QString mimeType, QUrl url, QWidget *parent)
QDialog(parent), : QDialog(parent)
ui(new Ui::DownloadOptionsDialog) ,ui(new Ui::DownloadOptionsDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->fileName->setText("<b>"+fileName+"</b>");
ui->fileIcon->setPixmap(fileIcon);
ui->fileType->setText(mimeType);
ui->fromServer->setText(url.host());
setWindowTitle(tr("Opening %1").arg(fileName));
}
int DownloadOptionsDialog::exec()
{
int status = QDialog::exec();
if (status == 0)
return 0;
else if (ui->radioOpen->isChecked())
return 1;
else if (ui->radioSave->isChecked())
return 2;
} }
DownloadOptionsDialog::~DownloadOptionsDialog() DownloadOptionsDialog::~DownloadOptionsDialog()

View File

@ -19,6 +19,8 @@
#define DOWNLOADOPTIONSDIALOG_H #define DOWNLOADOPTIONSDIALOG_H
#include <QDialog> #include <QDialog>
#include <QUrl>
#include <QDebug>
namespace Ui { namespace Ui {
class DownloadOptionsDialog; class DownloadOptionsDialog;
@ -29,9 +31,11 @@ class DownloadOptionsDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit DownloadOptionsDialog(QWidget* parent = 0); explicit DownloadOptionsDialog(QString fileName, QPixmap fileIcon, QString mimeType, QUrl url, QWidget* parent = 0);
~DownloadOptionsDialog(); ~DownloadOptionsDialog();
int exec();
private: private:
Ui::DownloadOptionsDialog* ui; Ui::DownloadOptionsDialog* ui;
}; };

View File

@ -7,17 +7,38 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>416</width> <width>416</width>
<height>279</height> <height>263</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Opening</string> <string>Opening</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../icons.qrc"> <iconset resource="../data/icons.qrc">
<normaloff>:/icons/qupzilla.png</normaloff>:/icons/qupzilla.png</iconset> <normaloff>:/icons/qupzilla.png</normaloff>:/icons/qupzilla.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="6">
<widget class="QLabel" name="label">
<property name="text">
<string>You have chosen to open</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3">
<widget class="QLabel" name="fileIcon">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1" colspan="4">
<widget class="QLabel" name="fileName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1" colspan="4"> <item row="2" column="1" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -66,65 +87,27 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="0" colspan="5"> <item row="3" column="5">
<widget class="QLabel" name="label"> <spacer name="horizontalSpacer_2">
<property name="text"> <property name="orientation">
<string>You have chosen to open</string> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
<item row="6" column="0" colspan="5"> <item row="7" column="0" colspan="5">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>&lt;b&gt;What should QupZilla do with this file?&lt;/b&gt;</string> <string>&lt;b&gt;What should QupZilla do with this file?&lt;/b&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1" colspan="4"> <item row="8" column="0">
<widget class="QRadioButton" name="radioOpen">
<property name="text">
<string>Open...</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1" colspan="4">
<widget class="QRadioButton" name="radioSave">
<property name="text">
<string>Save File</string>
</property>
</widget>
</item>
<item row="9" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="4">
<widget class="QLabel" name="fileName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fileIcon">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -140,20 +123,24 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="5"> <item row="8" column="1" colspan="4">
<spacer name="horizontalSpacer_2"> <widget class="QRadioButton" name="radioOpen">
<property name="orientation"> <property name="text">
<enum>Qt::Horizontal</enum> <string>Open...</string>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="checked">
<size> <bool>true</bool>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> </widget>
</item> </item>
<item row="10" column="0" colspan="6"> <item row="9" column="1" colspan="4">
<widget class="QRadioButton" name="radioSave">
<property name="text">
<string>Save File</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="6">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -163,10 +150,36 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="../icons.qrc"/> <include location="../data/icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>

View File

@ -74,7 +74,7 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
if (alt.isEmpty()) { if (alt.isEmpty()) {
if (src.indexOf("/") == -1) if (src.indexOf("/") == -1)
alt = src; alt = src;
else{ else {
int pos = src.lastIndexOf("/"); int pos = src.lastIndexOf("/");
alt = src.mid(pos); alt = src.mid(pos);
alt.remove("/"); alt.remove("/");
@ -113,6 +113,61 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
connect(ui->secDetailsButton, SIGNAL(clicked()), this, SLOT(securityDetailsClicked())); connect(ui->secDetailsButton, SIGNAL(clicked()), this, SLOT(securityDetailsClicked()));
connect(ui->treeImages, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showImagePreview(QTreeWidgetItem*))); connect(ui->treeImages, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showImagePreview(QTreeWidgetItem*)));
ui->treeImages->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->treeImages, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(imagesCustomContextMenuRequested(const QPoint&)));
}
void SiteInfo::imagesCustomContextMenuRequested(const QPoint& p)
{
QTreeWidgetItem* item = ui->treeImages->itemAt(p);
if (!item)
return;
QMenu menu;
menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Image Location"), this, SLOT(copyActionData()))->setData(item->text(1));
menu.addAction(tr("Copy Image Name"), this, SLOT(copyActionData()))->setData(item->text(0));
menu.addSeparator();
menu.addAction(QIcon::fromTheme("document-save"), tr("Save Image to Disk"), this, SLOT(downloadImage()))->setData(ui->treeImages->indexOfTopLevelItem(item));
menu.exec(QCursor::pos());
}
void SiteInfo::copyActionData()
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
qApp->clipboard()->setText(action->data().toString());
}
}
void SiteInfo::downloadImage()
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
QTreeWidgetItem* item = ui->treeImages->topLevelItem(action->data().toInt());
if (!item)
return;
QUrl imageUrl = item->text(1);
if (imageUrl.host().isEmpty()) {
imageUrl.setHost(QUrl(ui->siteAddress->text()).host());
imageUrl.setScheme(QUrl(ui->siteAddress->text()).scheme());
}
QIODevice* cacheData = mApp->networkCache()->data(imageUrl);
if (!cacheData) {
QMessageBox::warning(this, tr("Error!"), tr("This preview is not available!"));
return;
}
QString filePath = QFileDialog::getSaveFileName(this, tr("Save image..."), QDir::homePath()+"/"+item->text(0));
if (filePath.isEmpty())
return;
QFile file(filePath);
if (!file.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("Error!"), tr("Cannot write to file!"));
return;
}
file.write(cacheData->readAll());
file.close();
}
} }
void SiteInfo::showImagePreview(QTreeWidgetItem *item) void SiteInfo::showImagePreview(QTreeWidgetItem *item)
@ -120,16 +175,27 @@ void SiteInfo::showImagePreview(QTreeWidgetItem *item)
if (!item) if (!item)
return; return;
QUrl imageUrl = item->text(1); QUrl imageUrl = item->text(1);
if (imageUrl.host().isEmpty()) {
imageUrl.setHost(QUrl(ui->siteAddress->text()).host());
imageUrl.setScheme(QUrl(ui->siteAddress->text()).scheme());
}
QIODevice* cacheData = mApp->networkCache()->data(imageUrl); QIODevice* cacheData = mApp->networkCache()->data(imageUrl);
QPixmap pixmap; QPixmap pixmap;
bool invalidPixmap = false;
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
if (!cacheData) if (!cacheData)
pixmap.load(":/icons/qupzilla.png"); invalidPixmap = true;
else else {
pixmap.loadFromData(cacheData->readAll()); pixmap.loadFromData(cacheData->readAll());
if (pixmap.isNull())
invalidPixmap = true;
}
if (invalidPixmap)
scene->addText(tr("Preview not available"));
else
scene->addPixmap(pixmap);
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
scene->addPixmap(pixmap);
ui->mediaPreview->setScene(scene); ui->mediaPreview->setScene(scene);
} }

View File

@ -21,6 +21,7 @@
#include <QDialog> #include <QDialog>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QGraphicsItem>
namespace Ui { namespace Ui {
class SiteInfo; class SiteInfo;
@ -40,6 +41,10 @@ private slots:
void showImagePreview(QTreeWidgetItem* item); void showImagePreview(QTreeWidgetItem* item);
void securityDetailsClicked(); void securityDetailsClicked();
void imagesCustomContextMenuRequested(const QPoint& p);
void copyActionData();
void downloadImage();
private: private:
Ui::SiteInfo* ui; Ui::SiteInfo* ui;
QupZilla* p_QupZilla; QupZilla* p_QupZilla;

View File

@ -197,7 +197,7 @@
</item> </item>
<item row="3" column="0" colspan="4"> <item row="3" column="0" colspan="4">
<widget class="QTreeWidget" name="treeTags"> <widget class="QTreeWidget" name="treeTags">
<attribute name="headerDefaultSectionSize"> <attribute name="headerMinimumSectionSize">
<number>200</number> <number>200</number>
</attribute> </attribute>
<column> <column>
@ -286,16 +286,22 @@
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTreeWidget" name="treeImages"> <widget class="QTreeWidget" name="treeImages">
<property name="minimumSize">
<size>
<width>0</width>
<height>110</height>
</size>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>150</height> <height>110</height>
</size> </size>
</property> </property>
<property name="itemsExpandable"> <property name="itemsExpandable">
<bool>false</bool> <bool>false</bool>
</property> </property>
<attribute name="headerDefaultSectionSize"> <attribute name="headerMinimumSectionSize">
<number>200</number> <number>200</number>
</attribute> </attribute>
<column> <column>

View File

@ -407,7 +407,7 @@ void WebView::contextMenuEvent(QContextMenuEvent* event)
menu->addAction(tr("Copy image"), this, SLOT(copyImageToClipboard()))->setData(r.imageUrl()); menu->addAction(tr("Copy image"), this, SLOT(copyImageToClipboard()))->setData(r.imageUrl());
menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image address"), this, SLOT(copyLinkToClipboard()))->setData(r.imageUrl()); menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image address"), this, SLOT(copyLinkToClipboard()))->setData(r.imageUrl());
menu->addSeparator(); menu->addSeparator();
menu->addAction(QIcon::fromTheme("document-save"), tr("Save image as..."), this, SLOT(downloadImageToDisk())); menu->addAction(QIcon::fromTheme("document-save"), tr("Save image as..."), this, SLOT(downloadImageToDisk()))->setData(r.imageUrl());
menu->addAction(tr("Send image..."), this, SLOT(sendLinkByMail()))->setData(r.linkUrl()); menu->addAction(tr("Send image..."), this, SLOT(sendLinkByMail()))->setData(r.linkUrl());
menu->addSeparator(); menu->addSeparator();
//menu->addAction(tr("Block image"), this, SLOT(blockImage()))->setData(r.imageUrl().toString()); //menu->addAction(tr("Block image"), this, SLOT(blockImage()))->setData(r.imageUrl().toString());
@ -539,7 +539,11 @@ void WebView::selectAll()
void WebView::downloadImageToDisk() void WebView::downloadImageToDisk()
{ {
triggerPageAction(QWebPage::DownloadImageToDisk); if (QAction* action = qobject_cast<QAction*>(sender())) {
DownloadManager* dManager = mApp->downManager();
QNetworkRequest request(action->data().toUrl());
dManager->download(request, false);
}
} }
void WebView::copyImageToClipboard() void WebView::copyImageToClipboard()
@ -564,7 +568,7 @@ void WebView::downloadLinkToDisk()
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
QNetworkRequest request(action->data().toUrl()); QNetworkRequest request(action->data().toUrl());
DownloadManager* dManager = mApp->downManager(); DownloadManager* dManager = mApp->downManager();
dManager->download(request); dManager->download(request, false);
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff