Skip to content

Commit

Permalink
[UX] Gesture manager: add action - folder shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenzie committed Mar 4, 2019
1 parent c5b2bad commit b6b4e30
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
13 changes: 2 additions & 11 deletions frontend/apps/filemanager/filemanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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
}
Expand Down
14 changes: 14 additions & 0 deletions frontend/apps/filemanager/filemanagershortcuts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions frontend/apps/reader/modules/readergesture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6b4e30

Please sign in to comment.