mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Language: improve confirmboxes
Generic "OK" buttons should be avoided. Thanks to @lightonflux for pointing this out https://github.com/koreader/koreader/issues/2555#issuecomment-291039945
This commit is contained in:
committed by
Qingping Hou
parent
b076ca1c29
commit
1c25d0fd1b
@@ -196,6 +196,7 @@ function FileManager:init()
|
||||
UIManager:close(self.file_dialog)
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Are you sure that you want to delete this file?\n") .. file .. ("\n") .. _("If you delete a file, it is permanently lost."),
|
||||
ok_text = _("Delete"),
|
||||
ok_callback = function()
|
||||
local autoremove_deleted_items_from_history = G_reader_settings:readSetting("autoremove_deleted_items_from_history") or false
|
||||
local file_abs_path = util.realpath(file)
|
||||
@@ -220,18 +221,18 @@ function FileManager:init()
|
||||
input = util.basename(file),
|
||||
buttons = {{
|
||||
{
|
||||
text = _("OK"),
|
||||
text = _("Cancel"),
|
||||
enabled = true,
|
||||
callback = function()
|
||||
renameFile(file)
|
||||
self:refreshPath()
|
||||
UIManager:close(fileManager.rename_dialog)
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Cancel"),
|
||||
text = _("Rename"),
|
||||
enabled = true,
|
||||
callback = function()
|
||||
renameFile(file)
|
||||
self:refreshPath()
|
||||
UIManager:close(fileManager.rename_dialog)
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -39,6 +39,7 @@ function NetworkMgr:restoreWifiAsync() end
|
||||
function NetworkMgr:promptWifiOn(complete_callback)
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Do you want to turn on Wi-Fi?"),
|
||||
ok_text = _("Turn on"),
|
||||
ok_callback = function()
|
||||
self.wifi_was_on = true
|
||||
G_reader_settings:saveSetting("wifi_was_on", true)
|
||||
@@ -50,6 +51,7 @@ end
|
||||
function NetworkMgr:promptWifiOff(complete_callback)
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Do you want to turn off Wi-Fi?"),
|
||||
ok_text = _("Turn off"),
|
||||
ok_callback = function()
|
||||
self.wifi_was_on = false
|
||||
G_reader_settings:saveSetting("wifi_was_on", false)
|
||||
@@ -160,7 +162,7 @@ function NetworkMgr:getInfoMenuTable()
|
||||
})
|
||||
else
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Cannot retrieve network info"),
|
||||
text = _("Could not retrieve network info."),
|
||||
timeout = 3,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -145,6 +145,7 @@ function OTAManager:fetchAndProcessUpdate()
|
||||
local_version,
|
||||
ota_version
|
||||
),
|
||||
ok_text = _("Update"),
|
||||
ok_callback = function()
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Downloading may take several minutes…"),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--[[--
|
||||
Widget that shows a message and OK/Cancel buttons
|
||||
Widget that shows a confirmation alert with a message and Cancel/OK buttons
|
||||
|
||||
Example:
|
||||
|
||||
@@ -11,6 +11,10 @@ Example:
|
||||
end,
|
||||
})
|
||||
|
||||
It is strongly recommended to set a custom `ok_text` describing the action to be
|
||||
confirmed, as demonstrated in the example above. No ok_text should be specified
|
||||
if the resulting phrase would be longer than three words.
|
||||
|
||||
]]
|
||||
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
|
||||
@@ -37,6 +37,14 @@ Example:
|
||||
sample_input:onShowKeyboard()
|
||||
UIManager:show(sample_input)
|
||||
|
||||
If it would take the user more than half a minute to recover from a mistake,
|
||||
a "Cancel" button <em>must</em> be added to the dialog. The cancellation button
|
||||
should be kept on the left and the button executing the action on the right.
|
||||
|
||||
It is strongly recommended to use a text describing the action to be
|
||||
executed, as demonstrated in the example above. If the resulting phrase would be
|
||||
longer than three words it should just read "OK".
|
||||
|
||||
]]
|
||||
|
||||
local Blitbuffer = require("ffi/blitbuffer")
|
||||
|
||||
Reference in New Issue
Block a user