mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user