mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #2129 from Hzj-jie/master
Add folder name in file manager
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local FileManagerHistory = require("apps/filemanager/filemanagerhistory")
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local FrameContainer = require("ui/widget/container/framecontainer")
|
||||
local CenterContainer = require("ui/widget/container/centercontainer")
|
||||
local FileManagerMenu = require("apps/filemanager/filemanagermenu")
|
||||
local DocumentRegistry = require("document/documentregistry")
|
||||
local VerticalGroup = require("ui/widget/verticalgroup")
|
||||
@@ -58,11 +59,20 @@ local FileManager = InputContainer:extend{
|
||||
function FileManager:init()
|
||||
self.show_parent = self.show_parent or self
|
||||
|
||||
self.path_text = TextWidget:new{
|
||||
face = Font:getFace("infofont", 18),
|
||||
text = self.root_path,
|
||||
}
|
||||
|
||||
self.banner = VerticalGroup:new{
|
||||
TextWidget:new{
|
||||
face = Font:getFace("tfont", 24),
|
||||
text = self.title,
|
||||
},
|
||||
CenterContainer:new{
|
||||
dimen = { w = Screen:getWidth(), h = nil },
|
||||
self.path_text,
|
||||
},
|
||||
VerticalSpan:new{ width = Screen:scaleBySize(10) }
|
||||
}
|
||||
|
||||
@@ -88,6 +98,11 @@ function FileManager:init()
|
||||
}
|
||||
self.file_chooser = file_chooser
|
||||
|
||||
function file_chooser:onPathChanged(path) -- luacheck: ignore
|
||||
FileManager.instance.path_text:setText(path)
|
||||
return true
|
||||
end
|
||||
|
||||
function file_chooser:onFileSelect(file) -- luacheck: ignore
|
||||
FileManager.instance:onClose()
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
|
||||
@@ -20,7 +20,6 @@ local FileChooser = Menu:extend{
|
||||
path = lfs.currentdir(),
|
||||
parent = nil,
|
||||
show_hidden = nil,
|
||||
filter = function(filename) return true end,
|
||||
exclude_dirs = {"%.sdr$"},
|
||||
strcoll = strcoll,
|
||||
collate = "strcoll", -- or collate = "access",
|
||||
@@ -33,7 +32,7 @@ function FileChooser:init()
|
||||
-- common dir filter
|
||||
self.dir_filter = function(dirname)
|
||||
for _, pattern in ipairs(self.exclude_dirs) do
|
||||
if dirname:match(pattern) then return end
|
||||
if dirname:match(pattern) then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -161,6 +160,7 @@ function FileChooser:changeToPath(path)
|
||||
path = util.realpath(path)
|
||||
self.path = path
|
||||
self:refreshPath()
|
||||
self:onPathChanged(path)
|
||||
end
|
||||
|
||||
function FileChooser:toggleHiddenFiles()
|
||||
@@ -203,4 +203,8 @@ function FileChooser:onFileHold(file)
|
||||
return true
|
||||
end
|
||||
|
||||
function FileChooser:onPathChanged(path)
|
||||
return true
|
||||
end
|
||||
|
||||
return FileChooser
|
||||
|
||||
Reference in New Issue
Block a user