PathChooser: clearer usage and behaviour (#4133)

Explicit new options: select_directory, select_file, show_files.
With select_directory, show an entry to select current directory
(so, removed undocumented hack "hold on .. to select current
directory").
This commit is contained in:
poire-z
2018-08-06 20:59:01 +02:00
committed by GitHub
parent 0732379130
commit 1d18b01cf7
4 changed files with 126 additions and 34 deletions

View File

@@ -191,7 +191,7 @@ function ReaderWikipedia:addToMainMenu(menu_items)
},
{
{
text = _("Change (select directory by long-pressing)"),
text = _("Select another directory"),
callback = function()
UIManager:close(dialog)
-- Use currently read book's directory as starting point,
@@ -218,15 +218,10 @@ function ReaderWikipedia:addToMainMenu(menu_items)
end
local PathChooser = require("ui/widget/pathchooser")
local path_chooser = PathChooser:new{
title = _("Wikipedia 'Save as EPUB' directory"),
select_directory = true,
select_file = false,
path = dir,
show_hidden = G_reader_settings:readSetting("show_hidden"),
onConfirm = function(path)
-- hack to remove additional parent
if path:sub(-3, -1) == "/.." then
path = path:sub(1, -4)
end
path = require("ffi/util").realpath(path)
G_reader_settings:saveSetting("wikipedia_save_dir", path)
UIManager:show(InfoMessage:new{
text = T(_("Wikipedia 'Save as EPUB' directory set to:\n%1"), path),