summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFiliph Sandström <filiph.sandstrom@filfatstudios.com>2022-02-26 04:15:44 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-26 10:36:27 +0100
commit3c01ef1c2320647d9e1aadc995147690edce2444 (patch)
treedcfd520e79db46df2cd5feece05c5c569b9a7b30
parentfe67fe3791aae240289890bf81cbfec2d551c0a8 (diff)
downloadserenity-3c01ef1c2320647d9e1aadc995147690edce2444.zip
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.
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp7
1 files changed, 7 insertions, 0 deletions
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<Sheet> 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<Sheet> new_sheets)
update();
};
m_cell_value_editor->set_enabled(true);
+ m_cut_action->set_enabled(true);
+ m_copy_action->set_enabled(true);
static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(&cell);
return;
}