From 3c01ef1c2320647d9e1aadc995147690edce2444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filiph=20Sandstr=C3=B6m?= Date: Sat, 26 Feb 2022 04:15:44 +0100 Subject: Spreadsheet: Disable cut/copy if no cell is selected This resolves #12766 which occurred when the user tried to use either the cut or copy action before selecting a cell. --- Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 3396b695aa..a9928fbda6 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -237,6 +237,9 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe toolbar.add_action(*m_paste_action); toolbar.add_action(*m_undo_action); toolbar.add_action(*m_redo_action); + + m_cut_action->set_enabled(false); + m_copy_action->set_enabled(false); } void SpreadsheetWidget::resize_event(GUI::ResizeEvent& event) @@ -278,6 +281,8 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) m_cell_value_editor->on_focusout = nullptr; m_cell_value_editor->set_text(""); m_cell_value_editor->set_enabled(false); + m_cut_action->set_enabled(false); + m_copy_action->set_enabled(false); return; } @@ -299,6 +304,8 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) update(); }; m_cell_value_editor->set_enabled(true); + m_cut_action->set_enabled(true); + m_copy_action->set_enabled(true); static_cast(const_cast(m_cell_value_editor->syntax_highlighter()))->set_cell(&cell); return; } -- cgit v1.2.3