mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Couple of minor fixes (#13185)
This commit is contained in:
@@ -420,7 +420,9 @@ function ReaderAnnotation:addItem(item)
|
||||
end
|
||||
|
||||
function ReaderAnnotation:onAnnotationsModified(items)
|
||||
items[1].datetime_updated = os.date("%Y-%m-%d %H:%M:%S")
|
||||
if items.update_datetime ~= false then
|
||||
items[1].datetime_updated = os.date("%Y-%m-%d %H:%M:%S")
|
||||
end
|
||||
end
|
||||
|
||||
-- info
|
||||
|
||||
@@ -352,7 +352,7 @@ function ReaderBookmark:toggleBookmark(pageno)
|
||||
}
|
||||
self.ui.annotation:addItem(item)
|
||||
end
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item }))
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, update_datetime = false }))
|
||||
end
|
||||
|
||||
function ReaderBookmark:setDogearVisibility(pn_or_xp)
|
||||
@@ -416,9 +416,9 @@ function ReaderBookmark:removeItemByIndex(index)
|
||||
local item = self.ui.annotation.annotations[index]
|
||||
local item_type = self.getBookmarkType(item)
|
||||
if item_type == "highlight" then
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, nb_highlights_added = -1 }))
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, nb_highlights_added = -1, update_datetime = false }))
|
||||
elseif item_type == "note" then
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, nb_notes_added = -1 }))
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, nb_notes_added = -1, update_datetime = false }))
|
||||
end
|
||||
table.remove(self.ui.annotation.annotations, index)
|
||||
self.view.footer:maybeUpdateFooter()
|
||||
|
||||
@@ -2051,7 +2051,7 @@ function ReaderHighlight:saveHighlight(extend_to_sentence)
|
||||
end
|
||||
local index = self.ui.annotation:addItem(item)
|
||||
self.view.footer:maybeUpdateFooter()
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, nb_highlights_added = 1 }))
|
||||
self.ui:handleEvent(Event:new("AnnotationsModified", { item, nb_highlights_added = 1, update_datetime = false }))
|
||||
return index
|
||||
end
|
||||
end
|
||||
|
||||
@@ -476,7 +476,7 @@ function ReaderUI:init()
|
||||
end
|
||||
|
||||
local summary = self.doc_settings:readSetting("summary", {})
|
||||
if summary.status == nil then
|
||||
if BookList.getBookStatusString(summary.status) == nil then
|
||||
summary.status = "reading"
|
||||
summary.modified = os.date("%Y-%m-%d", os.time())
|
||||
end
|
||||
@@ -518,14 +518,14 @@ function ReaderUI:registerKeyEvents()
|
||||
self.key_events.Home = { { "Home" } }
|
||||
self.key_events.Reload = { { "F5" } }
|
||||
if Device:hasDPad() and Device:useDPadAsActionKeys() then
|
||||
self.key_events.KeyContentSelection = { { { "Up", "Down" } }, event = "StartHighlightIndicator" }
|
||||
self.key_events.StartHighlightIndicator = { { { "Up", "Down" } } }
|
||||
end
|
||||
if Device:hasScreenKB() or Device:hasSymKey() then
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events.KeyToggleWifi = { { "Shift", "Home" }, event = "ToggleWifi" }
|
||||
self.key_events.ToggleWifi = { { "Shift", "Home" } }
|
||||
self.key_events.OpenLastDoc = { { "Shift", "Back" } }
|
||||
else -- Currently exclusively targets Kindle 4.
|
||||
self.key_events.KeyToggleWifi = { { "ScreenKB", "Home" }, event = "ToggleWifi" }
|
||||
self.key_events.ToggleWifi = { { "ScreenKB", "Home" } }
|
||||
self.key_events.OpenLastDoc = { { "ScreenKB", "Back" } }
|
||||
end
|
||||
end
|
||||
@@ -558,8 +558,6 @@ function ReaderUI:getLastDirFile(to_file_browser)
|
||||
end
|
||||
|
||||
function ReaderUI:showFileManager(file, selected_files)
|
||||
local FileManager = require("apps/filemanager/filemanager")
|
||||
|
||||
local last_dir, last_file
|
||||
if file then
|
||||
last_dir = util.splitFilePathName(file)
|
||||
@@ -567,11 +565,8 @@ function ReaderUI:showFileManager(file, selected_files)
|
||||
else
|
||||
last_dir, last_file = self:getLastDirFile(true)
|
||||
end
|
||||
if FileManager.instance then
|
||||
FileManager.instance:reinit(last_dir, last_file)
|
||||
else
|
||||
FileManager:showFiles(last_dir, last_file, selected_files)
|
||||
end
|
||||
local FileManager = require("apps/filemanager/filemanager")
|
||||
FileManager:showFiles(last_dir, last_file, selected_files)
|
||||
end
|
||||
|
||||
function ReaderUI:onShowingReader()
|
||||
|
||||
@@ -28,7 +28,7 @@ function BookList.setBookInfoCache(file, doc_settings)
|
||||
}
|
||||
local summary = doc_settings:readSetting("summary")
|
||||
book_info.status = summary and summary.status
|
||||
if book_info.status == nil or BookList.getBookStatusString(book_info.status) == nil then
|
||||
if BookList.getBookStatusString(book_info.status) == nil then
|
||||
book_info.status = "reading"
|
||||
end
|
||||
local pages = doc_settings:readSetting("doc_pages")
|
||||
@@ -102,16 +102,18 @@ function BookList.getBookStatus(file)
|
||||
return book_info.been_opened and book_info.status or "new"
|
||||
end
|
||||
|
||||
local status_strings = {
|
||||
new = _("New"), -- no sidecar file
|
||||
reading = _("Reading"), -- doc_settings.summary.status
|
||||
abandoned = _("On hold"), -- doc_settings.summary.status
|
||||
complete = _("Finished"), -- doc_settings.summary.status
|
||||
deleted = _("Deleted"),
|
||||
all = _("All"),
|
||||
}
|
||||
|
||||
function BookList.getBookStatusString(status, with_prefix)
|
||||
local status_string = ({
|
||||
new = _("New"), -- no sidecar file
|
||||
reading = _("Reading"), -- doc_settings.summary.status
|
||||
abandoned = _("On hold"), -- doc_settings.summary.status
|
||||
complete = _("Finished"), -- doc_settings.summary.status
|
||||
deleted = _("Deleted"),
|
||||
all = _("All"),
|
||||
})[status]
|
||||
return with_prefix and T(_("Status: %1"), status_string:lower()) or status_string
|
||||
local status_string = status and status_strings[status]
|
||||
return status_string and (with_prefix and T(_("Status: %1"), status_string:lower()) or status_string)
|
||||
end
|
||||
|
||||
return BookList
|
||||
|
||||
Reference in New Issue
Block a user