From 8f2399caa9a73f685198a5f9be83569e53cf87c1 Mon Sep 17 00:00:00 2001 From: yparitcher Date: Sun, 5 Jul 2020 11:34:44 -0400 Subject: [PATCH] [fix] Allow default FM rotation on init when `Keep FM rotation` is disabled (#6348) --- frontend/apps/filemanager/filemanager.lua | 8 +++++--- reader.lua | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/apps/filemanager/filemanager.lua b/frontend/apps/filemanager/filemanager.lua index 60db22e8e..16a54c828 100644 --- a/frontend/apps/filemanager/filemanager.lua +++ b/frontend/apps/filemanager/filemanager.lua @@ -70,10 +70,12 @@ function FileManager:onSetRotationMode(rotation) return true end -function FileManager:setRotationMode() +-- init should be set to True when starting the FM for the first time +-- (not coming from the reader). This allows the default to be properly set. +function FileManager:setRotationMode(init) local locked = G_reader_settings:readSetting("lock_rotation") - local rotation_mode = G_reader_settings:readSetting("fm_rotation_mode") or 0 - if locked then + local rotation_mode = G_reader_settings:readSetting("fm_rotation_mode") or Screen.ORIENTATION_PORTRAIT + if locked or init then self:onSetRotationMode(rotation_mode) end end diff --git a/reader.lua b/reader.lua index 95369d223..9b49a9fcd 100755 --- a/reader.lua +++ b/reader.lua @@ -277,6 +277,7 @@ if ARGV[argidx] and ARGV[argidx] ~= "" then local home_dir = G_reader_settings:readSetting("home_dir") or ARGV[argidx] UIManager:nextTick(function() + FileManager:setRotationMode(true) FileManager:showFiles(home_dir) end) -- always open history on top of filemanager so closing history