1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:58:11 +00:00

Assistant: Enable escalation of commands that need it

Ideal for applications such as PartitionEditor. Previously an error
about how it needs to run as root was displayed which differed from
the behaviour when clicking from the system menus.

Use the new AppFile::spawn_with_escalation to perform the escalation
This commit is contained in:
Hugh Davenport 2024-01-05 17:24:11 +13:00 committed by Andreas Kling
parent 45c35267f6
commit bba53441ef
3 changed files with 21 additions and 20 deletions

View file

@ -205,7 +205,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!app_state.selected_index.has_value())
return;
lockfile.release();
app_state.results[app_state.selected_index.value()]->activate();
app_state.results[app_state.selected_index.value()]->activate(window);
GUI::Application::the()->quit();
};
text_box.on_up_pressed = [&]() {
@ -251,8 +251,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
match.set_icon(result->bitmap());
match.set_text(String::from_byte_string(result->title()).release_value_but_fixme_should_propagate_errors());
match.set_tooltip(result->tooltip());
match.on_click = [&result](auto) {
result->activate();
match.on_click = [&](auto) {
result->activate(window);
GUI::Application::the()->quit();
};
}