diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 9f62f95f4fa..26aab65b632 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2020-2022, Itamar S. + * Copyright (c) 2023-2024, Abhishek R. * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -866,6 +867,13 @@ ErrorOr> HackStudioWidget::create_remove_current_edit }); } +ErrorOr> HackStudioWidget::create_toggle_open_file_in_single_click_action() +{ + return GUI::Action::create_checkable("&Open File with Single Click", [this](auto&) { + m_project_tree_view->set_activates_on_selection(!m_project_tree_view->activates_on_selection()); + }); +} + ErrorOr> HackStudioWidget::create_open_action() { auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv)); @@ -1498,6 +1506,8 @@ ErrorOr HackStudioWidget::create_view_menu(GUI::Window& window) view_menu.add_action(show_dotfiles_action); m_toggle_semantic_highlighting_action = TRY(create_toggle_syntax_highlighting_mode_action()); view_menu.add_action(*m_toggle_semantic_highlighting_action); + m_toggle_view_file_in_single_click_action = TRY(create_toggle_open_file_in_single_click_action()); + view_menu.add_action(*m_toggle_view_file_in_single_click_action); view_menu.add_separator(); m_wrapping_mode_actions.set_exclusive(true); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index 04fcba54d82..42eb770f18e 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -113,6 +113,7 @@ private: NonnullRefPtr create_remove_current_editor_tab_widget_action(); ErrorOr> create_remove_current_editor_action(); ErrorOr> create_open_action(); + ErrorOr> create_toggle_open_file_in_single_click_action(); NonnullRefPtr create_save_action(); NonnullRefPtr create_save_as_action(); NonnullRefPtr create_show_in_file_manager_action(); @@ -247,6 +248,7 @@ private: RefPtr m_locations_history_back_action; RefPtr m_locations_history_forward_action; RefPtr m_toggle_semantic_highlighting_action; + RefPtr m_toggle_view_file_in_single_click_action; RefPtr m_open_project_configuration_action; RefPtr read_editor_font_from_config();