mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
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
1 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
|
#include <LibConfig/Client.h>
|
||||||
#include <LibCore/DeprecatedFile.h>
|
#include <LibCore/DeprecatedFile.h>
|
||||||
#include <LibCore/StandardPaths.h>
|
#include <LibCore/StandardPaths.h>
|
||||||
#include <LibGUI/Action.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_action(mkdir_action);
|
||||||
m_context_menu->add_separator();
|
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) {
|
"Show dotfiles", { Mod_Ctrl, Key_H }, [&](auto& action) {
|
||||||
m_model->set_should_show_dotfiles(action.is_checked());
|
m_model->set_should_show_dotfiles(action.is_checked());
|
||||||
m_model->invalidate();
|
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) {
|
m_view->on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
||||||
if (!index.is_valid()) {
|
if (!index.is_valid()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue