From 0e7f1ba31767949d83df0ed58895b20fd67b8cfa Mon Sep 17 00:00:00 2001 From: smartscripts-nl Date: Mon, 31 Aug 2020 11:47:37 +0200 Subject: [PATCH] Dispatcher: adds Texteditor: open last file (#6600) --- frontend/dispatcher.lua | 3 +++ plugins/texteditor.koplugin/main.lua | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/frontend/dispatcher.lua b/frontend/dispatcher.lua index 43f9a74af..03667fce7 100644 --- a/frontend/dispatcher.lua +++ b/frontend/dispatcher.lua @@ -77,6 +77,7 @@ local settingsList = { calibre_search = { category="none", event="CalibreSearch", title=_("Search in calibre metadata"), device=true,}, calibre_browse_tags = { category="none", event="CalibreBrowseTags", title=_("Browse all calibre tags"), device=true,}, calibre_browse_series = { category="none", event="CalibreBrowseSeries", title=_("Browse all calibre series"), device=true, separator=true,}, + edit_last_edited_file = { category = "none", event = "OpenLastEditedFile", title = 'Texteditor: open last file', device = true, separator = true, }, favorites = { category="none", event="ShowColl", arg="favorites", title=_("Favorites"), device=true,}, -- filemanager settings @@ -207,6 +208,8 @@ local dispatcher_menu_order = { "calibre_browse_tags", "calibre_browse_series", + "edit_last_edited_file", + "rotation_mode", -- filemanager diff --git a/plugins/texteditor.koplugin/main.lua b/plugins/texteditor.koplugin/main.lua index 7172aa6b3..95f272850 100644 --- a/plugins/texteditor.koplugin/main.lua +++ b/plugins/texteditor.koplugin/main.lua @@ -575,4 +575,15 @@ Do you want to keep this file as empty, or do you prefer to delete it? -- will hardly ever be readonly). end +-- reopen last edited file. Invokeable with gesture: +function TextEditor:onOpenLastEditedFile() + self:loadSettings() + if #self.history > 0 then + local file_path = self.history[1] + self:checkEditFile(file_path, true) + else + self:chooseFile() + end +end + return TextEditor