LibGUI: Use the global setting to show dotfiles in FilePicker
`FilePicker` will now look at the global setting at startup. Note that changing this parameter inside `FilePicker` won't affect the global parameter.
This commit is contained in:
parent
af8b715aac
commit
8faed20603
Notes:
sideshowbarker
2024-07-17 05:02:42 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/8faed20603 Pull-request: https://github.com/SerenityOS/serenity/pull/17777
1 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibGUI/Action.h>
|
||||
|
@ -207,12 +208,17 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
m_context_menu->add_action(mkdir_action);
|
||||
m_context_menu->add_separator();
|
||||
|
||||
m_context_menu->add_action(GUI::Action::create_checkable(
|
||||
auto show_dotfiles = GUI::Action::create_checkable(
|
||||
"Show dotfiles", { Mod_Ctrl, Key_H }, [&](auto& action) {
|
||||
m_model->set_should_show_dotfiles(action.is_checked());
|
||||
m_model->invalidate();
|
||||
},
|
||||
this));
|
||||
this);
|
||||
auto show_dotfiles_preset = Config::read_bool("FileManager"sv, "DirectoryView"sv, "ShowDotFiles"sv, false);
|
||||
if (show_dotfiles_preset)
|
||||
show_dotfiles->activate();
|
||||
|
||||
m_context_menu->add_action(show_dotfiles);
|
||||
|
||||
m_view->on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
||||
if (!index.is_valid()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue