chore: style cleanup for infomessage

This commit is contained in:
Qingping Hou
2017-05-08 00:26:01 -07:00
committed by Frans de Jonge
parent 0b47c81b1a
commit 23c2955500
8 changed files with 52 additions and 43 deletions

View File

@@ -122,7 +122,7 @@ function CloudStorage:openCloudServer(url)
table.remove(self.paths) table.remove(self.paths)
return false return false
else else
UIManager:show(InfoMessage:new{text = _("Empty folder") }) UIManager:show(InfoMessage:new{ text = _("Empty folder") })
return false return false
end end
end end

View File

@@ -27,7 +27,7 @@ function DropBox:downloadFile(item, password, path, close)
}) })
else else
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
text = _("Could not save file to:\n") .. path, text = T(_("Could not save file to:\n%1"), path),
timeout = 3, timeout = 3,
}) })
end end
@@ -81,7 +81,7 @@ function DropBox:config(item, callback)
{ {
text = _("Info"), text = _("Info"),
callback = function() callback = function()
UIManager:show(InfoMessage:new{text = text_info }) UIManager:show(InfoMessage:new{ text = text_info })
end end
}, },
{ {
@@ -99,7 +99,9 @@ function DropBox:config(item, callback)
self.settings_dialog:onClose() self.settings_dialog:onClose()
UIManager:close(self.settings_dialog) UIManager:close(self.settings_dialog)
else else
UIManager:show(InfoMessage:new{text = "Please fill in all fields." }) UIManager:show(InfoMessage:new{
text = _("Please fill in all fields.")
})
end end
end end
}, },

View File

@@ -48,7 +48,7 @@ function Ftp:downloadFile(item, address, user, pass, path, close)
}) })
else else
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
text = _("Could not save file to:\n") .. path, text = T(_("Could not save file to:\n%1"), path),
timeout = 3, timeout = 3,
}) })
end end
@@ -114,7 +114,7 @@ function Ftp:config(item, callback)
{ {
text = _("Info"), text = _("Info"),
callback = function() callback = function()
UIManager:show(InfoMessage:new{text = text_info }) UIManager:show(InfoMessage:new{ text = text_info })
end end
}, },
{ {
@@ -132,7 +132,9 @@ function Ftp:config(item, callback)
self.settings_dialog:onClose() self.settings_dialog:onClose()
UIManager:close(self.settings_dialog) UIManager:close(self.settings_dialog)
else else
UIManager:show(InfoMessage:new{text = "Please fill in all fields." }) UIManager:show(InfoMessage:new{
text = _("Please fill in all fields.")
})
end end
end end
}, },

View File

@@ -482,9 +482,9 @@ function FileManager:renameFile(file)
}) })
else else
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
text = util.template(_( text = util.template(
"Failed to move history data of %1 to %2.\n" .. _("Failed to move history data of %1 to %2.\nThe reading history may be lost."),
"The reading history may be lost."), file, dest), file, dest),
}) })
end end
end end

View File

@@ -98,7 +98,8 @@ function FileSearcher:close()
else else
UIManager:show( UIManager:show(
InfoMessage:new{ 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 end

View File

@@ -209,7 +209,11 @@ function Search:ShowSearch()
UIManager:show(self.search_dialog) UIManager:show(self.search_dialog)
else else
if self.error then 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
end end
@@ -472,12 +476,15 @@ function Search:find(option)
self:browse(option,1) self:browse(option,1)
end end
else 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
end end
function Search:onMenuHold(item) function Search:onMenuHold(item)
if string.len(item.info or "") > 0 then if not item.info or item.info:len() <= 0 then return end
if item.notchecked then if item.notchecked then
item.info = item.info .. item.path item.info = item.info .. item.path
local f = io.open(item.path) local f = io.open(item.path)
@@ -489,7 +496,7 @@ function Search:onMenuHold(item)
end end
item.notchecked = false item.notchecked = false
end end
local thumbnail = nil local thumbnail
local doc = DocumentRegistry:openDocument(item.path) local doc = DocumentRegistry:openDocument(item.path)
if doc then if doc then
thumbnail = doc:getCoverPageImage() thumbnail = doc:getCoverPageImage()
@@ -502,8 +509,6 @@ function Search:onMenuHold(item)
image_width = thumbwidth, image_width = thumbwidth,
image_height = thumbwidth/2*3 image_height = thumbwidth/2*3
}) })
end
end end
function Search:showresults() function Search:showresults()

View File

@@ -232,7 +232,8 @@ function ReaderDictionary:onUpdateDefaultDict(dict)
logger.dbg("make default dictionary:", dict) logger.dbg("make default dictionary:", dict)
self.default_dictionary = dict self.default_dictionary = dict
UIManager:show(InfoMessage:new{ 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, timeout = 2,
}) })
return true return true

View File

@@ -268,9 +268,7 @@ function MenuItem:onUnfocus()
end end
function MenuItem:onShowItemDetail() function MenuItem:onShowItemDetail()
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{ text = self.detail, })
text=self.detail,
})
return true return true
end end