Commit 71c970a6 authored by Andrea Diamantini's avatar Andrea Diamantini
Browse files

"Save as..." context menu action entry for images

BUG: 303357
parent ca4cb062
......@@ -38,6 +38,7 @@
// Local Includes
#include "adblockmanager.h"
#include "bookmarkmanager.h"
#include "downloadmanager.h"
#include "iconmanager.h"
#include "searchengine.h"
......@@ -411,7 +412,10 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers)));
menu.addAction(a);
menu.addAction(pageAction(KWebPage::DownloadImageToDisk));
a = new KAction(KIcon("document-save"), i18n("Save image as..."), this);
a->setData(m_contextMenuHitResult.imageUrl());
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(saveImage()));
menu.addAction(a);
a = new KAction(KIcon("view-media-visualization"), i18n("&Copy Image Location"), this);
a->setData(m_contextMenuHitResult.imageUrl());
......@@ -767,6 +771,7 @@ void WebView::openLinkInNewTab()
emit loadUrl(url, Rekonq::NewFocusedTab);
}
void WebView::openLinkInPrivateWindow()
{
KAction *a = qobject_cast<KAction*>(sender());
......@@ -775,6 +780,7 @@ void WebView::openLinkInPrivateWindow()
emit loadUrl(url, Rekonq::NewPrivateWindow);
}
void WebView::bookmarkLink()
{
KAction *a = qobject_cast<KAction*>(sender());
......@@ -1478,3 +1484,17 @@ WebTab *WebView::parentTab()
{
return m_parentTab;
}
void WebView::saveImage()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl imageUrl(a->data().toUrl());
DownloadManager::self()->downloadResource( imageUrl,
KIO::MetaData(),
this,
true,
QString(),
!settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled));
}
......@@ -109,6 +109,7 @@ private Q_SLOTS:
void slotSpellCheckDone(const QString&);
void sendByMail();
void saveImage();
void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
void slotCopyImageLocation();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment