From 88a1c5b30d6ff07c9a3d0a9644ed02a4b8090d4b Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 19 Dec 2020 08:27:14 +0200 Subject: Bookmark a link via context menu --- src/ui/documentwidget.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3f3e453a..1830239a 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -2325,10 +2325,18 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e format_CStr("!open noproxy:1 url:%s", cstr_String(linkUrl)) } }, 2); } + iString *linkLabel = collect_String(newRange_String(d->contextLink->text)); + urlEncodeSpaces_String(linkLabel); pushBackN_Array(&items, (iMenuItem[]){ { "---", 0, 0, NULL }, - { "Copy Link", 0, 0, "document.copylink" } }, - 2); + { "Copy Link", 0, 0, "document.copylink" }, + { "Bookmark Link...", + 0, + 0, + format_CStr("!bookmark.add title:%s url:%s", + cstr_String(linkLabel), + cstr_String(linkUrl)) } }, + 3); iMediaRequest *mediaReq; if ((mediaReq = findMediaRequest_DocumentWidget_(d, d->contextLink->linkId)) != NULL) { if (isFinished_GmRequest(mediaReq->req)) { -- cgit v1.2.3