1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:15:08 +00:00

Help: Make section books open and close when toggled

Much more satisfying!
This commit is contained in:
thankyouverycool 2020-07-07 07:19:30 -04:00 committed by Andreas Kling
parent cbf3c2caeb
commit d86dbfe9e8
6 changed files with 27 additions and 1 deletions

View file

@ -147,6 +147,7 @@ int main(int argc, char* argv[])
String path = model->page_path(tree_view.selection().first());
if (path.is_null()) {
page_view.set_document(nullptr);
window->set_title("Help");
return;
}
history.push(path);
@ -154,6 +155,10 @@ int main(int argc, char* argv[])
open_page(path);
};
tree_view.on_toggle = [&](const GUI::ModelIndex& index, const bool open) {
model->update_section_node_on_toggle(index, open);
};
page_view.on_link_click = [&](auto& url, auto&, unsigned) {
char* current_path = strdup(history.current().characters());
char* path = realpath(url.path().characters(), nullptr);