diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-04-16 10:29:16 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-04-25 02:16:48 -0600 |
commit | 2618639bdb947a479d7fae49d8daa25946603ed5 (patch) | |
tree | 7ea3114c330d036b64ad92fe9f8165891562ea0d | |
parent | 10700ca4c1cabe7889b0031bc01a3b18c68df77d (diff) | |
download | serenity-2618639bdb947a479d7fae49d8daa25946603ed5.zip |
Help: Ensure window title is updated when a subsection is selected
-rw-r--r-- | Userland/Applications/Help/ManualModel.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 1bd80035f6..770af30efd 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -56,10 +56,10 @@ Optional<String> ManualModel::page_name(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; - auto* node = static_cast<Manual::Node const*>(index.internal_data()); - if (!node->is_page()) + auto const* node = static_cast<Manual::Node const*>(index.internal_data()); + auto const* page = node->document(); + if (!page) return {}; - auto* page = static_cast<Manual::PageNode const*>(node); auto path = page->name(); if (path.is_error()) return {}; @@ -103,11 +103,12 @@ Optional<String> ManualModel::page_and_section(const GUI::ModelIndex& index) con { if (!index.is_valid()) return {}; - auto* node = static_cast<Manual::Node const*>(index.internal_data()); - if (!node->is_page()) + auto const* node = static_cast<Manual::Node const*>(index.internal_data()); + auto const* page = node->document(); + if (!page) return {}; - auto* page = static_cast<Manual::PageNode const*>(node); - auto* section = static_cast<Manual::SectionNode const*>(page->parent()); + + auto const* section = static_cast<Manual::SectionNode const*>(page->parent()); auto page_name = page->name(); if (page_name.is_error()) return {}; |