mirror of
https://github.com/koreader/koreader.git
synced 2025-12-18 12:02:09 +01:00
chore: style cleanup for infomessage
This commit is contained in:
committed by
Frans de Jonge
parent
0b47c81b1a
commit
23c2955500
@@ -122,7 +122,7 @@ function CloudStorage:openCloudServer(url)
|
||||
table.remove(self.paths)
|
||||
return false
|
||||
else
|
||||
UIManager:show(InfoMessage:new{text = _("Empty folder") })
|
||||
UIManager:show(InfoMessage:new{ text = _("Empty folder") })
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ function DropBox:downloadFile(item, password, path, close)
|
||||
})
|
||||
else
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Could not save file to:\n") .. path,
|
||||
text = T(_("Could not save file to:\n%1"), path),
|
||||
timeout = 3,
|
||||
})
|
||||
end
|
||||
@@ -81,7 +81,7 @@ function DropBox:config(item, callback)
|
||||
{
|
||||
text = _("Info"),
|
||||
callback = function()
|
||||
UIManager:show(InfoMessage:new{text = text_info })
|
||||
UIManager:show(InfoMessage:new{ text = text_info })
|
||||
end
|
||||
},
|
||||
{
|
||||
@@ -99,7 +99,9 @@ function DropBox:config(item, callback)
|
||||
self.settings_dialog:onClose()
|
||||
UIManager:close(self.settings_dialog)
|
||||
else
|
||||
UIManager:show(InfoMessage:new{text = "Please fill in all fields." })
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Please fill in all fields.")
|
||||
})
|
||||
end
|
||||
end
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@ function Ftp:downloadFile(item, address, user, pass, path, close)
|
||||
})
|
||||
else
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Could not save file to:\n") .. path,
|
||||
text = T(_("Could not save file to:\n%1"), path),
|
||||
timeout = 3,
|
||||
})
|
||||
end
|
||||
@@ -114,7 +114,7 @@ function Ftp:config(item, callback)
|
||||
{
|
||||
text = _("Info"),
|
||||
callback = function()
|
||||
UIManager:show(InfoMessage:new{text = text_info })
|
||||
UIManager:show(InfoMessage:new{ text = text_info })
|
||||
end
|
||||
},
|
||||
{
|
||||
@@ -132,7 +132,9 @@ function Ftp:config(item, callback)
|
||||
self.settings_dialog:onClose()
|
||||
UIManager:close(self.settings_dialog)
|
||||
else
|
||||
UIManager:show(InfoMessage:new{text = "Please fill in all fields." })
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Please fill in all fields.")
|
||||
})
|
||||
end
|
||||
end
|
||||
},
|
||||
|
||||
@@ -482,16 +482,16 @@ function FileManager:renameFile(file)
|
||||
})
|
||||
else
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = util.template(_(
|
||||
"Failed to move history data of %1 to %2.\n" ..
|
||||
"The reading history may be lost."), file, dest),
|
||||
text = util.template(
|
||||
_("Failed to move history data of %1 to %2.\nThe reading history may be lost."),
|
||||
file, dest),
|
||||
})
|
||||
end
|
||||
end
|
||||
else
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = util.template(
|
||||
_("Failed to rename from %1 to %2"), file, dest),
|
||||
_("Failed to rename from %1 to %2"), file, dest),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,7 +98,8 @@ function FileSearcher:close()
|
||||
else
|
||||
UIManager:show(
|
||||
InfoMessage:new{
|
||||
text = util.template(_("Found no files matching '%1'."), self.search_value)
|
||||
text = util.template(_("Found no files matching '%1'."),
|
||||
self.search_value)
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
@@ -209,7 +209,11 @@ function Search:ShowSearch()
|
||||
UIManager:show(self.search_dialog)
|
||||
else
|
||||
if self.error then
|
||||
UIManager:show(InfoMessage:new{text = self.error .. ("\n") .. _( "Unable to find a calibre metadata file."),})
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = ("%s\n%s"):format(
|
||||
self.error,
|
||||
_("Unable to find a calibre metadata file.")),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -472,38 +476,39 @@ function Search:find(option)
|
||||
self:browse(option,1)
|
||||
end
|
||||
else
|
||||
UIManager:show(InfoMessage:new{text = T(_("No match for %1."), self.search_value)})
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("No match for %1."), self.search_value)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function Search:onMenuHold(item)
|
||||
if string.len(item.info or "") > 0 then
|
||||
if item.notchecked then
|
||||
item.info = item.info .. item.path
|
||||
local f = io.open(item.path)
|
||||
if f == nil then
|
||||
item.info = item.info .. "\n" .. _("File not found!")
|
||||
else
|
||||
item.info = item.info .. "\n" .. _("Size:") .. " " .. string.format("%4.1fM",lfs.attributes(item.path, "size")/1024/1024)
|
||||
f:close()
|
||||
end
|
||||
item.notchecked = false
|
||||
end
|
||||
local thumbnail = nil
|
||||
local doc = DocumentRegistry:openDocument(item.path)
|
||||
if doc then
|
||||
thumbnail = doc:getCoverPageImage()
|
||||
doc:close()
|
||||
end
|
||||
local thumbwidth = math.min(240, Screen:getWidth()/3)
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = item.info,
|
||||
image = thumbnail,
|
||||
image_width = thumbwidth,
|
||||
image_height = thumbwidth/2*3
|
||||
})
|
||||
if not item.info or item.info:len() <= 0 then return end
|
||||
|
||||
if item.notchecked then
|
||||
item.info = item.info .. item.path
|
||||
local f = io.open(item.path)
|
||||
if f == nil then
|
||||
item.info = item.info .. "\n" .. _("File not found!")
|
||||
else
|
||||
item.info = item.info .. "\n" .. _("Size:") .. " " .. string.format("%4.1fM",lfs.attributes(item.path, "size")/1024/1024)
|
||||
f:close()
|
||||
end
|
||||
item.notchecked = false
|
||||
end
|
||||
local thumbnail
|
||||
local doc = DocumentRegistry:openDocument(item.path)
|
||||
if doc then
|
||||
thumbnail = doc:getCoverPageImage()
|
||||
doc:close()
|
||||
end
|
||||
local thumbwidth = math.min(240, Screen:getWidth()/3)
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = item.info,
|
||||
image = thumbnail,
|
||||
image_width = thumbwidth,
|
||||
image_height = thumbwidth/2*3
|
||||
})
|
||||
end
|
||||
|
||||
function Search:showresults()
|
||||
|
||||
@@ -232,7 +232,8 @@ function ReaderDictionary:onUpdateDefaultDict(dict)
|
||||
logger.dbg("make default dictionary:", dict)
|
||||
self.default_dictionary = dict
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("%1 is now the default dictionary for this document."), dict),
|
||||
text = T(_("%1 is now the default dictionary for this document."),
|
||||
dict),
|
||||
timeout = 2,
|
||||
})
|
||||
return true
|
||||
|
||||
@@ -268,9 +268,7 @@ function MenuItem:onUnfocus()
|
||||
end
|
||||
|
||||
function MenuItem:onShowItemDetail()
|
||||
UIManager:show(InfoMessage:new{
|
||||
text=self.detail,
|
||||
})
|
||||
UIManager:show(InfoMessage:new{ text = self.detail, })
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user