From 6eeac33ad126152ea9c6e1985b670676d8e5b49e Mon Sep 17 00:00:00 2001 From: Zijie He Date: Thu, 14 Apr 2016 14:13:53 -0700 Subject: [PATCH 1/5] *.sdr folders are not excluded in folder item count Bug #1966 --- frontend/ui/widget/filechooser.lua | 62 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index ad0adb540..641c1c09e 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -37,6 +37,30 @@ function FileChooser:init() end return true end + self.list = function(path, dirs, files) + -- lfs.dir directory without permission will give error + local ok, iter, dir_obj = pcall(lfs.dir, path) + if ok then + for f in iter, dir_obj do + if self.show_hidden or not string.match(f, "^%.[^.]") then + local filename = path.."/"..f + local attributes = lfs.attributes(filename) + if attributes ~= nil then + if attributes.mode == "directory" and f ~= "." and f~=".." then + if self.dir_filter(filename) then + table.insert(dirs, {name = f, attr = attributes}) + end + elseif attributes.mode == "file" then + if self.file_filter == nil or self.file_filter(filename) then + table.insert(files, {name = f, attr = attributes}) + end + end + end + end + end + end + end + -- circumvent string collating in Kobo devices. See issue koreader/koreader#686 if Device:isKobo() then self.strcoll = function(a, b) return a < b end @@ -49,27 +73,7 @@ function FileChooser:genItemTableFromPath(path) local dirs = {} local files = {} - -- lfs.dir directory without permission will give error - local ok, iter, dir_obj = pcall(lfs.dir, self.path) - if ok then - for f in iter, dir_obj do - if self.show_hidden or not string.match(f, "^%.[^.]") then - local filename = self.path.."/"..f - local attributes = lfs.attributes(filename) - if attributes ~= nil then - if attributes.mode == "directory" and f ~= "." and f~=".." then - if self.dir_filter(filename) then - table.insert(dirs, {name = f, attr = attributes}) - end - elseif attributes.mode == "file" then - if self.file_filter(filename) then - table.insert(files, {name = f, attr = attributes}) - end - end - end - end - end - end + self.list(path, dirs, files) local sorting = nil local reverse = self.reverse_collate @@ -99,19 +103,13 @@ function FileChooser:genItemTableFromPath(path) local item_table = {} for i, dir in ipairs(dirs) do + local dirs = {} + local files = {} local subdir_path = self.path.."/"..dir.name - local items = 0 - ok, iter, dir_obj = pcall(lfs.dir, subdir_path) - if ok then - for f in iter, dir_obj do - items = items + 1 - end - -- exclude "." and ".." - items = items - 2 - end + self.list(subdir_path, dirs, files) + local items = #dirs + #files local istr = util.template( - items == 0 and _("0 items") - or items == 1 and _("1 item") + items == 1 and _("1 item") or _("%1 items"), items) table.insert(item_table, { text = dir.name.."/", From bc16ed50357824fe9d6ed5abaa79aba7da0ce3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Fri, 15 Apr 2016 15:04:41 +0200 Subject: [PATCH 2/5] Spelling of calibre and KOReader. Ellipsis. --- frontend/apps/filemanager/filemanagersetdefaults.lua | 2 +- frontend/ui/otamanager.lua | 2 +- frontend/ui/widget/opdsbrowser.lua | 4 ++-- plugins/calibrecompanion.koplugin/main.lua | 2 +- plugins/evernote.koplugin/main.lua | 8 ++++---- plugins/kosync.koplugin/main.lua | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/apps/filemanager/filemanagersetdefaults.lua b/frontend/apps/filemanager/filemanagersetdefaults.lua index e31036101..74292d4ad 100644 --- a/frontend/apps/filemanager/filemanagersetdefaults.lua +++ b/frontend/apps/filemanager/filemanagersetdefaults.lua @@ -363,7 +363,7 @@ function SetDefaults:SaveSettings() end file:close() UIManager:show(InfoMessage:new{ - text = _("Default settings were saved successfully!"), + text = _("Default settings saved."), }) end settings_changed = false diff --git a/frontend/ui/otamanager.lua b/frontend/ui/otamanager.lua index d2be52530..5231407a4 100644 --- a/frontend/ui/otamanager.lua +++ b/frontend/ui/otamanager.lua @@ -142,7 +142,7 @@ function OTAManager:fetchAndProcessUpdate() ), ok_callback = function() UIManager:show(InfoMessage:new{ - text = _("Downloading may take several minutes..."), + text = _("Downloading may take several minutes…"), timeout = 3, }) UIManager:scheduleIn(1, function() diff --git a/frontend/ui/widget/opdsbrowser.lua b/frontend/ui/widget/opdsbrowser.lua index 0f5685a3b..1dcaeb788 100644 --- a/frontend/ui/widget/opdsbrowser.lua +++ b/frontend/ui/widget/opdsbrowser.lua @@ -133,11 +133,11 @@ function OPDSBrowser:editCalibreServer() { -- TODO: get IP address of current device text = calibre.host or "192.168.1.1", - hint = _("Calibre host"), + hint = _("calibre host"), }, { text = calibre.port and tostring(calibre.port) or "8080", - hint = _("Calibre port"), + hint = _("calibre port"), }, }, buttons = { diff --git a/plugins/calibrecompanion.koplugin/main.lua b/plugins/calibrecompanion.koplugin/main.lua index 43143646b..b55b3f220 100644 --- a/plugins/calibrecompanion.koplugin/main.lua +++ b/plugins/calibrecompanion.koplugin/main.lua @@ -81,7 +81,7 @@ end function CalibreCompanion:addToMainMenu(tab_item_table) table.insert(tab_item_table.plugins, { - text = _("Calibre wireless connection"), + text = _("calibre wireless connection"), sub_item_table = { { text_func = function() diff --git a/plugins/evernote.koplugin/main.lua b/plugins/evernote.koplugin/main.lua index 71bf0348a..c90040fbf 100644 --- a/plugins/evernote.koplugin/main.lua +++ b/plugins/evernote.koplugin/main.lua @@ -16,7 +16,7 @@ local MyClipping = require("clip") local EvernoteExporter = InputContainer:new{ name = "evernote", login_title = _("Login to Evernote"), - notebook_name = _("Koreader Notes"), + notebook_name = _("KOReader Notes"), evernote_domain = nil, notemarks = _("Note: "), clipping_dir = DataStorage:getDataDir() .. "/clipboard", @@ -94,7 +94,7 @@ function EvernoteExporter:addToMainMenu(tab_item_table) end) UIManager:show(InfoMessage:new{ - text = _("Exporting may take several seconds..."), + text = _("Exporting may take several seconds…"), timeout = 1, }) end @@ -110,7 +110,7 @@ function EvernoteExporter:addToMainMenu(tab_item_table) end) UIManager:show(InfoMessage:new{ - text = _("Exporting may take several minutes..."), + text = _("Exporting may take several minutes…"), timeout = 1, }) end @@ -153,7 +153,7 @@ function EvernoteExporter:login() end) UIManager:show(InfoMessage:new{ - text = _("Logging in. Please wait..."), + text = _("Logging in. Please wait…"), timeout = 1, }) end, diff --git a/plugins/kosync.koplugin/main.lua b/plugins/kosync.koplugin/main.lua index fd548d7b6..ed8a1d14b 100644 --- a/plugins/kosync.koplugin/main.lua +++ b/plugins/kosync.koplugin/main.lua @@ -119,7 +119,7 @@ function KOSync:login() end) UIManager:show(InfoMessage:new{ - text = _("Logging in. Please wait..."), + text = _("Logging in. Please wait…"), timeout = 1, }) end, @@ -135,7 +135,7 @@ function KOSync:login() end) UIManager:show(InfoMessage:new{ - text = _("Registering. Please wait..."), + text = _("Registering. Please wait…"), timeout = 1, }) end, @@ -299,7 +299,7 @@ function KOSync:getProgress(manual) }) elseif manual and body.progress == progress then UIManager:show(InfoMessage:new{ - text = _("We are already synchronized."), + text = _("Already synchronized."), timeout = 3, }) end From 273fbb2ec34c616ea4a390f76b36e94558b3410d Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Thu, 14 Apr 2016 17:24:40 +0200 Subject: [PATCH 3/5] Bump base --- base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base b/base index 8e39d6149..3ca13f3f2 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 8e39d61493257c05fe039f34fa1a6e3ae5f0eab6 +Subproject commit 3ca13f3f2cb1f3267ce5c7fa309c29a345387f12 From dfe321d87a66e5ca39299552868526a7cd2d9ed8 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Thu, 14 Apr 2016 17:36:06 +0200 Subject: [PATCH 4/5] Fix a hasFrontLight call in reader.lua... (it's a function, not a bool ;'( ). Fix #1961 --- reader.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader.lua b/reader.lua index 117dac0c3..1f14dc5e6 100755 --- a/reader.lua +++ b/reader.lua @@ -117,7 +117,7 @@ end -- restore kobo frontlight settings and probe kobo touch coordinates if Device:isKobo() then - if Device.hasFrontlight then + if Device:hasFrontlight() then local powerd = Device:getPowerDevice() if powerd and powerd.restore_settings then -- UIManager:init() should have sanely set up the frontlight_stuff by this point From d4e5746eb3fe78c38c619f8a2d3bf0522a14bf35 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Thu, 14 Apr 2016 21:05:19 +0200 Subject: [PATCH 5/5] Unbreak toggling the fL on Kindles Fix #1960 --- frontend/device/kindle/powerd.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/device/kindle/powerd.lua b/frontend/device/kindle/powerd.lua index de1e80213..644a27a41 100644 --- a/frontend/device/kindle/powerd.lua +++ b/frontend/device/kindle/powerd.lua @@ -27,8 +27,10 @@ end function KindlePowerD:toggleFrontlight() local sysint = self:read_int_file(self.fl_intensity_file) if sysint == 0 then - self:setIntensity(self.fl_intensity) + -- NOTE: We want to bypass setIntensity's shenanigans and simply restore the light as-is + self:setIntensityHW() else + -- NOTE: We want to really kill the light, so do it manually (asking lipc to set it to 0 would in fact set it to 1)... os.execute("echo -n 0 > " .. self.fl_intensity_file) end end