diff options
author | Johannes Tröscher <fritz_van_tom@hotmail.com> | 2011-08-01 13:55:43 +0200 |
---|---|---|
committer | Johannes Tröscher <fritz_van_tom@hotmail.com> | 2011-08-01 13:55:43 +0200 |
commit | 3014a1d15cce472d7d895fbbaf906dd582cce55f (patch) | |
tree | bb4cdca17fdebaa5e0daa17ccacca9088fef2d7e /src/webview.cpp | |
parent | Copyright year check fixes (waiting for a better regexp...) (diff) | |
download | rekonq-3014a1d15cce472d7d895fbbaf906dd582cce55f.tar.xz |
bookmark this link action in link's context menu REVIEW:102152
Diffstat (limited to 'src/webview.cpp')
-rw-r--r-- | src/webview.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index a938ad70..1490c9bc 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -163,6 +163,11 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); menu.addAction(a); + a = new KAction(KIcon("bookmark-new"), i18n("&Bookmark this Link"), this); + a->setData(result.linkUrl()); + connect(a, SIGNAL(triggered(bool)), this, SLOT(bookmarkLink())); + menu.addAction(a); + menu.addSeparator(); menu.addAction(pageAction(KWebPage::DownloadLinkToDisk)); menu.addAction(pageAction(KWebPage::CopyLinkToClipboard)); @@ -552,6 +557,16 @@ void WebView::openLinkInNewTab() } +void WebView::bookmarkLink() +{ + KAction *a = qobject_cast<KAction*>(sender()); + KUrl url(a->data().toUrl()); + + rApp->bookmarkProvider()->rootGroup().addBookmark(url.prettyUrl(), url); + rApp->bookmarkProvider()->bookmarkManager()->emitChanged(); +} + + void WebView::keyPressEvent(QKeyEvent *event) { if (event->modifiers() == Qt::ControlModifier) |