mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Gestures/profiles: allow disabling popup messages (#14543)
This commit is contained in:
@@ -1207,6 +1207,7 @@ function Dispatcher:execute(settings, exec_props)
|
||||
local has_many = Dispatcher:_itemsCount(settings) > 1
|
||||
if has_many then
|
||||
UIManager:broadcastEvent(Event:new("BatchedUpdate"))
|
||||
UIManager:setSilentMode(true)
|
||||
end
|
||||
Notification:setNotifySource(Notification.SOURCE_DISPATCHER)
|
||||
if settings.settings and settings.settings.notify then
|
||||
@@ -1253,6 +1254,7 @@ function Dispatcher:execute(settings, exec_props)
|
||||
end
|
||||
Notification:resetNotifySource()
|
||||
if has_many then
|
||||
UIManager:setSilentMode(false)
|
||||
UIManager:broadcastEvent(Event:new("BatchedUpdateDone"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -124,6 +124,14 @@ function UIManager:setIgnoreTouchInput(state)
|
||||
InputContainer:setIgnoreTouchInput(state)
|
||||
end
|
||||
|
||||
function UIManager:setSilentMode(toggle)
|
||||
self.silent_mode = toggle or nil
|
||||
end
|
||||
|
||||
function UIManager:isInSilentMode()
|
||||
return self.silent_mode or false
|
||||
end
|
||||
|
||||
--[[--
|
||||
Registers and shows a widget.
|
||||
|
||||
@@ -150,6 +158,10 @@ function UIManager:show(widget, refreshtype, refreshregion, x, y, refreshdither)
|
||||
logger.dbg("attempted to show a nil widget")
|
||||
return
|
||||
end
|
||||
if self.silent_mode and widget.honor_silent_mode then
|
||||
logger.dbg("widget show disabled:", widget.id or widget.name or tostring(widget))
|
||||
return
|
||||
end
|
||||
logger.dbg("show widget:", widget.id or widget.name or tostring(widget))
|
||||
|
||||
local window = {x = x or 0, y = y or 0, widget = widget}
|
||||
|
||||
@@ -46,6 +46,7 @@ local Screen = Device.screen
|
||||
|
||||
local InfoMessage = InputContainer:extend{
|
||||
modal = true,
|
||||
honor_silent_mode = true,
|
||||
face = nil,
|
||||
monospace_font = false,
|
||||
text = "",
|
||||
|
||||
@@ -107,16 +107,21 @@ function MoveToArchive:onMoveToArchive(do_copy)
|
||||
require("readcollection"):updateItem(document_full_path, dest_file)
|
||||
end
|
||||
DocSettings.updateLocation(document_full_path, dest_file, do_copy)
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = text,
|
||||
ok_callback = function()
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
ReaderUI:showReader(dest_file)
|
||||
end,
|
||||
cancel_callback = function()
|
||||
self:openFileBrowser(self.last_copied_from_dir)
|
||||
end,
|
||||
})
|
||||
if UIManager:isInSilentMode() then
|
||||
-- no dialog to allow multi-action executing
|
||||
self:openFileBrowser(self.last_copied_from_dir)
|
||||
else
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = text,
|
||||
ok_callback = function()
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
ReaderUI:showReader(dest_file)
|
||||
end,
|
||||
cancel_callback = function()
|
||||
self:openFileBrowser(self.last_copied_from_dir)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function MoveToArchive:setArchiveDirectory()
|
||||
|
||||
Reference in New Issue
Block a user