1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibGUI+Userland: Make Dialog::ExecResult an enum class

This commit is contained in:
Sam Atkins 2022-05-13 13:10:27 +01:00 committed by Linus Groh
parent 1f82beded3
commit cdffe556c8
90 changed files with 232 additions and 232 deletions

View file

@ -59,7 +59,7 @@ CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet,
button_layout.add_spacer();
auto& ok_button = buttonbox.add<GUI::Button>("OK");
ok_button.set_fixed_width(80);
ok_button.on_click = [&](auto) { done(ExecOK); };
ok_button.on_click = [&](auto) { done(ExecResult::OK); };
}
Vector<String> const g_horizontal_alignments { "Left", "Center", "Right" };

View file

@ -257,7 +257,7 @@ Result<void, String> ExportDialog::make_and_run_for(StringView mime, Core::File&
wizard->replace_page(page.page());
auto result = wizard->exec();
if (result == GUI::Dialog::ExecResult::ExecOK) {
if (result == GUI::Dialog::ExecResult::OK) {
auto& writer = page.writer();
if (!writer.has_value())
return String { "CSV Export failed" };
@ -312,7 +312,7 @@ Result<void, String> ExportDialog::make_and_run_for(StringView mime, Core::File&
wizard->push_page(page);
if (wizard->exec() != GUI::Dialog::ExecResult::ExecOK)
if (wizard->exec() != GUI::Dialog::ExecResult::OK)
return String { "Export was cancelled" };
if (format_combo_box->selected_index() == 0)

View file

@ -187,7 +187,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W
wizard->replace_page(page.page());
auto result = wizard->exec();
if (result == GUI::Dialog::ExecResult::ExecOK) {
if (result == GUI::Dialog::ExecResult::OK) {
auto& reader = page.reader();
NonnullRefPtrVector<Sheet> sheets;
@ -265,7 +265,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W
wizard->push_page(page);
if (wizard->exec() != GUI::Dialog::ExecResult::ExecOK)
if (wizard->exec() != GUI::Dialog::ExecResult::OK)
return String { "Import was cancelled" };
if (format_combo_box->selected_index() == 0)

View file

@ -392,7 +392,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
}
auto dialog = CellTypeDialog::construct(positions, *m_sheet, window());
if (dialog->exec() == GUI::Dialog::ExecOK) {
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
for (auto& position : positions) {
auto& cell = m_sheet->ensure(position);
cell.set_type(dialog->type());

View file

@ -99,7 +99,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
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) {
if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecResult::OK) {
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);
@ -108,7 +108,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
m_tab_context_menu->add_action(*m_rename_action);
m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
String name;
if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecOK) {
if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecResult::OK) {
NonnullRefPtrVector<Sheet> new_sheets;
new_sheets.append(m_workbook->add_sheet(name));
setup_tabs(move(new_sheets));
@ -456,12 +456,12 @@ bool SpreadsheetWidget::request_close()
return true;
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), current_filename());
if (result == GUI::MessageBox::ExecYes) {
if (result == GUI::MessageBox::ExecResult::Yes) {
m_save_action->activate();
return !m_workbook->dirty();
}
if (result == GUI::MessageBox::ExecNo)
if (result == GUI::MessageBox::ExecResult::No)
return true;
return false;