summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications/Spreadsheet')
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
index 95272b8fb2..936ab2542e 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
@@ -338,6 +338,21 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets)
m_tab_context_menu_sheet_view = static_cast<SpreadsheetView&>(widget);
m_tab_context_menu->popup(event.screen_position());
};
+
+ m_tab_widget->on_double_click = [&](auto& widget) {
+ m_tab_context_menu_sheet_view = static_cast<SpreadsheetView&>(widget);
+ VERIFY(m_tab_context_menu_sheet_view);
+
+ auto* sheet_ptr = m_tab_context_menu_sheet_view->sheet_if_available();
+ VERIFY(sheet_ptr); // How did we get here without a sheet?
+ auto& sheet = *sheet_ptr;
+ String new_name;
+ if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecOK) {
+ sheet.set_name(new_name);
+ sheet.update();
+ m_tab_widget->set_tab_title(static_cast<GUI::Widget&>(*m_tab_context_menu_sheet_view), new_name);
+ }
+ };
}
void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source, size_t cursor_offset)