Dict & wiki history: use filename when no book title (#3635)

This commit is contained in:
poire-z
2018-01-29 09:46:50 +01:00
committed by Frans de Jonge
parent b840a01144
commit e7377cd20e
2 changed files with 12 additions and 0 deletions

View File

@@ -611,6 +611,12 @@ function ReaderDictionary:stardictLookup(word, dict_names, fuzzy_search, box, li
if not self.disable_lookup_history then
local book_title = self.ui.doc_settings and self.ui.doc_settings:readSetting("doc_props").title or _("Dictionary lookup")
if book_title == "" then -- no or empty metadata title
if self.ui.document and self.ui.document.file then
local directory, filename = util.splitFilePathName(self.ui.document.file) -- luacheck: no unused
book_title = util.splitFileNameSuffix(filename)
end
end
lookup_history:addTableItem("lookup_history", {
book_title = book_title,
time = os.time(),

View File

@@ -379,6 +379,12 @@ function ReaderWikipedia:lookupWikipedia(word, box, get_fullpage, forced_lang)
if not self.disable_history then
local book_title = self.ui.doc_settings and self.ui.doc_settings:readSetting("doc_props").title or _("Wikipedia lookup")
if book_title == "" then -- no or empty metadata title
if self.ui.document and self.ui.document.file then
local directory, filename = util.splitFilePathName(self.ui.document.file) -- luacheck: no unused
book_title = util.splitFileNameSuffix(filename)
end
end
wikipedia_history:addTableItem("wikipedia_history", {
book_title = book_title,
time = os.time(),