From 082e818e67844ea03792477ef959495fc19701f6 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Tue, 13 May 2025 18:09:51 +0300 Subject: [PATCH] Annotations export/import: merge (keep existing annotations) (#13751) --- frontend/apps/reader/modules/readerannotation.lua | 2 +- frontend/apps/reader/modules/readerbookmark.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerannotation.lua b/frontend/apps/reader/modules/readerannotation.lua index b497b41b4..ae940f58e 100644 --- a/frontend/apps/reader/modules/readerannotation.lua +++ b/frontend/apps/reader/modules/readerannotation.lua @@ -282,7 +282,7 @@ function ReaderAnnotation:importAnnotations() if anno:readSetting("device_id") == G_reader_settings:readSetting("device_id") then return end -- same device local new_annotations = anno:readSetting("annotations") if (self.ui.paging and true) ~= anno:readSetting("paging") then return end -- incompatible annotations type - local new_datetime = anno:readSetting("datetime") + local new_datetime = G_reader_settings:isTrue("annotations_export_keep_all_on_import") and "" or anno:readSetting("datetime") os.remove(file) if #self.annotations == 0 then self.annotations = new_annotations diff --git a/frontend/apps/reader/modules/readerbookmark.lua b/frontend/apps/reader/modules/readerbookmark.lua index b74e5b9da..f05a6d176 100644 --- a/frontend/apps/reader/modules/readerbookmark.lua +++ b/frontend/apps/reader/modules/readerbookmark.lua @@ -252,6 +252,15 @@ function ReaderBookmark:addToMainMenu(menu_items) G_reader_settings:flipNilOrFalse("annotations_export_on_closing") end, }, + { + text = _("Keep all annotations on import"), + checked_func = function() + return G_reader_settings:isTrue("annotations_export_keep_all_on_import") + end, + callback = function() + G_reader_settings:flipNilOrFalse("annotations_export_keep_all_on_import") + end, + }, { text_func = function() return T(_("Export / import folder: %1"),