From 0a06041cd9c68e68dad773c782b0aecd356fcc16 Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 25 Nov 2014 17:43:28 +0800 Subject: [PATCH 1/2] fix calculation of widget height of filechooser the height of filechooser is provided when creating filechooser widget since there may be no title as in filemanger which needs a special title widget to contain filemanger menu. --- frontend/ui/downloadmgr.lua | 2 ++ frontend/ui/widget/filechooser.lua | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/ui/downloadmgr.lua b/frontend/ui/downloadmgr.lua index 36ed14022..54e517d31 100644 --- a/frontend/ui/downloadmgr.lua +++ b/frontend/ui/downloadmgr.lua @@ -1,5 +1,6 @@ local PathChooser = require("ui/widget/pathchooser") local UIManager = require("ui/uimanager") +local Screen = require("device").screen local util = require("ffi/util") local _ = require("gettext") @@ -20,6 +21,7 @@ function DownloadMgr:chooseDir() local download_dir = G_reader_settings:readSetting("download_dir") local path_chooser = PathChooser:new{ title = self.title, + height = Screen:getHeight(), path = download_dir and (download_dir .. "/..") or lastdir, show_hidden = G_reader_settings:readSetting("show_hidden"), onConfirm = function(path) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index e0f663def..06f9007f5 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -31,7 +31,6 @@ local FileChooser = Menu:extend{ function FileChooser:init() self.width = Screen:getWidth() - self.height = Screen:getHeight() -- common dir filter self.dir_filter = function(dirname) for _, pattern in ipairs(self.exclude_dirs) do From 1accddb8cdcdfe3f1e8c3461b31f38d6039050b6 Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 25 Nov 2014 17:49:26 +0800 Subject: [PATCH 2/2] fix #1236 by opening the parent directory of last used document --- frontend/apps/reader/modules/readermenu.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readermenu.lua b/frontend/apps/reader/modules/readermenu.lua index c19b75174..bfd4516bc 100644 --- a/frontend/apps/reader/modules/readermenu.lua +++ b/frontend/apps/reader/modules/readermenu.lua @@ -45,7 +45,12 @@ function ReaderMenu:init() local FileManager = require("apps/filemanager/filemanager") FileManager:restoreScreenMode() if not FileManager.is_running then - FileManager:showFiles() + local lastdir = nil + local last_file = G_reader_settings:readSetting("lastfile") + if last_file then + lastdir = last_file:match("(.*)/") + end + FileManager:showFiles(lastdir) end end, },