[UX] Gesture manager: add action - folder shortcuts (#4733)

See #4727.
pull/4736/head
Frans de Jonge 5 years ago committed by GitHub
parent bcb0b6e120
commit bae83ad663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -345,6 +345,7 @@ function FileManager:init()
ui = self,
})
table.insert(self, FileManagerFileSearcher:new{ ui = self })
table.insert(self, FileManagerShortcuts:new{ ui = self })
table.insert(self, ReaderDictionary:new{ ui = self })
table.insert(self, ReaderWikipedia:new{ ui = self })
table.insert(self, ReaderDeviceStatus:new{ ui = self })
@ -479,17 +480,7 @@ function FileManager:tapPlus()
{
text = _("Folder shortcuts"),
callback = function()
local fm_bookmark = FileManagerShortcuts:new{
title = _("Folder shortcuts"),
show_parent = self,
curr_path = self.file_chooser.path,
goFolder = function(folder)
if folder ~= nil and lfs.attributes(folder, "mode") == "directory" then
self.file_chooser:changeToPath(folder)
end
end,
}
UIManager:show(fm_bookmark)
self:handleEvent(Event:new("ShowFolderShortcutsDialog"))
UIManager:close(self.file_dialog)
end
}

@ -189,4 +189,18 @@ function FileManagerShortcuts:deleteFolderShortcut(item)
self:init()
end
function FileManagerShortcuts:onShowFolderShortcutsDialog()
local fm_bookmark = FileManagerShortcuts:new{
title = _("Folder shortcuts"),
show_parent = self.ui,
curr_path = self.ui.file_chooser.path,
goFolder = function(folder)
if folder ~= nil and lfs.attributes(folder, "mode") == "directory" then
self.ui.file_chooser:changeToPath(folder)
end
end,
}
UIManager:show(fm_bookmark)
end
return FileManagerShortcuts

@ -68,6 +68,7 @@ local action_strings = {
zoom_page = _("Zoom to fit page"),
folder_up = _("Folder up"),
folder_shortcuts = _("Folder shortcuts"),
}
local custom_multiswipes_path = DataStorage:getSettingsDir().."/multiswipes.lua"
@ -135,7 +136,8 @@ function ReaderGesture:init()
multiswipe_west_east = self.ges_mode == "gesture_reader" and "previous_location" or "nothing",
multiswipe_east_west = self.ges_mode == "gesture_reader" and "latest_bookmark" or "nothing",
multiswipe_north_east = self.ges_mode == "gesture_reader" and "toc" or "nothing",
multiswipe_north_west = self.ges_mode == "gesture_fm" and "folder_up" or "bookmarks",
multiswipe_north_west = self.ges_mode == "gesture_reader" and "bookmarks" or "folder_shortcuts",
multiswipe_north_south = self.ges_mode == "gesture_reader" and "nothing" or "folder_up",
multiswipe_east_north = "history",
multiswipe_east_south = "go_to",
multiswipe_south_north = self.ges_mode == "gesture_reader" and "skim" or "nothing",
@ -297,7 +299,8 @@ function ReaderGesture:buildMenu(ges, default)
{"follow_nearest_link", not self.is_docless},
{"clear_location_history", not self.is_docless, true},
{"folder_up", self.is_docless, true},
{"folder_up", self.is_docless},
{"folder_shortcuts", self.is_docless, true},
{ "toc", not self.is_docless},
{"bookmarks", not self.is_docless},
@ -636,6 +639,8 @@ function ReaderGesture:gestureAction(action, ges)
end
elseif action == "folder_up" then
self.ui.file_chooser:changeToPath(string.format("%s/..", self.ui.file_chooser.path))
elseif action == "folder_shortcuts" then
self.ui:handleEvent(Event:new("ShowFolderShortcutsDialog"))
elseif action == "open_previous_document" then
-- FileManager
if self.ui.menu.openLastDoc and G_reader_settings:readSetting("lastfile") ~= nil then

Loading…
Cancel
Save