From 0fe58c59f393473b8b9a56c647e84c27051964f5 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 29 Jan 2021 18:46:56 +0200 Subject: Allow importing remote bookmarks Importing bookmarks should be allowed to create local copies of remote bookmarks, so that one can add any locally missing bookmarks from a shared remote source. --- src/ui/documentwidget.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 68f3c966..87a55dcb 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -2005,8 +2005,14 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) /* Find links that aren't already bookmarked. */ iForEach(PtrArray, i, links) { const iGmRun *run = i.ptr; - if (findUrl_Bookmarks(bookmarks_App(), linkUrl_GmDocument(d->doc, run->linkId))) { - remove_PtrArrayIterator(&i); + uint32_t bmid; + if ((bmid = findUrl_Bookmarks(bookmarks_App(), + linkUrl_GmDocument(d->doc, run->linkId))) != 0) { + const iBookmark *bm = get_Bookmarks(bookmarks_App(), bmid); + /* We can import local copies of remote bookmarks. */ + if (!hasTag_Bookmark(bm, "remote")) { + remove_PtrArrayIterator(&i); + } } } if (!isEmpty_PtrArray(links)) { -- cgit v1.2.3