summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-02-27 11:40:55 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-03-03 22:19:50 +0330
commit20dbbdf90c271a948a7cf809227d9998424b8424 (patch)
tree8b1864781185029003756587a18a9417c9504588 /Userland/Applications
parentf384aff5104d596ce9a600db22b9a595e96e1721 (diff)
downloadserenity-20dbbdf90c271a948a7cf809227d9998424b8424.zip
Spreadsheet: Simplify enabling actions on selection
Since the function will *always* be called with some selection, we can straight up enable actions.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
index 746ff3b2b3..733f8b5187 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
@@ -274,10 +274,13 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets)
auto& sheet = *sheet_ptr;
VERIFY(!selection.is_empty());
+ m_cut_action->set_enabled(true);
+ m_copy_action->set_enabled(true);
+ m_current_cell_label->set_enabled(true);
+ m_cell_value_editor->set_enabled(true);
if (selection.size() == 1) {
auto& position = selection.first();
- m_current_cell_label->set_enabled(true);
m_current_cell_label->set_text(position.to_cell_identifier(sheet));
auto& cell = sheet.ensure(position);
@@ -292,9 +295,6 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets)
sheet.update();
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;
}
@@ -302,7 +302,6 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets)
// There are many cells selected, change all of them.
StringBuilder builder;
builder.appendff("<{}>", selection.size());
- m_current_cell_label->set_enabled(true);
m_current_cell_label->set_text(builder.string_view());
Vector<Cell&> cells;
@@ -331,7 +330,6 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets)
update();
}
};
- m_cell_value_editor->set_enabled(true);
static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(&first_cell);
};
m_selected_view->on_selection_dropped = [&]() {