mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -55,7 +55,7 @@ function MassStorage:start(never_ask)
|
||||
|
||||
if not never_ask and self:requireConfirmation() then
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
UIManager:show(ConfirmBox:new{
|
||||
self.usbms_widget = ConfirmBox:new{
|
||||
text = _("Share storage via USB?"),
|
||||
ok_text = _("Share"),
|
||||
ok_callback = function()
|
||||
@@ -65,7 +65,12 @@ function MassStorage:start(never_ask)
|
||||
UIManager:broadcastEvent(Event:new("Close"))
|
||||
UIManager:quit()
|
||||
end,
|
||||
})
|
||||
cancel_callback = function()
|
||||
self:dismiss()
|
||||
end,
|
||||
}
|
||||
|
||||
UIManager:show(self.usbms_widget)
|
||||
else
|
||||
-- save settings before activating USBMS:
|
||||
UIManager:flushSettings()
|
||||
@@ -75,4 +80,14 @@ function MassStorage:start(never_ask)
|
||||
end
|
||||
end
|
||||
|
||||
-- Dismiss the ConfirmBox
|
||||
function MassStorage:dismiss()
|
||||
if not self.usbms_widget then
|
||||
return
|
||||
end
|
||||
|
||||
UIManager:close(self.usbms_widget)
|
||||
self.usbms_widget = nil
|
||||
end
|
||||
|
||||
return MassStorage
|
||||
|
||||
@@ -212,6 +212,10 @@ function UIManager:init()
|
||||
self:_afterNotCharging()
|
||||
if Device.screen_saver_mode then
|
||||
self:suspend()
|
||||
else
|
||||
-- Potentially dismiss the USBMS ConfirmBox
|
||||
local MassStorage = require("ui/elements/mass_storage")
|
||||
MassStorage:dismiss()
|
||||
end
|
||||
end
|
||||
self.event_handlers["__default__"] = function(input_event)
|
||||
@@ -366,6 +370,10 @@ function UIManager:init()
|
||||
self:_afterNotCharging()
|
||||
if Device.screen_saver_mode then
|
||||
self:suspend()
|
||||
else
|
||||
-- Potentially dismiss the USBMS ConfirmBox
|
||||
local MassStorage = require("ui/elements/mass_storage")
|
||||
MassStorage:dismiss()
|
||||
end
|
||||
end
|
||||
self.event_handlers["__default__"] = function(input_event)
|
||||
|
||||
Reference in New Issue
Block a user