1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[WebView] Bookmark Link action now uses a.title as bookmark title

Closes #1131
This commit is contained in:
nowrep 2014-01-26 11:21:53 +01:00
parent 142407be21
commit 3b097c8da1

View File

@ -589,7 +589,10 @@ void WebView::bookmarkLink()
mApp->browsingLibrary()->bookmarksManager()->addBookmark(this); mApp->browsingLibrary()->bookmarksManager()->addBookmark(this);
} }
else { else {
mApp->browsingLibrary()->bookmarksManager()->insertBookmark(action->data().toUrl(), title(), icon()); const QVariantList bData = action->data().value<QVariantList>();
const QString bookmarkTitle = bData.at(1).toString().isEmpty() ? title() : bData.at(1).toString();
mApp->browsingLibrary()->bookmarksManager()->insertBookmark(bData.at(0).toUrl(), bookmarkTitle, icon());
} }
} }
} }
@ -991,7 +994,11 @@ void WebView::createLinkContextMenu(QMenu* menu, const QWebHitTestResult &hitTes
menu->addAction(act); menu->addAction(act);
menu->addAction(QIcon::fromTheme("window-new"), tr("Open link in new &window"), this, SLOT(openUrlInNewWindow()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("window-new"), tr("Open link in new &window"), this, SLOT(openUrlInNewWindow()))->setData(hitTest.linkUrl());
menu->addSeparator(); menu->addSeparator();
menu->addAction(qIconProvider->fromTheme("bookmark-new"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(hitTest.linkUrl());
QVariantList bData;
bData << hitTest.linkUrl() << hitTest.linkTitle();
menu->addAction(qIconProvider->fromTheme("bookmark-new"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(bData);
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadUrlToDisk()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadUrlToDisk()))->setData(hitTest.linkUrl());
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send link..."), this, SLOT(sendLinkByMail()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send link..."), this, SLOT(sendLinkByMail()))->setData(hitTest.linkUrl());
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.linkUrl());