mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 10:16: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:
parent
4aed402d09
commit
b879bdaed8
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,7 @@
|
||||
build
|
||||
DEBIAN
|
||||
tools_
|
||||
src0.*
|
||||
QupZilla-old-src.tar.gz
|
||||
*.deb
|
||||
*.pro.user
|
||||
headers*.tar.gz
|
||||
|
Binary file not shown.
@ -669,7 +669,7 @@ void QupZilla::savePage()
|
||||
QNetworkRequest request(weView()->url());
|
||||
|
||||
DownloadManager* dManager = mApp->downManager();
|
||||
dManager->download(request);
|
||||
dManager->download(request, false);
|
||||
}
|
||||
|
||||
void QupZilla::printPage()
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "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)
|
||||
,ui(new Ui::DownloadItem)
|
||||
,m_item(item)
|
||||
@ -26,6 +26,7 @@ DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString
|
||||
,m_path(path)
|
||||
,m_fileName(fileName)
|
||||
,m_downloading(false)
|
||||
,m_openAfterFinish(openAfterFinishedDownload)
|
||||
{
|
||||
QString fullPath = path+fileName;
|
||||
if (QFile::exists(fullPath))
|
||||
@ -91,6 +92,9 @@ void DownloadItem::finished()
|
||||
ui->button->hide();
|
||||
#endif
|
||||
m_downloading = false;
|
||||
|
||||
if (m_openAfterFinish)
|
||||
openFile();
|
||||
}
|
||||
|
||||
void DownloadItem::downloadProgress(qint64 received, qint64 total)
|
||||
|
@ -42,7 +42,7 @@ class DownloadItem : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
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 isCancelled();
|
||||
QTime remainingTime() { return m_remTime; }
|
||||
@ -86,6 +86,7 @@ private:
|
||||
QFile m_outputFile;
|
||||
|
||||
bool m_downloading;
|
||||
bool m_openAfterFinish;
|
||||
double m_currSpeed;
|
||||
qint64 m_received;
|
||||
qint64 m_total;
|
||||
|
@ -129,34 +129,53 @@ void DownloadManager::clearList()
|
||||
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 fileName;
|
||||
|
||||
QString userFileName;
|
||||
|
||||
QString _fileName = getFileName(reply);
|
||||
|
||||
if (m_downloadPath.isEmpty())
|
||||
userFileName = QFileDialog::getSaveFileName(mApp->getWindow(), tr("Save file as..."),m_lastDownloadPath+_fileName);
|
||||
else
|
||||
userFileName = m_downloadPath+_fileName;
|
||||
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);
|
||||
QString mimeType = m_iconProvider->type(tempInfo);
|
||||
|
||||
if (userFileName.isEmpty()) {
|
||||
reply->abort();
|
||||
return;
|
||||
bool openFileOptionsChoosed = false;
|
||||
if (askWhatToDo) {
|
||||
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("/");
|
||||
if (pos!=-1) {
|
||||
int size = userFileName.size();
|
||||
@ -164,20 +183,16 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply)
|
||||
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);
|
||||
settings.beginGroup("DownloadManager");
|
||||
settings.setValue("lastDownloadPath",m_lastDownloadPath);
|
||||
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);
|
||||
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*)));
|
||||
ui->list->setItemWidget(item, downItem);
|
||||
item->setSizeHint(downItem->sizeHint());
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
explicit DownloadManager(QWidget* parent = 0);
|
||||
~DownloadManager();
|
||||
|
||||
void download(const QNetworkRequest &request);
|
||||
void handleUnsupportedContent(QNetworkReply* reply);
|
||||
void download(const QNetworkRequest &request, bool askWhatToDo = true);
|
||||
void handleUnsupportedContent(QNetworkReply* reply, bool askWhatToDo = true);
|
||||
bool canClose();
|
||||
|
||||
void show() { m_timer.start(1000*2, this); QWidget::show(); }
|
||||
|
@ -18,11 +18,27 @@
|
||||
#include "downloadoptionsdialog.h"
|
||||
#include "ui_downloadoptionsdialog.h"
|
||||
|
||||
DownloadOptionsDialog::DownloadOptionsDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DownloadOptionsDialog)
|
||||
DownloadOptionsDialog::DownloadOptionsDialog(QString fileName, QPixmap fileIcon, QString mimeType, QUrl url, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
,ui(new Ui::DownloadOptionsDialog)
|
||||
{
|
||||
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()
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define DOWNLOADOPTIONSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Ui {
|
||||
class DownloadOptionsDialog;
|
||||
@ -29,9 +31,11 @@ class DownloadOptionsDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DownloadOptionsDialog(QWidget* parent = 0);
|
||||
explicit DownloadOptionsDialog(QString fileName, QPixmap fileIcon, QString mimeType, QUrl url, QWidget* parent = 0);
|
||||
~DownloadOptionsDialog();
|
||||
|
||||
int exec();
|
||||
|
||||
private:
|
||||
Ui::DownloadOptionsDialog* ui;
|
||||
};
|
||||
|
@ -7,17 +7,38 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>416</width>
|
||||
<height>279</height>
|
||||
<height>263</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Opening</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<iconset resource="../data/icons.qrc">
|
||||
<normaloff>:/icons/qupzilla.png</normaloff>:/icons/qupzilla.png</iconset>
|
||||
</property>
|
||||
<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">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@ -66,65 +87,27 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>You have chosen to open</string>
|
||||
<item row="3" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="5">
|
||||
<item row="7" column="0" colspan="5">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><b>What should QupZilla do with this file?</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="4">
|
||||
<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">
|
||||
<item row="8" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -140,20 +123,24 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="8" column="1" colspan="4">
|
||||
<widget class="QRadioButton" name="radioOpen">
|
||||
<property name="text">
|
||||
<string>Open...</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -163,10 +150,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="../data/icons.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -74,7 +74,7 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
if (alt.isEmpty()) {
|
||||
if (src.indexOf("/") == -1)
|
||||
alt = src;
|
||||
else{
|
||||
else {
|
||||
int pos = src.lastIndexOf("/");
|
||||
alt = src.mid(pos);
|
||||
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->secDetailsButton, SIGNAL(clicked()), this, SLOT(securityDetailsClicked()));
|
||||
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)
|
||||
@ -120,16 +175,27 @@ void SiteInfo::showImagePreview(QTreeWidgetItem *item)
|
||||
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);
|
||||
QPixmap pixmap;
|
||||
bool invalidPixmap = false;
|
||||
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
|
||||
|
||||
if (!cacheData)
|
||||
pixmap.load(":/icons/qupzilla.png");
|
||||
else
|
||||
invalidPixmap = true;
|
||||
else {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QGraphicsItem>
|
||||
|
||||
namespace Ui {
|
||||
class SiteInfo;
|
||||
@ -40,6 +41,10 @@ private slots:
|
||||
void showImagePreview(QTreeWidgetItem* item);
|
||||
void securityDetailsClicked();
|
||||
|
||||
void imagesCustomContextMenuRequested(const QPoint& p);
|
||||
void copyActionData();
|
||||
void downloadImage();
|
||||
|
||||
private:
|
||||
Ui::SiteInfo* ui;
|
||||
QupZilla* p_QupZilla;
|
||||
|
@ -197,7 +197,7 @@
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QTreeWidget" name="treeTags">
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>200</number>
|
||||
</attribute>
|
||||
<column>
|
||||
@ -286,16 +286,22 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeWidget" name="treeImages">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>110</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>150</height>
|
||||
<height>110</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>200</number>
|
||||
</attribute>
|
||||
<column>
|
||||
|
@ -407,7 +407,7 @@ void WebView::contextMenuEvent(QContextMenuEvent* event)
|
||||
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->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->addSeparator();
|
||||
//menu->addAction(tr("Block image"), this, SLOT(blockImage()))->setData(r.imageUrl().toString());
|
||||
@ -539,7 +539,11 @@ void WebView::selectAll()
|
||||
|
||||
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()
|
||||
@ -564,7 +568,7 @@ void WebView::downloadLinkToDisk()
|
||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
||||
QNetworkRequest request(action->data().toUrl());
|
||||
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
Loading…
Reference in New Issue
Block a user