summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp55
1 files changed, 34 insertions, 21 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 417da6bc..ac6f4566 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -67,6 +67,11 @@ WebView::WebView(QWidget* parent)
}
+WebView::~WebView()
+{
+}
+
+
WebPage *WebView::page()
{
if(!m_page)
@@ -179,7 +184,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if(!engine.isEmpty())
{
service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
- const QString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter;
+ const QString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter; // FIXME crashed
data.setData(searchProviderPrefix + "some keyword");
a = new KAction(service->name(), this);
a->setIcon(Application::icon(KUrl(data.uri())));
@@ -188,7 +193,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
searchMenu->addAction(a);
}
}
- menu.addAction(searchMenu);
+
+ if (!searchMenu->menu()->isEmpty())
+ {
+ menu.addAction(searchMenu);
+ }
+
menu.addSeparator();
// TODO Add translate, show translation
}
@@ -198,7 +208,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
menu.addSeparator();
- // TODO Add "View Image" && remove copy_this_image action
+ // TODO remove copy_this_image action
+ a = new KAction(KIcon("view-media-visualization"), i18n("&View Image"), this);
+ a->setData(result.imageUrl());
+ connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers)));
+ menu.addAction(a);
+
a = pageAction(QWebPage::DownloadImageToDisk);
a->setIcon(KIcon("document-save"));
menu.addAction(a);
@@ -304,24 +319,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
-void WebView::keyPressEvent(QKeyEvent *event)
-{
- if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab))
- {
- emit ctrlTabPressed();
- return;
- }
-
- if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab))
- {
- emit shiftCtrlTabPressed();
- return;
- }
-
- QWebView::keyPressEvent(event);
-}
-
-
void WebView::mousePressEvent(QMouseEvent *event)
{
m_page->m_pressedButtons = event->buttons();
@@ -382,6 +379,22 @@ void WebView::printFrame()
}
+void WebView::viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+{
+ KAction *a = qobject_cast<KAction*>(sender());
+ KUrl url(a->data().toUrl());
+
+ if (modifiers & Qt::ControlModifier || buttons == Qt::MidButton)
+ {
+ Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
+ }
+ else
+ {
+ Application::instance()->loadUrl(url, Rekonq::CurrentTab);
+ }
+}
+
+
void WebView::openLinkInNewWindow()
{
KAction *a = qobject_cast<KAction*>(sender());