mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-05 05:56:53 +03:00
Help: When opening a page, make sure it is selected in the tree view
This has to be called with a `deferred_invoke`, since on startup the tree view contains no data yet.
This commit is contained in:
parent
a5ecac5494
commit
3e73cfc08c
Notes:
sideshowbarker
2024-07-18 12:11:11 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/3e73cfc08cb Pull-request: https://github.com/SerenityOS/serenity/pull/8074 Reviewed-by: https://github.com/alimpfard ✅
@ -153,12 +153,18 @@ int main(int argc, char* argv[])
|
||||
auto url = URL::create_with_file_protocol(path);
|
||||
page_view.load_html(html, url);
|
||||
|
||||
auto tree_view_index = model->index_from_path(path);
|
||||
if (tree_view_index.has_value())
|
||||
tree_view.expand_tree(tree_view_index.value().parent());
|
||||
app->deferred_invoke([&, path](auto&) {
|
||||
auto tree_view_index = model->index_from_path(path);
|
||||
if (tree_view_index.has_value()) {
|
||||
tree_view.expand_tree(tree_view_index.value().parent());
|
||||
tree_view.selection().set(tree_view_index.value());
|
||||
|
||||
String page_and_section = model->page_and_section(tree_view_index.value());
|
||||
window->set_title(String::formatted("{} - Help", page_and_section));
|
||||
String page_and_section = model->page_and_section(tree_view_index.value());
|
||||
window->set_title(String::formatted("{} - Help", page_and_section));
|
||||
} else {
|
||||
window->set_title("Help");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
tree_view.on_selection_change = [&] {
|
||||
|
Loading…
Reference in New Issue
Block a user